// JavaScript Document

//browsercheck
var navi 		= navigator.appVersion;
var browserIE 	= false;
var browserIE6 	= false;
var browserSAF 	= false;
var scrollSpeed = 50;
var scrollHeight= 10;

if(navi.indexOf("MSIE")>-1){
	browserIE = true;
	var navAr = navi.split(";");
	browserIE6 = (parseFloat(navAr[1].split(" ")[2])<=6.0?true:false);
} else if(navi.indexOf("Safari")>-1){
	browserSAF = true;
}

if (document.images)
{
	preload_image_object1 = new Image();
	image_url = new Array();
	image_url_active = new Array();
	image_url[0] = "images/logo.jpg";
	image_url[8] = "images/btns/czc_agenda.gif";
	image_url[9] = "images/btns/czc_fotos.gif";
	image_url[10] = "images/btns/czc_contact.gif";
	
	image_url[11] = "images/btns/agency_artists.gif";
	image_url[12] = "images/btns/agency_agenda.gif";
	image_url[13] = "images/btns/agency_philosophy.gif";
	image_url[14] = "images/btns/agency_contact.gif";
	
	//over
	image_url_active[8] = "images/btns/czc_agenda_over.gif";
	image_url_active[9] = "images/btns/czc_fotos_over.gif";
	image_url_active[10] = "images/btns/czc_contact_over.gif";
	
	image_url_active[11] = "images/btns/agency_artists_over.gif";
	image_url_active[12] = "images/btns/agency_agenda_over.gif";
	image_url_active[13] = "images/btns/agency_philosophy_over.gif";
	image_url_active[14] = "images/btns/agency_contact_over.gif";
	
	preload_image_object1.src = image_url[0];
	
}

var besch_1 		= 0;
var besch_2 		= 0;
var breedte 		= 0;
var hoogte  		= 0;
var pos_x  			= 0;
var pos_y  			= 0;
var boven			= 0;
var links			= 0;
var containerwidth	= 800;
var containerheight	= 505;

var current_page		= 0;
var current_pageCZC		= 0;
var current_pageAgency	= 0;

var addon = "_artist";
var advisor_stage = 0;

function SetInterface(){
	changeAlpha('div_container', 0, 0.1, 0);
	changeAlpha('div_content_2', 0, 0.1, 0);
	
	var width_Avail = screen.availWidth;
	var heigth_Avail = screen.availHeight;
	
	
	window.moveTo(0,0);
	window.resizeTo(width_Avail,heigth_Avail);
	
	
	if(!browserSAF){
		var width_container 	= Math.round((document.documentElement.clientWidth * 0.98));
		var heigth_container 	= Math.round((document.documentElement.clientHeight * 0.97));
	}else{
		var width_container 	= Math.round((window.innerWidth * 0.95));
		var heigth_container 	= Math.round((window.innerHeight * 0.95));
	}
	besch_1 = width_container;
	besch_2 = heigth_container;
	
  	hoogte  	= containerheight;
	breedte  	= containerwidth;		

	pos_x = parseInt((besch_1 - breedte) / 2);
	pos_y = parseInt((besch_2 - hoogte) / 2);
	
	document.getElementById("div_index").style.height = besch_2 + 'px';
	document.getElementById("div_index").style.width = besch_1 + 'px';
	
	document.getElementById("menu_1").style.left = '-300px';
	document.getElementById("menu_2").style.left = '-400px';
	document.getElementById("menu_3").style.left = '-500px';
	document.getElementById("menu_4").style.left = '-600px';
	document.getElementById("menu_5").style.left = '-700px';
	document.getElementById("menu_6").style.left = '-800px';
	document.getElementById("menu_15").style.left = '-900px';
	//changePosBy(0, -300, 'menu_1', 0.1, YAHOO.util.Easing.easeOut);
	
	document.getElementById('pre_load').style.display = 'none';
	
	document.getElementById("div_container").style.left = pos_x + 'px';
	document.getElementById("div_container").style.top = pos_y + 'px';
	document.getElementById("powered_by").style.left = (pos_x + (breedte - 70)) + 'px';
	document.getElementById("powered_by").style.top = (pos_y + (hoogte + 20)) + 'px';
	
	//changeAlpha('div_container', 1, 1, 0);
	
	//YUI color
	var element = document.getElementById('div_index'); 
	var myAnim 	= new YAHOO.util.ColorAnim(element, {backgroundColor: { to: '#000000' } }, 2); 
	myAnim.onComplete.subscribe(function(){
		changeAlpha('div_container',1,1,0);
		document.getElementById("powered_by").style.display = 'block';
		changeSizeTo(800, 72, 'div_header', 2, YAHOO.util.Easing.bounceOut)
		//changePosBy(300, 0, 'menu_1', 1, YAHOO.util.Easing.bounceOut);
		changePosBy(400, 0, 'menu_2', 1.5, YAHOO.util.Easing.bounceOut);
		changePosBy(500, 0, 'menu_3', 2, YAHOO.util.Easing.bounceOut);
		changePosBy(600, 0, 'menu_4', 2.5, YAHOO.util.Easing.bounceOut);
		changePosBy(700, 0, 'menu_5', 3, YAHOO.util.Easing.bounceOut);
		changePosBy(800, 0, 'menu_6', 3.5, YAHOO.util.Easing.bounceOut);
		changePosBy(900, 0, 'menu_15', 4, YAHOO.util.Easing.bounceOut);
		
		var attributes = {
			left: 
				{ by: 300}
		};
		var anim1 = new YAHOO.util.Motion('menu_1', attributes, 1, YAHOO.util.Easing.bounceOut);
		anim1.onComplete.subscribe(function(){
			var so = new SWFObject("homepage.swf", "BARKODE", "300", "300", "9", "86A098");
			so.addVariable("flashVarText", "this is passed in via FlashVars"); 
			so.addParam("wmode", "transparent"); 
			so.useExpressInstall('expressinstall.swf');
			so.write("content_1");
		});
		anim1.animate()
	});
	myAnim.animate();
	
}

