//  Removed CartId from Line No. 46, 49, 57, 277, 292, 361, 654, 658, 690, 714, 737 by Armour - 23/12/2004
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: This function checks whether the entered qty is correct or not.
//  @   Pages Affected  : Index,Items, searchresult,Psearchresult
//  @		Function Name		: preproc(frm,index,code,type)									
//	@		Input Parameters: frm = Form Name, index = Index value, code = Item Code, type = Item Type
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//function for resize image

function Resize(img){
  foto1= new Image();
  foto1.src=(img);
  ResizeWidthHeight(img);
}
function ResizeWidthHeight(img){
  if((foto1.width!=0)&&(foto1.height!=0)){
    viewPhoto(img);
  }
  else{
    funzione="ResizeWidthHeight('"+img+"')";
    intervallo=setTimeout(funzione,20);
  }
}
function viewPhoto(img){
  largh=foto1.width+20;
  altez=foto1.height+20;
  stringa="width="+largh+",height="+altez;
  finestra=window.open(img,"",stringa);
}

function preAddonsri(iWishList,iUnits,itemCode,itemType,iCount)
{
var retval,qty,sMainItem,Iqty;
Iqty=0;
if (iWishList == 0)
{
	qty = document.frmAdd.qty.value;
	retval=IsNumeric(qty);
        for (count=0;count<document.forms.length;count++)
	{
		if (document.forms[count].name=="frmRelated")
		{	
			//alert(document.forms[count].name);
			var sItemList="";
			if (iCount == 1)
			{
				//alert("here");
				var iItemqty;
				iItemqty = document.frmRelated.txtAddOns.value;
				if (iItemqty != '')
					{
						retval=IsNumeric(iItemqty);
						if(retval == 1)	
						{
							alert(getMessage("iValidQuantity"));
							document.frmRelated.txtAddOns.value = '0';
							document.frmRelated.txtAddOns.focus();
							return;
						}
						
					
					}	
				else
					{
					document.frmRelated.txtAddOns.value = '0';
					sItemList = sItemList + document.frmRelated.hdnAddOns.value + "¶" + document.frmRelated.txtAddOns.value + ",";
					}
					
			}

			else
			// if the iCount is greater than 1
			{
				for(index=0;index< iCount;index++) 
				{
					var iItemqty;
					//alert(index);
					//alert(document.frmRelated.txtAddOns.value);
					iItemqty = document.frmRelated.txtAddOns[index].value;
					//alert(index);
					//alert(iItemqty);
					//alert(iItemqty);
					if (iItemqty != '')
					{
						retval=IsNumeric(iItemqty);
						/*if(iItemqty == 0)	
						{
							alert(getMessage("iValidQuantity"));
							document.frmRelated.txtAddOns[index].value = '0';
							document.frmRelated.txtAddOns[index].focus();
							return;
						}*/
						if (iItemqty > 0)
						{
							Iqty=Iqty+iItemqty
							sItemList+= document.frmRelated.hdnAddOns[index].value + "¶" + document.frmRelated.txtAddOns[index].value + ",";
							//alert('hi');
							//alert(sItemList);
						}
						
									
						//sItemList+= document.frmRelated.hdnAddOns[index].value + "¶" + document.frmRelated.txtAddOns[index].value + ",";
						//	alert(document.frmRelated.txtAddOns[index].value);
						//	alert(document.frmRelated.hdnAddOns[index].value);
								
						
					}	
					else
					{
					document.frmRelated.txtAddOns[index].value = '0';
					sItemList = sItemList + document.frmRelated.hdnAddOns[index].value + "¶" + document.frmRelated.txtAddOns[index].value + ",";
					}
					
			}
			}
			//sItemList = itemCode + "¶" + iUnits + "¶" + itemType + "¶" + document.frmAdd.qty.value + "," + sItemList;
			
			if(Iqty == 0)
			{
			alert("please select atleast one item by entering quantity");
			return;
			}
			//sItemList = sItemList.substring(0,sItemList.length-1)
			document.frmAdd.hdnChkItems.value = sItemList;
			//alert(document.frmAdd.hdnChkItems.value);
			
			document.frmAdd.submit();
		}	
		
	}	
	//alert(sMainItem);
	
}	

}

//  Removed CartId from Line No. 46, 49, 57, 277, 292, 361, 654, 658, 690, 714, 737 by Armour - 23/12/2004
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: This function checks whether the entered qty is correct or not.
//  @   Pages Affected  : Index,Items, searchresult,Psearchresult
//  @		Function Name		: preproc(frm,index,code,type)									
//	@		Input Parameters: frm = Form Name, index = Index value, code = Item Code, type = Item Type
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//function for color change 


function color(el) {
el.style.backgroundColor=el.options[el.selectedIndex].style.backgroundColor;
el.style.color=el.options[el.selectedIndex].style.color;
//alert(el.style.backgroundColor);
//var naam = document.kleuren.aa.value + document.kleuren.ab.value + document.kleuren.ac.value;
//document.kleuren.kleurteksta.value = "#"+naam;
//document.kleuren.kleura.style.backgroundColor='#'+ naam;
}

function preproc(frm,index,code,type,eqCode,iWishList, iUnits)
{ var element, retval, qty, iItemqty, iTotalqty;

	element = "document." + frm + ".qty" + index + ".value";
	qty = eval(element);
	retval=IsNumeric(qty)
	
	if(retval == 1)
	{
		alert(getMessage("iValidQuantity"));
		eval("document." + frm + ".qty" + index + ".value=iUnits");
		eval("document." + frm + ".qty" + index + ".focus()");
		return;
	}
	
	
	if (iWishList == 0){
		iItemqty = qty*1
		if ((iMaxCount != "") && (bMaxItem.toLowerCase()=="true")){
			iTotalqty = parseInt(sCartItems)
			if((iItemqty + iTotalqty)>parseInt(iMaxCount)){
				alert(getMessage("iTotalQtyExceed") +" "+ iMaxCount);
				eval("document." + frm + ".qty" + index + ".value=iUnits");
				//eval("document." + frm + ".qty" + index + ".focus()");
				return;
			}
		}
	document.frmAdditem.qty.value = qty;
	document.frmAdditem.ic.value = code;
	document.frmAdditem.type.value=type;
	document.frmAdditem.EqCode.value=eqCode;
	if (type == "3") {
		document.frmAdditem.action = sNonSecurePath+"customkititems.asp?kc="+code+"&iQty="+qty;
	}
	else {
		document.frmAdditem.action = sNonSecurePath+"includes/add_item.asp?Tp="+sTpCatalog;
	}
	document.frmAdditem.submit();
	}
	else{
	document.frmAdditem.qty.value = qty;
	document.frmAdditem.ic.value = code;
	document.frmAdditem.EqCode.value=eqCode;
	document.frmAdditem.action = sNonSecurePath+"includes/AddWishitem.asp?Tp="+sTpCatalog;
	document.frmAdditem.submit();
	}
}
// End of the function preproc(frm,index,code,type)

