// JavaScript Document
function __fncMoreHotDeals(){
	thisForm.txtWhat2Do.value = 'SHOWHOTDEAL';
	thisForm.action='shop.php'
	thisForm.submit();
}
function __fncMoreNewDeals(){
	/*thisForm.txtWhat2Do.value = 'SHOWHOTDEAL';*/
	thisForm.action='news.php'
	thisForm.submit();
}
function ClientRegister ()
{
	$('errChristianName').style.display='none';
	$('errSurName').style.display='none';
	$('errbillingAddress').style.display='none';
	$('errBillPostCode').style.display='none';
	$('errUserName').style.display = 'none';
	$('errPassword').style.display = 'none';
	$('errConfirmPassword').style.display = 'none';
	$('errBillPhone').style.display = 'none';
	$('errBilMobile').style.display = 'none';
	$('errEmail').style.display = 'none';
	$('errdeliveryAddress').style.display = 'none';
	$('errDelivPostCode').style.display = 'none';
	
	if(''==trim($('txtChristianName').value))
	{
		$('errChristianName').style.display='block';
		$('errChristianName').innerHTML='Enter First name';
		$('txtChristianName').focus(); 		
		return;
	}
	else if(''==trim($('txtSurName').value))
	{
		$('errSurName').style.display='block';
		$('errSurName').innerHTML='Enter Surname';
		$('txtSurName').focus();		
		return;
	}
	else if(''==trim($('billingAddress').value))
	{
		$('errbillingAddress').style.display='block';
		$('errbillingAddress').innerHTML='Enter Billing Address';
		$('billingAddress').focus();		
		return;
	}
	else if('' == trim($('txtBillPostCode').value))
	{
		$('errBillPostCode').style.display='block';
		$('errBillPostCode').innerHTML='Enter Postcode';
		$('txtBillPostCode').focus();		
		return;
	}
	else if( trim($('txtBillPostCode').value).length > 8)
	{
		$('errBillPostCode').style.display='block';
		$('errBillPostCode').innerHTML='Enter a valid Postcode';
		$('txtBillPostCode').focus();		
		return;
	}
	else if(''==trim($('deliveryAddress').value))
	{
		$('errdeliveryAddress').style.display = 'block';
		$('errdeliveryAddress').innerHTML = 'Enter Delivery Address';
		$('deliveryAddress').focus();
		return false;
	}
	else if('' == trim($('txtDeliveryPostCode').value))
	{
		$('errDelivPostCode').style.display='block';
		$('errDelivPostCode').innerHTML='Enter Delivery Postcode';
		$('txtDeliveryPostCode').focus();		
		return;
	}
	else if( trim($('txtDeliveryPostCode').value).length > 8)
	{
		$('errDelivPostCode').style.display='block';
		$('errDelivPostCode').innerHTML='Enter a valid Postcode';
		$('txtDeliveryPostCode').focus();		
		return;
	}	
	
	else if(''==trim($('txtBillPhone').value))
	{
		$('errBillPhone').style.display = 'block';
		$('errBillPhone').innerHTML = 'Enter Telephone';
		$('txtBillPhone').focus();
		return false;
	}
	else if(''==trim($('txtBilMobile').value))
	{
		$('errBilMobile').style.display = 'block';
		$('errBilMobile').innerHTML = 'Enter Mobile';
		$('txtBilMobile').focus();
		return false;
	}
	else if (!isValidEmail(trim($('txtEmail').value )))
	{
		$('errEmail').style.display = 'block';
		$('errEmail').innerHTML = 'Please Enter a Valid email';
		$('txtEmail').focus();
		return false;
	}
	
	else if(''==trim($('txtUserName').value))
	{
		$('errUserName').style.display='block';
		$('errUserName').innerHTML='Enter Username';
		$('txtUserName').focus();		
		return;
	}
	else if(!isValidUserName(trim($('txtUserName').value)))
	{
		$('errUserName').style.display='block';
		$('errUserName').innerHTML='Enter a valid Username.';
		$('txtUserName').focus();		
		return;
	}		
	else if(''==trim($('txtPassword').value))
	{
		$('errPassword').style.display = 'block';
		$('errPassword').innerHTML = 'Enter Password';
		$('txtPassword').focus();
		return false;
	}
	else if(trim($('txtPassword').value).length < 6)
	{
		$('errPassword').style.display = 'block';
		$('errPassword').innerHTML = 'Password Chosen Must be Minimum 6 Characters Long.';
		$('txtPassword').focus();
		return false;
	}
	else if(trim($('txtPassword').value) != trim($('txtConfirmPassword').value) )
	{
		$('errConfirmPassword').style.display = 'block';
		$('errConfirmPassword').innerHTML = 'Please Verify your Password and Confirm Password';
		$('txtConfirmPassword').focus();
		return;
	}
	
	else
	{
		thisForm.txtWhat2Do.value = 'REGISTER_CLIENT';
		thisForm.submit();
	}
}
function Sendmail ()
{
	$('errEmail').style.display = 'none';
	if (!isValidEmail(trim($('txtEmail').value )))
	{
		$('errEmail').style.display = 'block';
		$('errEmail').innerHTML = 'Please Enter a Valid email';
		$('txtEmail').focus();
		return false;
	}
	else
	{
		thisForm.txtWhat2Do.value = 'SEND_MAIL';
		thisForm.action='login.php';
		thisForm.submit();
	}
}
function cancelreg()
{
	thisForm.reset();		
}
function Clientaccount ()
{
	/*if(trim($('txtPassword').value) != trim($('txtConfirmPassword').value) )
	{
		alert("Please Verify your Password and Confirm Password");
		return;
	}
	else
	{*/
		thisForm.txtWhat2Do.value = 'ACCOUNT_CLIENT';
		thisForm.submit();
	//}
}
function validateLogin ()
{	
	if ('' == trim($('txtUserName').value ) )	
	{
		$('adminError').style.display = 'block';
		$('adminError').innerHTML = 'Please Enter Your User Name';
		$('txtUserName').focus();
		return false;
	}
	else if (!isValidUserName(trim($('txtUserName').value )))
	{
		$('adminError').style.display = 'block';
		$('adminError').innerHTML = 'Please Enter a Valid User Name';
		$('txtUserName').focus();
		return false;
	}
	else if ('' == trim($('txtPassWord').value)	)
	{
		$('adminError').style.display	 = 'block';
		$('adminError').innerHTML 		 = 'Please Enter Your Password';
		$('txtPassWord').focus();
		return false;
	}
	else 
	{
		thisForm.txtWhat2Do.value = 'USER_LOGIN';	
		thisForm.submit();
	}
}
/*####################################################################################################################*/
function __fncSelectedNews(NwId,NwName){
	$('hidNwId').value 		= NwId;
	$('hidNwName').value 	= NwName;
	thisForm.txtWhat2Do.value='VIEWNEWSDETAILS';
	thisForm.action='news.php';
	thisForm.submit();
	
}
function __fncSelectedRacing(RCId,RCName){
	$('hidRCId').value 		= RCId;
	$('hidRCName').value 	= RCName;
	thisForm.txtWhat2Do.value='VIEWRACINGDETAILS';
	thisForm.action='racing.php';
	thisForm.submit();
	
}
function __fncSelectedDrivers(DRId,DRName){
	$('hidDRId').value 		= DRId;
	$('hidDRName').value 	= DRName;
	//thisForm.txtWhat2Do.value='VIEWRACINGDETAILS';
	thisForm.action='drivers.php';
	thisForm.submit();
	
}
function __fncSelectedKartingTuition(RCId,RCName){
	$('hidKtId').value 		= RCId;
	$('hidKtName').value 	= RCName;
	thisForm.txtWhat2Do.value='VIEWKTDETAILS';
	thisForm.action='kartingtuition.php';
	thisForm.submit();
	
}
function __fncChangeClientPassword ()
{
	$('changePassError').style.display = 'none' ;
	if (trim($('txtOldPassword').value) == '')
	{
		$('changePassError').style.display = 'block' ;
		$('changePassError').innerHTML = "Please Enter Your Current Password";
		$('txtOldPassword').focus();
		return false;
	}
	else if (trim($('txtNewPassword').value) == '')
	{
		$('changePassError').style.display = 'block' ;
		$('changePassError').innerHTML = "Please Enter New Password";
		$('txtNewPassword').focus();
		return false;
	}
	else if (trim($('txtNewPassword').value).length < 6)
	{
		$('changePassError').style.display = 'block' ;
		$('changePassError').innerHTML = "Password Chosen Must be Minimum 6 Characters Long.	";
		$('txtNewPassword').focus();
		return false;
	}
	else if (trim($('txtConfirmPassword').value) == '')
	{
		$('changePassError').style.display = 'block' ;
		$('changePassError').innerHTML = "Please Enter  Confirm Password";
		$('txtConfirmPassword').focus();
		return false;
	}
	else if (trim($('txtConfirmPassword').value) != trim($('txtNewPassword').value))
	{
		$('changePassError').style.display = 'block' ;
		$('changePassError').innerHTML = "Password Mismatch Please Verify NewPassword and ConfirmPassword ";
		$('txtConfirmPassword').select();
		return false;
	}
	else
	{
		thisForm.txtWhat2Do.value = 'CHANGE_PASSWORD';	
		thisForm.submit();
	}
}
function __fncClearPasswordfields ()
{
	$('txtNewPassword').value = '';	
	$('txtConfirmPassword').value = '';	
	$('txtOldPassword').value = '';	
}
function __fncBuynowsmarty(){
	thisForm.txtWhat2Do.value = 'PRODUCTDETAILS';	
	thisForm.action='shop.php';
	thisForm.submit();
	
}
function __fncDriversPictureGallery(optid,id){
	$('hidoptId').value = optid;	
	$('hidId').value = id;
	thisForm.action='picturegallery.php';
	thisForm.submit();	
}