function MenuIndex(tmpVal,tmpLog)
{
	var oForm;
	oForm	=	document.forms['indexpage'];
	oForm.hdPageAction.value = tmpVal;
	oForm.hdBrowseCatalog.value = tmpVal;
	oForm.hdlogin.value = tmpLog;
	oForm.hdlogin1.value = tmpLog;
	if(tmpLog==2)
		oForm.hdChangeHotProduct.value = "HotProductIndex"
	oForm.submit();
}
function Search(tmpVal)
{
	var oForm,Descript;
	oForm	=	document.forms['indexpage'];
	
	if(tmpVal==1)
	{
		Descript     =	oForm.txtSearch.value;
		if (Descript == "")
		{
			alert("Please enter description for search")
			return;
		}
	}	
	if(tmpVal == 0)
	{
		oForm.txtSearch.value = "";
	}
	
	oForm.hdPageAction.value = 1;
	oForm.submit();	
}

function Category(tmpVal)
{
	var oForm,Descript;
	oForm	     =	document.forms['indexpage'];
	oForm.txtSearch.value = "";
	oForm.hdPageAction.value = 1;
	oForm.hdCategoryID.value = tmpVal;
	oForm.submit();
}

function subCat(Cat,SubCat)
{	
	var oForm; 
	oForm	=	document.forms['indexpage'];
	oForm.txtSearch.value = "";	
	oForm.hdPageAction.value = 1;
	oForm.hdCategoryID.value = Cat;
	oForm.hdSubCategoryID.value = SubCat;
	oForm.submit();
}	

function Moving(ChapterNo,page,cat,subcat,desc,brand,supplier,itemPerPage)
{
	var oForm;
	oForm	=	document.forms['indexpage'];	
	oForm.hdProductAction.value	= page;
	oForm.ChapterNo.value		= ChapterNo;
	oForm.hdCategoryID.value	= cat;
	oForm.hdSubCategoryID.value	= subcat;
	oForm.txtSearch.value		= desc;
	oForm.hdBrand.value			= brand ;
	oForm.hdSupplier.value		= supplier;
	oForm.hdItemPerPage.value	= oForm.NoOfItems.value;
	oForm.hdPageAction.value	= 1;
	oForm.submit();				
}
function OMoving(ChapterNo,page)
{
	var oForm;
	oForm	=	document.forms['indexpage'];	
	oForm.hdProductAction.value	= page;
	oForm.ChapterNo.value		= ChapterNo;
	oForm.hdPageAction.value	= 8;
	oForm.submit();				
}
function TrackOrder()
{
	var oForm;
	oForm	=	document.forms['indexpage'];	
	oForm.hdPageAction.value	= 10;
	oForm.submit();				
}
function fnCondition()
{
	window.open("../../ECommOrder/UPSTrackTermsCondition.asp","mywindow","top=100,left=150,location=0,titlebar=no,toolbar=no,titlebar=0,status=1,scrollbars=0,width=450,height=550")
}
function fnTrack()
{
	var MainForm
	MainForm = document.forms['indexpage'];	
	if(MainForm.txtTrack.value == "")
	{
		alert("Please enter valid tracking number !");
		return;
	}	
	else
	{
		if( MainForm.chkAccept.checked == false)		
			alert("Please note: To track your package(s), you must accept the UPS Tracking Terms and conditions by selecting the checkbox below.")
		else
		{
			MainForm.hdPageAction.value	= 10;
			MainForm.submit();				
		}	
	}
}
function MovingImage(Page,MultiImage)
{
	var oForm;
	oForm	=	document.forms['indexpage'];		
	oForm.hdProductAction.value	= Page;	
	oForm.hdMultiImage.value	= MultiImage;	
	oForm.hdPageAction.value	= 2;
	oForm.submit();				
}
function ItemsPerPage(cat,subcat,desc,brand,supplier)
{
	var oForm;
	oForm	=	document.forms['indexpage'];	
	oForm.hdItemPerPage.value	=	oForm.NoOfItems.value;
	oForm.hdCategoryID.value	= cat;
	oForm.hdSubCategoryID.value	= subcat;
	oForm.txtSearch.value		= desc;
	oForm.hdBrand.value			= brand; 
	oForm.hdSupplier.value		= supplier
	oForm.hdPageAction.value	= 1;
	oForm.submit();	
}

