/*
 * $ Default javascript file
 *
 * Copyright (c) 2007 That's-id Multimedia
 */

/*------------------------------------------------------------------------------
	Methode om CSS background-image cache te forceren voor IE6
------------------------------------------------------------------------------*/

try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}

//flashDetectVersion = "9.0"; 

/*------------------------------------------------------------------------------
	onLoad handler
------------------------------------------------------------------------------*/

function onLoad(root)
{
	if(typeof root!='string') root = 'body';
	
	if (root=='body')
	{
		$('.triggerPopup').setPopup('form', {
			content: {url: '/publicaties/188'},
			vAlign: 'top',
			animation: 'none',
			postShowHandler: function(){ onLoad('#popup_form'); }
		});
		
		$('.subscribePopup').setPopup('subscribe', {
			content: {url: '/publicaties/196'},
			formValidation: true,
			animation: 'none',
			postShowHandler: function(){ onLoad('#popup_subscribe'); }
		});
		
		if (typeof supersleight == 'object') {
			supersleight.run();
		}
	} else {
		loadPopupSIFR();
		if (typeof supersleight == 'object') {
			supersleight.limitTo(root.substring(1));
			supersleight.run();
		}
	}

	$(root+' img[rel=mo]').addRollOverHandler();
	$(root+' .showOnLoaded').css('visibility','visible');
}

/*------------------------------------------------------------------------------
	AJAX handlers
------------------------------------------------------------------------------*/

function setIndex(pub_Id, page, archive)
{
	$.get('/dynamics/getindex.php',{ pub_Id: pub_Id, page: page, archive: archive },
		function(msg) {
			document.getElementById('index_container').innerHTML=msg;
			//parseSelector();
		}
	);
}

function loadServiceBlok(id)
{
	$.get('/publicaties/'+id, {},
		function(msg) {
			$('#serviceBlok').show();
			$('#serviceBlok .layoutMiddenvlak').html(msg);
			onLoad('#serviceBlok');
		}
	);
}

function loadPopup(id)
{
	$.get('/publicaties/'+id, {}, 
		function(msg) {
			$.overlay.showPopup('pub', {
				content: msg,
				formValidation: true,
				animation: 'none',
				postShowHandler: function(){ onLoad('#popup_pub'); }
			});
		}
	);
}


/*------------------------------------------------------------------------------
	Various
------------------------------------------------------------------------------*/

function checkCookies(redirect)
{
	var cookieName = 'testCookie' + (new Date().getTime());

	document.cookie = cookieName + '=cookieValue';
	var cookiesEnabled = document.cookie.indexOf(cookieName) != -1;
	if (!cookiesEnabled)
	{
		location.href=redirect;
	}
}



