function grayship(additionalproduct)
{
	if(additionalproduct==0)
	{
		document.itemfrm.shiptoaddress.disabled=true;
		document.itemfrm.shiptoaddress.style.background="#D6CFC5";
		document.itemfrm.x_Ship_To_First_Name.disabled=true;
		document.itemfrm.x_Ship_To_First_Name.style.background="#D6CFC5";
		document.itemfrm.x_Ship_To_Last_Name.disabled=true;
		document.itemfrm.x_Ship_To_Last_Name.style.background="#D6CFC5";
		document.itemfrm.x_Ship_To_Address.disabled=true;
		document.itemfrm.x_Ship_To_Address.style.background="#D6CFC5";
		document.itemfrm.x_Ship_To_City.disabled=true;
		document.itemfrm.x_Ship_To_City.style.background="#D6CFC5";
		document.itemfrm.x_Ship_To_State.disabled=true;
		document.itemfrm.x_Ship_To_State.style.background="#D6CFC5";
		document.itemfrm.x_Ship_To_Zip.disabled=true;
		document.itemfrm.x_Ship_To_Zip.style.background="#D6CFC5";
		document.itemfrm.x_Ship_To_Country.disabled=true;
		document.itemfrm.x_Ship_To_Country.style.background="#D6CFC5";
		/*
		document.itemfrm.x_Ship_To_Phone.disabled=true;
		document.itemfrm.x_Ship_To_Phone.style.background="#D6CFC5";
		document.itemfrm.x_Ship_To_Email.disabled=true;
		document.itemfrm.x_Ship_To_Email.style.background="#D6CFC5";
		document.itemfrm.ship_conemail.disabled=true;
		document.itemfrm.ship_conemail.style.background="#D6CFC5";
		*/
	}
}






// to get the todays date
var todate = new Date()
var tyear = todate.getYear()
var tmonth = todate.getMonth() + 1
var tdate = todate.getDate()

/*****************************************************************************/
// SUBMITTING FROM THE PASSWORD FIELD
function chklogin()
{
	//alert("eve :"+event.keyCode)
	if(event.keyCode == 13)
	login()
}

/*****************************************************************************/
function login()
{
	//index.php - for admin
	var message="";
	if(document.loginfrm.userid.value.length==0)
	message=message+"Enter Name!\n";
	if(document.loginfrm.password.value.length==0)
	message=message+"Enter Password!\n";

	if(message.length>0)
	alert(message)
	else
	document.loginfrm.submit();
}

/*****************************************************************************/

/**************************EMAIL CHECKING***************************/

function checkmail(fldname)
{

	//for all email fields in any forms - BOTH FOR ADMIN/USERS

	email = fldname.value;
	var len = email.length;
	if(len<5)
	{
		alert("Invalid Email - id")
		fldname.value="";
	}
	else
	{

		var index1 = email.indexOf('@');
		var subind = email.substring(0,index1);
		var indlen = subind.length;
		var index2 = email.indexOf('.');
		var subind1=email.substring(indlen+1,index2);
		var indlen1 = subind1.length;
		var index3 = email.indexOf(' ');
		var subind3=email.substring(index2+1,len)
		var indlen2 = subind3.length;
		if((index1!= -1)&&(index2!= -1)&&(index3==-1))
		{
			if((indlen!=0)&&(indlen1!=0)&&(indlen2!=0))
			{
				//alert("valid Email -id");
				/*
				var subval1 = email.substring(index1+1,email.length);
				//alert(subval1)
				var pos1 = subval1.indexOf('@');
				var pos2 = subval1.indexOf('.');
				var subval2 = email.substring(pos2+1,email.length);
				alert(subval2)
				var pos3 = subval2.indexOf('.');
				var pos4 = subval1.indexOf(' ');
				if(pos1 != -1)
				alert("Invalid Email - id1");
				if(pos3 != -1)
				alert("Invalid Email - id2");
				if(pos4 != -1)
				alert("Invalid Email - id3");
				*/
			}
			else
			{
				alert("Invalid Email - id")
				fldname.value="";
				fldname.select();
				fldname.focus();
			}
		}
		else
		{
			alert("Invalid Email - id");
			fldname.value="";
			fldname.select();
			fldname.focus();
		}
	} // end of else if len<5
}

