/*-----------------------------------------------------------------------------
|                                                                             |
|  shared.js                                                                  |
|                                                                             |
|  Think Computer Corporation                                                 |
|  Web Site 9.0                                                               |
|  JavaScript Library                                                         |
|                                                                             |
|  Copyright © 2001-2006 Think Computer Corporation. All Rights Reserved.     |
|                                                                             |
-----------------------------------------------------------------------------*/

// Based on code from http://homepage.ntlworld.com/bobosola

function correctPNG() 
{
	for(var i = 0; i < document.images.length; i++) {
		var img = document.images[i]
		var imgName = img.src.toUpperCase()
		if (imgName.substring(imgName.length-3, imgName.length) == "PNG") {
			var imgID	= (img.id) ? "id='" + img.id + "' " : "";
			var imgClass	= (img.className) ? "CLASS='" + img.className + "' " : "";
			var imgTitle	= (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
			var imgStyle	= "display:inline-block;" + img.style.cssText;
			if (img.align == "left")
				imgStyle = "float:left;" + imgStyle;
			if (img.align == "right")
				imgStyle = "float:right;" + imgStyle;
			if (img.parentElement.href)
				imgStyle = "cursor:hand;" + imgStyle;
			var strNewHTML = "<SPAN " + imgID + imgClass + imgTitle + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>";
			img.outerHTML = strNewHTML;
			i = i - 1;
		}
	}
}

function preload(img)
{
	var a = new Image();
	a.src = img;
	return a;
}

function defaultState()
{
	if (hover) {
		for (i = 0; i < areas.length; i++) {
			eval("document['" + areas[i] + "'].src=" + areas[i] + "1.src;");
		}
	}
}

function rollover(image, value)
{
	if (hover)
		eval('document[\'' + image + '\'].src = ' + value + '.src;');
}

// Pop-Up Windows

function openWindow(path, name, width, height, format)
{
	window.open(path, name, "width=" + width + ",height=" + height + format);
}

// Buy

function copyBillTo(formName)
{
	fields = new Array("salutation", "firstname", "lastname", "title", "organization", "address1", "address2", "city", "stateprovince", "postalcode", "country");
	
	for (i = 0; i < fields.length; i++) {
		if (document.forms[formName].elements['copy'].checked) {
			document.forms[formName].elements['shipto' + fields[i]].value = document.forms[formName].elements['billto' + fields[i]].value;
		} else {
			document.forms[formName].elements['shipto' + fields[i]].value = '';
		}
	}
}

// Rollovers

netscape = navigator.appName == "Netscape";
netscape4 = netscape && parseInt(navigator.appVersion) <= 4;
ie = navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) >= 4;
opera = navigator.appName == "Opera";
hover = netscape || ie || opera;

if (ie)
	window.attachEvent('onload', correctPNG);