function test(theform)
{
alert("Kindly complete your monetary transaction before you add any more items to your cart.");
return false;
}

function modtest(theform)
{
alert("You cannot modify your cart anymore. Please click on checkout and finish the present transaction.");
return false;
}

function silver(theform)
{
alert("Silver items will require a minimum of 4 days for delivery.");
}

function sarees(theform)
{
alert("Saree orders will require a minimum of 3 days for delivery.");
}

function jewellery(theform)
{
alert("Jewellery items will require a minimum of 4 days for delivery.");
}

function serviceschk(theform)
{
if (theform.checkrep.checked==false && theform.checkphoto.checked==false && theform.checkgreeting.checked==false)
{
alert("Please select the service.");
theform.checkrep.focus();
return false;
}
return true;
}


function ostatus(theForm)
{

if(theForm.Orderid.value=="")
  {
   alert("Please enter a valid Order No.")
   theForm.Orderid.focus();
   return false;
  }  
return true;
}

function cal(obj)
{
var col
col=obj.options[obj.selectedIndex].value
document.forms[1].elements[6].value=col
return true;
}

function c(obj,i)
{
var col
col=obj.options[obj.selectedIndex].value
i=i*2
document.forms[i].elements[4].value=col
return true;
}


function reminder(theForm)
{
  if(theForm.rname.value=="")
  {
   alert("Please enter a valid name.")
   theForm.rname.focus();
   return false;
  }

  if(theForm.rocc[theForm.rocc.selectedIndex].value=="")
  {
  alert("Choose an occasion.");
  theForm.rocc.focus();
  return false;
  }
  
  if (theForm.rmonth.selectedIndex==0)
  {
  alert("Please select the month.");
  theForm.rmonth.focus();
  return false;
  }
 
  if (theForm.rday.selectedIndex==0)
  {
  alert("Please select the date.");
  theForm.rday.focus();
  return false;
  }

  if (theForm.ryear.selectedIndex==0)
  {
  alert("Please select the year.");
  theForm.ryear.focus();
  return false;
  }

  if(theForm.rcomments.value=="")
  {
   alert("Please enter some comments.")
   theForm.rcomments.focus();
   return false;
  }
  else
  {
  maxchar();
  //return false;
  }
return true;
}

function checkctus(theForm)
{
  if(theForm.email.value=="")
  {
   alert("Please enter a valid email address.")
   theForm.email.focus();
   return false;
  }  

  if(theForm.email.value.indexOf("@") == -1)
   {
   alert("Please enter a valid email address.")
   theForm.email.focus();
   theForm.email.select();
   return false;
   }
  if(theForm.email.value.indexOf(".") == -1)
  {
   alert("Please enter a valid email address.")
   theForm.email.focus();
   theForm.email.select(); 
   return false;
   }

  if(theForm.confirmemail.value=="")
  {
   alert("Please enter a valid email address.")
   theForm.confirmemail.focus();
   return false;
  }  

  if(theForm.confirmemail.value.indexOf("@") == -1)
   {
   alert("Please enter a valid email address.")
   theForm.confirmemail.focus();
   theForm.confirmemail.select();
   return false;
   }
  if(theForm.confirmemail.value.indexOf(".") == -1)
  {
   alert("Please enter a valid email address.")
   theForm.confirmemail.focus();
   theForm.confirmemail.select(); 
  return false;
   }

if(theForm.confirmemail.value!=theForm.email.value)
  {
   alert("Your Email value does not match with your Confirm Email value.")
   theForm.confirmemail.focus();
   theForm.confirmemail.select(); 
  return false;
   }

  if(theForm.comment.value=="")
  {
   alert("Please enter some comments.")
   theForm.comment.focus();
   theForm.comment.select(); 
  return false;
   }

return true;
}

function numberval(num)
{
   var i=0;
   var j=0;
   for(i=0;i<num.length;i++)
   {
   if(num.charAt(i) < '0'|| num.charAt(i) > '9') 
   return false;
   }
   
   if(num.charAt(0) < '1')
   {
	for(i=1;i<num.length;i++)
	 {
	   if(num.charAt(i) > '0')
		j=j+1
	 }
	 if(j>0)
	 {}
	 else
	   return false;
    }
   return true;
}


