//------------------------------------------------------------------------------
// GET SCREEN SIZE
// Defaults to 800x600 if cannot determine dimensions
//------------------------------------------------------------------------------
var screenWidth=800;
var screenHeight=600;
function getScreen(debug){
    screenWidth=window.screen.availWidth;
	//if (document.all){
      //screenWidth  = document.body.clientWidth;
      //screenHeight = document.body.clientHeight;
	//} else if(innerWidth) {
	      //screenWidth = innerWidth;
    	  //screenHeight = innerHeight;
	//}
}


//------------------------------------------------------------------------------
// VALIDATE REPLY FORM
//------------------------------------------------------------------------------
function checkReply() {
if (self.document.reply.vc2.value==''){
alert('Please enter your first name');
self.document.reply.vc2.focus();
return false;
}
if (self.document.reply.vc3.value==''){
alert('Please enter your last name');
self.document.reply.vc3.focus();
return false;
}
if (self.document.reply.vc4.value==''){
alert('Please enter your email address');
self.document.reply.vc4.focus();
return false;
}
if (checkMail(self.document.reply.vc4.value)) {
self.document.reply.submit();
} else {
self.document.reply.vc4.focus();
}}

//------------------------------------------------------------------------------
// VALIDATE SUBSCRIPTION EMAIL
//------------------------------------------------------------------------------
function checkSubscription() {
if (self.document.subscription.email.value==''){
alert('Please enter your email address');
self.document.subscription.email.focus();
return false;
}
if (checkMail(self.document.subscription.email.value)) {
self.document.subscription.submit();
} else {
self.document.subscription.email.focus();
}}

//------------------------------------------------------------------------------
// CHECK E-MAIL ADDRESS
//------------------------------------------------------------------------------
function checkMail(mail){
at=mail.indexOf('@',1);dot=0;chr='';
if (at>0){dot=mail.indexOf('.',at+2);}
if (dot>0){chr=mail.substring(dot+1,mail.length);}
if (mail==''||at<1||dot==-1||chr==''){
alert('The email address you entered does not appear to be valid\nPlease check and try again!');
return false;
}
return true;
}

//------------------------------------------------------------------------------
// ROLLOVER MENU CODE
//------------------------------------------------------------------------------
function swapImgRestore() {
if (document.swapImgData != null)
for (var i=0; i<(document.swapImgData.length-1); i+=2)
document.swapImgData[i].src = document.swapImgData[i+1];
}
function swapImage() {
var i,j=0,objStr,obj,swapArray=new Array,oldArray=document.swapImgData;
for (i=0; i < (swapImage.arguments.length-2); i+=3) {
objStr = swapImage.arguments[(navigator.appName == 'Netscape')?i:i+1];
if ((objStr.indexOf('document.layers[')==0 && document.layers==null) || (objStr.indexOf('document.all[')==0 && document.all==null))
objStr = 'document'+objStr.substring(objStr.lastIndexOf('.'),objStr.length);
obj = eval(objStr);
if (obj != null) {
swapArray[j++] = obj;
swapArray[j++] = (oldArray==null || oldArray[j-1]!=obj)?obj.src:oldArray[j];
obj.src = swapImage.arguments[i+2];
}}
document.swapImgData = swapArray;
}

//------------------------------------------------------------------------------
// COMPILE DATE
//------------------------------------------------------------------------------
function showDate() {
dn=new Array(7);dn[0]='Sun';dn[1]='Mon';dn[2]='Tue';dn[3]='Wed';dn[4]='Thu';dn[5]='Fri';dn[6]='Sat';
dm=new Array(12);dm[0]='January';dm[1]='February';dm[2]='March';dm[3]='April';dm[4]='May';dm[5]='June';dm[6]='July';dm[7]='August';dm[8]='September';dm[9]='October';dm[10]='November';dm[11]='December';
da=new Array(32);da[0]='';da[1]='st';da[2]='nd';da[3]='rd';da[4]='th';da[5]='th';da[6]='th';da[7]='th';da[8]='th';da[9]='th';da[10]='th';da[11]='th';da[12]='th';da[13]='th';da[14]='th';da[15]='th';da[16]='th';da[17]='th';da[18]='th';da[19]='th';da[20]='th';da[21]='st';da[22]='nd';da[23]='rd';da[24]='th';da[25]='th';da[26]='th';da[27]='th';da[28]='th';da[29]='th';da[30]='th';da[31]='st';
today=new Date();tw=today.getDay();td=today.getDate();tm=today.getMonth();ty='' + today.getYear();
if (ty>99 && ty<1999) ty=(1900+eval(ty));
if (ty.length==2){ty='19'+ty;}
var a=dn[tw]+' '+td+da[td]+' '+dm[tm]+' '+ty;
document.write(a);
}

//------------------------------------------------------------------------------
// OPEN UPLOAD WINDOW
//------------------------------------------------------------------------------
function uploadFile(vmId, siteId){
uploadWindow=window.open('/servlet/UploadFileServlet2?vmId='+vmId+'&siteId='+siteId,'uploadWindow','scrollbars=0,menubar=0,resizable=0,toolbar=0,width=500,height=150');
uploadWindow.focus();
}