//@@@@@@@@@@@@@@@@@@@@@@@
function CalculateTotals(el,sKitCall4Price,kitprice,clubtotal,sLocaleId,addKitPrice,count,index){
	
	el.style.backgroundColor=el.options[el.selectedIndex].style.backgroundColor;
	el.style.color=el.options[el.selectedIndex].style.color;
	if(typeof(count) == "undefined")
	{
	count=0
	}
		
		
	if(sLocaleId == "")
		sLocaleId = iEnglishLocaleId;
	var i,sel_Count;
	var Sum,addSum,temp,addtemp,arr,arr2,arr3,totalvalue,addTotalvalue,sKitValue,sAddKitValue,objKitFld,objAddKitFld;
	totalvalue=0;
	addTotalvalue=0;
	configArr=""
	
	var len = eval("document.frmKitUpgrades"+index+".elements.length");
	var frm="frmKitUpgrades"+index
	
  if (sKitCall4Price != "T") {
		if(clubtotal=='T'){
			Sum=getEnglishLocale(kitprice,sLocaleId);
			addSum = getEnglishLocale(addKitPrice,sLocaleId);
			
		}
		else{
			Sum = 0.0;
			addSum = 0.0;
		}
			
		sel_Count = 0;
		
		for(i=0;i<=parseInt(len)-1;i++)	{
			
			if(eval("document.frmKitUpgrades"+index+".elements[i].type.substring(0,3)") == "sel") {	
			
				arr =  "document.frmKitUpgrades"+index+".elements[i].options[document.frmKitUpgrades"+index+".elements[i].selectedIndex].value";
				arr=eval(arr).split("#");
				
				//alert(arr);
				arr2 = "document.frmKitUpgrades"+index+".elements[i].options[0].value";
				arr2=eval(arr2).split("#");
				//alert(arr2);
				if (eval("document.frmKitUpgrades"+index+".elements[i].selectedIndex") == 0){
				
					if (clubtotal != 'T'){
						Sum = formatValue(parseFloat(Sum) + parseFloat(getEnglishLocale(arr[1],sLocaleId) * parseInt(arr[2])));
						addSum = formatValue(parseFloat(addSum) + parseFloat(getEnglishLocale(arr[4],sLocaleId) * parseInt(arr[2])));
					}
						
				}
				else{
					
					if (clubtotal == 'T'){					
						Sum = formatValue(parseFloat(Sum) + parseFloat(getEnglishLocale(arr[1],sLocaleId) * parseInt(arr[2])));
						addSum = formatValue(parseFloat(addSum) + parseFloat(getEnglishLocale(arr[4],sLocaleId) * parseInt(arr[2])));
					}
					else {
						Sum = formatValue(parseFloat(Sum) + parseFloat((parseFloat(getEnglishLocale(arr[1],sLocaleId)) + parseFloat(getEnglishLocale(arr2[1],sLocaleId))) * parseInt(arr2[2])));
						addSum = formatValue(parseFloat(addSum) + parseFloat((parseFloat(getEnglishLocale(arr[4],sLocaleId)) + parseFloat(getEnglishLocale(arr2[4],sLocaleId))) * parseInt(arr2[2])));
						
					}
				}
				
				configArr = configArr + parseInt(eval("document.frmKitUpgrades"+index+".elements[i].selectedIndex"))+ "#";
				//alert("b"+ configArr);
				
				
				sel_Count = parseInt(sel_Count) + 1;
				if (clubtotal != 'T'){
					if(eval("document.frmKitUpgrades"+index+".elements[i].selectedIndex") == 0)	{
						temp = getEnglishLocale(arr2[1],sLocaleId)*arr2[2];
						addtemp	=getEnglishLocale(arr2[4],sLocaleId)*arr2[2];
						eval("document.frmKitUpgrades"+index+".price" + sel_Count + ".value=" + formatValue(temp));
						fldname="frmKitUpgrades"+index+".price" + sel_Count;
						setFormat(fldname);
						objKitFld = eval("document.frmKitUpgrades"+index+".price" + sel_Count);						 
						objKitFld.value= getCurrentLocale(objKitFld.value,sLocaleId);
						if (sAdditionalCurrencySymbol != "") {
						eval("document.frmKitUpgrades"+index+".Add_Curr_price" + sel_Count + ".value=" + formatValue(addtemp));												
						addfldname="frmKitUpgrades"+index+".Add_Curr_price" + sel_Count;
						setFormat(addfldname);
						objAddKitFld = eval("document.frmKitUpgrades"+index+".Add_Curr_price" + sel_Count);	
						objAddKitFld.value= getCurrentLocale(objAddKitFld.value,sLocaleId);				
						}
						
					}
					else	{
						temp = getEnglishLocale(arr[1],sLocaleId);
						temp = (parseFloat(temp) + parseFloat(getEnglishLocale(arr2[1],sLocaleId)))*arr2[2];
						addtemp = getEnglishLocale(arr[4],sLocaleId);
						addtemp = (parseFloat(addtemp) + parseFloat(getEnglishLocale(arr2[4],sLocaleId)))*arr2[2];
						eval("document.frmKitUpgrades"+index+".price" + sel_Count + ".value=" + formatValue(temp));
						fldname="frmKitUpgrades"+index+".price" + sel_Count;
						setFormat(fldname);
						objKitFld = eval("document.frmKitUpgrades"+index+".price" + sel_Count);
						objKitFld.value= getCurrentLocale(objKitFld.value,sLocaleId);
						if (sAdditionalCurrencySymbol != "") {
						eval("document.frmKitUpgrades"+index+".Add_Curr_price" + sel_Count + ".value=" + formatValue(addtemp));												
						addfldname="frmKitUpgrades"+index+".Add_Curr_price" + sel_Count;
						setFormat(addfldname);
						objAddKitFld = eval("document.frmKitUpgrades"+index+".Add_Curr_price" + sel_Count);						 
						objAddKitFld.value= getCurrentLocale(objAddKitFld.value,sLocaleId);				
						}
						
						
					}
				}
			}
				
				/* Add code for javascript tool tip here */
						
			
			
			
			if(eval("document.frmKitUpgrades"+index+".elements[i].name.substring(0,13)") == "upgradehidden")	{
				configArr = configArr + 0 + "#"
				sel_Count = parseInt(sel_Count) + 1;
			}
		}
	
		if(clubtotal != 'T'){
			for(i=0;i<=parseInt(len)-1;i++)	{
				if(eval("document.frmKitUpgrades"+index+".elements[i].name.substring(0,13)") == "upgradehidden")
					totalvalue= totalvalue + parseFloat(getEnglishLocale(eval("document.frmKitUpgrades"+index+".elements[i].value"),sLocaleId));
				if(eval("document.frmKitUpgrades"+index+".elements[i].name.substring(0,22)") == "Add_Curr_upgradehidden")
					addTotalvalue= addTotalvalue + parseFloat(getEnglishLocale(eval("document.frmKitUpgrades"+index+".elements[i].value"),sLocaleId));									
					
			//alert('d'+i+'-'+Sum);
			
			}
		}
		//alert('t='+Sum);
		//alert(totalvalue);
		if (isNaN(Sum)==true)
		{
			Sum=0.00
		}
		
		
		sKitValue=parseFloat(Sum)+ totalvalue;	
		//alert("kit"+sKitValue);
		sAddKitValue = parseFloat(addSum)+ addTotalvalue;	
		if (sAdditionalCurrencySymbol != "") {
			if(sKitValue < 0 || sAddKitValue<0)
				alert(getMessage("iValidPriceComb"));
		}
		else {
			if(sKitValue < 0)
				alert(getMessage("iValidPriceComb"));
		}
		
		//eval("document.frmKitAmt"+index+".txtTotalKitValue"+index+".value") = sKitValue;
		//document.frmKitAmt1.txtTotalKitValue.value = sKitValue;
		//document.setElementByName('txtTotalKitValue'+index).value=sKitValue;				
		
		document.getElementById('txtTotalKitValues'+index).value=sKitValue;
		setFormat("frmKitAmt"+index+".txtTotalKitValue"+index);
		stempKitVal = eval("document.frmKitAmt"+index+".txtTotalKitValue"+index+".value");
		//alert(stempKitVal);
		eval("document.frmKitAmt"+index+".txtTotalKitValue"+index+".value") = getCurrentLocale(stempKitVal,sLocaleId);
		if (sAdditionalCurrencySymbol != "") {
		eval("document.frmKitAmt"+index+".txtTotalKitValue_Add_Curr.value") = sAddKitValue		
		setFormat("frmKitAmt"+index+".txtTotalKitValue_Add_Curr");
		stempAddKitVal = eval("document.frmKitAmt"+index+".txtTotalKitValue_Add_Curr.value");
		eval("document.frmKitAmt"+index+".txtTotalKitValue_Add_Curr.value") = getCurrentLocale(stempAddKitVal,sLocaleId);
		
		}
	}
}
// End of the function CalculateTotal()

/////@@@@@@@@@@@@@end of CalculateTotal()

