var isdebug = (qstr("debug") == "1")?true:false;

var bLoaded = false;

var site = null;
var boxbreadcrumb = null;

var trtop = null;

var tdleft = null;
var tdcenter = null;
var tdright = null;

var boxleft = null;
var boxleftcontent = null;
var boxcontentleftroute = null;

var contentleftheadline = null;
var boxcenter = null;
var boxflag = null;
var boxleftcontentbottom = null;

var imglogotop = null;

var tabtilbud = null;
var tabtilbudon = null;

var tabbooking = null;
var tabbookingon = null;

var tabkontakt = null;
var tabkontakton = null;

var tabgaestebog = null;
var tabprint = null;

var offerone = null;
var offertwo = null;
var offerthree = null;
var offerfour = null;
var offerspacing = null;

var tabbuttons = null;
var tabbuttonscontentleft = null;
var tabbuttonscontentright = null;
var bg_content_offers = null;

var contentmenuright = null;

var imgcontentrighttop = null;
var imgcontentrightbottom = null;
var imgframerighttop = null;
var imgframerightbottom = null;
var imgframeleft = null;
var contentimageleft = null;

var subtopmenu = null;
var subtopmenu_resized = false;

var imgumbrella = null;

var browseimages = null;

var paddingBottom = 0;

var browsearrows = null;
var browsearrowsupdown = null;
var imgbrowsearrowsupdown = null;

var alertcounter = 0;

var adresstrelde = null;

var infobox = null;

var contentimagecenter = null;

function initialize()
{
	boxbreadcrumb = g("box_breadcrumb");


	tdleft = g("td_left");
	tdcenter = g("td_center");
	tdright = g("td_right");
	tdtop = g("td_top");
trtop = g("tr_top");

	boxleft = g("box_content_left");
	boxleftcontent = g("div_content_left_text");
	boxleftcontentroute = g("div_content_left_text_route");
	contentleftheadline = g("div_content_left_headline");
	boxcenter = g("div_box_center");
	boxflag = g("box_flag");
	boxleftcontentbottom = g("box_left_content_bottom");


	imglogotop = g("img_logo_top");

	tabtilbud = g("tab_tilbud");
	tabtilbudon = g("tab_tilbud_on");
	
	tabbooking = g("tab_booking");
		tabbookingon = g("tab_booking_on");
		
	tabkontakt = g("tab_kontakt");
	tabkontakton = g("tab_kontakt_on");
	
	tabgaestebog = g("tab_gaestebog");
	tabprint = g("tab_print");

	offerone = g("div_offer_one");
	offertwo = g("div_offer_two");
	offerthree = g("div_offer_three");
	offerfour = g("div_offer_four");

	tabbuttons = g("div_tabbuttons");
	tabbuttonscontentleft = g("div_content_left_tabs");
	tabbuttonscontentright = g("div_content_right_tabs");
	bg_content_offers = g("div_content_offers_bg");
	
	contentmenuright = g("content_menu_right");

	imgumbrella = g("img_umbrella");
//	imgcontentright = g("img_content_right");
	imgcontentrighttop = g("content_image_right_top");
	imgcontentrightbottom = g("content_image_right_bottom");
	imgframerighttop = g("img_frame_right_top");
	imgframerightbottom = g("img_frame_right_bottom");
	imgframeleft = g("img_frame_left");
	contentimageleft = g("content_image_left");

	subtopmenu = g("sub_top_menu");

	browseimages = g("div_browse_images");

	browsearrows = g("browse_arrows");
	browsearrowsupdown = g("browse_arrows_updown");
	imgbrowsearrowsupdown = g("img_browse_arrows_updown");

	adresstrelde = g("adress_trelde");

	infobox = g("info_box");

	downloadbrochure = g("div_download_brochure");
	meetUsOnFacebook = g("div_meetUsOnFacebook");

	contentimagecenter = g("content_image_center");

	if (jsres == 0) paddingBottom = crf*-3;
	if (jsres == 1) paddingBottom = crf*-12 - 1;

	site = g("site");
	if (site == null)
	{
		alert("Site not found!");
		return;
	}
	reposition();
}

