var xmlHttp;
var AdFirst;
var requestURL;
var is_ie = (navigator.userAgent.indexOf('MSIE') >= 0) ? 1 : 0; 
var is_ie5 = (navigator.appVersion.indexOf("MSIE 5.5")!=-1) ? 1 : 0; 
var is_opera = ((navigator.userAgent.indexOf("Opera 6")!=-1)||(navigator.userAgent.indexOf("Opera/6")!=-1)) ? 1 : 0; 
var is_netscape = (navigator.userAgent.indexOf('Netscape') >= 0) ? 1 : 0;
var INCT;
var Container,GenderID,ProductRollOverDiv,DefaultImage;
var designID,productID;
var DivID,cartPID,cartDID,cartID,IsBackProduct;
var cusertype,susertype;
var HURL_IMAGES;
var DSKU=0,PSKU=0,GENERATE_IMAGE_PATH;
var  GiftNoteDiv,DivMAFirstName,DivMALastName,DivMAStreet1,DivMAStreet2,DivMACity,DivMAZip,DivMACountryID,DivMAPhoneNo,BANonUSState,MANonUSState,BAUSState,MAUSState,DivBAFirstName,DivBALastName,DivBAStreet1,DivBAStreet1,DivBAZip,DivBACountryID,DivBAPhoneNo,DivBACity,CCNDiv,CCVDiv;
function savejerseydata(ID,JID,number,name)
{ 
		requestURL = 'include/editJersey.php?JID='+JID+'&Number='+number+'&Name='+name+'&Index='+ID;
		//alert(requestURL);
		var url = requestURL;
		xmlHttp = GetXmlHttpObject(stateChangeHandler1);
		xmlHttp_Get(xmlHttp, url);
		 
}
function stateChangeHandler1()
{
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete')
	{
		var str = xmlHttp.responseText;
		result = str.split('^');		
		 if(result[0] == 'success')
		{
			name = 	result[1];
			number = result[2];
			index = result[3]; 
			
			document.getElementById('ListNumber'+index).innerHTML = number;
			document.getElementById('ListName'+index).innerHTML = name;
		}
		else
		{
			alert("Problem Saving Data");
		}
	}
}