function SetInterfaceCZC(){
    changeAlpha('div_container', 0, 0.1, 0);
	changeAlpha('div_content_2', 0, 0.1, 0);
	
	var width_Avail = screen.availWidth;
	var heigth_Avail = screen.availHeight;
	
	
	if(browserIE && browserIE6==false	){
		//alert(width_Avail);
		//alert(heigth_Avail);
	}else{
		window.moveTo(0,0);
		window.resizeTo(width_Avail,heigth_Avail);
	}
	
	
	if(!browserSAF){
		var width_container 	= Math.round((document.documentElement.clientWidth * 0.98));
		var heigth_container 	= Math.round((document.documentElement.clientHeight * 0.97));
	}else{
		var width_container 	= Math.round((window.innerWidth * 0.95));
		var heigth_container 	= Math.round((window.innerHeight * 0.95));
	}
	
	
	besch_1 = width_container;
	besch_2 = heigth_container;
	
	if(besch_1<900){
		besch_1 = 900;
	}
	if(besch_2<600){
		besch_2 = 600;
	}
	
  	hoogte  	= containerheight;
	breedte  	= containerwidth;		

	pos_x = parseInt((besch_1 - breedte) / 2);
	pos_y = parseInt((besch_2 - hoogte) / 2);
	
	document.getElementById("div_index").style.height = besch_2 + 'px';
	document.getElementById("div_index").style.width = besch_1 + 'px';
	
	document.getElementById("menu_1").style.left = '-300px';
	document.getElementById("menu_2").style.left = '-400px';
	document.getElementById("menu_3").style.left = '-500px';
	document.getElementById("menu_4").style.left = '-600px';
	document.getElementById("menu_5").style.left = '-700px';
	document.getElementById("menu_6").style.left = '-800px';
	document.getElementById("menu_15").style.left = '-900px';
	//changePosBy(0, -300, 'menu_1', 0.1, YAHOO.util.Easing.easeOut);
	
	document.getElementById('pre_load').style.display = 'none';
	
	document.getElementById("div_container").style.left = pos_x + 'px';
	document.getElementById("div_container").style.top = pos_y + 'px';
	document.getElementById("powered_by").style.left = (pos_x + (breedte - 70)) + 'px';
	document.getElementById("powered_by").style.top = (pos_y + (hoogte + 20)) + 'px';
	
	//changeAlpha('div_container', 1, 1, 0);
	
	//YUI color
	var element = document.getElementById('div_index'); 
	var myAnim 	= new YAHOO.util.ColorAnim(element, {backgroundColor: { to: '#000000' } }, 2); 
	myAnim.onComplete.subscribe(function(){
		changeAlpha('div_container',1,1,0);
		document.getElementById("powered_by").style.display = 'block';
		changeSizeTo(800, 72, 'div_header', 2, YAHOO.util.Easing.bounceOut)
		openCZCSimple();
	});
	myAnim.animate();
	
}

function SetInterfaceAgency(){
	changeAlpha('div_container', 0, 0.1, 0);
	changeAlpha('div_content_2', 0, 0.1, 0);
	
	var width_Avail = screen.availWidth;
	var heigth_Avail = screen.availHeight;
	
	$('content_start').setStyle('display','block');
	
	if(browserIE && browserIE6==false	){
		//alert(width_Avail);
		//alert(heigth_Avail);
	}else{
		window.moveTo(0,0);
		window.resizeTo(width_Avail,heigth_Avail);
	}
	
	
	if(!browserSAF){
		var width_container 	= Math.round((document.documentElement.clientWidth * 0.98));
		var heigth_container 	= Math.round((document.documentElement.clientHeight * 0.97));
	}else{
		var width_container 	= Math.round((window.innerWidth * 0.95));
		var heigth_container 	= Math.round((window.innerHeight * 0.95));
	}
	
	
	besch_1 = width_container;
	besch_2 = heigth_container;
	
	if(besch_1<900){
		besch_1 = 900;
	}
	if(besch_2<600){
		besch_2 = 600;
	}
	
  	hoogte  	= containerheight;
	breedte  	= containerwidth;		

	pos_x = parseInt((besch_1 - breedte) / 2);
	pos_y = parseInt((besch_2 - hoogte) / 2);
	
	document.getElementById("div_index").style.height = besch_2 + 'px';
	document.getElementById("div_index").style.width = besch_1 + 'px';
	
	document.getElementById("menu_1").style.left = '-300px';
	document.getElementById("menu_2").style.left = '-400px';
	document.getElementById("menu_3").style.left = '-500px';
	document.getElementById("menu_4").style.left = '-600px';
	document.getElementById("menu_5").style.left = '-700px';
	document.getElementById("menu_6").style.left = '-800px';
	document.getElementById("menu_15").style.left = '-900px';
	//changePosBy(0, -300, 'menu_1', 0.1, YAHOO.util.Easing.easeOut);
	
	document.getElementById('pre_load').style.display = 'none';
	
	document.getElementById("div_container").style.left = pos_x + 'px';
	document.getElementById("div_container").style.top = pos_y + 'px';
	document.getElementById("powered_by").style.left = (pos_x + (breedte - 70)) + 'px';
	document.getElementById("powered_by").style.top = (pos_y + (hoogte + 20)) + 'px';
	
	//changeAlpha('div_container', 1, 1, 0);
	
	//YUI color
	var element = document.getElementById('div_index'); 
	var myAnim 	= new YAHOO.util.ColorAnim(element, {backgroundColor: { to: '#000000' } }, 2); 
	myAnim.onComplete.subscribe(function(){
		changeAlpha('div_container',1,1,0);
		document.getElementById("powered_by").style.display = 'block';
		changeSizeTo(800, 72, 'div_header', 2, YAHOO.util.Easing.bounceOut)
		openAgencySimple();
	});
	myAnim.animate();
}

function activateMenu(menu_id){
	document.getElementById("menu_"+menu_id).style.borderColor = "#969696";
}
function deActivateMenu(menu_id){
	document.getElementById("menu_"+menu_id).style.borderColor = "#383838";
}
function activateMenuCZC(menu_id){
	document.getElementById("btn_"+menu_id).src = image_url_active[menu_id];
}
function deActivateMenuCZC(menu_id){
	document.getElementById("btn_"+menu_id).src = image_url[menu_id];
}
function activateMenuAgency(menu_id){
	document.getElementById("btn_"+menu_id).src = image_url_active[menu_id];
}
function deactivateMenuAgency(menu_id){
	document.getElementById("btn_"+menu_id).src = image_url[menu_id];
}

function disableNload(id, current_page){
	if(current_page==0 && browserSAF==true){
		document.getElementById('div_content_1').innerHTML = '';
	}
	
	var attributes_Pos = {
	  	left: 
			{ to: 800},
	  	top: 
			{ to: 75}
	};
	var anim1 = new YAHOO.util.Motion('div_content_1', attributes_Pos, 0.5, YAHOO.util.Easing.easeIn);
	anim1.onComplete.subscribe(function(){
		openNextPage(id);	
	});
	anim1.animate();
}

function disableNloadCZC(id, current_pageCZC){
	var attributes_Pos = {
	  	left: 
			{ to: 195},
	  	top: 
			{ to: 800}
	};
	var anim1 = new YAHOO.util.Motion('div_content_1', attributes_Pos, 0.5, YAHOO.util.Easing.easeIn);
	anim1.onComplete.subscribe(function(){
		openNextPageCZC(id);	
	});
	anim1.animate();
}

function disableNloadAgency(id, current_pageAgency){
	var attributes_Pos = {
	  	left: 
			{ to: 195},
	  	top: 
			{ to: 800}
	};
	var anim1 = new YAHOO.util.Motion('div_content_1', attributes_Pos, 0.5, YAHOO.util.Easing.easeIn);
	anim1.onComplete.subscribe(function(){
		openNextPageAgency(id);	
	});
	anim1.animate();
}

