function removeStartText(obj, text) {	
	if (obj.value == text) {
		obj.value = '';
	}
}

function replaceStartText(obj, text) {	
	if (obj.value == '') {	
		obj.value = text;
	}
}

/* confirm before delete/add/etc. */
function confirm_window(input, next) {
	go_to_next = confirm(input);
	if (go_to_next)	{
		document.location.href=""+next+"";
	}
}

// show/hide

//here you place the ids of every element you want.
var ids=new Array('a1','a2');

function switchid(id){	
	hideallids();
	showdiv(id);
}

function hideallids(){
	//loop through the array and hide each element by id
	for (var i=0;i<ids.length;i++){
		hidediv(ids[i]);
	}		  
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}


  function toggleDiv(divid){
    if(document.getElementById(divid).style.display == 'none'){
      document.getElementById(divid).style.display = 'block';
    }
	else{
      document.getElementById(divid).style.display = 'none';
    }
  }
	
    //toggle multiple thingies	
	function toggleDiv2(divid1,divid2,divid3){
		if(document.getElementById(divid1).style.display == 'none'){
			document.getElementById(divid1).style.display = 'block';
			document.getElementById(divid2).style.display = 'none';
		    document.getElementById(divid3).style.display = 'none';		  
		}
		else {
      		document.getElementById(divid).style.display = 'none';
	    }
	}
  
  //untoggle all thingies	
  function toggleDiv3(divid1,divid2,divid3){
    if(document.getElementById(divid1).style.display == 'block'){
      document.getElementById(divid1).style.display = 'none';
	}
	else{
		document.getElementById(divid1).style.display = 'none';
	}
	if(document.getElementById(divid2).style.display == 'block'){
      document.getElementById(divid2).style.display = 'none';
	}
	else {
		document.getElementById(divid2).style.display = 'none';
	}
	if(document.getElementById(divid3).style.display == 'block'){
      document.getElementById(divid3).style.display = 'none';
	}
	else {
		document.getElementById(divid13).style.display = 'none';
	}
	}
  
  
function borderit(which,color){
	//if IE 4+ or NS 6+
	if (document.all||document.getElementById){
		which.style.borderColor=color
	}
}

//resize image by clicking (gallery.php?page=show)
function zoomToggle(iWideSmall,iHighSmall,iWideLarge,iHighLarge,whichImage){
var nW,nH,oH,oW;
	oW=whichImage.style.width;oH=whichImage.style.height;
	if ((oW==iWideLarge)||(oH==iHighLarge)) {
		nW=iWideSmall;nH=iHighSmall;
	}
	else {
		nW=iWideLarge;nH=iHighLarge;
	}
whichImage.style.width=nW;whichImage.style.height=nH;
}

//textarea maxlength
/*
        Textarea-maxlength by frequency decoder (http://www.frequency-decoder.com/)
        
        Released under a Creative Commons nc-sa license.
        
        ---------------------------------------------------------------------------
        
        These two functions are called from within the namespace so should really
        be declared within the namespace but I've made an exception here as they
        are functions that will inevitably be used by other scripts.
*/
function addEvent( obj, type, fn, tmp ) {
        if( obj.attachEvent ) {
                obj["e"+type+fn] = fn;
                obj[type+fn] = function(){obj["e"+type+fn]( window.event );}
                obj.attachEvent( "on"+type, obj[type+fn] );
        } else
                obj.addEventListener( type, fn, false );
}

function removeEvent( obj, type, fn ) {
        if( obj.detachEvent ) {
                obj.detachEvent( "on"+type, obj[type+fn] );
                obj[type+fn] = null;
        } else
                obj.removeEventListener( type, fn, false );
}


// Declare the namespace
var fdTextareaController;

(function() {
        function fdTextareaMaxlength(inp, maxlength) {
                this._inp       = inp;
                this._max       = Number(maxlength);
                var self        = this;

                self.maxlength = function() {
                        if(self._inp.disabled) return false;

                        if(self._inp.value.length > self._max) {
                                self._inp.value = self._inp.value.substring(0, self._max);
                                return false;
                        }

                        return true;
                }


                // Has Safari keypress foibles ? Needs tested...
                addEvent(self._inp, 'keypress', self.maxlength, false);

                // Sorry folks, but using the "onblur" event is the only way to cut the text down to size
                // after a users cut & paste action
                addEvent(self._inp, 'blur',     self.maxlength, false);

                // IE only event 'onpaste'

                // Conditional compilation used to load only in IE win.
                // As we don't need the onblur event for IE, we remove it at the same time.

                /*@cc_on @*/
                /*@if (@_win32)
                addEvent(self._inp, 'paste', function(){ setTimeout(self.maxlength, 50); }, true);
                removeEvent(self._inp, 'blur', self.maxlength, false);
                /*@end @*/

                // Call the maxlength function immediately to trim any text inserted server-side to the required length.
                self.maxlength();
        };

        // Construct the previously declared namespace
        fdTextareaController = {
                textareas: [],

                _construct: function( e ) {

                        var regExp_1 = /fd_max_([0-9]+){1}/ig;

                        var textareas = document.getElementsByTagName("textarea");

                        for(var i = 0, textarea; textarea = textareas[i]; i++) {
                                if(textarea.className && textarea.className.search(regExp_1) != -1) {
                                        max = parseInt(textarea.className.match(regExp_1)[0].replace(/fd_max_/ig, ''));
                                        if(max) fdTextareaController.textareas[fdTextareaController.textareas.length] = new fdTextareaMaxlength(textarea, max);
                                }
                        }

                },

                _deconstruct: function( e ) {

                }
        }
})();

