// JavaScript Document
/* 
	@description: All header related scripts should be placed here
	@author: Taufeeq ur Rehman
	@company: MBlue Designs RWP. Pakistan
*/
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function submitForm(frm,val){	//alert(frm);
	if(val > 0){
		frm.page.value = val;
		//alert(frm.page.value);
	}

	frm.submit();
}
function openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

/*
	@function: validateNewsLetter
	@description: validating the newsletter email 
	@params: form
	@return: bool result
	@author: Taufeeq ur Rehman
*/
function validateNewsLetter(frm){
	frm.news_email.className="txtbox_style";
	if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(frm.news_email.value))){
		frm.news_email.value = "Invalid email address";
		frm.news_email.className="error";
		return false;
	}else{
		frm.news_email.className="txtbox_style";
		return true;
	}
}
/*
	@function: emptyNews
	@description: Empty the email box if it contains error msg 
	@params: ctrl
	@author: Taufeeq ur Rehman
*/

function emptyNews(ctrl){
	if(ctrl.value == 'Invalid email address')
	ctrl.value = "";
}
 function validate_me()
 	{
			
		if(document.getElementById("product_search").value=='' || document.getElementById("product_search").value=='Search...')
			{
				document.getElementById("product_search").value=' ';
			}
	
	}
	function Validate_product_form()
		{
				
				//alert(document.productForm.lens_choice.value);
			//	return false;
			if(document.productForm.glass_type.value=='')
				{
					alert('Please select the Glasses you are looking for');	
					document.productForm.glass_type.focus();
					return false;
				}
			if(document.productForm.color_style.value=='')
				{
					alert('Please select Color/Style');	
					document.productForm.color_style.focus();
					return false;
				}
				
			if(document.productForm.color_style.value=='')
				{
					alert('Please select Color/Style');	
					document.productForm.color_style.focus();
					return false;
				}
			if(document.productForm.lens_choice.value=='')
				{
					alert('Please select Lens Choice');	
					document.productForm.lens_choice.focus();
					return false;
				}
			if(document.productForm.lens_coating.value=='')
				{
					alert('Please select Lens Coating');	
					document.productForm.lens_coating.focus();
					return false;
				}
							
			if(document.productForm.left_sph.value=='')
				{
					alert('Please select Left SPH');	
					document.productForm.left_sph.focus();
					return false;
				}
			if(document.productForm.left_cyl.value=='')
				{
					alert('Please select Left CYL');	
					document.productForm.left_cyl.focus();
					return false;
				}
			if(document.productForm.left_nead.value=='')
				{
					alert('Please select Left Nead');	
					document.productForm.left_nead.focus();
					return false;
				}
		/*	if(document.productForm.left_axis.value=='')
				{
					alert('Please select Left AXIS');	
					document.productForm.left_axis.focus();
					return false;
				}
	  	*/
			if(document.productForm.right_sph.value=='')
				{
					alert('Please select Right SPH');	
					document.productForm.right_sph.focus();
					return false;
				}
			
			if(document.productForm.right_cyl.value=='')
				{
					alert('Please select Right CYL');	
					document.productForm.right_cyl.focus();
					return false;
				}
			
			if(document.productForm.right_nead.value=='')
				{
					alert('Please select Right Nead');	
					document.productForm.right_nead.focus();
					return false;
				}
			
		/*	if(document.productForm.right_axis.value=='')
				{
					alert('Please select Right AXIS');	
					document.productForm.right_axis.focus();
					return false;
				}
	  	*/
			return true;
		}
	