// JavaScript Document
function popUp(url,width,height){

    attrib = 'width=' + width + ',height='+ height+ ',top=10,left=10,scrollbars=yes';
    popwindow = window.open(url,'PopUp',attrib);
}

function actionOnload(e) {
	if (!document.getElementById) {
		alert("Din webbl�sare kan inte presentera sidan ordentligt. Ladda hem den senaste versionen av Firefox eller Internet Explorer f�r en optimal presentation.");
		return;
	}
	boxReset("zoek");
}

function ttpKeepAlive(obj)
{
  document.getElementById(obj.id).style.visibility = "visible";
}

function ttpHide(obj)
{
  document.getElementById(obj.id).style.visibility = "hidden";
}

var inpBox = new Object();

function boxReset()
{
	var myElem;
	for(var i=0;i<arguments.length;i++) {
		myElem = document.getElementById(arguments[i]);

		if (myElem) {
			inpBox[myElem.id] = myElem.value;


			if (document.addEventListener) {
			  // REGISTERING THE EVENTS FOR DOM COMPLIANT BROWSERS
				myElem.addEventListener("focus",boxGotFocus,false);
				myElem.addEventListener("blur",boxLostFocus,false);
			} else {
			  // REGISTERING THE EVENTS FOR IE
				myElem.attachEvent("onblur",boxLostFocus);
				myElem.attachEvent("onfocus",boxGotFocus);
			}

		}
	}
}

function boxGotFocus(e)
{
  myBox = (!window.event) ? e.target:window.event.srcElement;

  if (myBox.value == inpBox[myBox.id])
  {
    myBox.value = "";
  }
}

function boxLostFocus(e)
{
  myBox = (!window.event) ? e.target:window.event.srcElement;

  if (myBox.value == "")
  {
    myBox.value = inpBox[myBox.id];
  }
}

function findPos(obj) {
  var curleft = curtop = 0;
  if (obj.offsetParent) {
    curleft = obj.offsetLeft
    curtop = obj.offsetTop
    while (obj = obj.offsetParent) {
      curleft += obj.offsetLeft
      curtop += obj.offsetTop
    }
  }
  return [curleft,curtop];
}

//This is a fix to add rounded corners too old browsers.
function activateRoundedCorners(){
    if (typeof jQuery != 'undefined' || typeof Modernizr != 'undefined') {
        if(!Modernizr.borderradius){
            if($.browser.msie && $.browser.version!="6.0")
                $(".button a").append('<em class="tl"></em></a><em class="tr"></em><em class="bl"></em><em class="br"></em>');
        }
    }
}


