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();
}

function redirect(location)	{

	window.location = location;

	//alert(location);

}

var newwindow;
function popup(url)
{
	newwindow=window.open(url,'name','height=270,width=530,scrollbars=1');
	newwindow.moveTo(250,180);
	if (window.focus) {newwindow.focus()}
}

function letternumber(e)
{
var key;
var keychar;

if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;
keychar = String.fromCharCode(key);
keychar = keychar.toLowerCase();

// control keys
if ((key==null) || (key==0) || (key==8) || 
    (key==9) || (key==13) || (key==27) )
   return true;

// alphas and numbers
else if ((("abcdefghijklmnopqrstuvwxyz0123456789").indexOf(keychar) > -1))
   return true;
else
   return false;
}

function intergeronly(e)
{
var key;
var keychar;

if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;
keychar = String.fromCharCode(key);
keychar = keychar.toLowerCase();

// control keys
if ((key==null) || (key==0) || (key==8) || 
    (key==9) || (key==13) || (key==27) )
   return true;

// alphas and numbers
else if ((("0123456789").indexOf(keychar) > -1))
   return true;
else
   return false;
}

function floatonly(e)
{
var key;
var keychar;

if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;
keychar = String.fromCharCode(key);
keychar = keychar.toLowerCase();

// control keys
if ((key==null) || (key==0) || (key==8) || 
    (key==9) || (key==13) || (key==27) )
   return true;

// alphas and numbers
else if (((".0123456789").indexOf(keychar) > -1))
   return true;
else
   return false;
}

function trim(inputString)
{
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") {
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") {
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1)
	{
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length);
   }
   return retValue;
}

// load the appropriate xmlHttpRequest for IE or Mozilla 
// this sniffer code can be found at 
// http://jibbering.com/2002/4/httprequest.html 

var xmlHttp 

/*@cc_on @*/ 
/*@if (@_jscript_version >= 5) 
  try { 
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP") 
} catch (e) { 
  try { 
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP") 
  } catch (E) { 
   xmlHttp=false 
  } 
} 
@else 
xmlHttp=false 
@end @*/ 
if (!xmlHttp) { 
try { 
  xmlHttp = new XMLHttpRequest(); 
} 
catch (e) { 
  xmlHttp=false 
} 
} 

// end jibbering.com code 


// the php script to process the form.  var must be global! 

var URLto = 'index.php'; 

// function to build POST requests 

function buildPOST(theFormName) { 
    theForm = document.forms[theFormName]; 
    var qs = '' 
    for (e=0;e<theForm.elements.length;e++) { 
        if (theForm.elements[e].name!='') { 
            var name = theForm.elements[e].name; 
            qs+=(qs=='')?'':'&' 
            qs+= name+'='+escape(theForm.elements[e].value); 
        } 
    } 
    qs+="\n"; 
    return qs 
} 

// function to communicate with remote script 

function send_post(theFormName, theURL) { 
	URLto = theURL;
    var xmlMessage = buildPOST(theFormName); 
    xmlHttp.open("POST", URLto, false) ;
         
    // for ie compatability 
    xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded') ;
//    xmlHttp.setRequestHeader('Content-Type','multipart/form-data') ;
     
    xmlHttp.send(xmlMessage) 
} 


function display_response(responseContainer) { 
    var optionDiv = document.getElementById(responseContainer); 
    optionDiv.innerHTML = xmlHttp.responseText; 
}