var lastID;
loaded=false;
var win;
function Fold(ulID) {
	if (ulID != '') {
		visible = document.getElementById(ulID).className=='visible';
	
		//fold the last Menukop in
	 	if (lastID != null) 
		   document.getElementById(lastID).className='hidden';
      
	    //check if fold out is necessary
	    if (!visible || ulID==lastID && !visible) 
	      document.getElementById(ulID).className='visible';
         
    	lastID = ulID;
    }
}

function FoldPlus(divID, imgID) {
	visible = document.getElementById(divID).className=='visible';
	if (visible) {
		document.getElementById(imgID).src = 'images/plus.gif';
		document.getElementById(divID).className='hidden';
	}
	else {
		document.getElementById(imgID).src = 'images/min.gif';
		document.getElementById(divID).className='visible';
	}
}

function foldAanvrager(divID, chkID) {
	checked = document.getElementById(chkID).checked;
	if (!checked) {
		document.getElementById(divID).className='hidden';
	}
	else {
		document.getElementById(divID).className='visible';
	}
}

function Loaded() {
	loaded=true;
	if ( document.getElementById('loading') != null )
		document.getElementById('loading').className = 'hidden';
}

function SelectItem(combobox, str) {
	var i = 0;
	for (i=0; i<document.getElementById(combobox).options.length; i++) {
		if (str == document.getElementById(combobox).options[i].value ||
		    str == document.getElementById(combobox).options[i].text)
			document.getElementById(combobox).options[i].selected = "selected";
	}
}

function CheckForJump(fieldID,maxlength,jumpFieldID) {
	sField = document.getElementById(fieldID).value;
	if (sField.length == maxlength)
		document.getElementById(jumpFieldID).focus();
}

function goTo(url) {
  window.location.href = url;
}

function popupMagazine(name, url) {
	w=Math.round(screen.availWidth*0.88);
	h=Math.round(screen.availHeight*0.8);
	LeftPosition=(screen.availWidth)?(screen.availWidth-w)/2:100;
    TopPosition=(screen.availHeight)?(screen.availHeight-h)/2:100;
    settings = 'width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',location=no,directories=no,status=no,';
    settings += 'menubar=no,toolbar=no,resizable=yes';
    win=window.open(url,name,settings);
}

function popupLargePic(name, url) {
	return popupMagazine(name, url);
}

function popupLargePicVert(name, url, bScroll) {
	if ( typeof(bScroll) == 'undefined' ) bScroll = false;
	h=Math.round(screen.availHeight*0.9);
	w=Math.round(h*0.75);
	LeftPosition=(screen.width)?(screen.width-w)/2:100;
    TopPosition=0;
    settings = 'width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',location=no,directories=no,status=no,';
    settings += 'menubar=no,toolbar=no,resizable=yes';
	if ( bScroll ) settings += ',scrollbars=yes';
    win=window.open(url,name,settings);
}

function popupFinancien(name, url) {
	h=Math.round(screen.availHeight*0.9);
	w=Math.round(h*1.10);
	LeftPosition=(screen.width)?(screen.width-w)/2:100;
    TopPosition=0;
    settings = 'width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',location=no,directories=no,status=no,';
    settings += 'menubar=no,toolbar=no,resizable=yes';
    win=window.open(url,name,settings);
}

function popupPicture(name, url) {
	w=300;
	h=300;
	LeftPosition=(screen.availWidth)?(screen.availWidth-w)/2:100;
    TopPosition=(screen.availHeight)?(screen.availHeight-h)/2:100;
    settings = 'width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',location=no,directories=no,status=no,';
    settings += 'menubar=no,toolbar=no,resizable=no, scrollbars=no';
    win=window.open(url,name,settings);
}

function popupPictureScroll(name, url) {
	w=300;
	h=300;
	LeftPosition=(screen.availWidth)?(screen.availWidth-w)/2:100;
    TopPosition=(screen.availHeight)?(screen.availHeight-h)/2:100;
    settings = 'width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',location=no,directories=no,status=no,';
    settings += 'menubar=no,toolbar=no,resizable=no,scrollbars=yes';
    win=window.open(url,name,settings);
}

function popupPDF(name, url, bHorizontal) {
	h=Math.round(screen.availHeight*0.85);
	w=Math.round(h*(bHorizontal?1.25:0.75));
	LeftPosition=(screen.width)?(screen.width-w)/2:100;
    TopPosition=0;
    settings = 'width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',location=no,directories=no,status=no,';
    settings += 'menubar=no,toolbar=no,resizable=yes';
    win=window.open(url,name,settings);
}
