// JavaScript Document
var rotation_interval = '';

//ready function fills this array for load function
var preload_images = new Array();

$(document).ready(function(){

	$('.swap').each(function(i){
		var src = this.src;
		
		if(src.indexOf('_on.')){
		   //
		   src = src.replace('_on.','_off.');	
		}
		else{
		   src = src.replace('_off.','_on.');
		}
							 
		preload_images[i] = this.src;
	});
						   
	$('.swap').mouseover(function(){
		this.src = this.src.replace('_off.','_on.');
	});
	
	$('.swap').mouseout(function(){
		
		//if class is selected we don't want to deselect it
		if(!$(this).hasClass("selected")){
		   this.src = this.src.replace('_on.','_off.');
		}
	});
	
	$('.focusClear').focus(function(){
        
	  //assign a local variable so our function 
	  //will have its own unique original value per item
	  var originalValue = this.value;
	  
	  //first time we always clear
	  this.value = '';
	  
	  //unbind this jquery inline function
	  //because we want to set original value once
	  $(this).unbind('focus');
	  
	  //add an unique onblur per item
	  this.onblur = function(){
		if(this.value == ''){
		   this.value = originalValue;	
		}
		
		//attach the new unique onfocus per item
		this.onfocus = function(){
			 if(originalValue == this.value){
				this.value = '';	
			 }
		  }
	  }
	});

});

$(window).load(function(){
	for(var i=0;i<preload_images.length;i++){
	   var image = new Image();
	   image.src = preload_images[i];	
	}

});