/* standaard js file */

defaultStatus = "";
var gv_default_js_loaded = true;


/*------------------------------------------------------------------------------
	Methode om CSS background-image cache te forceren voor IE6
------------------------------------------------------------------------------*/

try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}

//window.onload = init;
function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            oldonload();
            func();
        }
    }
}


/*------------------------------------------------------------------------------
	Popup scripts
------------------------------------------------------------------------------*/

/* pop up algemeen */
function popUp(location,popupname,width,height) {
	window.open(location, popupname,'width='+width+',height='+height+',status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,top='+((screen.height-height)/2)+',left='+((screen.width-width)/2)+'');
}

/* pop up voor images */
function popUpImage(location,popupname,width,height) {
	window.open(location, popupname, 'width='+width+',height='+height+',status=no,toolbar=no,menubar=no,scrollbars=no,resizable=no,top=0,left=0');
}

/* strip spaties en bepaal lengte */
function str_length(value) {
	str = new String(value);
	str = str.replace(/^[\s]+/g,"");
	return  str.length;
}



/*------------------------------------------------------------------------------
	AJAX scripts
------------------------------------------------------------------------------*/

function checkLogin(formId)
{
	var result = false;

	$.ajax({
		type: 'POST',
		url: '/dynamics/checklogin.php',
		data: $('#'+formId+' :input').serialize(),
		async: false,
		success: function(content){
			result = (content == 'OK');
		},
		error: function() { alert('Unable to login, please try again'); }
	});

	if (!result)
	{
		$('div.sfrm_login_error').show();
	}

	return result;
}

