function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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 MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}



function chkflds(){
frm=document.add;

if(frm.name.value==""){
alert("First Name of Member is required");
frm.name.focus();
return false;
}

else{
if(frm.lname.value==""){
alert("Last Name of member is required");
frm.lname.focus();
return false;
}

else{
if(frm.age.value==""){
alert("Member's Age is required");
frm.age.focus();
return false;
}
else{
if(frm.address.value==""){
alert("Street address is required");
frm.address.focus();
return false;
}
else{
if(frm.city.value==""){
alert("City is required");
frm.city.focus();
return false;
}

else{
if(frm.state.value==""){
alert("State is required");
frm.state.focus();
return false;
}

else {
if(frm.zip.value == ""){
alert("Please enter Postal Zip Number");
frm.zip.focus();
return false;
}

else {
if(frm.password.value==""){
alert("Please enter password");
frm.password.focus();
return false;
}

else{
if(frm.email.value==""){
alert("Member's email is required as an Login ID");
frm.email.focus();
return false;
}

else{
if(frm.email.value != ""){
var mailid=frm.email.value
var maillength=mailid.length
var i=0
var st=""
var at_num=0
var dot_num=0
var enderror="no"
var starterror="no"
var mailerror="no"
if(mailid.substr(maillength-1,1) == "." || mailid.substr(maillength-1,1) == "@"){
enderror="yes"
mailerror="yes"
}
if(mailid.substr(0,1) == "." || mailid.substr(0,1) == "@"){
starterror="yes"
mailerror="yes"
}

if(enderror=="no" && starterror=="no"){
while(i<maillength){
st=mailid.substr(i,1);
if(st == "@")at_num++;
if(st == ".")dot_num++;
i++
}
if(at_num != 1 || dot_num == 0){
mailerror="yes"
}
}
if(mailerror=="yes"){
alert("Invalid E-mail Address!...");
frm.email.focus();
return false;
}
}
}
}
}
}
}
}
}
}
}

}





function chklogin(){
frm=document.login;
if(frm.email.value==""){
alert("Member's email is required as an Login ID");
frm.email.focus();
return false;
}

else{
if(frm.email.value != ""){
var mailid=frm.email.value
var maillength=mailid.length
var i=0
var st=""
var at_num=0
var dot_num=0
var enderror="no"
var starterror="no"
var mailerror="no"
if(mailid.substr(maillength-1,1) == "." || mailid.substr(maillength-1,1) == "@"){
enderror="yes"
mailerror="yes"
}
if(mailid.substr(0,1) == "." || mailid.substr(0,1) == "@"){
starterror="yes"
mailerror="yes"
}

if(enderror=="no" && starterror=="no"){
while(i<maillength){
st=mailid.substr(i,1);
if(st == "@")at_num++;
if(st == ".")dot_num++;
i++
}
if(at_num != 1 || dot_num == 0){
mailerror="yes"
}
}
if(mailerror=="yes"){
alert("Invalid E-mail Address!...");
frm.email.focus();
return false;
}
}
if(frm.password.value==""){
alert("Please enter password");
frm.password.focus();
return false;
}
}


}








function chkwish(){
frm=document.wish;
if(frm.email.value==""){
alert("Invalid Email id for contact confirmation");
frm.email.focus();
return false;
}

else{
if(frm.email.value != ""){
var mailid=frm.email.value
var maillength=mailid.length
var i=0
var st=""
var at_num=0
var dot_num=0
var enderror="no"
var starterror="no"
var mailerror="no"
if(mailid.substr(maillength-1,1) == "." || mailid.substr(maillength-1,1) == "@"){
enderror="yes"
mailerror="yes"
}
if(mailid.substr(0,1) == "." || mailid.substr(0,1) == "@"){
starterror="yes"
mailerror="yes"
}

if(enderror=="no" && starterror=="no"){
while(i<maillength){
st=mailid.substr(i,1);
if(st == "@")at_num++;
if(st == ".")dot_num++;
i++
}
if(at_num != 1 || dot_num == 0){
mailerror="yes"
}
}
if(mailerror=="yes"){
alert("Invalid E-mail Address!...");
frm.email.focus();
return false;
}
}
if(frm.name.value==""){
alert("Please enter name of the applicant");
frm.name.focus();
return false;
}


if(frm.product.value==""){
alert("Please enter Product you wish!");
frm.product.focus();
return false;
}
}
}








