if (top != self) top.location.href = self.location.href;

function validate(){

	if ( ( document.emailForm.subject.value == "" ) || ( document.emailForm.name.value == "" ) || ( document.emailForm.text.value == "" ) || ( document.emailForm.email.value.search("@") == -1 ) || ( document.emailForm.email.value.search("[.*]" ) == -1 ) ) {
		alert( "Please make sure the form is complete and valid." );
	}
        else if( document.emailForm.subject.value==document.emailForm.name.value ) {
                alert( "Subject and Name can't be the same..." );
        }
        else if( document.emailForm.email.value==document.emailForm.name.value ) {
                alert( "Email and Name can't be the same..." );
        }
        else if( document.emailForm.email.value==document.emailForm.subject.value ) {
                alert( "Email and Subject can't be the same..." );
        }
        else if( document.emailForm.email.value==document.emailForm.text.value ) {
                alert( "Email and text can't be the same..." );
        }
	else if( isLegal(document.emailForm.text.value) || 
                 isLegal(document.emailForm.subject.value) || 
                 isLegal(document.emailForm.email.value) || 
                 isLegal(document.emailForm.name.value) 
                ){
		alert( "Warning: Incorrect use of form... IP-address has been logged...");
		
	} 	
	else {
	alert("Mail send...");
	document.emailForm.submit();
	}
}

function isLegal(txt) {
	var illegal = new Array();
	illegal[0]="Content-Type";
	illegal[1]="MIME-Version";
	illegal[2]="Content-Transfer-Encoding";
	illegal[3]="Content-";
	illegal[4]="bcc:";
	illegal[5]="charset=";
        illegal[6]="http://";
        illegal[7]="<a href=";
        illegal[8]="</a>";
        illegal[9]="[url]";
        illegal[10]="[/url]";
        

	for(i=0;i<illegal.length; i++){
                
		if(txt.indexOf(illegal[i]) >=0){
			
                      return true;
                        
                }
                        
	}
	return false;
}


function hidePanels(){
	hideAll('main');
	hideAll('joeri');
	hideAll('cv');
	hideAll('prive');
	hideAll('topvakantie');
	hideAll('sitemap');
	hideAll('foto');
	hideAll('contact');
        hideAll('link');
}

function showPanel(naam){
	hidePanels();
	showAll(naam);
}

function showhide(id){
	if (document.getElementById)
	{
		var obj = document.getElementById(id);
		if (obj.style.display == "none"){
			obj.style.display = "block";
		}
		else {
			obj.style.display = "none";
		}
	}
} //function showhide

function cache(layers) {
	var aff='';
	ss=layers
	tab=ss.split(',');
	aff=tab.join(',');
	disp='';
	for (i in tab) {
		disp=disp+tab[i]+'/';
		showhide(tab[i]);
	}
} //function cache

function hide(id){
	if (document.getElementById)
	{
		var obj = document.getElementById(id);
		if (obj.style.display == "block"){
			obj.style.display = "none";
		}
	}
} //function hide

function show(id){
	if (document.getElementById)
	{
		var obj = document.getElementById(id);
		if (obj.style.display=="none"){
			obj.style.display = "block";
		}
	}
} //function show

function hideAll(layers) {
	var aff='';
	ss=layers;
	tab=ss.split(',');
	aff=tab.join(',');
	disp='';
	for (i in tab) {
		disp=disp+tab[i]+'/';
		hide(tab[i]);
	}
} //function hideAll

function showAll(layers) {
	var aff='';
	ss=layers;
	tab=ss.split(',');
	aff=tab.join(',');
	disp='';
	for (i in tab) {
		disp=disp+tab[i]+'/';
		show(tab[i]);
	}
} //function showAll




