﻿//setTimeout("window.location.reload(true)", 1000 * 60 * 10);



var site					= null;
var secTop					= 0;
var siteLeft				= 0;
var siteTop					= 0;
var siteRight				= 0;
var siteBottom				= 0;
var siteWidth				= 0;
var siteHeight				= 0;

var arrScrollers			= new Array();
var scrollerCount			= 0;
var defaultScrollbarHeight	= -1;

var intX = intY = intW = intH = 0;

var blnDoShowContents = 0;
var blnSlideInProgress = 0;

var intInfoboxWidthExtra = 0;
var intInfoboxInitialWidth = 0;

var isM = (window.location.search.indexOf("&m=1") != -1);

function setup_global()
{
	if (g("divSiteMaster") == null)
	{
		alert("The site (divSiteMaster) was not detected. Stop.");
		return;
	} else {
		initialize();
	}
}

function initialize()
{
	//setInterval("document.title = g('divInfoboxBottomMaster').offsetHeight", 100);


	if(window.captureEvents){
		window.onmousemove=sourceCheck;
	} else {
		document.onmousemove=sourceCheck;
	}
	if (window.location.href.toLowerCase().indexOf("print.asp")  > -1 ) return;

	siteMaster = g("divSiteMaster");
	site = g("divSite");
	reposition();

	if (blnFirstRun == true)
	{
		g("divSite").style.width  = ( ("" + pg == "0")? g("divSiteMaster").offsetWidth : crf*747) + "px"; //765
		g("divSite").style.height = g("divSiteMaster").offsetHeight + "px";

		preload_images();
		if (is_ie && !is_ie7) addPngFix();
	}
	

	
	if (g("tblProgress"))
	{
		var objTableProgressBackground = g("tblProgress");
		var objTableProgressBackgroundURL = "";
		if (is_firefox)
		{
			objTableProgressBackgroundURL = "url('img/bg_table_progress_ff_" + jsres + ".png')";
		} else {
			if (is_ie)
			{
				if (is_ie6)
				{
					objTableProgressBackgroundURL = "url('img/bg_table_progress_ie6_" + jsres + ".png')";
				} else {
					objTableProgressBackgroundURL = "url('img/bg_table_progress_ie7_" + jsres + ".png')";
				}
			}
		}
		objTableProgressBackground.style.backgroundImage = objTableProgressBackgroundURL;
	}

	setupContents();

		iEmployee = 1;
		if (arrVPath.length > 2) iEmployee = 2;
		intExtraX_employee = 0;
		intExtraY_employee = 0;

		if ((jsres == 1 || jsres == 2) && (is_ie6 || is_ie7))
		{
			intExtraX_employee = -1;
		}


		hhmm = "";

		//alert( objTable = g("tblEmployee" + iEmployee) );

		intBackgroundPosition = 0;
		if (jsres == 0)
		{
			if (is_firefox )
			{
				intBackgroundPosition = 1;
			}
		}

		if (is_ie)
		{
			intBackgroundPosition = 1;
		}

		while( ( objTable = g("tblEmployee" + iEmployee) ) != null)
		{
			id = iEmployee; //-1;
			objTable = g("tblEmployee" + (id));
			if (objTable)
			{
				objTable.style.backgroundPosition = intBackgroundPosition + "px";
				objTable.onclick     = function() { window.location.href = this.getAttribute("url"); };
				//objTable.onmouseover = function() { document.title = "hit"; };
				objTable.onmouseover = function() { swapPhoto(this,1); obj = this.getElementsByTagName("img"); if (obj.length > 0) obj[0].setAttribute("src","img/arrow_red_left_" + jsres + ".png"); window.status = this.getAttribute("url"); }
				objTable.onmouseout  = function() { swapPhoto(this,0); obj = this.getElementsByTagName("img"); if (obj.length > 0) obj[0].setAttribute("src","img/arrow_lightgray_left_" + jsres + ".png"); window.status = ""; }
				
				tds = objTable.getElementsByTagName("td");
				for(i = 0, len = tds.length; i < len; i++)
				{
					//tds[i].onmouseover = function() { obj = this.parentNode.getElementsByTagName("img"); if (obj.length > 0) obj[0].setAttribute("src","img/arrow_red_left_" + jsres + ".png"); }
					//tds[i].onmouseout  = function() { obj = this.parentNode.getElementsByTagName("img"); if (obj.length > 0) obj[0].setAttribute("src","img/arrow_lightgray_left_" + jsres + ".png"); }
				}
				
			}
/*


			objTable.style.height = crf*(82+intExtraH_table)  + "px"; // 70
			objTable.style.position = "absolute";
			objTable.style.left = 0 + "px";
			objTable.style.top  = 0 + "px";
			objTable.style.marginLeft = 200 + "px";



*/
			////objArrow = g("imgArrowEmployeeNew" + id)
			////objArrow.style.position = "absolute";
			////objArrow.style.zIndex = 101;
			////objArrow.style.left = rxpos(objTable.id) + resvalue(2,3,4) + "px";
			////objArrow.style.top  = rypos(objTable.id) + resvalue(2,2,2) + "px";

			objEmployee = g("imgEmployeeNew" + id);
			if (objEmployee)
			{
				objEmployee.style.marginRight = resvalue(1,1,2)  + intExtraX_employee + "px";
				objEmployee.style.marginTop  = resvalue(1,1,1) + intExtraY_employee + "px";
				//objEmployee.style.visibility = "hidden";
			}



			/*
			objEmployee.style.position = "absolute";
			objEmployee.style.left = 200 + "px";
			objEmployee.style.marginLeft = resvalue(8,11,14)  + intExtraX_employee + "px";
			objEmployee.style.marginTop  = resvalue(-5,-7,-9) + intExtraY_employee + "px";
			*/

			if (hhmm == "")
			{
				//alert("yyeepp")
				hhmm = "hhmm";
			}

			iEmployee++;
		}

/*
	intStartX = 500;
	intStartW = 135
	g("me").style.width = crf*intStartW + "px"
	g("me").style.left = crf*intStartX + "px";
	g("me").style.top  = crf*10 + "px";
*/


	/*
	if (2==2)
	{
		iEmployee = 1;

		intExtraX_employee = 0;
		intExtraY_employee = 0;
		intExtraH_table = 0;

		if (jsres == 0)
		{
			if (is_ie6)
			{
				intExtraX_employee = 1;
				intExtraH_table = -12;
			}
			if (is_ie7)
			{
				intExtraX_employee = 0;
				intExtraH_table = -12;
			}
		}

		if (jsres == 1)
		{
			if (is_ie6)
			{
				intExtraX_employee = 1;
			}
		}

		//alert( g("imgEmployeeNew" + 2 ) );

		hhmm = "";
		while( ( objArrow = g("imgArrowEmployeeNew" + iEmployee++) ) != null)
		{
			id = iEmployee-1;

			objTable = g("tblEmployeeNew" + id);
			objTable.style.height = crf*(82+intExtraH_table)  + "px"; // 70
			objTable.style.position = "absolute";
			objTable.style.left = 0 + "px";
			objTable.style.top  = 0 + "px";
			objTable.style.marginLeft = 200 + "px";

			objTable.onclick     = function() { alert(this.getAttribute("url")) };
			objTable.onmouseover = function() { g("imgArrowEmployeeNew" + (id)).setAttribute("src","img/arrow_red_left_" + jsres + ".png"); }
			objTable.onmouseout  = function() { g("imgArrowEmployeeNew" + (id)).setAttribute("src","img/arrow_lightgray_left_" + jsres + ".png"); }

			objArrow.style.position = "absolute";
			objArrow.style.zIndex = 101;
			objArrow.style.left = rxpos(objTable.id) + resvalue(2,3,4) + "px";
			objArrow.style.top  = rypos(objTable.id) + resvalue(2,2,2) + "px";

			objEmployee = g("imgEmployeeNew" + id);
			objEmployee.style.position = "absolute";
			objEmployee.style.left = 200 + "px";
			objEmployee.style.marginLeft = resvalue(8,11,14)  + intExtraX_employee + "px";
			objEmployee.style.marginTop  = resvalue(-5,-7,-9) + intExtraY_employee + "px";

			if (hhmm == "")
			{
				alert("yyeepp")
			}
		}
	}
	/**/


	removeDottedBorderFromlinks()
}

