
//This is my Super Function, allows dynamic changing of any CSS Property value
function changeCSS(objectID,styleName,newVal)
{
	var object = document.getElementById(objectID);
	object.style[styleName] = newVal;
}

//this is a confirmation popup just pur onclick="return confirmSubmit()" in the link or on the submit button and it will prompt ok or cancel
function confirmSubmit()
{
var agree=confirm("Are you sure you wish to Delete this?");
if (agree)
	return true ;
else
	return false ;
}


//this is a macromedia created image swap function

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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}


//this function is for the colapsable things
function t(i) {
		var e = document.getElementById(i);
		var t = e.className;
		if (t.match('invisible')) { t = t.replace(/invisible/gi, 'visible'); 
		}
		else { t = t.replace(/visible/gi, 'invisible');
		}
		e.className = t;
}

function folder(i,image) {
		var e = document.getElementById(i);
		var f = e.className;
		if (f.match('invisible')) { f = f.replace(/invisible/gi, 'visible'); 
		MM_swapImage(image,'','images/content.gif',1);
		}
		else { f = f.replace(/visible/gi, 'invisible');
		MM_swapImgRestore();
		}
		e.className = f;
}

//Validation Functions

//numbervalidation
function validateNumber(field, msg, min, max) { // checks to make sure numbers are a certian length
	if (!min) { min = 0 }
	if (!max) { max = 255 }
		
	if (!field.value || field.value.length < min || field.value.length > max)
	{
		alert(msg);
		field.focus();
		field.select();
		return false;
	}

	return true;
}

//email validation
function validateEmail(email, msg, optional) { // checks to make sure the email is in proper format
	if (!email.value && optional) {
		return true;
	}
	var re_mail = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z]){2,}$/;
	if (!re_mail.test(email.value))
	 {
		alert(msg);
		email.focus();
		email.select();
		return false;
	}
	return true;
}


//string validation
function validateString(field, msg, min, max) { // check to make sure that strings are the right length
	if (!min) { min = 1 }
	if (!max) { max = 65535 }

	if (!field.value || field.value.length < min || field.value.length > max)
	 {
		alert(msg);
		return false;
	}
	return true;
}

//updated radio button checker that can check multiple radio button fields
function RadioOptionSelected(fldRadioToCheck, msg)
{
   //returns whether the user has made a choice in a radio button group

  if (fldRadioToCheck.length == null)  //only one option 
  {
     if (fldRadioToCheck.checked)
     {
       return true;
     }
     else
     {
	 alert(msg);
       return false;
     } 
   } 
   else  //multiple options
   {
     for (intRadioOption = 0; intRadioOption < fldRadioToCheck.length ; intRadioOption++)
     {
       if (fldRadioToCheck[intRadioOption].checked == '1')    
       {
         return true;
       }       
     }
	 alert(msg);
     return false;
   }
}

/* Add this block of code to the onSubmit or onClick to validate forms 
return(
validateString(this.[formfieldname],'[message]', [min], [max]) && //add && to check multiple fields
validateNumber([formfieldname], '[message]', [min], [max]) &&
validateEmail([formfieldname], '[message]', [true/false]) &&
RadioOptionSelected([radiobuttongroup], '[message]'));
*/

//reloads the window if Nav4 resized
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

//popup window code
function popUp(source_file,window_name,height,width,top,left) {
  window.open(source_file,window_name,"top=" + top + ",left=" + left + ",height=" + height + ",width=" + width + ",scrollbars=yes,resizable=yes,toolbar=yes,menubar=no,location=no,status=no");
}

//sets a bunch of varibles to detect what browser is seeing the site.
//this will let us serve different css if needed
is_dom = (document.getElementById) ? true : false;
is_ns4 = (document.layers) ? true : false;
is_ie = (document.all) ? true : false;
is_ie4 = is_ie && !is_dom;
is_mac = (navigator.appVersion.indexOf("Mac") != -1);
is_ns6 = is_dom && !is_ie
is_ie5m = is_ie && is_dom && is_mac;
is_ie4m = is_ie4 && is_mac;
is_ns4m = is_ns4 && is_mac;
is_opera = (navigator.userAgent.indexOf("Opera")!=-1);
is_konqueror = (navigator.userAgent.indexOf("Konqueror")!=-1);
spawnMenu = !is_ie5m && !is_opera && !is_konqueror && !is_ie4m && !is_ns4m && (is_dom || is_ns4 || is_ie4);