function ApplyCoupon(HURL,CID){
		

		CountryID = document.getElementById("BACountryID").value;
	    requestURL = HURL+'action/apply_coupon.php?CID='+CID+'&CountryID='+CountryID;
		//alert(requestURL);
		var url = requestURL;
		xmlHttp = GetXmlHttpObject(stateChangeHandlerCoupon);
		xmlHttp_Get(xmlHttp, url);
	
	
}
function stateChangeHandlerCoupon()
{
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete')
	{
		var str = xmlHttp.responseText;
	 
	    result = str.split('^');	
		 
		/*if(result[1]==1){  
			document.getElementById('ErrorDiv').style.display='';
			document.getElementById('ErrorDiv').innerHTML=result[0]; 
		}else{
	      document.getElementById('DiscountPriceDiv').innerHTML=result[0]; 
		  document.getElementById('ErrorDiv').style.display='none';
		}*/
		 
		    document.getElementById('ErrorDiv').style.display='';
			document.getElementById('ErrorDiv').innerHTML=(result[0])?result[0]:'';
			if(result[1]!='' )
			{

				document.getElementById("DiscountLine").style.display = 'inline';
				document.getElementById('DiscountPriceDiv').innerHTML= "("+((result[1])?result[1]:0 )+")"; 
			}
			if(result[2]!='')
			document.getElementById('SubTotalDiv').innerHTML=(result[2])?result[2]:0; 
			if(result[3]!='')
			document.getElementById('ShippingPriceDiv').innerHTML=(result[3])?result[3]:0; 
			
			if(result[1] =='$0.00')
			{
				document.getElementById("DiscountLine").style.display = 'none';
			}
			
			if(result[2] =='$0.00')
			{

				 if(CCNDiv){
					 Spry.Widget.Utils.destroyWidgets("CCNDiv");
						//CCNDiv.destroy();	 
				 }
				 if(CCVDiv){
					 Spry.Widget.Utils.destroyWidgets("CCVDiv");
					//CCVDiv.destroy();	 
				 }
				document.getElementById("PaymentBox").style.display = "none";	 
			}
			else
			{
			document.getElementById("PaymentBox").style.display = "";	
			CCNDiv = new Spry.Widget.ValidationTextField("CCNDiv", "credit_card", {useCharacterMasking:true,validateOn:["blur","change"]});
			CCVDiv = new Spry.Widget.ValidationTextField("CCVDiv", "none", {useCharacterMasking:true,maxChars:4,minChars:3,validateOn:["blur","change"]});

			}
			
			
			
			document.getElementById('TaxPriceDiv').innerHTML=(result[4])?result[4]:0;

			// code for add remove credit card validation
	}
}
function CalculateTax(StateID,Zip,CountryID,HURL){
	
	    requestURL = HURL+'action/calculate_tax.php?StateID='+StateID+'&Zip='+Zip+'&CountryID='+CountryID;
		//alert(requestURL);
		var url = requestURL;
		xmlHttp = GetXmlHttpObject(stateChangeHandlerTax);
		xmlHttp_Get(xmlHttp, url);
}
function stateChangeHandlerTax()
{
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete')
	{
		var str = xmlHttp.responseText;
		 result = str.split('^');

	    document.getElementById('TaxPriceDiv').innerHTML=(result[0])?result[0]:0;
		document.getElementById('SubTotalDiv').innerHTML=(result[1])?result[1]:0;
		document.getElementById('DiscountPriceDiv').innerHTML="("+((result[2])?result[2]:0)+")"; 

		if(result[1] =='$0.00')
			{
				 if(CCNDiv){
					 Spry.Widget.Utils.destroyWidgets("CCNDiv");
						//CCNDiv.destroy();	 
				 }
				 if(CCVDiv){
					 Spry.Widget.Utils.destroyWidgets("CCVDiv");
					//CCVDiv.destroy();	 
				 }
				document.getElementById("PaymentBox").style.display = "none";	 
			}
			else
			{
			document.getElementById("PaymentBox").style.display = "";	
			CCNDiv = new Spry.Widget.ValidationTextField("CCNDiv", "credit_card", {useCharacterMasking:true,validateOn:["blur","change"]});
			CCVDiv = new Spry.Widget.ValidationTextField("CCVDiv", "none", {useCharacterMasking:true,maxChars:4,minChars:3,validateOn:["blur","change"]});

			}
			

	}
}
function GenerateRollOverImage(DesignDiv,BGUrl,BGColor,Flag){
	if(Flag==1){
	  if(BGColor='#000000')
	    document.getElementById(DesignDiv+'').style.backgroundColor = "#ffffff";
	}else{
		document.getElementById(DesignDiv+'').style.backgroundColor = BGColor;
	}
	document.getElementById(DesignDiv+'').style.backgroundImage = "url('" + BGUrl + "')";
 }
/*function GenerateRollOverImage(ProductID,DesignID,PRDivID,DefaultImage,HURL){  
	if(ProductID!=0 && DesignID!=0){
		ProductRollOverDiv=PRDivID;
	    requestURL = HURL+'include/generate_rollover_image.php?ProductID='+ProductID+'&DesignID='+DesignID;
		var url = requestURL;
		xmlHttp = GetXmlHttpObject(stateChangeHandlerGenerateRollOverImage);
		xmlHttp_Get(xmlHttp, url);
	
	}else{
		
	document.getElementById(ProductRollOverDiv+'').style.backgroundImage = "url('" + DefaultImage + "')";	
	}
}

function stateChangeHandlerGenerateRollOverImage()
{
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete')
	{
		var str = xmlHttp.responseText;
	    document.getElementById(ProductRollOverDiv+'').style.backgroundImage = "url('" + requestURL + "')";
	   
	}else{
			document.getElementById(ProductRollOverDiv+'').style.backgroundImage = "url('" + DefaultImage + "')";	
	}
}*/
function xmlHttp_Get(xmlhttp, url)
{
	xmlhttp.open('GET', url, true);
	xmlhttp.send(null);
}
function GetXmlHttpObject(handler)
{
 	var objXmlHttp = null;
		if (is_ie)
		{
			var strObjName = (is_ie5) ? 'Microsoft.XMLHTTP' : 'Msxml2.XMLHTTP';
			try{
				objXmlHttp = new ActiveXObject(strObjName);
				objXmlHttp.onreadystatechange = handler;
			 }
			catch(e)
			{
			alert('IE detected, but object could not be created. Verify that active scripting and activeX controls are enabled');
			return;
			}
		}
	else if (is_opera)
	{
		alert('Opera detected. The page may not behave as expected.');
		return;
	}
	else
	{
		objXmlHttp = new XMLHttpRequest();
		objXmlHttp.onload = handler;
		objXmlHttp.onerror = handler;
	}
	return objXmlHttp;
}

