// JavaScript Document
$.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    $("<img>").attr("src", arguments[i]);
  }
}

$(document).ready(

	function(){
		
		//Adding hover-functionality to <li>-elements for IE6
		function ie6hover(elem){
			$(elem).hover(
				function() {
					$(this).addClass("ie6hover");
				},
				function() {
					$(this).removeClass("ie6hover");
				}
			);
		};
		ie6hover("#left ul li a div");
		//Thumbnails over links
		function hoverin() {
			$(this).css({'z-index' : '10'}); /*Add a higher z-index value so this image stays on top*/ 
			$(this).find('img').css({ 'display' : 'block' });
			$(this).find('#small').addClass("hover").stop() /* Add class of "hover", then stop animation queue buildup*/
				.animate({
					width: '300', /* Set new width */
					height: '224', /* Set new height */
					top: '150px',
					left: '40px'
				}, 200); /* this value of "200" is the speed of how fast/slow this hover animates */
			$(this).find('#big').addClass("hover").stop() /* Add class of "hover", then stop animation queue buildup*/
				.animate({
					width: '370', /* Set new width */
					height: '141', /* Set new height */
					top: '210px',
					left: '5px'
				}, 200); /* this value of "200" is the speed of how fast/slow this hover animates */
		
		};
		function hoverout() {
			$(this).find('img').removeClass("hover").stop()  /* Remove the "hover" class , then stop animation queue buildup*/
				.animate({
					width: '12px', /* Set width back to default */
					height: '9px', /* Set height back to default */
					top: '260px',
					left: '180px'
				}, 400, function(){$(this).css({ 'display' : 'none' });});
			$(this).css({'z-index' : '0'}); /* Set z-index back to 0 */
		}
		//$("#right_ref div").hover(hoverin,hoverout);
		$("#right_ref span").hover(hoverin,hoverout);
		
	}
										  
);

//Set page height by screen resolution
function setPageHeight(){
	var winHeight = document.documentElement.clientHeight;
	var mainTop = ((winHeight-520)/2);
	if(winHeight<520){mainTop=+10;winHeight=540;}
	$("#page").css("height",winHeight+"px");
	$("#main").css("top",mainTop+"px");
};
//Adding resize event
$(window).resize(function(){setPageHeight();});

