// OLA 
// jquery Dropdown Add-on	
	
var timeout         = 500; // time it takes for the dropdown to close
var closetimer		= 0;
var ddmenuitem      = 0;

  // Opening the dropdown
  function dropdown_open() {	
	  dropdown_canceltimer();
	  dropdown_close();
	  ddmenuitem = $(this).find('ul').eq(0).css('visibility', 'visible');
  }
   
   // Closing the dropdown
  function dropdown_close() {	
	  if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');
  }

  // Timer for dropdown mouseout
  function dropdown_timer() {	
	  closetimer = window.setTimeout(dropdown_close, timeout);
  }
  
  function dropdown_canceltimer() {	
	  if(closetimer) {	
		  window.clearTimeout(closetimer);
		  closetimer = null;
	  }
  }


// If clicked anywhere outside the dropdown, close the dropdown.
document.onclick = dropdown_close;	
	
	
	$(document).ready(function(){
							   
		// SUBMENU OnLoad
		$('#dropdown > li').bind('mouseover', dropdown_open);
		$('#dropdown > li').bind('mouseout',  dropdown_timer);
							  
		
		// Images ROLLOVER Function, Add a class="rollover" to any image to activate this function.
		$(".rollover").hover(
		 function() {
		  this.src = this.src.replace("_off","_on");
		 },
		 function()
		 {
		  this.src = this.src.replace("_on","_off");
		 
		});
	});


$(document).ready(function(){
	// Function to validate email
	$("#recommend").validate({
		rules: {
			recommend_from_name: {
				required: true
			},
			recommend_from_email: {
				required: true,
				email: true
			},
			recommend_to_email: {
				required: true,
				email: true
			},
			recommend_message: {
				required: true
			}
		}
	});
});
