function popupLink(u)
{
	var winW = 630, winH = 560;
/*	if (parseInt(navigator.appVersion) > 3)
	{
		if (navigator.appName=="Netscape")
		{
			winW = window.innerWidth;
			winH = window.innerHeight;
		}
		if (navigator.appName.indexOf("Microsoft") != -1)
		{
			winW = document.body.offsetWidth;
			winH = document.body.offsetHeight;
		}
	}	*/

//	var winW	= document.body.clientWidth;
//	var winH	= document.body.clientHeight;
	openPopup(u, winW, winH, 'help', 1, 1);
	return false;
/*
	openPopup(u, 525, 360, 'link', 1, 1);
	return false;	*/
}

/*
generic popup, only url is required, defaults are false

parameters:
	pUrl [required]
		the url of the window to open

	pWidth [optional]
		width of popup
		default = screen width - 100
		uses default if left blank or 0 (zero)

	pHeight [optional]
		height of popup
		default = (screen height - 100) or window content height, which ever is smaller
		uses default if left blank or 0 (zero)

	pName [optional]
		name of popup
		default = "pop"
		
	pCenter [optional]
		boolean - whether or not to center the popup
		default = false
		accepts: true|false|1|0|yes|no
		
	pScroll [optional]
		boolean - whether or not to show scrollbars
		default = false
		accepts: true|false|1|0|yes|no

	pResize [optional]
		boolean - whether or not to allow resizing on the popup
		default = false
		accepts: true|false|1|0|yes|no

*/
function openPopup( pUrl , pWidth , pHeight , pName , pCenter , pScroll , pResize )
{
	if ( pResize == null ) pResize = false;
	if ( pScroll == null ) pScroll = false;
	if ( pCenter == null ) pCenter = false;
	if ( pName == null || pName == "" ) pName = "pop";
	pHeight2 = pHeight;
	if ( pHeight == null || pHeight == "" || pHeight == 0 || isNaN(pHeight) ) { pHeight = 0; pHeight2 = screen.availHeight - 100; }
	if ( pWidth == null || pWidth == "" || pWidth == 0 || isNaN(pWidth) ) pWidth = screen.availWidth - 100;
	if ( pUrl == null || pUrl == "" ) { alert( "Failed to set a URL"); return false; }

	args = "width=" + pWidth + ",height=" + pHeight2;
	if ( pScroll ) args += ",scrollbars=1";
	if ( pResize ) args += ",resizable=1";
	newwin = open( pUrl , pName , args );
	if ( pCenter ) newwin.moveTo( ( screen.availWidth - pWidth ) / 2 , ( screen.availHeight - pHeight2 ) / 2 );

	p72addEvent( newwin , "load" , function()
	{ 
		/* no height was specified, shrink the window to fit the contents if they are smaller than the current window */
		if ( getDocumentHeight( newwin ) < pHeight2 && pHeight == 0 )
		{
			newwin.resizeBy( 0 , -(getClientHeight( newwin ) - getDocumentHeight( newwin )) );
		}
		newwin.focus();
	} );

}

function getDocumentHeight( o )
{
	if ( o == null ) o = document;
	else o = o.document;
	return o.body.offsetHeight + 12 ;
}

function getClientHeight( o )
{
	if ( o == null ) o = window;
	if ( document.all )
	{
		return ( o.document.documentElement ) ? o.document.documentElement.clientHeight : o.document.body.clientHeight;
	}
	else
	{
		return o.innerHeight;
	}
}

function p72validateString(p72str,p72type){

	var TEXT	= 0;
	var MULTI	= 1;
	var EMAIL	= 2;
	var NUMBER	= 3;
	var PHONE	= 4;

	if ( isNaN( p72type ) ) p72type = eval( p72type.toUpperCase() );

	re = new Array(5);
	re[0] = /[.\n]*/ ;
	re[1] = /[.\n]*/ ;
	re[2] = /^[\w|-]+(\.[\w|-]+)*@[\w|-]+(\.[\w|-]+)*(\.\w{2,3}){1,2}$/ ;
	re[3] = /^\d+$/ ;
	re[4] = /^(\+?)(( ?|-?)*(\(?( ?|-?)*\d+\)?))+( ?|-?)*$/ ;
	return re[p72type].test(p72str)
}

