/*****
* script voor de SWITCHING show/hide divs 
****/

function toggleDiv(divName, divName2) {
    thisDiv = document.getElementById(divName);
	thisDiv2 = document.getElementById(divName2);
	
	if (thisDiv) {
			if (thisDiv.style.display == "none") {
				thisDiv.style.display = "block";
			} else {
				thisDiv.style.display = "none";
			}
		}
		if (thisDiv2) {
			if (thisDiv2.style.display == "block") {
				thisDiv2.style.display = "none";
			} else {
				thisDiv2.style.display = "block";
			}
		}
    }
/*****
* script voor de show/hide divs 
****/
        function toggleLayer(whichLayer)
        {
        if (document.getElementById)
        {
        // this is the way the standards work
            var style2 = document.getElementById(whichLayer).style;
            style2.display = style2.display? "":"block";
            }
            else if (document.all)
            {
            // this is the way old msie versions work
            var style2 = document.all[whichLayer].style;
            style2.display = style2.display? "":"block";
            }
            else if (document.layers)
            {
            // this is the way nn4 works
            var style2 = document.layers[whichLayer].style;
            style2.display = style2.display? "":"block";
            }
            }
/******** MAX CHARS TEXTFIELD

 Original: Ronnie T. Moore 
// Web Site: The JavaScript Source 
// Dynamic 'fix' by: Nannette Thacker 
// Web Site: http://www.shiningstar.net 
// This script and many more are available free online at 
// The JavaScript Source!! http://javascript.internet.com 

// Begin */
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
countfield.value = maxlimit - field.value.length;
}
// End 
/*****************************************
VALIDATE FUNCTIONS
1 ***Subject filled ??********************/
function validateSubject(theform) {
	if (theform.onderwerp.value=="") {
		alert("Please enter a subject in the subject field.");
		return false; 
		}  else { 
	   return true; 
	   }
}
function validateParty(theform) {
	if ((theform.newName.value=="") || (theform.day.value=="") || (theform.month.value=="") || (theform.year.value=="")){
		alert("Vul de naam en datum in van het project.");
		return false; 
		}  else { 
	   return true; 
	   }
}
function validateMedia(theform) {
	if ((theform.naam.value=="") || (theform.soort.value=="") || (theform.auteur.value=="") || (theform.link.value=="http://")){
		alert("Please enter all info.");
		return false; 
		}  else { 
	   return true; 
	   }
}
function validateUpload1a(theform) {
	if (theform.file1.value=="") {
		alert("Please select a file to upload.");
		return false; 
		}  else { 
	   return true; 
	   }
}

/*****************************************
 * Simple RollOver script by Virtual_Max 
 * http://come.to/vmax 
 * Free to use untill this notice  present 
 * unchanged in all copies and derivatives
 *****************************************/
function VMaxOver(link,id,overIm) {
  if(document.images) {
    im            = document.images[id];
    im.outIm      = new Image();
    im.overIm     = new Image();
    im.outIm.src  = document.images[id].src;
    im.overIm.src = overIm;
    im.src        =im.overIm.src;
    link.onmouseout  = new Function("var im=document."+id+"; im.src=im.outIm.src;");
    link.onmouseover = new Function("var im=document."+id+"; im.src=im.overIm.src;");
  }
}
function sectionChecker(theform)
{
// set var radio_choice to false
var radio_choice = false;

// Loop from zero to the one minus the number of radio button selections
for (counter = 0; counter < theform.section.length; counter++)
{
// If a radio button has been selected it will return true
// (If not it will return false)
if (theform.section[counter].checked)
radio_choice = true; 
}

if (!radio_choice)
{
// If there were no selections made display an alert box 
alert("Please select a section.")
return (false);
}
return (true);
}
