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 getCookieVal (j);    
		i = document.cookie.indexOf(" ", i) + 1;    
		if (i == 0) break;   
	}  
	return null;
}
function getCookieVal(offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
		endstr = document.cookie.length;
		return unescape(document.cookie.substring(offset, endstr));
}
function SetCookie (name, value, expires) {  
	var argv = SetCookie.arguments;  
	var argc = SetCookie.arguments.length;  
	var expires = (argc > 2) ? argv[2] : null;  
	var path = (argc > 3) ? argv[3] : null;  
	var domain = (argc > 4) ? argv[4] : null;  
	var secure = (argc > 5) ? argv[5] : false;  
	document.cookie = name + "=" + escape (value) + 
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
	((path == null) ? "" : ("; path=" + path)) +  
	((domain == null) ? "" : ("; domain=" + domain)) +    
	((secure == true) ? "; secure" : "");
}
// test to see if cookie val is 1. if so, change to 2 and dispaly welcome
function checkFirstVisit() {
	var welcomeExpDays = 720; // number of days the cookie should last
	var exp = new Date(); 
	exp.setTime(exp.getTime() + (welcomeExpDays*24*60*60*1000));
	var page = "http://www.oas.org";
	var windowprops = "width=350,height=300,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=yes";
	var cname = "fwelcome";
	var cval = GetCookie(cname);
	if (cval == 1) {
		cval=2;
		SetCookie(cname, cval, exp, '/','.oas.org');
		window.open(page, "", windowprops);
	}
}

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;
}

// function to show or hide a layer.  "nr" is the id of the layer to show or hide. "show" = 0 means to hide. 1 means to show
function blocking(nr,show)
{
	if (show==1) { current = 'block'; } else { current = 'none'; }
	if (document.layers)
	{
		document.layers[nr].display = current;
	}
	else if (document.all)
	{
		document.all[nr].style.display = current;
	}
	else if (document.getElementById)
	{
		document.getElementById(nr).style.display = current;
	}
}