function specialval(num)
{
  var i=0;
   var j=0;
   for(i=0;i<num.length;i++)
   {
if(num.charAt(i) < '0'|| num.charAt(i) > '9') 
{
   if(!(num.charAt(i) == ' ' || num.charAt(i) == '(' || num.charAt(i)==')' || num.charAt(i)==',' || num.charAt(i)=='/' || num.charAt(i)=='-')) 
   {
    return false;
   }
}
}

    return true
   
}



function updateinfo(theForm)
{

if(theForm.fname.value== "")        
  {
   alert("Please enter your first name.");
   theForm.fname.focus();
   theForm.fname.select();
   return false;
   }

  if(theForm.lname.value== "")        
  {
   alert("Please enter your last name.");
   theForm.lname.focus();
   theForm.lname.select();
   return false;
   }


 if(theForm.address.value== "")        
  {
   alert("Please enter your address.");
   theForm.address.focus();
   theForm.address.select();
   return false;
   }

  if(theForm.city.value== "")
  {
   alert("Please enter the City.");
   theForm.city.focus();
   theForm.city.select();
   return false;
   }

  if(theForm.state.value== "")        
  {
   alert("Please enter the State.");
   theForm.state.focus();
   theForm.state.select();
   return false;
   }

if(theForm.postcode.value== "")        
  {
   alert("Please enter your Postal code.");
   theForm.postcode.focus();
   theForm.postcode.select();
   return false;
   }


  if(theForm.country.value== "")        
  {
   alert("Please enter your Country.");
   theForm.country.focus();
   theForm.country.select();
   return false;
   }


if(theForm.phonep.value== "")        
  {
   alert("Please enter your phone number.");
   theForm.phonep.focus();
   theForm.phonep.select();
   return false;
   }

//if(!numberval(window.document.FOS.phonep.value))
//     {

if(!specialval(window.document.FOS.phonep.value))
{
      alert("Please enter numbers in Phone field, Alphabets and special characters not accepted.");
      window.document.FOS.phonep.focus();
      return false;
}


  if(theForm.email.value.indexOf("@") == -1)
   {
   alert("Please enter a valid email address.")
   theForm.email.focus();
   theForm.email.select();
   return false;
   }
  if(theForm.email.value.indexOf(".") == -1)
{
   alert("Please enter a valid email address.")
   theForm.email.focus();
   theForm.email.select(); 
  return false;
   }

}

function loginval(theForm)
{

if(theForm.Login.value == "")
{
    alert("Please enter your User ID.")
    theForm.Login.focus();
    theForm.Login.select();   
    return false;
}
 if(theForm.Password.value == "")
  {
    alert("Please enter your password.")
    theForm.Password.focus();
    theForm.Password.select();   
    return false;
    }
return true;
}

function check(theForm)
{
  if(theForm.fname.value== "")        
  {
   alert("Please enter your first name.");
   theForm.fname.focus();
   theForm.fname.select();
   return false;
   }

  if(theForm.lname.value== "")        
  {
   alert("Please enter your last name.");
   theForm.lname.focus();
   theForm.lname.select();
   return false;
   }

 if(theForm.address.value== "")        
  {
   alert("Please enter your address.");
   theForm.address.focus();
   theForm.address.select();
   return false;
   }

 if(theForm.LandMark.value== "")        
  {
   alert("Please enter the Land Mark.");
   theForm.LandMark.focus();
   theForm.LandMark.select();
   return false;
   }

  if(theForm.city.value== "")
  {
   alert("Please enter the City.");
   theForm.city.focus();
   theForm.city.select();
   return false;
   }

  if(theForm.state.value== "")        
  {
   alert("Please enter the State.");
   theForm.state.focus();
   theForm.state.select();
   return false;
   }

if(theForm.postcode.value== "")        
  {
   alert("Please enter your Postal code.");
   theForm.postcode.focus();
   theForm.postcode.select();
   return false;
   }


  if(theForm.country.value== "")        
  {
   alert("Please enter your Country.");
   theForm.country.focus();
   theForm.country.select();
   return false;
   }


if(theForm.phonep.value== "")
  {
   alert("Please enter your phone number.");
   theForm.phonep.focus();
   theForm.phonep.select();
   return false;
   }

//if(!numberval(window.document.FOS.phonep.value))
//     {
	if(!specialval(window.document.FOS.phonep.value))
	{
      alert("Please enter numbers in Phone field, Alphabets and Special characters not accepted.");
      window.document.FOS.phonep.focus();
      return false;
	}
//}


  if(theForm.email.value.indexOf("@") == -1)
   {
   alert("Please enter a valid email address.")
   theForm.email.focus();
   theForm.email.select();
   return false;
   }
  if(theForm.email.value.indexOf(".") == -1)
{
   alert("Please enter a valid email address.")
   theForm.email.focus();
   theForm.email.select(); 
  return false;
   }
 
if(theForm.loginname.value == "")
{
    alert("Please enter your login name.")
    theForm.loginname.focus();
    theForm.loginname.select();   
    return false;
}
 
return true;
}


