window.onload = init;

function init() {
	initHightlight3Steps();
}

$(function() {
	$('img.tooltip').Tooltip({
		delay: 0,
		track: true,
		showURL: false,
		showBody: "; "
	});
	$.fn.search = function() {
		return this.focus(function() {
			if( this.value == this.defaultValue ) {
				this.value = "";
			}
		}).blur(function() {
			if( !this.value.length ) {
				this.value = this.defaultValue;
			}
		});
	};
	$("#s").search();
});



function playMov(id) {
	$('#backscreen').show(); // show backscreen div
	$('#flashcontent').hide(); // hide flash banner div i.v.m. backscreen 
	$('#movie').show(); // show movie div
	$('#playertop').html('<a href="#movie-be18-close" onClick="closeMov(\'held\')" class="black">X</a>');	
	$('#playerbottom').show(); // show player div
	$('#playerbottom').html('<a href="#movie-be18-close" onClick="closeMov(\'held\')" class="black">Venster sluiten</a>');
	
	if (id) 
	{
		$('#player').show(); // show player div

		var so = new SWFObject('http://www.all-in-solo.nl/media/flvplayer.swf','mpl','384','288','7');
		so.addParam('allowfullscreen','true');
		so.addParam('allowscriptaccess','always');
		so.addVariable('file','http://www.all-in-solo.nl/media/all-in-solo.flv');
		so.addVariable("image","http://www.all-in-solo.nl/images/movie_screen01.jpg");		
		so.addVariable('height','288');
		so.addVariable('width','384');
		so.write('player');		
	}
	else {
		$('#movie').html('<h2>Film kan niet gevonden worden.</h2>');
	}
}	

function closeMov(id) {
	$('#backscreen').hide(); 
	$('#movie').hide();
	$('#player').html(''); // Player legen, zodat film niet blijft doorspelen
	$('#flashcontent').show();
}	


/*
 * initHightlight3Steps
 * Hightlights one of the three steps.
 * 
 * @author Ralph Meeuws (ralph-meeuws[AT]efocus.nl)
 */
function initHightlight3Steps() {
	if (!document.getElementById('trial_3steps_list')) return;

	var arrTrial3StepsListItems = document.getElementById('trial_3steps_list').getElementsByTagName('li');
	var countSteps = arrTrial3StepsListItems.length;
	var timer;
	var delay = 3500;
	
	timed3Steps = function () {
		countSteps = (countSteps >= arrTrial3StepsListItems.length - 1) ? 0 : countSteps + 1;
		for (var i=0; i < arrTrial3StepsListItems.length; i++) {
			arrTrial3StepsListItems[i].className = (i == countSteps) ? 'active' : '';
		}
		timer = setTimeout("timed3Steps()", delay);
	}
	
	timed3Steps();
}
