
$(function(){
	
	// image rollover effect
	$("img.rollover").each( function() {
		var $$ = $(this),
			target_extPos = $$.attr("src").search(/\.(jpg|jpeg|png|gif)/),
			target = $$.attr("src").substr(0,target_extPos)+"-mouse-over"+$$.attr("src").substr(target_extPos);
		
		$$.parent().addClass("rollover-link")
		if ($.browser.msie)
		{
			// old version image rollover effect
			$$.wrap('<span></span>');
			var span = $$.parent().append('<img>'),
			targetIMG = span.find('img:last')
							.attr('src', target)
							.css("display", "none");
			if ($$.css("display")=="block")
			{
				span.hover(function() {
					$$.css("display", "none");
					targetIMG.css("display", "block");
				}, function(){
					$$.css("display", "block");
					targetIMG.css("display", "none");
				})
			}
			else
			{
				span.hover(function() {
					$$.css("display", "none");
					targetIMG.css("display", "inline");
				}, function(){
					$$.css("display", "inline");
					targetIMG.css("display", "none");
				})
			}
		}
		else
		{
			$$.parent().wrapInner('<div></div>');
			var div = $$.parent();
			div.css("background-image", "url("+target+")").css("background-repeat", "no-repeat").css("display", "inline-block")
			   .hover(function() 
				{
					if ($$.is(':animated')) {
						$$.stop().fadeTo(250, 0);
					} else {
						$$.fadeTo(250, 0);
					}
				}, function(){
					if ($$.is(':animated')) {
						$$.stop().fadeTo(1000, 1);
					} else {
						$$.fadeTo(1000, 1);
					}
				})
		}
	})
	
	// Make all image heading unselectable and undraggable
	$("img.noDrag").mousedown(function(){return false;});
	
	// Make all link that opens in a new window says so
	$("a[target=_blank]").each(function() {
		if ($(this).find("img").size()>0)
		{
			var $img = $(this).find("img")
			if ($img.attr("title") != undefined)
			{
				$img.attr("title", $img.attr("title")+" (Opens in new window)")
				$(this).attr("title", $img.attr("title"))
			}
			else
			{
				$(this).attr("title", $img.attr("alt")+" (Opens in new window)")
				$img.attr("title", $img.attr("alt")+" (Opens in new window)")
			}
		}
		else
		{	
			console.log($(this), $(this).attr("title"))
			if ($(this).attr("title") != undefined)
				$(this).attr("title", $(this).attr("title")+" (Opens in new window)")
			else
				$(this).attr("title", "(Opens in new window)")
		}
	})
	/***********************************************
	* Encrypt Email script- Please keep notice intact
	* Tool URL: http://www.dynamicdrive.com/emailriddler/
	* **********************************************/
	// Encrypted version of: reservations [at] ****************.*** 
	var emailriddlerarray=[114,101,115,101,114,118,97,116,105,111,110,115,64,115,97,110,105,103,110,97,99,105,111,98,101,108,105,122,101,46,99,111,109]
	var encryptedemail_id30='' //variable to contain encrypted email 
	for (var i=0; i<emailriddlerarray.length; i++)
	{
		encryptedemail_id30+=String.fromCharCode(emailriddlerarray[i])
	}
	/*$(".emailhere").html('<a href="mailto:'+encryptedemail_id30+'">'+encryptedemail_id30+'</a>');*/
})