/*****************************************************************************/
// confirm password validation
function chkconpass()
{
	// for registerform.php

	var pass = document.regfrm.password.value
	var conpass = document.regfrm.txtconpass.value

	if( conpass == pass)
	{

		document.regfrm.email.focus
	}
	else
	{
		alert("Confirmed password is incorrect")
		document.regfrm.txtconpass.value = ""
		document.regfrm.txtconpass.focus
	}
}

/*****************************************************************************/

// TO CHECK NULL IN REGISTRATION
function registration()
{
	// for registration
	var str;
	str ="";
	var user = document.regfrm.userid.value
	var pass = document.regfrm.password.value
	var conpass = document.regfrm.txtconpass.value
	var email = document.regfrm.email.value
	var add1 = document.regfrm.addr1.value
	var city = document.regfrm.city.value
	var state = document.regfrm.state.value
	var country = document.regfrm.country.value
	var zip = document.regfrm.zipcode.value
	var phone = document.regfrm.phone.value

	if(user == "")
	{
		str = "Enter User Name \n"
	}
	if(pass == "")
	{
		str += "Enter Password  \n"
	}
	if(conpass == "")
	{
		str += "Confirm Password \n"
	}
	if(email == "")
	{
		str += "Enter Email \n"
	}
	if(add1 == "")
	{
		str += "Enter Address \n"
	}
	if(city == "")
	{
		str += "Enter City \n"
	}
	if(state == "")
	{
		str += "Enter State \n"
	}
	if(zip == "")
	{
		str += "Enter Zipcode \n"
	}
	if(country == "")
	{
		str += "Enter Country \n"
	}
	if(phone == "")
	{
		str += "Enter Phone Number \n"
	}

	if(str != "")
	{
		alert(str)
	}
	else
	{
		if(conpass != pass)
		{
			alert("Confirmed password is incorrect")
			document.regfrm.txtconpass.value = ""
			document.regfrm.txtconpass.select()
			document.regfrm.txtconpass.focus()
		}
		document.regfrm.submit()
	}
}
/*****************************************************************************/
function forgotpass()
{
	var message="";
	if(document.forgotpassfrm.username.value.length==0)
	message=message+"Enter Username!\n";
	if(document.forgotpassfrm.email.value.length==0)
	message=message+"Enter Email!\n";
	if(message.length>0)
	alert(message)
	else
	document.forgotpassfrm.submit();

}


/*****************************************************************************/

var name;
var pass;
var str;
str="";

function tochangepword()
{
	var str
	str = ""
	var email = document.form1.emailhidd.value;
	var pword = document.form1.passhidd.value;
	//alert(emailid)
	//alert(email + " pass " + pword)
	userid = document.form1.userid.value;
	pass = document.form1.password.value;
	npass = document.form1.newpassword.value;

	if(userid == "")
	{
		str = "You must enter the UserID \n"
	}
	if(pass == "")
	{
		str += "You must enter the Original Password \n"
	}
	if(npass == "")
	{
		str += "You must enter the New Password \n"
	}

	if(str == "")
	{
		if((userid == email)&&(pass == pword))
		{
			document.form1.submit()
		}
		if((userid == email)&&(pass != pword))
		{
			//alert("inside if")
			alert("Enter a Valid Password")
			document.form1.password.value = ""
			document.form1.password.focus
		}
		if((userid != email)&&(pass == pword))
		{
			//alert("inside if userod")
			alert("Enter a Valid Email ID")
			document.form1.userid.value = ""
			document.form1.userid.focus
		}

		if((userid != email)&&(pass != pword))
		{
			alert("Enter a Valid Email ID & Password")

			document.form1.userid.value = ""
			document.form1.password.value = ""
			document.form1.userid.focus
		}

	}
	else
	{
		alert(str)
		document.form1.userid.focus
	}
}

/*****************************************************************************/

function addcategory()
{
	//admin_addprojectcategory.php
	var message="";

	if(document.addcategoryfrm.catname.value.length==0)
	alert("Enter Category name!");
	else
	document.addcategoryfrm.submit();
}

/***************************************************************************/

function editcategory()
{
	if(document.updatecategoryfrm.updatecategory.value==-1)
	alert("Select Category!");
	else
	document.updatecategoryfrm.submit();
}
/***************************************************************************/
function deletecategory()
{
	if(document.deletecategoryfrm.deletecategory.value==-1)
	alert("Select Category!");
	else
	document.deletecategoryfrm.submit();
}
/***************************************************************************/

