// JavaScript Document

// Load required classes
AppGlobal.loadClass("Ajax");

var BlainCat;
if (!BlainCat) BlainCat = {};

// Declare properties
BlainCat.timer = null;
BlainCat.cartPopup = null;
BlainCat.storeAjaxURL = "/ajax/stores.aspx";
BlainCat.ajaxURL = "/ajax/catalog.aspx";
BlainCat.productDetailURL = "/catalog/product.aspx";

BlainCat.borderOn = function(obj) {
	if (document.getElementById(obj)) document.getElementById(obj).style.border = '1px solid #CC0000';
}

BlainCat.borderOff = function(obj) {
	if (document.getElementById(obj)) document.getElementById(obj).style.border = '1px solid #CCCCCC';
}

// Clears the field on focus if it is filled with the default "Search by Keyword" value
BlainCat.clearEmptyFindForm = function(textfield) {
	if (textfield.value == "Find a Product") textfield.value = '';
}

// Changes the sort order of the find product page
BlainCat.changeFindProductSortResultsPerPage = function(field) {
	location.href = field.value;
}

// Changes the ecom only flag of the find product page
BlainCat.changeFindProductEcomStatus = function(field) {
	// Remove the ecom flag from the url
	var qs = (location.search.charAt(0) == '?') ? location.search.substring(1) : location.search;
	var tmp = new Array();
	var pair = qs.split("&");
	for (var i = 0; i < pair.length; i++) {
		if (pair[i].indexOf("eco=") == -1) tmp.push(pair[i]);
	}
	if (field.checked) tmp.push("eco=1");
	var newqs = "";
	if (tmp.length > 0) newqs = "?" + tmp.join("&");
	location.href = location.pathname + newqs;
}

// Switches to another child product
BlainCat.changeChild = function() {
	var c = document.getElementById("c");
	if (c) {
		// Hide existing child information
		var pnPrice = document.getElementById("pnPrice");
		var pnAvailability = document.getElementById("pnAvailability");
		var frmProduct = document.getElementById("frmProduct");
		var imgProgress = document.getElementById("imgChildProgress");
		if (pnPrice && imgProgress) {
			pnPrice.style.visibility = 'hidden';
			if (pnAvailability) pnAvailability.style.visibility = 'hidden';
			if (frmProduct) frmProduct.style.visibility = 'hidden';
			imgProgress.style.visibility = 'visible';
		}
		// Parse URL string and separate the query string into individual parts;
		var base = location.pathname;
		var qs = location.search.substring(1, location.search.length);
		qs = qs.replace(/\+/g, ' ');
		var args = qs.split('&');
		// Formulate new URL string
		var url = location.pathname + '?i=' + c.value;
		for (var i = 0; i < args.length; i++) {
			// Split name/value pair to get the variable name
			var pair = args[i].split('=');
			var name = unescape(pair[0]);
			if (name != 'i') url = url + '&' + args[i];
		}
		window.onunload = BlainCat.resetDisplay;
		location.href = url;
	}
}

// Switches the child product display back to the default condition
BlainCat.resetDisplay = function() {
	var pnPrice = document.getElementById("pnPrice");
	var pnAvailability = document.getElementById("pnAvailability");
	var imgProgress = document.getElementById("imgChildProgress");
	var frmProduct = document.getElementById("frmProduct");
	if (pnPrice && imgProgress) {
		pnPrice.style.visibility = 'visible';
		if (pnAvailability) pnAvailability.style.visibility = 'visible';
		if (frmProduct) frmProduct.style.visibility = 'visible';
		imgProgress.style.visibility = 'hidden';
	}
}

// Opens a window with a full-size image view
BlainCat.viewFullImage = function(id) {
	var popup = document.getElementById("image-popupobj");
	var img = document.getElementById(id);
	var div = document.getElementById("FullImage");
	if (popup && img && div) {
		AppGlobal.overlay = new Overlay("image-popupobj");
		var lgimg = document.createElement("img");
		lgimg.width = 450;
		lgimg.height = 450;
		lgimg.src = img.src.replace("/detail/", "/full/");
		if (lgimg.complete) div.appendChild(lgimg);
		lgimg.onload = function() { div.appendChild(this); }
		if (document.frmItemSelect) {
			if (document.frmItemSelect.c) document.frmItemSelect.c.style.visibility = 'hidden';
		}
		// Track event in Google Analytics
		try { pageTracker._trackEvent('Product Details', 'View Full Image'); } catch(err) {}
	}
	return false;
}