function reposition()
{	
	siteleft = ( pageWidth / 2)  - (siteMaster.offsetWidth / 2);
	sitetop  = ( pageHeight / 2) - (siteMaster.offsetHeight / 2) ; //- (boxbreadcrumb.offsetHeight / 2)
	siteMaster.style.left = ( (siteleft > 0)?siteleft:0 ) + "px";
	siteMaster.style.top = ( (sitetop > 0)?sitetop-2:0 ) + "px";

	site.style.left = rxpos("divSiteMaster") + "px";
	site.style.top  = rypos("divSiteMaster") + "px";
}

function addPngFix()
{
	c = 0;
	pngimg = document.getElementsByTagName("img");
	for(var i = 0, len = pngimg.length; i < len; i++)
	{
		if (pngimg[i].src.toLowerCase().indexOf(".png") > -1)
		{
			classname = pngimg[i].className.toLowerCase();
			if (classname.indexOf("nopng") == -1 && classname.indexOf("overlay") == -1)
			{
				pngimg[i].className += " overlay";
				//pngimg[i].setAttribute("src", pngimg[i].src);
				c = pngimg[i].id;
			}
		}
	}
	//alert("pngfixed: " + c);
}

function setupContents()
{
	//alert(g("divSite").offsetWidth);

	if (g("divLogo")) // setup logo
	{
		intX = 0;
		intY = 0;
		if (pg == 0)
		{
			intX = rxpos("divSite") + crf*31; // 1
			intY = rypos("divSite") + crf*17; // 16
		} else {
			intX = rxpos("divSite") + crf*(12+8);
			intY = rypos("divSite") + crf*(6+3);
		}
		g("divLogo").style.left = intX + "px";
		g("divLogo").style.top  = intY + "px";
	}

	

	if (g("divTabsTopLeft"))
	{
		g("divTabsTopLeft").style.left = rxpos("divSite") + "px";
		g("divTabsTopLeft").style.top  = rypos("divSite") + crf*62 + "px";
	}

	if (intMenuTabs == 3) // show 3 menuitems, articles
	{
		if (g("divMenuTabsTop"))
		{
			g("divMenuTabsTop").style.left = right("divSite") - resvalue(1,1,1) + "px";
			g("divMenuTabsTop").style.top  = top("divSite") + "px";
		}

			
		if (g("tblMenuContact"))
		{
			intExtra = resvalue(0,0,1);
			if (jsres == 2)
			{
				if (is_ie6)
				{
					intExtra = 1;
				}
			}
			g("tblMenuContact").style.left = left("divSite") + intExtra + "px";
			g("tblMenuContact").style.top  = top("divSite")  + crf*61 + "px";

			if (g("tblMenuProfile"))
			{
				g("tblMenuProfile").style.left = right("tblMenuContact") + crf*15 + "px";
				g("tblMenuProfile").style.top  = top("tblMenuContact") + "px";

				if (g("tblMenuNews"))
				{
					g("tblMenuNews").style.left = right("tblMenuProfile") - 1 + "px";
					g("tblMenuNews").style.top  = top("tblMenuProfile") + "px";

					if (g("tblMenuSkills"))
					{
						g("tblMenuSkills").style.left = right("tblMenuNews") + crf*15 + "px";
						g("tblMenuSkills").style.top  = top("tblMenuNews") + "px";

						if (g("tblMenuProjects"))
						{
							g("tblMenuProjects").style.left = right("tblMenuSkills") - 1 + "px";
							g("tblMenuProjects").style.top  = top("tblMenuSkills") + "px";
						}
					}

				}

			}

// tblMenuSkills
// tblMenuProjects
			

		}
		
		/*
		if (g("tblTopLeftMenu"))
		{
			g("tblTopLeftMenu").style.left = 0*200 + left("divSite") + 1 + "px";
			g("tblTopLeftMenu").style.top  = 0*20  + top("divSite") + crf*61 + "px";
		}
		*/

		/*
		if (g("tblMenuTopLeftContact"))
		{
			g("tblMenuTopLeftContact").style.left = left("divSite") + "px";
			g("tblMenuTopLeftContact").style.top  = top("divSite") + crf*62 + "px";

			if (g("tblMenuTopLeftProfile"))
			{
				g("tblMenuTopLeftProfile").style.left = right("tblMenuTopLeftContact") + crf*10 + "px";
				g("tblMenuTopLeftProfile").style.top  = top("tblMenuTopLeftContact") + "px";

				if (g("tblMenuTopLeftNews"))
				{
					g("tblMenuTopLeftNews").style.left = right("tblMenuTopLeftProfile") + (is_ie?-1:0) + "px";
					g("tblMenuTopLeftNews").style.top  = top("tblMenuTopLeftProfile") + "px";
				}
			}
		}
		*/


		if (g("divMenuRight"))
		{
			g("divMenuRight").style.left = right("divSite") + crf*12 + "px";
			g("divMenuRight").style.top  = bottom("divSite") - g("divMenuRight").offsetHeight + "px";

			if (g("divMenuRightContents"))
			{
				intExtraX = 0;
				intExtraY = 0;
				if (pg == 1)
				{
					intExtraX = crf*28;
					intExtraY = crf*-19;
				}
				if (pg == 4)
				{
					intExtraX = crf*2;
					intExtraY = crf*76;
					g("divMenuRightContents").style.width  = crf*150 + "px";
					g("divMenuRightContents").style.height = crf*300 + "px";
					//g("divMenuRightContents").style.paddingLeft = crf*3 + "px";
					//g("divMenuRightContents").style.backgroundColor = "#fff0f0";
					g("divMenuRightContents").style.overflow = "hidden";
				}
				g("divMenuRightContents").style.left = left("divMenuRight") + crf*11 + intExtraX + "px";
				g("divMenuRightContents").style.top  = top("divMenuRight")  + crf*19 + intExtraY + "px";

				if (pg == 1)
				{
					if (g("divMasterEmployees"))
					{
						createScrollbar("employees", "divMasterEmployees", "divDocumentEmployees", right("divMasterEmployees") + crf*5, 0, 999);
					}
				}
			}
			
			if (g("tblInfoBoxTopPart"))
			{
				g("tblInfoBoxTopPart").style.width = crf*135 + "px";
				intInfoboxInitialWidth = g("tblInfoBoxTopPart").offsetWidth;
				g("tblInfoBoxTopPart").style.left = right("divMenuRight") - g("tblInfoBoxTopPart").offsetWidth + "px";
				g("tblInfoBoxTopPart").style.top  = top("divMenuRight") + resvalue(0,1,0) + "px";

				//tblInfoBoxTopPart_part_1, imgInfoBoxTopPart_part_1, tdInfoboxTopContents, imgInfoBoxTopPart_part_2

				if (is_ie6)
				{
					myheight = 70;
				}

				/*
				if (g("tblInfoBoxTopPart_part_1")) g("tblInfoBoxTopPart_part_1").style.height = crf*myheight + "px";
				if (g("imgInfoBoxTopPart_part_1")) g("imgInfoBoxTopPart_part_1").style.height = crf*myheight + "px";
				if (g("tdInfoboxTopContents")) g("tdInfoboxTopContents").style.height = crf*myheight + "px";
				if (g("imgInfoBoxTopPart_part_2")) g("imgInfoBoxTopPart_part_2").style.height = crf*myheight + "px";
				*/

				if (
					/*
					g("divInfoboxTopArrow")
					&&*/
					g("tdInfoboxTopFade")
					&&
					g("divInfoboxTopFade"))
				{
					if (is_ie6)
					{
						/*
						var hmm = resvalue(69,86,108);
						//g("divInfoboxTopArrow").style.height = hmm + "px";
						g("tdInfoboxTopFade").style.height   = hmm + "px";
						g("divInfoboxTopFade").style.height  = hmm + "px";
						*/
					}
				}

				if (g("tdInfoboxTextBottom"))
				{
					intHeight = 0;
					if (is_firefox)	intHeight = resvalue(37,46,59);
					if (is_ie)		intHeight = resvalue(34,43,55);
					g("tdInfoboxTextBottom").style.height = intHeight + "px";
				}

				if (g("tdInfoboxTextMenuOnly"))
				{
					intHeight = 0;
					if (is_firefox)	intHeight = resvalue(69,86,108);
					if (is_ie)		intHeight = resvalue(68,84,106);
					g("tdInfoboxTextMenuOnly").style.height = intHeight + "px";
				}

				if (g("tdSpecificProjectCategoryOnly"))
				{
					intHeight = 0;
					if (is_firefox)	intHeight = resvalue(69,85,108);
					if (is_ie)		intHeight = resvalue(67,83,106);
					g("tdSpecificProjectCategoryOnly").style.height = intHeight + "px";
				}

				if (g("tdSpecificProjectCategoryAndSub"))
				{
					intHeight = 0;
					if (is_firefox)	intHeight = resvalue(37,45,58);
					if (is_ie)		intHeight = resvalue(68-35,84-42-1,106-52); // (68,84,106)
					g("tdSpecificProjectCategoryAndSub").style.height = intHeight + "px";
				}

				if (g("tdSpecificProject"))
				{
					intHeight = 0;
					if (is_firefox)	intHeight = resvalue(38-1,46-1,58);
					if (is_ie)		intHeight = resvalue(68-35,84-42,106-52);
					g("tdSpecificProject").style.height = intHeight + "px";
				}

				

				if (g("tblInfoBoxBottomPart"))
				{
					intLeft = resvalue(-1,-2,0);
					if (is_ie6)
					{
						if (jsres == 1)
						{
							intLeft = -2;
						}

						if (jsres == 2)
						{
							intLeft = 0;
						}

					}
					g("tblInfoBoxBottomPart").style.left = rxpos("divSite") + resvalue(361,451,557) + intLeft + "px";
					g("tblInfoBoxBottomPart").style.top  = rypos("divSite") + crf*170 - crf*50 + "px";
					if (is_ie6)
					{
						g("tblInfoBoxBottomPart").style.width = resvalue(370,369,369) + "px";
						td = g("tblInfoBoxBottomPart").childNodes[0].childNodes[0].childNodes[0];
						td.style.width = 2 + "px";
						g("divInfoboxBottomMaster").style.top = resvalue(10,10,10) + "px";
						
					}
					if (is_firefox)
					{
						g("divInfoboxBottomMaster").style.marginLeft = resvalue(24,30,36) + "px";
					}
					//g("divInfoboxBottomMaster").style.height = crf*10 + "px";

				}

				//locate("divHideLeftSideOfMenuRight")
				//g("divHideLeftSideOfMenuRight").style.display = "none";

				if ( blnShowProgress == 1 && g("tblProgress"))
				{
					intExtra = 0;
					if (is_ie6)
					{
						intExtra = resvalue(-0,-0,-0);
					}
					g("imgInfoboxTopArrow").style.display = "none";
					g("tblProgress").style.left = rxpos("divSite") + resvalue(165,230,337) + intExtra + "px";
					g("tblProgress").style.top  = rypos("tblInfoBoxTopPart") + "px";
					g("imgProgressArrow").style.left = rxpos("tblProgress") + crf*12 + "px";
					g("imgProgressArrow").style.top  = rypos("tblProgress") + crf*64 + "px";

					createLine(
						rxpos("divProgress") + resvalue(10,10,20),
						rypos("divProgress") + resvalue(2,2,3),
						1,
						g("divProgress").offsetHeight - crf*3,
						"#858789",
						1500,
						"lineProgress"
					);

					intLeft = 0;
					intTop = 0;
					if (is_ie)
					{
						intLeft = 1;
					}

					g("imgProgressArrowTip").style.left = rxpos("lineProgress") - g("imgProgressArrowTip").offsetWidth / 2 + intLeft + "px";
					g("imgProgressArrowTip").style.top  = rypos("lineProgress") + g("lineProgress").offsetHeight - g("imgProgressArrowTip").offsetHeight + intTop + "px";
					
					g("lineProgress").style.visibility = "hidden";
					g("imgProgressArrowTip").style.visibility = "hidden";
				}


				if (g("imgMenuRightHide") && 2 == 2)
				{
					g("imgMenuRightHide").style.left = left("divMenuRight") + "px";
					g("imgMenuRightHide").style.top  = top("divMenuRight") + resvalue(0,1,0) + "px";
					//locate("imgMenuRightHide")
					//g("imgMenuRightHide").style.display = "none";
					g("divHideLeftSideOfMenuRight").style.display = "none";
				}


				if (g("divHideHideMenuRight") && 2 == 2)
				{
					g("divHideHideMenuRight").style.left = left("divMenuRight") + 1 + "px";
					g("divHideHideMenuRight").style.top  = top("divMenuRight")  + 2 + "px";

					//g("divHideLeftSideOfMenuRight").style.display = "none";
				}
				blnDoShowContents = 1;

				if (jsres == 2 || is_ie)
				{
					var intHeight = 120;
					if (is_ie6)
					{
						intHeight = 139;
					}

					if (is_ie && (jsres == 0 || jsres == 1))
					{
						intHeight = 0;
					}

					if (g("imgMenuRightHide"))
					{
						if (blnShowInfobox == 1)
						{
							intExtraX = 0;
							if (jsres == 2) intExtraX = 2*0;
							createTransImage(
								"transImageMenuRight_one",
								rxpos("imgMenuRightHide") + intExtraX,
								rypos("imgMenuRightHide") + 10,
								crf*2,
								intHeight,
								"#ffffff",
								999999
							);
							intExtraX = 0;
						}
						
						createTransImage(
							"transImageMenuRight_two",
							rxpos("imgMenuRightHide") + 1,
							rypos("imgMenuRightHide") + 10,
							1,
							resvalue(122,0,142),
							"#ffffff",
							999999
						);
					}
				}
				
				if (g("imgMenuRightHide"))
				{
					createTransImage(
						"removeHorizontalLineInMenuRight",
						rxpos("imgMenuRightHide") + 2,
						rypos("imgMenuRightHide") + 10,
						crf*171,
						100,
						"#ffffff",
						9989
					)
				}
			}
		}
	} else { // show 6 menuitems, sliding images, text below sliding images

//	if (intXMenuTabs == 6) // show 6 menuitems, sliding images, text below sliding images
//	{

		/*
		if (g("divSlidingImages"))
		{
			g("divSlidingImages").style.left = rxpos("divSite") + g("divSite").offsetWidth / 2 - g("divSlidingImages").offsetWidth / 2 + "px";
			g("divSlidingImages").style.top  = rypos("divSite") + crf*123 + "px";

			g("imgArrowLeft").style.left = rxpos("divSlidingImages") - g("imgArrowLeft").offsetWidth - crf*8 + "px";
			g("imgArrowLeft").style.top  = centerVert("imgArrowLeft", "divSlidingImages") + "px";
			
			g("imgArrowRight").style.left = rxpos("divSlidingImages") + g("divSlidingImages").offsetWidth + crf*8 + "px";
			g("imgArrowRight").style.top  = rypos("imgArrowLeft") + "px";
		}
		*/


		/* ------------ image-scroller ------------ */
		if (g("tblImageScroller"))
		{
			if (is_opera)
			{
				g("tblImageScroller").cellSpacing = resvalue(5,5,6) + "px";
			}

			if (is_ie)
			{
				g("tblImageScroller").cellSpacing = resvalue(5,5,6) + "px";
			}

			if (is_firefox)
			{
				g("tblImageScroller").cellSpacing = resvalue(7,9,11) + "px";
			}
		}
		
		g("divFrontImageMaster").style.left = rxpos("divSite") + p((g("divSite").offsetWidth - g("divFrontImageMaster").offsetWidth) / 2) + "px";
		g("divFrontImageMaster").style.top  = rypos("divSite") + p(crf*124) + "px";
	

		if (intFrontImageCount > 3)
		{
			g("imgGalleryLeft").style.left = rxpos("divFrontImageMaster") - p(crf*16) + "px";
			g("imgGalleryLeft").style.top = rypos("divFrontImageMaster") + (g("divFrontImageMaster").offsetHeight / 2) + "px";
			
			g("imgGalleryRight").style.left = rxpos("divFrontImageMaster") + g("divFrontImageMaster").offsetWidth + p(crf*8) + "px";
			g("imgGalleryRight").style.top = rypos("divFrontImageMaster") + (g("divFrontImageMaster").offsetHeight / 2) + "px";
		}
		g("divSite").style.visibility = "visible";
		/* ------------ image-scroller ------------ */


		if (g("divFrontpageText"))
		{
			g("divFrontpageText").style.left = rxpos("divSite") + crf*(489-20) - g("divFrontpageText").offsetWidth / 2 + "px";
			g("divFrontpageText").style.top  = rypos("divSite") + g("divSite").offsetHeight - g("divFrontpageText").offsetHeight - crf*(65-21) + "px"; // 635
		}

		if (g("divMenuTabsTop"))
		{
			g("divMenuTabsTop").style.left = right("divSite") - g("divMenuTabsTop").offsetWidth - resvalue(0,1,1) + "px";
			g("divMenuTabsTop").style.top  = top("divSite") + crf*12 + "px";
			
			if (g("divMenuTabsBottom"))
			{
				g("divMenuTabsBottom").style.left = rxpos("divMenuTabsTop") + "px";
				g("divMenuTabsBottom").style.top  = bottom("divSite") - g("divMenuTabsBottom").offsetHeight - crf*12 + "px";
			}
		}
	}  // end: show 6 menuitems, sliding images, text below sliding images


	if (g("imgGallery"))
	{

		intTop = 0;
		if (is_ie)
		{
			intTop = resvalue(0,0,1);
		}


		g("imgGallery").style.left = rxpos("divSite") + 1 + "px";
		g("imgGallery").style.top  = rypos("divSite") + resvalue(71,89,111) + intTop + "px";

		if (g("divPrintHome") && pg == 0)
		{
			g("divPrintHome").style.left = left("divMenuTabsTop") - g("divPrintHome").offsetWidth - crf*28 + "px";
			g("divPrintHome").style.top  = top("divMenuTabsTop") + crf*2 + "px";
		} else {
			g("divPrintHome").style.left = right("imgGallery") - g("divPrintHome").offsetWidth - crf*12 + "px";
			g("divPrintHome").style.top  = top("imgGallery") - g("divPrintHome").offsetHeight - crf*3 + "px";
		}

		positionGalleryNote();

		if (arrPageImages.length > 1)
		{
			intSpace = resvalue(0,0,3);
			intSpaceArrowLeft  = resvalue(-2,-1,-2);
			intSpaceArrowRight = resvalue(1,0,1);


			if (g("imgArrowLeftGalleryBox") && g("imgArrowRightGalleryBox") && g("imgArrowLeftGallery") && g("imgArrowRightGallery"))
			{
				// box for arrow left
				g("imgArrowLeftGalleryBox").style.left = rxpos("imgGallery") + intSpace + "px";
				g("imgArrowLeftGalleryBox").style.top  = centerVert("imgArrowLeftGalleryBox","imgGallery") + "px";
				
				// box for arrow right
				g("imgArrowRightGalleryBox").style.left = right("imgGallery") - g("imgArrowRightGalleryBox").offsetWidth - intSpace + "px"; // crf*(2+1)
				g("imgArrowRightGalleryBox").style.top  = rypos("imgArrowLeftGalleryBox") + "px";

				

				// arrow left
				g("imgArrowLeftGallery").style.left = rxpos("imgArrowLeftGalleryBox") + g("imgArrowLeftGalleryBox").offsetWidth/2 - g("imgArrowLeftGallery").offsetWidth/2 + intSpaceArrowLeft + "px";
				g("imgArrowLeftGallery").style.top  = centerVert("imgArrowLeftGallery","imgArrowLeftGalleryBox") + "px";

				// arrow left
				g("imgArrowRightGallery").style.left = rxpos("imgArrowRightGalleryBox") + g("imgArrowRightGalleryBox").offsetWidth/2 - g("imgArrowRightGallery").offsetWidth/2 + intSpaceArrowRight + "px";
				g("imgArrowRightGallery").style.top  = centerVert("imgArrowRightGallery","imgArrowRightGalleryBox") + "px";

			}




			/*
			if (g("imgArrowLeftGallery"))
			{
				// arrow left
				g("imgArrowLeftGallery").style.left = rxpos("imgGallery") + intSpace + "px"; // crf*(2+1)
				g("imgArrowLeftGallery").style.top  = centerVert("imgArrowLeftGallery","imgGallery") + "px";

				if (g("imgArrowRightGallery"))
				{
					// arrow right
					g("imgArrowRightGallery").style.left = right("imgGallery") - g("imgArrowRightGallery").offsetWidth - intSpace + "px"; // crf*(2+1)
					g("imgArrowRightGallery").style.top  = rypos("imgArrowLeftGallery") + "px";


					if (g("imgArrowLeftGalleryBox") && g("imgArrowRightGalleryBox"))
					{
						/// box for arrow left
						g("imgArrowLeftGalleryBox").style.left = rxpos("imgArrowLeftGallery") - g("imgArrowLeftGalleryBox").offsetWidth / 2 + g("imgArrowLeftGallery").offsetWidth / 2 + "px";
						g("imgArrowLeftGalleryBox").style.top  = rypos("imgArrowLeftGallery") - g("imgArrowLeftGalleryBox").offsetHeight / 2 + g("imgArrowLeftGallery").offsetHeight / 2 + "px";

						/// box for arrow right
						g("imgArrowRightGalleryBox").style.left = rxpos("imgArrowRightGallery") - g("imgArrowRightGalleryBox").offsetWidth / 2 + g("imgArrowRightGallery").offsetWidth / 2 + "px";
						g("imgArrowRightGalleryBox").style.top  = rypos("imgArrowLeftGalleryBox") + "px";

					}
				}


			}
			/**/
		}
	}

	if (g("frmContact") && blnFirstRun)
	{

		els = g("frmContact").elements;
		for(i = 0, len = els.length; i < len; i++)
		{
			el = els[i];
			if (el.type == "select-one") el.style.width = el.offsetWidth + crf*2 + "px";
			if (el.type == "submit")     el.style.width = el.offsetWidth + crf*2 + "px";
		}
		//alert(m);
	}

	if (blnFirstRun == true)
	{
		//blnFirstRun = false;
		setTimeout("showContents()", 125);
	}

	if (g("imgDammit"))
	{
		g("imgDammit").style.height = 200 + "px";
	}

	//locate("tblButtonClose");

	if (g("tblButtonClose"))
	{
		g("tblButtonClose").style.left = rxpos("divSiteMaster") + crf*660 + "px";
		g("tblButtonClose").style.top  = rypos("divSiteMaster") + crf*100 + "px";
	}

} // end function setupContents


