<!-- Begin

function theflash(movie, width, height) {
	
	movieLocal = movie.replace("'", "%27");
				
	document.writeln('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + width + '" height="' + height + '">');
    document.writeln('<param name="movie" value="' + movieLocal + '">');
	document.writeln('<param name="quality" value="high" />');
	document.writeln('<param name="menu" value="false">');
	document.writeln('<param name="wmode" value="transparent">');
	document.writeln('<embed src="' + movieLocal + '" width="' + width + '" height="' + height + '" quality="high" pluginspage="https://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false" wmode="transparent"></embed>');
    document.writeln('</object>');
}

		function load() {
		if (GBrowserIsCompatible()) {
			var map = new GMap2(document.getElementById("map"));
			var htmlforgmap = "<h3>Fortnum&nbsp;&amp;&nbsp;Mason</h3><p>181 Piccadilly, London</p><p>W1A 1ER</p>";
			map.addControl(new GSmallMapControl());
			map.setCenter(new GLatLng(51.517556, -0.134228), 14);
			map.openInfoWindowHtml(map.getCenter(), htmlforgmap);
		}
		}

document.onmousedown=disableclick;

function disableclick(e)
{
   if(event.button==2)
   {
     return false;	
   }
   return true;
}
// End -->


function g_processSearch (input) { 
                    if ((input != null) &&
			(input.value != "") &&
			(input.value != "Search:")) { 
                         location.href="/search/default.aspx?txtSearch="+input.value; 
                    } 
		    else
{
	input.value = "Search:";
}
               }

			
function checkEnter(e,str,btn){ //e is event object passed from function invocation
				//alert(str.name);
								
				if (btn==1){
					location.href="/search/default.aspx?txtSearch="+str.value;
				}
				else{
				var pstrsearch;
					if (str.name=="txtSearchGlobal"){
						pstrsearch=str.value;
					}
					else {
						if (str.name=="UserControlSearch:search"){
							pstrsearch=str.value;
						}
					}
					
					if (pstrsearch!=""){
						var characterCode; // literal character code will be stored in this variable
						if(e && e.which){ //if which property of event object is supported (NN4)
						e = e;
						characterCode = e.which; //character code is contained in NN4's which property
						}
						else{
						e = event;
						characterCode = e.keyCode; //character code is contained in IE's keyCode property
						}

						if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
						//location.href="/search/default.aspx?strSearch="+document.forms[0].txtSearchGlobal.value;
						       
						location.href="/search/default.aspx?txtSearch="+pstrsearch;
						return false; 
						}			
						else{
						return true; 
						}
					}
				}
				}

function CheckEnterKey(event, origin)
{

	if (event.keyCode == 13) 
	{ 					
		if (origin == 'SEARCHDIV')		
		{			
			__doPostBack('UserControlSearchDiv$btnSearch','');
		}
		else
		{
			__doPostBack('UserControlSearch$btnSearch','');
		}
						
	}			
}

function displayBlock(objId, blnVisible){
	var element = document.getElementById(objId);
	if(blnVisible){
		element.style.display = "block";
	}
	else{
		element.style.display = "none";
	}
}

function ShowLoginDiv() 
{
	HideSearchDiv();
	HideProductBasketDiv();
	
	if (document.getElementById("LoginControl") != null)
	{
		if (document.getElementById("LoginControl").className == "divLoginShow")
		{
			document.getElementById("LoginControl").className = "divLoginHide";
		}
		else
		{
			document.getElementById("LoginControl").className = "divLoginShow";
			 document.getElementById("signin").className = "lnkSignSel";
		}
	}
}
		
function HideLoginDiv() 
{
	if (document.getElementById("LoginControl") != null)
	{
		document.getElementById("LoginControl").className = "divLoginHide";			
	}
}

function ShowSearchDiv() 
{
	HideLoginDiv();
	HideProductBasketDiv();
	
	if (document.getElementById("SearchControl") != null)
	{
		if (document.getElementById("SearchControl").className == "divLoginShow")
		{
			document.getElementById("SearchControl").className = "divLoginHide";
		}
		else
		{
			document.getElementById("SearchControl").className = "divLoginShow";
		}
	}
}
		
