


// SELECT FOR OVERWRITE
// Written by Nathan Wesling
// June 6, 2006
// The following function is used to select the default text
// in a form field so that it can be easily typed over
function selectForOverwrite(thisField,highlightText){
	highlightText = highlightText === undefined ? "" : highlightText;
	if(thisField.value == highlightText || highlightText == '')
		thisField.select();
}

// Gets a element by its Id. Used for shorter coding.
function GetElem( elementId )
{
	return document.getElementById(elementId);
}

function ShowElem( element, isVisible )
{
	if ( typeof( element ) == 'string' )
		element = GetElem( element ) ;
	element.style.display = isVisible ? '' : 'none' ;
}
function UpdateColor(element,color){
		GetElem(element).style.color=color;
	}
function getHTTPObj() {
	var ua;

	if(window.XMLHttpRequest) {
		try {
			ua = new XMLHttpRequest();
		} catch(e) {
			ua = false;
		}
	} else if(window.ActiveXObject) {
		try {
			ua = new ActiveXObject("Microsoft.XMLHTTP");
		} catch(e) {
			ua = false;
		}
	}
	return ua;
}

function popup(url, w, h)
{  var winl = (screen.width-w-3)/2;
  var wint = (screen.height-h-150)/2;
  
  var win = window.open(url, "win" + new Date().getTime(), "height="+h+",width="+w + ", top="+wint+", left="+winl+", toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");
  

  
  
  if (window.focus) win.focus();
  
}

function popupScroll(url, w, h)
{  var winl = (screen.width-w-3)/2;
  var wint = (screen.height-h-150)/2;
  
  var win = window.open(url, "win" + new Date().getTime(), "height="+h+",width="+w + ", top="+wint+", left="+winl+", toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no");
  

  
  
  if (window.focus) win.focus();
  
}

function popfull(url)
{
  var win = window.open(url, "win" + new Date().getTime(), "height=760,width=570,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");
  win.moveTo(0,0);
  win.resizeTo(screen.availWidth, screen.availHeight);
  if (window.focus) win.focus();
}

// Browser Detect

var ua = navigator.userAgent.toLowerCase();
var os,browser,version,data;

if (detect('konqueror')) {browser = "Konqueror"; os = "Linux";}
else if (detect('safari')) browser = "Safari";
else if (detect('omniweb')) browser = "OmniWeb";
else if (detect('netscape')) browser = "Netscape";
else if (detect('firefox')) browser = "Firefox";
else if (detect('opera')) browser = "Opera";
else if (detect('webtv')) browser = "WebTV";
else if (detect('icab')) browser = "iCab";
else if (detect('msie')) browser = "Internet Explorer";
else if (detect('netscape')) browser = "Netscape Navigator";
else if (!detect('compatible')) {browser = "Netscape Navigator"; version = ua.charAt(8);}
else browser = "An unknown browser";

if (!version) version = ua.charAt(stringposition + data.length);

if (!os) {
   if (detect('linux')) os = "Linux";
   else if (detect('x11')) os = "Unix";
   else if (detect('mac')) os = "Mac";
   else if (detect('win')) os = "Windows";
   else os = "An unknown operating system";
}

function detect(text) {
   stringposition = ua.indexOf(text) + 1;
   data = text;
   return stringposition;
   }
   
function popup(url, w, h)
{
  var win = window.open(url, "win" + new Date().getTime(), "height="+h+",width="+w + ",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");
  if (window.focus) win.focus();
}

function popupScroll(url, w, h)
{ var winl = (screen.width-w-3)/2;
  var wint = (screen.height-h-150)/2;
  var win = window.open(url, "win" + new Date().getTime(), "height="+h+",width="+w + ", top="+wint+", left="+winl+", toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no");
  if (window.focus) win.focus();
}

function popfull(url)
{
  var win = window.open(url, "win" + new Date().getTime(), "height=760,width=570,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");
  win.moveTo(0,0);
  win.resizeTo(screen.availWidth, screen.availHeight);
  if (window.focus) win.focus();
}