function setPage(id){
	if(id!=current_page){
		//open new
		disableNload(id, current_page);
	}
}

function setPageCZC(id){
	if(id!=current_pageCZC){
		//open new
		disableNloadCZC(id, current_pageCZC);
	}
}

function setPageAgency(id){
	if(id!=current_pageAgency){
		//open new
		
		searchvalue = '';
		curr_search	= false;
		
		disableNloadAgency(id, current_pageAgency);
	}
}


function setPageAgencyAgenda(history){
	makePOSTRequest('agendaAgency.php?history='+history, '', 'content');
}

var selected_client = 0;
function setConceptsClient(client){
	selected_client = client
	id = 55;
	disableNload(id, current_page);
}

function setConceptCat(soort, cat){
	var poststr = "&soort="+soort+"&cat="+cat
	makePOSTRequest('concepts.php', poststr, 'content');
}

function openNextPage(id){
	current_page = id;
	switch(current_page){
		case 1:
			var poststr = "&soort=1&cat=0"
			makePOSTRequest('concepts.php', poststr, 'content');
		break;
		case 2:
			var poststr = "&soort=2&cat=0"
			makePOSTRequest('concepts.php', poststr, 'content');
		break;
		case 3:
			var poststr = "&soort=3&cat=0"
			makePOSTRequest('concepts.php', poststr, 'content');
		break;
		case 4:
			var poststr = "&soort=4&cat=0"
			makePOSTRequest('concepts.php', poststr, 'content');
		break;
		case 5:
			makePOSTRequest('clients.php', '', 'content');
		break;
		case 55:
			var poststr = "&client="+selected_client;
			makePOSTRequest('conceptsClients.php', poststr, 'content');
		break;
		case 6:
			makePOSTRequest('contact.html', '', 'content');
		break;
	}
}

var agenda_info = 0;
function openNextPageCZC(id){
	current_pageCZC = id;
	switch(current_pageCZC){
		case 1:
			agenda_info = 0;
			var poststr = "&soort=1"
			makePOSTRequest('agendaCZC.php', poststr, 'content');
		break;
		case 2:
			var poststr = "&soort=2"
			makePOSTRequest('galleryCZC.php', poststr, 'content');
		break;
		case 3:
			makePOSTRequest('contactCZC.html', '', 'content');
		break;
	}
}

function openNextPageAgency(id){
	current_pageAgency = id;
	
	$('content_start').setStyle('display','none');
	
	switch(current_pageAgency){
		case 1:
			curr_artist = 0;
			curr_search = false;
			makePOSTRequest('artistsAgency.php', '', 'content');
		break;
		case 2:
			makePOSTRequest('agendaAgency.php', '', 'content');
		break;
		case 3:
			makePOSTRequest('philosophyAgency.html', '', 'content');
		break;
		case 4:
			makePOSTRequest('contactAgency.html', '', 'content');
		break;
	}
}

function changeSizeTo(a, b, target, speed, motion){
	var attributes_Size = {
	  	width: 
			{ to: a},
	  	height: 
			{ to: b}
	};
	var anim1 = new YAHOO.util.Motion(target, attributes_Size, speed, motion);
	anim1.animate();	
}

function changeSizeBy(a, b, target, speed, motion){
	var attributes_Size = {
	  	width: 
			{ by: a},
	  	height: 
			{ by: b}
	};
	var anim1 = new YAHOO.util.Motion(target, attributes_Size, speed, motion);
	anim1.animate();	
}

function changePosTo(a, b, target, speed, motion){
	var attributes_Size = {
	  	left: 
			{ to: a},
	  	top: 
			{ to: b}
	};
	var anim1 = new YAHOO.util.Motion(target, attributes_Size, speed, motion);
	anim1.animate();	
}

function changePosToAndOpen(a, b, target, speed, motion, pageLoad, containerid){
	var attributes_Size = {
	  	left: 
			{ to: a},
	  	top: 
			{ to: b}
	};
	var anim1 = new YAHOO.util.Motion(target, attributes_Size, speed, motion);
	anim1.onComplete.subscribe(function(){
		ajaxpage(pageLoad, containerid);
	});
	anim1.animate();	
}

function changePosBy(a, b, target, speed, motion){
	var attributes_Size = {
	  	left: 
			{ by: a},
	  	top: 
			{ by: b}
	};
	var anim1 = new YAHOO.util.Motion(target, attributes_Size, speed, motion);
	anim1.animate();	
}

function changeAlpha(target, alpha, speed, action){
	if(alpha==1){
		document.getElementById(target).style.display = "block";	
	}
	var attributes = {
	opacity: 
		{ to: alpha } 
	};
	var anim = new YAHOO.util.Motion(target, attributes, speed, YAHOO.util.Easing.easeOut);
	if(alpha==0){
		anim.onComplete.subscribe(function(){
			document.getElementById(target).style.display = "none";	
		});
	}		
	anim.animate();
}

//common function
function ajaxpage(url, containerid){
	var page_request = false
	if (window.XMLHttpRequest) // if Mozilla, Safari etc
		page_request = new XMLHttpRequest()
	else if (window.ActiveXObject){ // if IE
		try {
			page_request = new ActiveXObject("Msxml2.XMLHTTP")
		} 
		catch (e){
			try{
				page_request = new ActiveXObject("Microsoft.XMLHTTP")
			}
		catch (e){}
		}
	}
	else
		return false
		page_request.onreadystatechange=function(){
		loadpage(page_request, containerid)
	}
	page_request.open('GET', url, true)
	page_request.send(null)
}

function loadpage(page_request, containerid){
	//alert(containerid);
	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)){
		document.getElementById(containerid).innerHTML = page_request.responseText;
	}
}

function makePOSTRequest(url, parameters, category) {
	http_request = false;
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
	 		if (http_request.overrideMimeType) {
				http_request.overrideMimeType('text/html');
	 		}
		} else if (window.ActiveXObject) { // IE
	 		try {
				http_request = new ActiveXObject("Msxml2.XMLHTTP");
	 		} catch (e) {
			try {
		   		http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
	 	}
	}
	if (!http_request) {
		alert('Cannot create XMLHTTP instance');
		return false;
	}
	
	switch(category){
		case 'formcontent':
			document.getElementById('formcontent').innerHTML = '<img src="images/loader.gif">';
			http_request.onreadystatechange = alertContentBookMe;
		break;
		case 'content':
			document.getElementById('div_content_1').innerHTML = '<img src="images/loader.gif">';
			http_request.onreadystatechange = alertContent;
		break;
		case 'image':
			http_request.onreadystatechange = alertContentImages;
		break;
		case 'advisor':
			switch(advisor_stage){
				case 0:
					document.getElementById('div_content_2'+addon).innerHTML = '<img src="images/loader.gif">';
					http_request.onreadystatechange = alertAdvisorResult;
				break;
				case 1:
					document.getElementById('div_content_3'+addon).innerHTML = '<img src="images/loader.gif">';
					http_request.onreadystatechange = alertAdvisorResult;
				break;
				case 2:
					document.getElementById('div_content_4'+addon).innerHTML = '<img src="images/loader.gif">';
					http_request.onreadystatechange = alertAdvisorResult;
				break;
				case 3:
					document.getElementById('div_content_5'+addon).innerHTML = '<img src="images/loader.gif">';
					http_request.onreadystatechange = alertAdvisorResult;
				break;
				case 4:
					document.getElementById('div_content_6'+addon).innerHTML = '<img src="images/loader.gif">';
					http_request.onreadystatechange = alertAdvisorResult;
				break;
			}
		break;
		
	} 
	
	http_request.open('POST', url, true);
	http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http_request.setRequestHeader("Content-length", parameters.length);
	http_request.setRequestHeader("Connection", "close");
	http_request.send(parameters);
}