function positionGalleryNote()
{
	if ( g("tblNote") && g("imgGallery") && g("tdGalleryNote").innerHTML.length > 0 && g("tdGalleryNote").innerHTML != "undefined" )
	{
		g('tblNote').style.display = "block";
		g("tblNote").style.left = left("imgGallery") + crf*30*0 + crf*15 + "px";
		g("tblNote").style.top  = bottom("imgGallery") - crf*30*0 - crf*15 - g("tblNote").offsetHeight + "px";
	}
}


function showContents()
{
	
	if ("" + pg == "1" && vpath == "1|") return;

	if (g("divHideLeftSideOfMenuRight"))
	{
		
		//g("divHideLeftSideOfMenuRight").style.display = "block";
		//intLocationX_divHideLeftSideOfMenuRight = rxpos("divHideLeftSideOfMenuRight");

		g("tblInfoBoxTopPart").style.display = "block";
		intLocationX_divHideLeftSideOfMenuRight = rxpos("tblInfoBoxTopPart");
		intSize_divHideLeftSideOfMenuRight = g("tblInfoBoxTopPart").offsetWidth;

		if (blnDoShowContents == 1 && blnShowInfobox == 1)
		{
			//slideInfoboxX(1);
			showInfoboxTop(1);
		}
	}
}


