$(document).ready( function()
{
 PEPS.rollover.init();
});

PEPS = {};

PEPS.rollover =
{
 init: function()
 {
	this.preload();
	
	$(".ro").hover(
	   function () { $(this).attr( 'src', PEPS.rollover.newimage($(this).attr('src')) ); },
	   function () { $(this).attr( 'src', PEPS.rollover.oldimage($(this).attr('src')) ); }
	);
 },
 
 preload: function()
 {
	$(window).bind('load', function() {
	   $('.ro').each( function( key, elm ) { $('<img>').attr( 'src', PEPS.rollover.newimage( $(this).attr('src') ) ); });
	});
 },
 
 newimage: function( src ) { return src.substring( 0, src.search(/(\.[a-z]+)/) ) + '_1' + src.match(/(\.[a-z]+)/)[0]; },
 oldimage: function( src ){ return src.replace(/_1/, ''); }
};

// show / hide desc divs
var state = 'none';
function showhide(layer_ref){
if(state == 'block'){
state = 'none';
}else{
state = 'block';
}
if(document.all){ //IS IE 4 or 5 (or 6 beta)
eval("document.all." +layer_ref+ ".style.display = state");
}
if (document.layers) { //IS NETSCAPE 4 or below
document.layers[layer_ref].display = state;
}
if (document.getElementById &&!document.all) {
hza = document.getElementById(layer_ref);
hza.style.display = state;
}
}

// fade gallery
$(document).ready(function() {
	//area 1
	$('.fader').children().hover(function() {
		$(this).siblings().stop().fadeTo(500,0.5);
	}, function() {
		$(this).siblings().stop().fadeTo(500,1);
	});
	
});