function chkcontact(){
frm=document.contact;
if(frm.email.value==""){
alert("Invalid Email id for contact confirmation");
frm.email.focus();
return false;
}

else{
if(frm.email.value != ""){
var mailid=frm.email.value
var maillength=mailid.length
var i=0
var st=""
var at_num=0
var dot_num=0
var enderror="no"
var starterror="no"
var mailerror="no"
if(mailid.substr(maillength-1,1) == "." || mailid.substr(maillength-1,1) == "@"){
enderror="yes"
mailerror="yes"
}
if(mailid.substr(0,1) == "." || mailid.substr(0,1) == "@"){
starterror="yes"
mailerror="yes"
}

if(enderror=="no" && starterror=="no"){
while(i<maillength){
st=mailid.substr(i,1);
if(st == "@")at_num++;
if(st == ".")dot_num++;
i++
}
if(at_num != 1 || dot_num == 0){
mailerror="yes"
}
}
if(mailerror=="yes"){
alert("Invalid E-mail Address!...");
frm.email.focus();
return false;
}
}
if(frm.name.value==""){
alert("Please enter name of the applicant");
frm.name.focus();
return false;
}


if(frm.comments.value==""){
alert("Please enter comments you wish to send us!");
frm.comments.focus();
return false;
}
}
}


function newPopUp() {
var raj = "forgot_pass.php";
apop = window.open(raj,'apop','toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,height=150,width=350, raised=1');
}



var message="Sorry, right click is disabled !";

///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")








function chk_order(){
frm=document.order;
if(frm.item_code.value==""){
alert("Please specify atleast one product item!");
frm.item_code.focus();
return false;
}

else{
if(frm.name.value==""){
alert("Person name Required !");
frm.name.focus();
return false;
}
else{
if(frm.shipping_address.value==""){
alert("Please specify Shipping Address !");
frm.shipping_address.focus();
return false;
}


else{
if(frm.email.value==""){
alert("Please enter a valid email address!");
frm.email.focus();
return false;
}

else{
if(frm.email.value != ""){
var mailid=frm.email.value
var maillength=mailid.length
var i=0
var st=""
var at_num=0
var dot_num=0
var enderror="no"
var starterror="no"
var mailerror="no"
if(mailid.substr(maillength-1,1) == "." || mailid.substr(maillength-1,1) == "@"){
enderror="yes"
mailerror="yes"
}
if(mailid.substr(0,1) == "." || mailid.substr(0,1) == "@"){
starterror="yes"
mailerror="yes"
}

if(enderror=="no" && starterror=="no"){
while(i<maillength){
st=mailid.substr(i,1);
if(st == "@")at_num++;
if(st == ".")dot_num++;
i++
}
if(at_num != 1 || dot_num == 0){
mailerror="yes"
}
}
if(mailerror=="yes"){
alert("Invalid E-mail Address!...");
frm.email.focus();
return false;
}
}
}

}
}
}

}




function addurl_form(){

if (document.add_url.title.value == ""){
		alert("Please enter Title of your website")
		document.add_url.title.focus()
		return false;
	}
	
if (document.add_url.url.value == ""){
		alert("Please enter URL of your website")
		document.add_url.url.focus()
		return false;
	}
	
if (document.add_url.rurl.value == ""){
		alert("Please enter Reciprocal URL where our link is palced in your website")
		document.add_url.rurl.focus()
		return false;
	}


if(document.add_url.email.value.length==0){
		alert("Email feild is required !...")
                document.add_url.email.focus()
            return false;
                    }
       else{
            var maillength=document.add_url.email.value.length
            var posat=document.add_url.email.value.indexOf("@")   
            var posdot=document.add_url.email.value.indexOf(".") 
           if(posat <= 0 || posat ==maillength-1 || posdot < posat || posdot == maillength-1){
                 alert("Sorry! That dosen't seem to be a valid e-mail account...")
                document.add_url.email.focus()
        return false;
               }
}

}