function resendactivation(theform)
{
if(theform.userid.value=="")
{
alert("Please enter your userid.")
theform.userid.select();
theform.userid.focus();
return false;
}
 return true;
}



function forg(theForm)
{

if(theForm.name.value == "")
{
    alert("Please enter your name.")
    theForm.name.focus();
    theForm.name.select();   
    return false;
}

if(theForm.userid.value == "")
{
    alert("Please enter your User Id.")
    theForm.userid.focus();
    theForm.userid.select();   
    return false;
}
return true;
}

window.name="checkout"
function acartjew(theForm)
{
//alert("hello")
if((theForm.HiddPrice.value != ""))
{
mwin=window.open('addtocart.asp','popup','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,width=380,height=175,left=220,top=220');
}
return true;
}

window.name="checkout"
function acart(theForm)
{
if((theForm.HiddPrice.value != "") && (theForm.Qty.value!= ""))
{
mwin=window.open('addtocart.asp','popup','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,width=380,height=175,left=220,top=220');
}
return true;
}


window.name="checkout"
function acart1(theForm)
{
if((theForm.HiddPrice.value != "") && (theForm.Qty.value!= ""))
{
mwin=window.open('../addtocart.asp','popup','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,width=380,height=175,left=220,top=220');
}
return true;
}


window.name="checkout"
function acart1jew(theForm)
{
if((theForm.HiddPrice.value != ""))
{
mwin=window.open('../addtocart.asp','popup','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,width=380,height=175,left=220,top=220');
}
return true;
}