// Closes the store selector popup
BlainCat.closeFullImage = function() {
	AppGlobal.overlay.remove();
	AppGlobal.overlay = null;
	var div = document.getElementById("FullImage");
	while (div.firstChild) div.removeChild(div.firstChild);
	if (document.frmItemSelect) {
		if (document.frmItemSelect.c) document.frmItemSelect.c.style.visibility = 'visible';
	}
}

// Opens the store selector popup
BlainCat.openStoreSelector = function() {
	var popup = document.getElementById("store-popupobj");
	if (popup) {
		if (AppGlobal.overlay == null) AppGlobal.overlay = new Overlay("store-popupobj");
		var selector = document.getElementById("store-select");
		var set = document.getElementById("store-set");
		var notfound = document.getElementById("store-notfound");
		selector.style.display = '';
		set.style.display = 'none';
		notfound.style.display = 'none';
		if (document.frmItemSelect) {
			if (document.frmItemSelect.c) document.frmItemSelect.c.style.visibility = 'hidden';
		}
		// Track event in Google Analytics
		try { pageTracker._trackEvent('Product Details', 'Open Store Selector'); } catch(err) {}
	}
	return false;
}

// Closes the store selector popup
BlainCat.closeStoreSelector = function() {
	AppGlobal.overlay.remove();
	AppGlobal.overlay = null;
	if (document.frmItemSelect) {
		if (document.frmItemSelect.c) document.frmItemSelect.c.style.visibility = 'visible';
	}
}

// Changes the local store to the selected store
BlainCat.changeStore = function() {
	var ddlStoreNum = document.getElementById("ddlStoreNum");
	var lblBlainNum = document.getElementById("lblBlainNum");
	var imgProgress = document.getElementById("imgStoreProgress");
	if (ddlStoreNum && lblBlainNum) {
		var StoreNum = ddlStoreNum.value;
		var BlainNumber = lblBlainNum.innerHTML;
		if (StoreNum.length > 0 && BlainNumber.length > 0) {
			var selector = document.getElementById("store-select");
			var set = document.getElementById("store-set");
			var notfound = document.getElementById("store-notfound");
			if (BlainCat.timer != null) {
				clearTimeout(BlainCat.timer);
				BlainCat.timer = null;
			}
			// Call ajax script synchronously
			if (imgProgress) imgProgress.style.visibility = '';
			var request = Ajax.newRequest();
			request.open("POST", BlainCat.storeAjaxURL, false);
			request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			request.send("a=s&n=" + encodeURIComponent(StoreNum) + "&i=" + encodeURIComponent(BlainNumber));
			if (request.status == 200) {
    	        var xmlDoc = request.responseXML;
				var vLocationName = AppGlobal.getXMLValue(xmlDoc.getElementsByTagName("LocationName")[0]);
				var vPhone = AppGlobal.getXMLValue(xmlDoc.getElementsByTagName("Phone")[0]);
				var vLocatorURL = AppGlobal.getXMLValue(xmlDoc.getElementsByTagName("LocatorURL")[0]);
				var vStatus = AppGlobal.getXMLValue(xmlDoc.getElementsByTagName("Status")[0]);
				var vDomain = AppGlobal.getXMLValue(xmlDoc.getElementsByTagName("Domain")[0]);
				// Replace stock status information
				var lblLocationName = document.getElementById("lblLocationName");
				var lblStoreName = document.getElementById("lblStoreName");
				var lblLocationPhone = document.getElementById("lblLocationPhone");
				var hlLocationURL = document.getElementById("hlLocationURL");
				var lblStatusStore = document.getElementById("lblStatusStore");
				var pnAvailStore = document.getElementById("pnAvailStore");
				var pnStoreSelect = document.getElementById("pnStoreSelect");
				if (lblLocationName) AppGlobal.setText(lblLocationName, vLocationName);
				if (lblStoreName) AppGlobal.setText(lblStoreName, vLocationName);
				if (lblLocationPhone) AppGlobal.setText(lblLocationPhone, vPhone);
				if (hlLocationURL) hlLocationURL.href = "/stores/" + vLocatorURL;
				if (lblStatusStore) AppGlobal.setText(lblStatusStore, vStatus);
				if (pnAvailStore) pnAvailStore.style.display = '';
				if (pnStoreSelect) pnStoreSelect.style.display = 'none';
				pnAvailStore.className = (vStatus == "Available" || vStatus == "Limited Availability") ? "avail-yes" : "avail-no";
				// Set new store cookie for 60 days (first number in the equation)
				var vExpireDate = new Date(new Date().getTime() + (60 * 1000 * 60 * 60 * 24) );
				Cookie.set("Local", StoreNum, vExpireDate, "/", vDomain);
				// Set panel display
				selector.style.display = 'none';
				set.style.display = '';
				notfound.style.display = 'none';
				// Track event in Google Analytics
				try { pageTracker._trackEvent('Product Details', 'Set Local Store', vLocationName); } catch(err) {}
			} else {
				// Display failed message
				selector.style.display = 'none';
				set.style.display = 'none';
				notfound.style.display = '';
		    }
			if (imgProgress) imgProgress.style.visibility = 'hidden';
		} else throw new Error("Variables missing in AJAX request.");
	}
}


