// JavaScript Document

/************************************************************************************/
/*							ERROR HANDLING											*/
/************************************************************************************/
function clearError(){
	var errormessage = document.getElementById('errormessage');
	errormessage.innerHTML = "";
}

function showError(newError){
	var errormessage = document.getElementById('errormessage');
	errormessage.innerHTML = newError;
}

/************************************************************************************/
/*								GENERAL												*/
/************************************************************************************/
function validMail(str){
	var at="@";
	var dot=".";
	var lat=str.indexOf(at);
	var lstr=str.length;
	var ldot=str.indexOf(dot);
	if(str.indexOf(at)==-1){return false;}
	if(str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){return false;}
	if(str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){return false;}
	if(str.indexOf(at,(lat+1))!=-1){return false;}
	if(str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){return false;}
	if(str.indexOf(dot,(lat+2))==-1){return false;}	
	if(str.indexOf(" ")!=-1){return false;}
	return true;		
}

//variables
  var btn_active = '0';
  //functions  
  function setResolution() {
	w = window.screen.availWidth;
	h = window.screen.availHeight;
	window.resizeTo(w,h);
	window.moveTo(0,0);
	window.focus();
  }

  function writeEmailAddress(nme, dom, cou, cla){
           document.write("<a href='mailto:"+nme+"@"+dom+"."+cou+"' class="+cla+" >"+nme+"@"+dom+"."+cou+"</a>");
  }
  
  function changeTitle(tit){
			document.title = tit;
  }

 function changePhoto(img, btn_id){
	document.getElementById('btn'+btn_active).className="menulink";
	btn_active = btn_id;
	document.getElementById('btn'+btn_active).className="menulink_active";
	document.getElementById('photo').innerHTML='<img src="'+img+'" alt="" />';
	window.focus();
 }
 
 function hideDiv(id){
	document.getElementById(id).style.display="none";
 }
 
 function showDiv(id){
	document.getElementById(id).style.display="block";
 }
 
 function changeQuality(img, btn, btn_img){
	document.getElementById('quality').src=img;
	//reset btns
	if(document.getElementById('original')){document.getElementById('original').src='../images/original_up.gif';};
	if(document.getElementById('v2')){document.getElementById('v2').src='../images/2v_up.gif';};
	if(document.getElementById('v4')){document.getElementById('v4').src='../images/4v_up.gif';};
	if(document.getElementById('shipdeck')){document.getElementById('shipdeck').src='../images/shipdeck_up.gif';};
	//set btn active
	document.getElementById(btn).src=btn_img;
 }

 //another wonderfull script by Karel "bigger than Jesus" Bouvyn
  function setSize(minW, minH){
			if(document.body.clientHeight<minH){
				document.getElementById("flashcontent").style.height = minH-1+"px";
			} else {
				document.getElementById("flashcontent").style.height = "100%";
			}
			if(document.body.clientWidth<minW){
				document.getElementById("flashcontent").style.width = minW-1+"px";
			} else {		
				document.getElementById("flashcontent").style.width = "100%";
			}
			void(0);
  }
  
  //yet another wonderfull script by Karel "the best of the  best of the best" Bouvyn
  function setThumb(id){
	var th1_ttl = document.getElementById(id).childNodes[0].title;
	var th1_url = document.getElementById(id).childNodes[0].href;
	var th1_rel = document.getElementById(id).childNodes[0].rel;	
	var th1_txt = document.getElementById(id).childNodes[0].childNodes[0].alt;
	var th1_img = document.getElementById(id).childNodes[0].childNodes[0].src;
	var th1_typ = document.getElementById(id).childNodes[0].childNodes[0].title;
	var th1r = new SWFObject("../../thumb.swf", "mc", "100%", "100%", "9", "#ffffff");
	
	th1r.addVariable("ttl",th1_ttl);
	th1r.addVariable("url",th1_url);
	th1r.addVariable("rel",th1_rel);
	th1r.addVariable("txt",th1_txt);
	th1r.addVariable("pic",th1_img);
	th1r.addVariable("typ",th1_typ);
	th1r.write(id);
}

function disableCheck(id){
	document.getElementById(id).setAttribute("class","checkDisabled");
	document.getElementById(id).childNodes[0].checked = false;
	document.getElementById(id).childNodes[0].disabled = true;
}

function enableCheck(id){
	document.getElementById(id).setAttribute("class","check");
	document.getElementById(id).childNodes[0].checked = true;
	document.getElementById(id).childNodes[0].disabled = false;
}



function printOut(){
	var info = '<img src="pics/map.jpg" alt="" id="printmap" /><div id="printaddress"><h2>Woodstoxx</h2><p>Hogeweg 245<br />8930 Menen<br />T&nbsp;0032 56 51 79 60<br />F&nbsp;0032 56 51 79 75<br />info@woodstoxx.be</p><br /><h2>Openingsuren</h2><div id="open"><div>Ma<br />Di<br />Wo<br />Do<br />Vr<br />Za<br />Zo</div><div>gesloten<br />9u30-12u30<br />9u30-12u30<br />9u30-12u30<br />9u30-12u30<br />10u-18u<br />14u-18u</div><div><br />13u30-18u30<br />13u30-18u30<br />13u30-18u30<br />13u30-18u30</div></div></div>';
	document.getElementById("printlogo").innerHTML = '<img src="images/logo_woodstoxx_print.gif" alt="" />';
	document.getElementById("printinfo").innerHTML = info;
	print();
}		