function alertContent() {
	if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			result = http_request.responseText;
			document.getElementById('div_content_1').innerHTML = result;
			var attributes_Pos = {
				left: 
					{ to: 195},
				top: 
					{ to: 75}
			};
			var anim1 = new YAHOO.util.Motion('div_content_1', attributes_Pos, 1.0, YAHOO.util.Easing.easeOut);
			anim1.animate();
			
		} else {
			alert('Er is een probleem opgetreden, probeer het nogmaals.');
		}
	}
}

function alertContentBookMe() {
	if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			result = http_request.responseText;
			document.getElementById('formcontent').innerHTML = result;
		} else {
			alert('Er is een probleem opgetreden, probeer het nogmaals.');
		}
	}
}


function alertContentImages() {
	if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			result = http_request.responseText;
			var arreetje = result.split('###');
			
			if(current_pageAgency!=0){
				$('big_image_txt').setStyle('width',250);
				$('big_image_txt').setStyle('height',400);
			}else{
				$('big_image_txt').setStyle('width',180);
				$('big_image_txt').setStyle('height',300);
			}
			document.getElementById('big_image_txt').innerHTML = arreetje[0];
			document.getElementById('big_image_thumbs').innerHTML = arreetje[1];
			document.getElementById('big_image_content').innerHTML = arreetje[2];
			
		} else {
			alert('Er is een probleem opgetreden, probeer het nogmaals.');
		}
	}
}

function alertAdvisorResult(){
	if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			result = http_request.responseText;
			switch(advisor_stage){
				case 0:
					document.getElementById('div_content_2'+addon).innerHTML = result;
				break;
				case 1:
					document.getElementById('div_content_3'+addon).innerHTML = result;
				break;
				case 2:
					document.getElementById('div_content_4'+addon).innerHTML = result;
					if(current_pageAgency==1){
						var THEaccordion = new Accordion('h3.atStart', 'div.atStart', {
						show : 1000,
						opacity: true,
						onActive: function(toggler, element){
							document.getElementById('scrollcontent').scrollTop=0;
							toggler.setStyle('color', '#ec008c');
						},
	 					onBackground: function(toggler, element){
							toggler.setStyle('color', '#f0f0f0');
							toggler.setStyle('cursor', 'pointer');
							//alert(1);
						}}, $('scrollcontent'));
						//var myScroller = new Scroller('scrollcontent');
						//myScroller.start();
					}
				break;
				case 3:
					document.getElementById('div_content_5'+addon).innerHTML = result;
				break;
				case 4:
					document.getElementById('div_content_6'+addon).innerHTML = result;
				break;
			}
			//ie6PNGFix();
		} else {
			alert('Er is een probleem opgetreden, probeer het nogmaals.');
		}
	}	
}

var foto = false;
var txt = false;

function setLeesMeer(folder,photo_id,target,concept_id){
	txt = true;
	changeAlpha('div_content_2',1,1,0);
	changeAlpha('big_image_content',1,0.1,0);
	changeAlpha(target+'_loader',0,0.1,0);
	document.getElementById('big_image_im').style.display = "none";
	var poststr = "&concept="+concept_id;
	if(czc==0){
		makePOSTRequest('concept.php', poststr, 'image');
	}else{
		makePOSTRequest('galleryCZC_party.php', poststr, 'image');
	}
}

function setBigImage(folder,photo_id,target,concept_id){
	if(foto == false){
		foto = true
		if(txt==false){
			changeAlpha('div_content_2',1,1,0);
		}else{
			changeAlpha('big_image_content',0,1,0);
			txt = false;
		}
		document.getElementById('big_image_im').style.display = "block";
		changeAlpha(target+'_loader',1,1,0);
		changeAlpha('big_image_content',0,0.1,0);
		alphaImage(target, 0, 0.6, folder, photo_id, 0);
		var poststr = "&concept="+concept_id;
		if(czc==0){
			makePOSTRequest('concept.php', poststr, 'image');
		}else{
			if(current_pageAgency!=0){
				poststr+="&folder="+folder;
				makePOSTRequest('galleryArtistAgency.php', poststr, 'image');
				$('close_artist').setStyle('display', 'block');
				$('menu_7').setStyle('display', 'none');
			}else{
				poststr+="&folder="+folder;
				makePOSTRequest('galleryCZC_party.php', poststr, 'image');
			}
		}
	}else{
		changeAlpha(target+'_loader',1,0.4,0);
		alphaImage(target, 0, 0.6, folder, photo_id, 0);
	}
}

function closeImages(){
	
	if(current_pageAgency!=0){
		$('close_artist').setStyle('display', 'none');
		$('menu_7').setStyle('display', 'block');
	}
	
	var attributes = {
		opacity: 
			{ to: 0 } 
		};
	var anim = new YAHOO.util.Motion('div_content_2', attributes, 1, YAHOO.util.Easing.easeOut);
	anim.onComplete.subscribe(function(){
		document.getElementById('div_content_2').style.display = "none";	
		document.getElementById('big_image_txt').innerHTML = '';
		document.getElementById('big_image_thumbs').innerHTML = '';
		document.getElementById('big_image_content').innerHTML = '';
		document.getElementById('big_image_im').src = 'images/bg_foto.png';
	});
	anim.animate();
	txt = false;
	foto = false;
}

function openSubCategorie(id){
	poststr	= '&category='+id;
	makePOSTRequest('categories.php', poststr, 'subcategory');
}

function hideSubInfo(id){
	document.getElementById('img_'+id).style.display = 'none';
}

function showSubInfo(id){
	document.getElementById('img_'+id).style.display = 'block';
}

