
function processCart(mode)
{

	var len = document.frmcart.elements.length;

	var qrystr = "mode="+mode;
	for(var i=0;i<len;i++)
	{
		if(document.frmcart.elements[i].type == "text")
		{
			var name = document.frmcart.elements[i].name;
			var val = document.frmcart.elements[i].value;
			if(val<=0)
			{
				alert("Quantity not valid");
				return false;
			}
			
			qrystr += "&"+name+"="+val;
		}
		
	}
	return 	qrystr;
}
function printSpecial(){

	if(document.getElementById != null){

		var html = '<HTML>\n<HEAD>';
		/*if (document.getElementsByTagName != null){
			var headTags = document.getElementsByTagName("head");
			if (headTags.length > 0)
				html += headTags[0].innerHTML;
		}*/
		html += '\n</HE' + 'AD>\n<BODY style="background-color:#000000; color:#ffffff; font-size:11px;">\n';
		var printReadyElem = document.getElementById("printReady");
		
		if (printReadyElem != null)
		{
			html += printReadyElem.innerHTML;

		}else{
			alert("Could not find the printReady section in the HTML");
			return;
		}

		html += '\n</BO' + 'DY>\n</HT' + 'ML>';
		var printWin = window.open("","printSpecial");
		printWin.document.open();
		printWin.document.write(html);
		printWin.document.close();
		if (gAutoPrint){
			printWin.print();
			printWin.close();
		}
	}else{
		alert("Sorry, the print ready feature is only available in modern browsers.");
	}
}

function addtocart(mode,id)
{
	
	document.frmmerch.mode.value = mode;
	document.frmmerch.id.value = id;
	document.frmmerch.submit();
}

function getfrmvalpaircartvar(frmobj,paramstr)
{

	paramarr=paramstr.split('###');
	pstr='';
	prodid=frmobj.id.value;
	for(i=1;i<paramarr.length;i++)
	{
		val=document.getElementById(paramarr[i]).value;
		 if(val!='')
		 pstr+="&"+paramarr[i]+"="+val;
	}
	
	str='id='+frmobj.id.value+'&mode='+frmobj.mode.value+pstr;

	return str;
}
function getfrmvalpaircartvar1(frmobj,paramstr)
{
//alert(paramstr);
paramarr=paramstr.split('###');
	pstr='';
	prodid=frmobj.id.value;

		for(i=1;i<paramarr.length;i++)
	{
		//alert(paramarr[i]);
		val=document.getElementById(paramarr[i]).value;
		 if(val!='')
		 pstr+="&"+paramarr[i]+"="+val;
	}
//	alert(pstr);
	str='id='+frmobj.id.value+'&mode='+frmobj.mode.value+pstr;

	return str;
}
function get_shipping_form_values()
{

	var bl_firstname=document.getElementById('bl_firstname').value;
	var bl_lastname=document.getElementById('bl_lastname').value;
	var bl_address1=document.getElementById('bl_address1').value;
	var bl_address2=document.getElementById('bl_address2').value;
	var bl_city=document.getElementById('bl_city').value;
	var bl_country=document.getElementById('bl_country').value;
	var bl_state=document.getElementById('bl_state').value;
	var bl_zip=document.getElementById('bl_zip').value;
	var bl_phone=document.getElementById('bl_phone').value;
	var bl_mail=document.getElementById('bl_mail').value;
	
if(document.frmsignup.checkship.checked == true)
{
	var sh_firstname = bl_firstname;
	var sh_lastname = bl_lastname;
	var sh_address1 = bl_address1;
	var sh_address2 = bl_address2;
	var sh_city = bl_city;
	var sh_country = bl_country;
	var sh_state = bl_state;
	var sh_zip = bl_zip;
	var sh_phone = bl_phone;
	
	
}
else
{
	var sh_firstname=document.getElementById('sh_firstname').value;
	var sh_lastname=document.getElementById('sh_lastname').value;
	var sh_address1=document.getElementById('sh_address1').value;
	var sh_address2=document.getElementById('sh_address2').value;
	var sh_city=document.getElementById('sh_city').value;
	var sh_country=document.getElementById('sh_country').value;
	var sh_state=document.getElementById('sh_state').value;
	var sh_zip=document.getElementById('sh_zip').value;
	var sh_phone=document.getElementById('sh_phone').value;
}

	var returnval="bl_firstname="+bl_firstname+"&bl_lastname="+bl_lastname+"&bl_address1="+bl_address1+"&bl_address2="+bl_address2+	"&bl_city="+bl_city+"&bl_country="+bl_country+"	&bl_state="+bl_state+"&bl_zip="+bl_zip+"&bl_phone="+bl_phone+"&bl_mail="+bl_mail+"&sh_firstname="+sh_firstname	+"&sh_lastname="+sh_lastname+"&sh_address1="+sh_address1+"	&sh_address2="+sh_address2+"&sh_city="+sh_city+"	&sh_country="+sh_country+"&sh_state="+sh_state+"&sh_zip="+sh_zip+"&sh_phone="+sh_phone;

	return returnval;
}


function hideTable(val)
{
	if(val==true)
	{
		document.getElementById('Ship_Address').style.display = "none";
	}
	else
	{
		document.getElementById('Ship_Address').style.display="";
		document.frmsignup.sh_title.value="";
	}
}

function fillInfo(control,basefield,selectedfield)
{
	control.options.length = 0;
	flag = 0;
	for(i=0,j=0; i<fillArr.length; i++)
	{
		if(fillArr[i][0] == basefield)
		{
			if(selectedfield == fillArr[i][1])
			{
				control.options[j] = new Option(fillArr[i][1]+" "+fillArr[i][2]);
				control.options[j].value = fillArr[i][1];
				control.options[j].selected = true;
				flag = 1;
				
			}
			else
			{
				control.options[j] = new Option(fillArr[i][1]+" "+fillArr[i][2]);
				control.options[j].value = fillArr[i][1];
			}				
			j++;
		}
	}
}