function popupMapWindow( Name, Title,  width, height, top, left ) {
	style = "height=" + height + ",width=" + width + ", top=" + top + ", left=" + left + ", status=no, toolbar=no, menubar=no, location=no, scrollbars=no, resizable=no";
	open(Name, Title, style);
}

function TopObjects(sVisibility) {
	oSelects = document.getElementsByTagName('SELECT');
	if (oSelects.length > 0) {
		for (i = 0; i < oSelects.length; i++) {
			oSelects[i].style.visibility = sVisibility;
		}
	}

	oObjects = document.getElementsByTagName('OBJECT');
	if (oObjects.length > 0) {
		for (i = 0; i < oObjects.length; i++) {
			oObjects[i].style.visibility = sVisibility;
		}
	}
}

function showInschrijfUitleg(Stap, Titel)
{
	style = "height=400, width=500, status=yes, toolbar=no, menubar=no, location=no, scrollbars=yes, resizable=no";
	openPrefix("Help.aspx?Stap=" + Stap, "HelpPopup", style);
}

window.onload = function() {
	initall();
}

function browserObject() {
	this.ver = navigator.appVersion;

	this.docId = (document.getElementById && document.defaultView) ? true : false;
	this.docLay = document.layers ? true : false;
	this.docAll = document.all ? true : false;
	
	this.compatible = ( this.docId || this.docLay || this.docAll );

	this.width = null; //to be set later after document is loaded;
	this.height = null; //to be set later after document is loaded;
	return this;
}
var browser = new browserObject();

var _oBody; // Will hold pointer to document body

function initBrowserComp() {
	if (browser.compatible) { // browser compatible ?
		if (browser.docAll) {
			// IE6 with right doctype needs 'document.documentElement'
			if(document.documentElement && document.body.clientHeight == 0) _oBody = document.documentElement;
			else _oBody = document.body;
			browser.width = _oBody.clientWidth;
			browser.height = _oBody.clientHeight;
		}
		else if (browser.docId) {
			browser.width = window.innerWidth;
			browser.height = window.innerHeight;
			_oBody = document.body;
		}
		else if (browser.docLay) {
			browser.width = window.innerWidth;//-20;
			browser.height = window.innerHeight;//-20;
		}
	}
}

function initall() {
	initBrowserComp();
	window.onresize = initall;
	checkScroll();
}
var _iY, _iH;

function checkScroll() {
	var iY = (browser.docLay) ? window.pageYOffset : _oBody.scrollTop;
//	var iH = (browser.docLay) ? document.layers['navScrollDiv'].document.images[0].height : document.images['scrollIMG'].height;
	var iH = 23;
	iY += browser.height - iH;
	if((_iY != iY) || (_iH != iH)) layerMoveTo('divIconen',0,iY);
	_iY = iY;
	_iH = iH;
	setTimeout('checkScroll()',10);
}

function layerMoveTo( sID, iX, iY) {
	var oSL = layerGetRef(sID);
	if (browser.docLay) {
		oSL.moveTo(iX, iY);
	}
	else {
		//oSL.style.left= iX +'px';
		oSL.style.top = iY +'px';
	}
}

function layerGetRef( sID ) {
	if (browser.docId) return document.getElementById(sID);
	else if (browser.docLay) return document.layers[sID];
	else if (browser.docAll) return document.all[sID];
}

function isDefined( vElt ) {
	var UNDEF;
	var bDef = (vElt == UNDEF) ? false : true;
	return bDef;
}

/* Woningbezit dorpen */

function showDorpen(animate) {
	$(document).ready(function() {
		if (animate == 1) {
			$('#divBezitWijkenShow').css('width', '0px').show().animate({ width: 485 });
		} else {
			$('#divBezitWijkenShow').css('width', '485px').show();
		}
	});
}

function hideDorpen() {
	$('#divBezitWijkenShow').hide();
}

/* URL Rewrites */
/* Gebruiken ipv de normale open functie */
function openPrefix(Name, Title, Style) {
    if (document.getElementsByTagName('base')[0] && Name.substring(0, 1) != "/") {
        var prefix = document.getElementsByTagName('base')[0].href;
    }
    else {
        var prefix = "";
    }
    window.open(prefix + Name, Title, Style);
}



$(document).ready(function() {
    kruimelpadFix();
});

function kruimelpadFix() {
    var w = 0;
    $('.locatie > span').each(function() {
        w += $(this).outerWidth();
    });
    $('.locatie').wrapInner('<div class="locatie_content" />');
    if (w > 341) {
        $('.locatie').after('<div class="locatie_puntjes">');
        $('.locatie').mouseenter(function() {
            $('.locatie_puntjes').hide();
            $(this).stop().animate({ width: (w + 10) }, 300);
        }).mouseleave(function() {
            $(this).stop().animate({ width: '342px' }, 300, function() {
                $('.locatie_puntjes').show();
            });
        });
    }

}