// Opens a popup window to send product to a friend
BlainCat.sendToFriend = function(id) {
	popup = window.open('product_email.aspx?i=' + encodeURIComponent(id), 'SetStore','width=530,height=570,resizable=yes,scrollbars=yes');
	if (window.focus) popup.focus();
}

// Returns the main browser window to the newsletter signup
BlainCat.goToNewsletterSignup = function() {
	window.opener.location.href = '/promotions/newsletter.aspx';
	window.close();
}

// Changes the tab display
BlainCat.displayTab = function(val) {
	BlainCat.toggleTab(false, "Promo");
	BlainCat.toggleTab(false, "Features");
	BlainCat.toggleTab(false, "Swatches");
	BlainCat.toggleTab(false, "Technical");
	BlainCat.toggleTab(false, "Reviews");
	BlainCat.toggleTab(false, "Warranty");
	BlainCat.toggleTab(false, "Diagrams");
	BlainCat.toggleTab(false, "Projects");
	if (val == 'P') BlainCat.toggleTab(true, "Promo");
	else if (val == 'F') BlainCat.toggleTab(true, "Features");
	else if (val == "S") BlainCat.toggleTab(true, "Swatches");
	else if (val == "T") BlainCat.toggleTab(true, "Technical");
	else if (val == "V") BlainCat.toggleTab(true, "Reviews");
	else if (val == "W") BlainCat.toggleTab(true, "Warranty");
	else if (val == "D") BlainCat.toggleTab(true, "Diagrams");
	else if (val == "R") BlainCat.toggleTab(true, "Projects");
}

BlainCat.toggleTab = function(val, id) {
	var pn = document.getElementById('pn' + id);
	var hl = document.getElementById('hl' + id);
	var img = document.getElementById('img' + id);
	if (pn) pn.className = (val) ? "product-tabshow" : "product-tabhide";
	if (hl && img) img.src = (val) ? img.src.replace("_off.gif", "_on.gif") : img.src.replace("_on.gif", "_off.gif");
	// Track event in Google Analytics
	try { pageTracker._trackEvent('Product Details', 'Change Tab', id); } catch(err) {}
}

// Toggles the display/non-display of the filter list
BlainCat.toggleFilterList = function(link_elem, divname) {
	var div = document.getElementById(divname);
	if (div) {
		if (div.style.display == "none") {
			div.style.display = ""
			link_elem.className = "open";
		} else {
			div.style.display = "none"
			link_elem.className = "closed";
		}
	}
}

// Assigns border toggles to links in a page
BlainCat.assignBorderToggles = function() {
	var links = document.getElementsByTagName("a");
	for (var x = 0; x < links.length; x++) {
		var id = links[x].getAttribute("bordertoggle");
		if (id != null) BlainCat.addBorderToggle(links[x], id);
	}
}
BlainCat.addBorderToggle = function(obj, id) {
	obj.onmouseover = function() { BlainCat.borderOn(id); }
	obj.onmouseout = function() { BlainCat.borderOff(id); }
}

// Adds an item to the cart
BlainCat.addToCart = function(blain, parent) {
	if (parent.length > 0) BlainCat.openChildSelector(blain);
	else {
		self.location = BlainCat.productDetailURL + '?a=A&i=' + encodeURIComponent(blain);
		if (BlainCat.cartPopup != null) BlainCat.closeChildSelector();
	}
	return false;
}