function addsubcategory()
{
	//addmaincategory.php
	var message="";

	if(document.addcategoryfrm.subcatname.value.length==0)
	alert("Enter Maincategory name!");
	else
	document.addcategoryfrm.submit();
}

/***************************************************************************/

function editsubcategory()
{
	if(document.updatecategoryfrm.updatecategory.value==-1)
	alert("Select Maincategory!");
	else
	document.updatecategoryfrm.submit();
}
/***************************************************************************/
function deletesubcategory()
{
	if(document.deletecategoryfrm.deletecategory.value==-1)
	alert("Select Maincategory!");
	else
	document.deletecategoryfrm.submit();
}

/***************************************************************************/
//	TO SELECT CATEGORY
function changecategory(catname,form,fname)
{
	var catname = catname.value
	form.action=fname+".php?catname="+catname
	form.submit()
}

/***************************************************************************/

//	TO CHECK LOGIN
function checklogin()
{
	var str
	str = ""
	var user = document.loginfrm.userid.value
	var pass = document.loginfrm.password.value

	if(user == "")
	str = "Enter the User ID \n"
	if(pass == "")
	str += "Enter the Password"
	if(str != "")
	alert(str)
	else
	document.loginfrm.submit()
}

/***************************************************************************/

//TO ADD MERCHANT ACCOUNT
function addmerchant()
{
	var str;
	str = "";
	//var catname = document.merfrm.catname.value
	//var subcatname = document.merfrm.subcatname.value
	var mname = document.merfrm.merchantname.value
	var url = document.merfrm.url.value
	var desc = document.merfrm.description.value
	/*
	if(catname == "")
	str += "Select the Category \n";
	if(subcatname == "")
	str += "Select the SubCategory \n";
	*/
	if(mname == "")
	str += "Enter the Merchant Name \n";
	if(url == "")
	str += "Enter the Merchant URL \n";
	if(desc == "")
	str += "Enter the Description \n";
	if(str != "")
	alert(str)
	else
	document.merfrm.submit()
}

/***************************************************************************/

//TO ADD COUPON INFO
function addcoupon()
{
	var str;
	str = "";
	var title = document.merfrm.title.value
	var cname = document.merfrm.subcatname.value
	var mname = document.merfrm.merchantname.value
	//	var amt  = document.merfrm.amount.value
	//	var styear = document.merfrm.st_year.value
	//	var stmon = document.merfrm.st_month.value
	//	var stdate = document.merfrm.st_date.value
	//	var expyear = document.merfrm.exp_year.value
	//	var expmon = document.merfrm.exp_month.value
	//	var expdate = document.merfrm.exp_date.value
	var desc = document.merfrm.description.value
	var status = document.merfrm.status.value

	if(cname == "")
	str += "Select the Sub Category Name \n";
	if(mname == "")
	str += "Select the Merchant Name \n";
	if(title == "")
	str += "Enter the Title \n";
	//	if(amt == "")
	//		str += "Enter the Amount \n";
	//	if(styear == "" || stmon == "" || stdate == "")
	//		str += "Select the Start Date \n";
	//	if(expyear == "" || expmon == "" || expdate == "")
	//		str += "Select the Expiry Date \n";
	if(desc == "")
	str += "Enter the Description \n";
	if(status == "")
	str += "Select the Status \n";
	if(str != "")
	alert(str)
	else
	document.merfrm.submit()
}

/***************************************************************************/

// TELL A FRIEND
function tellaction()
{
	var catname = "<?php echo $cat; ?>"
	alert(catname)
}


/***************************************************************************/

// TELL A FRIEND
function mailtofriend(form)
{
	//alert(form.name)
	//alert("fff :"+escape(document.location))

	if((form.toemail1.value == "") && (form.toemail2.value == "") && (form.toemail3.value == "") && (form.toemail4.value == "") && (form.toemail5.value == "") && (form.toemail6.value == "") && (form.toemail7.value == "") && (form.toemail8.value == "") && (form.toemail9.value == "") && (form.toemail10.value == ""))
	{
		alert("Enter the To-Email Address");
		form.toemail1.select();
		form.toemail1.focus();
	}
	else if(form.fromname.value == "")
	{
		alert("Enter Your Name");
		form.fromname.select();
		form.fromname.focus();
	}
	else if(form.fromemail.value == "")
	{
		alert("Enter the From-Email Address");
		form.fromemail.select();
		form.fromemail.focus();
	}
	else
	form.submit()

}