function qty(theForm)
{
/*if((theForm.HiddPrice.value != "") && (theForm.Qty.value!= ""))

{
    alert("Your items are added to cart")
    //return false;
}*/

/*if((theForm.HiddPrice.value != "") && (theForm.Qty.value!= ""))
{
mwin=window.open('http://server/websites/indiaeshop/details/addtocart.asp','Popup','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,copyhistory=0,width=360,height=180,left=220,top=220');
}*/


/*if(theForm.name=="flowersform")
{
if(theForm.elements[7].value=="Your Message")
{
alert("Enter the required message on the complimentary card");
theForm.elements[7].value="";
theForm.elements[7].select();
return false;
}
}

if(theForm.name=="cakesform")
{
if(theForm.elements[9].value=="Your Message")
{
alert("Enter the required message on the cake");
theForm.elements[9].value="";
theForm.elements[9].select();
return false;
}
}

if(theForm.name=="cakesformdet")
{
if(theForm.elements[8].value=="Your Message")
{
alert("Enter the required message on the cake");
theForm.elements[8].value="";
theForm.elements[8].select();
return false;
}
}
*/


if(theForm.name=="WishFormdud")
{
}
else
{
if(theForm.name=="addform")
{
var i
i=theForm.Qty.value
var a=parseInt(theForm.Qty.value)
var c=parseInt(theForm.NSPrice.value)
var b=parseInt(theForm.HiddPrice.value)
var d=a*c+b
/*
if(((theForm.HiddStatus.value)=="G") && (d>15000))
{
alert("Your spending limit per session is Rs. 15000/-....")
if(theForm.elements[5].value=="Yes")
{
theForm.elements[5].value="No"
}
return false;
}

if(((theForm.HiddStatus.value)=="Y") && (d>15000))
{
alert("Since you are shopping for the first time on VizagEShop.com,\nyour spending limit is Rs. 15000/-")
if(theForm.elements[5].value=="Yes")
{
theForm.elements[5].value="No"
}
return false;
}

*/
if(theForm.Qty.value == "")
{
    alert("Please enter the quantity required")
    theForm.Qty.focus();
    theForm.Qty.select();   
    return false;
}

if(!numberval(theForm.Qty.value))
     {
      alert("Please enter numbers in Quantity field, Alphabets not accepted. Also do not enter zero.");
    theForm.Qty.focus();
    theForm.Qty.select();   
      return false;
}
if(i.length>3)
{
alert("Trying to add too many");
    theForm.Qty.focus();
    theForm.Qty.select();   
 return false;

}
}
else
{
if(theForm.elements[7].value=="Yes")
{
}
else
{
var i
i=theForm.Qty.value

var a=parseInt(theForm.Qty.value)
var c=parseInt(theForm.NSPrice.value)
var b=parseInt(theForm.HiddPrice.value)

if((theForm.name=="cakesform") || (theForm.name=="cakesformdet"))
{
//alert("theform: " + theForm.Weight[theForm.Weight.selectedIndex].value);
var e=parseInt(theForm.Weight[theForm.Weight.selectedIndex].value)
var g=e*c
var d=a*g+b
}
else
{

var d=a*c+b
}


if(theForm.Qty.value == "")
{
    alert("Please enter the quantity required")
    theForm.Qty.focus();
    theForm.Qty.select();   
    return false;
}

if(!numberval(theForm.Qty.value))
{
alert("Please enter numbers in Quantity field, Alphabets not accepted. Also do not enter zero.");

theForm.Qty.focus();
theForm.Qty.select();   
return false;
}

if(i.length>3)
{
alert("Trying to add too many");
theForm.Qty.focus();
theForm.Qty.select();   
return false;
}


if (theForm.name=="Wishform" && theForm.Icode.value=="GJ")
{
if(theForm.Qty.value>2 && (theForm.ItemName.value=="Bangles" || theForm.ItemName.value=="Ear Rings"))
{
alert("You cannot order more than two bangles or ear rings during any one transaction.");
theForm.Qty.focus();
theForm.Qty.select();
return false;
}

if(theForm.Qty.value>1 && theForm.ItemName.value=="Chain")
{
alert("You cannot order more than one chain during any one transaction.");
theForm.Qty.focus();
theForm.Qty.select();
return false;
}

}


/*
if(((theForm.HiddStatus.value)=="G") && (d>15000))
{
alert("Your spending limit per session is Rs. 15000/-....")
if(theForm.elements[5].value=="Yes")
{
theForm.elements[5].value="No"
}
return false;
}

if(((theForm.HiddStatus.value)=="Y") && (d>15000))
{
alert("Since you are shopping for the first time on VizagEShop.com,\nyour spending limit is Rs. 15000/-")
if(theForm.elements[5].value=="Yes")
{
theForm.elements[5].value="No"
}
return false;
}*/
}
}
}
return true;
}


function qtyjew(theForm)
{
var a=parseInt(theForm.qty[theForm.qty.selectedIndex].value)
var c=parseInt(theForm.NSPrice.value)
var b=parseInt(theForm.HiddPrice.value)

var d=a*c+b
/*
if(((theForm.HiddStatus.value)=="G") && (d>15000))
{
alert("Your spending limit per session is Rs. 15000/-....")

if(theForm.elements[5].value=="Yes")
{
theForm.elements[5].value="No"
}
return false;
}

if(((theForm.HiddStatus.value)=="Y") && (d>15000))
{
alert("Since you are shopping for the first time on VizagEShop.com,\nyour spending limit is Rs. 15000/-")
if(theForm.elements[5].value=="Yes")
{
theForm.elements[5].value="No"
}
return false;
}*/
return true;
}