function reposition()
{
	siteleft = ( document.body.offsetWidth / 2)  - (site.offsetWidth / 2);
	
	sitetop  = ( document.body.offsetHeight / 2) - (site.offsetHeight / 2) - (boxbreadcrumb.offsetHeight / 2);

	site.style.left = ( (siteleft > 0)?siteleft-20/2:0 ) + "px";
	site.style.top = ( (sitetop > 0)?sitetop-2:0 ) + "px";
}

function setup_global()
{
	initialize();
	add_png_fix();

	if (offerone) offerspacing = crf*84+offerone.offsetWidth; //(site.offsetWidth - (4*offerone.offsetWidth));

	// 173

	/**/
	if (tdleft && offerone)
	{

		TOPofferone = 0;
		if (jsres == 1)
		{
			TOPofferone = 7;
		}

		if (jsres == 2)
		{
			TOPofferone = -2;
		}

		offerone.style.left   = rxpos(site.id) + (tdleft.offsetWidth / 2 - offerone.offsetWidth / 2) + "px";
		offerone.style.top    = rypos(tdleft.id) + tdleft.offsetHeight - offerone.offsetHeight + paddingBottom + crf*TOPofferone + "px";
		offerone.style.zIndex = 999;

		if (tabbuttons)
		{
			tabbuttons.style.left = rxpos(offerone.id) + "px";
			tabbuttons.style.top = tdcenter.offsetHeight - rypos(site.id) - tabbuttons.offsetHeight + crf*10*0 + "px"; //rypos(offerone.id) - offerone.offsetHeight + "px";
		}

		if (offertwo)
		{
			LEFToffertwo = rxpos(site.id) + (tdleft.offsetWidth / 2 - offertwo.offsetWidth / 2) + offerspacing;
			offertwo.style.left   = LEFToffertwo + "px";
			offertwo.style.top    = rypos(offerone.id) + "px";
			offertwo.style.zIndex = 999;


	
			if (offerthree)
			{
				LEFTofferthree = rxpos(site.id) + (tdleft.offsetWidth / 2 - offerthree.offsetWidth / 2) + offerspacing * 2;
				offerthree.style.left   = LEFTofferthree + "px";
				offerthree.style.top    = rypos(offerone.id) + "px";
				offerthree.style.zIndex = 999;
	
				if (offerfour)
				{
					LEFTofferfour = rxpos(site.id) + (tdleft.offsetWidth / 2 - offerfour.offsetWidth / 2) + offerspacing * 3;
					offerfour.style.left   = LEFTofferfour + "px";
					offerfour.style.top    = rypos(offerone.id) + "px";
					offerfour.style.zIndex = 999;
				}

			}

		}

	}

	setup_boxes();
	setup_tabs();
	setup_content_images();
/*
	if (downloadbrochure)
	{
		//td_top
		downloadbrochure.style.left = crf*470 + "px";
		downloadbrochure.style.top  =  rypos(tdtop.id) + crf*43 + "px";
	}
	*/
	
	if (meetUsOnFacebook)
	{
		//g("box_flag")
		//td_top
		//meetUsOnFacebook.style.left =crf*700 + "px";
		meetUsOnFacebook.style.left = rxpos(site.id) + site.offsetWidth - boxflag.offsetWidth - meetUsOnFacebook.offsetWidth - crf*75 + "px";
		
		meetUsOnFacebook.style.top  =  rypos(tdtop.id) + crf*5 + "px";
	}
	
	// div conten left text route
	if (boxleftcontentroute)
	{
		// top:		onsectetuer
		// bottom:	magna

		if (jsres == 0)
		{
			boxleftcontentroute.style.height = crf*230 + crf*11 + "px";
			boxleftcontentbottom.style.height = crf*67 + "px";
			
		}
		if (jsres == 1)
		{
			boxleftcontentroute.style.height = crf*265 + crf*12 + "px";
			boxleftcontentbottom.style.height = crf*67 + "px";

		}
		if (jsres == 2)
		{
			boxleftcontentroute.style.height = crf*295 + crf*5 + "px";
			boxleftcontentbottom.style.height = crf*67 + "px";
		}
		
		
//		imgframeleft.style.display = "none";
	} else {
		// HERE
	}
	
	if (boxleftcontent != null && content_left_show_text_and_image == 1 && bLoaded == false && 2 == 2)
	{
		// top:		onsectetuer
		// bottom:	magna

		if (jsres == 0)
		{
			boxleftcontent.style.height = crf*78 + crf*11 + "px";
			boxleftcontentbottom.style.height = crf*67 + "px";
			
		}
		if (jsres == 1)
		{
			boxleftcontent.style.height = crf*78 + crf*12 + "px";
			boxleftcontentbottom.style.height = crf*67 + "px";

		}
		if (jsres == 2)
		{
			boxleftcontent.style.height = crf*78 + crf*5 + "px";
			boxleftcontentbottom.style.height = crf*67 + "px";
		}
		
		
//		imgframeleft.style.display = "none";
	} else {
		// HERE
	}



	if (qstr("debug") == "1") { RunDebug(); }
	show_first_center_image();
	if (site.style.visibility != "visible") site.style.visibility = "visible";

	boxbreadcrumb.style.left = rxpos(site.id) + "px";
	boxbreadcrumb.style.width = site.offsetWidth + "px";
	boxbreadcrumb.style.top = ryposObj(site) + site.offsetHeight + parseInt(crf*5) + "px";
	bLoaded = true


	
	if (g("content_text_center").style.display != "none")
	{
		browsearrows.style.display = "none";
	}
	if (jsimages.length == 0) browsearrowsupdown.style.display = "none";

	if (g("imgloading")) g("imgloading").style.display = "none";

	
	//alert(typeof(aEasyGo));

	/*
	if (aEasyGo) // && aMingle && aBusiness && aOtium)
	{
		//if (aEasyGo.length > 0 || aMingle.length > 0 || aBusiness.length > 0 || aOtium.length > 0) setInterval("RotateOffers()", 4000);
	}
	*/

}

