function get_cover_value(cnt)
		{
		cover_price = document.product_info.cover_price[cnt].value;
		document.product_info.cover_name_final.value=document.product_info.cover_name[cnt].value;
		document.product_info.cover_price_final.value=cover_price;
		newtotal();
	}	
	
function get_related_product(count)
		{
		document.product_info.related_product_total.value=document.product_info.related_product_cost[count].value;
		document.product_info.related_product_name_final.value=document.product_info.related_product_name[count].value;
		newtotal();
	}	

function extrachairs()
		{
			var chairssel="";
			var chairsqty="";
			for (var i=0; i < document.product_info.chairs.length; i++)
		   {
		   if (document.product_info.chairs[i].checked)
			  {
				chairsqty=document.product_info.temp_qt[i].value;
				chairssel=document.product_info.chairs[i].value;
				chairname=document.product_info.chair_name[i].value;
				chairprice=document.product_info.chair_price[i].value;
			  }
		   }


			
		 if (chairssel=="" || chairsqty=="")
		 {alert("Please select chair by clicking radio button");
				
		 }
		 else
		 {
		  rad_val31=parseFloat(chairprice * chairsqty);
				document.product_info.chair_total.value=rad_val31;
				document.product_info.chair_qty_final.value=chairsqty;
				document.product_info.chair_name_final.value=chairname;
				document.product_info.chair_price_final.value=chairprice;
				newtotal();
		}
	}	


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 for Number check start */	
	var qty = "0123456789";
	var numb = "0123456789";
	var alpha = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ";
	function res(t,v){
	var w = "";
	for (i=0; i < t.value.length; i++) {
	x = t.value.charAt(i);
	if (v.indexOf(x,0) != -1)
	w += x;
	}
	t.value = w;
	}
	/* Function for Number check end*/
	
	/* Function for Total round start */
	function roundTo(num,pow)
	{
  	num *= Math.pow(10,pow);
  	num = (Math.round(num)/Math.pow(10,pow))+ "" ;
  	if(num.indexOf(".") == -1)
    	num += "." ;
  	while(num.length - num.indexOf(".") - 1 < pow)
    	num += "0" ;
  	return num ;
	}
	/* Function for Total round start */


	/* Complete function for cushion start */
	var rad_val = 0;
	var rad_value = 0;
	

function newtotal(){
		var product_cost=0;
		var chair_total=0;
		var cushion_total1=0;
		var cushion_total2=0;
		var cover_total=0;
		
		
		
		product_cost=document.product_info.product_cost.value;
		chair_total=document.product_info.chair_total.value;	
		cushion_total=parseFloat(document.product_info.cushion_price.value)*parseFloat(document.product_info.cushion_qty.value);
		cover_total=parseFloat(document.product_info.cover_price_final.value);
		related_product_total=parseFloat(document.product_info.related_product_total.value);
		
		//alert(related_product_total);
	
		var total=roundTo(parseFloat(product_cost)+parseFloat(chair_total)+parseFloat(cushion_total)+parseFloat(related_product_total)+parseFloat(cover_total),2)

		document.product_info.total_amt.value=total;
		
		document.getElementById("divtotalamount").innerHTML="&pound; " + total;
		document.getElementById("divtable").innerHTML="1";
		document.getElementById("divtotalamount2").innerHTML="&pound; " + document.product_info.cushion_price.value;
		document.getElementById("divcushionqty").innerHTML= document.product_info.cushion_qty.value; 
		document.getElementById("divtotalamount5").innerHTML="&pound; " + document.product_info.chair_price_final.value; 
		document.getElementById("divchairqty").innerHTML= document.product_info.chair_qty_final.value; 
		document.getElementById("divtotalamount3").innerHTML="&pound; " + document.product_info.cover_price_final.value;
		document.getElementById("divtotalamount4").innerHTML="&pound; " + document.product_info.related_product_total.value;

}
	