function ItemDetail(itemid,cat,subcat,desc,brand,supplier,colorsize,qoh,allowneg)
{	
	var oForm,path;
	oForm	=	document.forms['indexpage'];	
	oForm.hdItemID.value		= itemid;
	oForm.hdCategoryID.value	= cat;
	oForm.hdSubCategoryID.value	= subcat;
	oForm.txtSearch.value		= desc;
	oForm.hdBrand.value			= brand; 
	oForm.hdSupplier.value		= supplier;
	oForm.hdColorSize.value		= colorsize;	
	oForm.hdQOH.value			= qoh;	
	oForm.hdAllowNegative.value		= allowneg;	
	
	oForm.hdPageAction.value	= 2;
	oForm.submit();	
}

function BuyItem(szItemID, HaveColorSize, Q_O_H, LimitQty)
{
	var myForm = document.forms['indexpage'];	
	var szAction;
	if( navigator.appName == "Netscape" )
		var Qty = myForm.elements[szItemID + "Qty"].value;
	else
		var Qty = myForm.elements(szItemID + "Qty").value;	

	if( !CheckNumber(Qty) )
	{
		alert("Please enter valid number in quantity.");
		return;
	}
	//check condition.............
	/*if( LimitQty != "0" ){
		if( parseInt(Qty) > parseInt(Q_O_H) ){
			alert("Sorry! Not enough quantities remain.");
			return;
		}
	}*/
	szAction = "ShoppingAction.asp?Item_ID="+szItemID+"&Qty="+Qty+"&HaveColorSize="
	szAction = szAction + HaveColorSize + "&Q_O_H=" + Q_O_H + "&LimitQty=" + LimitQty + "&Mode=AddItem"
	myForm.action = szAction;	
	myForm.submit();
}
function CheckNumber(iQty)
{
	if(isNaN(iQty)||iQty == "" || iQty == 0 || iQty == " ")
	{	
		return false; 
	}
	else
	{	
		for (i = 0; i < iQty.length ;i++) 
		{ 
			Char = iQty.charAt(i); 			
			if (Char == "." || Char == "+" || Char == "-") 
			{
				return false;
			}			
		}
		return true;
	}	
}
function GetItemBarCodeID(){
	var ColorCode,SizeCode;
	var ItemBarCodeID;
		ColorCode = document.forms("indexpage").ColorCode.options[document.forms("indexpage").ColorCode.selectedIndex].value;
		SizeCode = document.forms("indexpage").SizeCode.options[document.forms("indexpage").SizeCode.selectedIndex].value;
		ItemBarCodeID = document.forms("indexpage").elements["ItemBarCodeID" + ColorCode + "," + SizeCode].value;
	
	//ItemBarCodeID = document.forms[0].elements["ItemBarCodeID" + ColorCode + "," + SizeCode].value;
	return ItemBarCodeID;
}

function SoftBuyItem(whereto,ColorCode)
{
	
	var myForm = document.forms['indexpage'];
	if (whereto=="Buy")
	{
		var Qty = myForm.Qty.value;
		if( !CheckNumber(Qty) )
		{
			alert("Please enter valid number in quantity.");
			return;
		}
		if (myForm.ColorCode.value == "N/A" || myForm.SizeCode.value == "N/A")
		{
			myForm.action = "ShoppingAction.asp"
			myForm.Mode.value = "AddItem";	
			myForm.submit();
		}
		else
		{
			myForm.ItemBarCodeID.value = GetItemBarCodeID();		
			myForm.action = "ShoppingAction.asp"
			myForm.Mode.value = "AddItem";
			myForm.submit();
		}
	}	
}