/***************************************************************************/

//TO SEARCH THE MERCHANT INFO
function tosearch()
{
	var kword = document.searchfrm.srh_keyword.value
	if(kword =="")
	{
		alert("Enter the Keyword")
		document.searchfrm.srh_keyword.focus()
	}
	else
	document.searchfrm.submit()
}

/***************************************************************************/

//TO JOIN OUR MAILING LIST
function mailinglist(form)
{
	/*
	var kk=form.merchantname.options.length;
	var aa="";
	for(j=0;j<kk;j++)
	{
	if(form.merchantname.options[j].selected)
	{
	if(form.merchantname.options[j].value!=0)
	aa+=form.merchantname.options[j].value + ",";
	}
	}

	form.mername.value=aa;
	*/

	if(form.name.value == "")
	{
		alert("Enter Your Name");
		form.name.select();
		form.name.focus();
	}
	else if(form.email.value == "")
	{
		alert("Enter the Email-ID");
		form.email.select();
		form.email.focus();
	}
	else if(form.address.value == "")
	{
		alert("Enter Your Address");
		form.address.select();
		form.address.focus();
	}
	/*	else if(form.merchantname.value == "")
	{
	alert("Select the Merchant Name");
	form.merchantname.focus();
	}*/
	else
	form.submit()
}

/***************************************************************************/

//TO SEND MAILS TO THE SUBSCRIBED USERS
function sendmails(form)
{
	var mname = form.merchantname.value
	var msg = form.message.value
	if(form.merchantname.value == "")
	{
		alert("Select the MerchantName")
		form.merchantname.focus();
	}
	else if(form.message.value == "")
	{
		alert("Enter the Message")
		form.message.select();
		form.message.focus();
	}
	else
	document.mailfrm.submit()
}

/***************************************************************************/
// UNSUBSCRIBED CHECKING
function tounsubscribe(form)
{
	if(form.email.value == "")
	{
		alert("Enter the Email-ID")
		form.email.select()
		form.email.focus()
	}
	else
	form.submit()
}


/***************************************************************************/
//TO JOIN OUR MAILING LIST
function addmersubcat(form)
{
	/*
	var kk=form.subcatname.options.length;
	var aa="";
	for(j=0;j<kk;j++)
	{
	if(form.subcatname.options[j].selected)
	{
	if(form.subcatname.options[j].value!=0)
	aa+=form.subcatname.options[j].value + ",";
	}
	}

	form.subcathid.value=aa;
	*/

	if(form.merchantname.value == "")
	{
		alert("Select the Merchant Name");
		//form.merchantname.select();
		form.merchantname.focus();
	}
	else if(form.catname.value == "")
	{
		alert("Select the Category");
		//form.catname.select();
		form.catname.focus();
	}
	else if(form.subcatname.value == "")
	{
		alert("Select the Subcatgory");
		//form.subcatname.select();
		form.subcatname.focus();
	}
	else
	form.submit()
}

/***************************************************************************/
//	TO SELECT CATEGORY
function changemername(mname,form,fname)
{
	var mername = mname.value
	form.action=fname+".php?merchantname="+mername
	form.submit()
}


//	TO SELECT CATEGORY
function changemerchantname(mname,form,fname)
{
	var mername = mname.value
	//alert("ddd"+mername)
	form.action=fname+".php?merchantname="+mername
	form.submit()
}

/*****************************************************************************/
// add products
function addproduct(form,mes)
{
	//alert("mes :"+mes)

	if (form.productname.value=="") {
		alert("Enter Product Name");
		form.productname.select();
		form.productname.focus();

	} else if (form.description.value=="") {
		alert("Enter Description");
		form.description.select();
		form.description.focus();

	} else if (form.price.value=="") {
		alert("Enter Price");
		form.price.select();
		form.price.focus();

	} else
	form.submit();

}

