/* This is the JavaScript source for Justin Albers site v3.0*/
/*Cache Images
This caches the roll-over button images for the site.The 'Image' 
object parameters are (h,w) of the given image.
/*----------------------------------------------------------------------------*/
if (document.images){
//sets two objects for normal and highlighted image cache//
	var imagesNormal = new Object();
	imagesNormal["home"] = new Image(113,395);
	imagesNormal["home"].src = "images/mec_btn_home_static.gif";
	imagesNormal["legend"] = new Image(113,395);
	imagesNormal["legend"].src = "images/mec_btn_legend_static.gif";
	imagesNormal["media"] = new Image(113,395);
	imagesNormal["media"].src = "images/mec_btn_media_static.gif";	
	imagesNormal["merch"] = new Image(36,111);
	imagesNormal["merch"].src = "images/mec_btn_merch_static.gif";
	imagesNormal["music"] = new Image(36,111);
	imagesNormal["music"].src = "images/mec_btn_music_static.gif";
	imagesNormal["photos"] = new Image(36,111);
	imagesNormal["photos"].src = "images/mec_btn_photos_static.gif";
	imagesNormal["press"] = new Image(36,111);
	imagesNormal["press"].src = "images/mec_btn_press_static.gif";
	imagesNormal["email"] = new Image(150,34);
	imagesNormal["email"].src = "images/mec_btn_homeBlank.gif";
	imagesNormal["address"] = new Image(150,34);
	imagesNormal["address"].src = "images/mec_btn_homeBlank.gif";
	imagesNormal["hours"] = new Image(150,34);
	imagesNormal["hours"].src = "images/mec_btn_homeBlank.gif";
	
	var imagesHilite = new Object();
	imagesHilite["home"] = new Image(113,395);
	imagesHilite["home"].src = "images/mec_btn_home.gif";
	imagesHilite["legend"] = new Image(113,395);
	imagesHilite["legend"].src = "images/mec_btn_legend.gif";
	imagesHilite["media"] = new Image(113,395);
	imagesHilite["media"].src = "images/mec_btn_media.gif";	
	imagesHilite["merch"] = new Image(36,111);
	imagesHilite["merch"].src = "images/mec_btn_merch.gif";
	imagesHilite["music"] = new Image(36,111);
	imagesHilite["music"].src = "images/mec_btn_music.gif";
	imagesHilite["photos"] = new Image(36,111);
	imagesHilite["photos"].src = "images/mec_btn_photos.gif";
	imagesHilite["press"] = new Image(36,111);
	imagesHilite["press"].src = "images/mec_btn_press.gif";
	imagesHilite["email"] = new Image(150,34);
	imagesHilite["email"].src = "images/mec_btn_email.png";
	imagesHilite["address"] = new Image(150,34);
	imagesHilite["address"].src = "images/mec_btn_address.png";
	imagesHilite["hours"] = new Image(150,34);
	imagesHilite["hours"].src = "images/mec_btn_hours.png";
}

/* Roll-over Function 
This function sets the image from the Image objects (normal and
hilite)created in the Cache Function based on the type being normal
or highlighted. 
Looks like this in the html:
<img class="thumbnail" name="imageName" src="images/imageName.png"
					onmouseover="return setImage(this.name,'hilite')";
					onmouseout="return setImage(this.name,'normal')";>
/*----------------------------------------------------------------------------*/
function setImage (imgName, type){
	if (document.images){
		if (type == "hilite"){
			document.images[imgName].src = imagesHilite[imgName].src;
			return true;
		}else if (type == "normal"){
			document.images[imgName].src = imagesNormal[imgName].src;
			return true;
		}
	}
	return false;
}

/*pageLink: refreshes current window with the new listed page
	in html it looks like this: 
<tag onMouseOver="this.style.cursor='pointer';" onClick="pageLink('page.html');"> Whatever to click </tag>
/*----------------------------------------------------------------------------*/
function pageLink (URL){
		if (document.images){
			window.location = URL;
		}
		return false;
}
/* Cache Images*/
/*----------------------------------------------------------------------------*/
bg_home= new Image(800,600); 
bg_home.src="images/mec_bg_home.gif"; 

bg_legend= new Image(800,600); 
bg_legend.src="images/mec_bg_legend.gif"; 

bg_media= new Image(800,600); 
bg_media.src="images/mec_bg_media.gif"; 

bg_merch= new Image(800,600); 
bg_merch.src="images/mec_bg_merch.gif"; 

bg_music= new Image(800,600); 
bg_music.src="images/mec_bg_music.gif"; 

bg_photos= new Image(800,600); 
bg_photos.src="images/mec_bg_photos.gif"; 

bg_press= new Image(800,600); 
bg_press.src="images/mec_bg_press.gif"; 

merch_skull= new Image(295,172); 
merch_skull.src="images/mec_merchSkull.gif"; 

copyright= new Image(800,20); 
copyright.src="images/copyrightbar.gif"; 

mySpaceBadge= new Image(122,228); 
mySpaceBadge.src="images/MySpaceBadge.gif"; 

NavBar= new Image(800,600); 
NavBar.src="images/mec_menuBar.gif"; 