function CheckConfig(todo,index,code,eqCode){
	var retval,iKitqty,iTotalqty,iMaxCount,sAttvalue,sAttvalue1,sAttvalue2;
	//Added for selection of atleast one attribute by Ashish/Ani - 19/06/2004
	//alert(document.frmKitUpgrades.selhide2.value);
	len = eval("document.frmKitUpgrades"+index+".elements.length");
	//alert(len);
	//var attcount=document.frmKitUpgrades.indcount.value;
	//alert(attcount);
	for(iIndex=0;iIndex<=parseInt(len)-1;iIndex++) {
		if(eval("document.frmKitUpgrades"+index+".elements[iIndex].type.substring(0,3)") == "sel"){
			sString1 = eval("document.frmKitUpgrades"+index+".elements[iIndex].options[0].text");
			sAlert = "Please select at least one "+sString1.toLowerCase().substring(7)+".";
			if (eval("document.frmKitUpgrades"+index+".elements[iIndex].options.selectedIndex") == 0) {
				alert(sAlert);
				return;
			}
		}
		
		
		
	}
	/*for(i=2;i<=parseInt(attcount);i++) {
								
				
	//alert(i);
	//alert(attcount);
			//sString1 = document.frmKitUpgrades.elements[iIndex].options[0].text;
			sAttvalue=document.getElementById('selcolor'+[i]).innerHTML;
			sAttvalue1=Trim(document.getElementById('selcolors'+[i]).innerHTML);
			
			//alert(sAttvalue1);
			sAttvalue1 = sAttvalue1.replace(":","");
			//alert(sAttvalue1);
			sAlert = "Please select at least one "+sAttvalue1.toLowerCase().substring(7);
			//sAlert = "Please select at least one"+sAttvalue1;
			//alert(sAlert);
			//if (sAttvalue.toLowerCase().substring(0,6)=="select")
			if (isBlank(sAttvalue) ==true)
			{
			alert(sAlert);
			document.getElementById('selcolors'+[i]).style.color='Red';
			return;
						
			}			
				
		}*/
	//iKitqty=eval("document.frmKitAmt"+index+".qty.value");
	iKitqty=document.getElementById('qty'+index).value;
	
	retval=IsNumeric(iKitqty)
	
	//if(Trim(parseFloat(document.getElementById('txtTotalKitValues'+index)).value) < 0){
	if(eval("document.frmKitAmt"+index+".txtTotalKitValue"+index+".value") < 0){
		alert(getMessage("iValidPriceComb"));
		return;
	}	
	if(retval == 1)	{
		alert(getMessage("iValidQuantity"));
		eval("document.frmKitAmt"+index+".qty.value")=1;
		document.frmKitAmt.qty.focus();
		return;
	}
	iKitqty = iKitqty*1
	//alert('max'+iMaxCount);
	if ((iMaxCount != "") && (bMaxItem.toLowerCase()=="true")){
		iTotalqty = parseInt(sCartItems)
		if(todo=="update")
			iTotalqty=iTotalqty - parseInt(iQty)
		if((iKitqty + iTotalqty)>parseInt(iMaxCount)){
			alert(getMessage("iTotalQtyExceed") + " " + iMaxCount);
			document.frmKitAmt.qty.value=1;
			document.frmKitAmt.qty.focus();
			return;
		}
	}
	//alert(configArr);
	document.frmKitInfo.qty.value = document.getElementById('qty'+index).value;
	document.frmKitInfo.configArr.value = configArr;
	document.frmKitInfo.todo.value = todo;
	document.frmKitInfo.ic.value = code;
	document.frmKitInfo.EqCode.value = eqCode;
	document.frmAdditem.action = sNonSecurePath+"includes/Add_item.asp?CartId="+sCartId;
	document.frmKitInfo.submit();
}
// End of the function CheckConfig(todo)


//function CheckConfigAll(todo,index,code,eqCode){
function CheckConfigAll(todo,index){
	var retval,iKitqty,iTotalqty,iMaxCount,sAttvalue,sAttvalue1,sAttvalue2,configArr,ArrVal;
	//Added for selection of atleast one attribute by Ashish/Ani - 19/06/2004
	//alert(document.frmKitUpgrades.selhide2.value);
	//len = eval("document.frmKitUpgrades"+index+".elements.length");
	//alert(len);
	//var attcount=document.frmKitUpgrades.indcount.value;
	//alert(attcount);
	//len = eval("document.frmAdds.elements.length");
	//len = document.frmAdds.elements.length;
	//alert(len);
	ArrVal="";
	configArr="";
	//for(j=0;j<=index-1;j++)
	for(var Ind=1;Ind<=parseInt(index);Ind++)
	{
		//alert(Ind);
		//var p=document.getElementById("qty"+Ind).value;
		//alert(p);
		//alert(document.frmAdds1.qty1.value);
		
		//if(document.frmAdds.elements[0].type.substring(0,3) == "inp") 
		//if(eval("document.frmAdds"+Ind+".elements[Ind].name.substring(0,3)") == "qty")
		if (eval("document.frmAdds"+Ind+".qty"+Ind+".value") > 0)
		
		{
			//alert('yes');
			
			//hidden value of att
			if (document.getElementById('attribute'+Ind).value > 0)
			
			{
			//len=document.getElementById('attribute'+Ind).value;
			len = eval("document.frmKitUpgrades"+Ind+".elements.length");
			//alert("len"+len);
			for(iIndex=0;iIndex<=parseInt(len)-1;iIndex++) {
				//alert(eval("document.frmKitUpgrades"+Ind+".elements[iIndex].type.substring(0,3)"));
				if(eval("document.frmKitUpgrades"+Ind+".elements[iIndex].type.substring(0,3)") == "sel"){
				
					
					sString1 = eval("document.frmKitUpgrades"+Ind+".elements[iIndex].options[0].text");
					sAlert = "Please select at least one "+sString1.toLowerCase().substring(7)+".";
					if (eval("document.frmKitUpgrades"+Ind+".elements[iIndex].options.selectedIndex") == 0) {
						alert(sAlert);
						return;
					}
					else{
										
					configArr = configArr + parseInt(eval("document.frmKitUpgrades"+Ind+".elements[iIndex].selectedIndex"))+ "#";
					
					}
				}
				
				if(eval("document.frmKitUpgrades"+Ind+".elements[iIndex].name.substring(0,13)") == "upgradehidden")	{
								configArr = configArr + 0 + "#"
								//sel_Count = parseInt(sel_Count) + 1;
				}



			}
			
			ArrVal=ArrVal + eval("document.frmAdds"+Ind+".itemcodes"+Ind+".value") +eval("document.frmAdds"+Ind+".qty"+Ind+".value")+"@"+configArr+"|";
			configArr='';		
			
			}
			else
			{
			ArrVal=ArrVal + eval("document.frmAdds"+Ind+".itemcodes"+Ind+".value") +eval("document.frmAdds"+Ind+".qty"+Ind+".value")+"@RG|";
			
			}
		}	
	}
	
	/*//iKitqty=eval("document.frmKitAmt"+index+".qty.value");
	iKitqty=document.getElementById('qty'+index).value;
	
	retval=IsNumeric(iKitqty)
	
	//if(Trim(parseFloat(document.getElementById('txtTotalKitValues'+index)).value) < 0){
	if(eval("document.frmKitAmt"+index+".txtTotalKitValue"+index+".value") < 0){
		alert(getMessage("iValidPriceComb"));
		return;
	}	
	if(retval == 1)	{
		alert(getMessage("iValidQuantity"));
		eval("document.frmKitAmt"+index+".qty.value")=1;
		document.frmKitAmt.qty.focus();
		return;
	}
	iKitqty = iKitqty*1
	//alert('max'+iMaxCount);
	if ((iMaxCount != "") && (bMaxItem.toLowerCase()=="true")){
		iTotalqty = parseInt(sCartItems)
		if(todo=="update")
			iTotalqty=iTotalqty - parseInt(iQty)
		if((iKitqty + iTotalqty)>parseInt(iMaxCount)){
			alert(getMessage("iTotalQtyExceed") + " " + iMaxCount);
			document.frmKitAmt.qty.value=1;
			document.frmKitAmt.qty.focus();
			return;
		}
	}*/
	//alert(ArrVal);
	//document.frmKitInfo.qty.value = document.getElementById('qty'+index).value;
	document.frmKitInfo.configArr.value = ArrVal;
	
	//alert("p"+document.frmKitInfo.configArr.value);
	if (isBlank(document.frmKitInfo.configArr.value))
	{
	alert("please select atleast one item by entering quantity");
	return;
	}
	document.frmKitInfo.todo.value = todo;
	//document.frmKitInfo.ic.value = code;
	//document.frmKitInfo.EqCode.value = eqCode;
	document.frmAdditem.action = sNonSecurePath+"includes/Add_item_all.asp?CartId="+sCartId;
	document.frmKitInfo.submit();
}
// End of the function CheckConfigAll

