document.write('<LINK rel="stylesheet" type="text/css" href="/Style/Default.css">');
function displayPrice(price, pricingcatalogid, productid, productsku){
	
	//document.write("<a href='");
	//if (price!="?"){
	//	document.write("Cart.aspx?qty=1&pcid="+pricingcatalogid + "&pid="+productid);
	//}else{
	//	document.write("#");
	//}
	//document.write("'>");
	document.write("<strong>");
	document.write(price);
	document.write("</strong>");
	//document.write("</a>");
}
function displayButton(price, pricingcatalogid, productid, productsku){
	document.write("<a href='");
	if (price!="?"){
		document.write("Cart.aspx?qty=1&pcid="+pricingcatalogid + "&pid="+productid);
	}else{
		document.write("#");
	}
	document.write("'>");
	document.write("<img src=/images/buy_now.jpg border=0 alt=\"Add to Cart\" title=\"Add to Cart\">");
	document.write("</a>");
}

function displayProductPrice(sku,f,ctlName){
     var xmlHttp = GetXmlHttpObject();
     var url = "/SharedCatalog/AJAX/ajaxGetProductInfo.aspx";
     url += "?sku="+sku;
     url += "&f="+ f;
     
     if (!xmlHttp){
          alert ("Browser does not support HTTP Request")
          return
     }
     xmlHttp.onreadystatechange=function(){
     if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
            document.getElementById(ctlName).innerHTML=xmlHttp.responseText;
        }
     };
     xmlHttp.open("GET", url, true);
     xmlHttp.send(null);
}
function displayProductButton(sku,f,imageURL,cartURL,ctlName){
     var xmlHttp = GetXmlHttpObject();
     var url = "/SharedCatalog/AJAX/ajaxGetProductInfo.aspx";
     url += "?sku="+sku;
     url += "&f="+ f;
     
     if (!xmlHttp){
          alert ("Browser does not support HTTP Request")
          return
     }
     xmlHttp.onreadystatechange=function(){
     if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
            document.getElementById(ctlName).innerHTML="<a href='"+ cartURL+ xmlHttp.responseText + "'>"+ imageURL + "</a>";
        }
     };
     xmlHttp.open("GET", url, true);
     xmlHttp.send(null);
}


function GetXmlHttpObject(){
var objXMLHttp=null;

     if (window.XMLHttpRequest){
          objXMLHttp=new XMLHttpRequest();
     }else if (window.ActiveXObject){
          objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
     }
     return objXMLHttp;
}
function getAjaxProgressImage(){
	return "<img src='/images/roller.gif' />";
}
function createAJAXPrice(strSKU, strCtl){
	if (strCtl!="") {
		document.write('<div id="'+ strCtl +'_price">'+ getAjaxProgressImage() +'</div>');
		displayProductPrice(strSKU,'price',strCtl+'_price')
	}else{
		document.write('<div id="'+ strSKU +'_price">'+ getAjaxProgressImage() +'</div>');
		displayProductPrice(strSKU,'price',strSKU+'_price')
	}
}
function createAJAXLink(strSKU, strCtl){
	buttonLink="<img src='/images/buy_now.jpg' border=0 alt=\"Add to Cart\" title=\"Add to Cart\">";
	cartUrl="/cart.aspx?qty=1";
	if (strCtl!="") {
		document.write('<div id="'+ strCtl +'_link" >'+ getAjaxProgressImage() +'</div>');
		displayProductButton(strSKU,'link',buttonLink,cartUrl,strCtl+'_link')
	}else{
		document.write('<div id="'+ strSKU +'_link">'+ getAjaxProgressImage() +'</div>');
		displayProductButton(strSKU,'link',buttonLink,cartUrl,strSKU+'_link')
	}
}
function isSoldOut(strSKU){
	var bReturn=false;
	
	if (strSKU=="DW02WJ_5mm 45cm") return true;
	if (strSKU=="DW05P_6mm 42cm 7P") return true;
	if (strSKU=="CH03WPP_5-6mm 48cm 61P") return true;
	if (strSKU=="GM02C3_8mm 45cm") return true;
	if (strSKU=="DW72WU_4mm 18cm") return true;
	if (strSKU=="DW06Pu_7mm 43cm") return true;
	if (strSKU=="DW72WJ_4mm 18cm") return true;
	if (strSKU=="DW02WJ_DW72WJ") return true;
}
function createAJAXPriceAndLink(strSKU, strCtl){
	createAJAXPrice(strSKU,strCtl);
	document.write("<p></p>");
	if (!isSoldOut(strSKU))
		createAJAXLink(strSKU,strCtl);
	else
		displaySoldOut();
}
function displaySoldOut(){
	document.write("<img src='/images/soldout.gif' border=0>");
}
function validateNewsletterForm(){
	if (Subscriber.n.value==""){
		alert('Please enter your name.');
		return false;
	}
	if (Subscriber.e.value==""){
		alert('Please enter email address.');
		return false;
	}
	document.form.action="/milist.aspx";
	Subscriber.submit();
	return true;
}
function openZoomWindow2(url,sizeinfo)   {
	window.open(url,   'zoom',   sizeinfo);
}
function openZoomWindow(url,target)   {
	window.open(url, target);
}

function loadMailingListBox(){
document.write('<form action="/milist.aspx" method="post" id="Subscriber" accept-charset="UTF-8">')
document.write('<table class=milist><tr ><td>&nbsp;<label for="GRCategory2">Name</label>&nbsp;</td><td><input type="text" name="n" size="12" id="n" /></td></tr><tr><td nowrap=true>&nbsp;<label for="GRCategory3">E-Mail</label>&nbsp;</td><td><input type="text" name="e" size="12" id="e" /></td></tr></table>')
document.write('<center><input type="button" value="Sign Up Now!" onclick="return validateNewsletterForm();"/></center>')
document.write('<input type="hidden" name="c" value="" />')
document.write('<input type="hidden" name="m" value="s" />')
document.write('</form>')
}