function ChangeItemQty(szItemBarCodeID, Qty){
	var iQty;
	var myForm =document.forms['indexpage'];
	
	iQty = prompt('Please enter the new quantity below.', Qty);
	
	if( !CheckNumber(iQty) )
	{
		alert("Please enter valid number in quantity.");
		return;
	}
	myForm.action = "ShoppingAction.asp";
	myForm.Mode.value = "ChangeQty";
	myForm.ItemBarCodeID.value = szItemBarCodeID;
	myForm.Qty.value = iQty;
	myForm.submit();
}
function RemoveItem(szItemBarCodeID){
	var myForm = document.forms['indexpage'];
	if(confirm("Are you sure you want to remove the selected item now?")){
		myForm.action = "ShoppingAction.asp?FF=<%=Rnd%>";
		myForm.Mode.value = "RemoveItem";
		myForm.ItemBarCodeID.value = szItemBarCodeID
		myForm.submit();
	}else
		return;
}
function EmptyCart(){
	var myForm = document.forms['indexpage'];
	if(confirm("Empty shopping cart now?")){
		myForm.action = "ShoppingAction.asp";
		myForm.Mode.value = "ClearCart";
		myForm.submit();
	}else
		return;
}

function Cancel(){
	var myForm = document.forms['indexpage'];
	myForm.hdPageAction.value = 1;	
	myForm.submit();
}

function CalculateTotal(tmpVal,tmpLog)
{
	var oForm;
	oForm	=	document.forms['indexpage'];	
	oForm.hdPageAction.value = tmpVal;
	oForm.hdlogin.value = tmpLog;	
	oForm.hdlogin1.value = tmpLog;
	oForm.submit();	
}
function fnCountry()
{
var oForm;
	oForm	=	document.forms['indexpage'];	
	oForm.hdPageAction.value = 5;	
	oForm.submit();	
}
function OpenSubmit(){
	if(CheckDS())
	{	
		var oForm = document.forms['indexpage'];	
		oForm.hdlogin.value = "UpdateCustInfo";
		oForm.hdPageAction.value = 15;
		oForm.submit(); 
	}
}	
function fnChangePassword()
{
	var oForm = document.forms['indexpage'];
	if(oForm.txtPassword.value=="")
	{
		alert("Please Enter Password.");
		document.indexpage.txtPassword.focus();
		return;
	}
	if(oForm.txtCPassword.value=="")
	{
		alert("Please Enter Confirm Password.");
		document.indexpage.txtCPassword.focus();
		return;
	}
	if(oForm.txtPassword.value != oForm.txtCPassword.value)
	{
		alert("Password and Confirm Password is not matching.");
		document.indexpage.txtPassword.focus();
		return;			
	}
	oForm.hdlogin.value = "UpdateCustPassword";
	oForm.hdPageAction.value = 15;
	oForm.submit(); 
}
function fnViewPurchaseHistory()
{
	var oForm = document.forms['indexpage'];
	oForm.hdPageAction.value = 8;
	oForm.PurchaseHistory.value = "ShowPurchaseHistory"
	oForm.submit(); 

}
function fnViewCurrentOrders()
{
	var oForm = document.forms['indexpage'];
	oForm.hdPageAction.value = 8;
	oForm.PurchaseHistory.value = ""
	oForm.submit(); 
}
//****************** Registration ***************************************
function CheckDS()
{
	if(validateDS())
	{
		if(emailCheck(indexpage.CEmail.value))
		{
			return true;
		}
		else
		{
			document.indexpage.CEmail.focus();
			return false
		}
	}
	else
	{
	return false
	}
	
}
function validateDS()
{
	if(indexpage.firstName.value=="")
	{
		alert("Please Enter First Name Of the User.");
		document.indexpage.firstName.focus();
		return false;
	}
	
	if(indexpage.lastName.value=="")
	{
		alert("Please Enter Last Name Of the User.");
		document.indexpage.lastName.focus();
		return false;
	}
	if(indexpage.address1.value=="")
	{
		alert("Please Enter Billing Address Of the User.");
		document.indexpage.address1.focus();
		return false;
	}
	if(indexpage.city.value=="")
	{
		alert("Please Enter City Of the User.");
		document.indexpage.city.focus();
		return false;
	}
	/*if(indexpage.state.value=="")
	{
		alert("Please Enter State Of the User.");
		document.indexpage.state.focus();
		return false;
	}*/
	if(indexpage.zipCode.value=="")
	{
		alert("Please Enter Zip Code Of the User.");
		document.indexpage.zipCode.focus();
		return false;
	}
	/*if(indexpage.country.value=="")
	{
		alert("Please Enter Country Of the User.");
		document.indexpage.country.focus();
		return false;
	}*/
	if(indexpage.phone.value == "")
	{
		alert("Please Enter Phone Of the User.");
		document.indexpage.phone.focus();
		return false;
	}
	if(!emailCheck(indexpage.CEmail.value))
	{
		document.indexpage.CEmail.focus();
		return false
	} 
	/*if(indexpage.UName.value=="")
	{
		alert("Please Enter User Id.");
		document.indexpage.UName.focus();
		return false;
	}
	if(indexpage.pass.value=="")
	{
		alert("Please Enter Password.");
		document.indexpage.pass.focus();
		return false;
	}
	if(indexpage.confirm.value=="")
	{
		alert("Please Enter Confirm Password.");
		document.indexpage.confirm.focus();
		return false;
	}*/
		return true;
}

