/**
 * functions
 * by MarZZZ, june 2004
 */



function check_frames(strQueryVars) {
	if (top.frames.length == 0) {
		//Not in a frame => redirect
//		top.location="test-index.php?url=" + "url-index";
//		alert("Redirected")
//		top.location="http://www.sofritonamas.nl/index.php";
		top.location="index.php" + "?" + strQueryVars;
	}
}



function MM_findObj(n, d) { //v4.01
 var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
   d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
 if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
 for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
 if(!x && d.getElementById) x=d.getElementById(n); return x;
}



function MM_showHideLayers() { //v6.0
 var i,p,v,obj,args=MM_showHideLayers.arguments;
 for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
   if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
   obj.visibility=v; }
}



function preloadImages() {
	var d=document; 

	if(d.images){
		if(!d.p) {
			d.p = new Array();
		}
	
		var i;
		var j = d.p.length;
		var a = preloadImages.arguments; 
		
		for(i=0; i<a.length; i++) {
			if (a[i].indexOf("#") != 0){ 
				d.p[j] = new Image; 
				d.p[j++].src = a[i];
			}
		}
	}
}



function handle_persoon_onmouse_out(strPersoon) {
	var strTemp = 'div_persoon_' + strPersoon;

	debug_alert('Persoon : ' + strTemp);
//	hide_all_persons(); ==> div laten staan (laatst geselecteerde)
//	MM_showHideLayers(strTemp, '', 'hide')
}

function hide_all_divs(DivsArr) {
	for (var i = 0; i < DivsArr.length; i++) {
		//alert("DivsArr : "+ DivsArr[i]);
		MM_showHideLayers(DivsArr[i], '', 'hide');
	}
}

function hide_all_persons() {
	MM_showHideLayers('div_persoon_entree', '', 'hide');
	
	MM_showHideLayers('div_persoon_vladimir', '', 'hide');
	MM_showHideLayers('div_persoon_natascha', '', 'hide');
	MM_showHideLayers('div_persoon_jolanda', '', 'hide');
	MM_showHideLayers('div_persoon_guido', '', 'hide');
	MM_showHideLayers('div_persoon_marius', '', 'hide');
	MM_showHideLayers('div_persoon_janwillem', '', 'hide');
//	MM_showHideLayers('div_persoon_reinoud', '', 'hide');
	MM_showHideLayers('div_persoon_marcel', '', 'hide');
	MM_showHideLayers('div_persoon_remco', '', 'hide');
	MM_showHideLayers('div_persoon_klaas', '', 'hide');
	MM_showHideLayers('div_persoon_sjors', '', 'hide');
	MM_showHideLayers('div_persoon_maria', '', 'hide');
}

function get_queryvar() {
	var args = new Object();
	var query = location.search.substring(1);	//Get query string
	var pairs = query.split("=");
	var obj;
	
	if ((pairs[0] != "showdiv") || (!pairs[1])) {
		//Geen query var meegegeven
		debug_alert("geen showdiv");
		return;
	}
	
	if (MM_findObj(pairs[1]) == null) {
		//DIV bestaat niet
		debug_alert("DIV bestaat niet");
		return;
	}
	
	MM_showHideLayers('entree', '', 'hide', 'entreeoff', '', 'show', 'home', '', 'hide', pairs[1], '', 'show');

	debug_alert("Show div = " + pairs[1]);
}

