jQuery(function($){

	if($.browser.msie && parseInt($.browser.version) == 6){
		/*alert("
		);*/


		if (typeof window.innerWidth != 'undefined')
		 {
		      viewportwidth = window.innerWidth,
		      viewportheight = window.innerHeight
		 }

		// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

		 else if (typeof document.documentElement != 'undefined'
		     && typeof document.documentElement.clientWidth !=
		     'undefined' && document.documentElement.clientWidth != 0)
		 {
		       viewportwidth = document.documentElement.clientWidth,
		       viewportheight = document.documentElement.clientHeight
		 }

		 // older versions of IE

		 else
		 {
		       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
		       viewportheight = document.getElementsByTagName('body')[0].clientHeight
		 }


		$message = "We are very sorry!<br/>This page will not be displayed correctly <br/>in internet explorer version 6.<br/>"
					+ "Please use one of the following browsers!";

		$browsersDown = '<span><a style="border:none;margin:5px;" title ="Firefox Download" href="http://www.mozilla.com/en-US/firefox/firefox.html"><img style="border:none;" alt="firefox" src="themes/alturabeds/images/Firefox.jpg" /></span>'
						+ '<span><a style="border:none;margin:5px;"title ="Chrome Download" href="http://www.google.com/chrome/intl/en/landing_chrome.html?hl=en&hl=en"><img style="border:none;" alt="chrome" src="themes/alturabeds/images/Chrome.jpg" /></span>'
						+ '<span><a style="border:none;margin:5px;"title ="Opera Download" href="http://www.opera.com/download/"><img style="border:none;" alt="opera" src="themes/alturabeds/images/Opera.jpg" /></span>'
						+ '<span><a style="border:none;margin:5px;"title ="Safari Download" href="http://www.apple.com/safari/download/"><img style="border:none;" alt="opera" src="themes/alturabeds/images/Safari.jpg" /></span>'
						+ '<span><a style="border:none;margin:5px;"title =" Internet explorer Download" href="http://www.microsoft.com/uk/windows/internet-explorer/"><img style="border:none;" alt="Internet explorer" src="themes/alturabeds/images/IE.jpg" /></span>';






		// firefox: http://www.mozilla.com/en-US/firefox/firefox.html
		// opera:	http://www.opera.com/download/
		// chrome:	http://www.google.com/chrome/intl/en/landing_chrome.html?hl=en&hl=en
		// safari:	http://www.apple.com/safari/download/
		// IE 	:	http://www.microsoft.com/uk/windows/internet-explorer/


		$('#superdivmsg').html($message);
		$('#superdivmsg').css({"font-size":"14px"});
		$('#superdivImgs').html($browsersDown);

		$("#SuperDiv").show();

		$('html').css({"overflow":"hidden"});
		$("#SuperDiv").css({"height":viewportheight,
							"position":"absolute",
							"background-color":"#222",
							"overflow":"hidden"
						});
	}




	$(".importAction").click(function(){
		$message = "Please wait while file is being processed!";

		$('#superdivmsg').html($message);
		$('#superdivmsg').css({"font-size":"20px"});
		$("#SuperDiv #SDbgd").css({"opacity":0.8});
		$("#SuperDiv").show();

	});


	$("#HomeOtherBanners a").click(function(){
		$code = $(this).attr("rel");
		$location = $(this).attr("href");
		$.ajax({
			url: 'home/CountClickExternalBanners?Bypass_Login=1&banid=' + $code,
			//data: ({code :  $(this).attr("rel")}),
			dataType: 'json',
			success: function(data) {
				window.location=$location;
        	},
        	error:function(data){
        		window.location=$location;
        	}
		});
		return false;
	});

	$("#MainBanner a.homeBanner").click(function(){
		$code = $(this).attr("rel");
		$location = $(this).attr("href");
		$.ajax({
			url: 'home/CountClickHomeTopBanner?Bypass_Login=1&banid=' + $code,
			//data: ({code :  $(this).attr("rel")}),
			dataType: 'json',
			success: function(data) {
				window.location=$location;
        	},
        	error:function(data){
        		window.location=$location;
        	}
		});
		return false;
		//alert("home" + $(this).attr("rel"));
	});

	$("#MainBanner a.loggedBanner").click(function(){
		$code = $(this).attr("rel");
		$location = $(this).attr("href");

		$.ajax({
			url: 'home/CountClickInsideTopBanner?Bypass_Login=1&banid=' + $code,
			//data: ({code :  $(this).attr("rel")}),
			dataType: 'json',
			success: function(data) {
				window.location=$location;
        	},
        	error:function(data){
        		window.location=$location;
        	}
		});
		return false;
		//alert("home" + $(this).attr("rel"));
	});



	function AnimateMyBookings(){
		if($.browser.opera){return false};
		 setTimeout(function(){MoveLeft();},1000);
	}
	function MoveRight(){
		$maxLeft = $("#Settingsctn").width() - $("#MyBookings").width();
		$('#MyBookings').animate({
		    'left': '+=' + $maxLeft
		    //'opacity':'1'
		  }, 5000, function() {
			  setTimeout(function(){MoveLeft();},1000);
		 });

	}
	function MoveLeft(){
		$maxLeft = $("#Settingsctn").width() - $("#MyBookings").width();
		$('#MyBookings').animate({
		    'left': '-='+ $maxLeft
		    //'opacity':'0.75'
		  }, 5000, function() {
			  setTimeout(function(){MoveRight();},1000);

		  });
	}

	if(ShowMapPlotIP=='T'){
		$("#Gmap").gMap({
			markers	: Markers,
			maptype	: G_HYBRID_MAP,
			zoom	: 20
		});
	}

	 AnimateMyBookings();


	 $('a[rel="clear-btn"]').css({'display':'none'});

});/** END OF JQUERY READY **/
