function changeBg()
{
	var bgNum = $chk(Cookie.get('bgNum')) ? Cookie.get('bgNum').toInt() + 1 : 1;
	
	if(bgNum > 1) bgNum = 1;			  								//eerste getal in deze veranderen in aantal achtergronden.
	$$('body').set('class', 'bg_' + bgNum);
	Cookie.set('bgNum', bgNum);
}
function setImage()
{
	var bgNum = $chk(Cookie.get('bgNum')) ? Cookie.get('bgNum').toInt(): $random(1,1); 	  	   		//laatste getal veranderen in aantal achtergronden
	//var bgNum = "9";
	//alert(bgNum);
	$$('body').set('class', 'bg_' + bgNum);
	Cookie.set('bgNum', bgNum);
}
function clearField(searchField)
{
	searchField.value = "";
}

function submitSearch(searchField)
{
	if(searchField.toLowerCase() != 'search')
		return true;
	
	return false;
}

// site functions
// Popup Window (Centred)
function popup(url,winname,w,h,feat) {
	if (!(isNaN(w) || isNaN(h))) {
		var x=parseInt((screen.width-w)/2);
		var y=parseInt((screen.height-h)/2);
		if (x<0)	x=0;
		if (y<0)	y=0;
		
		if (feat!=null && feat!="") {
			feat=","+feat;
		} else {
			feat="";
		}
		feat="left="+x+",top="+y+",width="+w+",height="+h+feat;
	}
	window.open(url,winname,feat,false);
}

function openGoogle(url) {
	popup(url,"",780,600,"resizable");
}

function viewShowreel(appPath) {
	popup(appPath + "/showreel","",720,244,"");
}

/** job form**/
function javaEnabled()
{
	$('applyLink').style.display = "inline";
	if($('jobForm') != null)
	{
		$('jobForm').style.display = "none";
		$('jobForm').style.position = "absolute";
	}
}
function javaEnableBanner()
{
	if($('javaEnabled') != null)
	{
		$('javaEnabled').style.display = "none";
	}
}
function ApplyNow()
{
	var slide = new Fx.Slide('appform', {
		onComplete: function() {
			$('applyLink').remove();
		}
	}).hide();
	$('appform').removeClass('hide');
	slide.slideIn();
	
}
function displayForm()
{
	Effect.toggle('jobForm','appear');
	$('applyLink').style.display = "none";
}

function swapPortfolio(show) {
	//debugger;
	$$('.projectlist').each(function(item){ 
		if (!item.hasClass('hide')) item.addClass('hide');
	});
	$(show + 'list').removeClass('hide');
}

window.addEvent('domready', function() {
	$$('.time').each(function(item){
		item.removeClass('time');
		item.load(path + "/site/time.rails?timezone=" + item.get('class'));
	});
	/*	var box1 = new SelectBox('portfolio_select', {
			button: { 'isImage': true, 'open': siteRoot + '/images/layout/button_open.png', 'close': siteRoot + '/images/layout/button_close.png' },
			listClass: 'dropDownList',
			offset: 0,
			listLength:5,
			listStyles: { 
				'color': '#000',
				'overBackgroundColor': '#000',
				'overColor': '#FFFF00',
				'baseBackground': '#999',
				'backgroundColor': 'transparent',
				'height': 18
			},
			listWidthAdj: 0
		});
		var box2 = new SelectBox('job_select', {
		button: { 'isImage': true, 'open': siteRoot + '/images/layout/button_open.png', 'close': siteRoot + '/images/layout/button_close.png' },
		listClass: 'dropDownList',
		offset: 0,
		listLength:10,
		listStyles: { 
			'color': '#000',
			'overBackgroundColor': '#000',
			'overColor': '#FFFF00',
			'baseBackground': '#999',
			'backgroundColor': 'transparent',
			'height': 18
		},
		listWidthAdj: 0
	});*/
});