/* =================================================================================

   JS Library 
   Last Updated: August 24 2007

================================================================================= */

// Menu code
function show(id) {
		var d = document.getElementById(id);
		for (var i = 1; i<=10; i++) {
			if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
		}
		if (d) {d.style.display='block';}
		}


// Collapsing Divs v.1.0
	function expandCollapse() {
		for (var i=0; i<expandCollapse.arguments.length; i++) {
		var element = document.getElementById(expandCollapse.arguments[i]);
		element.style.display = (element.style.display == "none") ? "block" : "none";
	}
}

//clears inputs on form
function doClear(theText) {
if (theText.value == theText.defaultValue) {
theText.value = ""
}
}

function doReturn(theText) {
theText.value = theText.defaultValue
}


//Text Counter for Form Field
function textCounter (field, countfield, maxlimit)
  {
  	if (field.value.length > maxlimit)
  	field.value = field.value.substring(0, maxlimit);
  	else
  	countfield.value = maxlimit - field.value.length;
}


//IP address
function ipval() {
document.myform.ipaddr.value=ip;
	var ip = '<!--#echo var="REMOTE_ADDR"-->'
	window.onload=ipval
}


//New Window
var newwindow;
function popitup(url)
{

	var x = document.forms[0].elements;
	var properties = '';
	for (var i=0;i<x.length;i++)
	{
		if (x[i].checked)
			properties += x[i].name + '=' + x[i].value +',';
	}
	properties = properties.substring(0,properties.length-1);
	newwindow=window.open(url,'name','height=120,width=250');
	newwindow.moveTo(400,400);
	if (window.focus) {newwindow.focus()}
	return false;
}