//IMAGE
var foto_width = 400;
var foto_height = 300;
function ImageLoader(id,url,left,target){
	this.i 				= new Image();
	this.url 			= url;
	this.rand 			= Math.floor(Math.random()*100000000000); //cache verhindern
	this.imEl			= document.getElementById(id);
	
	this.loadImage = function(){
		this.i.src 		= this.url+'?r='+this.rand;
		objRef 			= this;
		objRef.waitForImage();
	};   
 
	this.waitForImage = function(){
		if(objRef.i.complete){
			document.getElementById('pre_load').src = this.i.src;
			//objRef.imEl.src	=this.i.src;	
			width_this  = this.i.width;
			height_this = this.i.height;
			left_this   = (400 - (width_this/2));
			top_this    = 20 + (150 - (height_this/2));
			
			if(current_pageAgency!=0){
				top_this += 50;
				left_this += 75;
			}
			
			foto_width  = width_this;
			foto_height = height_this;
					
			objRef.imEl.src		= document.getElementById('pre_load').src;
			objRef.imEl.width	= width_this;
			document.getElementById(target).style.display = "block";
			resizeImageholder(target+'_holder',1, foto_width, foto_height,  left_this, top_this, 0.5, 1, target);
			//alert(target);
			changeAlpha(target+'_loader',0,1,0);
			
			document.getElementById('big_image').style.left = left_this + 'px';
			document.getElementById('big_image').style.top = top_this +'px';
			//changeAlpha('big_image', 1, 1, 0);
			
		}else{
			setTimeout('objRef.waitForImage()', 100);
		}
	};
}

function resizeImageholder(target, alpha, height, width, x, y, speed, page, target_2){
	var attributes_Alpha = {
	  opacity: 
		{ to: alpha } 
	};
	var anim = new YAHOO.util.Motion(target, attributes_Alpha, speed, YAHOO.util.Easing.easeOut);
	anim.onComplete.subscribe(function(){
		document.getElementById(target_2).style.visibility = "visible";
		alphaImage(target_2, 1, 0.5, 0, 'xx', 0);	
	});
	anim.animate();
}

function alphaImage(target, alpha, speed, folder, photo_id, cat){
	
		var attributes_Alpha = {
		  opacity: 
			{ to: alpha } 
		};
		var anim = new YAHOO.util.Motion(target, attributes_Alpha, speed, YAHOO.util.Easing.easeOut);
		if(photo_id!=10){
		anim.onComplete.subscribe(function(){
			if(photo_id=='xx'){
				//alert('klaar');
			}else{
				url_string = folder+photo_id+'.jpg';
				//alert(url_string);
				loadd=new ImageLoader(target+'_im',url_string,0,target);
				loadd.loadImage();	
				document.getElementById(target+'_loader').style.display = "block";
			}
			if(target=='big_image' && alpha == 0){
				document.getElementById('big_image').style.display = "none";
			}
		});
		}
		anim.animate();
}

function scrollStart(direction, divID, elementID){
	ourInterval = setInterval("move"+direction+"('"+divID+"')", scrollSpeed);
}

function scrollEnd(which){
	//document.getElementById(which).style.backgroundColor = origColor;
	clearInterval(ourInterval);
}

function moveUp(which){
	document.getElementById(which).scrollTop = document.getElementById(which).scrollTop - scrollHeight;	
}

function moveDown(which){
	//alert(which);
	document.getElementById(which).scrollTop+=scrollHeight;	
}

var czc = 0;
function openCZC(){
	if(czc==0){
		czc = 1;
		document.getElementById('div_header_czc').style.display = "block";
		document.getElementById('div_menu_czc').style.display = "block";
		document.getElementById('div_menu_czc').style.zIndex = 20;
		changeSizeTo(800, 72, 'div_header_czc', 1, YAHOO.util.Easing.bounceOut)
		changePosBy(0, -73, 'div_header_czc', 1, YAHOO.util.Easing.bounceOut);
		changePosBy(0, -75, 'div_header', 0.5, YAHOO.util.Easing.easeOut);
		changePosBy(-300, 0, 'menu_1', 1, YAHOO.util.Easing.bounceOut);
		changePosBy(-400, 0, 'menu_2', 1, YAHOO.util.Easing.bounceOut);
		changePosBy(-500, 0, 'menu_3', 1, YAHOO.util.Easing.bounceOut);
		changePosBy(-600, 0, 'menu_4', 1, YAHOO.util.Easing.bounceOut);
		changePosBy(-700, 0, 'menu_5', 1, YAHOO.util.Easing.bounceOut);
		changePosBy(-800, 0, 'menu_6', 1, YAHOO.util.Easing.bounceOut);
		changePosBy(-900, 0, 'menu_15', 1, YAHOO.util.Easing.bounceOut);
		changePosBy(0, 450, 'menu_8', 2, YAHOO.util.Easing.bounceOut);
		changePosBy(0, 450, 'menu_9', 1.5, YAHOO.util.Easing.bounceOut);
		changePosBy(0, 450, 'menu_10', 1, YAHOO.util.Easing.bounceOut);
		var attributes_Size = {
			top: 
				{ by: 1200}
		};
		var anim1 = new YAHOO.util.Motion('div_content_1', attributes_Size, 1, YAHOO.util.Easing.bounceOut);
		anim1.onComplete.subscribe(function(){
			makePOSTRequest('homeCZC.php', '', 'content');
		});
		anim1.animate();	
	}
}

function openAgency(){
	if(czc==0){
		
		$('content_start').setStyle('display','block');
		
		czc = 1;
		document.getElementById('div_header_agency').style.display = "block";
		document.getElementById('div_menu_agency').style.display = "block";
		document.getElementById('div_menu_agency').style.zIndex = 20;
		changeSizeTo(800, 72, 'div_header_agency', 1, YAHOO.util.Easing.bounceOut)
		changePosBy(0, -73, 'div_header_agency', 1, YAHOO.util.Easing.bounceOut);
		changePosBy(0, -75, 'div_header', 0.5, YAHOO.util.Easing.easeOut);
		changePosBy(-300, 0, 'menu_1', 1, YAHOO.util.Easing.bounceOut);
		changePosBy(-400, 0, 'menu_2', 1, YAHOO.util.Easing.bounceOut);
		changePosBy(-500, 0, 'menu_3', 1, YAHOO.util.Easing.bounceOut);
		changePosBy(-600, 0, 'menu_4', 1, YAHOO.util.Easing.bounceOut);
		changePosBy(-700, 0, 'menu_5', 1, YAHOO.util.Easing.bounceOut);
		changePosBy(-800, 0, 'menu_6', 1, YAHOO.util.Easing.bounceOut);
		changePosBy(-900, 0, 'menu_15', 1, YAHOO.util.Easing.bounceOut);
		changePosBy(0, 450, 'menu_11', 2, YAHOO.util.Easing.bounceOut);
		changePosBy(0, 450, 'menu_12', 1.5, YAHOO.util.Easing.bounceOut);
		changePosBy(0, 450, 'menu_13', 1, YAHOO.util.Easing.bounceOut);
		changePosBy(0, 450, 'menu_14', 0.5, YAHOO.util.Easing.bounceOut);
/*		var attributes_Size = {
			top: 
				{ by: 1200}
		};
		var anim1 = new YAHOO.util.Motion('div_content_1', attributes_Size, 1, YAHOO.util.Easing.bounceOut);
		anim1.onComplete.subscribe(function(){
			makePOSTRequest('homeCZC.php', '', 'content');
		});
		anim1.animate();*/	
		var attributes_Size = {
			top: 
				{ by: 125}
		};
		var anim1 = new YAHOO.util.Motion('div_content_1', attributes_Size, 1, YAHOO.util.Easing.bounceOut);
		anim1.onComplete.subscribe(function(){
			var so = new SWFObject("homepage_agency.swf", "BARKODE", "300", "250", "9", "86A098");
			so.addVariable("flashVarText", "this is passed in via FlashVars"); 
			so.addParam("wmode", "transparent"); 
			so.useExpressInstall('expressinstall.swf');
			so.write("content_1");
		});
		anim1.animate();
		
	}
}

