window.parent.name = 'launcher';

var currentColour = '';
var currentMountImage = '';
var currentFrameImage = '';

function ShippingSameAsBilling( object )
{	
	//assume object is a check box
	if ( object.checked ) 
	{
		window.document.getElementById('tbNameShipping').value = window.document.getElementById('tbFirstname').value + ' ' + window.document.getElementById('tbLastname').value;
		window.document.getElementById('tbAddressLine1Shipping').value = window.document.getElementById('tbAddressLine1Billing').value;
		window.document.getElementById('tbAddressLine2Shipping').value = window.document.getElementById('tbAddressLine2Billing').value;
		window.document.getElementById('tbTownShipping').value = window.document.getElementById('tbTownBilling').value;
		window.document.getElementById('tbPostcodeShipping').value = window.document.getElementById('tbPostcodeBilling').value;
		window.document.getElementById('ddlCountyShipping').value = window.document.getElementById('ddlCountyBilling').value;
	}
	else 
	{
		window.document.getElementById('tbAddressLine1Shipping').value = '';
		window.document.getElementById('tbAddressLine2Shipping').value = '';
		window.document.getElementById('tbTownShipping').value = '';
		window.document.getElementById('tbPostcodeShipping').value = '';
		window.document.getElementById('tbCountyShipping').value = 0;
	}

}

function swapColour(object) 
{
	//save the colour	
	currentColour = window.document.getElementById('pnlLargeBackgroundColour').style.backgroundColor;	
	
	//set the colour to that passed in
	window.document.getElementById('pnlLargeBackgroundColour').style.backgroundColor = object.style.backgroundColor;
}

function restoreColour () 
{
	window.document.getElementById('pnlLargeBackgroundColour').style.backgroundColor = currentColour;pnlCentreImage
}

function swapMountColour(object) 
{
	//save the colour	
	currentColour = window.document.getElementById('pnlLargeBackgroundColour').style.backgroundColor;	
	//set the colour to that passed in
	window.document.getElementById('pnlLargeBackgroundColour').style.backgroundColor = object.style.backgroundColor;
}
function restoreMountColour () 
{
	window.document.getElementById('pnlCentreImage').style.backgroundColor = currentColour;
}

function swapMountImage (object) 
{	
	currentMountImage = window.document.getElementById('imgSelectedFrameLarge').src;
	window.document.getElementById('imgSelectedFrameLarge').src = object.src;
	window.document.getElementById('lblEnlargedImage').innerHTML = "Enlarged Mount Image:";
	window.document.getElementById('EnlargeLinkDiv').style.visibility = "hidden"; //This is the information link
}

function restoreMountImage () 
{	
	window.document.getElementById('imgSelectedFrameLarge').src = currentMountImage;
	window.document.getElementById('lblEnlargedImage').innerHTML  = "Enlarged Frame Image:";
	window.document.getElementById('EnlargeLinkDiv').style.visibility = "visible"; //This is the information link
}

function searchValidateRemove(object)
{
	if(object.value.length > 2)
	{
		try
		{

			window.document.getElementById('Header1_lblSearchError').innerText = "";
		}
		catch(err)
		{}
	}
}

function popupWhatIsThis(value)
{
	oNewWindow = window.open(value, 'tinyWindow', 'toolbar,width=351,height=192');
}

function swapFrameImage (object) 
{
	currentFrameImage = window.document.getElementById('imgSelectedFrameLarge').src;
	window.document.getElementById('imgSelectedFrameLarge').src = object.src;
}

function removeTextIfPresent (object, text) 
{
	if ( object.value == text ) {
		object.value = '';
	}
}

function restoreFrameImage () 
{
	window.document.getElementById('imgSelectedFrameLarge').src = currentFrameImage;
}

function SetBlankImage(oImg,sImageName)
{
	oImg.onerror = null;
	oImg.src = '/Images/' + sImageName;
}

// WINDOW OPENER

function openWindow(winURL,winName,features) {
  window.open(winURL,winName,features);
}


// IMAGE SWAPPER


if (document.images)
{

A1 = new Image (65,9);A1.src = "/images/b-my_account_lo.gif";
A2 = new Image (65,9);A2.src = "/images/b-my_account_hi.gif";
B1 = new Image (65,9);B1.src = "/images/b-basket_lo.gif";
B2 = new Image (65,9);B2.src = "/images/b-basket_hi.gif";
C1 = new Image (15,13);C1.src = "/images/dot.gif";
C2 = new Image (15,13);C2.src = "/images/mini_heart.gif";


}

function hiLite(imgDocID,imgObjName) {
	document.images[imgDocID].src = eval(imgObjName + ".src")


}

function checkCookie()
{
	var cookievalue,returnvalue;
	returnvalue = true;
	document.cookie = 'cookiename=test';	//set test cookie
	cookievalue = document.cookie;			//read test cookie
	if (cookievalue == '')
	{
		returnvalue = false;
		//document.location="/cookies.aspx";
		//window.open('/cookies.aspx','Cookies','top=10,width=350,height=300');
	}
	else
	{	//already cookies there, but are they old ones?
		//alert(cookievalue);
		if (document.cookie.indexOf('cookiename=test') == -1)
		{
			returnvalue = false;
			//document.location="/cookies.aspx";
			//window.open('/cookies.aspx','Cookies','top=10,width=350,height=300');
		}
	}
	return returnvalue;
}

function popUp(URL) 
{
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=600,left = 240,top = 212');");
}


/*
function hideDeliveryAddress() 
{
	document.getElementById('DeliveryAddressFields').style.visibility = 'hidden';
}

function showDeliveryAddress()
{
	document.getElementById('DifferentDeliveryAddress').style.visibility = 'hidden';
	document.getElementById('DifferentDeliveryAddress').style.display = 'none';
	document.getElementById('btnRegister').style.visibility = 'hidden';
	document.getElementById('DeliveryAddressFields').style.visibility = 'visible';
	document.getElementById('rfvNameShipping').disabled = false;
	document.getElementById('btnRegister2').disabled = true;
	
	
}
*/