function swapImage(image, large_image,imgId) {
		document.getElementById("main_img").src = image;
		defaultimage = large_image;
		//document.getElementById('thumb1').className = "";
		//document.getElementById('thumb2').className = "";
		//document.getElementById('thumb3').className = "";
		//document.getElementById(imgId).className = "selected";
	}
	
function funBlock(URL,skuId,prt,cPath,glassesTot,skuGroupId,requri,isStockAvailable){

	document.getElementById('txtSkuId').value = skuId;
	if(document.getElementById('buyButon')){
		if(isStockAvailable=='N'){
			document.getElementById('seperator').style.display = "none";
			document.getElementById('buyButon').style.display = "none";
			document.getElementById('buyOnline').style.display = "none";
		}else{
			document.getElementById('seperator').style.display = "block";
			document.getElementById('buyButon').style.display = "block";
			document.getElementById('buyOnline').style.display = "block";
		}
	}
	
	ajax_call_test(URL, "sku_id="+skuId+"&isprint="+prt+"&catPath="+cPath+"&glassesTotal="+glassesTot+"&id="+skuGroupId+"&isStockAvailable="+isStockAvailable+"&requri="+requri,"img_block", false);
	//ajax_call_glasses_details_attributes(URL, ""+skuId+"/"+prt+"/"+cPath+"/"+glassesTot+"/"+skuGroupId+"/"+requri,"img_block", false);
}

function getNonPlatoAttributes(URL,skuId,cPath,skuGroupId,requri,prt){

	document.getElementById('txtSkuId').value = skuId;
	if(document.getElementById('buyButon')){
		if(isStockAvailable=='N'){
			document.getElementById('seperator').style.display = "none";
			document.getElementById('buyButon').style.display = "none";
			document.getElementById('buyOnline').style.display = "none";
		}else{
			document.getElementById('seperator').style.display = "block";
			document.getElementById('buyButon').style.display = "block";
			document.getElementById('buyOnline').style.display = "block";
		}
	}
	
	ajax_non_plato_attributes(URL, "skuId="+skuId+"&cPath="+cPath+"&id="+skuGroupId+"&requri="+requri+"&print="+prt,"img_block", false);
	//ajax_call_glasses_details_attributes(URL, ""+skuId+"/"+prt+"/"+cPath+"/"+glassesTot+"/"+skuGroupId+"/"+requri,"img_block", false);
}


function PrintGlasses(){
	
	URL=document.getElementById('method_url').value;
	popupWin = window.open('URL', 'popupWin', 650, 600 ,status = 1, resizable = 0, scrollbars=1, toolbar = 0);
	document.print_glasses.submit();
	
 
}

function Form1_Validator(theForm){
	// Validation for the user checked the quantity or not
	var frm  = document.frmContactLense;
	var variantqty = frm.variant;

	if(!checkRadioValue(variantqty)){
		alert(PLEASE_CHECK_ONE_CONTACT_LENSE);
		return (false);
	}

	if(document.getElementById('contactColour').value != ""){
	    var contClr = frm.contactColour;
		 if(!checkRadioValue(contClr)){
			alert(PLEASE_CHECK_ONE_CONTACT_LENSE_COLOR);
			return (false);
		 }   		
	}
				

	function checkRadioValue(frmElement){
		var checkvalue = "";
		for (i=0, n=frmElement.length; i<n; i++) {
			if (frmElement[i].checked) {
				  checkvalue = frmElement[i].value;
			      break;
			}
		}
	
		if (checkvalue != "") {
		       return true;
		}
		return (false); 				
	}


	 //	 Check to see if the rightBaseCurve contains value
		if(!checkEmpty("rightBaseCurve",YOU_MUST_SELECT_RIGHT_BASE_CURVE)){
			return (false);
		}
	
	 //	 Check to see if the leftBaseCurve contains value
		if(!checkEmpty("leftBaseCurve",YOU_MUST_SELECT_LEFT_BASE_CURVE)){
			return (false);
		}
	
	 //	 Check to see if the rightDiameter contains value
		if(!checkEmpty("rightDiameter",YOU_MUST_SELECT_RIGHT_DIAMETER)){
			return (false);
		}
	
	
	 //	 Check to see if the leftDiameter contains value
		if(!checkEmpty("leftDiameter",YOU_MUST_SELECT_LEFT_DIAMETER)){
			return (false);
		}
	
	 //	 Check to see if the rightSphere contains value
		if(!checkEmpty("rightSphere",YOU_MUST_SELECT_RIGHT_SPHERE)){
			return (false);
		}
	
	 //	 Check to see if the leftSphere contains value
		if(!checkEmpty("leftSphere",YOU_MUST_SELECT_LEFT_SPHERE)){
			return (false);
		}
		
		
		// Checks the Lenses are Toric or not
		if(document.getElementById('toricLense').value != ""){
		
			 //	 Check to see if the rightCylinder contains value
				if(!checkEmpty("rightCylinder",YOU_MUST_SELECT_RIGHT_CYLINDER)){
					return (false);
				}
				
	
			 //	 Check to see if the leftCylinder contains value
				if(!checkEmpty("leftCylinder",YOU_MUST_SELECT_LEFT_CYLINDER)){
					return (false);
				}
	
	
	
			 //	 Check to see if the rightAxis contains value
				if(!checkEmpty("rightAxis",YOU_MUST_SELECT_RIGHT_AXIS)){
					return (false);
				}
	
	
			 //	 Check to see if the leftAxis contains value
				if(!checkEmpty("leftAxis",YOU_MUST_SELECT_LEFT_AXIS)){
					return (false);
				}
		
		}
		return (true);
} 


function FormBatteries_Validator(theForm){
	// Validation for the user checked the quantity or not
	var frm  = document.frmContactLense;
	var variantqty = frm.variant;

	if(!checkRadioValue(variantqty)){
		alert(PLEASE_CHECK_ONE_CONTACT_LENSE);
		return (false);
	}

		

	function checkRadioValue(frmElement){
		var checkvalue = "";
		if (frmElement.length) {
			for (i=0, n=frmElement.length; i<n; i++) {
				if (frmElement[i].checked) {
					  checkvalue = frmElement[i].value;
				      break;
				}
			}
		
			if (checkvalue != "") {
			       return true;
			}
			return false;
		} else {
			if (frmElement.checked) {
				  checkvalue = frmElement.value;
			}
			if (checkvalue != "") {
			       return true;
			}
			return false;
		}
	}

		
		return (true);
} 