//
// Usage:
//	insert into the HMTL code in the header section 
//
//		<script src="path to pDate.js"></script>
//
//	put the following at the point you want the display
//
//   	<script> document.write(pDate ("Format string")); </script>
//
//
//		%A Full Month name
//		%a Short Month name
//		%N Two Digit Month No.
//		%n Month No.
//		%W Long Weekday
//		%w Short Weekday
//		%D Two Digit Day of the month
//		%d Day of the month
//		%Y Four digit year
//		%y Two digit year
//		%H 24 Hour
//		%h 12 Hour
//		%M Minutes
//		%S Second
//		%P AM/PM
//
//
function pDate (sDate) {
	//alert("ding");
	ldow = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday", "Friday","Saturday");
	sdow = new Array("Sun","Mon","Tue","Wed","Thur", "Fri","Sat");
	lmoy = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
	smoy = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
	CurDate = new Date();
	aYr =new String;
	//alert("sDate: "+sDate);
	//document.write(CurDate);
	wkday = CurDate.getDay();
	dom = CurDate.getDate();
	Dom = dom;
	if (Dom < 10) {
		Dom = "0" + Dom;
	}
	mon = CurDate.getMonth();
	imon = mon+1;
	iMon = mon;
	if (imon < 10) {
		iMon = "0" + imon;
	}
	yr = CurDate.getFullYear();
	Hr = CurDate.getHours();
	sHr = Hr;
	if ( Hr > 12) {
		sHr = Hr - 12;
		sAP = "PM";
	} else {
		sAP = "AM";
	}
	Mn = CurDate.getMinutes();
	if ( Mn < 10) {
		Mn = "0" + Mn;
	}
	Sec = CurDate.getSeconds();
	if ( Sec < 10) {
		Sec = "0" + Sec;
	}		
	aYr = yr.toString();
	syr = aYr.substr(2,2);
	sDate = sDate.replace(/%A/g,lmoy[mon]);
	sDate = sDate.replace(/%a/g,smoy[mon]);
	sDate = sDate.replace(/%N/g,iMon);
	sDate = sDate.replace(/%n/g,imon);
	sDate = sDate.replace(/%W/g,ldow[wkday]);
	sDate = sDate.replace(/%w/g,sdow[wkday]);
	sDate = sDate.replace(/%D/g,Dom);
	sDate = sDate.replace(/%d/g,dom);
	sDate = sDate.replace(/%Y/g,yr);
	sDate = sDate.replace(/%y/g,syr);
	sDate = sDate.replace(/%H/g,Hr);
	sDate = sDate.replace(/%h/g,sHr);
	sDate = sDate.replace(/%M/g,Mn);
	sDate = sDate.replace(/%S/g,Sec);
	sDate = sDate.replace(/%P/g,sAP);
	
	//alert(CurDate.toString());
	//if (navigator.appName == "Netscape") {
	//	yr = yr+1900};
	//window.alert(yr);
	//document.writeln(sDate);
	return sDate
}		