function openCZCSimple(){
	if(czc==0){
		czc = 1;
		document.getElementById('div_header_czc').style.display = "block";
		document.getElementById('div_menu_czc').style.display = "block";
		document.getElementById('div_menu_czc').style.zIndex = 20;
		changePosBy(0, -75, 'div_header', 0.5, YAHOO.util.Easing.easeOut);
		changeSizeTo(800, 72, 'div_header_czc', 1, YAHOO.util.Easing.bounceOut)
		changePosBy(0, -73, 'div_header_czc', 1, YAHOO.util.Easing.bounceOut);
		changePosBy(0, 450, 'menu_8', 2, YAHOO.util.Easing.bounceOut);
		changePosBy(0, 450, 'menu_9', 1.5, YAHOO.util.Easing.bounceOut);
		changePosBy(0, 450, 'menu_10', 1, YAHOO.util.Easing.bounceOut);
		var attributes_Size = {
			top: 
				{ by: 1200}
		};
		var anim1 = new YAHOO.util.Motion('div_content_1', attributes_Size, 1, YAHOO.util.Easing.bounceOut);
		anim1.onComplete.subscribe(function(){
			makePOSTRequest('homeCZC.php', '', 'content');
		});
		anim1.animate();	
	}
}

function openAgencySimple(){
	if(czc==0){
		czc = 1;
		document.getElementById('div_header_agency').style.display = "block";
		document.getElementById('div_menu_agency').style.display = "block";
		document.getElementById('div_menu_agency').style.zIndex = 20;
		changePosBy(0, -75, 'div_header', 0.5, YAHOO.util.Easing.easeOut);
		changeSizeTo(800, 72, 'div_header_agency', 1, YAHOO.util.Easing.bounceOut)
		changePosBy(0, -73, 'div_header_agency', 1, YAHOO.util.Easing.bounceOut);
		changePosBy(0, 450, 'menu_11', 2, YAHOO.util.Easing.bounceOut);
		changePosBy(0, 450, 'menu_12', 1.5, YAHOO.util.Easing.bounceOut);
		changePosBy(0, 450, 'menu_13', 1, YAHOO.util.Easing.bounceOut);
		changePosBy(0, 450, 'menu_14', 0.8, YAHOO.util.Easing.bounceOut);
		var attributes_Size = {
			top: 
				{ by: 125}
		};
		var anim1 = new YAHOO.util.Motion('div_content_1', attributes_Size, 1, YAHOO.util.Easing.bounceOut);
		anim1.onComplete.subscribe(function(){
			var so = new SWFObject("homepage_agency.swf", "BARKODE", "300", "250", "9", "86A098");
			so.addParam("wmode", "transparent"); 
			so.useExpressInstall('expressinstall.swf');
			so.write("content_1");
		});
		anim1.animate();	
	}
}

function closeAGENCY(){
	if(czc==1){
		if(foto==true){
			closeImages();	
		}
		
		$('content_start').setStyle('display','none');
		
		current_pageAgency = 0;
		czc = 0;
		document.getElementById('div_header_agency').style.display = "block";
		document.getElementById('div_menu_agency').style.zIndex = 0;
		document.getElementById('div_menu_czc').style.zIndex = 0;
		changeSizeTo(800, 0, 'div_header_agency', 1, YAHOO.util.Easing.bounceOut)
		changePosBy(0, 73, 'div_header_agency', 1, YAHOO.util.Easing.bounceOut);
		changePosBy(0, 75, 'div_header', 1.5, YAHOO.util.Easing.easeOut);
		changePosBy(300, 0, 'menu_1', 1, YAHOO.util.Easing.bounceOut);
		changePosBy(400, 0, 'menu_2', 1.5, YAHOO.util.Easing.bounceOut);
		changePosBy(500, 0, 'menu_3', 2, YAHOO.util.Easing.bounceOut);
		changePosBy(600, 0, 'menu_4', 2.5, YAHOO.util.Easing.bounceOut);
		changePosBy(700, 0, 'menu_5', 3, YAHOO.util.Easing.bounceOut);
		changePosBy(800, 0, 'menu_6', 3.5, YAHOO.util.Easing.bounceOut);
		changePosBy(900, 0, 'menu_15', 4, YAHOO.util.Easing.bounceOut);
		changePosBy(0, -450, 'menu_11', 2, YAHOO.util.Easing.bounceOut);
		changePosBy(0, -450, 'menu_12', 1.5, YAHOO.util.Easing.bounceOut);
		changePosBy(0, -450, 'menu_13', 1, YAHOO.util.Easing.bounceOut);
		changePosBy(0, -450, 'menu_14', 1, YAHOO.util.Easing.bounceOut);
		var attributes_Size = {
			top: 
				{ by: -1200}
		};
		var anim1 = new YAHOO.util.Motion('div_content_1', attributes_Size, 1, YAHOO.util.Easing.bounceOut);
		anim1.onComplete.subscribe(function(){
			//var poststr = "&soort=4&cat=1"
			//makePOSTRequest('concepts.php', poststr, 'content');
			document.getElementById('div_content_1').innerHTML = '<table style="width:463px;" align="right"><tr><td style="vertical-align:bottom; text-align:right"><div id="content_1">slideshow is loading...</div></td></tr></table>';
			var so = new SWFObject("homepage.swf", "BARKODE", "300", "300", "9", "86A098");
			so.addVariable("flashVarText", "this is passed in via FlashVars"); 
			so.addParam("wmode", "transparent"); 
			so.useExpressInstall('expressinstall.swf');
			so.write("content_1");
			var attributes_Pos = {
				left: 
					{ to: 195},
				top: 
					{ to: 75}
			};
			var anim1 = new YAHOO.util.Motion('div_content_1', attributes_Pos, 1.0, YAHOO.util.Easing.easeOut);
			anim1.animate();
			
			current_page = 0;
			
		});
		anim1.animate();	
	}
}