intLocX  = 0;
intLocY  = 0;
intSizeX = 0;
intSizeY = 0;

function hidedivInfoboxTopFade()
{
	g("divInfoboxTopFade").style.width = 0 + "px";
		slideManager(
			'tblInfoBoxTopPart',				// object to slide
			2,									// which way to slide
			rxpos("divMenuRight"),			// when to stop in X-direction
			20,									// when to stop in Y-direction
			'', //'fade("divInfoboxTopFade",0,100)',	// code to execute after completing slide
			''									// code to execute after completing fade
		);
}



/*
rxpos("divSite") + crf*362
*/


function showInfoboxTop(showhide)
{
	if (showhide == 1)
	{
		g("tblInfoBoxTopPart").style.visibility = "visible";
		if ("" + pg == "1" && g("divMenuRightContents"))
		{
			ts = g("divMenuRightContents").getElementsByTagName("table");
			if (ts.length > 0)
			{
				ts[0].style.backgroundImage = "url('img/bg_employee_selected_" + jsres + ".png')";
				objSelectedEmployeeArrow = ts[0].getElementsByTagName("img")[0];
				if (objSelectedEmployeeArrow)
				{
					objSelectedEmployeeArrow.style.visibility = "hidden";
				}				
			}
		}

		intExtraX = 0;

		if (jsres == 0)
		{
			if (is_ie) intExtraX = -1;
			if (is_firefox)
			{
				intExtraX = -1;
			}
		}


		if (jsres == 1)
		{
			if (is_ie) intExtraX = -1;
			if (is_firefox)
			{
				intExtraX = -2;
			}
		}

		if (jsres == 2)
		{
			if (is_ie) intExtraX = -1;
			if (is_firefox)
			{
				intExtraX = -4;
			}
		}

		intInfoboxWidthExtra = intExtraX;
		intInfoboxInitialWidth = intInfoboxInitialWidth + intExtraX;


		slideInfoboxTopOut("tblInfoBoxTopPart","fadeTextInfoboxTop(0)");
	} else {
		if (g("imgInfoboxTopArrow").style.visibility == "visible") g("imgInfoboxTopArrow").style.visibility = "hidden";
		fadeOutTextInfoboxTop("divInfoboxTopFade", 100);
	}
}

