function closeIntro() {
    $('flashIntro').remove();
}

function rollover(object,preload){
	if (object.src)
	{
		image = object.src;
		imageDot = image.lastIndexOf('.');
		if (imageDot > -1)
		{
			imageName = image.substr(0,imageDot);
			imageExt = image.substr(imageDot+1);
			if (preload) object = new Image();
			if (imageName.substr(imageName.length-5)=='-over')
				imageName = imageName.substr(0, imageName.length-5);
			else
				imageName += '-over';
			object.src = imageName + '.' + imageExt;
		}
	}
}

function calculateCost(){
	if (!document.getElementById) return null;
	var unitprice = document.getElementById("productUnitPrice").value;
	var quantitysel = document.getElementById("productQuantity");
	var quantity = quantitysel[quantitysel.selectedIndex].value;
	var display = document.getElementById("productPrice");
	var price = (quantity * unitprice).toFixed(2)
	display.innerHTML = '$'+price;
}

function fixLinks(){	if (!document.getElementsByTagName) return null;	var anchors = document.getElementsByTagName("a");	for(var i=0; i < anchors.length; i++){		var a = anchors[i];		var href = a.href;		if (href.indexOf("mailto:") != -1){			var href = unescape(href);			var href = href.replace(" at ","@");			while (href.indexOf(" dot ") != -1)	{			var href = href.replace(" dot ",".");			}			a.setAttribute("href",href);			a.innerHTML = href.substring(7);		}	}
}

function fixListStyle() {
	if (!document.getElementById("navigation")) return null;
	document.getElementById("navigation").firstChild.firstChild.style.borderWidth = 0;
}

if (window.attachEvent){ // for IE	window.attachEvent("onload", fixLinks);	window.attachEvent("onload", fixListStyle);}
if (document.addEventListener){ // for Opera	document.addEventListener("load",fixLinks,false);}if (window.addEventListener){// for Mozilla and Safari	window.addEventListener("load",fixLinks,false);}function goTo(page){
var url = (location.href.lastIndexOf("/")+1)? location.href.slice(0,location.href.lastIndexOf("/")+1) : location.href;
location.href = url+page
}

var onloads = new Array();
function bodyOnLoad() {
    onloads.each(function (load) { load(); });
}

// Imagescale Helper Class
var ImageScale = Class.create();
ImageScale.prototype = {
    initialize: function (reference) {
        var breakdown = reference.split(".");
        var size = breakdown[breakdown.length-2].split("x");
        this.width = size[0];
        this.height = size[1];
        this.src = reference;
    },
    popup: function () {
	    var openWindow = window.open("", "", "resizable=no,menubar=no,scrollbars=no,status=no,titlebar=no,toolbar=no,height="+this.height+",width="+this.width+"", false);
	    openWindow.document.body.style.border = "0px";
	    openWindow.document.body.style.padding = "0px";
	    openWindow.document.body.style.margin = "0px";
	    openWindow.document.body.innerHTML = '<center><img src="' + ((this.src.indexOf("//")==-1)?document.location.protocol + "//" + document.location.host + "/":"") + this.src + '"/></center>';
    },
    apply: function(image, width, height) {
        image.style.display = "none";
        image.src = this.src;
        image.width = this.width;
        image.height = this.height;
        if (width)
        {
            var px = Math.round((width - this.width)/2);
            image.style.marginLeft = px + "px";
            image.style.marginRight = (width - this.width - px) + "px";
        }
        if (height)
        {
            var px = Math.round((height - this.height)/2);
            image.style.marginTop = px + "px";
            image.style.marginBottom = (height - this.height - px) + "px";
        }
        image.style.display = "inline";
    }
}