function closeCZC(){
	
	if(czc==1){
		if(foto==true){
			closeImages();	
		}
		current_pageCZC = 0;
		czc = 0;
		document.getElementById('div_header_czc').style.display = "block";
		document.getElementById('div_menu_czc').style.zIndex = 0;
		document.getElementById('div_menu_agency').style.zIndex = 0;
		changeSizeTo(800, 0, 'div_header_czc', 1, YAHOO.util.Easing.bounceOut)
		changePosBy(0, 73, 'div_header_czc', 1, YAHOO.util.Easing.bounceOut);
		changePosBy(0, 75, 'div_header', 1.5, YAHOO.util.Easing.easeOut);
		changePosBy(300, 0, 'menu_1', 1, YAHOO.util.Easing.bounceOut);
		changePosBy(400, 0, 'menu_2', 1.5, YAHOO.util.Easing.bounceOut);
		changePosBy(500, 0, 'menu_3', 2, YAHOO.util.Easing.bounceOut);
		changePosBy(600, 0, 'menu_4', 2.5, YAHOO.util.Easing.bounceOut);
		changePosBy(700, 0, 'menu_5', 3, YAHOO.util.Easing.bounceOut);
		changePosBy(800, 0, 'menu_6', 3.5, YAHOO.util.Easing.bounceOut);
		changePosBy(900, 0, 'menu_15', 3.5, YAHOO.util.Easing.bounceOut);
		changePosBy(0, -450, 'menu_8', 2, YAHOO.util.Easing.bounceOut);
		changePosBy(0, -450, 'menu_9', 1.5, YAHOO.util.Easing.bounceOut);
		changePosBy(0, -450, 'menu_10', 1, YAHOO.util.Easing.bounceOut);
		var attributes_Size = {
			top: 
				{ by: -1200}
		};
		var anim1 = new YAHOO.util.Motion('div_content_1', attributes_Size, 1, YAHOO.util.Easing.bounceOut);
		anim1.onComplete.subscribe(function(){
			//var poststr = "&soort=4&cat=1"
			//makePOSTRequest('concepts.php', poststr, 'content');
			document.getElementById('div_content_1').innerHTML = '<table style="width:463px;" align="right"><tr><td style="vertical-align:bottom; text-align:right"><div id="content_1">slideshow is loading...</div></td></tr></table>';
			var so = new SWFObject("homepage.swf", "BARKODE", "300", "300", "9", "86A098");
			so.addVariable("flashVarText", "this is passed in via FlashVars"); 
			so.addParam("wmode", "transparent"); 
			so.useExpressInstall('expressinstall.swf');
			so.write("content_1");
			var attributes_Pos = {
				left: 
					{ to: 195},
				top: 
					{ to: 75}
			};
			var anim1 = new YAHOO.util.Motion('div_content_1', attributes_Pos, 1.0, YAHOO.util.Easing.easeOut);
			anim1.animate();
			
			current_page = 0;
			
		});
		anim1.animate();	
	}
}

function closeInfoCZC(counter_info){
	var attributes_Size = {
		height: 
			{ to: 0}
	};
	var anim1 = new YAHOO.util.Motion('infoVlak_'+agenda_info, attributes_Size, 0.4, YAHOO.util.Easing.easeIn);
	anim1.onComplete.subscribe(function(){
		document.getElementById('infoVlak_'+agenda_info).style.display = "none";	
		agenda_info = 0;
	});
	anim1.animate();
}

function showInfoCZC(counter_info){
	if(agenda_info!=0){
		if(agenda_info==counter_info){
			closeInfoCZC(counter_info);
		}else{
			var attributes_Size = {
				height: 
					{ to: 0}
			};
			var anim1 = new YAHOO.util.Motion('infoVlak_'+agenda_info, attributes_Size, 0.6, YAHOO.util.Easing.easeIn);
			anim1.onComplete.subscribe(function(){
				document.getElementById('infoVlak_'+agenda_info).style.display = "none";
				document.getElementById('infoVlak_'+counter_info).style.display = "block";
				changeSizeTo(350, 190, 'infoVlak_'+counter_info, 1, YAHOO.util.Easing.easeOut)		
				agenda_info = counter_info;		
			});
			anim1.animate();	
		}
	}else{
		document.getElementById('infoVlak_'+counter_info).style.display = "block";
		changeSizeTo(350, 190, 'infoVlak_'+counter_info, 1, YAHOO.util.Easing.easeOut);
		agenda_info = counter_info;		
	}
}

function ie6PNGFix(){
	var arVersion = navigator.appVersion.split("MSIE")
	var version = parseFloat(arVersion[1])
	
	if ((version >= 5.5) && (document.body.filters) && (version <= 6.0)) 
	{
	   for(var i=0; i<document.images.length; i++)
	   {
		  var img = document.images[i]
		  var imgName = img.src.toUpperCase()
		  //alert(imgName);
		  if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
		  {
			 var imgID = (img.id) ? "id='" + img.id + "' " : ""
			 var imgClass = (img.className) ? "class='" + img.className + "' " : ""
			 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
			 var imgStyle = "display:inline-block;" + img.style.cssText 
			 if (img.align == "left") imgStyle = "float:left;" + imgStyle
			 if (img.align == "right") imgStyle = "float:right;" + imgStyle
			 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
			 var strNewHTML = "<span " + imgID + imgClass + imgTitle
			 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
			 + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
			 + "(src=\'" + img.src + "\', sizingMethod='scale');\">" 
			 img.outerHTML = strNewHTML
			 i = i-1
		  }
	   }
	}	
}

var upperleft 	= 650;
var postoTravel	= 0;
function resetVlakkenAdviser(id){
	for(i=6;i>id;i--){
		changeSizeTo(10, 370, 'div_content_'+i+addon, 1, YAHOO.util.Easing.easeOut);
		changePosTo(650 - ((6 - i) * 15), 35, 'div_content_'+i+addon, 1, YAHOO.util.Easing.easeOut);	
		document.getElementById('div_content_'+i+addon).innerHTML = '';			
	}
}

var curr_artist = 0;
function openArtist(artist){
	if(curr_artist==0){
		changeSizeTo(0, 370, 'div_content_1'+addon, 1, YAHOO.util.Easing.easeOut);	
		changeSizeTo(150, 380, 'div_content_2'+addon, 1, YAHOO.util.Easing.easeOut);	
		//changeSizeTo(150, 380, 'div_content_3'+addon, 1, YAHOO.util.Easing.easeOut);
		changePosTo(0, 35, 'div_content_1'+addon, 1, YAHOO.util.Easing.easeOut);
		changePosTo(0, 35, 'div_content_2'+addon, 1, YAHOO.util.Easing.easeOut);
		//changePosTo(0, 35, 'div_content_3'+addon, 1, YAHOO.util.Easing.easeOut);
		
		changeSizeTo(410, 390, 'div_content_4'+addon, 1, YAHOO.util.Easing.easeOut);
		changePosTo(151, 35, 'div_content_4'+addon, 1, YAHOO.util.Easing.easeOut);
	}
	
	changeSizeTo(150, 380, 'div_content_2'+addon, 1, YAHOO.util.Easing.easeOut);	
		
	curr_artist = artist;
	
	advisor_stage = 2;
	poststr	= '&artist='+artist+'&stage='+2;
	makePOSTRequest('artistsAgencyInfo.php', poststr, 'advisor');	
	
	document.getElementById('ArtistHeader').innerHTML = '<a href="javascript:closeArtist();" class="agency">zoek op categorie</a>';
}