function add_png_fix()
{
	if (navigator.userAgent.toLowerCase().indexOf("msie 7") > -1) return;
	pngimg = document.getElementsByTagName("img");
	for(var i = 0, len = pngimg.length; i < len; i++)
	{
		if (pngimg[i].src.toLowerCase().indexOf(".png") > -1)
		{
			pngimg[i].className += " overlay";
		}
	}
}

function setup_boxes()
{
	if (boxflag)
	{
		LEFTflag = 110 + boxflag.offsetWidth;
		TOPflag = 12 + 3;
		boxflag.style.paddingTop = crf*2 + "px";

		if (jsres == 1)
		{
			LEFTflag = 130 + boxflag.offsetWidth;
			TOPflag = 13 + 3;
			boxflag.style.paddingTop = crf*3 + "px";
		}
		if (jsres == 2)
		{
			LEFTflag = 160 + boxflag.offsetWidth;
			TOPflag = 11 + 3;
			boxflag.style.paddingTop = crf*4 + "px";
		}

		//boxflag.style.left = rxpos(site.id) + site.offsetWidth - boxflag.offsetWidth - LEFTflag + "px";
		boxflag.style.left = rxpos(site.id) + site.offsetWidth - boxflag.offsetWidth + "px";
		boxflag.style.top = rypos(site.id) + crf*21 - crf*14 + crf*TOPflag + "px";
		boxflag.style.border = "0px";
	}


	if (imglogotop)
	{
		imglogotop.style.left = rxpos(tdtop.id) + crf*24 - crf*10 + "px";
		imglogotop.style.top = rypos(tdtop.id) + tdtop.offsetHeight - imglogotop.offsetHeight - crf*resValue(10,11,11) + "px";

		if (adresstrelde)
		{
			LEFTadresstrelde = 20;
			TOPadresstrelde = -17;
			if (jsres == 1)
			{
				LEFTadresstrelde = 20;
				TOPadresstrelde = -17;
			}
			if (jsres == 2)
			{
				LEFTadresstrelde = 20;
				TOPadresstrelde = -17;
			}
		
			adresstrelde.style.left = rxpos(imglogotop.id) + crf*LEFTadresstrelde + "px";
			adresstrelde.style.top = rypos(imglogotop.id) + imglogotop.offsetHeight + crf*TOPadresstrelde + "px";
		}
	}

	if (imgumbrella && imglogotop)
	{
		LEFTimgumbrella = 0;
		TOPimgumbrella = 0;
		if (jsres == 0)
		{
			LEFTimgumbrella = 10;
			TOPimgumbrella = -5;
		}
		if (jsres == 1)
		{
			LEFTimgumbrella = 10;
			TOPimgumbrella = -4;
		}
		if (jsres == 2)
		{
			TOPimgumbrella = -6;
		}
		imgumbrella.style.left = rxpos(site.id) + rxpos(imglogotop.id) - rxpos(site.id) + imglogotop.offsetWidth + crf*85 + "px";
		imgumbrella.style.top = rypos(imglogotop.id) + TOPimgumbrella + "px";
	}

	if (downloadbrochure)
	{
		//td_top
		//downloadbrochure.style.left = crf*470 + "px";
		downloadbrochure.style.left = rxpos(site.id) + rxpos(imglogotop.id) - rxpos(site.id) + imglogotop.offsetWidth + crf*85 + "px";
		downloadbrochure.style.top  =  rypos(tdtop.id) + crf*43 + "px";
	}

	if (boxleft)
	{
		boxleft.style.left = rxpos(tdleft.id) + "px";
		boxleft.style.top = rypos(tdleft.id) + "px";
		boxleft.style.width = tdleft.offsetWidth + "px";
		boxleft.style.height = tdleft.offsetHeight + "px";
		
		HEIGHTboxleftcontent = 343*crf;
			HEIGHTboxleftcontentroute = 343*crf;
		TOPpadding = crf*12;

		HEIGHTboxleftcontent = 343*crf - contentleftheadline.offsetHeight - crf*12;
HEIGHTboxleftcontentroute = 343*crf - contentleftheadline.offsetHeight - crf*12;

		box_width = crf*175;
		box_top   = crf*4;
		if (contentleftheadline)
		{
			contentleftheadline.style.zIndex = 500;
			contentleftheadline.style.left = parseInt(tdleft.offsetWidth / 2) - parseInt(contentleftheadline.offsetWidth / 2) + "px";
			contentleftheadline.style.top = crf*4 + "px";
			contentleftheadline.style.width = crf*175 + "px";

			if (boxleftcontent)
			{
				boxleftcontent.style.width = crf*175 + "px";
				boxleftcontent.style.left = parseInt(tdleft.offsetWidth / 2) - parseInt(boxleftcontent.offsetWidth / 2) + "px";
				boxleftcontent.style.top = contentleftheadline.offsetHeight + crf*12 + "px";
				
				if (contentimageleft)
				{
					additionalTOP = 0;
					if (jsres == 1)
					{
						additionalTOP = crf*5;
					}
					if (jsres == 2)
					{
						additionalTOP = crf*0;
					}
					contentimageleft.style.left = ( tdleft.offsetWidth / 2 - contentimageleft.offsetWidth / 2 ) + "px";
					contentimageleft.style.top  = rypos(boxleftcontent.id) + boxleftcontent.offsetHeight - rypos(tdleft.id) + crf*10 + additionalTOP + "px";
					contentimageleft.style.backgroundColor = "#0000ff";
					
					if (boxleftcontentbottom)
					{

						tmp = parseInt(tdleft.offsetWidth / 2) - parseInt(boxleftcontentbottom.offsetWidth / 2);
						boxleftcontentbottom.style.left = tmp + "px";
						boxleftcontentbottom.style.top = -rypos(tdleft.id) + crf*20 + rypos(contentimageleft.id) + contentimageleft.offsetHeight + "px";
					}
				} else {
					HEIGHTboxlefcontent = 1;
					if (jsres == 0)
					{
						HEIGHTboxlefcontent = 310; // used to be 300
					}
					if (jsres == 1)
					{
						HEIGHTboxlefcontent = 310; // used to be 303
					}
					if (jsres == 2)
					{
						HEIGHTboxlefcontent = 310; // used to be 304
					}
					boxleftcontent.style.height = crf*HEIGHTboxlefcontent + "px";
				}
			}
			
						if (boxleftcontentroute)
			{
				boxleftcontentroute.style.width = crf*175 + "px";
				boxleftcontentroute.style.left = parseInt(tdleft.offsetWidth / 2) - parseInt(boxleftcontentroute.offsetWidth / 2) + "px";
				boxleftcontentroute.style.top = contentleftheadline.offsetHeight + crf*12 + "px";
				
				if (contentimageleft)
				{
					additionalTOP = 0;
					if (jsres == 1)
					{
						additionalTOP = crf*5;
					}
					if (jsres == 2)
					{
						additionalTOP = crf*0;
					}
					contentimageleft.style.left = ( tdleft.offsetWidth / 2 - contentimageleft.offsetWidth / 2 ) + "px";
					contentimageleft.style.top  = rypos(boxleftcontentroute.id) + boxleftcontentroute.offsetHeight - rypos(tdleft.id) + crf*10 + additionalTOP + "px";
					contentimageleft.style.backgroundColor = "#0000ff";
					
					if (boxleftcontentbottom)
					{

						tmp = parseInt(tdleft.offsetWidth / 2) - parseInt(boxleftcontentbottom.offsetWidth / 2);
						boxleftcontentbottom.style.left = tmp + "px";
						boxleftcontentbottom.style.top = -rypos(tdleft.id) + crf*20 + rypos(contentimageleft.id) + contentimageleft.offsetHeight + "px";
					}
				} else {
					HEIGHTboxleftcontentroute = 1;
					if (jsres == 0)
					{
						HEIGHTboxleftcontentroute = 310; // used to be 300
					}
					if (jsres == 1)
					{
						HEIGHTboxleftcontentroute = 310; // used to be 303
					}
					if (jsres == 2)
					{
						HEIGHTboxleftcontentroute = 310; // used to be 304
					}
					boxleftcontentroute.style.height = crf*HEIGHTboxleftcontentroute + "px";
				}
			}
		}
	}

	if (boxcenter)
	{
		boxcenter.style.height = crf*366 + "px";
		boxcenter.style.left = rxpos(tdcenter.id)+ crf*30 + "px";
		boxcenter.style.top = rypos(tdcenter.id) + "px";

		LEFTbrowsearrows = crf*6*0;
		browsearrows.style.left = rxpos(boxcenter.id) + LEFTbrowsearrows + "px";
		browsearrows.style.width = boxcenter.offsetWidth - 2*LEFTbrowsearrows + "px";
		browsearrows.style.top = rypos(boxcenter.id) + (boxcenter.offsetHeight/2) - (crf*33)/2 + "px";

		if (browsearrowsupdown && imgbrowsearrowsupdown)
		{
			browsearrowsupdown.style.left = rxpos(boxcenter.id) + boxcenter.offsetWidth - crf*42 - crf*1 + "px";
			browsearrowsupdown.style.top = rypos(boxcenter.id) + crf*2*0 + "px"; // *0
			browsearrowsupdown.style.display = "";
			if (show_image_instead_of_text == 1) showhideimagelist();
			if (page_has_center_text == 0) imgbrowsearrowsupdown.style.display = "none";
		}

	}
	bg_content_offers.style.left = rxpos(boxleft.id) + "px";
	bg_content_offers.style.top = rypos(boxcenter.id) + boxcenter.offsetHeight + "px";

	if (tdright)
	{
		contentmenuright.style.left = rxpos(tdright.id) + (tdright.offsetWidth / 2) - (contentmenuright.offsetWidth / 2) + 10 + "px";
		contentmenuright.style.top = rypos(tdright.id) + crf*10 + "px";
	}

	if (browseimages)
	{
		browseimages.style.left = rxpos(boxcenter.id) + boxcenter.offsetWidth - browseimages.offsetWidth - crf*5  + "px";
		browseimages.style.top  = rypos(boxcenter.id) + crf*5 + "px";
	}
}