function estimateship(index,sCustZip,sResi)
//function estimateship(index)
		{

		var arrcode,itemcodes,ArrVal,attval;
		//alert(index);
		itemcodes="";
		ArrVal1='';
		attval='';
		for(var Ind=1;Ind<=parseInt(index)-1;Ind++)
			{

				//alert(Ind);
				//var p=document.getElementById("qty"+Ind).value;
				//alert(p);
				//alert(document.frmAdds1.qty1.value);


				//if(eval("document.frmAdds"+Ind+".elements[Ind].name.substring(0,3)") == "qty")
				if (eval("document.frmAdds"+Ind+".qty"+Ind+".value") > 0)

				/*{
					alert('yes');
					arrcode=eval("document.frmAdds"+Ind+".itemcodes"+Ind+".value").split("#");
					itemcodes=itemcodes + arrcode[0]+"#";
					alert(itemcodes);
				}*/
				{
							//alert('yes');
							
							//hidden value of att
							if (document.getElementById('attribute'+Ind).value > 0)
							
							{
							//len=document.getElementById('attribute'+Ind).value;
							len = eval("document.frmKitUpgrades"+Ind+".elements.length");
							//alert("len"+len);
							for(iIndex=0;iIndex<=parseInt(len)-1;iIndex++) {
								//alert(eval("document.frmKitUpgrades"+Ind+".elements[iIndex].type.substring(0,3)"));
								if(eval("document.frmKitUpgrades"+Ind+".elements[iIndex].type.substring(0,3)") == "sel"){
								
									
									sString1 = eval("document.frmKitUpgrades"+Ind+".elements[iIndex].options[0].text");
									sAlert = "Please select at least one "+sString1.toLowerCase().substring(7)+".";
									if (eval("document.frmKitUpgrades"+Ind+".elements[iIndex].options.selectedIndex") == 0) {
										alert(sAlert);
										return;
									}
									else{
														
									//configArr = configArr + parseInt(eval("document.frmKitUpgrades"+Ind+".elements[iIndex].selectedIndex.value"))+ "#";
									arr =  eval("document.frmKitUpgrades"+Ind+".elements[iIndex].value");
									arr=arr.split("#");
									attval=attval+ arr[0]+ "^";
									}
								}
								
								/*if(eval("document.frmKitUpgrades"+Ind+".elements[iIndex].name.substring(0,13)") == "upgradehidden")	{
												attval = attval + 0 + "#"
												//sel_Count = parseInt(sel_Count) + 1;
								}*/
				
				
				
							}
							
							ArrVal1=ArrVal1 + eval("document.frmAdds"+Ind+".itemcod"+Ind+".value") +">"+eval("document.frmAdds"+Ind+".qty"+Ind+".value")+">"+attval+"|";
							attval='';		
							
							}
							else
							{
							ArrVal1=ArrVal1 + eval("document.frmAdds"+Ind+".itemcod"+Ind+".value") +">"+eval("document.frmAdds"+Ind+".qty"+Ind+".value")+">RG|";
							
							}
						document.frmAdd.txhControl.value =1;	
						}
			
			}
			//alert(document.frmAdd.txhControl.value);
		if (isBlank(document.frmAdd.txhControl.value))
			{
			alert("please select atleast one item by entering quantity");
			return;
			}
		
		//document.frmAdd.submit();
		//window.open('itemshipcalculator.asp?isCartId=<%=sCartId%>&isItemCode='+itemcodes+'&sZipCode=<%=sCustZip%>&sResi=<%=sResi%>','0C7BA32642A8469586C312CEVEREST7119B26F3','top=100,left=250,width=650,resizable=no,scrollbars=yes,toolbar=no,height=500,status=yes');
		//return false;
		window.open("itemshipcalculatorAll.asp?isCartId="+sCartId+"&sAttval="+ArrVal1+"&sZipCode="+sCustZip+"&sResi="+sResi,"0C7BA32642A8469586C312CEVEREST7119B26F3","top=100,left=250,width=650,resizable=no,scrollbars=yes,toolbar=no,height=500,status=yes");
		}
	// end of estimateship
	
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: This function gets the selected matrix attributes from the select box
//  @                      and checks whether the particular combination is present or not.
//  @   Pages Affected  : Items
//  @		Function Name		: getattribute(frm,index,code,type)									
//	@		Input Parameters: frm = Form Name, index = Index value, code = Item Code, type = Item Type
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function getattribute(frm,index,code,type)
{ var iIndex,matrix,arrTemp,strselected,len;
	iItemCount=index
	matrix = false;
	arrTemp = eval("arrSelItems" + iItemCount)
	strselected = eval("document.frmAdd.SelMatrixAtt1" + iItemCount + ".options[document.frmAdd.SelMatrixAtt1" + iItemCount + ".selectedIndex].value"); 
	strselected = strselected + eval("document.frmAdd.SelMatrixAtt2" + iItemCount + ".options[document.frmAdd.SelMatrixAtt2" + iItemCount + ".selectedIndex].value"); 
	
	len = document.frmAdd.elements.length;
	for(iCount=0;iCount<=parseInt(len)-1;iCount++){
		if((document.frmAdd.elements[iCount].name.substring(0,13) == "SelMatrixAtt3") && (document.frmAdd.elements[iCount].name.substring(13,14) == iItemCount))
			strselected = strselected + eval("document.frmAdd.SelMatrixAtt3" + iItemCount + ".options[document.frmAdd.SelMatrixAtt3" + iItemCount + ".selectedIndex].value"); 
	}		
	for(iIndex=0;iIndex<=arrTemp.length-1;iIndex++){
		if(arrTemp[iIndex][1]==strselected){
			code = arrTemp[iIndex][0];
			matrix = true;
			break;
		}
	}
	if(matrix){
		preproc(frm,index,code,type,"",0)
		return;
	}
	else{
		alert(getMessage("iMatrixCombNotPresent"));
		return;
	}
}
// End of the function getattribute(frm,index,code,type)

//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: This function checks whether the attributes are unique 
//  @   Pages Affected  : Itemmatrix
//  @		Function Name		: attribCheck()
//	@		Input Parameters: iAttrib3 = (returns 1 if 3rd attribute is present, else returns 0)
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

		function attribCheck(iAttrib3){
			var sAttrib1,sAttrib2,sAttrib3;
			sAttrib1=document.frmMatrix.Attrib1.options[document.frmMatrix.Attrib1.selectedIndex].value;
			sAttrib2=document.frmMatrix.Attrib2.options[document.frmMatrix.Attrib2.selectedIndex].value;
			if(sAttrib1==sAttrib2){
				alert(getMessage("iUniqueAttributes"));
				return false;
			}
			if(iAttrib3=="1"){
				sAttrib3=document.frmMatrix.Attrib3.options[document.frmMatrix.Attrib3.selectedIndex].value;
				if((sAttrib3==sAttrib1)||(sAttrib3==sAttrib2)){
					alert(getMessage("iUniqueAttributes"));
					return false;
				}
			}
			document.frmMatrix.submit();
		}
// End of the function attribCheck(iAttrib3)

//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: This function gets the selected matrix Items 
//  @   Pages Affected  : Itemmatrix
//  @		Function Name		: multiselect()
//	@		Input Parameters: type = Item type(matrix Item),attribcode3=attribcode3
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function multiselect(type,attribcode3)
{ 
	var len, iIndex, attributes, qty, code, quantity, retval, attribute_codes,iTotalqty,iItemqty;

	iTotalqty=0;
	iItemqty=0;
	qty = "";
	code = "";
	attributes = "";
	attribute_codes = "";
		
	len = document.frmAdd.elements.length;
	for(iIndex=0;iIndex<=parseInt(len)-1;iIndex++){	
		if(document.frmAdd.elements[iIndex].type == "checkbox"){
			if(document.frmAdd.elements[iIndex].checked){
				arr = document.frmAdd.elements[iIndex].value.split("*");
				quantity = eval("document.frmAdd.qty" + arr[0] + ".value")
				retval=IsNumeric(quantity)
				if(retval == 1){
					alert(getMessage("iValidQuantity"));
					eval("document.frmAdd.qty" + arr[0] + ".value=1");
					eval("document.frmAdd.qty" + arr[0] + ".focus()");
					return;
				}
				qty = qty + quantity + "*";
				code = arr[1];
				attributes = attributes + arr[2] + "*";
				iItemqty=iItemqty+parseInt(quantity);
							
			}	  
		}	
	}
	if(code == ""){
		alert(getMessage("iSelectItems"));
		return;
	}

	if ((iMaxCount != "") && (bMaxItem.toLowerCase()=="true")){
		iTotalqty = parseInt(sCartItems)
		if((iItemqty + iTotalqty)>parseInt(iMaxCount)){
			alert(getMessage("iTotalQtyExceed") + " " + iMaxCount);
			return;
		}
	}
	attribute_codes = attribute_codes + (document.frmMatrix.Attrib1.selectedIndex + 1) + "*";
	attribute_codes = attribute_codes + (document.frmMatrix.Attrib2.selectedIndex + 1) + "*";
	if(attribcode3 != "") 
		attribute_codes = attribute_codes + (document.frmMatrix.Attrib3.selectedIndex + 1);
	else
		attribute_codes = attribute_codes + "";
		
	document.frmAdditem.qty.value = qty;
	document.frmAdditem.ic.value = code;
  document.frmAdditem.type.value=type;
  document.frmAdditem.attributes.value = attributes;
  document.frmAdditem.attribute_codes.value = attribute_codes;
  document.frmAdditem.submit();
}
// End of the function multiselect(type)



