// JavaScript Document
var preloadImages = new Array("images/menu_craft_on.jpg", "images/menu_specialty_on.jpg", "images/menu_import_on.jpg");

if(document.images){
	var loadingImages = new Array(preloadImages.length);
	for(var i = 0; i < preloadImages.length; ++i){
		loadingImages[i] = new Image();
		loadingImages[i].src = preloadImages[i];
	}
}

function highlightBtn(theObj){
var stringArray = new Array();
var theObjSrc_on;
var theObj_type;
var URL_txt = "";

theObjSrc = theObj.src;
stringArray = theObjSrc.split(".");
	
	for(var i=0; i<stringArray.length - 1; ++i){
		URL_txt = (URL_txt=="")? URL_txt + stringArray[i] : URL_txt +"."+ stringArray[i];
	}

	theObjSrc_on = (URL_txt)? URL_txt+"_on" : "none";
	theObj_type = (theObjSrc_on)? stringArray[stringArray.length - 1] : "none";
	if(theObjSrc_on != "none" && theObj_type != "none"){
		theObj.src = theObjSrc_on +"."+ theObj_type;
		theObj.onmouseout = unhighlightBtn;
	}
}

function unhighlightBtn(){
	this.src = theObjSrc;
	theObjSrc = null;
}

function wipe(){window.status= "";}

function changeClass(objToChange, changeTo){
	objToChange.className = changeTo;
}

function openPopUp(theURL,winName) {
  var features = "width=551,height=418,toolbar=no,status=yes,scrollbars=yes,menubar=no,resizable=no";
  window.open(theURL,winName,features);
}

function highlightIntro(tableObj){
	if(tableObj){
		introContentObj = tableObj.getElementsByTagName("TD").item(1);
		introType = introContentObj.className;
		imgTopSrc = "IMG/intro_"+introType+"_top_on.gif";
		imgBottomSrc = "IMG/intro_"+introType+"_bottom_on.gif";

		introContentObj.className = introContentObj.getAttribute("classOn");
		
		tableObj.getElementsByTagName("IMG").item(0).src = imgTopSrc;
		tableObj.getElementsByTagName("IMG").item(2).src = imgBottomSrc;
		
		tableObj.onmouseout = unhighlightIntro;
		tableObj.onclick = openIntro;
	}
}

function unhighlightIntro(){
	imgTopSrc = "IMG/intro_"+introType+"_top.gif";
	imgBottomSrc = "IMG/intro_"+introType+"_bottom.gif";

	introContentObj.className = introContentObj.getAttribute("classOff");
	
	this.getElementsByTagName("IMG").item(0).src = imgTopSrc;
	this.getElementsByTagName("IMG").item(2).src = imgBottomSrc;
	
}

function openIntro(){
	 window.location = "about_"+introType+".html";
}

