/* currency component */
	
	function readCookie(name)
	{
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++)
		{
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	}
	

	function initCurrency()
	{
		//set the currency
		if(document.formCurrency)
		{
			if(document.formCurrency.currency)
			{
				var fCurrency = document.formCurrency;
	
				currSelected = readCookie('CurrSelected');
	
				
				for(i=0; i<fCurrency.currency.length; i++)	
				{
					//alert(fCurrency.currency.options[i].value)
	
					if(fCurrency.currency.options[i].value == currSelected )
					{
						fCurrency.currency.options[i].selected = true;
					}
				}
	
			}
	
			//disable the currency control, when these pages are encountered.
			/*
				i. addressRegister.asp
				ii. addressBilling.asp
				iii. 
			*/
				
			if(
					(document.location.href.indexOf('addressRegister.asp') >= 0) ||
					(document.location.href.indexOf('addressBilling.asp') >= 0) ||
					(document.location.href.indexOf('addressBook.asp') >= 0) ||
					(document.location.href.indexOf('addressShipping.asp') >= 0) ||
					(document.location.href.indexOf('shipping.asp') >= 0) ||
					(document.location.href.indexOf('orderSummary.asp') >= 0) ||
					(document.location.href.indexOf('payment.asp') >= 0) ||
					(document.location.href.indexOf('thankyou.asp') >= 0) ||
					(document.location.href.indexOf('cancelpayment.asp') >= 0) 
				)
			{
				if(document.formCurrency.currency)
				{
		
					var objCurrency = eval('document.formCurrency.currency')
					objCurrency.disabled = true;
				}
			}
		}
	}


function VerifyFormNewsletter()
{
	var f = document.formNewsletter;

	if(f.email.value == '' || 
		f.email.value.indexOf('@') == -1 ||
		f.email.value.indexOf('.') == -1)
	{
		alert('Please enter your email address');
		f.email.focus();
		return false;
	}	
		
	f.FlagProcess.value = '1';
	return true;
}


function initLoginBox()
{
		
		//alert(document.cookie);
		pkCustomer = readCookie('pkCustomer');

		//alert(readCookie('pkCustomer'));

		custName = new String(readCookie('custName'));
		custName = (custName.replace("+"," "));
		//alert(custName);
		
		
		if(pkCustomer != null && pkCustomer != '')
		{
			var objVisitorName = document.getElementById('visitorName');
			objVisitorName.innerHTML = custName;
			
			var btn = document.getElementById('btnAccount');
			btn.src = '/theme/images/btn-sign-out.gif';
			
			var link = document.getElementById('linkAccount');
			link.href = '/webshaper/store/logoff.asp';
		}
}