function HideSearchDiv() 
{
	if (document.getElementById("SearchControl") != null)
	{
		document.getElementById("SearchControl").className = "divLoginHide";			
	}
	if (document.getElementById("SearchControlPage") != null)
	{
		document.getElementById("SearchControlPage").className = "divLoginHide";			
	}
}

function ShowProductBasketDiv() 
{
	HideLoginDiv();
	HideSearchDiv();
	
	if (document.getElementById("ProductBasketControl") != null)
	{
		if (document.getElementById("ProductBasketControl").className == "divLoginShow")
		{
			document.getElementById("ProductBasketControl").className = "divLoginHide";
		}
		else
		{
			document.getElementById("ProductBasketControl").className = "divLoginShow";
		}
	}
}
		
function HideProductBasketDiv() 
{
	if (document.getElementById("ProductBasketControl") != null)
	{
		document.getElementById("ProductBasketControl").className = "divLoginHide";			
	}	
}

function ShowNotesOldUsers()
{
document.getElementById('LoginNotesOldUsers').style.display = 'block';	

}

function ShowSplitter() 
{
	if (document.getElementById("Splitter") != null)
	{
		if (document.getElementById("Splitter").className == "divLoginShow")
		{
			document.getElementById("Splitter").className = "divLoginHide";
		}
		else
		{
			document.getElementById("Splitter").className = "divLoginShow";
		}
	}
}

function HideSplitter() 
{
	if (document.getElementById("Splitter") != null)
	{
		document.getElementById("Splitter").className = "divLoginHide";			
	}	
}

function GoToBasket()
{
	urlToNavigate = "http://" + window.location.host + "/basket/";
	
	if (window.location.href.indexOf("ShoppingUrl") == -1)
	{
		 urlToNavigate = urlToNavigate + "?ShoppingUrl=" + window.location.href;
	}
	
	if (urlToNavigate.indexOf("itemsToAdd") >= 0)
	{
		urlToNavigate = urlToNavigate.substr(0, urlToNavigate.indexOf("itemsToAdd"));
	}
	window.location = urlToNavigate;
}

function RemoveItem()
{
	window.location = window.location.href + "&remove=true";
}

function ShowAddMultipleRecipients() 
{
	if (document.getElementById("PanelMultipleRecipients") != null)
	{
		document.getElementById("PanelMultipleRecipients").className = "divLoginShow";			
	}	
	
	if (document.getElementById("UserControlBasketView_PanelAddressNew") != null)
	{
		document.getElementById("UserControlBasketView_PanelAddressNew").className = "divLoginHide";			
	}	
}

function HideAddMultipleRecipients() 
{
	if (document.getElementById("PanelMultipleRecipients") != null)
	{
		document.getElementById("PanelMultipleRecipients").className = "divLoginHide";			
	}	
}

function ShowPanelMultipleAddresses() 
{
	if (document.getElementById("TextBoxMultipleAddresses") != null)
	{
		if ((document.getElementById("TextBoxMultipleAddresses").value != null) &&
			(document.getElementById("TextBoxMultipleAddresses").value != ""))
		{
			window.location = window.location.href + "?itemsToAdd=" + document.getElementById("TextBoxMultipleAddresses").value;
			
			document.getElementById("UserControlBasketView_PanelBasket").className = "divLoginHide";
			document.getElementById("UserControlBasketView_PanelMultipleAddresses").className = "divLoginShow";
		}
	}	
}



n = (document.layers) ? 1:0
ie = (document.all) ? 1:0

function init() {
	slideoutActive = 0
	
	slideout1			= document.getElementById('DivLogin');
	slideout2			= document.getElementById('DivSearch');
	slideoutShown		= "none";	
	slideoutShown.xpos	= 0;
	slideoutNew			= "none";			
	slideoutNew.xpos	= -285;
}


function slideout(which) 
{
	if (!slideoutActive && slideoutShown != which) 
	{
		slideoutActive = 1;
		slideoutNew = which;
		slideoutNew.xpos = -285;
		slideoutLeft();
	}
}


