function MM_openBrWindow(theURL,winName,features)
{ //v2.0 opens a new window
  window.open(theURL,winName,features);
}


function ClearBox(theText) 
{ // clears what's in a text input box
     if (theText.value == theText.defaultValue)
 {
         theText.value = ""
     }
 }

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function GetCookie(name) {
var arg=name+"=";
var alen=arg.length;
var clen=document.cookie.length;
var i=0;
while (i<clen) {
var j=i+alen;
if (document.cookie.substring(i,j)==arg)
return "here";
i=document.cookie.indexOf(" ",i)+1;
if (i==0) break;
}
return null;
}

function EmailSignup() {
var visit=GetCookie("COOKIE1");
if (visit==null){
var expire=new Date();
window.name = "thiswin";
newwin=open("/popups/emailsignup.php", "dispwin", 
"width=300,height=250,scrollbars=no,menubar=no");
expire=new Date(expire.getTime()+7776000000);
document.cookie="COOKIE1=here; expires="+expire;
}
}

// The next 2 functions test to see if the browser accepts cookies.
function TestForSetting() {
document.cookie = 'TemporaryTestCookie=yes; path=/';
setTimeout('TestIfCookieWasSet()',1500);
}

function TestIfCookieWasSet() {
var testcookie = '';
if(document.cookie.length > 0) {
	var cookiename = 'TemporaryTestCookie=';
	var cookiebegin = document.cookie.indexOf(cookiename);
	var cookieend = 0;
	if(cookiebegin > -1) {
		cookiebegin += cookiename.length;
		cookieend = document.cookie.indexOf(";",cookiebegin);
		if(cookieend < cookiebegin) { cookieend = document.cookie.length; }
		testcookie = document.cookie.substring(cookiebegin,cookieend);
		}
	}
if(testcookie == 'yes') { EmailSignup(); }
else { return false; }
}

function disableForm(theform) {
if (document.all || document.getElementById) {
for (i = 0; i < theform.length; i++) {
var tempobj = theform.elements[i];
if (tempobj.type.toLowerCase() == "submit" || tempobj.type.toLowerCase() == "reset")
tempobj.disabled = true;
}
setTimeout('alert("Your form has been submitted.  Notice how the submit and reset buttons were disabled upon submission.")', 2000);
return true;
}
else {
alert("The form has been submitted.  But, since you're not using IE 4+ or NS 6, the submit button was not disabled on form submission.");
return false;
   }
}

function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit)
field.value = field.value.substring(0, maxlimit);
else 
countfield.value = maxlimit - field.value.length;
}