function setup_tabs()
{

	// setup tabs for: Tilbud, Booking, Kontakt
	if (tabtilbud && tabbooking && tabkontakt && offerone)
	{
		total_tabs_width = tabtilbud.offsetWidth + tabbooking.offsetWidth + tabkontakt.offsetWidth - 4*2;
		LEFTtabs = (offerone.offsetWidth / 2) - (total_tabs_width / 2);

		tabtilbud.style.left = rxpos(offerone.id) + LEFTtabs + "px";
		tabtilbud.style.top  = rypos(boxcenter.id) + boxcenter.offsetHeight - tabtilbud.offsetHeight/2 - crf*3 + "px";
		
		tabtilbudon.style.left = rxpos(offerone.id) + LEFTtabs + "px";
		tabtilbudon.style.top  = rypos(boxcenter.id) + boxcenter.offsetHeight - tabtilbud.offsetHeight/2 - crf*3 + "px";

		tabbooking.style.left = rxpos(tabtilbud.id) + tabtilbud.offsetWidth - crf*4 + "px";
		tabbooking.style.top = rypos(tabtilbud.id) - 50*0 + "px";

		tabbookingon.style.left = rxpos(tabtilbud.id) + tabtilbud.offsetWidth - crf*4 + "px";
		tabbookingon.style.top = rypos(tabtilbud.id) - 50*0 + "px";
		
		tabkontakt.style.left = rxpos(tabbooking.id) + tabbooking.offsetWidth - crf*4 + "px";
		tabkontakt.style.top = rypos(tabtilbud.id) + "px";

		tabkontakton.style.left = rxpos(tabbooking.id) + tabbooking.offsetWidth - crf*4 + "px";
		tabkontakton.style.top = rypos(tabtilbud.id) + "px";
	}
	
	// setup tabs for: Gæstebog, Print
	if (tabtilbud && tdright && tabgaestebog && tabprint && total_tabs_width)
	{

		total_tabs_width = tabgaestebog.offsetWidth + tabprint.offsetWidth - 4*1;
		LEFTtabgaestebog = tdright.offsetWidth / 2 - total_tabs_width / 2;

		tabgaestebog.style.left = rxpos(tdright.id) + LEFTtabgaestebog + "px";
		tabgaestebog.style.top = rypos(tabtilbud.id) + "px";

		tabprint.style.left = rxpos(tabgaestebog.id) + tabgaestebog.offsetWidth - crf*4 + "px";
		tabprint.style.top = rypos(tabgaestebog.id) + "px";
	}

	if (subtopmenu && trtop)
	{
		if (subtopmenu_resized == false)
		{
			subtopmenu_resized = true;
			subtopmenu.style.width = subtopmenu.offsetWidth + crf*12 + "px";
		}

		LEFTsubtopmenu = 0;
		if (jsres == 1)
		{
			/*
			if (navigator.userAgent.toLowerCase().indexOf("msie 6") > -1)
			{
				LEFTsubtopmenu = -1*10;
				//g("bg_top").style.width = 1210 + "px";
			}
			*/
		}
		if (jsres == 2)
		{
			LEFTsubtopmenu = 0*crf*5;
		}

		subtopmenu.style.left = rxpos(site.id) + site.offsetWidth - subtopmenu.offsetWidth + LEFTsubtopmenu + "px";
		subtopmenu.style.top  = rypos(trtop.id) + trtop.offsetHeight - subtopmenu.offsetHeight + "px";
	} else {
		alert("subtopmenu or trtop does not exist");
	}
}