function emailCheck(emailStr)
{
	var emailPat=/^(.+)@(.+)$/
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
	var validChars="\[^\\s" + specialChars + "\]"
	var quotedUser="(\"[^\"]*\")"
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	var atom=validChars + '+'
	var word="(" + atom + "|" + quotedUser + ")"
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
	var matchArray=emailStr.match(emailPat)

					if (matchArray==null)
					{
						alert("Email address seems incorrect (check @ and .'s)");
						return false;
					}
					var user=matchArray[1]
					var domain=matchArray[2]

					if (user.match(userPat)==null)
					{
						alert("The username doesn't seem to be valid.")
						return false;
					}

					var IPArray=domain.match(ipDomainPat)
					if (IPArray!=null)
					{
						// this is an IP address
						for (var i=1;i<=4;i++)
						{
							if (IPArray[i]>255)
							{
								alert("Destination IP address is invalid!")
								return false
							}
						}
						return true
					}

					// Domain is symbolic name
					var domainArray=domain.match(domainPat)
					if (domainArray==null)
					{
						alert("The domain name doesn't seem to be valid.")
						return false
					}

					var atomPat=new RegExp(atom,"g")
					var domArr=domain.match(atomPat)
					var len=domArr.length
					if (domArr[domArr.length-1].length < 2 ||
					domArr[domArr.length-1].length > 3)
					{
						// the address must end in a two letter or three letter word.
						alert("The address must end in a three-letter domain, or two letter country.")
						return false
					}

					// Make sure there's a host name preceding the domain.
					if (len < 2) 
					{
						var errStr="This address is missing a hostname!"
						alert(errStr)
						return false
					}
					// If we've gotten this far, everything's valid!

					return true
}

function NewUser()
{
	var oForm;
	oForm	=	document.forms['indexpage'];	
	oForm.hdUserLogin.value="UserSignUp"
	oForm.hdPageAction.value = 6;
	oForm.submit(); 
}

