// JavaScript Document

function theDate() {
day = new Array("Sun","Mon","Tues","Weds","Thurs","Fri","Sat")
month = new Array("January","February","March","April","May","June","July","August","September","October","November","December")
today = new Date()
thisDay = day[today.getDay()]
thisDate = today.getDate()
thisMonth = month[today.getMonth()]
thisYear = today.getFullYear()
thisHour = today.getHours()
thisMin = today.getMinutes()
document.getElementById('theDate').value=thisDay+', '+thisDate+' '+thisMonth+' '+thisYear
}

function hideSub() {
document.getElementById('linkContent').style.visibility='hidden'
}

function CountResultDisplay(p) {
	if (p=="1"){document.getElementById('Results_Display').value = "{List based on Data type field with sub set of org types. Counts should covers number of orgs and number of records covered}"}
	if (p=="2"){document.getElementById('Results_Display').value = "{List based on Sector then a sub list of Categories}"}
	if (p=="3"){document.getElementById('Results_Display').value = "{Breakdown of contacts based on \'senioirity\' field}"}
	if (p=="4"){document.getElementById('Results_Display').value = "{Breakdown of contacts based on \'Region\' field}"}
	if (p=="5"){document.getElementById('Results_Display').value = "{Number of orgs / contacts / e-mail addresses}"}
}

function pickSelect(f) {
	document.getElementById('SelectFrame').src=f+".htm";
}

function psxPopup(p) {
	window.open(p,'','height=300, width=450')
}
	
function afterLoad(){
	document.frmLogin.login_user.focus();
	btnCheck();
}
function doValid(){
	if(trim(document.frmLogin.login_user.value)==''){
		alert("Enter your username");
		document.frmLogin.login_user.focus();
		return(false);
	}
	if(trim(document.frmLogin.login_password.value)==''){
		alert("Enter your password");
		document.frmLogin.login_password.focus();
		return(false);
	}
	return(true);
}
function btnCheck(){
	if((trim(document.frmLogin.login_user.value)!='') && (trim(document.frmLogin.login_password.value)!='')){
		document.frmLogin.dosubmit.disabled=false;
	}
	else{
		document.frmLogin.dosubmit.disabled=true;
	}
}
function trim(str){
	return(str.replace(/\A\s*(.*\S)\s*\z/g, "\\1"));
}

function go2Login(Route,Size) {
if(Route=="PSX") {psxLogin(Size)}
if(Route=="FOLD") {foldLogin(Size)}
if(Route=="") {window.location.reload()}
}

function psxLogin(OffSet) {
Pos0 = (document.body.offsetWidth-746)/2
document.getElementById('loginBox').style.zIndex=2
document.getElementById('loginBox').style.left=Pos0+OffSet+'px'
document.getElementById('loginBox').style.visibility='visible'
}

function foldLogin(OffSet) {
Pos0 = (document.body.offsetWidth-746)/2
document.getElementById('loginBox').style.zIndex=2
document.getElementById('loginBox').style.left=Pos0+OffSet+'px'
document.getElementById('loginBox').style.visibility='visible'
document.getElementById('loginBox').innerHTML="<p align=\"center\" style=\"width: 270px;\">Sorry, service not yet available</p>"+
"<p align=\"center\"><button onclick=\"window.location.reload()\">Close</button></p>"
}

function tickerPage(p) {
location=p+".html"
}

oCost=0
Tot=0
function subCalc1() { 
sCost = new Array(7)
	if (document.costForm.AnnSub[0].checked==true) {sCost[0]=parseFloat(document.costForm.AnnSub[0].value)}
	else {sCost[0]=0}
	if (document.costForm.AnnSub[1].checked==true) {sCost[1]=parseFloat(document.costForm.AnnSub[1].value)}
	else {sCost[1]=0}
	if (document.costForm.AnnSub[2].checked==true) {sCost[2]=parseFloat(document.costForm.AnnSub[2].value)}
	else {sCost[2]=0}
	if (document.costForm.AnnSub[3].checked==true) {sCost[3]=parseFloat(document.costForm.AnnSub[3].value)}
	else {sCost[3]=0}
	if (document.costForm.AnnSub[4].checked==true) {sCost[4]=parseFloat(document.costForm.AnnSub[4].value)}
	else {sCost[4]=0}
	if (document.costForm.AnnSub[5].checked==true) {sCost[5]=parseFloat(document.costForm.AnnSub[5].value)}
	else {sCost[5]=0}
	if (document.costForm.AnnSub[6].checked==true) {sCost[6]=parseFloat(document.costForm.AnnSub[6].value)}
	else {sCost[6]=0}
	Tot=sCost[0]+sCost[1]+sCost[2]+sCost[3]+sCost[4]+sCost[5]+sCost[6]
document.getElementById('orderTotal').innerHTML="&pound; "+Tot
}