function get_radio_value()
		{

		if (document.product_info.cushion_qty1.value=="")
		{alert("Please enter Seat Pads quantity")
		}
		else
		{document.product_info.cushion_qty2.value=0;
		for (var i=0; i < document.product_info.cushions.length; i++)
		   {
		   if (document.product_info.cushions[i].checked)
			  {
				var cushionarray=document.product_info.cushions[i].value;
				var array=cushionarray.split("/");
			//	alert(array[0]+" "+array[1]+" "+array[2]+" "+array[3]+" "+array[4]);
				  rad_val = array[0];
         		  document.product_info.cushions.value=rad_val;
				//  alert (rad_val);
			  }
		   }
		   
		  rad_value=parseFloat(rad_val * document.product_info.cushion_qty1.value);
		
		  
		 	document.getElementById("divtotalamount2").innerHTML="&pound; " + rad_val;
		   	document.getElementById("divcushionqty").innerHTML= document.product_info.cushion_qty1.value; 
		  
			document.product_info.cushion_name.value=array[3];
			document.product_info.cushion_price.value=array[0];
			document.product_info.cushion_type.value=array[1];
			document.product_info.cushion_fabric.value=array[2];
			document.product_info.cushion_qty.value=document.product_info.cushion_qty1.value;

		  newtotal();
		}
		}
	/* Complete function for cushion end */
	
	
		function cushions_quantity1()
		{

		
		for (var i=0; i < document.product_info.cushions.length; i++)
		   {
		   if (document.product_info.cushions[i].checked)
			  {
				var cushionarray=document.product_info.cushions[i].value;
				var array=cushionarray.split("/");
			//	alert(array[0]+" "+array[1]+" "+array[2]+" "+array[3]+" "+array[4]);
				  rad_val = array[0];
         		  document.product_info.cushions.value=rad_val;
				//  alert (rad_val);
			  }
		   }
		   
		  rad_value=parseFloat(rad_val * document.product_info.cushion_qty1.value);
		
		  
			document.getElementById("divtotalamount2").innerHTML="&pound; " + rad_val;
		   	document.getElementById("divcushionqty").innerHTML= document.product_info.cushion_qty1.value; 
		  
			document.product_info.cushion_name.value=array[3];
			document.product_info.cushion_price.value=array[0];
			document.product_info.cushion_type.value=array[1];
			document.product_info.cushion_fabric.value=array[2];	
			document.product_info.cushion_qty.value=document.product_info.cushion_qty1.value;


		  newtotal();
		}
	
	
	
	
	/* Complete function for cover start */
	var rad_val1 = 0;	
	
	
	
	
	function get_cushion2_value()
		{

		if (document.product_info.cushion_qty2.value=="")
		{alert("Please enter Seat Pads with back quantity")
		}
		else
		{document.product_info.cushion_qty1.value=0;
		for (var i=0; i < document.product_info.cushions.length; i++)
		   {
		   if (document.product_info.cushions[i].checked)
			  {
				var cushionarray2=document.product_info.cushions[i].value;
				var array2=cushionarray2.split("/");
			//	alert(array2[0]+" "+array2[1]+" "+array2[2]+" "+array2[3]+" "+array2[4]);
				  rad_val_cushion2 = array2[0];
         		  document.product_info.cushions.value=rad_val_cushion2;
				//  alert (rad_val);
			  }
		   }
		   
		  rad_value_cushion2=parseFloat(rad_val_cushion2 * document.product_info.cushion_qty2.value);
		  
		 

	document.product_info.cushion_name.value=array2[3];
	document.product_info.cushion_price.value=array2[0];
	document.product_info.cushion_qty.value=document.product_info.cushion_qty2.value;
	document.product_info.cushion_type.value=array2[1];
	document.product_info.cushion_fabric.value=array2[2];

		   

		  newtotal();
		}
		}
	

	function cushions_quantity2()
		{

		
		for (var i=0; i < document.product_info.cushions.length; i++)
		   {
		   if (document.product_info.cushions[i].checked)
			  {
				var cushionarray2=document.product_info.cushions[i].value;
				var array2=cushionarray2.split("/");
			//	alert(array2[0]+" "+array2[1]+" "+array2[2]+" "+array2[3]+" "+array2[4]);
				  rad_val_cushion2 = array2[0];
         		  document.product_info.cushions.value=rad_val_cushion2;
				//  alert (rad_val);
			  }
		   }
		   
		  rad_value_cushion2=parseFloat(rad_val_cushion2 * document.product_info.cushion_qty2.value);
		  
	//	  document.getElementById("divtotalamount2").innerHTML="&pound; " + rad_val_cushion2;
		    document.getElementById("divcushionqty").innerHTML= document.product_info.cushion_qty2.value; 
	document.product_info.cushion_name.value=array2[3];
	document.product_info.cushion_price.value=array2[0];
	document.product_info.cushion_type.value=array2[1];
	document.product_info.cushion_fabric.value=array2[2];
	document.product_info.cushion_qty.value=document.product_info.cushion_qty2.value;

		   

		  newtotal();
	
		}



function finaltest(){
alert (document.product_info.chair_qty_final.value);
alert(document.product_info.chair_name_final.value);
alert(document.product_info.chair_price_final.value);

alert(document.product_info.cushion_name.value);
alert(document.product_info.cushion_price.value);
alert(document.product_info.cushion_type.value);
alert(document.product_info.cushion_fabric.value);
alert(document.product_info.cushion_qty.value);

alert(document.product_info.cover_name_final.value);
alert(document.product_info.cover_price_final.value);

alert(document.product_info.related_product_total.value);
alert(document.product_info.related_product_name_final.value);

	
}