//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: Function IsNumeric checks whether the entered value is a 
//	@											numeric and greater than Zero
//  @		Function Name		: IsNumeric(value)									
//	@		Input Parameters: value to be tested
//	@		Return Value		: 0 - Success	  1 - Failure			
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function IsNumeric(value)
{
	var validate=/(^\d+$)/
	if ((validate.test(value)) && (value > 0))
		return 0; 
	else
		return 1; 
}
// End of the function IsNumeric(value)

//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: This function used to format the contents in the field.
//	@		                	If value is 100.0 , this funciton will change it to 100.00.
//	@		Pages Affected  : Shipcalculator.asp
//  @		Function Name		: setFormat(field)									
//	@		Input Parameters: field = name of the form and fieldto be formatted
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function setFormat(field){
		var i, idiff,strval;
		var m_Field = eval("document." + field);
  	if(m_Field.value.indexOf(".") < 0)
			m_Field.value = m_Field.value + ".00";
		if(m_Field.value.length-m_Field.value.indexOf(".") == 2)
			m_Field.value = m_Field.value + "0";
		else if(m_Field.value.length-m_Field.value.indexOf(".") > 3){
			m_Field.value=m_Field.value.substring(0,m_Field.value.indexOf(".") +3)		
		}
		
	  idiff=10-m_Field.value.length	
		strval=""
		for(i=0;i< 10;i++)	{
			strval=strval+ " "  
			if (i==idiff-1){
				strval=strval+m_Field.value;
				break;
			}
		}
		m_Field.value=strval;
}

// End of the function setFormat(field)

//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: This function used to format numbers.
//	@		                	If we pass 100 , this funciton will return 100.00.
//	@	  Pages Affected  : Shipcalculator.asp
//  @		Function Name		: formatValue(value)									
//	@		Input Parameters: value = then number to be formatted
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function formatValue(value){
	return Math.round(value*100)/100;
}
// End of the function formatValue(value)


//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: This function is for submitting the form automatically when user  
//	@											selects a subcategory from list-box.
//  @   Pages Affected  : items, itemdesc
//  @		Function Name		: submitlist()									
//	@		Input Parameters: null
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function submitlist(sBc)
{
	var value,sCatText;
	value=document.frmList.lstSubCategory.options[document.frmList.lstSubCategory.selectedIndex].value;
	sCatText=document.frmList.lstSubCategory.options[document.frmList.lstSubCategory.selectedIndex].text;
	if(value != "0")
	{
		document.frmList.action = sNonSecurePath+"items.asp?Cc=" + value + "&CatName=" + sCatText + "&Bc="+sBc+"&BrandName="+sBrandName+"&Tp="+sTpCatalog+"&iTpStatus=1";
		document.frmList.submit();
	}
}
// End of the function submitlist()

//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: This function is called to choose the Catalog from the list.
//  @   Pages Affected  : PowerSearch
//  @		Function Name		: ChangeCatalog()									
//	@		Input Parameters: null							
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function ChangeCatalog()
{
  strURL = sNonSecurePath+"powersearch.asp?Tp=" + document.frmPSearch.shop.options[document.frmPSearch.shop.selectedIndex].value;
  window.location.href = strURL;
}
// End of the function ChangeCatalog()
	
	
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: This function checks	whether the entered qty is correct or not.
//  @                   : If any related items is checked then it is passed thru hidden 
//  @                   : field called chkitems with ',' as seperator
//  @   Pages Affected  : Itemdesc
//  @		Function Name		: preprocess()									
//	@		Input Parameters: Value to be tested									
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


function preprocess(iWishList, iUnits){ 
	var retval, iItemqty, iTotalqty, qty, iIndex, iRelatedQty;
	qty=document.frmAdd.qty.value;
	retval=IsNumeric(qty);
	iRelatedQty = 0;
	if(retval == 1)	{
		alert(getMessage("iValidQuantity"));
		document.frmAdd.qty.value=iUnits;
		document.frmAdd.qty.focus();
		return;
	}
	
	if (iWishList == 0){
		iItemqty = qty*1
		if ((iMaxCount != "") && (bMaxItem.toLowerCase()=="true")){
			iTotalqty = parseInt(sCartItems)
			if (document.frmRelated){
				if(document.frmRelated.chkItems.length > 1){
					for (iIndex = 0; iIndex < document.frmRelated.chkItems.length; iIndex++){
						if (document.frmRelated.chkItems[iIndex].checked){
							iRelatedQty =  iRelatedQty + parseInt(document.frmRelated.chkItems[iIndex].value.split(",")[1]);
						}
					}
				}
				else{
					if (document.frmRelated.chkItems.checked){
						iRelatedQty =  parseInt(document.frmRelated.chkItems.value.split(",")[1]);
					}
				}
			}
			if((iItemqty + iTotalqty + iRelatedQty)>parseInt(iMaxCount)){
				alert(getMessage("iTotalQtyExceed") + " " + iMaxCount);
				document.frmAdd.qty.value=iUnits;
				document.frmAdd.qty.focus();
				return;
			}
		}
		for (count=0;count<document.forms.length;count++){
				if (document.forms[count].name=="frmRelated"){	
					var sItemList="";
					for(index=0;index<(document.frmRelated.elements.length);index++) {
						if(document.frmRelated.elements[index].checked){
							sItemList+=document.frmRelated.elements[index].value + "," ;
							iItemqty++;				
						}
					}
					sItemList = sItemList.substring(0,sItemList.length-1)
					document.frmAdd.chkItems.value = sItemList;
				}
		}
		document.frmAdd.submit();
	}
	else{
		document.frmAdd.action = sNonSecurePath+"includes/AddWishitem.asp?Tp="+sTpCatalog;
		document.frmAdd.submit();
	}
}
// End of the function preprocess()


//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: This function is used to submit the upgrade items form.
//  @   Pages Affected  : Itemdesc
//  @		Function Name		: UpgradeBuy(itemcode)									
//	@		Input Parameters: itemcode = Item Code									
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function UpgradeBuy(itemcode,iUnits)
{
	iTotalqty = parseInt(sCartItems)
	if ((iMaxCount != "") && (bMaxItem.toLowerCase()=="true")){
		if(iTotalqty >= parseInt(iMaxCount)){
			alert(getMessage("iTotalQtyExceed") + " " + iMaxCount);
			return;
		}
	}
	document.frmUpgrade.ic.value = itemcode;
	document.frmUpgrade.qty.value = iUnits;
	document.frmUpgrade.submit();
}
// End of the function UpgradeBuy(itemcode)

	
	
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: This function is used to delete a particular item from cart.
//  @   Pages Affected  : Viewcart
//  @		Function Name		: DeleteFromCart(itemcode, itemtype, tpcode)									
//	@		Input Parameters: itemcode = Item Code, itemtype = Item Type, tpcode = TpCode									
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function DeleteFromCart(itemcode, itemtype, tpcode, eqCode)
{
	if(confirm(getMessage("iRemoveItemFromCart")))
	{
	document.frmDelete.itemcode.value = itemcode;
	document.frmDelete.itemtype.value = itemtype;
	document.frmDelete.tpcode.value = tpcode;
	document.frmDelete.EqCode.value = eqCode;
	document.frmDelete.submit();
	}
}
// End of the function DeleteFromCart(itemcode, itemtype, tpcode)