function modqty(theForm,i)
{
var chk;
var nos;
var no;
var j;
nos=1;
var tot;
tot=0;
var p;
p=0;
chk=0;
for(j=1;j<=i;j++)
{
if(theForm.elements[nos-1].checked)
{
chk=chk+1;
}
else
{

if(theForm.elements[nos].value == "")
{   
    alert("Please enter the quantity required")
    theForm.elements[nos].focus();
    theForm.elements[nos].select();   
    return false;
    break;
}

if(!numberval(theForm.elements[nos].value))
{
    alert("Please enter numbers in Quantity field, Alphabets not accepted. Also do not enter zero.");
    theForm.elements[nos].focus();
    theForm.elements[nos].select();   
    return false;
    break; 
}

no=theForm.elements[nos].value
if(no.length>3)
{
    alert("Trying to add too many");
    theForm.elements[nos].focus();
    theForm.elements[nos].select();   
    return false;
    break;
}


tot=tot+(theForm.elements[nos].value*theForm.elements[nos+1].value)
}

if(theForm.elements[nos+2].value=="GJ")
{
     if (theForm.elements[nos].value>2 && (theForm.elements[nos+3].value=="Bangles" || theForm.elements[nos+3].value=="Ear Rings"))
     {
     alert("You cannot order more than two bangles or ear rings during any one transaction.");
     theForm.elements[nos].focus();
     theForm.elements[nos].select();
     return false;
     }
 
     if (theForm.elements[nos].value>1 && theForm.elements[nos+3].value=="Chain")   
     {
     alert("You cannot order more than one chain during any one transaction.");
     theForm.elements[nos].focus();
     theForm.elements[nos].select();
     return false;
     }
}


nos=nos+5;

}


/*
if(((theForm.HiddStatus.value)=="G") && (tot>15000))
{
if(chk>0)

{
alert("Your spending limit per session is Rs. 15000/-.\n\nYou have to delete some more products.")
}
else
{
alert("Your spending limit per session is Rs. 15000/-....")
return false;
}
}

if(((theForm.HiddStatus.value)=="Y") && (tot>15000))
{
if(chk>0)
{
alert("Your spending limit per session is Rs. 15000/-.\n\nYou have to delete some more products.")
}
else
{
alert("Since you are shopping for the first time on VizagEShop.com,\nyour spending limit is Rs. 15000/-")
return false;
}
}*/
return true;
}



function chg(theForm)
{

//if(theForm.user.value == "")
//{
//    alert("Please enter your login name")
//    theForm.user.focus();
//    theForm.user.select();   
//    return false;
//}
// if(theForm.oldpass.value == "")
//  {
//    alert("Please Enter your old password")
//    theForm.oldpass.focus();
//    theForm.oldpass.select();   
//    return false;
//    }

 if(theForm.newpass.value == "")
  {
    alert("Please Enter your new password")
    theForm.newpass.focus();
    theForm.newpass.select();   
    return false;
    }
if(theForm.conpass.value == "")
  {
    alert("Please Enter the Confirm Password")
    theForm.conpass.focus();
    theForm.conpass.select();
    return false;
    }

if(theForm.newpass.value != theForm.conpass.value)
{
alert("Your password field is not equal to the confirm password field")
theForm.conpass.focus();
theForm.conpass.select();
return false;
}
return true;
}

function maxchar()
{
    rc = document.form1.rcomments.value
    if (rc.length>=1000)
    {
        alert("You cannot enter more than 1000 characters.")
        document.form1.rcomments.blur()
    }
    
}

//Code for additonal services
var amtphoto,total;

function chgamount()
{
chk=eval("document.check.checkrep.checked")
if (chk==true)
{
amt=50;
eval("document.check.rmprice.value="+amt);
}
else if (chk==false)
{
amt=0;
eval("document.check.rmprice.value="+amt);
}

chk1=eval("document.check.checkphoto.checked")
if (chk1==true)
{
amtphoto=100;
eval("document.check.photoprice.value="+amtphoto);
}
else if (chk1==false)
{
amtphoto=0;
eval("document.check.photoprice.value="+amtphoto);
}

chk2=eval("document.check.checkgreeting.checked")
if (chk2==true)
{
amtgreeting=100;
eval("document.check.greetingprice.value="+amtgreeting);
}
else if (chk2==false)
{
amtgreeting=0;
eval("document.check.greetingprice.value="+amtgreeting);
}

//copies=eval("document.uploadform2.copies"+j+".options[document.uploadform2.copies"+j+".selectedIndex].value");
//amt1=amt*copies;
//total=amt+amtphoto;
total=amt+amtphoto+amtgreeting;
//alert(total)
eval("document.check.sevtotal.value="+total);
//calamount();
}


