/*  init = function() {
	initRollovers();
}  */

jQuery.preloadImages = function() {
	for(var i = 0; i<arguments.length; i++) {
		jQuery("<img>").attr("src", arguments[i]);
	}
}


// preload images first (can run before page is fully loaded)
$.preloadImages(
		"/images/icon/download_over.png", 
		"/images/navi/bt_whatwedo_over.png", 
		"/images/navi/bt_whyus_over.png", 
		"/images/navi/bt_foryou_over.png", 
		"/images/navi/bt_aboutus_over.png",
		"/images/navi/contact_over.png",
		"/images/navi/imprint_over.png",
		"/images/navi/jobs_over.png", 
		"/images/nyro/ajaxLoader.gif", 
		"/images/nyro/prev_over.png", 
		"/images/nyro/next_over.png", 
		"/images/nyro/close_over.png",
		"/images/plus_on.png"
	);

$(
	function() {
		// set up rollover
		$("img.imgover").hover(
			function() {
				this.src = this.src.replace("_off","_over");
			},
			function() {
				this.src = this.src.replace("_over","_off");
			}
		);	
	}
)


$(document).ready(function(){
	
	/* sidebar */
	$("div.item_inner").hover(
		function() { this.className="item_inner_on"; jQuery('.plus > img',this).attr('src',"/images/plus_on.png"); },
		function() { this.className="item_inner";    jQuery('.plus > img',this).attr('src',"/images/plus.png");}
	);
	$('.item a').nyroModal();
	
	/* boxbox */
	/*
	$("div.boxbox").hover(
		function() { this.className="boxbox_on"; jQuery('h3',this).attr('class',"on"); },
		function() { this.className="boxbox";    jQuery('h3',this).attr('class',""); }
	);
	$('td.boxbox').nyroModal();
	*/
 });


img_prev = function(total,imgname,imgext) {
	prev_val = parseInt($("#currentimg").attr("value")) - 1; 
	if(prev_val == 0) { prev_val = total };
	$("#currentimg").attr({value: prev_val });
	$("#layerpic").attr({ src: "/images/layers/"+imgname+"_"+prev_val+"."+imgext });
}
img_next = function(total,imgname,imgext) {
	next_val = parseInt($("#currentimg").attr("value")) + 1; 
	if(next_val > total) { next_val = 1 };
	$("#currentimg").attr({value: next_val });
	$("#layerpic").attr({ src: "/images/layers/"+imgname+"_"+next_val+"."+imgext });
}
 