$(document).ready(function(){	
		$(document).pngFix();	
		mainmenu();
		addrabbit();
}); 

$(function ()			
{
  $('.suboffer li:last').css('visibility','hidden');

$(".rollover").hover(function() { 
             var currentImg = $(this).attr("src");
                $(this).attr("src", $(this).attr("hover"));
                $(this).attr("hover", currentImg);
            }, function() {
                var currentImg = $(this).attr("src");
                $(this).attr("src", $(this).attr("hover"));
                $(this).attr("hover", currentImg);
});


});

function showvideos(){
	$(document).ready(function(){
                $("a[rel^='prettyPhoto']").prettyPhoto({showTitle:false});
            });
	$("#vdolink").trigger('click');
}
function onlinechat(){
	$("#olc").trigger('click');		
}
		

function NewWindowTop(mypage,myname,w,h,scroll,resize){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable='+resize;
	win = window.open(mypage,myname,settings);
	if (window.focus) {win.focus()}

}
function setZ (zz){
	$('#taward').css('z-index',zz);
}

var t;
function mainmenu(){
	$(" #roomsB").hover(
				function(){clearTimeout(t);$('#subrooms').fadeIn(300);},
				function(){
					t = setTimeout("hidesub()",500);
				}
	);
	$(" #subrooms").hover(
				function(){clearTimeout(t);},
				function(){					
					//$('#subrooms').fadeOut(100);
					t = setTimeout("hidesub()",500);
				}
	);
	$(" #subroomitem").bind('click',function(){
					var ltaget=$(this).attr('ln');
					window.location=ltaget;
	 });
}
function hidesub(){
	clearTimeout(t);
	$('#subrooms').fadeOut(100);
}
function checktimeHover(){
	var tagSUB=$('#subrooms').attr('offset','top');
	alert(tagSUB);
}


//Newsletter
function OnSubmit() 
	{
	
	var frm=document.frmSubscribe;
	if (frm.scb_email.value=='') 
	{
		alert("E-Mail Address is required.");
		document.getElementById('scb_email').focus();
		return false;
	}
	else if (!checkemail(frm.scb_email.value))
	{
		alert("E-Mail Syntax Error.");
		document.getElementById('scb_email').focus();
		return false;
	}
/*	else if (frm.code.value=='') 
	{
		alert("Please input Security Code.");
		document.getElementById('code').focus();
		return false;
	}*/
	else
	{
		return true;
	}
}
function returnSend(txt) 
{
	if (txt=='true') 
	{
		alert('Thank you for subscribing to our newsletter.');
	//	window.location.reload(true)
		window.location.href = ('index.php');
	} else if (txt=='false'){
		alert('Wrong security');
	} else if (txt=='falsee'){
		alert('Your email address is already in our database. Thank you.');
	} else {
		alert('Error !\nCan not prodessing, try again later.');
	}
	
}
var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;
function checkemail(e){
	var returnval=emailfilter.test(e);
	return returnval;
}	

function addrabbit(){
	var tagT = $('#reservebox').position();
	var checkT = tagT.top;
	if (checkT < 600){
		$('#reservebox').append('<img src="images/rabbit-mass-small.png" id="rabbitM"/>');
	}else{}
}
