$(document).ready(function() {

	$('#newsletter').focus(function() {
		if( $(this).val() == 'your email address' ) {
			$(this).removeClass('ghosted').val('');
		}
	}).blur(function() {
		if( $(this).val() == '' ) {
			$(this).addClass('ghosted').val('your email address');
		}
	}).trigger('blur');
	
  // home page
	$("div#location").corner("15px");
	$("div#tour").corner("15px");
	$("div#spa").corner("15px");
	$("div#fish").corner("15px");
	$("div#weddings").corner("15px");
	$("div#meetings").corner("15px");
	// many pages corners
	$("div.image_holder").corner("10px");
	$("div.newsHolder_1").corner("10px");
	$("div.newsHolder_2").corner("10px");
	$("div.newsHolder_3").corner("10px");
	$("div.newsHolder_4").corner("10px");
	$("div.newsHolder_5").corner("10px");
	$("div.newsHolder_6").corner("10px");
	$("div.offers_box").corner("bl br 20px");
	$("div.content_box_small").corner("15px");
	
	$("#right_nav").Accordion({
	  active : '.dark',
	  header: '.title',
	  animated: false,
	  autoheight: true,
	  event : "mouseover",
	  selectedClass  : "selected"
	});
	
	function txt (el,txt){
	  $(el).attr('value',txt);
	  $(el).focus(function(){if($(this).val()==txt){$(this).attr('value','')}});
	  $(el).blur(function(){if($(this).val()==''){$(this).attr('value',txt)}});
	}
	
	txt('input#name','NAME');
	txt('input#email','EMAIL');
	txt('textarea#message','MESSAGE');
	txt('input#phone','PHONE');
	
	$("div.main_img img").replaceWith("<img src='" + $("div.sub_img img").attr("src") + "' />");
	
	$("div.sub_img img").hover(
	  function ()
	  {
		  $(this).css("opacity","0.6");
	  },
	  function ()
		{
		  $(this).css("opacity","1");
	  })
	$("div.main_img").css("height","520px");
	
	$("div.sub_img img").click(function ()
	{
		newimg = $(this).attr('src');
	  $("div.main_img img").fadeTo("normal",0.2, function (){
		  $("div.main_img img").replaceWith("<img src='" + newimg + "' height='470' width='696' />");
			$("div.main_img img").css("opacity","0.2")
			$("div.main_img img").fadeTo("normal",1)
    })
	})
	function getNewImg(img)
	{
		$("div.main_img img").replaceWith("<img src='" + img + "' />");
	}
	
	baseLocation = 'http://www.stmichaelshotel.co.uk';
	currentLocation = location.href;
	currentLocation = currentLocation.replace(baseLocation, '');															
	$('ul#rightNavigationMenu a').each( function() 
  {
    $(this).css("font-weight","normal");
		if( $(this).attr('href') == currentLocation ) 
		{
			$(this).parent().addClass('selected');
		}
	});
	
	$("ul.inner_menu li a:first").addClass("first");
	
	$('ul.inner_menu li a').each( function() 
  {
   
		if( $(this).attr('href') == currentLocation ) 
		{
			$(this).addClass('selected');
		}
	});
	
	$("a#premier").tooltip({
	bodyHandler: function() {
		return $($(this).attr("href")).html();
	},
	showURL: false
  });
		
	function bedBox (name,left,top)
	{
		$("div#" + name + "_text").hide();
		$("div#" + name + "_text").css("margin-left",left);
		if (top != "")
		{
			$("div#" + name + "_text").css("margin-top",top);
		}
		$("th#" + name ).mouseover( function ()
		{
      $("div#" + name + "_text").show()
    })
		$("th#" + name ).mouseout( function ()
	  {
      $("div#" + name + "_text").hide()
    })
	}
	
	bedBox ("premier","170px");
	bedBox ("deluxe","250px");
	bedBox ("super","340px");
	bedBox ("select","400px");
	bedBox ("standard","450px");
	
	bedBox ("premier_2","170px","5em");
	bedBox ("deluxe_2","250px","5em");
	bedBox ("super_2","340px","5em");
	bedBox ("select_2","400px","5em");
	bedBox ("standard_2","450px","5em");
	
	bedBox ("premier_3","170px","5em");
	bedBox ("deluxe_3","250px","5em");
	bedBox ("super_3","340px","5em");
	bedBox ("select_3","400px","5em");
	bedBox ("standard_3","450px","5em");
});

function getTheDay(day){
	var d=new Date();
	var weekday=new Array(7);
	weekday[0]="Sunday";
	weekday[1]="Monday";
	weekday[2]="Tuesday";
	weekday[3]="Wednesday";
	weekday[4]="Thursday";
	weekday[5]="Friday";
	weekday[6]="Saturday";
	return d;
}