function p72addEvent( p72target , p72event , p72action , p72bubble ){
	if ( (/opera/i).test( navigator.userAgent ) ) return; /* opera has sh1t3 support for dom events */
	p72event = p72event.toLowerCase();
	if ( arguments.length < 4 ) p72bubble = false;
	if ( document.addEventListener ) p72target.addEventListener( p72event , p72action , p72bubble );
	else if ( document.attachEvent ) p72target.attachEvent( "on" + p72event , p72action );
}


/****************************************************************************************/
	function validateEmail(obj)
	{
		var email = obj.value;
/*		
		var emailReg = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
		var regex = new RegExp(emailReg);
		return regex.test(email);	*/

		var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/

		if (! email.match(re) && email.length != 0)
		{
			obj.style.background = "#eee0b4";
			return false;
		}
		obj.style.background = "#FFFFFF";
		return true;
	}
	/****************************************************************************************/
	function validateUrl(obj)
	{
		var v = obj.value;
		reg = /[a-zA-Z0-9_]/;
		reg = /\W/;
		if (v.match(reg) || v.length == 0)
		{
			return false;
		}
		return true;
	}
	/****************************************************************************************/

//	return the value of the radio button that is checked
//	return an empty string if none are checked, or there are no radio buttons
	function getCheckedValue(radioObj)
	{
		if(!radioObj)
			return "";
		var radioLength = radioObj.length;
		if(radioLength == undefined)
			if(radioObj.checked)
				return radioObj.value;
			else
				return "";
		for(var i = 0; i < radioLength; i++)
		{
			if(radioObj[i].checked)
			{
				return radioObj[i].value;
			}
		}
		return "";
	}
	/****************************************************************************************/
	function fnClearCal(obj, e)
	{
		if (e.keyCode == 46)
			obj.value = "";
	}
	/****************************************************************************************/
	function trim (str)
	{
		str = str.replace(/^\s*|\s*$/g, "");
		return str;
	}
	/****************************************************************************************/
	function typeOf(value)
	{
	    var s = typeof value;
	    if (s === 'object') {
	        if (value) {
	            if (typeof value.length === 'number' &&
	                    !(value.propertyIsEnumerable('length')) &&
	                    typeof value.splice === 'function') {
	                s = 'array';
	            }
	        } else {
	            s = 'null';
	        }
	    }
	    return s;
	}
	/****************************************************************************************/
	function isEmpty(o)
	{
	    var i, v;
	    if (typeOf(o) === 'object') {
	        for (i in o) {
	            v = o[i];
	            if (v !== undefined && typeOf(v) !== 'function') {
	                return false;
	            }
	        }
	    }
	    return true;
	}
	/****************************************************************************************/
	String.prototype.entityify = function ()
	{
    	return this.replace(/&/g, "&amp;").replace(/</g,
    	    "&lt;").replace(/>/g, "&gt;");
	};
	/****************************************************************************************/
	String.prototype.quote = function ()
	{
	    var c, i, l = this.length, o = '"';
	    for (i = 0; i < l; i += 1) {
	        c = this.charAt(i);
	        if (c >= ' ') {
	            if (c === '\\' || c === '"') {
	                o += '\\';
	            }
	            o += c;
	        } else {
	            switch (c) {
	            case '\b':
	                o += '\\b';
	                break;
	            case '\f':
	                o += '\\f';
	                break;
	            case '\n':
	                o += '\\n';
	                break;
	            case '\r':
	                o += '\\r';
	                break;
	            case '\t':
	                o += '\\t';
	                break;
	            default:
	                c = c.charCodeAt();
	                o += '\\u00' + Math.floor(c / 16).toString(16) +
	                    (c % 16).toString(16);
	            }
	        }
	    }
	    return o + '"';
	};
	/****************************************************************************************/
	String.prototype.supplant = function (o)
	{
	    return this.replace(/{([^{}]*)}/g,
	        function (a, b) {
	            var r = o[b];
	            return typeof r === 'string' || typeof r === 'number' ? r : a;
	        }
	    );
	};
	/****************************************************************************************/
	String.prototype.trim = function ()
	{
	    return this.replace(/^\s+|\s+$/g, "");
	};
		/****************************************************************************************/
	function checkemail(str)
	{
		var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
		if (filter.test(str))
			return true;
		else
		{
			return false;
		}
	}
	/****************************************************************************************/