/*
function showInfoboxBottom(showhide)
{
	if (showhide == 1)
	{
		slideInfoboxTopOut("tblInfoBoxTopPart","fadeTextInfoboxTop(0)");
	} else {
		if (g("imgInfoboxTopArrow").style.visibility == "visible") g("imgInfoboxTopArrow").style.visibility = "hidden";
		fadeOutTextInfoboxTop("divInfoboxTopFade", 100);
	}
}
*/


function swapImage(obj, src)
{
	if (typeof(obj) == "string") obj = g(obj);
	obj.setAttribute("src", src);
}

function swapPhoto(obj,onoff)
{
	if (typeof(obj) == "string") obj = g(obj);
	arrow = obj.getElementsByTagName('img')[0];
	employee = obj.getElementsByTagName('img')[1];
	if (onoff == 1)
	{
		arrow.setAttribute("src", arrow.src.replace("lightgray","red"));
		employee.setAttribute("src", employee.src.replace("/gs_","/"));
	} else {
		employee.setAttribute("src", employee.src.replace("/emp","/gs_emp"));
		arrow.setAttribute("src", arrow.src.replace("red","lightgray"));
	}
}

function preload_images()
{
	arrPreloadImages = new Array
	(
		"img/infobox_toppart_bg_" + jsres + ".png"
	);

	for(i = 0, len = arrPreloadImages.length; i < len; i++)
	{
		m = new Image();
		m.setAttribute("src", arrPreloadImages[i]);
	}
}