/*****************************************************************************/
// add additional options
function addoptions(form,mes)
{

	if (form.productid.value=="") {
		alert("Select Product Name");

	} else if (form.producttitle.value=="") {
		alert("Enter Description");
		form.producttitle.select();
		form.producttitle.focus();

	} else if (form.price.value=="") {
		alert("Enter Price");
		form.price.select();
		form.price.focus();

	} else
	form.submit();

}


/*****************************************************************************/


/*****************************************************************************/

// TO NUMBER CHECKING IN ADV SEARCH PAGE,REGISTRATION (GENERAL)
function chknumber(txtname)
{
	var num = txtname.value
	if(isNaN(num))
	{
		alert("You can enter only the number")
		txtname.value = ""
		txtname.focus
	}
}
/*****************************************************************************/
// ADDING TO CART
function addtocart(oid,ccount)
{
	if(oid == "a")
	{
		if(ccount == 0)
		{   alert("The E-book must first be ordered before this option can be selected.");
		return false;			}
	}

}

/*****************************************************************************/
// SIGNING UP NEWS
function signupnews()
{
	if(document.newsfrm.email.value == "")
	alert("Enter the Email ID");
	else
	document.newsfrm.submit()
}

/***************************************************************************/

// to checkout form
var pval;
pval=""
function checkout(form,additionalproduct)
{
	// validation starts for billing info
	if (form.x_First_Name.value == "") {
		alert("You must enter a billing First Name.");
		form.x_First_Name.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.x_Last_Name.value == "") {
		alert("You must enter a billing Last Name.");
		form.x_Last_Name.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.x_Address.value == "") {
		alert("You must enter a billing address.");
		form.x_Address.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.x_City.value == "") {
		alert("You must enter a billing city.");
		form.x_City.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.x_State.value == "") {
		alert("You must enter a billing state.");
		form.x_State.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.x_Zip.value == "") {
		alert("You must enter a billing zipcode.");
		form.x_Zip.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.x_Country.value == "") {
		alert("You must enter a billing Country.");
		form.x_Country.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.x_Phone.value == "") {
		alert("You must enter a billing Phone No.");
		form.x_Phone.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.x_Email.value == "") {
		alert("You must enter a billing Email ID");
		form.x_Email.focus()
		return false; //This prevents the form from being submitted
	}

	// validation for Credit Card Info
	if (pval == "") {
		alert("You must select a Card Type.");
		//form.cardtype.select()
		return false; //This prevents the form from being submitted
	}
	if (form.x_Card_Num.value == "") {
		alert("You must enter a Valid Card No.");
		form.x_Card_Num.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.x_Exp_Date.value == "") {
		alert("You must enter a Credit Card Expiry Date.");
		form.x_Exp_Date.focus()
		return false; //This prevents the form from being submitted
	}
	/*if (form.x_Card_Code.value == "") {
	alert("You must enter a Valid Card Code. It contains 3 or 4 digits");
	form.x_Card_Code.focus()
	return false; //This prevents the form from being submitted
	}

	if (form.CC_MONTH.value == "") {
	alert("You must select a Expiry Month.");
	form.CC_MONTH.focus()
	return false; //This prevents the form from being submitted
	}
	if (form.CC_YEAR.value == "") {
	alert("You must select a Expiry Year");
	form.CC_YEAR.focus()
	return false; //This prevents the form from being submitted
	}*/

	// validation starts for Shipping info

	if(additionalproduct!=0)
	{

		if (form.x_Ship_To_First_Name.value == "") {
			alert("You must enter a shipping First Name.");
			form.x_Ship_To_First_Name.focus()
			return false; //This prevents the form from being submitted
		}
		if (form.x_Ship_To_Last_Name.value == "") {
			alert("You must enter a shipping Last Name.");
			form.x_Ship_To_Last_Name.focus()
			return false; //This prevents the form from being submitted
		}
		if (form.x_Ship_To_Address.value == "") {
			alert("You must enter a shipping address.");
			form.x_Ship_To_Address.focus()
			return false; //This prevents the form from being submitted
		}
		if (form.x_Ship_To_City.value == "") {
			alert("You must enter a shipping city.");
			form.x_Ship_To_City.focus()
			return false; //This prevents the form from being submitted
		}
		if (form.x_Ship_To_State.value == "") {
			alert("You must enter a shipping state.");
			form.x_Ship_To_State.focus()
			return false; //This prevents the form from being submitted
		}
		if (form.x_Ship_To_Zip.value == "") {
			alert("You must enter a shipping zipcode.");
			form.x_Ship_To_Zip.focus()
			return false; //This prevents the form from being submitted
		}
		if (form.x_Ship_To_Country.value == "") {
			alert("You must enter a shipping Country.");
			form.x_Ship_To_Country.focus()
			return false; //This prevents the form from being submitted
		}
		/*
		if (form.x_Ship_To_Phone.value == "") {
			alert("You must enter a shipping Phone No.");
			form.x_Ship_To_Phone.focus()
			return false; //This prevents the form from being submitted
		}
		if (form.x_Ship_To_Email.value == "") {
			alert("You must enter a shipping Email ID");
			form.x_Ship_To_Email.focus()
			return false; //This prevents the form from being submitted
		}
		*/

		else
		{
			if(form.x_Email.value != form.bill_conemail.value)
			{
				alert("The confirm Email in BILLING is incorrect. Enter it again!")
				form.bill_conemail.focus()
				return false; //This prevents the form from being submitted
			}
			/*
			if(form.x_Ship_To_Email.value != form.ship_conemail.value)
			{
				alert("The confirm Email in SHIPPING is incorrect. Enter it again!")
				form.ship_conemail.focus()
				return false; //This prevents the form from being submitted
			}
			*/
			/*
			//alert(form.discountcode.value)
			if(form.discountcode.value != "")
			form.h_discountcode.value = form.discountcode.value;
			//alert("hidden :"+form.h_discountcode.value)
			*/
			form.cc_number.value = form.x_Card_Num.value
			form.cc_expdate.value = form.x_Exp_Date.value
			//alert(form.cc_number.value+" -- "+form.cc_expdate.value)

		}

	}

	form.submit();


}


