/*------------------------------------------------------------------------------
	Methode om CSS background-image cache te forceren voor IE6
------------------------------------------------------------------------------*/

try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}


/*------------------------------------------------------------------------------
	onLoad handler
------------------------------------------------------------------------------*/

var bodyInit = false; //set initial load
var root = 'body'; //set root
var popWidth = 492;

function onLoad(loadRoot)
{
	// set root
	if (typeof(loadRoot) == 'string') root = loadRoot;


	//png fix
	if (typeof DD_belatedPNG == 'object') {
		if(loadRoot == 'body') {
			DD_belatedPNG.fix('.faq span,.strand .bottom,.navSub,.navSub a.home,.navSub a.faq,.navSub a.actie,.navSub a.print,.navSub a.auto,.strand .mid');
		}
	}
}

function setPopWidth()
{
	if($('.loContent').css('width') && root == 'body') {
		cssWidth = new String($('.loContent').css('width'));
		if(cssWidth.indexOf('px') > 0) {
			popWidth = parseInt(cssWidth.substr(0,cssWidth.indexOf('px')));
		}
		else {
			popWidth = parseInt($('.loContent').css('width'));
		}
	}	
}

/*------------------------------------------------------------------------------
	AJAX handlers
------------------------------------------------------------------------------*/

function setIndex(pub_Id, page, archive)
{
	$.get(location.href,{ pub_Id: pub_Id, page: page, archive: archive, action: 'index'},
		function(msg) {
			$('#index_container').html(msg);
			onLoad('#index_container');
		}
	);
}

/*------------------------------------------------------------------------------
	Various
------------------------------------------------------------------------------*/

function checkCookies(redirect)
{
	var cookieName = 'testCookie';
	document.cookie = cookieName + '=cookieValue';
	var cookiesEnabled = document.cookie.indexOf(cookieName) != -1;
	if (!cookiesEnabled)
	{
		location.href=redirect;
	}
}

function createCleanSearchUrl()
{	
	var searchVal = $('form#frm_search_side input#search').val();
	var action = $('form#frm_search_side').attr('action');
	if ($('form#frm_search_side input#search').hasClass('errHilite') == false) {
		window.location = '../..'+action+'/'+searchVal.replace(' ', '/');
	}
	return false;
}
