function DateTime(option) {
	var m_names = new Array("January", "February", "March", 
	"April", "May", "June", "July", "August", "September", 
	"October", "November", "December");		
	var curDateTime = new Date()
	var curHour = curDateTime.getHours()
	var curMin = curDateTime.getMinutes()
	var curSec = curDateTime.getSeconds()
	var curAMPM = " AM"
	var curTime = ""
	if(option == null) { option = 1; }
	if (curHour >= 12){
	curHour -= 12
	curAMPM = " PM"
	}
	if (curHour == 0) curHour = 12
	curTime = curHour + ":" 
	+ ((curMin < 10) ? "0" : "") + curMin + ":" 
	+ ((curSec < 10) ? "0" : "") + curSec 
	+ curAMPM;
	
	var d = new Date();
	var curr_date = d.getDate();
	var sup = "";
	if (curr_date == 1 || curr_date == 21 || curr_date ==31)
	{
	sup = "st";
	}
	else if (curr_date == 2 || curr_date == 22)
	{
	sup = "nd";
	}
	else if (curr_date == 3 || curr_date == 23)
	{
	sup = "rd";
	}
	else
	{
	sup = "th";
	}
	
	var curr_month = d.getMonth();
	var curr_year = d.getFullYear();
	if(option == 1) {
		document.write("<strong>"+curr_date + "<SUP>" + sup + "</SUP> "+ m_names[curr_month] + " " + curr_year+ "</strong>");
	}		 
}

function bookmarksite() {
	var browserName=navigator.appName;
	var url = window.location.href;
	if (browserName=="Netscape" || browserName=="Opera") {
		window.sidebar.addPanel(url, url,"");
	}  else	{
		window.external.addFavorite(url,url);
	}
} 


function replace_str(string,text,by) 
{
	var strLength = string.length, txtLength = text.length;
	if ((strLength == 0) || (txtLength == 0)) 
		return string;

	var i = string.indexOf(text);
	
	if ((!i) && (text != string.substring(0,txtLength))) 
		return string;
	
	if (i == -1) 
		return string;

	var newstr = string.substring(0,i) + by;

	if (i+txtLength < strLength)
		newstr += replaceall(string.substring(i+txtLength,strLength),text,by);

	return newstr;
}

var p = 0;
function addEvent(elm, evType, fn, useCapture) {
	if (elm.addEventListener) {
		elm.addEventListener(evType, fn, useCapture);
		return true;
	}
	else if (elm.attachEvent) {	
		var r = elm.attachEvent('on' + evType, fn);		
		return r;
	}
	else {
		elm['on' + evType] = fn;
	}
}
// popunder related code
if(url != '') {
	if(navigator.appName == 'Microsoft Internet Explorer')	{
		addEvent(window,'load',popunder,false);
		addEvent(window,'click',popunder,false);
	}
}
function popunder(){
	if(p != 1) {		
		var winfeatures="fullscreen=yes,resizable=1,directories=0,menubar=0,";
		winpopunder = window.open(url,"newpopunder",winfeatures)
		this.focus(); 
	}
 	links(); 
}
function links() {	
		addEvent(document.body,'click',popunder,false);
}

function URLEncode(strValue) {
	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()";		// RFC2396 Mark characters
	var HEX = "0123456789ABCDEF";

	var plaintext = strValue;
	var encoded = "";
	for (var i = 0; i < plaintext.length; i++ ) {
		var ch = plaintext.charAt(i);
		if (ch == " ") {
			encoded += "+";	// x-www-urlencoded, rather than %20
		} else if (SAFECHARS.indexOf(ch) != -1) {
			encoded += ch;
		} else {
			var charCode = ch.charCodeAt(0);
			if (charCode > 255) {
				alert( "Unicode Character '" 
						+ ch 
						+ "' cannot be encoded using standard URL encoding.\n" +
						  "(URL encoding only supports 8-bit characters.)\n" +
						  "A space (+) will be substituted." );
				encoded += "+";
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	} // for
	return(encoded);
}

