﻿/******************************************************
	JQUERY IMAGE ROLLOVER FUNCTION
	
	NOTE: All rollover images must have the same
	name as the original image, but with "_over"
	at the end of the filename.
	
	Example:
	
	Original Image: image.gif
	Rollover Image: image_over.gif
	
	Application:
	
	To create an image rollover, simple append the
	CSS class "rollover" to the image.
	
******************************************************/

$(document).ready( function()
{
   PEPS.rollover.init();
});

PEPS = {};

PEPS.rollover = 
{
   init: function()
   {
      this.preload();
      
      $(".rollover").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() {
         $('.rollover').each( function( key, elm ) { $('<img>').attr( 'src', PEPS.rollover.newimage( $(this).attr('src') ) ); });
      });
   },
   
   newimage: function( src )
   { 
      return src.substring( 0, src.search(/(\.[a-z]+)$/) ) + '_over' + src.match(/(\.[a-z]+)$/)[0]; 
   },

   oldimage: function( src )
   { 
      return src.replace(/_over\./, '.'); 
   }
};
/******************************************************/
/******************************************************
	JQUERY FOR HOMEPAGE BLOCKS HOVER STATE
******************************************************/
$(document).ready(function() {
   
   /*$('#nav li').mouseover( function() 
	{
		var div = this.title;
		
		/* Hide all others */
		/*for( var i = 1; i < 8; i++ )
		{
			if( div != ('nav_0' + i) )
				$( '#nav_0' + i ).css( 'display', 'none' );
		}
		
		$('#' + div).slideDown( 500 );
		
		//alert( $('#' + div ).html() );
	});
	
	$('#nav li').mouseout( function() 
	{
		/*var div = this.title;
		
		$('#' + div ).css( 'display', 'none' );*/
		/*for( var i = 1; i < 8; i++ )
		{
			$( '#nav_0' + i ).css( 'display', 'none' );
		}
	});
	
	$('#site_body').mouseover( function()
	{
		for( var i = 1; i < 8; i++ )
		{
			$( '#nav_0' + i ).css( 'display', 'none' );
		}
	});
   
   /*$("#home_blocks .block").mouseover(function() {
	
		$(this).css('cursor', 'pointer');
		$(".block_hover").css('display', 'block');
		
   });
   
   $("#home_blocks .block").mouseout(function() {
	
		$(".block_hover").css('display', 'none');
		
   });*/
   
   /* Block 1 */
	/*$("#home_block_1").mouseover(function() {
		$(this).css('cursor', 'pointer');
		$("#block_hover_1").css( 'display', 'block' );
	});
	
	$("#home_block_1").mouseout(function() {
		$("#block_hover_1").css( 'display', 'none' );
	});
	
   /* Block 2 */
	/*$("#home_block_2").mouseover(function() {
		$(this).css('cursor', 'pointer');
		$("#block_hover_2").css( 'display', 'block' );
	});
	
	$("#home_block_2").mouseout(function() {
		$("#block_hover_2").css( 'display', 'none' );
	});
   
   /* Block 3 */
	/*$("#home_block_3").mouseover(function() {
		$(this).css('cursor', 'pointer');
		$("#block_hover_3").css( 'display', 'block' );
	});
	
	$("#home_block_3").mouseout(function() {
		$("#block_hover_3").css( 'display', 'none' );
	});
	
   /* Block 4 */
	/*$("#home_block_4").mouseover(function() {
		$(this).css('cursor', 'pointer');
		$("#block_hover_4").css( 'display', 'block' );
	});
	
	$("#home_block_4").mouseout(function() {
		$("#block_hover_4").css( 'display', 'none' );
	});*/
 });
/******************************************************/
/******************************************************
	FUNCTIONS TO EMPTY AND RE-FILL A TEXT FIELD
******************************************************/
/*
function clickclear(thisfield, defaulttext) {
	if (thisfield.value == defaulttext) {
	thisfield.value = "";
	}
}

function clickrecall(thisfield, defaulttext) {
	if (thisfield.value == "") {
	thisfield.value = defaulttext;
	}
}
*/
/******************************************************/
/******************************************************
	FUNCTION TO VALIDATE SITE SEARCH FORM
******************************************************/
/*
function validate_sitesearch(){
	
	var bError = 0
	
	if(document.frm_search.txt_search.value == "" || toLowerCase(document.frm_search.txt_search.value) == 'search site'){
		if(bError==0){
			alert("Please enter a search.")
			bError=1
			return false
		}
	}

	
				
	if(bError==0){
		document.frm_search.submit()
	}
}
*/
/******************************************************/