function checkout_paypal(form)
{
	// validation starts for billing info
	if (form.first_name.value == "") {
		alert("You must enter a billing First Name.");
		form.first_name.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.last_name.value == "") {
		alert("You must enter a billing Last Name.");
		form.last_name.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.address1.value == "") {
		alert("You must enter a billing address.");
		form.address1.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.city.value == "") {
		alert("You must enter a billing city.");
		form.city.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.state.value == "") {
		alert("You must enter a billing state.");
		form.state.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.zip.value == "") {
		alert("You must enter a billing zipcode.");
		form.zip.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.x_Country.value == "") {
		alert("You must enter a billing Country.");
		form.x_Country.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.day_phone_a.value == "") {
		alert("You must enter your area code of the phone number.");
		form.day_phone_a.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.day_phone_b.value == "") {
		alert("You must enter your first three digits of the phone number.");
		form.day_phone_b.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.day_phone_c.value == "") {
		alert("You must enter your last four digits of the phone number.");
		form.day_phone_c.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.email.value == "") {
		alert("You must enter a billing Email ID");
		form.email.focus()
		return false; //This prevents the form from being submitted
	}



	// validation starts for Shipping info
	if (form.x_Ship_To_First_Name.value == "") {
		alert("You must enter a shipping First Name.");
		form.x_Ship_To_First_Name.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.x_Ship_To_Last_Name.value == "") {
		alert("You must enter a shipping Last Name.");
		form.x_Ship_To_Last_Name.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.x_Ship_To_Address.value == "") {
		alert("You must enter a shipping address.");
		form.x_Ship_To_Address.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.x_Ship_To_City.value == "") {
		alert("You must enter a shipping city.");
		form.x_Ship_To_City.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.x_Ship_To_State.value == "") {
		alert("You must enter a shipping state.");
		form.x_Ship_To_State.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.x_Ship_To_Zip.value == "") {
		alert("You must enter a shipping zipcode.");
		form.x_Ship_To_Zip.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.x_Ship_To_Country.value == "") {
		alert("You must enter a shipping Country.");
		form.x_Ship_To_Country.focus()
		return false; //This prevents the form from being submitted
	}
	/*
	if (form.x_Ship_To_Phone.value == "") {
		alert("You must enter a shipping Phone No.");
		form.x_Ship_To_Phone.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.x_Ship_To_Email.value == "") {
		alert("You must enter a shipping Email ID");
		form.x_Ship_To_Email.focus()
		return false; //This prevents the form from being submitted
	}
*/
	else
	{
		if(form.email.value != form.bill_conemail.value)
		{
			alert("The confirm Email in BILLING is incorrect. Enter it again!")
			form.bill_conemail.focus()
			return false; //This prevents the form from being submitted
		}
		/*
		if(form.x_Ship_To_Email.value != form.ship_conemail.value)
		{
			alert("The confirm Email in SHIPPING is incorrect. Enter it again!")
			form.ship_conemail.focus()
			return false; //This prevents the form from being submitted
		}
		*/
		/*
		//alert(form.discountcode.value)
		if(form.discountcode.value != "")
		form.h_discountcode.value = form.discountcode.value;
		//alert("hidden :"+form.h_discountcode.value)
		*/
		//	form.cc_number.value = form.x_Card_Num.value
		//       form.credit_card_type.value=form.cardtype.value
		//	form.cc_expdate.value = form.x_Exp_Date.value
		//alert(form.cc_number.value+" -- "+form.cc_expdate.value)
		form.submit();
	}


}



