$(document).ready(function(){
	function replacesifr()
		{
			sIFR.replace(kepler, {
			    selector: 'h1,h2'
			    ,css: [
			      '.sIFR-root { size: 12px; font-weight: bold;}'
			      ,'a { text-decoration: none }'
			      ,'a:link { color: #000000 }'
			      ,'a:hover { color: #CCCCCC }'
			    ]
			    , wmode: 'transparent'
			    ,tuneHeight:-8

			});
		}
		
		// set cookie by number of days
 		
	 	var COOKIE_NAME = 'LandingLang';
     	var ADDITIONAL_COOKIE_NAME = 'additional';
     	var options = { path: '/', expires: 10 };

    	var Cookie = $.cookie(COOKIE_NAME);
        if(!Cookie)
        {
        	var date = new Date();
        	date.setTime(date.getTime() + (20 * 24 * 60 * 60 * 1000));// 10 Dage
        	var CookieContent = 'true';
        	$.cookie(COOKIE_NAME, CookieContent, { path: '/', expires: date });
        	// ^^ Husk at fjerne kommenteringen inden lancering ^^
     
		if (navigator.appName == 'Netscape')
		var language = navigator.language;
		else
		var language = navigator.browserLanguage;
		if(language.indexOf('no') > -1)
		{				
	
				

			$.ajax({
      				  type: "GET",
				url: "http://www.tivoli.dk/2009/sprog/norwegian.xml",
				dataType: "xml",
				success: function(xml) {
					$(xml).find('site').each(function(){
					var description = $(this).find('page').text();
					$("#NorwaycountryBox").html(description );
					$("#NorwaycountryBox").fadeIn();
					
					
			
			$(".NorwayWelcome").click(function () {
				$("#NorwaycountryBoxPractical").hide();
				$("#NorwaycountryBoxOpening").hide();
				$("#NorwaycountryBoxGetthere").hide();
				$("#NorwaycountryBoxPrices").hide();
				$("#NorwaycountryBoxWelcome").show();
				
				replacesifr();
			});
			
			$(".NorwayPrices").click(function () {
				$("#NorwaycountryBoxWelcome").hide();
				$("#NorwaycountryBoxOpening").hide();
				$("#NorwaycountryBoxGetthere").hide();
				$("#NorwaycountryBoxPractical").hide();
				$("#NorwaycountryBoxPrices").show();
				replacesifr();
			});

			
			$(".NorwayPractical").click(function () {
				$("#NorwaycountryBoxWelcome").hide();
				$("#NorwaycountryBoxOpening").hide();
				$("#NorwaycountryBoxGetthere").hide();
				$("#NorwaycountryBoxPrices").hide();
				$("#NorwaycountryBoxPractical").show();
				replacesifr();
			});
			
			$(".NorwayOpening").click(function () {
				$("#NorwaycountryBoxWelcome").hide();
				$("#NorwaycountryBoxPractical").hide();
				$("#NorwaycountryBoxGetthere").hide();
				$("#NorwaycountryBoxPrices").hide();
			
				$("#NorwaycountryBoxOpening").show();
				replacesifr();
			});

			$(".NorwayGetthere").click(function () {
				$("#NorwaycountryBoxWelcome").hide();
				$("#NorwaycountryBoxPractical").hide();
				$("#NorwaycountryBoxOpening").hide();
				$("#NorwaycountryBoxPrices").hide();
				$("#NorwaycountryBoxGetthere").show();
				replacesifr();
			});

			
			window.setTimeout(function(){ 
			replacesifr();
			;},1000);
			
			
			$(".closeCountryBox").click(function () { 
				$("#NorwaycountryBox").fadeOut("normal");

			});


					
			});

 
			}
			});
	              

		
					}		else if (language.indexOf('de') > -1){
					$.ajax({
      				  type: "GET",
				url: "http://www.tivoli.dk/2009/sprog/german.xml",
				dataType: "xml",
				success: function(xml) {
					$(xml).find('site').each(function(){
					var description = $(this).find('page').text();
					$("#GermancountryBox").html(description );
					$("#GermancountryBox").fadeIn();

									
						$(".GermanWelcome").click(function () {
							$("#GermancountryBoxPractical").hide();
							$("#GermancountryBoxOpening").hide();
							$("#GermancountryBoxGetthere").hide();
							$("#GermancountryBoxPrices").hide();
							$("#GermancountryBoxWelcome").show();
							
							replacesifr();
						});
						
						$(".GermanPrices").click(function () {
							$("#GermancountryBoxWelcome").hide();
							$("#GermancountryBoxOpening").hide();
							$("#GermancountryBoxGetthere").hide();
							$("#GermancountryBoxPractical").hide();
							$("#GermancountryBoxPrices").show();
							replacesifr();
						});

						
						$(".GermanPractical").click(function () {
							$("#GermancountryBoxWelcome").hide();
							$("#GermancountryBoxOpening").hide();
							$("#GermancountryBoxGetthere").hide();
							$("#GermancountryBoxPrices").hide();
							$("#GermancountryBoxPractical").show();
							replacesifr();
						});
						
						$(".GermanOpening").click(function () {
							$("#GermancountryBoxWelcome").hide();
							$("#GermancountryBoxPractical").hide();
							$("#GermancountryBoxGetthere").hide();
							$("#GermancountryBoxPrices").hide();
							$("#GermancountryBoxOpening").show();
							replacesifr();
						});

						$(".GermanGetthere").click(function () {
							$("#GermancountryBoxWelcome").hide();
							$("#GermancountryBoxPractical").hide();
							$("#GermancountryBoxOpening").hide();
							$("#GermancountryBoxPrices").hide();
							$("#GermancountryBoxGetthere").show();
							replacesifr();
						});

						
						window.setTimeout(function(){ 
						replacesifr();
						;},1000);
						
						
						$(".closeCountryBox").click(function () { 
							$("#GermancountryBox").fadeOut("normal");
						});


					
			});

 
			}
			});
	              

		
					}
					else
		{
		}
        }
}); 

