if (!top.main && top.location != self.location) {
	top.location = self.location;
}
/*
artfaderObjects = new Object();
artfaderTimers = new Object();
*/

function setValueOfSelect(selectObj, waarde){
	var teller=0;
	
	while(selectObj[teller].value!=waarde)
	{
		teller++;
	}
	selectObj[teller].selected=true;
}
function getValueOfSelect(selectObj){
	return selectObj.options[selectObj.selectedIndex].value;
}

function captureDates(){
	var form=document.forms["SBform"];
	oDay=getValueOfSelect(form.sector_1_d);
	oMonth=getValueOfSelect(form.sector_1_m).substring(0,2);
	oYear=getValueOfSelect(form.sector_1_m).substring(2,6);
	rDay=getValueOfSelect(form.sector_2_d);
	rMonth=getValueOfSelect(form.sector_2_m).substring(0,2);
	rYear=getValueOfSelect(form.sector_2_m).substring(2,6);
}
function reconcile_dates() {
	var form=document.forms["SBform"];
	var retVal=false;
	captureDates();
	calcCal("kalenderVan", form.sector_1_m, "heen");
	if(rDay!=0) 
	{
		if((rMonth < oMonth) && (rYear==oYear) || (oYear > rYear))
		{
			form.sector_2_m.options.selectedIndex=form.sector_1_m.options.selectedIndex+1;
			form.sector_2_d.options.selectedIndex=form.sector_1_d.options.selectedIndex+1;
			calcCal("kalenderNaar",form.sector_2_m, "terug");
			retVal=true;
		}
		else if((rDay < oDay) && (rMonth==oMonth)) 
		{
			form.sector_2_d.options.selectedIndex=form.sector_1_d.options.selectedIndex+1;
			retVal=true;
		}
	}
	return retVal;
}


function getPopupDistLeft(width){
	if (window.screen) {
		left = (screen.availWidth - width)/2;
	}
	else{
		left = (640-width)/2;
	}
	return(left);
}
function getPopupDistTop(height){
	//	alert(screen.availHeight);
	//	return 100;
	if (window.event) {
		topPx = (screen.availHeight - height - 50)/2;
	}
	else{
		topPx = (480-height)/2;
	}
	//	var top = 50;
	//	alert(top);
	return(topPx);
}
function getPopupScreenHeight(){
	var height = 400;
	if (window.screen) {
		height = screen.availHeight - 150;
	}
	else{
		height = 420;
	}
	//	alert(height);
	if(height > 768) height = 768;
	return(height);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function openErrorWindow(statusmessage,language,questions){
	alert("/statusmessage.php?statusmessage="+statusmessage+"&questions="+questions);
	var width = 500;
	var height = 300;
	eval("desktop = window.open('"+url+"','statusmessage','width="+width+",height="+height+",left="+getPopupDistLeft(width)+",top="+getPopupDistTop(height)+",toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no');");
}

function artfader(object, destOp, rate, delta){
if (!document.all)
return
    if (object != "[object]"){  //do this so I can take a string too
        setTimeout("artfader("+object+","+destOp+","+rate+","+delta+")",0);
        return;
    }

    clearTimeout(artfaderTimers[object.sourceIndex]);

    diff = destOp-object.filters.alpha.opacity;
    direction = 1;
    if (object.filters.alpha.opacity > destOp){
        direction = -1;
    }
    delta=Math.min(direction*diff,delta);
    object.filters.alpha.opacity+=direction*delta;

    if (object.filters.alpha.opacity != destOp){
        artfaderObjects[object.sourceIndex]=object;
        artfaderTimers[object.sourceIndex]=setTimeout("artfader(artfaderObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);
    }
}
function doLoad(){
	//
	/*
	<?=$doLoad2?>*/
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function cityregion(){
	if(document.form){
		if(document.form.city_region_city.checked){
			document.form.new_region.disabled = 1;
			document.form.new_city.disabled = 0;
		}
		else{
			document.form.new_region.disabled = 0;
			document.form.new_city.disabled = 1;
		}
	}
}
function cityregioncheck(choice){
	if(document.form && choice){
		eval("document.form.city_region_"+choice+".checked=1;");
	}
	cityregion();
}