function slideoutLeft() 
{
	if (slideoutShown.xpos > -285) {
		slideoutShown.xpos -= 15
		slideoutShown.left = slideoutShown.xpos
		setTimeout("slideoutLeft()",50)
	}
	else {
		hide(slideoutShown)
		show(slideoutNew)
		setTimeout("slideoutRight()",50)
	}
}


function slideoutRight() {
	if (slideoutNew.xpos < 0) {
		slideoutNew.xpos += 15
		slideoutNew.left = slideoutNew.xpos
		setTimeout("slideoutRight()",50)
	}
	else {
		slideoutShown = slideoutNew
		slideoutActive = 0  // stops the sequence
	}
}


function show(showobj) {
	if (n) showobj.visibility = "show";
	if (ie) showobj.visibility = "visible";
}
function hide(hideobj) {
	if (n) hideobj.visibility = "hide";
	if (ie) hideobj.visibility = "hidden";
}

function ShowHideShippingCountryDdl()
{
	divShippingCountryDdl = document.getElementById('divShippingChooseCountry');
	
	if (divShippingCountryDdl.style.display == 'block')
	{
		divShippingCountryDdl.style.display = 'none';
		document.getElementById('PanelShippingAddressQAS').style.display = 'none';
	}
	else
	{
		divShippingCountryDdl.style.display = 'block';
	}
}

function ShowLoadingFunction()
{
	divPleasewaitScreen = document.getElementById('pleasewaitScreen');
	divPleasewaitScreen.style.pixelTop = (document.body.scrollTop + 50);
	divPleasewaitScreen.style.visibility="visible";	
}

//function to validate the controls in the Payment Process Control (for IE and in conjunction with the following function too)
function ValidateControl(ControlId)
{	
	//Default End Date for all cards except Switch
	if ((ControlId == 'DropDownListExpiryMonth') || (ControlId == 'DropDownListExpiryYear'))
	{
		document.getElementById("DropDownListExpiryDiv").className = "formBlock";
		
		ValidateControl2('DropDownListExpiryMonth');
		ValidateControl2('DropDownListExpiryYear');
	}
	//Start date for Switch
	else if ((ControlId == 'DropDownListSwichStartMonth') || (ControlId == 'DropDownListSwichStartYear'))
	{
		ValidateControl2('DropDownListSwichStartMonth');
		ValidateControl2('DropDownListSwichStartYear');
	}
	//End date for Switch
	else if ((ControlId == 'DropDownListSwichEndMonth') || (ControlId == 'DropDownListSwichEndYear'))
	{
		document.getElementById("DropDownListSwichEndDiv").className = "formBlock";
		ValidateControl2('DropDownListSwichEndMonth');
		ValidateControl2('DropDownListSwichEndYear');
	}
	//All other validators
	else
	{	
		document.getElementById(ControlId + "Div").className = "formBlock";
		ValidateControl2(ControlId);		
	}	
}

//called by the function above
function ValidateControl2(ControlId)
{
	var i;
	checkOutControlId	= "UserControlCheckout_" + ControlId;
	newAddressControlId	= "ProfileAddressBookNewAddress1__ctl0_" + ControlId;
	personalDetailsId	= "UserControlProfilePersonalDetails_" + ControlId;
	profileAddressId	= "UserControlProfileAddressBook_" + ControlId;
	RegisterId			= "UserControlRegister_" + ControlId;
	
	for (i = 0; i < Page_Validators.length; i++) 
	{
	
		if(Page_Validators[i].controltovalidate == checkOutControlId || Page_Validators[i].controltovalidate == newAddressControlId 
		|| Page_Validators[i].controltovalidate == personalDetailsId || Page_Validators[i].controltovalidate == profileAddressId
		|| Page_Validators[i].controltovalidate == RegisterId)
		{
			if(!Page_Validators[i].isvalid)
			{

				//End date for all cards except Switch
				if ((ControlId == 'DropDownListExpiryMonth') || (ControlId == 'DropDownListExpiryYear'))
					document.getElementById("DropDownListExpiryDiv").className = "formBlockError";
				//Start Switch
				else if ((ControlId == 'DropDownListSwichStartMonth') || (ControlId == 'DropDownListSwichStartYear'))
					document.getElementById("DropDownListSwichStartDiv").className = "formBlockError";
				//End Switch
				else if ((ControlId == 'DropDownListSwichEndMonth') || (ControlId == 'DropDownListSwichEndYear'))
					document.getElementById("DropDownListSwichEndDiv").className = "formBlockError";
				else
					document.getElementById(ControlId + "Div").className = "formBlockError";
				
				break;
			}
			else
			{
				if (ControlId == "txtRecipientName")
				{
					if (document.getElementById(newAddressControlId).value == "")
					{					
						document.getElementById(ControlId + "Div").className = "formBlockError";
					}
				}
				if (Page_Validators[i].controltovalidate == RegisterId)
				{
					document.getElementById(ControlId + "Div").className = "formBlock";
				}
			
			}				
		}		
	}		
}

