/* This script by $criptMaster B  Duall 2008 */
/* JQuery 1.2.6 needed */
/* www.duall.be */

////////////////////////////////////////////////////////////////////////////////////////////

$(document).ready(function(){

WSWslide("#slideshow");
WSWshootNewsinTabs();
WSWtabs();
WSW_dl_showHide();
});

////////////////////////////////////////////////////////////////////////////////////////////
function WSWtabs() {
	
	$('#tabs').tabs();
	
}

function WSWshootNewsinTabs() {
	if ( $('#blog').length>0){
	news = $(".WSWpageNews").html();
	$("#blog").html(news);
	$(".WSWpageNews").remove();

}
}


function WSWslide(DIV){

	//$(DIV+" br").remove();
	$(DIV).cycle({   
	fx:    'fade', 
    speed:  2500,
    pause: 1
    });
}
////////////////////////////////////////////////////////////////////////////////////////////

function WSWfixNav(){

	var a = $("ul.WSWnav li:eq(0)").html(); //blog
	var b = $("ul.WSWnav li:eq(1)").html(); //home
	//$("ul.WSWnav li:eq(0)").after("<li>"+a+"</li>");
	$("ul.WSWnav li:eq(0)").replaceWith("<li>"+b+"</li>");
	$("ul.WSWnav li:eq(1)").replaceWith("<li>"+a+"</li>");



}


////////////////////////////////////////////////////////////////////////////////////////////

function WSWhome(){
	$(window).bind('load', function(){
		var preload = [
		'http://www.workshopweek.be/wp-content/themes/workshopweek2009/img/01.jpg',
		'http://www.workshopweek.be/wp-content/themes/workshopweek2009/img/02.jpg',
		'http://www.workshopweek.be/wp-content/themes/workshopweek2009/img/03.jpg',
		'http://www.workshopweek.be/wp-content/themes/workshopweek2009/img/04.jpg',
		'http://www.workshopweek.be/wp-content/themes/workshopweek2009/img/05.jpg',
		'http://www.workshopweek.be/wp-content/themes/workshopweek2009/img/06.jpg',
		'http://www.workshopweek.be/wp-content/themes/workshopweek2009/img/07.jpg',
		'http://www.workshopweek.be/wp-content/themes/workshopweek2009/img/08.jpg',
		'http://www.workshopweek.be/wp-content/themes/workshopweek2009/img/09.jpg',

		];           
		$(document.createElement('img')).bind('load', function(){
			if(preload[0]) this.src = preload.shift();
			}).trigger('load');
		});
	$("ul.homeNav li").mouseover(function(){
		var klas = $(this).attr("class");
		var klas = klas.substr(20);
	var j = 0;
		switch(klas)
			{
				case "95":
					j = 1;
				break;
				case "105":
					j = 2
 				break;
 				case "108":
					j = 3
 				break;
 				case "111":
					j = 4
 				break;
				case "113":
					j = 5
 				break;
				case "115":
					j = 6
 				break;
				case "117":
					j = 7
 				break;
				case "119":
					j = 8
 				break;
				case "121":
					j = 9
 				break;
				default:
					j = 0
			}	
		$("div.logo").css("background-image","url(http://www.workshopweek.be/wp-content/themes/workshopweek2009/img/0"+j+".jpg)");
		});
		
	$("ul.homeNav li").mouseout(function(){
		$("div.logo").css("background-image","url(http://www.workshopweek.be/wp-content/themes/workshopweek2009/img/00.jpg)");
		});

}

////////////////////////////////////////////////////////////////////////////////////////////

//opgelet Packed version niet gebruiken voor IE — We love you Bill!
function WSWvalidate() {
	$("form#wswItalie").validate({ 
		rules: {
		aantal: "required",
		adres: {
		       required: true,
		       email: true
		     			}
	  		},
		messages:{
		adres: {
			required: "&uarr; we hebben jouw e-mail nodig om je te contacteren",
			email: "&uarr; e-mail moet in het volgende formaat: naam@artesis.be"
			},
		aantal: {
			required: "&uarr; sorry, maar we hebben het aantal deelnemers nodig"
			}
			
			}
		});
}
////////////////////////////////////////////////////////////////////////////////////////////

function WSW_dl_showHide() {
$("#blog dd").hide();
//$("dt").wrapInner("<a href='#&nbsp;'></a>");
$("#blog dt").hover(
	function(){$(this).addClass("dtHover");},
	function(){$(this).removeClass("dtHover");}

);
$("#blog dt").toggle(
	function(){
		$(this).addClass("dtActive");
		$(this).next("dd").show();
	},
	function(){
		$(this).removeClass("dtActive");
		$(this).next("dd").hide();

	});

}