function creditinfo_paypal(form)
{

	// validation for Credit Card Info
	if (pval == "") {
		alert("You must select a Card Type.");
		//form.cardtype.select()
		return false; //This prevents the form from being submitted
	}
	if (form.x_Card_Num.value == "") {
		alert("You must enter a Valid Card No.");
		form.x_Card_Num.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.x_Exp_Date.value == "") {
		alert("You must enter a Credit Card Expiry Date.");
		form.x_Exp_Date.focus()
		return false; //This prevents the form from being submitted
	}
	/*if (form.x_Card_Code.value == "") {
	alert("You must enter a Valid Card Code. It contains 3 or 4 digits");
	form.x_Card_Code.focus()
	return false; //This prevents the form from being submitted
	}

	if (form.CC_MONTH.value == "") {
	alert("You must select a Expiry Month.");
	form.CC_MONTH.focus()
	return false; //This prevents the form from being submitted
	}
	if (form.CC_YEAR.value == "") {
	alert("You must select a Expiry Year");
	form.CC_YEAR.focus()
	return false; //This prevents the form from being submitted
	}*/
	form.submit();
}
/***************************************************************************/
// to check the ccard type
function cardtype_chk(obj)
{
	pval = obj.value;
}

/***************************************************************************/

// filling the shipping info same as billing info
function loadaddress()
{

	if (document.itemfrm.shiptoaddress.checked)
	{

		document.itemfrm.x_Ship_To_First_Name.value =   document.itemfrm.x_First_Name.value;
		document.itemfrm.x_Ship_To_Last_Name.value =   document.itemfrm.x_Last_Name.value
		document.itemfrm.x_Ship_To_Address.value =  document.itemfrm.x_Address.value;
		document.itemfrm.x_Ship_To_City.value =  document.itemfrm.x_City.value;
		document.itemfrm.x_Ship_To_State.value = document.itemfrm.x_State.value;
		document.itemfrm.x_Ship_To_Zip.value = document.itemfrm.x_Zip.value;
		document.itemfrm.x_Ship_To_Country.value = document.itemfrm.x_Country.value;
		/*document.itemfrm.ship_country.selectedIndex = document.itemfrm.x_Country.selectedIndex;*/
		/*
		document.itemfrm.x_Ship_To_Phone.value = document.itemfrm.x_Phone.value;
		document.itemfrm.x_Ship_To_Email.value = document.itemfrm.x_Email.value;
		document.itemfrm.ship_conemail.value = document.itemfrm.bill_conemail.value;
		*/
	}

	else

	{

		document.itemfrm.x_Ship_To_First_Name.value =   ""
		document.itemfrm.x_Ship_To_Last_Name.value =   ""
		document.itemfrm.x_Ship_To_Address.value =  ""
		document.itemfrm.x_Ship_To_City.value =  ""
		document.itemfrm.x_Ship_To_Zip.value = ""
		//document.itemfrm.bill_country.selectedIndex = document.itemfrm.ship_country.selectedIndex;
		document.itemfrm.x_Ship_To_Country.value = ""
		document.itemfrm.x_Ship_To_State.value = ""
		/*
		document.itemfrm.x_Ship_To_Phone.value = ""
		document.itemfrm.x_Ship_To_Email.value = ""
		document.itemfrm.ship_conemail.value = ""
		*/
	}
}


