function showdesigns(num){
        for(var i=1; i<= 4 ; i++){
			 var visproperty =  (i === num) ? "block" :  "none";
			 if(i === num){
			     document.getElementById('lpanel_'+i+"_s").style.display = "block"; 
			     document.getElementById('lpanel_'+i+"_u").style.display = "none";
			 }else{
			 	document.getElementById('lpanel_'+i+"_s").style.display = "none";
			 	document.getElementById('lpanel_'+i+"_u").style.display = "block"; 
			 }
			 document.getElementById('panel_'+i).style.display = visproperty ;
		}
}
function changetoonview(id,imgname){
	document.getElementById('toonpanel').innerHTML = "<img src='http://www.myntra.com/skin1/mkimages/cricinfo/toons/"+imgname+"' alt='image' width='527' height='441' />";
	document.getElementById('toonid').value = id;
	
}
function printthis(styleid,name){
	var toonid = document.getElementById('toonid').value;
	window.location.href = "http://www.myntra.com/modules/affiliates/cricinfoprocess.php?style="+styleid+"&tid="+toonid+"&stylename="+name;
}
function postcomments(){
	 if(document.getElementById('txtName').value == '' || document.getElementById('txtName').value === "Name"){
		  alert("Please input your name"); return false;
	 }else if(document.getElementById('txtaComment').value == '' || document.getElementById('txtaComment').value === "Post you comment here...."){
		   alert("Please input your comments"); return false; 
	 }else{
		 document.frmpostcomment.submit();
		 return true;
	 }
}
function changestyle(){
	document.getElementById('mainimage').innerHTML = "<img src='"+productPreviewArray[ctr]+"' border='0'  />";
	document.getElementById('prwimage').innerHTML = "";
    document.getElementById('prdname').innerHTML = "my dream OTeeOm<br/>mens white Rs. 349";
}
function IsNumeric(sText) {
	pattern = /^[0-9]*$/;
	if(pattern.test(sText)==false){
	 	 return false;
	}
	else if(sText == 0){
		return false;
	}
	else{
	 	return true;
	}
}


function changepreview(ctr,catId,prid,style,lgImg,designName){
	switch(catId){
		  /* For quotes **/	
		   case 1: 
		             document.getElementById('prwimg').innerHTML = "<img src='"+quotes_w_men[ctr]+"' border='0' width='327' height='302'  alt=''  />";
			            break;
           case 2: document.getElementById('prwimg').innerHTML = "<img src='"+quotes_b_men[ctr]+"' border='0' width='327' height='302'  alt=''    />";
			            break; 
           case 3: document.getElementById('prwimg').innerHTML = "<img src='"+quotes_w_women[ctr]+"' border='0' width='327' height='302'  alt=''   />";
			            break;  
          case 4: document.getElementById('prwimg').innerHTML = "<img src='"+quotes_b_women[ctr]+"' border='0' width='327' height='302'  alt=''   />";
			            break;  
           case 5: document.getElementById('prwimg').innerHTML = "<img src='"+quotes_w_mug[ctr]+"' border='0' width='327' height='302'  alt=''  />";
			            break;  
           case 6: document.getElementById('prwimg').innerHTML = "<img src='"+quotes_m_mug[ctr]+"' border='0' width='327' height='302'  alt=''   />";
			            break;  
						
           case 7: document.getElementById('prwimg').innerHTML = "<img src='"+quotes_g_mug[ctr]+"' border='0' width='327' height='302'  alt=''    />";
			            break;  

           case 8: document.getElementById('prwimg').innerHTML = "<img src='"+quotes_y_mug[ctr]+"' border='0' width='327' height='302'  alt=''   />";
			            break;
		/* For caricatures **/	            
		   case 9: 
		             document.getElementById('prwimg').innerHTML = "<img src='"+caricatures_w_men[ctr]+"' border='0' width='327' height='302'  alt=''  />";
			            break;
           case 10: document.getElementById('prwimg').innerHTML = "<img src='"+caricatures_b_men[ctr]+"' border='0' width='327' height='302'  alt=''    />";
			            break; 
           case 11: document.getElementById('prwimg').innerHTML = "<img src='"+caricatures_w_women[ctr]+"' border='0' width='327' height='302'  alt=''   />";
			            break;  
          case 12: document.getElementById('prwimg').innerHTML = "<img src='"+caricatures_b_women[ctr]+"' border='0' width='327' height='302'  alt=''   />";
			            break;  
           case 13: document.getElementById('prwimg').innerHTML = "<img src='"+caricatures_w_mug[ctr]+"' border='0' width='327' height='302'  alt=''  />";
    	            break;  
           case 14: document.getElementById('prwimg').innerHTML = "<img src='"+caricatures_m_mug[ctr]+"' border='0' width='327' height='302'  alt=''   />";
			            break;  
           case 15: document.getElementById('prwimg').innerHTML = "<img src='"+caricatures_g_mug[ctr]+"' border='0' width='327' height='302'  alt=''    />";
			            break;  
          case 16: document.getElementById('prwimg').innerHTML = "<img src='"+caricatures_y_mug[ctr]+"' border='0' width='327' height='302'  alt=''   />";
			            break;  	
          case 17: document.getElementById('prwimg').innerHTML = "<img src='"+caricatures_poster[ctr]+"' border='0' width='327' height='302'  alt=''   />";
			            break; 
	      case 18: document.getElementById('prwimg').innerHTML = "<img src='"+caricatures_mousepad[ctr]+"' border='0' width='327' height='302'  alt=''   />";
			            break; 
	      case 19: document.getElementById('prwimg').innerHTML = "<img src='"+quotes_poster[ctr]+"' border='0' width='327' height='302'  alt=''   />";
			            break; 	
		  case 20: document.getElementById('prwimg').innerHTML = "<img src='"+quotes_mousepad[ctr]+"' border='0' width='327' height='302'  alt=''   />";
			            break; 		             		            	
			            	            			                          
	
 	}
	document.getElementById('selectedstyle').value = style;
	document.getElementById('selectedesign').value = ctr;
	document.getElementById('productid').value = prid;
	document.getElementById('largeviewimg').value = lgImg;
	document.getElementById('designName').value = designName;
}
function addToCart(pagetype){
  	 if(!IsNumeric(document.getElementById("txtQty").value) && !IsNumeric(document.getElementById("txtQty").value) ){
			alert("Please enter valid quantity");
			return false;
	 }
	 else{
		  document.getElementById("referrer").value  = "addCricinfoP";
		  document.getElementById("referredTo").value = pagetype;
		  document.getElementById("unitQty").value       = document.getElementById("txtQty").value
		  if(document.getElementById("styleoption")){
		  	  if(document.getElementById("styleoption").value == '0'){ 
		  	  	  alert("Please choose option"); 
		  	  	  return false;
		  	  }
		  	  document.getElementById("sizeoption").value  =    document.getElementById("styleoption").value	
		  }
		  document.getElementById("hiddenForm").submit();
	 }
	
}
function viewlargeimg(seriesid,style){
	 window.open(http_loc+"/modules/affiliates/cricinfo_large.php?series="+seriesid+"&styleid="+style+"&lgimg="+(document.getElementById('largeviewimg').value),'',"width=600px,height=600px");
	return false;
	
}
function changeSelectedStyle(styleid,series,product){
	window.location.href = http_loc+'/modules/affiliates/cricinfo_designs.php?style='+styleid+'&series='+series+'&product='+product+"&name="+document.getElementById('designName').value;
	
	
}