function RemoveExtraSpaces(str)
{
var str1 = "";
	
	for(i=0;i<str.length;i++)
	{
		str2 = str;
		var CharCode = str2.substring(i,(str2.length)).charCodeAt();
		if(CharCode !=10 && CharCode !=13){
			str1 = str1 + str.substring(i,i+1);
			//alert(str1);
		}
	}
	//alert(str1+" -- Trim");
	return str1;
}

function changeSizeCombo(HURL,colorid,PID,DID)
{ 
		designID = DID;
		productID = PID;
		HURL_IMAGES = HURL;
		document.getElementById('SizeCombo').innerHTML = "";
		requestURL = HURL+'include/changeSizeCombo.php?ColorID='+colorid+'&PID='+PID+'&DID='+DID;
		//alert(requestURL);
		var url = requestURL;
		xmlHttp = GetXmlHttpObject(changeSizeCombostateChangeHandler);
		xmlHttp_Get(xmlHttp, url);
		 
}
function changeSizeCombostateChangeHandler()
{
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete')
	{
		var str = xmlHttp.responseText;
		result = str.split('^~^');
		document.getElementById('SizeCombo').innerHTML = result[0];
		document.getElementById('DisplaySKU').innerHTML = "<strong>"+result[1]+"</strong>";
		document.getElementById('SKU').value = result[1];
		document.getElementById('Price').innerHTML = "$"+
		result[2];

		changeExtraImages(HURL_IMAGES,designID,productID);
	}
}
function changePrice(HURL,PID,DID)
{ 
		if(PID != "" && PID != "-" && PID != "0" && PID != "")
		{

			requestURL = HURL+'include/changePriceProductDetail.php?PID='+PID+'&DID='+DID;
			//alert(requestURL);
			var url = requestURL;
			xmlHttp = GetXmlHttpObject(changePricestateChangeHandler);
			xmlHttp_Get(xmlHttp, url);
		}
}
function changePricestateChangeHandler()
{
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete')
	{
		var str = xmlHttp.responseText;
		result = str.split('^~^');
		price = (result[0])?result[0]:0;
		document.getElementById('Price').innerHTML = "$"+price;
		document.getElementById('txtprice').value = price;
			
		colorname = (result[1])?result[1]:'';
		colorcost = (result[2])?result[2]:0;
		SKU = (result[3])?result[3]:0;

		var Price;
		if(colorcost > 0)
		{
			Price = "&nbsp;(+$"+colorcost+")";
		}
		else
		{
			Price = "";
		}
		document.getElementById("ColorName").innerHTML = "<strong>"+colorname+Price+"</strong>";
		document.getElementById("SKU").value =  SKU ;
		document.getElementById("DisplaySKU").innerHTML= "<strong>"+SKU+"</strong>";
	}
}
function changeExtraImages(HURL,DID,PID)
{ 

		requestURL = HURL+'include/changeExtraImages.php?DID='+DID+'&PID='+PID;
		var url = requestURL;
		xmlHttp = GetXmlHttpObject(changeExtraImagesHandler);
		xmlHttp_Get(xmlHttp, url);
		 
}
function changeExtraImagesHandler()
{
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete')
	{
		var str = xmlHttp.responseText;
		document.getElementById('ExtraImages').innerHTML = str;
	}
}
function onColorChange(HURL,PID,ID,DID,CartID,IsBack,ctype,GENERATE_IMAGE,OptionID)
{ 
	IsBackProduct = IsBack;
	DivID= ID;
	cartPID = PID.value;
	cartDID = DID;
	cartID  = CartID;
	cusertype = ctype;
	GENERATE_IMAGE_PATH = GENERATE_IMAGE;
	HURL_IMAGES = HURL;

	SKUString  = document.getElementById(OptionID).options[document.getElementById(OptionID).selectedIndex].id;
	result =  SKUString.split("-");
	PSKU = result[0];
	DSKU = result[1];
	
	requestURL = HURL+'include/changeCart.php?DID='+DID+'&PID='+PID.value+"&CartID="+CartID+'&size=1&ID='+ID;
	var url = requestURL;
	xmlHttp = GetXmlHttpObject(onColorChangeHandler);
	xmlHttp_Get(xmlHttp, url);
}
function onColorChangeHandler()
{
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete')
	{
		var str = xmlHttp.responseText;
		result = str.split('^~^');	
		ordersubtotal = parseFloat(result[3]);
		orderShippingTotal = parseFloat(document.getElementById("OrderShippingTotal").innerHTML);

		document.getElementById('SizeCombo'+DivID).innerHTML = result[0];
		if(cusertype == 'user'){
			
			document.getElementById('Price'+DivID).innerHTML = "$"+result[1];
		}
		else
		{
			document.getElementById('txtPrice'+cartID).value = result[1];	
		}
		document.getElementById('SKU'+DivID).innerHTML = result[2];
		document.getElementById('frontimage'+DivID).style.backgroundImage = "url('"+HURL_IMAGES+GENERATE_IMAGE_PATH+"/"+PSKU+"."+DSKU+"-75x75-front.png')";

//		document.getElementById('frontimage'+DivID).style.backgroundImage = "url('include/generate_rollover_image.php?ProductID="+cartPID+"&DesignID="+cartDID+"&ThumbW=75&ThumbH=75')";

		if(IsBackProduct.toString() == 'true'){
		
		//document.getElementById('backimage'+DivID).style.backgroundImage = "url('include/generate_rollover_image.php?ProductID="+cartPID+"&DesignID="+cartDID+"&ThumbW=75&ThumbH=75&View=back')";
		document.getElementById('backimage'+DivID).style.backgroundImage = "url('"+HURL_IMAGES+GENERATE_IMAGE_PATH+"/"+PSKU+"."+DSKU+"-75x75-back.png')";
		}

		document.getElementById('frontimage'+DivID).innerHTML = '<a href="#" onclick="javascript:open_win_cart(\'include/cartimage.php\',\'400\',\'450\','+cartDID+','+cartPID+',\'front\');"><img height="78" border="0" width="78" src="images/trans.gif"/></a>';

		if(IsBackProduct.toString() == 'true'){
			
		document.getElementById('backimage'+DivID).innerHTML = '<a href="#" onclick="javascript:open_win_cart(\'include/cartimage.php\',\'400\',\'450\','+cartDID+','+cartPID+',\'back\');"><img height="78" border="0" width="78" src="images/trans.gif"/></a>';
		}
		qty = document.getElementById('txtqty_'+cartID).value;
		subtotal = result[1] * qty ;
			var	grandtotal =  parseFloat(ordersubtotal.toFixed(2)) + parseFloat(orderShippingTotal);
		document.getElementById('Total'+DivID).innerHTML = "$"+subtotal.toFixed(2);
		document.getElementById('OrderTotal').innerHTML = "$"+ordersubtotal.toFixed(2);
		document.getElementById('FinalorderTotal').innerHTML = "$"+grandtotal.toFixed(2);
	}
}
function onSizeChange(HURL,PID,ID,DID,CartID,IsBack,stype,ProductSKU,DesignSKU,GENERATE_IMAGE)
{ 
	IsBackProduct = IsBack;
	DivID= ID;
	cartPID = PID.value;
	cartDID = DID;
	cartID  = CartID;
	susertype = stype;
	HURL_IMAGES = HURL+"/";
	DSKU = DesignSKU;
	PSKU = ProductSKU;
	GENERATE_IMAGE_PATH = GENERATE_IMAGE;
	requestURL = HURL+'include/changeCart.php?DID='+DID+'&PID='+PID.value+"&CartID="+CartID+'&size=0&ID='+ID;
	var url = requestURL;
	xmlHttp = GetXmlHttpObject(onSizeChangeHandler);
	xmlHttp_Get(xmlHttp, url);
}
function onSizeChangeHandler()
{
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete')
	{
		var str = xmlHttp.responseText;
		result = str.split('^~^');			
		ordersubtotal = parseFloat(result[3]);
		orderShippingTotal = parseFloat(document.getElementById("OrderShippingTotal").innerHTML);

		if(susertype == 'user'){
			document.getElementById('Price'+DivID).innerHTML = "$"+result[1];
		}
		else
		{
			document.getElementById('txtPrice'+cartID).value = result[1];	
		}

		document.getElementById('SKU'+DivID).innerHTML = result[2];
		document.getElementById('frontimage'+DivID).style.backgroundImage = "url(HURL_IMAGES+GENERATE_IMAGE_PATH+'/'+PSKU+'.'+DSKU+'-75x75-front.png')";
		
		if(IsBackProduct.toString() == 'true'){	
		document.getElementById('frontimage'+DivID).style.backgroundImage = "url(HURL_IMAGES+GENERATE_IMAGE_PATH+'/'+PSKU+'.'+DSKU+'-75x75-back.png')";
		//document.getElementById('backimage'+DivID).style.backgroundImage = "url("+HURL_IMAGES+"'include/generate_rollover_image.php?ProductID="+cartPID+"&DesignID="+cartDID+"&ThumbW=75&ThumbH=75&View=back')";
		}
		document.getElementById('frontimage'+DivID).innerHTML = 
		'<a href="#" onclick="javascript:open_win_cart(\''+HURL_IMAGES+'include/cartimage.php\',\'400\',\'450\','+cartDID+','+cartPID+',\'front\');"><img height="78" border="0" width="78" src="images/trans.gif"/></a>';

		if(IsBackProduct.toString() == 'true'){
			
		document.getElementById('backimage'+DivID).innerHTML = '<a href="#" onclick="javascript:open_win_cart(\''+HURL_IMAGES+'include/cartimage.php\',\'400\',\'450\','+cartDID+','+cartPID+',\'back\');"><img height="78" border="0" width="78" src="images/trans.gif"/></a>';
		}
		var qty = document.getElementById('txtqty_'+cartID).value;
		var subtotal = result[1] * qty ;

		var	grandtotal =  parseFloat(ordersubtotal.toFixed(2)) + parseFloat(orderShippingTotal);

		document.getElementById('Total'+DivID).innerHTML = "$"+subtotal.toFixed(2);
		document.getElementById('OrderTotal').innerHTML = "$"+ordersubtotal.toFixed(2);
		document.getElementById('FinalorderTotal').innerHTML = "$"+grandtotal.toFixed(2);
	}
}
function changeSizeRange(HURL,colorid,PID)
{ 
		productID = PID;
		HURL_IMAGES = HURL;
		document.getElementById('SizeRange').innerHTML = "";
		requestURL = HURL+'include/changeSizeRange.php?ColorID='+colorid+'&PID='+PID;
		//alert(requestURL);
		var url = requestURL;
		xmlHttp = GetXmlHttpObject(changeSizeRangestateChangeHandler);
		xmlHttp_Get(xmlHttp, url);
}
function changeSizeRangestateChangeHandler()
{
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete')
	{
		var str = xmlHttp.responseText;
		result = str.split('^~^');
		document.getElementById('SizeRange').innerHTML = result[0];
		document.getElementById('DisplaySKU').innerHTML = result[1];
		document.getElementById('SKU').value = result[1];
		changeExtraImages(HURL_IMAGES,'0',productID);
	}
}
function changeShippingTable(HURL,CountryID,StateID,ZipCode)
{   
		requestURL = HURL+'include/changeShippingTable.php?CID='+CountryID+'&SID='+StateID+'&ZID='+ZipCode;
		//alert(requestURL);
		var url = requestURL;
		xmlHttp = GetXmlHttpObject(changeShippingTableHandler);
		xmlHttp_Get(xmlHttp, url);

	/*if(document.getElementById('ShipRadio2').checked){
		changeMAState();
		}*/
		// make changes depenns on option selected for shipping address	

}
function changeShippingTableHandler()
{
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete')
	{
		var str = xmlHttp.responseText;
		result = str.split('^');
		document.getElementById('ShippingTable').innerHTML = (result[0])?result[0]:'';
		document.getElementById('ShippingPriceDiv').innerHTML = (result[1])?result[1]:0;
		document.getElementById('SubTotalDiv').innerHTML=(result[2])?result[2]:0;
		document.getElementById('TaxPriceDiv').innerHTML=(result[3])?result[3]:0;
		document.getElementById('EstimatedDate').innerHTML=(result[4])?result[4]:0;
		document.getElementById('ShippingMethodName').innerHTML=(result[5])?result[5]:'';
		document.getElementById('DiscountPriceDiv').innerHTML="("+((result[6])?result[6]:0)+")"; 
		
		if(country == '223')
				{
					bstate = document.getElementById("BAStateID").value;
				}else
				{
					bstate = document.getElementById("BAStateID1").value;
				}
			// calculate the tax based on selected Shipping Option	
			  callCalculate(bstate,'','BA');
	
	}
}
function ChangeShippingOrderPrice(HURL,ShippingOption,CountryID)
{
	requestURL = HURL+'include/ChangeShippingOrderPrice.php?ShippingOption='+ShippingOption+'&CID='+CountryID;
	//alert(requestURL);
	var url = requestURL;
	xmlHttp = GetXmlHttpObject(ChangeShippingOrderPriceHandler);
	xmlHttp_Get(xmlHttp, url);
}
function ChangeShippingOrderPriceHandler()
{
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete')
	{
		var str = xmlHttp.responseText;
		result = str.split('^');	
	    document.getElementById('ShippingPriceDiv').innerHTML=(result[0])?result[0]:0;
		document.getElementById('SubTotalDiv').innerHTML=(result[1])?result[1]:0;
		document.getElementById('EstimatedDate').innerHTML=(result[2])?result[2]:'';
		document.getElementById('ShippingMethodName').innerHTML=(result[3])?result[3]:'';
		document.getElementById('DiscountPriceDiv').innerHTML="("+((result[4])?result[4]:0)+")"; 

	if(result[1] =='$0.00')
			{
				 if(CCNDiv){
					 Spry.Widget.Utils.destroyWidgets("CCNDiv");
				 }
				 if(CCVDiv){
					 Spry.Widget.Utils.destroyWidgets("CCVDiv");
				 }
				document.getElementById("PaymentBox").style.display = "none";	 
			}
		else
			{
			document.getElementById("PaymentBox").style.display = "";	
			CCNDiv = new Spry.Widget.ValidationTextField("CCNDiv", "credit_card", {useCharacterMasking:true,validateOn:["blur","change"]});
			CCVDiv = new Spry.Widget.ValidationTextField("CCVDiv", "none", {useCharacterMasking:true,maxChars:4,minChars:3,validateOn:["blur","change"]});

			}

	}
}
function ChangeSecurityImage(HURL)
{
	requestURL = HURL+'include/ChangeSecurityImage.php';
	//alert(requestURL);
	document.getElementById('SCodeImageDiv').innerHTML = "";
	var url = requestURL;
	xmlHttp = GetXmlHttpObject(ChangeSecurityImageHandler);
	xmlHttp_Get(xmlHttp, url);
}
function ChangeSecurityImageHandler()
{
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete')
	{
		var str = xmlHttp.responseText;
	    document.getElementById('SCodeImageDiv').innerHTML=str;
	}
		
}

