 

function popUp(URL){

pop = window.open(URL,"win1","width=400,height=400,resizable=1,scrollbars=1")

pop.focus()

}

function decrement(){
 if(document.form.smallc.checked)
{
var c=document.form.small.value;
if(isInteger(c))
 {
if(document.form.smallc.checked)
{
c = c-1 ;
}
if(c >= 0)
{
 document.form.small.value=c ;
 if(document.form.smallc.checked)
{
 totalq=parseInt(c) 
}
if(document.form.mediumc.checked)
{
 totalq=parseInt(totalq) +parseInt(document.form.medium.value) 
}
if(document.form.largec.checked)
{
 totalq=parseInt(totalq) +parseInt(document.form.large.value) 
}
document.form.textfield.value=totalq;
totalamt();
}else{
document.form.small.value=0;
 alert("please enter valid integers");
return false;
 }
 }else{
 document.form.small.value=0;
    alert("please enter valid integers");
return false;
 }
}
} 
 
function update(){
if(document.form.smallc.checked)
{
totalq=0;
 z=document.form.small.value
if(isInteger(z))
 {
   if(z>=0)
   {
if(z=="")
{
 z=parseInt(0);
}else{
if(document.form.smallc.checked)
{
z=parseInt(z)+parseInt(1) ;
}

 }
 z=parseInt(z);
document.form.small.value=z ;
if(document.form.smallc.checked)
{
 totalq=parseInt(z) 
}
if(document.form.mediumc.checked)
{
 totalq=parseInt(totalq) +parseInt(document.form.medium.value) 
}
if(document.form.largec.checked)
{
 totalq=parseInt(totalq) +parseInt(document.form.large.value) 
}
document.form.textfield.value=totalq;
totalamt();
}else{
document.form.small.value=0;
      alert("please enter valid integers");
return false;
}
}else{
document.form.small.value=0;
    alert("please enter valid integers");
return false;
 }
 }
}

function qclicked()
{
t1=0;
   if(document.form.smallc.checked)
	{
	 t1=parseInt(t1) + parseInt(document.form.small.value)
	}
   if(document.form.mediumc.checked)
	{
	 t1=parseInt(t1) + parseInt(document.form.medium.value)
	}
   if(document.form.largec.checked)
	{
	 t1=parseInt(t1) + parseInt(document.form.large.value)
	}
	document.form.textfield.value=parseInt(t1);
	totalamt();
}

function qclicked_s()
{
t1=0;
 for (i=0; i<document.form.india.length; i++) 
 {
         if (document.form.india[i].checked==true)
         {
            t1 =document.form.india[i].value
         }
      }

	
	totalamt();
}

function decrement1(){
 if(document.form.mediumc.checked)
{
var c1=document.form.medium.value;
//alert(c1);
if(isInteger(c1))
 {
if(document.form.mediumc.checked)
{
c1 = c1-1 ;
}
if(c1 >= 0)
{
 document.form.medium.value=c1 ;
 if(document.form.mediumc.checked)
{
 totalq=parseInt(c1)
}
 if(document.form.smallc.checked)
{
 totalq=parseInt(totalq) +parseInt(document.form.small.value)
}

if(document.form.largec.checked)
{
 totalq=parseInt(totalq) +parseInt(document.form.large.value) 
}
document.form.textfield.value=totalq;
totalamt();
}else{
document.form.medium.value=0;
    alert("please enter valid integers");
return false;
 }
 }else{
 document.form.medium.value=0;
    alert("please enter valid integers");
return false;
 }
 
}
} 
 
function update1(){
 if(document.form.mediumc.checked)
{
totalq=0;
 z1=document.form.medium.value
//alert(z);
if(isInteger(z1))
 {
 if(document.form.mediumc.checked)
{
 
z1=parseInt(z1)+parseInt(1) ;

  
 }
 z1=parseInt(z1);
 //alert(z);
document.form.medium.value=z1 ;
if(document.form.smallc.checked)
{
 totalq=parseInt(totalq) +parseInt(document.form.small.value) 
}
if(document.form.mediumc.checked)
{
 totalq=parseInt(totalq) +parseInt(z1) 
}
if(document.form.largec.checked)
{
 totalq=parseInt(totalq) +parseInt(document.form.large.value) 
}
document.form.textfield.value=totalq;
totalamt();
}else{
 document.form.medium.value=0;
 alert("Please enter valid integers");
 return false;
}
}
}
function decrement2(){
if(document.form.largec.checked)
{
 totalq=0;
var c2=document.form.large.value;
if(isInteger(c2))
 {
//alert(c2);
if(document.form.largec.checked)
{
c2 = c2-1 ;
}
if(c2 >= 0)
{
 document.form.large.value=c2 ;
 if(document.form.largec.checked)
{
 totalq=parseInt(c2)
// alert(totalq);
}
  if(document.form.mediumc.checked)
{
  totalq=parseInt(totalq) +parseInt(document.form.medium.value) 
  // alert("medium"+totalq);
}
 if(document.form.smallc.checked)
{
 totalq=parseInt(totalq) +parseInt(document.form.small.value)
  //alert("small"+totalq);
}


document.form.textfield.value=totalq;
 totalamt();

}else{

 alert("please enter valid integers");
  document.form.large.value=0;
return false;
 }
 }else{
   alert("please enter valid numbers");
    document.form.large.value=0;
   return false;
 }
}
} 
 
function update2(){
if(document.form.largec.checked)
{
totalq=0;
 z2=document.form.large.value
 if(isInteger(z2))
 {
//alert(z);
  
if(z2=="")
{
 z2=parseInt(0);
}else{
if(document.form.largec.checked)
{
z2=parseInt(z2)+parseInt(1) ;
}
z2=parseInt(z2);
 }
 if(z2 >= 0)
  {
 //alert(z);
document.form.large.value=z2 ;
if(document.form.smallc.checked)
{
 totalq=parseInt(totalq) +parseInt(document.form.small.value) 
}
if(document.form.mediumc.checked)
{
 totalq=parseInt(totalq) +parseInt(document.form.medium.value) 
}
if(document.form.largec.checked)
{
 totalq=parseInt(totalq) +parseInt(z2) 
}
document.form.textfield.value=totalq;
totalamt();
}else{
 document.form.large.value=0;
  alert("Please enter correct values");
  return false;
}
}else{
  alert("Please enter correct values");
   document.form.large.value=0;
  return false;
}
}
}
function isInteger(number)
{
  return (number.toString().search(/^-?[0-9]+$/) == 0);
}

function totalamt(){
t=0;
var cc= document.form.textfield.value

if(cc>0)
{
var ship=document.form.india.checked
 for (i=0; i<document.form.india.length; i++) 
 {
         if (document.form.india[i].checked==true)
         {
            t =document.form.india[i].value
         }
      }
//alert(t);
//alert(cc);
if(t>0)
{
 
 finalamt=parseInt(cc)*parseInt(500); 
 //alert("qproce"+finalamt);
 finalamt=parseInt(finalamt)+parseInt(t)
  //alert("aftershqproce"+finalamt);
 
document.form.calamount.value=parseInt(finalamt);
}else{
  alert("please select the shipping method");
  return false;
}
}else{
 document.form.calamount.value=parseInt(0);
}



}
 
 