months = new Array('January','February','March','April','May','June','July','August','September','October','November','December')
days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday')
function writeDateFull(){
now = new Date()
document.write(days[now.getDay()]+", "+now.getDate()+" "+months[now.getMonth()]+" "+now.getFullYear())
}


var imgWin
function popIMGWin(i){
var u='image-pop.asp?IMG='+i
imgWin=window.open(u,"IMAGEPOP","width=226,height=226"); imgWin.window.focus()
}


smonths = new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')
function writeDateList(dd){
for(i=1; i<=31; i++){
	if(i==parseInt(dd,10)) {document.write("<option value="+insZero(i,2)+" selected>"+insZero(i,2))}
	else {document.write("<option value="+insZero(i,2)+">"+insZero(i,2))}
}}
function writeMonthList(mm){
for(i=1; i<=12; i++){
	if(i==parseInt(mm,10)) {document.write("<option value="+insZero(i,2)+" selected>"+smonths[i-1])}
	else {document.write("<option value="+insZero(i,2)+">"+smonths[i-1])}
}}
function insZero(num,sf){
var inputStr=num.toString()
while(inputStr.length<sf) {inputStr="0"+inputStr}
return inputStr
}

function isBlank(input){
var inputStr=input.value
if(window.RegExp && inputStr!=""){
	var regExp1 = /\S/
	if(!regExp1.test(inputStr)) {input.value="";return true}; return false
}}

function isNumber(input){
var inputStr=input.value
if(window.RegExp && inputStr!=""){
	var regExp1 = /[^0-9]/
	if(regExp1.test(inputStr)) {alert("Invalid entry.\n\nPlease ensure that entries are numbers only.");input.value="";input.focus();return false}; return true
}}

function isAlphaNum(input){
var inputStr=input.value
if(window.RegExp && inputStr!=""){
	var regExp1 = /[^a-zA-Z0-9]/
	if(regExp1.test(inputStr)) {alert("Invalid entry.\n\nPlease ensure that entries are alphanumeric only.");input.value="";input.focus();return false}; return true
}}

function isEmail(input){
var inputStr=input.value
if(window.RegExp && inputStr!=""){
	var regstr1 = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)"
	var regstr2 = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$"
	var regExp1 = new RegExp(regstr1)
	var regExp2 = new RegExp(regstr2)
	var regExp3 = /[^a-zA-Z0-9\-_.@]/
	if(!(!regExp1.test(inputStr) && regExp2.test(inputStr) && !regExp3.test(inputStr)) || !(inputStr.indexOf("@")>=0)) {alert("Invalid entry.\n\nPlease enter a valid Email Address.");input.value="";input.focus();return false}; return true
}}

function chkField(input,min,type){
if(type=="num") {isNumber(input)}
else if(type=="alphanum") {isAlphaNum(input)}
else {isBlank(input)}
var inputStr=input.value
if(inputStr!=""){
	inputStr=inputStr.replace(/^\s+/,""); inputStr=inputStr.replace(/\s+$/,"")
	if(min!="" && inputStr.length<min) {alert("Invalid entry.\n\nPlease enter a minimum of "+min+" characters.");input.value="";input.focus()}
}}

function isDate(day,month,year){
var cDate = new Date()
cDate.setDate(1);cDate.setFullYear(parseInt(year,10));cDate.setMonth(parseInt(month,10)-1);cDate.setDate(parseInt(day,10))
if(cDate.getDate()!=parseInt(day,10) || cDate.getMonth()!=(parseInt(month,10)-1) || cDate.getFullYear()!=parseInt(year,10)) {return false}
return true
}

function isFwdDate(day,month,year,min){
var cDate = new Date(), dDate = new Date()
dDate.setDate(1);dDate.setFullYear(parseInt(year,10));dDate.setMonth(parseInt(month,10)-1);dDate.setDate(parseInt(day,10))
if(min) {cDate.setDate(cDate.getDate()+min)}
if(dDate.getTime()<cDate.getTime()) {return false}
return true
}