function setup_content_images()
{
	if (tdright)
	{
		if (imgcontentrighttop && show_top_right_image)
		{
			spaceTop = crf*16;

			TOPimgcontentrighttop = crf*0;
			TOPimgcontentrighttop = spaceTop + TOPimgcontentrighttop;

			imgcontentrighttop.style.left = rxpos(tdright.id) + ( tdright.offsetWidth / 2 - imgcontentrighttop.offsetWidth / 2 ) + "px";
			imgcontentrighttop.style.top = rypos(tdright.id) + TOPimgcontentrighttop + "px";



			if (imgframerighttop)
			{
				LEFTimgcontentrightbottom = crf*0;
				TOPimgcontentrighttop = -crf*4;
				if (jsres == 2)
				{
					LEFTimgcontentrightbottom =  crf*1;
					TOPimgcontentrighttop = -4;
				}

				imgframerighttop.style.left = rxpos(imgcontentrighttop.id) - crf*4 + LEFTimgcontentrightbottom + "px";
				imgframerighttop.style.top = rypos(imgcontentrighttop.id) + TOPimgcontentrighttop + "px";
			}


		}

		if (imgcontentrightbottom && show_bottom_right_image)
		{
			spaceTop = crf*175+4;
			TOPimgcontentrightbottom = crf*0;
			TOPimgcontentrightbottom = spaceTop + TOPimgcontentrightbottom;

			imgcontentrightbottom.style.left = rxpos(tdright.id) + ( tdright.offsetWidth / 2 - imgcontentrightbottom.offsetWidth / 2 ) + "px";
			imgcontentrightbottom.style.top = rypos(tdright.id) + TOPimgcontentrightbottom + "px";

			if (imgframerightbottom)
			{
				LEFTimgcontentrightbottom =  - crf*5
				TOPimgcontentrightbottom  = -crf*4;
				if (jsres == 1)
				{
					LEFTimgcontentrightbottom =  -crf*4;
					TOPimgcontentrightbottom  = crf*-4;
				}
				if (jsres == 2)
				{
					LEFTimgcontentrightbottom =  -crf*2;
					TOPimgcontentrightbottom = crf*-3;
				}
				imgframerightbottom.style.left = rxpos(imgcontentrightbottom.id) + LEFTimgcontentrightbottom + "px";
				imgframerightbottom.style.top = rypos(imgcontentrightbottom.id) + TOPimgcontentrightbottom + "px";
			}
		}

		/**/

		if (imgframeleft && contentimageleft && 2 == 2)
		{

			LEFTimgframeleft = -crf*22;
			TOPimgframeleft	 = -crf*115;

			if (jsres == 1)
			{
				LEFTimgframeleft =  -crf*24;
				TOPimgframeleft  = -crf*156;
			}

			if (jsres == 2)
			{
				LEFTimgframeleft = -crf*25;
				TOPimgframeleft  = -crf*125;
			}

			if (jsres == 1)
			{
				//imgframeleft.style.left = rxpos(contentimageleft.id) + LEFTimgframeleft + "px";
				//imgframeleft.style.top  = rypos(contentimageleft.id) + TOPimgframeleft  + "px";
			}

			// FRAME HERE
			MoveLeft_imgframeleft = -crf*4;
			MoveTop_imgframeleft  = -crf*4;

			if (jsres == 0)
			{
				MoveLeft_imgframeleft	+= crf*0;
				//MoveTop_imgframeleft	+= crf*2;
			}

			if (jsres == 1)
			{
				MoveLeft_imgframeleft	+= -1;
				MoveTop_imgframeleft	+= -1;
			}

			if (jsres == 2)
			{
				MoveLeft_imgframeleft	+= crf*1;
				MoveTop_imgframeleft	+= crf*2;
			}

			imgframeleft.style.left = 0 + rxpos(contentimageleft.id) - rxpos(tdleft.id) + MoveLeft_imgframeleft + "px";
			imgframeleft.style.top  = 0 + rypos(contentimageleft.id) - rypos(tdleft.id) + MoveTop_imgframeleft  + "px";
		}

	}

}