function debug_alert(sss) {
//	alert(sss);
}


		/* Beginning of JavaScript for checking required fields and for checking that certain fields contain only digits.
		
		// Code obtained from http://WillMaster.com/
		//
		// Each required form field can be checked with JavaScript. Here are 
		//    the function names for the different kinds of checks:
		//
		//       1. WithoutContent() -- check if the text, textarea, password, 
		//              file, or other text input fields has no content.
		//       2. NoneWithContent() -- check if none of the set of text, 
		//              textarea, password, file, or other text input fields 
		//              have content. (Set: More than one with the same field 
		//              name.)
		//
		//       3. NoneWithCheck() -- check if none of the set of radio buttons 
		//              or checkboxes are checked. (Set: More than one with the 
		//              same field name.)
		//       4. WithoutCheck() -- check if the single radio button or checkbox 
		//              is unchecked.
		//
		//       5. WithoutSelectionValue() -- check if selected drop-down list or 
		//              select box entries have no value.
		//
		//
		// The format for using the above functions is
		//             if(       WithoutContent([FORMFIELDVALUE])) [ERRORMESSAGE]
		//             if(      NoneWithContent([FORMFIELD])     ) [ERRORMESSAGE]
		//             if(        NoneWithCheck([FORMFIELD])     ) [ERRORMESSAGE]
		//             if(         WithoutCheck([FORMFIELD])     ) [ERRORMESSAGE]
		//             if(WithoutSelectionValue([FORMFIELD])     ) [ERRORMESSAGE]
		//
		// The if(...) part and the error message part may be on separate lines, like
		//             if(WithoutContent([FORMFIELDVALUE]))
		//                [ERRORMESSAGE]
		//             if(NoneWithContent([FORMFIELD]))
		//                [ERRORMESSAGE]
		//             if(NoneWithCheck([FORMFIELD]))
		//                [ERRORMESSAGE]
		//             if(WithoutCheck([FORMFIELD]))
		//                [ERRORMESSAGE]
		//             if(WithoutSelectionValue([FORMFIELD]))
		//                [ERRORMESSAGE]
		//
		//
		//      FORMFIELD -- The format for specifying a "form field" is 
		//                         document.[FORMNAME].[FIELDNAME]
		// FORMFIELDVALUE -- The format for specifying a "form field value" is 
		//                         document.[FORMNAME].[FIELDNAME].value
		//   ERRORMESSAGE -- The format for specifying an "error message" is
		//                          errormessage += "\n\n[MESSAGE]"; 
		//                   If the message itself contains quotation marks, 
		//                      they must be preceded with a back slash. 
		//                      Example: \"
		//
		//
		//      FORMNAME -- The name assigned to the form in the <FORM... tag. 
		//     FIELDNAME -- The field name being checked.
		// 
		//
		// For use with this JavaScript, the only non-alphanumeric character a 
		//    fieldname may have is the underscore. Replace any hyphens, colons, 
		//    spaces, or other non-alphanumeric characters in your field names 
		//    with an underscore character.
		//
		//
		// Put field checks into the function CheckRequiredFields(), in the order 
		//    you want the fields checked.
		//
		*/
		
		
		function WithoutContent(ss) {
			if(ss.length > 0) { return false; }
			return true;
		}
			
		function NoneWithContent(ss) {
			for(var i = 0; i < ss.length; i++) {
				if(ss[i].value.length > 0) { return false; }
			}
			return true;
		}
			
		function NoneWithCheck(ss) {
			for(var i = 0; i < ss.length; i++) {
				if(ss[i].checked) { return false; }
			}
			return true;
		}
			
		function WithoutCheck(ss) {
				if(ss.checked) { return false; }
			return true;
		}
			
		function WithoutSelectionValue(ss) {
			for(var i = 0; i < ss.length; i++) {
				if(ss[i].selected) {
					if(ss[i].value.length) { return false; }
					}
				}
			return true;
		}
		
		// Returns true if the string only contains alpha characters (empty string = true)
		function isAlpha(txt)
		{
			return ValidString(txt,'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz .-()');
		}
		
		// Returns true if the string only contains numeric characters (empty string = true)
		function isNumeric(txt)
		{
			return ValidString(txt,'0123456789');
		}
		
		// Returns true if the string only contains alpha numeric characters (empty string = true)
		function isAlphaNumeric(txt)
		{
			return ValidString(txt,'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz .-()0123456789');
		}
		
		// Returns true if the CheckString only contains characters passed in ValidString (empty string = true)
		function ValidString(ChkString,ValidString)
		{
			for (i=0; i<ChkString.length; i++)
			{
				if (ValidString.indexOf(ChkString.substring(i,i+1)) == -1) return false;
			}
			return true;
		}
		
		//Eigen functies
		function isTelNr(txt)
		{
			return ValidString(txt,'0123456789-');
		}
		function isDatum(txt)
		{
			return ValidString(txt,'0123456789-');
		}
		
		//-->