//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: This function is used to empty the cart.
//  @   Pages Affected  : Viewcart
//  @		Function Name		: EmptyCart()									
//	@		Input Parameters: Null									
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function EmptyCart()
{
	if(confirm(getMessage("iEmptyCart")))
	{
	document.frmDelete.todo.value = "empty";
	document.frmDelete.submit();
	}
}
// End of the function EmptyCart()


//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: This function is used to update the cart contents, as changed 
//	@											by the user.
//  @   Pages Affected  : Viewcart
//  @		Function Name		: UpdateCart(Index)									
//	@		Input Parameters: Index = Total no. of items									
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


function UpdateCart(Index)
{
	var count,qty,retval,iItemqty;
	iItemqty=0
	
	for(count = 1;count<=Index;count++)
	{		
		qty = eval("document.frmCartContents.qty" + count + ".value")
		var validate=/(^\d+$)/
		if (validate.test(qty) == false)
		{
			alert(getMessage("iValidQuantity"));
			eval("document.frmCartContents.qty" + count + ".focus()");
			return;
		}
		qty=qty*1
		iItemqty=iItemqty+qty
	}
	if ((iMaxCount != "") && (bMaxItem.toLowerCase()=="true")){
		if(iItemqty > parseInt(iMaxCount)){
			alert(getMessage("iTotalQtyExceed") + " " + iMaxCount);
			return;
		}
	}
	document.frmCartContents.submit();
}
// End of the function UpdateCart(Index)


//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: This function is called whenever user clicks prev or next navigation.
//  @   Pages Affected  : pSearchresult
//  @		Function Name		: submitSearch(iPageNo)									
//	@		Input Parameters: iPageNo	= PageNo								
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function submitSearch(iPageNo){	
	document.frmPSearch.PageNo.value= iPageNo;
	document.frmPSearch.submit();
}
// End of the function submitSearch(iPageNo)




//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: This function is called before submiting page, to validate
//	@											the min & max price.
//  @   Pages Affected  : PowerSearch
//  @		Function Name		: PowerSearchVal()									
//	@		Input Parameters: null							
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function PowerSearchVal(sCustTypeInt, sCustTypeDate){
	var len,iIndex,bCriteria,fMinval,fMaxval,value ;
	
	var validate=/(^\d+$)/
	
	//The hidden variables are being reset to blank when user comes back to page using back button.
	document.frmPSearch.sManDesc.value  = "";
	document.frmPSearch.sBrandDesc.value = "";
	document.frmPSearch.sCatDesc.value  =  "";
	
	if(sCustTypeInt!=""){
		sCustTypeInt = sCustTypeInt.substring(0,sCustTypeInt.length-1) 
		arr = sCustTypeInt.split(",");
		for(iIndex=0;iIndex<=arr.length-1;iIndex++){
			objField=eval("document.frmPSearch." + arr[iIndex]) 
			if(objField.value!=""){
				if(!(validate.test(objField.value)))  {
						alert(getMessage("iValidInteger"));
						objField.focus();
						objField.select();
						return false;
				}
			}	
		}	
	}
	if(sCustTypeDate!=""){
		sCustTypeDate = sCustTypeDate.substring(0,sCustTypeDate.length-1) 
		arr = sCustTypeDate.split(",");
		for(iIndex=0;iIndex<=arr.length-1;iIndex++){
			smonth=eval("document.frmPSearch." + arr[iIndex]+ "month.options[document.frmPSearch." + arr[iIndex]+ "month.selectedIndex].value")
			sday=eval("document.frmPSearch." + arr[iIndex]+ "day.options[document.frmPSearch." + arr[iIndex]+ "day.selectedIndex].value")
			syear=eval("document.frmPSearch." + arr[iIndex]+ "year.options[document.frmPSearch." + arr[iIndex]+ "year.selectedIndex].value")
			var sdate=new Date(syear, smonth ,sday)
			var sDefaultDate=new Date(1995,1,1)
			if((sdate-sDefaultDate)!=0)
				eval("document.frmPSearch.Txt" + arr[iIndex] + ".value=smonth+'/'+sday+'/'+syear")
			else
				eval("document.frmPSearch.Txt" + arr[iIndex] + ".value=''")
		}
	}
	
	bCriteria=false;
	len = document.frmPSearch.elements.length;
	for(iIndex=0;iIndex<=parseInt(len)-1;iIndex++){	
		if(document.frmPSearch.elements[iIndex].type == "text"){
			if(document.frmPSearch.elements[iIndex].value != ""){
				if(document.frmPSearch.elements[iIndex].value.charAt(0)==" "){
					alert(getMessage("iSearchNoStartSpace"));
					document.frmPSearch.elements[iIndex].focus();
					return false;
				}
				bCriteria = true;
			}
		}
		
		if(document.frmPSearch.elements[iIndex].type == "hidden"){
			if(document.frmPSearch.elements[iIndex].value != "")
				bCriteria = true;
		}
		if(document.frmPSearch.elements[iIndex].type == "checkbox"){
			if(document.frmPSearch.elements[iIndex].checked)
				bCriteria = true;
		}
		sFldname=document.frmPSearch.elements[iIndex].name
		if((sFldname == "selCategory")||(sFldname == "selBrand")||(sFldname == "selManufacturer")){
			if(document.frmPSearch.elements[iIndex].options[document.frmPSearch.elements[iIndex].selectedIndex].value != "")
				bCriteria = true;
		}
		if(bCriteria) break;
	}
	
	if(! bCriteria)	{
		alert(getMessage("iEnterSearchText"));
		document.frmPSearch.txtKey.focus();
		return false;
	}
	
	fMinval=document.frmPSearch.txtMin.value
	fMaxval=document.frmPSearch.txtMax.value
	
	if(document.frmPSearch.txtMin.value.length > 0)
	{ 
		 retval=IsFloat(fMinval);
		
		if(! retval)
		{
				alert(getMessage("iValidPrice"));
				document.frmPSearch.txtMin.focus();
				document.frmPSearch.txtMin.select();
				return false;
		}
		
			fMinval=parseFloat(fMinval);
		
		
	}
	if(document.frmPSearch.txtMax.value.length > 0)
	{   
	  
		 retval=IsFloat(fMaxval);
		if(! retval)
		{
			alert(getMessage("iValidPrice"));
			document.frmPSearch.txtMax.focus();
			document.frmPSearch.txtMax.select();
			return false;
		}
		
			fMaxval=parseFloat(fMaxval);
	
		
	}
	if(fMaxval < fMinval)
	{
		alert(getMessage("iMaxPriceGTMinPrice"));
		document.frmPSearch.txtMax.focus();
		document.frmPSearch.txtMax.select();
		return false;
		
	}
/*	document.frmPSearch.sManDesc.value  = document.frmPSearch.selManufacturer.options[document.frmPSearch.selManufacturer.selectedIndex].text;
	document.frmPSearch.sBrandDesc.value = document.frmPSearch.selBrand.options[document.frmPSearch.selBrand.selectedIndex].text;*/
	document.frmPSearch.sCatDesc.value  =  document.frmPSearch.selCategory.options[document.frmPSearch.selCategory.selectedIndex].text;
	document.frmPSearch.submit();
	
}

// End of the function powersearchval()

//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: This function is called before submiting page, to validate
//	@											float value.
//  @   Pages Affected  : PowerSearch
//  @		Function Name		: IsFloat()									
//	@		Input Parameters: price value(Minimum or Maximum)							
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


function IsFloat(value)
{
	var pattern1 = /^(\d+)(\.){0,1}(\d*)$/
	var pattern2 = /^(\d*)(\.){0,1}(\d+)$/
	return pattern1.test(value) || pattern2.test(value);
}

// End of the function IsFloat()


//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: This function is called when Delete or Retrieve link is clicked.
//	@											It is used to change the action depending on the link clicked.
//  @   Pages Affected  : Retreivecart
//  @		Function Name		: RetrieveCart(getcart,todo)									
//	@		Input Parameters: getcart = cartid,todo = 1(Delete) or 0(Retrieve)							
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function RetrieveCart(getcart,todo)
{
	if(todo=="1")
		if(confirm(getMessage("iDelSavedCart")))
			document.frmRetrieveCart.action = sNonSecurePath+"retrievecart.asp?action=DEL";
		else
			return;
	else
		document.frmRetrieveCart.action = sNonSecurePath+"retrievecart.asp?action=RET";
	document.frmRetrieveCart.PrevCartID.value =  getcart;
	document.frmRetrieveCart.submit();
}
// End of the function RetrieveCart(getcart,todo)


