

    function findPos(obj,laag) {
    	var curleft = curtop = 0;
    	var makeit = 'visible';
    	if (obj.offsetParent) {
    		do {
    			curleft += obj.offsetLeft;
    			curtop += obj.offsetTop;
    		} while (obj = obj.offsetParent);
    	}
    	// alert(curleft);
    	// alert(curtop);
    	if (document.getElementById(laag).style.visibility=="visible")
    	{
    		makeit= 'hidden';
    	}
    	document.getElementById("laagkreta").style.visibility = 'hidden';
    	document.getElementById(laag).style.left= curleft + 'px';
    	document.getElementById(laag).style.top= (curtop+36) + 'px';
    	document.getElementById(laag).style.visibility= makeit;
//    	return [curleft,curtop];
    } 	
		function resizeScreen()
	{
		 //alert(document.body.clientWidth);
		//if (document.body.clientWidth<1259)
		//{
		//	document.getElementById("leftheaderimage").style.width="0px";
		//	document.getElementById("rightheaderimage").style.width="0px";
		//}
			var margin = 0;
			margin=((document.body.clientWidth-939)/2);
			if (margin<0)
			{
				margin="20";
			}
			margin = margin + "px";
			document.getElementById("left_logo").style.width= margin;
			document.getElementById("right_logo").style.width= margin;

	}
	
	function changePicture(picture)
	{
		document.getElementById("largeimage").innerHTML= "<a rel='lightbox[]' href='large_image.php?id=" + picture + "' ><img width='356' border='0' src='large_image.php?id=" + picture + "' /></a>";
	}

	function changePictureBig(picture)
	{
		document.getElementById("largeimagetab").innerHTML= "<img width='640' border='0' src='large_image.php?id=" + picture + "' />";
		document.getElementById("picnum").value = eval(picture);
		
	}
	
	function changeIntoNext()
	{
		var hitit = 0;
		var imgArr = document.getElementById("picnums").value.split(",");
		for (var x=0; x<imgArr.length; x++)
		{
			if (hitit==1)
			{
				hitit=imgArr[x];
			}
			if ((imgArr[x]==document.getElementById("picnum").value) && hitit==0)
			{
				hitit = 1;
			}
		}
		if (hitit>1)
		{
		  changePictureBig(hitit);
		}
	}
	
	function changeIntoPrevious()
	{
		var hitit = 0;
		var imgArr = document.getElementById("picnums").value.split(",");
		for (var x=0; x<imgArr.length; x++)
		{
			if ((imgArr[x]==document.getElementById("picnum").value) && hitit==0 && x>0)
			{
				changePictureBig(imgArr[x-1])
				hitit = 1;
			}
		}
	}
	
	
	function getHTTPObject()
{
  if (window.ActiveXObject)
    return new ActiveXObject("Microsoft.XMLHTTP");
    else if (window.XMLHttpRequest)
    return new XMLHttpRequest();
  else {
    alert("Your browser does not support AJAX.");
    return null;
  }
}

function getPage(bestand,div_id)
{
    httpObject = getHTTPObject();
    if (httpObject != null)
    {
      httpObject.open("GET", bestand, true);
      httpObject.onreadystatechange = function()
      {
        if (httpObject.readyState == 4 && httpObject.status == 200)
        {
          document.getElementById(div_id).innerHTML = httpObject.responseText;
        }
      };
      httpObject.send(null);
    }
}

function searchresults(locationv, category, leave_date, stay, persons, bedrooms)
{
	var adres = "ajax_searchresult.php?location=" + locationv + "&category=" + category + "&leave_date=" + leave_date + "&stay=" + stay + "&persons=" + persons + "&bedrooms=" + bedrooms;
	// alert(locationv);
	getPage(adres,"searchresults");
}

function changeMenu(id,niveau,status,currentid)
{
	/*
	t<id> = column class
	a<id> = anchor class
	i<id> = image class
	*/
	if (niveau==2)
	{
		if (status=="over")
		{
			document.getElementById("p" + id).className="menunivo2s";
			document.getElementById("a" + id).className="menutextnivo2s";
			document.getElementById("i" + id).src="images/menuimagenivo2s.png";
		}
		if (status=="out" && id!=currentid)
		{
			document.getElementById("p" + id).className="menunivo2";
			document.getElementById("a" + id).className="menutextnivo2";
			document.getElementById("i" + id).src="images/menuimagenivo2.png";
		}
	}
	if (niveau==3)
	{
		if (status=="over")
		{
			document.getElementById("t" + id).className="menunivo3s";
			document.getElementById("a" + id).className="menutextnivo3s";
			document.getElementById("i" + id).src="images/menuimagenivo3s.png";
		}
		if (status=="out" && id!=currentid)
		{
			document.getElementById("t" + id).className="menunivo3";
			document.getElementById("a" + id).className="menutextnivo3";
			document.getElementById("i" + id).src="images/menuimagenivo3.png";
		}
	}
	if (niveau==4)
	{
		if (status=="over")
		{
			document.getElementById("p" + id).className="menunivo4s";
			document.getElementById("a" + id).className="menutextnivo4s";
			document.getElementById("i" + id).src="images/menuimagenivo4s.png";

		}
		if (status=="out" && id!=currentid)
		{
			document.getElementById("p" + id).className="menunivo4";
			document.getElementById("a" + id).className="menutextnivo4";
			document.getElementById("i" + id).src="images/menuimagenivo4.png";
		}
	}

}