// Goes to a product detail page
BlainCat.viewDetail = function(blain) {
	location.href = BlainCat.productDetailURL + '?i=' + encodeURIComponent(blain);
	BlainCat.closeChildSelector();
}

// Opens a popup window to select a child item
BlainCat.openChildSelector = function(blain) {
	var mainload = document.getElementById("cartselect-mainload");
	var error = document.getElementById("cartselect-error");
	var content = document.getElementById("cartselect-content");
	var image = document.getElementById("cartselect-image");
	if (mainload) mainload.style.display = '';
	if (error) error.style.display = 'none';
	if (content) content.style.display = 'none';
	if (image) image.style.visibility = 'hidden';
	BlainCat.cartPopup = new Overlay("cartselect-popupobj");
	BlainCat.getChildList(blain);
}

// Changes the information regarding the current product
BlainCat.changeProductInfo = function(blain) {
	var subload = document.getElementById("cartselect-subload");
	var childinfo = document.getElementById("cartselect-child");
	var image = document.getElementById("cartselect-image");
	if (subload) subload.style.display = '';
	if (childinfo) childinfo.style.display = 'none';
	if (image) image.style.visibility = 'hidden';
	BlainCat.getProductInfo(blain);
}

// Gets information regarding the current product
BlainCat.getProductInfo = function(blain) {
	var request = Ajax.newRequest();
	request.open("POST", BlainCat.ajaxURL, true);
	var params = "a=pd&i=" + encodeURIComponent(blain);
	request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	request.onreadystatechange = function() {
		if (request.readyState == 4) {
			var mainload = document.getElementById("cartselect-mainload");
			var subload = document.getElementById("cartselect-subload");
			var error = document.getElementById("cartselect-error");
			var content = document.getElementById("cartselect-content");
			var childinfo = document.getElementById("cartselect-child");
			if (request.status == 200) {
    	        var xmlDoc = request.responseXML;
				var imgProduct = document.getElementById("cartselect-image");
				var imgCartButton = document.getElementById("cartselect-cartbutton");
				var vVendorBrand = AppGlobal.getXMLValue(xmlDoc.getElementsByTagName("VendorBrand")[0]);
				var vProductName = AppGlobal.getXMLValue(xmlDoc.getElementsByTagName("ProductName")[0]);
				var vWebAttributeDescription = AppGlobal.getXMLValue(xmlDoc.getElementsByTagName("WebAttributeDescription")[0]);
				var vBlainNumber = AppGlobal.getXMLValue(xmlDoc.getElementsByTagName("BlainNumber")[0]);
				var vMFGItemNumber = AppGlobal.getXMLValue(xmlDoc.getElementsByTagName("MFGItemNumber")[0]);
				var vImageURL = AppGlobal.getXMLValue(xmlDoc.getElementsByTagName("ImageDetailURL")[0]);
				var vCurrentPrice = AppGlobal.getXMLValue(xmlDoc.getElementsByTagName("CurrentPrice")[0]);
				var vRegularPrice = AppGlobal.getXMLValue(xmlDoc.getElementsByTagName("RegularPrice")[0]);
				var vPriceModifier = AppGlobal.getXMLValue(xmlDoc.getElementsByTagName("PriceModifier")[0]);
				var vPromoPrice = AppGlobal.getXMLValue(xmlDoc.getElementsByTagName("PromoPrice")[0]);
				var vPromoExpiration = AppGlobal.getXMLValue(xmlDoc.getElementsByTagName("PromoExpiration")[0]).toDate();
				var vDisplayMode = AppGlobal.getXMLValue(xmlDoc.getElementsByTagName("DisplayMode")[0]);
				var hVendorBrand = document.getElementById("hVendorBrand");
				var hProductName = document.getElementById("hProductName");
				var hWebAttributeDescription = document.getElementById("hWebAttributeDescription");
				var lblBlainNumber = document.getElementById("lblBlainNumber");
				var lblMfrNum = document.getElementById("lblMfrNum");
				var lblPrice = document.getElementById("lblPrice");
				var lblPriceSuffix = document.getElementById("lblPriceSuffix");
				var lblPriceComment = document.getElementById("lblPriceComment");
				var lblPromoPrice = document.getElementById("lblPromoPrice");
				// Insert product text
				AppGlobal.setText(hVendorBrand, vVendorBrand);
				AppGlobal.setText(hProductName, vProductName);
				AppGlobal.setText(hWebAttributeDescription, "Select " + vWebAttributeDescription + ":");
				AppGlobal.setText(lblMfrNum, vMFGItemNumber);
				AppGlobal.setText(lblBlainNumber, vBlainNumber);
				
				// PRICING INFORMATION
				// Handle special exchange pricing
				if (vDisplayMode.endsWith("d")) {
					vCurrentPrice -= 7;
					vRegularPrice -= 7;
					vPromoPrice -= 7;
				} else if (vDisplayMode.endsWith("e")) {
					vCurrentPrice -= 5;
					vRegularPrice -= 5;
					vPromoPrice -= 5;
				}
				// Pricing information
				if (vCurrentPrice == (vPromoPrice - vPriceModifier) && vCurrentPrice >= (vRegularPrice - vPriceModifier)) {
					lblPrice.innerHTML = "Price: <b>" + (vPromoPrice - vPriceModifier).toString().toCurrency() + "</b><br />\r\n";
					lblPriceSuffix.style.display = '';
					if (vPriceModifier > 0) lblPriceSuffix.innerHTML = "Find Value, after $" + vPriceModifier.toString().toCurrency() + " exchange";
					else lblPriceSuffix.innerHTML = "Find Value";
				} else if (vCurrentPrice == (vPromoPrice - vPriceModifier)) {
					lblPrice.innerHTML = "Price: <b>$" + (vRegularPrice - vPriceModifier).toString().toCurrency() + "</b><br />\r\n";
					lblPrice.className = "strikethru";
					lblPromoPrice.style.display = '';
					lblPromoPrice.innerHTML = "Sale Price: <b>$" + vCurrentPrice.toString().toCurrency() + "</b><br />\r\n";
					lblPriceSuffix.style.display = '';
					if (vPriceModifier > 0) lblPriceSuffix.innerHTML = "After $" + vPriceModifier.toString().toCurrency() + " exchange, through " + vPromoExpiration;
					else lblPriceSuffix.innerHTML = "Through " + vPromoExpiration;
				} else {
					lblPrice.innerHTML = "Price: <b>$" + vCurrentPrice.toString().toCurrency() + "</b><br />\r\n";
					lblPromoPrice.style.display = 'none';
					if (vPriceModifier > 0) {
						lblPriceSuffix.style.display = '';
						lblPriceSuffix.innerHTML = "After $" + vPriceModifier.toString().toCurrency() + " exchange";
					} else lblPriceSuffix.style.display = 'none';
				}
				// Determine if this is an exchange price
				if (vDisplayMode.endsWith("d")) {
					lblPriceComment.style.display = '';
					lblPriceComment.innerHTML = "After $7.00 exchange<br />\r\n";
				} else if (vDisplayMode.endsWith("e")) {
					lblPriceComment.style.display = '';
					lblPriceComment.innerHTML = "After $5.00 exchange<br />\r\n";
				} else if (vDisplayMode.endsWith("f")) {
					lblPriceComment.style.display = '';
					lblPriceComment.innerHTML = "per ft.<br />\r\n";
				} else lblPriceComment.style.display = 'none';
				
				// Insert image
				imgProduct.src = vImageURL;
				imgProduct.onload = function() { }
				if (imgProduct.complete) imgProduct.style.visibility = '';
				else imgProduct.onload = function() { imgProduct.style.visibility = ''; }
				// Assign cart button target
				imgCartButton.onclick = function() { BlainCat.addToCart(blain, ""); };
				// Display product information
				if (mainload) mainload.style.display = 'none';
				if (subload) subload.style.display = 'none';
				if (error) error.style.display = 'none';
				if (content) content.style.display = '';
				if (childinfo) childinfo.style.display = '';
			} else {
				// Get failed status error message
				var message = "";
				message = request.statusText;
				if (message.length == 0) message = "Unspecified error " + request.status;
				// Display error message
				if (message != "No Data Available" || message != "OK") {
					var errormsg = document.getElementById("cartselect-errormsg");
					AppGlobal.setText(errormsg, "We're sorry for the confusion, but an it seems that an error may have occurred on this end.  Please click on the button below to view details about this product.");
				}
				// Display error information
				if (mainload) mainload.style.display = 'none';
				if (subload) subload.style.display = 'none';
				if (error) error.style.display = '';
				if (content) content.style.display = 'none';
				if (childinfo) childinfo.style.display = 'none';
				var imgDetailButton = document.getElementById("cartselect-detailbutton");
				imgDetailButton.onclick = function() { BlainCat.viewDetail(blain, ""); };
			}
		}
	}
	request.send(params);
}