function show_tabs()
{
	divs = document.getElementsByTagName("div");
	for(var i = 0, len = divs.length; i < len; i++)
	{
		div = divs[i];
		if (div.className.indexOf("tab") > -1)
		{
			//div.style.display = "";
		}
	}
}

var ndx = 0;
function showimage()
{
	if (jsimages)
	{
		if (jsimages.length > 1)
		{
			if (ndx < 0) ndx = jsimages.length - 1;
			else if (ndx > jsimages.length - 1) ndx = 0;

			if (jsimages == null)
			{
				alert("array, jsimages, is null");
			} else {
				if (contentimagecenter == null)
				{
					g("browse_arrows").style.display = "none";
					//alert("Center image not found");
					return;
				}
				contentimagecenter.setAttribute("src", jsimages[ndx]);
			}
		} else {
			browsearrows.style.display = "none";
		}
	}
}

function show_first_center_image()
{
	if (typeof(jsimages) == "undefined")
	{
		alert("jsimages array does not exist");
		return;
	}

	if (jsimages.length > 0)
	{
		if (g("browse_arrows") == null)
		{
			alert("browse_arrows does not exist.\nFile: _js_setup.js\nFunction: show_first_center_image()");
		}
		if (jsimages.length > 1 && g("browse_arrows"))
		{
			g("browse_arrows").style.display = "";
		}
		showimage();
	}
}