function validateContactForm(f)
{
	blnError = false;

	els = f.elements;
	for(i = 0, len = els.length; i < len; i++)
	{
		el = els[i];

		el.style.zIndex = 9999;

		if (el.type == "input" || el.type == "textarea")
		{
			if (el.value.length == 0)
			{
				blnError = true;
				break;
			}
		}
	}

	if (blnError == true)
	{
		alert("Alle felterne skal udfyldes.");
		return false;
	} else {
		return true;
	}
}

function highlightTable(table,onoff)
{
	tds = table.getElementsByTagName("td");
	for(i = 0, len = tds.length; i < len; i++)
	{
		td = tds[i];
		if (onoff == 1)
		{
			img = td.style.backgroundImage.replace("off","on");
			color = "#ffffff";
		} else {
			img = td.style.backgroundImage.replace("on","off");
			color = "#818285";
		}
		td.style.backgroundImage = img;
		td.style.color = color;

		lnx = td.getElementsByTagName("a");
		for(j = 0, lenj = lnx.length; j < lenj; j++)
		{
			lnx[j].style.color = color;
		}
		
	}
}

function highlightTab(tab,img,color)
{
	if (img.toLowerCase().indexOf("url") == -1) img = "url('" + img + "')";
	tab.style.backgroundImage = img;
	tab.childNodes[0].style.color = color;
	//alert(color);
}