function fnUserLogin()
{
	var oForm;
	oForm	=	document.forms['indexpage'];	
	if(oForm.txtUserId.value=="" || oForm.txtUserPass.value=="")	
	{
		alert("Please enter user name and password");
		return;
	}		
	oForm.hdlogin.value  =	"UserLogin"
	oForm.hdPageAction.value =	6;
	oForm.submit();
}
function fnEditUserInfo()
{
	var oForm,tmp;
	tmp = 0;
	oForm	=	document.forms['indexpage'];	
	for(i=0;i<oForm.CustSetting.length;i++)
	{
		if(oForm.CustSetting[i].checked){
			oForm.hdlogin1.value = i;
			tmp=1;
		}
	}
	if(tmp==0)
	{
		alert("Please select one of the option.");
		return;
	}
	else
	{
		oForm.hdPageAction.value =	15;
		oForm.hdlogin.value	= "EditInfo"
		oForm.submit();
	}
}
function CountrySelect()
{
	var oForm;
	oForm	=	document.forms['indexpage'];	
	oForm.hdPageAction.value =	6;
	oForm.submit();
}
function CustCountrySelect()
{
	var oForm;
	oForm	=	document.forms['indexpage'];	
	oForm.hdlogin.value = "CustInfoForm";
	oForm.hdPageAction.value =	15;
	oForm.submit();
}
function Moving1(ChapterNo,CurrentPage){
	var myForm = document.forms[0];
	myForm.ChapterNo.value = ChapterNo;
	myForm.CurrentPage.value = CurrentPage;
	//myForm.action = "ECommOrder.asp"
	myForm.submit();
}
function ViewOrderDetail(I_TRNO){
	var myForm = document.forms[0]
	myForm.I_TRNO.value = I_TRNO
	myForm.hdPageAction.value =	9;
	//myForm.action = "ECommOrderDetail.asp"
	myForm.submit()
}
//------------------ Checkout ----------------------------------

