function popUpMsg( msg )
{ 
	alert( msg );
}


var popupWindow;

function openWindowAtCenter(url) 
{
	if (!popupWindow || popupWindow.closed) {
		var w = 750;
	    var h = 400;
	    var l = parseInt((screen.availWidth/2) - (w/2));
	    var t = parseInt((screen.availHeight/2) - (h/2));
	    var f = "width=" + w + ",height=" + h + 
	        ",status,resizable,scrollbars,left=" + l + ",top=" + t + 
	        ",screenX=" + l + ",screenY=" + t;
	    popupWindow = window.open(url, "NewWindow", f);
    } else if (popupWindow.focus) {
        // window is already open and focusable, so bring it to the front
    	popupWindow.focus();
    	popupWindow.location.href=url;
    }
    
}



//** Functions for showing/hiding elements ***//

/**
 * Toggles an element to between being shown and hiden.
 * whichLayer is its ID
 */
function toggleLayer( elementId )
{
  var elem, vis;
  elem = getElement( elementId );
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}

/**
 * Shows the layer with the given ID
 * @param elementId the elements ID
 * @return
 */
function showLayer( elementId )
{
	var elem, vis;
	elem = getElement( elementId );
	vis = elem.style;
	vis.display = 'block';
}

/**
 * Hides the layer with the given ID
 * @param elementId the elements ID
 * @return
 */
function hideLayer( elementId )
{
	var elem, vis;
	elem = getElement( elementId );
	vis = elem.style;
	vis.display = 'none';
}


/**
 * Returns the element with the given Id.
 * May be Null.
 * @param elementId
 * @return
 */
function getElement( elementId )
{
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( elementId );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[elementId];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[elementId];
  return elem;
}





// thx to http://www.scriptygoddess.com/archives/2005/11/15/clear-default-text-onclick-restore-if-nothing-entered/
function clickclear(thisfield, defaulttext) {
	if (thisfield.value == defaulttext) {
		thisfield.value = "";
	}
}

function clickrecall(thisfield, defaulttext) {
	if (thisfield.value == "") {
		thisfield.value = defaulttext;
	}
}







