
// preload images function
jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}

$(function() { 
	
	if ($(window).height()>664) {
		$("#wrapper").css({ 'margin-top':'-33.2em','margin-left':'-45.9em','position':'absolute','top':'50%','left':'50%' });
		var bgpos = ($(window).height()/2)-68;
		$('body').css({ 'background-position':'center ' + bgpos + 'px','background-image':'url(http://www.glasrocf.com/images/templates/bg.jpg)','background-repeat':'no-repeat' });
		var move = "yes";
	} else {
		$('body').css({ 'background-position':'center 315px','background-image':'url(http://www.glasrocf.com/images/templates/bg.jpg)','background-repeat':'no-repeat' });
	}
	
	$(window).resize(function(){
		if (move=="yes") {
			var new_bgpos = ($(window).height()/2)-68;
			$('body').css({ 'background-position':'center ' + new_bgpos + 'px' });
		}
	});
	
	$('#lang_select_nav ul').find('li').hover(
		function(){
			$(this).find('div').css({ 'display':'block','opacity':'0.85','cursor':'pointer' });
		},
		function(){
			$(this).find('div').css({ 'display':'none' });
		}
	).click(
		function() {
			top.location = $(this).find('a').attr('href'); 
		}
	);
	
	$('#checkin_now').click(function() {
		top.location = 'http://www.glasrocf.com/check-in/';
	});
	
	$("#checkin_now").hover(
		function(){
			$(this).addClass("iactive");
		},
		function(){
			$(this).removeClass("iactive");
		}
	);
	
	$('.standard_btn').click(function() {
		btn_target = $(this).parent().attr('href');
		top.location = btn_target;
	});
	
	$(".standard_btn").hover(
		function(){
			$(this).addClass("iactive");
		},
		function(){
			$(this).removeClass("iactive");
		}
	);

});