//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: This function is called when New cart name and Email id is entered.
//	@											It validates the Name and the Email id.
//  @   Pages Affected  : SaveCart
//  @		Function Name		: SaveCart()									
//	@		Input Parameters: null							
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function SaveCart(){
	if (document.frmSaveCart.CARTNAME.value == ""){
    	alert(getMessage("iEnterCartName"));
		document.frmSaveCart.CARTNAME.focus();
		return;
	}
	if (document.frmSaveCart.CARTNAME.value.charAt(0)==" "){
		alert(getMessage("iCartSpaces"));
		document.frmSaveCart.CARTNAME.focus();
		return;
	}
	if(document.frmSaveCart.CARTNAME.value.indexOf('"')!=-1)
	 {
		alert(getMessage("iInvalidCartname"));
		document.frmSaveCart.CARTNAME.focus();
		return;
	 }
	document.frmSaveCart.action = sNonSecurePath+"savecart.asp?action=SN&saved=1"
	document.frmSaveCart.submit();
}
// End of the function SaveCart()


//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@	Description		:	This function is called when New cart name and Email id is entered.
//	@						It validates the Name and the Email id.
//  @   Pages Affected  :	SaveEmail()
//  @	Function Name	:	SaveEmail()									
//	@	Input Parameters:	null
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function SaveEmail(){
	
	// ### Validating email.
	ret_val = IsEmail(document.frmSaveEmail.EMAIL.value);
	if (ret_val == 1){
		document.frmSaveEmail.EMAIL.focus();
		document.frmSaveEmail.EMAIL.select();
		return;
	}
	
	document.frmSaveEmail.action = sNonSecurePath+"EmailidReq.asp"
	document.frmSaveEmail.submit();
}
// End of the function SaveEmail()





//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: This function is called when when existing cart name is selected.
//  @   Pages Affected  : SaveCart
//  @		Function Name		: RestoreCart()									
//	@		Input Parameters: null							
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function RestoreCart()
{
	if (document.frmSaveCart.CARTLIST.options[document.frmSaveCart.CARTLIST.selectedIndex].value == 0 )	{
		alert(getMessage("iChooseCartName"));
		document.frmSaveCart.CARTLIST.focus();
	}	
	else	{	
		document.frmSaveCart.action = sNonSecurePath+"savecart.asp?action=SE&saved=1"
		document.frmSaveCart.submit();
	}
}
// End of the function RestoreCart()


//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: This function is called to validate the zipcode.
//  @   Pages Affected  : ShipCalculator
//  @		Function Name		: ZipCode_validate()									
//	@		Input Parameters: null							
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function ZipCode_validate(bUseDestZone)
{	
	var retval;
	// ### Validating address type
	if (document.frmShip.RESI.options[document.frmShip.RESI.selectedIndex].value == 0)
	{
		alert(getMessage("iAddressType"));
		document.frmShip.RESI.focus();
		return false;
	}
	if(document.frmShip.zipcode.value != ""){	
		if(bUseDestZone.toUpperCase() !="TRUE") {
			retval=IsNumeric(document.frmShip.zipcode.value)
			if(retval == 1)	{
				alert(getMessage("iValidZipCode"));
				document.frmShip.zipcode.focus();
				document.frmShip.zipcode.select();
				return false;
			}
		}
	}
	if((bUseDestZone.toUpperCase()=="FALSE") && (document.frmShip.zipcode.value == ""))	
		alert(getMessage("iEnterZipCode"));
			
	if(bUseDestZone.toUpperCase()=="TRUE"){
		// ### Validating City
		if((document.frmShip.City.value != "") && (document.frmShip.City.value.charAt(0)==" ") ){
				alert(getMessage("iValidText"))
				document.frmShip.City.focus();
				document.frmShip.City.select();
				return false;
		}
		// ### Validating State/ Province
		if((document.frmShip.State.value != "") && (document.frmShip.State.value.charAt(0)==" " )){	
				alert(getMessage("iValidText"))
				document.frmShip.State.focus();
				document.frmShip.State.select();
				return false;
		}
	}	
	document.frmShip.submit();
}
// End of the function ZipCode_validate()


//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: This function is called to validate the zipcode.
//  @   Pages Affected  : ShipCalculator
//  @		Function Name		: ZipCodevalidate()									
//	@		Input Parameters: null							
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function ZipCodevalidate()
{	
	var retval;
	// ### Validating address type
	
	 if(document.frmShip.zipcode.value == ""){	
		alert(getMessage("iValidZipCode"));
		document.frmShip.zipcode.focus();
		return false;
	}
}
// End of the function ZipCodevalidate()

//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: This function is called when a shipping method is selected.
//  @		Pages Affected  : ShipCalculator
//  @		Function Name		: ShipCharge_Calculate()									
//	@		Input Parameters: null							
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function ShipCharge_Calculate(iLocale)
{	var iTotal, iCartTotal,i, iRadselValue
	if(iLocale==null)
		iLocale=iEnglishLocaleId;
	
	for(i=0;i<=document.frmCost.radsel.length-1;i++){
	
  	 if(document.frmCost.radsel[i].checked)
	  { 
	   iRadselValue=document.frmCost.radsel[i].value.split("*")
	   
	  
	   iRadselValue[0]=getEnglishLocale(iRadselValue[0],iLocale)

	        iRadselValue[0] = formatValue(parseFloat(iRadselValue[0]));
  			iCartTotal=sCartTotal
  			
			iCartTotal=getEnglishLocale(iCartTotal,iLocale)
   			iTotal = parseFloat(iRadselValue[0]) + parseFloat(iCartTotal);
   			
			document.frmCost.total.value = formatValue(iTotal);
			setFormat("frmCost.total");
			document.frmCost.total.value = getCurrentLocale(document.frmCost.total.value,iLocale);
			document.frmCost.shipprice.value = iRadselValue[0] 
			setFormat("frmCost.shipprice");
			document.frmCost.shipprice.value = getCurrentLocale(document.frmCost.shipprice.value,iLocale);
			
		if (sAdditionalCurrencySymbol != "") {
			iRadselValue[1]=getEnglishLocale(iRadselValue[1],iLocale)
			iRadselValue[1] = formatValue(parseFloat(iRadselValue[1]));	        
  			iCartTotal=sCartTotalInAddCurr
			iCartTotal=getEnglishLocale(iCartTotal,iLocale)
   			iTotal = parseFloat(iRadselValue[1]) + parseFloat(iCartTotal);   		
			document.frmCost.total_add_curr.value = formatValue(iTotal);
			setFormat("frmCost.total_add_curr");
			document.frmCost.total_add_curr.value = getCurrentLocale(document.frmCost.total_add_curr.value,iLocale);
			document.frmCost.shipprice_add_curr.value = iRadselValue[1] 
			setFormat("frmCost.shipprice_add_curr");
			document.frmCost.shipprice_add_curr.value = getCurrentLocale(document.frmCost.shipprice_add_curr.value,iLocale);
		}
		break;
		
		}
	}
}
// End of the function ShipCharge_Calculate()

//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: Function is to validate the alphanumeric characters and  string.  
//  @  		Pages Affected 		: Shipcalculator
//  @		Function Name		: isAlphanumeric(str,cSpace)
//	@		Input Parameters	: formname = name of the form
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function isAlphanumeric(str,cSpace){
    var sSpacepat = /^(((\w+)[\s,\-*\.]*)+)$/
     var sPat = /^(((\w+)[*,\-\.]*)+)$/
     if (cSpace=="1"){
		if(!(sSpacepat.test(str)))
		   {
			 alert(getMessage("iValidText"));
			 return false;
	       }	
		}
	  else{
		
		if(!(sPat.test(str)))  
			{
				alert(getMessage("iValidText"));
				return false;
	        }
	        }
     return true;
}
// End of the function isAlphanumeric(str,cSpace)

//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: This function changes the no. of days dynamically according to  
//  @											the month and the year.
//	@	  Pages Affected  : powersearch.asp
//  @		Function Name		: DateValidate(which)									
//	@		Input Parameters: which = field
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

