function sh(id) {
  	$(id).style.display = (($(id).style.display == 'none')?'inline' :'none');
}
function sl(id) {
  	$(id).style.display = 'inline';
}
function hl(id) {
  	$(id).style.display = 'none';
}

var show;

window.addEvent('domready',function(){
	var loc=String(window.location).split('http://www.roelofheida-architecten.nl/')[1].split('/');
	if(loc[0].toLowerCase()=='projecten' && loc.length>1 && (!loc[2] || (loc[2].toLowerCase()!='all' && loc[2].toLowerCase()!='text'))   )mkSlideShow();								
})

function mkSlideShow(){
	var slides=[];
	$('f_g').getElements('.data').each(function(item){
		var data=String(item.value).split('##');										
		slides.push({'img':data[0],'txt':data[1]});
	});
	var t=$('f_g').getElement('.pro_img');
	for(var i=0; i<3; i++){
		var div= new Element('div', {
    		'id': 's'+i,
   			 'class': 'slide'
		});
		if(!i){
			div.grab(t.getElement('a img'));
			t.getElement('a').dispose();
		}else if(i==2){
			var ld=new Element('div', {
    			'id': 'load'
			});
			div.grab(ld);
		}
		t.grab(div);
	}
	var ph=[$('s0'),$('s1')];
	show=new sShow(ph,slides,2000);//(-,-,interval);
	if(slides.length > 1)mkNav();
}

function mkNav(){
	var b=$('b_pla');
	b.setStyle('display','inline');
	b.addEvent('click',function(e){
		new Event(e).stop();
		this.setStyle('display','none');
		$('b_pau').setStyle('display','inline');
		show.play();
	});
	var b=$('b_pau');
	b.addEvent('click',function(e){
		new Event(e).stop();
		this.setStyle('display','none');
		$('b_pla').setStyle('display','inline');
		show.pause();
	});
	var b=$('b_fwd');
	b.addEvent('click',function(e){
		new Event(e).stop();
		show.flip('fwd');
	});
	var b=$('b_bck');
	b.addEvent('click',function(e){
		new Event(e).stop();
		show.flip('bwd');
	});
	$('s2').addEvent('click',function(){show.flip('fwd')});
}
	