function getCoors(obj)
{
	if (obj)
	{
		return rxpos(obj.id) + "," + rypos(obj.id)
	}
}

bUpDown = 0;
if (show_image_instead_of_text == 1) bUpDown = 0;
function showhideimagelist()
{
	path = "../gfx/browse_arrows/" + jsres + "/browse_arrow_$dir$.gif";
	if (bUpDown == 1)
	{
		path = path.replace("$dir$","down");
	} else {
		path = path.replace("$dir$","up");
	}

	if (imgbrowsearrowsupdown)
	{
		title = " hello world ";
		if (path.indexOf("up") > -1)
		{
			contentimagecenter.style.display = "block";
			g("content_text_center").style.display = "none";
			boxcenter.style.overflow = "hidden";
			if (jsimages.length > 1) browsearrows.style.display = "block";
			title = " Vis tekst ";
			bUpDown = 1;
		} else {
			contentimagecenter.style.display = "none";
			g("content_text_center").style.display = "block";
			boxcenter.style.overflow = "auto";
			browsearrows.style.display = "none";
			title = " Vis billede ";
			bUpDown = 0;
		}
		imgbrowsearrowsupdown.setAttribute("src", path);
	}
}

function infoboxhint(txt, obj)
{
	if (obj == null)
	{
		infobox.style.display = "none";
		infobox.firstChild.nodeValue = "";
		return;
	}
	if (infobox)
	{
		infobox.style.display = "";
		if (infobox.childNodes.length == 0) infobox.appendChild(document.createTextNode(""));
		infobox.firstChild.nodeValue = txt;
		if (infobox.offsetWidth > crf*125)  infobox.style.width = crf*125 + "px";
		infobox.style.left = rxposObj(obj) - infobox.offsetWidth / 2 + "px";
		infobox.style.top = ryposObj(obj) + obj.offsetHeight + crf*10 + "px";
	} else {
		alert("info_box does not exist");
	}
}