// onload events
addEvent(window, 'load', fdTextareaController._construct, false);
addEvent(window, 'unload', fdTextareaController._deconstruct, false);


// vergroot het formaat van de textareas
function changeCommentSize(d)
	{
		var el = document.getElementById("comment");
		var height = parseInt(el.style.height);
		if(!height && el.offsetHeight)
			height = el.offsetHeight;
		height += d;
		if(height < 20) 
			height = 20;
		el.style.height = height+"px";
		//<textarea name="comment" id="comment" cols="60" rows="14" tabindex="4"></textarea>
	}	


// validate e-mail
function Validate_Email_Address(email_address)
         {
         //Assumes that valid email addresses consist of user_name@domain.tld
         at = email_address.indexOf('@');
         dot = email_address.indexOf('.');
         
         if(at == -1 || 
            dot == -1 || 
            dot <= at + 1 ||
            dot == 0 || 
            dot == email_address.length - 1)
            return(false);
            
         user_name = email_address.substr(0, at);
         domain_name = email_address.substr(at + 1, email_address.length);                  
         
         if(Validate_String(user_name) === false || 
            Validate_String(domain_name) === false)
            return(false);                     
         
         return(true);
         }

//checks url
	function isUrl(s) {
		var regexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
		return regexp.test(s);
	}
	
// form validation frontend: news
	function check(form) {
		if (form.user_name.value.length < 2) {
			alert("Uw naam moet uit minimaal 2 tekens bestaan.");
			return false;
		}
		
		/*if (form.user_mail.value.length > 0) {
			if (Validate_Email_Address(form.user_mail.value) == false) {
				alert("Het opgegeven e-mailadres is niet geldig.");
				return false;
			}
		}
		
		if (form.user_url.value.length > 0) {
			if (!isUrl(form.user_url.value)) {
				alert("De opgegeven websitelink is incorrect.") 
				return false;	
			}
		}*/

		if (form.comment.value.length < 2) {
			alert("De opgegeven reactie is te kort.");
			return false;
		}
		

}

// © Dit script is gemaakt door mark knol
function Foto(img,txt){
 foto1= new Image();
 foto1.src=(img);
 CheckFoto(img,txt);
}
function CheckFoto(img,txt){
 if((foto1.width!=0)&&(foto1.height!=0)){
 viewFoto(img,txt);
}
else{
 uitvoering="CheckFoto('"+img+"','"+txt+"')";
 interval=setTimeout(uitvoering,20);
}
}
function viewFoto(img,txt){
 imgbreedte=foto1.width;
 imghoogte=foto1.height;
 if (!txt) {txt=img}
 vars="width="+imgbreedte+",height="+imghoogte+",left="+((screen.width-imgbreedte)/2)+",top="+((screen.height-imghoogte)/2);
 newwindow=window.open("","nieuwvenster",vars);
 newwindow.document.clear();
 newwindow.document.write("<html>\n<head>\n<title>"+txt+"</title>\n");
 newwindow.document.write("<meta http-equiv=\"imagetoolbar\" content=\"no\">\n");
 newwindow.document.write("</head>\n\n<body style=\"margin:0px; padding:0px;\" onBlur=\"window.close()\">\n"); 
 newwindow.document.write("<img src=\""+img+"\" border=\"0\" src=\""+img+"\"\ alt=\""+txt+"\" title=\""+txt+"\" style=\"cursor:pointer;\"  onclick=\"javascript:window.close()\" />\n"); 
 newwindow.document.write("</body>\n</html>\n"); 
 if (newwindow.document.focus) {newwindow.document.focus();}
 newwindow.document.close(); 
}
// einde script 

//button rollover
function movepic(img_name,img_src) {
    document[img_name].src=img_src;
}

