// JavaScript Document

//submit a from by form name
function submitFrm(f){
	document.getElementById(f).submit();	
}
//open specific popup
function openWoordenboek(url){
newWindow(url,430,600,'woordenboek','toolbar=no,status=no,resizable=yes,scrollbars=yes');
}
function openInsturen(url){
newWindow(url,430,400,'insturen','toolbar=no,status=no,resizable=yes,scrollbars=yes');
}
function openEkaart(){
newWindow('',640,580,'ekaart','toolbar=no,status=no,resizable=yes,scrollbars=yes');
}

//default script for popup
function newWindow(url,width,height,name,props){
  if(!props){
  	var properties = "width="+width+",height="+height+",toolbar=no,status=no,resizable=yes,scrollbars=yes";
 }else{
   var properties = "width="+width+",height="+height+","+props;
 }
  	var screenY = window.screen.availHeight;
  	var screenX = window.screen.availWidth;
  	var leftvar = Math.round((screenX - width) / 2);
  	var rightvar = Math.round((screenY - height) / 2);
  	properties += ",left=" + leftvar +",top=" + rightvar;

    var base = document.getElementsByTagName("base")[0].getAttribute("href");

    popupHandle = window.open(base+url,name, properties);
	setTimeout('popupHandle.focus();',250);
}

function to(url, target) {
    var base = document.getElementsByTagName("base")[0].getAttribute("href");
    if(!target) document.location.href=base + url;
    else target.location.href=base + url;
}

function ito(input) {
    window.scrollTo(findPosX(input), findPosY(input));
}
function ifocus(input) {
    input.originalClassName = input.className;
    input.className="focus";
}
function iblur(input) {
    input.className=input.originalClassName;
}

function findPosY(obj) {
    var curtop = 0;
    if (obj.offsetParent) {
        while (obj.offsetParent) {
            curtop += obj.offsetTop
            obj = obj.offsetParent;
        }
    } else if (obj.y)
        curtop += obj.y;
    return curtop;
}
function findPosX(obj) {
    var curleft = 0;
    if (obj.offsetParent) {
        while (obj.offsetParent) {
            curleft += obj.offsetLeft
            obj = obj.offsetParent;
        }
    } else if (obj.x)
        curleft += obj.x;
    return curleft;
}