function RunDebug()
{
	alert("RunDebug, _js_setup.js");
}

ndxEasyGo = ndxMingle = ndxBusiness = ndxOtium = 0;
function RotateOffers()
{
	/*
	//return false;
	if (aEasyGo.length		> 0 && aEasyGo		)		ndxEasyGo	= __rotate_offer(aEasyGo, ndxEasyGo, "one");
	if (aMingle.length		> 0 && aMingle		)		ndxMingle	= __rotate_offer(aMingle, ndxMingle, "two");
	if (aBusiness.length	> 0 && aBusiness	)		ndxBusiness = __rotate_offer(aBusiness, ndxBusiness, "three");
	if (aOtium.length		> 0 && aOtium		)		ndxOtium	= __rotate_offer(aOtium, ndxOtium, "four");
	*/
}

function __rotate_offer(a, n, on)
{
		if (n > a.length - 1) n = 0;

		id = a[n][0];
		summary = a[n][1];
		price = a[n][2];

		g("s_offer_" + on).href = SetOfferURL("" + id);
		g("a_offer_frame_" + on).href = SetOfferURL("" + id);
		g("p_offer_" + on).href = SetOfferURL("" + id);
		if (g("s_offer_" + on).childNodes.length == 1) AddToNode(g("s_offer_" + on), summary);
		if (g("s_offer_" + on).childNodes.length == 1) AddToNode(g("p_offer_" + on), price);
		n++;
		return n;
}

function SetOfferURL(id)
{
	url = window.location.href.toLowerCase();
	qs = qe = "";
	if (url.indexOf("&t=") > -1)
	{
		qs = url.substring(0, url.indexOf("&t=") + 3);
		qs += id;

		qe = url.substring(url.indexOf("&t=") + 3);
		if (qe.indexOf("&") > -1) qs += qe;
	} else {
		qs = url + "&t=" + id;
	}
	return qs;
}

function AddToNode(obj,txt)
{
	if ( obj.childNodes[0] == undefined) obj.appendChild(document.createTextNode(""));
	obj.childNodes[0].nodeValue = "" + txt;
}