function loadaddress_paypal()
{

	if (document.itemfrm.shiptoaddress.checked)
	{

		document.itemfrm.x_Ship_To_First_Name.value =   document.itemfrm.first_name.value;
		document.itemfrm.x_Ship_To_Last_Name.value =   document.itemfrm.last_name.value
		document.itemfrm.x_Ship_To_Address.value =  document.itemfrm.address1.value;
		document.itemfrm.x_Ship_To_City.value =  document.itemfrm.city.value;
		document.itemfrm.x_Ship_To_State.value = document.itemfrm.state.value;
		document.itemfrm.x_Ship_To_Zip.value = document.itemfrm.zip.value;
		document.itemfrm.x_Ship_To_Country.value = document.itemfrm.x_Country.value;
		/*
		document.itemfrm.x_Ship_To_Phone.value = document.itemfrm.day_phone_a.value + "-" + document.itemfrm.day_phone_b.value + "-" + document.itemfrm.day_phone_c.value ;
		document.itemfrm.x_Ship_To_Email.value = document.itemfrm.email.value;
		document.itemfrm.ship_conemail.value = document.itemfrm.bill_conemail.value;
		*/
	}
	else
	{
		document.itemfrm.x_Ship_To_First_Name.value =   ""
		document.itemfrm.x_Ship_To_Last_Name.value =   ""
		document.itemfrm.x_Ship_To_Address.value =  ""
		document.itemfrm.x_Ship_To_City.value =  ""
		document.itemfrm.x_Ship_To_Zip.value = ""
		document.itemfrm.x_Ship_To_Country.value = ""
		document.itemfrm.x_Ship_To_State.value = ""
		/*
		document.itemfrm.x_Ship_To_Phone.value = ""
		document.itemfrm.x_Ship_To_Email.value = ""
		document.itemfrm.ship_conemail.value = ""
		*/
	}
}

/***************************************************************************/
// searching
function search()
{
	var kword = document.topfrm.srh_keyword.value
	if(kword == "")
	{
		alert("Enter the Keyword!")
		document.topfrm.srh_keyword.select()
		document.topfrm.srh_keyword.focus()
	}
	else
	document.topfrm.submit()
}


/***************************************************************************/
// offline order submission
function offlineorder(form1)
{
	var form = eval(form1.name)
	if (form.name1.value == "") {
		alert("You must enter a First Name.");
		form.name1.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.lastname.value == "") {
		alert("You must enter a Last Name.");
		form.lastname.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.street.value == "") {
		alert("You must enter a address.");
		form.street.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.city.value == "") {
		alert("You must enter a city.");
		form.city.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.state.value == "") {
		alert("You must enter a state.");
		form.state.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.zipcode.value == "") {
		alert("You must enter a zipcode.");
		form.zipcode.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.email.value == "") {
		alert("You must enter a Email ID");
		form.email.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.confirmemail.value == "") {
		alert("You must enter a Confirm Email ID");
		form.confirmemail.focus()
		return false; //This prevents the form from being submitted
	}
	if (form.phone.value == "") {
		alert("You must enter a Phone No.");
		form.phone.focus()
		return false; //This prevents the form from being submitted
	}
	else
	{
		if(form.email.value != form.confirmemail.value)
		{
			alert("The confirm Email is incorrect. Enter it again!")
			form.confirmemail.focus()
			return false; //This prevents the form from being submitted
		}
	}
	//return true;
}

/***************************************************************************/
function confirmdiscount()
{
	if(document.form1.discountcode.value == "")
	{
		alert("Enter your Promotional Code!");
		document.form1.discountcode.focus()
		return false
	}
	else
	return true
}


/***************************************************************************/

// TO NUMBER CHECKING AND ONLY 4 DIGITS TO BE ALLOWED
function chkcardnumber(txtname)
{
	var num = txtname.value
	if(isNaN(num))
	{
		alert("You can enter only the number")
		txtname.value = ""
		txtname.focus()
	}
	else
	{
		if(num.length > 4)
		{
			var substr1 = num.substring(0,4)
			txtname.value = substr1
			txtname.focus()
		}
	}
}
/*****************************************************************************/

/***************************************************************************/