function removeDottedBorderFromlinks()
{
	lnx = document.links;
	for(i=0,len=lnx.length;i<len;i++)
	{
		lnk = lnx[i];
		onc = lnk.onclick;
		lnk.onclick = function() { this.blur(); onc; }
	}
}



/* ---------------- image-scroller ---------------- */
var intRollingImagesCount = 0;

function colorizeArrow(obj, blnIsOver, strVari) {
	obj.src = (blnIsOver ? "img/arrow_red_" + strVari + "_" + jsres + ".png" : "img/arrow_gray_" + strVari + "_" + jsres + ".png");
}


function rollImages(dir) {
	// dir  =  prev / next
	
	if(blnSliderMoving) {
		return;
	}
	var intImageMoveWidth = 0;
	var intImageMoveCount = 3;
	switch(jsres) {
		case 0:
			intImageMoveWidth = 303;
			break
		case 1:
			intImageMoveWidth = 378;
			break
		case 2:
			intImageMoveWidth = 473;
			break
	}
	
	if(intFrontImageCount > 3) {
		if(dir=="next") {
			intImageMoveCount = intFrontImageCount - intRollingImagesCount - 3;
			if(intImageMoveCount > 3 ) {
				intRollingImagesCount += 3;
				intImageMoveCount = 3;
			} else {
				intRollingImagesCount += intImageMoveCount;
			}
		} else {
			if(intRollingImagesCount > 0) {
				if(intRollingImagesCount <= 3) {
					intImageMoveCount = intRollingImagesCount;
					intRollingImagesCount = 0;
				} else {
					intImageMoveCount = 3;
					intRollingImagesCount-= 3;
				}
			}
		}
	}
	if(dir=="next") {
		xy_scroller('divFrontImageContainer', p(g('divFrontImageContainer').style.left), (intImageMoveWidth * intRollingImagesCount * -1), 50, 8);
	} else {
		xy_scroller('divFrontImageContainer', p(g('divFrontImageContainer').style.left), (intImageMoveWidth * intRollingImagesCount * -1), 50, 8);
	}
}