function open_win_cart(url,width,height,designid,productid,view) {
	  
 var url = url+'?DID='+designid+'&PID='+productid+'&view='+view;

 var newwindow=window.open(url,'name','"height='+height+',width='+width+',scrollbars=0"');
	if (window.focus) {newwindow.focus()}
	return false;
}

function popup(url,width,height) {
		 
window.open(url,'Fibers','width='+width+',height='+height);

}

// JavaScript Document
// function to change the header Login and Logout box.

function changeHeaderTitle(login)
{
	if(login == "1")
	{
		document.getElementById("login").style.display="none";
		document.getElementById("myaccount").style.display="inline";
	}
	else
	{
		document.getElementById("myaccount").style.display="none";
		document.getElementById("login").style.display="inline";
	}
}

function appendSearchText(formName,Action,Value){
	
	Value = RemoveExtraSpaces(Value);
	Value =  Value.replace(/[^a-zA-Z 0-9/&]+/g,'');
	Value =  Value.replace(/[/&]+/g,'and');
	Value=Value.replace(/\s+/g,"-");


document.getElementById(formName+'').action=Action+Value;
}

function appendSearchTextHelp(formName,Action,Value){
	
	Value = RemoveExtraSpaces(Value);
	Value =  Value.replace(/[^a-zA-Z 0-9/&]+/g,'');

document.getElementById('SearchText').value = Value;
document.getElementById(formName+'').action=Action;
}
 
function UpdateHeaderCartQty(Qty){


cQty = document.getElementById('HeaderCartQty').innerHTML;
nQty = parseInt(cQty) + parseInt(Qty) ; 
document.getElementById('HeaderCartQty').innerHTML = nQty;
}

function filterInput(id) {
	var re = /[^a-zA-Z0-9\s]/g
	id.value = id.value.replace(re,'');
}  