// Gets the list of child products
BlainCat.getChildList = function(blain) {
	var request = Ajax.newRequest();
	request.open("POST", BlainCat.ajaxURL, true);
	var params = "a=pcl&ecom=1&i=" + encodeURIComponent(blain);
	request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	request.onreadystatechange = function() {
		if (request.readyState == 4) {
			var mainload = document.getElementById("cartselect-mainload");
			var subload = document.getElementById("cartselect-subload");
			var error = document.getElementById("cartselect-error");
			var content = document.getElementById("cartselect-content");
			var childinfo = document.getElementById("cartselect-child");
			if (request.status == 200) {
    	        var xmlDoc = request.responseXML;
				var vProducts = xmlDoc.getElementsByTagName("Product");
				var ddlBlainNumber = document.getElementById("ch");
				// Add child products to the drop-down list
				var vBlainNumber, vWebAttributeValue;
				ddlBlainNumber.options.length = 0;
				for (var x = 0; x < vProducts.length; x++) {
					vBlainNumber = AppGlobal.getXMLValue(vProducts[x].getElementsByTagName("BlainNumber")[0]);
					vWebAttributeValue = AppGlobal.getXMLValue(vProducts[x].getElementsByTagName("WebAttributeValue")[0]);
					ddlBlainNumber.options.add(new Option(vWebAttributeValue, vBlainNumber));
				}
				// Select the current blain number in the list
				for (var x = 0; x < ddlBlainNumber.options.length; x++) if (ddlBlainNumber.options[x].value == blain) { ddlBlainNumber.selectedIndex = x; break; }
				// Now get the product info
				BlainCat.getProductInfo(blain);
			} else {
				// Get failed status error message
				var message = "";
				message = request.statusText;
				if (message.length == 0) message = "Unspecified error " + request.status;
				if (message.length == 0) message = "Unspecified error " + request.status;
				// Display error message
				if (message != "No Data Available" || message != "OK") {
					var errormsg = document.getElementById("cartselect-errormsg");
					AppGlobal.setText(errormsg, "We're sorry for the confusion, but an it seems that an error may have occurred on this end.  Please click on the button below to view details about this product.");
				}
				// Display error information
				if (mainload) mainload.style.display = 'none';
				if (subload) subload.style.display = 'none';
				if (error) error.style.display = '';
				if (content) content.style.display = 'none';
				if (childinfo) childinfo.style.display = 'none';
				var imgDetailButton = document.getElementById("cartselect-detailbutton");
				imgDetailButton.onclick = function() { BlainCat.viewDetail(blain, ""); };
			}
		}
	}
	request.send(params);
}

// Closes the popup window
BlainCat.closeChildSelector = function() {
	BlainCat.cartPopup.remove();
	BlainCat.cartPopup = null;
}

// OnLoad directive for this class
BlainCat.onLoad = function() {
	BlainCat.assignBorderToggles();
	(new Image()).src = '/images/interface/cart_selector_bkg.png';
	(new Image()).src = '/images/interface/storeselect_bkg.png';
	(new Image()).src = '/images/interface/image_bkg.png';
	(new Image()).src = '/images/headers/features_off.gif';
	(new Image()).src = '/images/headers/features_on.gif';
	(new Image()).src = '/images/headers/colors_styles_on.gif';
	(new Image()).src = '/images/headers/product_diagrams_on.gif';
	(new Image()).src = '/images/headers/promo_on.gif';
	(new Image()).src = '/images/headers/related_projects_on.gif';
	(new Image()).src = '/images/headers/technical_description_on.gif';
	(new Image()).src = '/images/headers/warranty_on.gif';
	(new Image()).src = '/images/headers/reviews_on.gif';
}

if (window.addEventListener) window.addEventListener("load", BlainCat.onLoad, false);
else if (window.attachEvent) window.attachEvent("onload", BlainCat.onLoad);
