// JavaScript Document

$(document).ready(function() {
  $("a.link").click(function() {
     $("p.id0").toggle("slow");
   });
  $("a.pitem").click(function() {
     $("div.pdescr").hide("slow");
	 $("a.pitem").addClass("pact");
	 $("a.pitem").removeClass("pact");
   });
  $("a.id0").click(function() {
     $("div.id0").show("slow");
	 $("a.id0").addClass("pact");
   });
  $("a.id1").click(function() {
     $("div.id1").show("slow");
	 $("a.id1").addClass("pact");
   });
  $("a.id2").click(function() {
     $("div.id2").show("slow");
	 $("a.id2").addClass("pact");
   });
  $("a.id3").click(function() {
     $("div.id3").show("slow");
	 $("a.id3").addClass("pact");
   });
  $("a.id4").click(function() {
     $("div.id4").show("slow");
	 $("a.id4").addClass("pact");
   });
  $("a.id5").click(function() {
     $("div.id5").show("slow");
	 $("a.id5").addClass("pact");
   });
  $("a.id6").click(function() {
     $("div.id6").show("slow");
	 $("a.id6").addClass("pact");
   });
  $("a.id7").click(function() {
     $("div.id7").show("slow");
	 $("a.id7").addClass("pact");
   });
  $("a.id8").click(function() {
     $("div.id8").show("slow");
	 $("a.id8").addClass("pact");
   });
  $("a.id9").click(function() {
     $("div.id9").show("slow");
	 $("a.id9").addClass("pact");
   });
  $("a.id10").click(function() {
     $("div.id10").show("slow");
	 $("a.id10").addClass("pact");
   });
  $("a.id11").click(function() {
     $("div.id11").show("slow");
	 $("a.id11").addClass("pact");
   });
  $("a.id12").click(function() {
     $("div.id12").show("slow");
	 $("a.id12").addClass("pact");
   });
  $("a.id13").click(function() {
     $("div.id13").show("slow");
	 $("a.id13").addClass("pact");
   });
  $("a.id14").click(function() {
     $("div.id14").show("slow");
	 $("a.id14").addClass("pact");
   });
  $("a.id15").click(function() {
     $("div.id15").show("slow");
	 $("a.id15").addClass("pact");
   });
  $("a.id16").click(function() {
     $("div.id16").show("slow");
	 $("a.id16").addClass("pact");
   });
  $("a.id17").click(function() {
     $("div.id17").show("slow");
	 $("a.id17").addClass("pact");
   });
  $("a.id18").click(function() {
     $("div.id18").show("slow");
	 $("a.id18").addClass("pact");
   });
  $("a.id19").click(function() {
     $("div.id19").show("slow");
	 $("a.id19").addClass("pact");
   });
  $("a.id20").click(function() {
     $("div.id20").show("slow");
	 $("a.id20").addClass("pact");
   });  
 });

jQuery(document).ready(
	function(){
		jQuery('ul#rotator').innerfade({
		speed: 1500,
		timeout: 25000,
		type: 'random',
		containerheight: '200px'
		});
	});

function selectIt(tekst){
	if (1 == 1)  {
		if (tekst.value == "") {
			alert('Enter a value.');
		}
		else{
			tekst.focus();
			tekst.select();
		}
	}
}
function checkMail(adres,tekst) {
	if ((adres.indexOf("@") == -1) || (adres.indexOf(".") == -1 )) {
		alert(adres + ' is not a valid e-mail address. \n\nEnter a valid one.');
		tekst.focus();
		tekst.select();
	}
}
function ConfirmCDR(formke) {
	if (document.form1.agreement.checked) {
		formke.submit();
	}
	else {
		alert('Before you can confirm your participation you need to agree with the declaration.');
	}
}

// roulette.js

function hideContent ( selectedButton, sTypeEl, buttonActive, buttonNonActive, elClassShow )
{
	var buttons = selectedButton.parentNode.getElementsByTagName ( sTypeEl );
	
	
	for ( var i = 0; i < buttons.length; i++ )
	{
		if ( buttons[i] == selectedButton )
		{
			buttons[i].className = buttonActive;
			document.getElementById('tab' + i).className = 'showblock';
		}
		else
		{
			//alert(buttons[i]);
			buttons[i].className = buttonNonActive;
			document.getElementById('tab' + i).className = 'hidden';
		}
	}
}

function roulette ()
{
	var els = document.getElementById ( 'fptabs' );
	var _self;
	
	if ( els )
	{
		els = els.getElementsByTagName ( 'a' );
		
		for ( var i = 0; i < els.length; i++ )
		{
			if ( els[i].className == 'active' )
			{
				els[i].className = 'nonact';
				
				if ( i == els.length - 1 )
					_self = els[0];
				else
					_self = els[i+1];
				
				_self.className = 'active';
				
				hideContent ( _self, 'a', 'active', '', 'input' );
				
				break;
			}
		}
	}
}

function openLink(url)
{
	window.location.href = 'http://www.vehicledesignsummit.be/' + url;
}