// JavaScript Document

function printpage() {
	window.print();  
}
	
function showDiv(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementsByTagName("div"); //DynamicDrive.com change
		if(el.style.display != "block"){ //DynamicDrive.com change
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="filterclass") //DynamicDrive.com change
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function evaswap(obj, val){
  obj.src = val;
}

function check_contact(form) {					
	var emailFilter=/^.+@.+\..{2,3}$/;
	var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/;
	if (form.name.value == ''){
		alert("Please enter your name...");
		form.name.focus();
		return false;
	}
	if (form.email.value == '' || form.email.value.match(illegalChars) || !(emailFilter.test(form.email.value))){
		alert("Please enter your email address...");
		form.email.focus();
		return false;
	}
	var stripped = form.telephone.value.replace(/[\(\)\.\-\ ]/g, '');
	if (form.telephone.value=='' || isNaN(parseInt(stripped))) {
		alert("Your telephone number is incomplete or contain invalid characters...");
		form.telephone.focus();
		return false;
	}	

function check_addtobasket(form) {													
	if (form.quantity.value == ''){
		alert("Please enter a quantity...");
		form.quantity.focus();
		return false;
	}	
}


function check_addtobasket(form) {													
	if (form.quantity.value == ''){
		alert("Please enter a quantity...");
		form.quantity.focus();
		return false;
	}	
}




function loginvalidate()
{
		missinginfo = "";
			
		if (trim(document.loginform.email.value)=="" )
	{
		missinginfo += "\n     - Email";
				
	}
	
	if (document.loginform.password.value=="")

	{
		missinginfo += "\n     - Password";
		
	}
			
	if (missinginfo != "") 
	{
		missinginfo ="____________________\n" +
	
		"Please fill in the following fields :\n" +
	
		missinginfo + "\n____________________" ;
	
		alert(missinginfo);
	
		return false;
	}

	else 

	{
		
		return true;
	}

}

function trim(str)
{
    while (str.substring(0,1) == ' ') // check for white spaces from beginning

    {

        str = str.substring(1, str.length);

    }

    while (str.substring(str.length-1, str.length) == ' ') // check white space from end

    {

        str = str.substring(0,str.length-1);

    }

   

    return str;

}





function addvalidate()
{

	missinginfo = "";
	
	
	
	
	if (trim(document.addaddress.address1.value)=="")

	{
		missinginfo += "\n     - Address1";
		
	}
	
	
	if (trim(document.addaddress.city.value)=="")

	{
		missinginfo += "\n     - City";
		
	}
	if (trim(document.addaddress.county.value)=="")

	{
		missinginfo += "\n     - County";
		
	}
	if (trim(document.addaddress.postcode.value)=="")

	{
		missinginfo += "\n     - Post Code";
		
	}
	
	if (trim(document.addaddress.country.value)=="")

	{
		missinginfo += "\n     - Country";
		
	}
		
	
	if (missinginfo != "") 
	{
		missinginfo ="____________________\n" +
	
		"Please fill in the following fields :\n" +
	
		missinginfo + "\n____________________" ;
	
		alert(missinginfo);
	
		return false;
	}

	else 

	{
		
		return true;
	}
	
	function trim(str)
{
    while (str.substring(0,1) == ' ') // check for white spaces from beginning

    {

        str = str.substring(1, str.length);

    }

    while (str.substring(str.length-1, str.length) == ' ') // check white space from end

    {

        str = str.substring(0,str.length-1);

    }

   
    return str;

}
	
	
	

}





function updvalidate()
{
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i

	missinginfo = "";
	
	if (trim(document.joinform.firstname.value)=="")

	{
		missinginfo += "\n     - First Name";
		
	}	
	
	if (trim(document.joinform.lastname.value)=="")

	{
		missinginfo += "\n     - Last Name";
		
	}
	
	var telephn = trim(document.joinform.telephone.value).replace(/[\(\)\.\-\ ]/g, '');
	if (trim(document.joinform.telephone.value)==""|| isNaN(parseInt(telephn)))

	{
		missinginfo += "\n     - Your telephone number is incomplete or contain invalid characters...";
		
	}
	
	
	var mobno = trim(document.joinform.mobile.value).replace(/[\(\)\.\-\ ]/g, '');
	if (trim(document.joinform.mobile.value)==""|| isNaN(parseInt(mobno)))

	{
	
		missinginfo += "\n     - Your mobile no number is incomplete or contain invalid characters...";
		
	}
	
	
	
	
	/*if (trim(document.joinform.telephone.value)=="")

	{
		missinginfo += "\n     - Telephone";
		
	}
	
	if (trim(document.joinform.mobile.value)=="")

	{
		missinginfo += "\n     - Mobile";
		
			}*/
			
	if (trim(document.joinform.email.value)=="")
	{
		missinginfo += "\n     - Email";
		alert("email");
	}
	if (trim(document.joinform.emailconf.value)=="")

	{
		missinginfo += "\n     - Confirm Email";
		
	}
	if(trim(document.joinform.email.value) != "" && !filter.test(document.joinform.email.value))

	{
		missinginfo += "\n     - Sorry. The Email address seems wrong. Please check the prefix and '@' sign.";
		
	}
	
	
	if (trim(document.joinform.address1.value)=="")

	{
		missinginfo += "\n     - Address1";
		
	}
		
	if (trim(document.joinform.city.value)=="")

	{
		missinginfo += "\n     - City";
		
	}
	if (trim(document.joinform.county.value)=="")

	{
		missinginfo += "\n     - County";
		
	}
	if (trim(document.joinform.postcode.value)=="")

	{
		missinginfo += "\n     - Post Code";
		
	}
	
	if (trim(document.joinform.country.value)=="")

	{
		missinginfo += "\n     - Country";
		
	}
	
	if (document.joinform.password.value=="")

	{
		missinginfo += "\n     - Password";
		
	}
	if (document.joinform.passwordconf.value=="")

	{
		missinginfo += "\n     - Confirm Password";
		
	}
	if (document.joinform.passwordconf.value!=document.joinform.password.value)

	{
		missinginfo += "\n     - Password and Confirm Password do not match";
		
	}
	
	
	
	if (missinginfo != "") 
	{
		missinginfo ="____________________\n" +
	
		"Please fill in the following fields :\n" +
	
		missinginfo + "\n____________________" ;
	
		alert(missinginfo);
	
		return false;
	}

	else 

	{
		
		return true;
	}
	
	function trim(str)
{
    while (str.substring(0,1) == ' ') // check for white spaces from beginning

    {

        str = str.substring(1, str.length);

    }

    while (str.substring(str.length-1, str.length) == ' ') // check white space from end

    {

        str = str.substring(0,str.length-1);

    }

   
    return str;

}
	

}





function validate()
{
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i

	missinginfo = "";
	
	if (document.joinform.firstname.value=="")

	{
		missinginfo += "\n     - First Name";
		
	}	
	
	if (document.joinform.lastname.value=="")

	{
		missinginfo += "\n     - Last Name";
		
	}
	if (document.joinform.telephone.value=="")

	{
		missinginfo += "\n     - Telephone";
		
	}
	if (document.joinform.mobile.value=="")

	{
		missinginfo += "\n     - Mobile";
		
			}
			
	if (document.joinform.email.value=="")
	{
		missinginfo += "\n     - Email";
		
	}
	if (document.joinform.emailconf.value=="")

	{
		missinginfo += "\n     -Confirm Email";
		
	}
	if(document.joinform.email.value != "" && !filter.test(document.joinform.email.value))

	{
		missinginfo += "\n     - Sorry. The Email address seems wrong. Please check the prefix and '@' sign.";
		
	}
	if (document.joinform.hear_about.value=="")

	{
		missinginfo += "\n     - Select Hear From";
	}
	
	if (document.joinform.address1.value=="")

	{
		missinginfo += "\n     - Address1";
		
	}
	
	
	if (document.joinform.city.value=="")

	{
		missinginfo += "\n     - City";
		
	}
	if (document.joinform.county.value=="")

	{
		missinginfo += "\n     - County";
		
	}
	if (document.joinform.postcode.value=="")

	{
		missinginfo += "\n     - Post Code";
		
	}
	
	if (document.joinform.country.value=="")

	{
		missinginfo += "\n     - Country";
		
	}
	
	if (document.joinform.password.value=="")

	{
		missinginfo += "\n     - Password";
		
	}
	if (document.joinform.passwordconf.value=="")

	{
		missinginfo += "\n     - Confirm Password";
		
	}
	if (document.joinform.passwordconf.value!=document.joinform.password.value)

	{
		missinginfo += "\n     - Password and Confirm Password do not match";
		
	}
	
	
	
	if (missinginfo != "") 
	{
		missinginfo ="____________________\n" +
	
		"Please fill in the following fields :\n" +
	
		missinginfo + "\n____________________" ;
	
		alert(missinginfo);
	
		return false;
	}

	else 

	{
		
		return true;
	}

}

