var doDebug = false;

if(parent.frames.length > 0) 
{
    parent.location.href = location.href;
}
function rp(p)
{
    window.location = p;
}
function externalSite(url, w, h) 
{
	var left = (screen.width - w) / 2;
    var top = (screen.height - h) / 2;
    
	window.open(url,
	            'externalSite',
	          	'height='+h+',width='+w+',resizable=0,toolbar=0,scrollbars=1,left='+left+',top='+top);
}
function popup(merk) {
	var width = 600;
	var height = 600;
	var left = (screen.width - width) / 2;
    var top = (screen.height - height) / 2;
    var clusters = '';

    if (merk == 'volkswagen') {
    	var url = 'https://www.financieringverzekering.nl/vw3/Indicatie.asp';
    }
    
	clusters = window.open(url,
	                       'calculator',
	          	           'height='+height+',width='+width+',resizable=0,toolbar=0,scrollbars=1,left='+left+',top='+top);

}

function rtnFalse()
{
    return false;
}
function stayAlive()
{
    new Ajax.PeriodicalUpdater('stayalive', 
                               'index.php?mod=keepalive',   
                               {method: 'get',     
                                frequency: 60,
                                decay: 1}); 
}
function frmDisplayBlock(id)
{
    var e, k;
    if(id != false && document.getElementById(id)) {
        e = document.getElementById(id);
        var MSIE = false;
        if(navigator.userAgent.indexOf('MSIE') > 0) {
            MSIE = true;
        }
        if(MSIE == true) {
            e.parentNode.parentNode.style.display = 'inline';
        }
        else {
            e.parentNode.parentNode.style.display = 'table-row';
        }
    }
 
    var arg = frmDisplayBlock.arguments;
    for(k=1; k<arg.length; k ++) {
        e = document.getElementById(arg[k]);
        e.parentNode.parentNode.style.display = 'none';
    }
} 

function showProgress()
{

}

function endProgress()
{

}

function requestError(xmlObj, reqObj)
{
    alert(reqObj);
}

function trim(string) {
    var remove = ' \t\r\n';
    var r = '';
    var s = 0;
    var e = string.length - 1;

    while(s <= e && remove.indexOf(string.charAt(s)) != -1) {
        s++;
    }
    while(e >= s && remove.indexOf(string.charAt(e)) != -1) {
        e--;
    }
    for(i=s; i <= e; i++) {
        r += string.charAt(i);
    }
    return r;
}

