window.addEvent('domready', function() {
	
	var myGallery = new gallery($('myGallery'));
	$$('a.left-highlightslides').each(function(el) { 
		el.addEvent('click', function(e) {
			e=new Event(e).stop();
			var this_id=el.getProperty('rel');
			myGallery.goTo(this_id);
			e.stop();
		});
	});
	
	var hor = new Ticker('TickerVertical',{speed:1000,delay:4000,direction:'horizontal'});
	
	
		
	
	//if goback button then add onlclick history
	if($chk($('single-go-back'))){
		$('single-go-back').addEvent('click', function(e) {
			e=new Event(e);
			history.back();
			e.stop();
		});
	}
	
	if($chk($('lookingforFormT'))){
		/** temp text */
		var FormContentsT = "Klik hier om je eigen tekstje toe te voegen.\n\nEr is plek voor maximaal zes regels. Wanneer je tekst wordt uitgekozen vermelden we je voornaam op de winkelruit. Leuk!";
		
		/** onload set textarea text */
		$('lookingforFormT').set('html',FormContentsT);
		
		/** events */
		$('lookingforFormT').addEvents({
		    'focus': function(){
		    	if($('lookingforFormT').get('html')==FormContentsT)$('lookingforFormT').set('html','');
		    },
		    'blur': function(){
		    	if($('lookingforFormT').get('html')=='')$('lookingforFormT').set('html',FormContentsT);
		    }
		});
	}
	
	if($chk($('lookingforFormWo'))){
		var lookingforFormWo = "Wie ben je? Waar word je blij van? Hoe praat je beste vriendin over je?";
		
		/** onload set textarea text */
		$('lookingforFormWo').set('html',lookingforFormWo);
		
		/** events */
		$('lookingforFormWo').addEvents({
		    'focus': function(){
		    	if($('lookingforFormWo').get('html')==lookingforFormWo)$('lookingforFormWo').set('html','');
		    },
		    'blur': function(){
		    	if($('lookingforFormWo').get('html')=='')$('lookingforFormWo').set('html',lookingforFormWo);
		    },
		    'keyup': function(){
		    	limitText('lookingforFormWo',6,lookingforFormWo,5000);
		    }
		});
	}
	
	if($chk($('lookingforFormWy'))){
		var lookingforFormWy = "Waarom wil je graag bij Liisa werken? Wat zou je anders doen en wat juist niet?";
		
		/** onload set textarea text */
		$('lookingforFormWy').set('html',lookingforFormWy);
		
		/** events */
		$('lookingforFormWy').addEvents({
		    'focus': function(){
		    	if($('lookingforFormWy').get('html')==lookingforFormWy)$('lookingforFormWy').set('html','');
		    },
		    'blur': function(){
		    	if($('lookingforFormWy').get('html')=='')$('lookingforFormWy').set('html',lookingforFormWy);
		    },
		    'keyup': function(){
		    	limitText('lookingforFormWy',6,lookingforFormWy,5000);
		    }
		});
	}
	
	function limitText(IdName,MaxLines,ReplaceText,TimeOut){
		var numLinesCount = 0;
		var IdContents = $(IdName).get('value');	
		for(i=0;i < IdContents.length;i++){
			var myRegExp = /\n/
			if (myRegExp.test(IdContents.charAt(i))) {
				numLinesCount++;
			}
		}
		if(i==0){
			setTimeout( $(IdName).set('value',ReplaceText) ,TimeOut);
		}
		if(numLinesCount == MaxLines){
			alert('Je mag maximaal '+MaxLines+' regels tekst invoeren. Pas je tekst aan of bel (050) 311 56 93.');
		}
	}
	
	if($chk($('lookingforFormP'))){
		/** temp text */
		var FormContentsP = "Telefoon";
		
		/** onload set textarea text */
		$('lookingforFormP').setProperty('value',FormContentsP);
		
		/** events */
		$('lookingforFormP').addEvents({
		    'focus': function(){
		    	if($('lookingforFormP').getProperty('value')==FormContentsP)$('lookingforFormP').setProperty('value','');
		    },
		    'blur': function(){
		    	if($('lookingforFormP').getProperty('value')=='')$('lookingforFormP').setProperty('value',FormContentsP);
		    }
		});
	}
	
	if($chk($('lookingforFormE'))){
		/** temp text */
		var FormContentsE = "E-mail adres";
		
		/** onload set textarea text */
		$('lookingforFormE').setProperty('value',FormContentsE);
		
		/** events */
		$('lookingforFormE').addEvents({
		    'focus': function(){
		    	if($('lookingforFormE').getProperty('value')==FormContentsE)$('lookingforFormE').setProperty('value','');
		    },
		    'blur': function(){
		    	if($('lookingforFormE').getProperty('value')=='')$('lookingforFormE').setProperty('value',FormContentsE);
		    }
		});
	}
	
	if($chk($('lookingforFormN'))){
		/** temp text */
		var FormContents = "Voor- en achternaam";
		
		/** onload set textarea text */
		$('lookingforFormN').setProperty('value',FormContents);
		
		/** events */
		$('lookingforFormN').addEvents({
		    'focus': function(){
		    	if($('lookingforFormN').getProperty('value')==FormContents)$('lookingforFormN').setProperty('value','');
		    },
		    'blur': function(){
		    	if($('lookingforFormN').getProperty('value')=='')$('lookingforFormN').setProperty('value',FormContents);
		    }
		});
	}
	
	if($chk($('lookingforFormC'))){
		if(Browser.Platform.mac)$('lookingforFormC').setProperty('style','width:132px;');
		else $('lookingforFormC').setProperty('style','width:180px;');
	}
	
	});

	