var bShow = false;

// Flashobject activeX workaround
function makeFlashObj(sID, sPath, sWidth, sHeight, sBG)
{
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="' + sID + '" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' + sWidth + '" height="' + sHeight + '">');
	document.write('<param name="movie" value="' + sPath + '">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="bgcolor" value="' + sBG + '">');
	document.write('<embed bgcolor="' + sBG + '" src="' + sPath + '" quality="high" id="' + sID + '" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + sWidth + '" height="' + sHeight + '"></embed>');
	document.write('</object>');
}

$(document).ready(function() 
{
	
	//$.cookie('nosplash', null);

	
	$("#sidecol a").each(function()
	{
		switch ($(this).attr("id"))
		{
			case "fotos_uploaden2":
				setAjaxRequest("#" + $(this).attr("id"),520,400);				
				break;
				
			case "nieuwe_locatie2":
				setAjaxRequest("#" + $(this).attr("id"),520,400);				
				break;				
				
			default:

				break;
		}
	});	
	
	$("#globalNav li a").each(function()
	{
		switch ($(this).attr("id"))
		{
			case "toevoegen_aan_favorieten":
				setAjaxRequest("#" + $(this).attr("id"),420,245);				
				break;
				
			case "hsv_inloggen":
				setAjaxRequest("#" + $(this).attr("id"),500,420);				
				break;
				
			case "tips":
				setAjaxRequest("#" + $(this).attr("id"),450,300);				
				break;
				
			case "contact":
				setAjaxRequest("#" + $(this).attr("id"),450,300);				
				break;												
				
			default:
				setAjaxRequest("#" + $(this).attr("id"),600,355);
				break;
		}
	});
	
	if (_ajax != "true")
	{
		if ($.cookie('nosplash') != '1')
		{
			$("#welkom a").each(function()
			{
				$(this).attr('href',$(this).attr('href') + '&ajax=true');
			});			
			
			$("#welkom a").fancybox(
			{
				'zoomSpeedIn': 300, 
				'zoomSpeedOut':	300, 
				'overlayShow': false,
				'hideOnContentClick': false,
				'frameWidth': 450,
				'frameHeight': 320,
				'padding': 10
			}).trigger('click');	
		}
	}
	
	$("#close a").click(function()
	{
		if (bShow == true)
		{
			$("#sidecol").animate({width: '30px'}, 'fast', function() {});		
			$(this).addClass("closed");
			bShow = false;
		}	
	});
	
	$("#toggle").click(function()
	{
		if (bShow == true)
		{
			$("#sidecol").animate({width: '30px'}, 'fast', function() {});		
			$(this).addClass("closed");
			bShow = false;
		}
		else
		{
			$("#sidecol").animate({width: '226px'}, 'fast', function() {});			
			$(this).removeClass("closed");
			bShow = true;
		}
	});
	
	//$(this).delay(8000,function()
	//{
		//$("#toggle").trigger("click");
	//});
	
});

function setAjaxRequest(id,width,height)
{
	$(id).each(function()
	{
		$(this).attr('href',$(this).attr('href') + '&ajax=true');
	});
	
	$(id).fancybox(
	{
		'zoomSpeedIn': 300, 
		'zoomSpeedOut':	300, 
		'overlayShow': false,
		'hideOnContentClick': false,
		'frameWidth': width,
		'frameHeight': height
	});		
}

function setSplash(o)
{
	if (o.checked == true)
	{
		$.cookie('nosplash', '1', { expires: 365});	
		return false;
	}
	else
	{
		$.cookie('nosplash', null);
		return false;
	}
}
