function URLPopup(thisURL, windowW, windowH) {
    if (thisURL != "none") {
		win = window.open(thisURL,'ScriptPopup','width='+windowW+', height='+windowH+', left=50, top=50, location=0, toolbar=0, directories=0, status=1, menubar=0, scrollbars=1, resizable=1, zindex=-1, minimized=1');
    }
}

function limitlength(formobj, e, size){
	var returnvalue=true;
	var theCell = document.getElementById('charCount');
	if (!e.which && formobj.value.length>=size) //IE
		{ returnvalue=false; }
	else if (e.which && e.which!=8 && formobj.value.length>=size) //NS4, NS6+ (allow backspace key)
		{ returnvalue=false; }
	theCell.innerHTML = formobj.value.length + '/' + size;
	return returnvalue
}

function isEmail(who) {
	var email=/^[\+\.\-_]*[A-Z0-9]+([\+\.\-_][A-Z0-9]+)*[\+\.\-_]*@[A-Z0-9]+([_\.-][A-Z0-9]+)*\.([A-Z]){2,4}(,[\+\.\-_]*[A-Z0-9]+([\+\.\-_][A-Z0-9]+)*[\+\.\-_]*@[A-Z0-9]+([_\.-][A-Z0-9]+)*\.([A-Z]){2,4})*$/i;
	return(email.test(who));
}

// email=/^[A-Za-z0-9]+([_\.-]*[A-Za-z0-9]*)*@[A-Za-z0-9]+([_\.-][A-Za-z0-9]+)*\.([A-Za-z]){2,4}$/i;
// email=/^[_-]*[A-Z0-9]+([_\.-][A-Z0-9]+)*[_-]*@[A-Z0-9]+([_\.-][A-Z0-9]+)*\.([A-Z]){2,4}$/i;

function isMobile(who) {
	var mobile=/^\+?[0-9]+(,\+?[0-9]+)*$/;
	return(mobile.test(who));
}

function isName(who) {
	var name=/^[A-Z0-9]+([_\.-]*[A-Z0-9]+)*$/i;
	return(name.test(who));
}

function printWindow(){
   bV = parseInt(navigator.appVersion)
   if (bV >= 4) window.print()
}

function ClassNew(obj, new_style) {
    obj.className = new_style;
}

function selectURL(form) {
    var newURL = form.url.options[form.url.selectedIndex].value
    if (newURL != "") {
        location.href=newURL
    }
}

function RefreshList(form) {
    var newTopic = form.topic.options[form.topic.selectedIndex].value
    if (newTopic != "") {
        location.href=newTopic
   	}
}

function getStyleObject(objectId) {
  // checkW3C DOM, then MSIE 4, then NN 4.
  //
  if(document.getElementById && document.getElementById(objectId)) {
	return document.getElementById(objectId).style;
   }
   else if (document.all && document.all(objectId)) {  
	return document.all(objectId).style;
   } 
   else if (document.layers && document.layers[objectId]) { 
	return document.layers[objectId];
   } else {
	return false;
   }
}

function changeVis(objectId, newVisibility) {
    // first get a reference to the cross-browser style object 
    // and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.display = newVisibility;
	return true;
    } else {
	// we couldn't find the object, so we can't change its visibility
	return false;
    }
}

function toggleDiv(div_id)
	{
	  var styleObject = getStyleObject(div_id);
	  if (styleObject)
	  {
	  	if (styleObject.display == "none")
	  	{
	  	styleObject.display = "block";
	  	}
	  	else
	  	{
	  	styleObject.display = "none";
	  	}
	  }
	  else 
	  {
	    alert("Sorry, this only works in browsers that do Dynamic HTML!");
	  }
	}


var lastValidIndex = 0;
function checkDisabled(select_object){
	try {
		var selIndex = select_object.selectedIndex;
		if(select_object.options[selIndex].disabled){
		select_object.selectedIndex = lastValidIndex;
		}	else {
		lastValidIndex = select_object.selectedIndex;
		}
		if (select_object.options[lastValidIndex].disabled) {
			select_object.selectedIndex = 0;
		}
		return true;
		}
	catch(e){
		alert(e.description);
	}
}

//function to fix IE bug in menu
startList = function() {
	if (document.all&&document.getElementById) {
	navRoot = document.getElementById("nav");
	for (i=0; i<navRoot.childNodes.length; i++) {
	node = navRoot.childNodes[i];
	if (node.nodeName=="LI") {
	node.onmouseover=function() {
	this.className+="over";
	  }
	  node.onmouseout=function() {
	  this.className=this.className.replace("over", "");
	   }
	   }
	  }
	 }
	}
window.onload=startList;


