// JavaScript Document

jQuery.preloadImages = function() {
	for(var i = 0; i<arguments.length; i++) {
		jQuery("<img>").attr("src", arguments[i]);
	}
}

//  menu
function setupButtons() {

	//  get all menu buttons and set behaviours
	var imgs = document.getElementsByTagName("img");
	var nImgs = imgs.length;
	var imgs
	
	//  check all divs
	for (var i = 0; i < nImgs; i++) {
	
		img = imgs[i];
		
		//  if they're menuButtons add rollOver behaviour
		if (img.className == "menuButton") {
			
			img.onmouseover = menuRollOver;
			img.onmouseout = menuRollOut;
			
		}
		
	}
	
	
			
			
	
	//  get all menu buttons and set behaviours
	var hrefs = document.getElementsByTagName("img");
	var nHrefs = hrefs.length;
	var href
	
	//  check all divs
	for (var i = 0; i < nHrefs; i++) {
	
		href = hrefs[i];
		
		//  if they're menuButtons add rollOver behaviour
		if (href.className == "galleryImage") {
			
			href.onmouseover = galleryRollOver;
			href.onmouseout = galleryRollOut;
			
		}
		
	}
	
}

function menuRollOver(){
	
	//  show rollover image
	var imgURL = "i/buttons/" + this.id + "_btn_on.jpg";
	this.src = imgURL;
	
	
	//$(this).fadeOut(2000);
	
}

function menuRollOut() {
	
	//  hide rollover image
	var imgURL = "i/buttons/" + this.id + "_btn.jpg";
	this.src = imgURL;
	
	
	//$(this).stop();
				   
}


//  gallery rollovers
function galleryRollOver(){
	/*
	//  show rollover image
	var imgURL = "i/buttons/" + this.id + "_btn_on.jpg";
	this.src = imgURL;
	*/
	
	//alert("hey : " + this);
	
	//$(this).stop().fadeTo(500, 0.75);
	//$(this).stop();
	//$(this).stop().animate({opacity:1}, 100, "linear");
	//$(this).fadeOut();
	
	//$(this).set('tween', {duration: 200});
	//Elastic.easeOut with user-defined value for elasticity.
	/*
	$(this).set('tween', {duration: 200});
	$(this).tween('margin-left', 5);
	*/
	this.fade(0.5);






	//alert(this);
	
}

function galleryRollOut() {
	/*
	//  hide rollover image
	var imgURL = "i/buttons/" + this.id + "_btn.jpg";
	this.src = imgURL;
	*/
	
	//$(this).stop();
	
	//$(this).stop().fadeTo(500, 1);
	//$(this).stop();
	/*
	$(this).set('tween', {duration: 500});
	$(this).tween('margin-left', 0);
	*/
	this.fade(1);
	   
}
/*
function galleryMouseUp() {

	var galleryIMG = document.getElementById('galleryImageFullSize');

	alert(galleryIMG);
	
	var imgURL = "i/gallery/" + this.id + ".gif";
	galleryIMG.src = imgURL;

}
*/

