﻿if (top.frames.length != 0) {
  if (window.location.href.replace)
    top.location.replace(self.location.href);
  else
    top.location.href = self.document.href;
}

function hideSiteWarning() {
  $('#siteWarning').slideUp('normal');
  SetCookie("siteWarning", "1", 1);
}

function hideUKPostage() {
  $('#ukpostage').slideUp('normal');
  SetCookie("ukpostage", "1", 1);
}

function SetCookie(cookieName, cookieValue, nDays) {
  var today = new Date();
  var expire = new Date();
  if (nDays == null || nDays == 0) nDays = 1;
  expire.setTime(today.getTime() + 3600000 * 24 * nDays);
  document.cookie = cookieName + "=" + escape(cookieValue) + ";expires=" + expire.toGMTString();
}

function ReadCookie(cookieName) {
  var theCookie = "" + document.cookie;
  var ind = theCookie.indexOf(cookieName);
  if (ind == -1 || cookieName == "") return "";
  var ind1 = theCookie.indexOf(';', ind);
  if (ind1 == -1) ind1 = theCookie.length;
  return unescape(theCookie.substring(ind + cookieName.length + 1, ind1));
}
function showSearchBox() {
  if ($('#topNavSearch').css('display') == 'none') {
    $('#topNavSearch').slideDown('normal');
  } else {
    $('#topNavSearch').slideUp('normal');
  }
}

$(document).ready(function() {
	if ($('#sli_search_1').val() == 'Search'){
		$('#sli_search_1').css('color','#e8e2cf');
	}
  $('.topNavSearch').click(function(){
    if ($(this).val() == 'Search') {
      $(this).val('').css('color', '#868379');
    }
  });
  $('.topNavSearch').blur(function(){
    if ($(this).val() == '') {
      $(this).val('Search').css('color', '#e8e2cf');
    }
  });
  $('#currentCountry').click(function(){
    $('#countryList').slideDown('normal');
  });
  $('#countryList').mouseleave(function(){
    $(this).delay(500, function() {
      $('#countryList').slideUp('normal');
    });
  });
  $('.topNavSearchGo').click(function(){
    if ($('.topNavSearch').val() != '' && $('.topNavSearch').val() != 'Search') {
      $('#searchform').submit();
    } else {
      alert('Please enter search terms');
    }
  })
  $('#scope').change(function(){
	  $('#scopeParam').val($(this).val());
  });
});