/*function PopUpCheckout()
{
	var myForm = document.forms[0];
	myForm.hdPageAction.value =	6;	
	myForm.submit()	
}*/
function PopUpCheckout(Status,CustID)
{
	var myForm = document.forms[0];
	if(Status==0)
	{
		myForm.action = "https://shop.gsnetx.org/Ecommerce/Checkout/CustomerLogin.asp";	
	}
	else
	{	
		myForm.action = "https://shop.gsnetx.org/Ecommerce/Checkout/CustomerLogin.asp?Mode=Login&CustId="+CustID;	
	}
	myForm.submit()	
}
function SendForm(Mode)
{
	if(Mode=='ChgCountry')
	{		
		document.indexpage.Mode.value = Mode;		
		document.indexpage.hdPageAction.value =	9;	
		document.indexpage.submit();		
	}
	else if(Mode=='ChgMailCountry')
	{
		document.indexpage.Mode.value = Mode;
		document.indexpage.hdPageAction.value =	9;			
		//document.indexpage.action="Checkout2.asp#SI";
		document.indexpage.submit();
	}
	else if(Mode=='ChgCC')
	{
		document.indexpage.Mode.value = Mode;
		document.indexpage.hdPageAction.value =	9;	
		document.indexpage.submit();		
	}
	else if(Mode=='Save')
	{
		var bOK = true;
		var PayMethod;		
		var szMsg;
		if(document.indexpage.FirstName.value == "")
			bOK = false;
		if(document.indexpage.LastName.value == "")
			bOK = false;
		if(document.indexpage.Address1.value == "")
			bOK = false;
		if(document.indexpage.City.value == "")
			bOK = false;
		if(document.indexpage.Country.value == "")
			bOK = false;
		if ((document.indexpage.Country.value=="Canada") || (document.indexpage.Country.value=="USA"))
		{
			if(document.indexpage.PostalCode.value == "")
				bOK = false;
		}
		if(document.indexpage.Province.value == "")
			bOK = false;
		if(document.indexpage.Phone.value == "")
			bOK = false;
		if(document.indexpage.Email.value == "")
			bOK = false;		
		if(bOK == false)
		{
			alert("Fields with '*' cannot be blank.");
			return;
		}	
		if(document.indexpage.MailName.value == "")
			bOK = false;
		if(document.indexpage.MailAddress1.value == "")
			bOK = false;
		if(document.indexpage.MailCity.value == "")
			bOK = false;
		if(document.indexpage.MailCountry.value == "")
			bOK = false;

		if ((document.indexpage.MailCountry.value=="Canada") || (document.indexpage.MailCountry.value=="USA"))
		{
			if(document.indexpage.MailPostalCode.value == "")
				bOK = false;
		}
		if(CheckEmail()==false){
				alert("Invalid E-Mail address.");
				return;
		}		
		if(document.indexpage.MailPhone.value == "")
			bOK = false;

		if(bOK == false){
			alert("Please enter shipping information if not the same as billing information");
			return;
		}	
		
		if (document.indexpage.PaymentMethod.value == "Credit Card Payment"){
			if(IsCCNumber()==false){
				alert("Invalid credit card number.");
				return;
			}		
			else
				document.indexpage.PaymentMethodCC.value=document.indexpage.PaymentMethodCC.options[document.indexpage.PaymentMethodCC.selectedIndex].value;
  
    				if ( Expired(document.indexpage.ED_M.value,document.indexpage.ED_Y.value) ) 
    				{
     					alert("Sorry! the Credit Card is expired");
        			return;
    				}
  		}			
	}		
	
}	
function setSameAdd(){
	document.indexpage.MailName.value = document.indexpage.FirstName.value + " " + document.indexpage.LastName.value;
	document.indexpage.MailAddress1.value = document.indexpage.Address1.value;
	document.indexpage.MailAddress2.value = document.indexpage.Address2.value;
	document.indexpage.MailCity.value = document.indexpage.City.value;
	//document.indexpage.MailCountry.value = document.indexpage.Country.value;
	//document.indexpage.MailProvince.value = document.indexpage.Province.value;
	document.indexpage.MailPostalCode.value = document.indexpage.PostalCode.value;
	document.indexpage.MailPhone.value = document.indexpage.Phone.value;
	
	document.indexpage.SameAsBill.value = 1;
	if(document.indexpage.BillOther.value == "1")
		document.indexpage.MailOther.value == "1";
	//SendForm("ChgMailCountry");
}
function CheckEmail()
{
	var theInput=this.document.indexpage.Email.value;
	if ((theInput!='')&&(theInput!=null))
	{
		var HaveA=false;
		var HaveD=false;
		for (var i=0;i < theInput.length;i=i+1)
		{
			var theC=theInput.substring(i,i+1);
			if (theC=='@')
			{
				if ((HaveA)||(i== theInput.length-1))
				{
					HaveA=false;
					break;
				}
				HaveA=true;
			}
			else if (theC=='.')
			{
				if (i== theInput.length-1)
				{
					HaveD=false;
					break;
				}
				HaveD=true;
			}
		}
		if ((!HaveA)||(!HaveD))
			return false;
		else
			return true;
	}
	else
		return true;
}
function CheckPhone(IsPhone)
{
	var theInput;
	theInput=IsPhone.value;
	
	var Phone='';
	if (theInput!='')
	{
		var theLength = 0;
		if ((theInput!='')&&(theInput!=null))
			theLength = theInput.length;
		for (var i = 0; i < theLength; i=i+1)
		{
			var theChar = theInput.substring(i, i+1);
			if (theChar >= "0" && theChar <= "9")
				Phone+=theChar;
		}
		if ((Phone!='')&&(Phone!=null)&&(Phone.length==10))
		{
			theInput=Phone;
			var theLength = 0;
			if ((theInput!='')&&(theInput!=null))
				theLength = theInput.length;
			if (theLength==7)
			{
				Phone='(   ) ';
				Phone+=theInput.substring(0,3);
				Phone+='-';
				Phone+=theInput.substring(3,7);
			}
			else if (theLength==10)
			{
				Phone='(';
				Phone+=theInput.substring(0,3);
				Phone+=') ';
				Phone+=theInput.substring(3,6);
				Phone+='-';
				Phone+=theInput.substring(6,10);
			}
			else if ((theLength==11)&&(theInput.substring(0,1)=='1'))
			{
				Phone='(';
				Phone+=theInput.substring(1,4);
				Phone+=') ';
				theInput.substring(4,7);
				Phone+='-';
				Phone+=theInput.substring(7,11);
			}
			else
			{
				Phone='(';
				for (var i=0;i< theLength;i=i+1)
				{
					if (i==3)
						Phone+=') ';
					else if (i==6)
						Phone+='-';
					Phone+=theInput.substring(i,i+1);
					if (i>=9)
						break;
				}
			}
		}
		
		IsPhone.value=Phone;
	}
}
function IsCCNumber()
{
	var CC=document.indexpage.CC.value;
	var PaymentMethodCC=document.indexpage.PaymentMethodCC.options[document.indexpage.PaymentMethodCC.selectedIndex].value;
	var realCC='';
	var s=0;
	if ((CC!="")&&(CC!=null))
		s=CC.length;
	for (var i=0;i< s;i=i+1)
	{
		var InputC=CC.substring(i,i+1);
		if ((InputC>='0')&&(InputC<='9'))
			realCC+=InputC;
	}
	document.indexpage.CC.value=realCC;
	
	if (PaymentMethodCC=='AMEX')
	{
		var LLL=0;
		if ((realCC!="")&&(realCC!=null))
			LLL=realCC.length;
		if (LLL!=15)
			return false;
		var tmp1=realCC.substring(0,1);
		var tmp2=realCC.substring(1,2);
		if ((tmp1!='3') || ((tmp2!='4')&&(tmp2!='7')))
			return false;
	}
	else if (PaymentMethodCC=='MAST')
	{
		var LLL=0;
		if ((realCC!="")&&(realCC!=null))
			LLL=realCC.length;
		if (LLL!=16)
			return false;
		var tmp1=realCC.substring(0,1);
		var tmp2=realCC.substring(1,2);
		if ((tmp1!='5') ||((tmp2!='1')&&(tmp2!='2')&&(tmp2!='3')&&(tmp2!='4')&&(tmp2!='5')))
			return false;
	}
	else if (PaymentMethodCC=='VISA')
	{
		var LLL=0;
		if ((realCC!="")&&(realCC!=null))
			LLL=realCC.length;
		if ((LLL!=13)&&(LLL!=16))
			return false;
		var tmp1=realCC.substring(0,1);
		if (tmp1!='4')
			return false;
	}
	else if (PaymentMethodCC=='DISCVR')
	{
		var LLL=0;
		if ((realCC!="")&&(realCC!=null))
			LLL=realCC.length;
		if (LLL!=16)
			return false;
		var tmp1=realCC.substring(0,1);
		var tmp2=realCC.substring(1,2);
		var tmp3=realCC.substring(2,3);
		var tmp4=realCC.substring(3,4);
		if ((tmp1!='6')||(tmp2!='0')||(tmp3!='1')||(tmp4!='1'))
			return false;
	}
	else
		return false;
		
	var ss= 1-1;
	var LLL=0;
	if ((realCC!="")&&(realCC!=null))
		LLL=realCC.length;
	for (i=0;i< LLL;i=i+1)
	{
		var Num= 1-1;
		Num=parseInt(realCC.substring(LLL-i-1,LLL-i));
		if (CanDivBy(i,2)==false)
		{
			ss += 1+(2*Num)-1;
			if (Num>4)
			ss= 1 + ss;
		}
		else
			ss= 1 + ss + Num - 1;
	}
	if (CanDivBy(ss,10))
		return true;
	return false;
}
function CanDivBy(Up,Down)
{
	var rr= 0 + Up%Down;
	if (rr==0)
		i=0;
		return true;
	return false;
}
function Expired(month,year)
{
	var now = new Date();
	var ExpiresIn = new Date(year,month,0,0,0);
	ExpiresIn.setMonth(ExpiresIn.getMonth() + 1);
	if ( now.getTime() < ExpiresIn.getTime() ) return false;
	return true;
}
function fnShippingCharge()
{
	var oForm = document.forms["indexpage"]
	for(i=0;i<=oForm.rdShipRate.length-1;i++)
	{
		if(oForm.rdShipRate[i].checked==true)
			oForm.ShippingRate.value = oForm.rdShipRate[i].value;
	}	
	oForm.hdPageAction.value = 5;
	oForm.submit();
}
function fnOpenUrl(ImageURL)
{
	testwindow= window.open (ImageURL, "mywindow","top=80,left=200,location=0,titlebar=no,toolbar=no,titlebar=0,status=1,scrollbars=1,width=600,height=600");
}