function showFrontText(objSource, idno) {
	var obj = g("divFrontText" + idno);
	if(!obj || obj.innerHTML == "" || blnSliderMoving) {
		return;
	}
	var pObj = objSource.parentNode.parentNode;
	obj.style.display = "block";
	obj.style.top = "0px";
	obj.style.left = "0px";
	obj.style.top = ryposObj(pObj) + pObj.offsetHeight + "px";
	obj.style.left = rxposObj(pObj) + "px";
	obj.style.width = pObj.offsetWidth - (p(pObj.style.paddingLeft) * 2) - 2 + "px";
}

function hideFrontText(idno) {
	if ( g("divFrontText" + idno) ) g("divFrontText" + idno).style.display = "none";
}

/* ---------------- ---------------- */

function showNoteImageScroller(obj, text)
{
	if (typeof(obj) == "string") obj = g(obj);
	if (obj && g("divImageScrollerNote") && text != "" && !blnSliderMoving)
	{
		g("divImageScrollerNote").style.display = "block";
		g("divImageScrollerNote").style.width = obj.offsetWidth + "px";
		g("divImageScrollerNote").style.height = crf*50 + "px";
		g("divImageScrollerNote").style.left = rxposObj(obj) + "px";
		g("divImageScrollerNote").style.top  = ryposObj(obj) + obj.offsetHeight + "px";
		g("divImageScrollerNoteContents").style.padding = crf*9 + "px";
		g("divImageScrollerNoteContents").innerHTML = text;
	} else {
		g("divImageScrollerNote").style.display = "none";
	}
}

/*
function toggleTabContact(table,imgLeft, imgMiddle, imgRight)
{
	tds = table.getElementsByTagName("td");
	tds[0].style.backgroundImage = "url('" + imgLeft + "')";
	tds[1].style.backgroundImage = "url('" + imgMiddle + "')";
	tds[2].style.backgroundImage = "url('" + imgRight + "')";
}
*/

function switchTab(tab, childNum, img, color)
{
	tab.childNodes[childNum].setAttribute("src", img);
	tab.childNodes[childNum+1].childNodes[0].style.color = color;
}

function switchDiv(div, img, color, blnBackgroundImage)
{
	if (blnBackgroundImage == 1)
	{
		div.style.backgroundImage = "url('" + img + "')";
	} else {
		div.style.setAttribute("src", img);
	}
	div.childNodes[0].style.color = color;
}




/**/
document.onmouseup = function()
{
	//document.title = "mouse up";
	//document.title = "";
	for(i = 0, len = arrScrollers.length; i < len; i++)
	{
		obj = arrScrollers[i];
		//alert(obj);
		if (obj != null && typeof(obj) != "undefined")
		{
			//document.title += obj.masterobj + ", ";
			if (!isM || 2 == 2)
			{
				obj.cancelScroll();
				obj.endDrag();
				obj.alterSpeed(0);
				obj.moving = false;
			}
		}
	}
};
/**/


function highlightButtonClose(tbl,onoff)
{
	imgCircle = g("imgButtonCloseCircle");
	imgArrow = g("imgButtonCloseArrow");
	txt = g("txtButtonCloseText");

	if (!imgCircle || !imgArrow || !txt)
	{
		alert("something is missing, function highlightButtonClose");
		return;
	}

	if (onoff == 1)
	{
		imgCircle.src = "img/icon_close_on_" + jsres + ".png";
		txt.style.color = "#b8b8ba";
		imgArrow.src = "img/arrow_lightgray_right_" + jsres + ".png";
	} else {
		imgCircle.src = "img/icon_close_off_" + jsres + ".png";
		txt.style.color = "#b00069";
		imgArrow.src = "img/arrow_red_right_" + jsres + ".png";
	}
}