function DateValidate(which)
{
	var sel = eval("document.frmPSearch." + which + "day.selectedIndex");
	var i=eval("document.frmPSearch." + which + "month.options[document.frmPSearch." + which + "month.selectedIndex].value");
	var j=eval("document.frmPSearch." + which + "year.options[document.frmPSearch." + which + "year.selectedIndex].value");
	var k;
	if(i=="1" || i=="3" || i=="5" || i=="7" || i=="8" || i=="10" || i=="12")
	{
		eval("document.frmPSearch." + which + "day.length=31");
		for(k=28;k<=30;k++)
		{
			eval("document.frmPSearch." + which + "day.options[" + k + "].value=" + parseInt(k+1));
			eval("document.frmPSearch." + which + "day.options[" + k + "].text=" + parseInt(k+1));
		}
	}
	if(i=="4" || i=="6" || i=="9" || i=="11")
	{
		eval("document.frmPSearch." + which + "day.length=30");
		for(k=28;k<=29;k++)
		{
			eval("document.frmPSearch." + which + "day.options[" + k + "].value=" + parseInt(k+1));
			eval("document.frmPSearch." + which + "day.options[" + k + "].text=" + parseInt(k+1));
		}
	}
	var mydate = new Date();
	if(i==2)
	{
		mydate.setDate(1);
		mydate.setYear(j);
		mydate.setMonth(1);
		mydate.setDate(31);
		var k=31-mydate.getDate();
		eval("document.frmPSearch." + which + "day.length=" + k);
		if((k==29) || (k==28))
		{
			eval("document.frmPSearch." + which + "day.options[" + (k-1) + "].value=" + k);
			eval("document.frmPSearch." + which + "day.options[" + (k-1) + "].text=" + k);
		}
	}
	
	if((sel+1) > eval("document.frmPSearch." + which + "day.length"))
	{
		eval("document.frmPSearch." + which + "day.selectedIndex=document.frmPSearch." + which + "day.length-1");
	}
}
// End of the function DateValidate(which)


//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@		Description			: Validation for EMail									@
//  @		Function Name		: IsEmail()												@
//	@		Input Parameters	: Value to be tested									@
//	@		Return Value		: 0 - Success											@
//	@							  1 - Failure											@
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function IsEmail(strEmail)
{
var intReturn =1;
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=strEmail.match(emailPat)
	if (matchArray==null ) {
		alert(getMessage("iValidEmail"));
		return intReturn;
	}
var user=matchArray[1]
var domain=matchArray[2]
if (user.match(userPat)==null) {
    alert(getMessage("iValidEmail"));
    return intReturn;
}
	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(getMessage("iValidEmail"));
			return intReturn;
			}
		}
		intReturn=0;
		return intReturn;
	}
var domainArray=domain.match(domainPat)
if (domainArray==null) {
	alert(getMessage("iValidEmail"));
    return intReturn;
}
	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	if (domArr[domArr.length-1].length<2 || 
		domArr[domArr.length-1].length>4) {
	alert(getMessage("iValidEmail"));
	return intReturn;
	}
var len=domArr.length	
if (len<2) {
   var errStr = getMessage("iValidEmail");
   alert(errStr)
   return intReturn;
}
intReturn=0;
return intReturn;
}
//	End of the function IsEmail(strEmail)

//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//	@	Description			: This function is to show the Color Disclaimer. 
//	@	Pages Affected			: ItemDesc.asp
//	@	Function Name			: showdisclaim()									
//	@	Input Parameters		: null
//	@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


function showdisclaim()
{
	var iIndex,myWin,iCount,sString1,len,sString2,sImgLink;
	myWin = window.open('','_itemdcl','width=530,height=370')
	myWin.document.write("<TITLE>Image and Color Disclaimer</TITLE>");
	myWin.document.write("<table border=0>");
	myWin.document.write("<tr><td valign=top>");
	myWin.document.write("<font face='verdana' style='font-size: 8pt'><b>Why wouldn’t the product image exactly match the product being described?</b><br><br></font>");
	myWin.document.write("</td></tr>");
	myWin.document.write("<tr><td valign=top>");
	myWin.document.write("<font face='verdana' style='font-size: 8pt'>Because of the multiple options that some of our products offer we do not always have a picture of every product with every option.&nbsp;&nbsp;In this situation we offer the closest image available to show what the product looks like.<br><br></font>");
	myWin.document.write("</td></tr>");
	myWin.document.write("<tr><td valign=top>");
	myWin.document.write("<font face='verdana' style='font-size: 8pt'><b>Why doesn’t the product look at all like the product I am ordering?</b><br><br></font>");
	myWin.document.write("</td></tr>");
	myWin.document.write("<tr><td valign=top>");
	myWin.document.write("<font face='verdana' style='font-size: 8pt'>On occasion we do make mistakes and it is possible that we have the wrong picture shown on the website.&nbsp;&nbsp;If you think that is the case please feel free to call us at 888-447-2401 with any questions or comments.<br><br></font>");
	myWin.document.write("</td></tr>");
	myWin.document.write("<tr><td valign=top>");
	myWin.document.write("<font face='verdana' style='font-size: 8pt'><b>Are the colors on the website exactly what the product will look like?</b><br><br></font>");
	myWin.document.write("</td></tr>");
	myWin.document.write("<tr><td valign=top>");
	myWin.document.write("<font face='verdana' style='font-size: 8pt'>It is almost impossible to match the colors of our products to the colors that we can show you over the internet.&nbsp;&nbsp;Every monitor shows colors a little differently and the colors of our products will often vary from lot to lot.&nbsp;&nbsp;We do our best to show you the color of our products but if there is any question please give us a call and we would be happy to send you an actual samples for your review.<br><br></font>");
	myWin.document.write("</td></tr>");
	myWin.document.write("<tr><td>&nbsp;</td></tr>");
	myWin.document.write("<tr><td align=center><input type=button name=bClose value='Close Window' onclick='window.close();'></td></tr>");
	myWin.document.write("</table>");
	myWin.document.close();
	myWin.focus();
}
// End of the function showdisclaim()

// @@@@@@@@@@@@@@@@@@@@  check for blank
function isBlank(val){
	if(val==null){return true;}
	for(var i=0;i<val.length;i++) {
		if ((val.charAt(i)!=' ')&&(val.charAt(i)!="\t")&&(val.charAt(i)!="\n")&&(val.charAt(i)!="\r")){return false;}
		}
	return true;
	}
// check for blank

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Trim fuction

function RTrim(str){
	if (str==null){return null;}
	for(var i=str.length-1;str.charAt(i)==" " || str.charAt(i)=="\n" || str.charAt(i)=="\t";i--);
	return str.substring(0,i+1);
	}
//
//@@@@@@@@@@@@@@@@@@@@@@@@@@@

function LTrim(str){
	if (str==null){return null;}
	for(var i=0;str.charAt(i)==" " || str.charAt(i)=="\n" || str.charAt(i)=="\t";i++);
	return str.substring(i,str.length);
	}
function Trim(str){return LTrim(RTrim(str));}
//
function estimateitemship(sIc,sCustZip,sResi)
{
	
	var retval,iKitqty,iTotalqty,iMaxCount,sAttvalue,sAttvalue1,sAttvalue2;
	//Added for selection of atleast one attribute by Ashish/Ani - 19/06/2004
	//alert(document.frmKitUpgrades.selhide2.value);
	
	//len = document.frmAdd.elements.length;
	//alert(len);
	
	//alert(attcount);
	window.open("itemshipcalculator.asp?isItemCode="+sIc+"&sZipCode="+sCustZip+"&sResi="+sResi,"0C7BA32642A8469586C312CEVEREST7119B26F3","top=100,left=250,width=650,resizable=no,scrollbars=yes,toolbar=no,height=500,status=yes");
}
function estimatecartship(sCustZip,sResi){
	
	var retval,iKitqty,iTotalqty,iMaxCount,sAttvalue,sAttvalue1,sAttvalue2;
	//Added for selection of atleast one attribute by Ashish/Ani - 19/06/2004
	//alert(document.frmKitUpgrades.selhide2.value);
	
	len = document.frmCartContents.elements.length;
	//alert(len);
	
	//alert(attcount);
	window.open("cartshipcalculator.asp?sZipCode="+sCustZip+"&sResi="+sResi,"0C7BA32642A8469586C312CEVEREST7119B26F3","top=100,left=250,width=650,resizable=no,scrollbars=yes,toolbar=no,height=500,status=yes");
}