function closeArtist(){
	curr_artist = 0;
	curr_search = false;
		
	resetVlakkenAdviser(3);
	advisor_stage = 1;
	changeSizeTo(145, 370, 'div_content_1'+addon, 1, YAHOO.util.Easing.easeOut);
	changeSizeTo(450, 370, 'div_content_2'+addon, 1, YAHOO.util.Easing.easeOut);
	//changeSizeTo(0, 370, 'div_content_3'+addon, 1, YAHOO.util.Easing.easeOut);
	//changePosTo(615, 35, 'div_content_3'+addon, 1, YAHOO.util.Easing.easeOut);	
	changePosTo(170, 35, 'div_content_2'+addon, 1, YAHOO.util.Easing.easeOut);
	changePosTo(25, 35, 'div_content_1'+addon, 1, YAHOO.util.Easing.easeOut);
	
	document.getElementById('ArtistHeader').innerHTML = 'Selecteer een categorie';
}

function openAdviser(parent,stap){
	switch(stap){
		case 0:
			advisor_stage = stap;
			poststr	= '&category='+parent+'&stage='+stap;
			makePOSTRequest('artistsAgencySequil.php', poststr, 'advisor');	
			changeSizeTo(145, 370, 'div_content_1'+addon, 1, YAHOO.util.Easing.easeOut);	
			changeSizeTo(450, 370, 'div_content_2'+addon, 1, YAHOO.util.Easing.easeOut);	
			changePosTo(170, 35, 'div_content_2'+addon, 1, YAHOO.util.Easing.easeOut);
			resetVlakkenAdviser(2);
		break;
		case 1:
			advisor_stage = stap;
			changeSizeTo(130, 370, 'div_content_2'+addon, 1, YAHOO.util.Easing.easeOut);
			//changeSizeTo(340, 370, 'div_content_3'+addon, 1, YAHOO.util.Easing.easeOut);
			//changePosTo(301, 35, 'div_content_3'+addon, 1, YAHOO.util.Easing.easeOut);
			poststr	= '&category='+parent+'&stage='+stap;
			makePOSTRequest('artistsAgencySequil.php', poststr, 'advisor');	
			resetVlakkenAdviser(3);	
		break;
	}
}

function reBook(artist){
	var poststr = "&artist="+artist
	makePOSTRequest('bookMeAgencyFormulier.php', poststr, 'formcontent');
}
function bookme(onOff){
	switch(onOff){
		case 1:
			$('formcontent').setStyle('display', 'block');
			$('scrollcontent').setStyle('display', 'none');
			$('text_scroll1').setStyle('display', 'none');
			$('text_scroll2').setStyle('display', 'none');
		break;
		case 2:
			$('scrollcontent').setStyle('display', 'block');
			$('text_scroll1').setStyle('display', 'block');
			$('text_scroll2').setStyle('display', 'block');
			$('formcontent').setStyle('display', 'none');
		break;
	}
}

function sendBookMe(){
	//errorSpan
	$('errorSpan').innerHTML = '';
	
	var name 	= $('name').value;
	var email 	= $('email').value;
	var tel	 	= $('tel').value;
	var opm 	= $('opm').value;
	var artist 	= $('artist').value;
	
	if(checkEmail('email') && tel==''){
		$('errorSpan').innerHTML = 'Geldig emailadres of telefoonnummer verplicht';
	}else if(name==''){
		$('errorSpan').innerHTML = 'Voer uw naam in';
	}else{
		var poststr = "&name="+name+"&email="+email+"&tel="+tel+"&opm="+opm+"&artist="+artist
		makePOSTRequest('bookMeAgency.php', poststr, 'formcontent');
	}
}


function checkEmail( field_name ) {
	//kijk naar formaat: name@site.nl
	var objRegExp  = /^([a-zA-Z0-9_\-])([a-zA-Z0-9_\-\.]*)@(\[((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}|((([a-zA-Z0-9\-]+)\.)+))([a-zA-Z]{2,}|(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\])$/;
	var waarde = $(field_name).value;
	if($(field_name).value==null || $(field_name).value==''){
		return true;
	}else if( objRegExp.test($(field_name).value)==false){
		return true;
	}else{ return false; }
}

var curr_search = false;
var searchvalue = '';

function searchArtistName(veld){
	var temp_searchvalue 	= veld.value;
	var searchvalue_length 	= temp_searchvalue.length;
	if(searchvalue_length > 2 && temp_searchvalue != searchvalue){
		searchvalue 		= veld.value;
		openSearchResult();	
	}
}
function openSearchResult(){
	if(curr_search==false){
		curr_search = true;
		changeSizeTo(0, 370, 'div_content_1'+addon, 1, YAHOO.util.Easing.easeOut);	
		if(curr_artist==0){
			changePosTo(0, 35, 'div_content_2'+addon, 1, YAHOO.util.Easing.easeOut);
			changeSizeTo(560, 380, 'div_content_2'+addon, 1, YAHOO.util.Easing.easeOut);	
		}
		//changeSizeTo(150, 380, 'div_content_3'+addon, 1, YAHOO.util.Easing.easeOut);
		changePosTo(0, 35, 'div_content_1'+addon, 1, YAHOO.util.Easing.easeOut);
		//changePosTo(0, 35, 'div_content_3'+addon, 1, YAHOO.util.Easing.easeOut);
		
		changeSizeTo(410, 390, 'div_content_4'+addon, 1, YAHOO.util.Easing.easeOut);
		changePosTo(151, 35, 'div_content_4'+addon, 1, YAHOO.util.Easing.easeOut);
	}
	
	advisor_stage = 0;
	poststr	= '&search='+searchvalue+'&stage='+2;
	makePOSTRequest('artistsAgencySearch.php', poststr, 'advisor');	
	
	document.getElementById('ArtistHeader').innerHTML = '<a href="javascript:closeArtist();" class="agency">zoek op categorie</a>';
}

function seeText(artist){
	besch_1 = screen.availWidth;
	besch_2 = screen.availHeight;
  	boven  = 100;
	links  = screen.availWidth/2 - 250;
	
	window.open('artistsAgencytxt.php?artist='+artist,'BARKODEAGENCY','left='+links+',top='+boven+',width=505,height=600,scrollbars=yes,toolbar=no,location=no,statusbar=no'); 
}
function downloadKit(artist){
	besch_1 = screen.availWidth;
	besch_2 = screen.availHeight;
  	boven  = 200;
	links  = screen.availWidth/2 - 150;
	
	window.open('artistsAgencyDownload.php?artist='+artist,'BARKODEAGENCY','left='+links+',top='+boven+',width=350,height=250,scrollbars=yes,toolbar=no,location=no,statusbar=no'); 
}