function SetBackground(Prefix, ControlId)
{
	_prefix = Prefix;
	
	document.getElementById(ControlId + "Div").className = "formBlock";

	if (document.getElementById(Prefix + ControlId) == null)
	{
		if (Prefix == 'ProfileAddressBookNewAddress1__ctl0_')
		{
			_prefix = 'UserControlBasketView_ProfileAddressBookNewAddress1__ctl0_';
		}
	}

	textBoxValue = document.getElementById(_prefix + ControlId).value;
	
	if (textBoxValue.length > 0)
	{
		document.getElementById(ControlId + "Div").className = "formBlock";
	}
	else
	{
		if (ControlId == 'txtBillingCounty') 
		{
			if ((document.getElementById('UserControlRegister_ddlBillingChooseCountry').value == 'US') ||
			    (document.getElementById('UserControlRegister_ddlBillingChooseCountry').value == 'CA'))
			{
			
				document.getElementById(ControlId + "Div").className = "formBlockError";
			}
			else
			{
			
				document.getElementById(ControlId + "Div").className = "formBlock";
			}
		}
		else
		{
			document.getElementById(ControlId + "Div").className = "formBlockError";
		}
	}
	
}

function SetBackground2(Prefix, ControlId, DivId)
{
	document.getElementById(DivId).className = "formBlock";

	textBoxValue = document.getElementById(Prefix + ControlId).value;
	
	if (textBoxValue.length > 0)
	{
		document.getElementById(DivId).className = "formBlock";
	}
	else
	{
		document.getElementById(DivId).className = "formBlockError";
	}
}

function SetBackgroundMultipleRec(Control, DivID)
{
	if (Control.value.length > 0)
	{
		document.getElementById(DivID).className = "formBlock";
	}
	else
	{
		document.getElementById(DivID).className = "formBlockError";
	}

	
}

function ValidatorFocus()
{

	var i;
    for (i = 0; i < Page_Validators.length; i++) 
    {
        if (Page_Validators[i].controltovalidate == "TextBoxCcNumber") 
        {
            //document.getElementById(Page_Validators[i].controltovalidate + "Div").className = "formBlockError";
            if(!Page_Validators[i].isvalid)
            {
				document.getElementById("TextBoxCcNumberDiv").className = "formBlockError";
            
				break;
			}
			else
			{
				//document.getElementById(Page_Validators[i].controltovalidate + "Div").className = "formBlock";
				document.getElementById("TextBoxCcNumberDiv").className = "formBlock";
				break;
			}
		}
    }
}




function UnselectAddressBookLinks()
{
	link1 = document.getElementById('AddressBookDefault');	
	link1.className ="subItem";
	
	link2 = document.getElementById('AddressBookAddNewRec');	
	link2.className ="subItem";
	
	link3 = document.getElementById('AddressBookMultipleRecipients');	
	link3.className ="subItem";
}

function SelectAddressBookDefaultLink()
{
	UnselectAddressBookLinks();
	
	link = document.getElementById('AddressBookDefault');	
	link.className ="subItemSel";
}

function SelectAddressBookAddNewRecLink()
{
	UnselectAddressBookLinks();
	
	link = document.getElementById('AddressBookAddNewRec');	
	link.className ="subItemSel";
}

function SelectAddressBookMultipleRecipientsLink()
{
	UnselectAddressBookLinks();
	
	link = document.getElementById('AddressBookMultipleRecipients');	
	link.className ="subItemSel";
}