
var stdImage = '';
$(function() {
	setTimeout('swapNewsFeed()', 3000);
	$('#brochure').bind('click', function() {
		newwin = window.open('/forfragan.asp','brochure','width=450,height=500,scrollbars=yes');
		if(newwin.innerWidth) {
			_xpos = eval(window.innerWidth / 2 - newwin.innerWidth / 2)
			newwin.moveTo(_xpos,'50');
		} else if(newwin.document.body.clientWidth) {
			_xpos = eval(window.innerWidth / 2 - newwin.document.body.clientWidth / 2)
			newwin.moveTo('100','50');				
		}
		return false;
	});
	
	$('.newsletter').bind('click', function() {
		newwin = window.open('/as.asp?ml_id=9669FEB7-8BDD-40B6-BA24-886AA05AA1ED','newsletter','width=450,height=500,scrollbars=yes');
		if(newwin.innerWidth) {
			_xpos = eval(window.innerWidth / 2 - newwin.innerWidth / 2)
			newwin.moveTo(_xpos,'50');
		} else if(newwin.document.body.clientWidth) {
			_xpos = eval(window.innerWidth / 2 - newwin.document.body.clientWidth / 2)
			newwin.moveTo('100','50');				
		}
		return false;
	});
	
	var tempBkg;
	$('#roadmap').bind('click', function() {
		$('#content *').hide();
		$('#content').append('<div class="close"></div>');
		tempBkg = $('#content').css('background');
		
		if (language == 1033) {	
			$('#content').css({ 'background': 'url(\'/bilder/bakgrund/0001_roadmap_eng.jpg\') top left no-repeat' });
		} else {
			$('#content').css({ 'background': 'url(\'/bilder/bakgrund/0001_roadmap.jpg\') top left no-repeat' });
		}
		$('#content').append('<div id="roadText"></div>');

		if (language == 1033) {
			
			$('#content #roadText').append('<div class="readbox"><p>It takes about one hour to travel from Båstad to Kastrup, and an additional 20 minutes to get to Copenhagen. The Öresund train leaves directly from Båstad.</p><p>It takes twenty minutes by car to Ängelholm airport.</p><p>Multiple highways leads to Båstad if you travel from Copenhage, Malmö, Göteborg or Stockholm.</p><p id="print"><b><a href="#" class="#slider" onclick="window.print(); return false;">Print</a></b> this page.</p><div class="readbox_map"></div></div>');
		
		} else {
		
			$('#content #roadText').append('<div class="readbox"><p>Från Båstad är det drygt en timme till Kastrup och ytterligare 20 min till Köpenhamns centrum. Öresundståget går direkt från Båstad.</p><p>Till Ängelholms flygplats tar det tjugo minuter med bil.</p><p>Flera motorvägar leder till Båstad om man kommer från Köpenhamn, Malmö, Göteborg eller Stockholm.</p><p id="print"><b><a href="#" class="#slider" onclick="window.print(); return false;">Skriv ut</a></b> den här sidan.</p><div class="readbox_map"></div></div>');
		
		}
		
		$('#content div.close').bind('click', function() {
			$(this).remove();
			$('#roadText').remove();
			$('#content').css({ 'background': tempBkg});
			$('#content *').show();
		});
		return false;
	});
	
	$('#freeCapacity').bind('click', function() {
		newwin = window.open('/ledigKapacitet/ledigkonf.asp','capacity','scrollbars=yes,resizable=yes,width=550,height=590');
		if(newwin.innerWidth) {
			_xpos = eval(window.innerWidth / 2 - newwin.innerWidth / 2)
			newwin.moveTo(_xpos,'50');
		} else if(newwin.document.body.clientWidth) {
			_xpos = eval(window.innerWidth / 2 - newwin.document.body.clientWidth / 2)
			newwin.moveTo('100','50');				
		}
	});
	
	/*$('.crossover').bind('click', function() {
		var lid = $(this).attr('href').substring(eval($(this).attr('href').lastIndexOf('/') + 1), $(this).attr('href').length);
		var id = $(this).attr('href').match(/([0-9]{2,4})(?:\/)/);
		id = id[1];
		$.ajax({
			url: 'packagereaderAjax.asp?id=' + id + '&lid=' + lid,
			type: 'GET',
			success: function(cont) {
				$('.center').html(cont);
			},
			complete: function() {
				if($('#bkgImage').val() != "") {
					if(stdImage == '') {
						stdImage = $('#content').css('background-image'); }
					$('#content').css({'background-image': 'url(\'' + $('#bkgImage').val() + '\')'});
				} else {
					if(stdImage != '') {
					$('#content').css({'background-image': stdImage }); }
				}
				//$('.readBox').css({ 'height': $('.readBox .text').height() + 'px'});
				//$('.readBox .background').css({ 'height': $('.readBox .text').height() + 'px'});
			}
		});
		return false;
	});*/

});

function swapNewsFeed() {
		if($('.loop').length > 1) {
			if($('.loop').is(':visible'))
			{
				$('.loop:visible').hide(function() {
					if ($(this).next('.loop').length == 1) {
						$(this).next('.loop').show();
					} else {
						$('.loop:first').show();
					}
				});
			} else {
				$('.loop:first').show();
			}
			setTimeout('swapNewsFeed()', 3000);
		}
}