var topMargin = 150;
var intcount = 1;
var slideTime = 1200;
var ns6 = (!document.all && document.getElementById);
var ie4 = (document.all);
var ns4 = (document.layers);

var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
function getthedate(){
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var hours=mydate.getHours()
var minutes=mydate.getMinutes()
var seconds=mydate.getSeconds()
var dn="AM"
if (hours>=12)
dn="PM"
if (hours>12){
hours=hours-12
}
{
 d = new Date();
 Time24H = new Date();
 Time24H.setTime(d.getTime() + (d.getTimezoneOffset()*60000) + 3600000);
 InternetTime = Math.round((Time24H.getHours()*60+Time24H.getMinutes()) / 1.44);
 if (InternetTime < 10) InternetTime = '00'+InternetTime;
 else if (InternetTime < 100) InternetTime = '0'+InternetTime;
}
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
//change font size here
var cdate=dayarray[day]+",  "+montharray[month]+" "+daym+" "+year+" | "+hours+":"+minutes+":"+seconds+" "+dn+"&nbsp;&nbsp;" //| @"+InternetTime+""
if (document.all)
document.all.clock.innerHTML=cdate
else if (document.getElementById)
document.getElementById("clock").innerHTML=cdate
else
document.write(cdate)
}
if (!document.all&&!document.getElementById)
getthedate()
function goforit(){
if (document.all||document.getElementById)
setInterval("getthedate()",1000)
sitetest()
}

//window.onload=goforit

function imageOn(imageName) {
    if (document.images) {
        currentImage = document.images[imageName];
        currentImage.src = imageName + "_on.gif";
    }
}

function imageOff(imageName) {
    if (document.images) {
        currentImage = document.images[imageName];
        currentImage.src = imageName + "_off.gif";
    }
}

function sitetest() {
	document.cookie="zok=1"
}

function MenuAction(x,y,z) {
	var sURL = unescape(window.location.pathname);
	if (z == 99 ){	
		alert("__________________________        \n\nYour request was not processed.\n__________________________");
		return false;
	} else {
	document.cookie="pgc=" + x
	document.cookie="mod=" + y
	document.cookie="mnu=" + z
//	if (GC("zok") == '1' ) {
//		window.location.href = sURL }
//	  else {
		window.location.href = sURL + "?pgc=" + x + "&mod=" + y + "&mnu=" + z;
//		}
	// parent.navigate (x )	;
	}
}

function uplMenuAction(x,y,z,a) {
//    alert(a)
		document.cookie='pgc=' + x 
		document.cookie='mod=' + y
		document.cookie='mnu=' + z
		parent.navigate (a);
}


function HeadMenuAction(w,x,y,z) {
	var sURL = unescape(window.location.pathname);
	if (z == 99 ){	
		alert("__________________________        \n\nYour request was not processed.\n__________________________");
		return false;
	} else {
	document.cookie="pgc=" + x
	document.cookie="mod=" + y
	document.cookie="mnu=" + z
		window.location.href = sURL + "?pgc=" + x + "&mod=" + y + "&mnu=" + z + "&act=" + w;
	}
}


function GC (name) {  
	var arg = name + "=";  
	var alen = arg.length;  
	var clen = document.cookie.length;  
	var i = 0;  
	while (i < clen) {    
		var j = i + alen;    
		if (document.cookie.substring(i, j) == arg)      
		return GCVal (j);    
		i = document.cookie.indexOf(" ", i) + 1;    
		if (i == 0) break;   
	}  
	return null;
}

function GCVal (offset) {  
	var endstr = document.cookie.indexOf (";", offset);  
	if (endstr == -1)    
	endstr = document.cookie.length;  
	return unescape(document.cookie.substring(offset, endstr));
}

function MM_invalid() { //v3.0
  var msg
	msg  = "_______________________________________        \n\n" ;
	msg += "You cannot view an Administrators information!\n";
	msg += "_______________________________________\n" ;
	  alert(msg) ;	  
}


function printdoc(x){
	window.open('/?mode=print&doc='+x,'FOSFA','width=630,height=600,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes');
}

function PrMenuAction(x,y,z) {
		var sURL = unescape(window.location.pathname);
		var msg;
		msg  = "___________________________________        \n\n" ;
		if(z == 'DEL') {
		msg += "Are You sure you wish to delete this page?\n"; }
		  else {
		msg += "Are You sure you wish to restore this page?\n"; }
	
		msg += "___________________________________\n" ;
		if(confirm(msg)) {
			msg  = "____________________________________________        \n\n" ;
			msg += "Your request has been accepted and will be processed!\n";
			msg += "____________________________________________\n" ;
			alert(msg);			
			document.cookie="pgc=" + x
			document.cookie="mod=" + y
			document.cookie="mnu=" + z
			window.location.href = sURL + "?pgc=" + x + "&mod=" + y + "&mnu=" + z
			return true;
			}
			else {
		alert("__________________________        \n\nYour request was not processed.\n__________________________");
		return false;
		}
}


function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i>d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_validateForm() { //v3.0
  var i,p,q,nm,test,num,min,max,msg,errors='',args=MM_validateForm.arguments;
  if (GC("DNSRO") == 1 ){
  var msg
	msg  = "_______________________________________        \n\n" ;
	msg += "You do not have permission to save information!\n";
	msg += "_______________________________________\n" ;
	  alert(msg) ;
	  document.MM_returnValue = False ;	
  }

  document.cookie="save=1" ;

	msg  = "____________________________________________________\n\n" ;
	msg += "The form was not submitted because of the following error(s).\n";
	msg += "Please correct these error(s) and re-submit.\n";
	msg += "____________________________________________________\n" ;


  for (i=0; i<(args.length-2); i+=3)
 {
 test=args[i+2]; val=MM_findObj(args[i]);
    if (val)
	 {
	 nm=val.name;
	 if ((val=val.value)!="")
		 {
     		 if (test.indexOf('isEmail')!=-1)
			 {
			 p=val.indexOf('@');
        		if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain a valid e-mail address.\n';
			 }
		 else if (test!='R')
			 {
			 num = parseFloat(val);
		         if (val!==''+num) errors+='- '+nm+' must contain a number.\n';
		         if (test.indexOf('inRange') != -1)
				 {
				   p=test.indexOf(':');
			           min=test.substring(8,p);
				   max=test.substring(p+1);
			           if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
				 }
		  	 }
	 	 }
	 else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n';
 }

  }
 if (errors) {
	 alert(msg+'\n'+errors);
	 document.cookie="save=0" ;
  }
  else if (GC("mod") == 1 ) AskTechie() ;
  document.MM_returnValue = (errors == '');

}

function move(fbox, tbox) {
	var arrFbox = new Array();
	var arrTbox = new Array();
	var arrLookup = new Array();
	var i;
	for (i = 0; i < tbox.options.length; i++) {
		arrLookup[tbox.options[i].text] = tbox.options[i].value;
		arrTbox[i] = tbox.options[i].text;
	}
	var fLength = 0;
	var tLength = arrTbox.length;
	for(i = 0; i < fbox.options.length; i++) {
		arrLookup[fbox.options[i].text] = fbox.options[i].value;
		if (fbox.options[i].selected && fbox.options[i].value != "") {
			arrTbox[tLength] = fbox.options[i].text;
			tLength++;
		}
		else {
			arrFbox[fLength] = fbox.options[i].text;
			fLength++;
		}
	}
	arrFbox.sort();
	arrTbox.sort();
	fbox.length = 0;
	tbox.length = 0;
	var c;
	for(c = 0; c < arrFbox.length; c++) {
		var no = new Option();
		no.value = arrLookup[arrFbox[c]];
		no.text = arrFbox[c];
		fbox[c] = no;
	}
	for(c = 0; c < arrTbox.length; c++) {
		var no = new Option();
		no.value = arrLookup[arrTbox[c]];
		no.text = arrTbox[c];
		tbox[c] = no;
	}
	List1(); 
}

function movedocs(fbox, tbox) {
	var arrFbox = new Array();
	var arrTbox = new Array();
	var arrLookup = new Array();
	var i;
	for (i = 0; i < tbox.options.length; i++) {
		arrLookup[tbox.options[i].text] = tbox.options[i].value;
		arrTbox[i] = tbox.options[i].text;
	}
	var fLength = 0;
	var tLength = arrTbox.length;
	for(i = 0; i < fbox.options.length; i++) {
		arrLookup[fbox.options[i].text] = fbox.options[i].value;
		if (fbox.options[i].selected && fbox.options[i].value != "") {
			arrTbox[tLength] = fbox.options[i].text;
			tLength++;
		}
		else {
			arrFbox[fLength] = fbox.options[i].text;
			fLength++;
		}
	}
	arrFbox.sort();
	arrTbox.sort();
	fbox.length = 0;
	tbox.length = 0;
	var c;
	for(c = 0; c < arrFbox.length; c++) {
		var no = new Option();
		no.value = arrLookup[arrFbox[c]];
		no.text = arrFbox[c];
		fbox[c] = no;
	}
	for(c = 0; c < arrTbox.length; c++) {
		var no = new Option();
		no.value = arrLookup[arrTbox[c]];
		no.text = arrTbox[c];
		tbox[c] = no;
	}

	Listc(); 
}

function moveuser(fbox, tbox) {
	var arrFbox = new Array();
	var arrTbox = new Array();
	var arrLookup = new Array();
	var i;
	for (i = 0; i < tbox.options.length; i++) {
		arrLookup[tbox.options[i].text] = tbox.options[i].value;
		arrTbox[i] = tbox.options[i].text;
	}
	var fLength = 0;
	var tLength = arrTbox.length;
	for(i = 0; i < fbox.options.length; i++) {
		arrLookup[fbox.options[i].text] = fbox.options[i].value;
		if (fbox.options[i].selected && fbox.options[i].value != "") {
			arrTbox[tLength] = fbox.options[i].text;
			tLength++;
		}
		else {
			arrFbox[fLength] = fbox.options[i].text;
			fLength++;
		}
	}
	arrFbox.sort();
	arrTbox.sort();
	fbox.length = 0;
	tbox.length = 0;
	var c;
	for(c = 0; c < arrFbox.length; c++) {
		var no = new Option();
		no.value = arrLookup[arrFbox[c]];
		no.text = arrFbox[c];
		fbox[c] = no;
	}
	for(c = 0; c < arrTbox.length; c++) {
		var no = new Option();
		no.value = arrLookup[arrTbox[c]];
		no.text = arrTbox[c];
		tbox[c] = no;
	}

	Lista(); 
}


function Lista() {
	var list = document.Content.lista;
	var theList = ",";
	// start with a "?" to make it look like a real query-string
	for (i = 0; i <= list.options.length-1; i++) { 
		theList += list.options[i].value;
		if (i != list.options.length-1) theList += ",";
	}
	document.cookie="users=" + theList + ",";
}

function Listc() {
	var list = document.Content.listc;
	var theList = ",";
	// start with a "?" to make it look like a real query-string
	for (i = 0; i <= list.options.length-1; i++) { 
		theList += list.options[i].value;
		if (i != list.options.length-1) theList += ",";
	}
	document.cookie="docmt=" + theList + ",";
}

function List1() {
	var list = document.Content.list1;
	var theList = ",";
	// start with a "?" to make it look like a real query-string
	for (i = 0; i <= list.options.length-1; i++) { 
		theList += list.options[i].value;
		if (i != list.options.length-1) theList += ",";
	}
	document.cookie="pages=" + theList + ",";
}

function openwindowlink(x) {
	newwin = window.open(x,"windowname"," scrollbars,resizable")
}


function PublMsg() {
	x = document.Content.Publish.value

	if (x == "1" || x == "3") {
	msg  = "____________________________________________________\n\n" ;
	msg += "You do not have permission to directly post content on the site.\n";
	msg += "Please OBTAIN APPROVAL before your submission is published.\n\n";
	msg += "                YOUR CURRENT CHOICE WILL BE IGNORED!\n";	
	msg += "____________________________________________________\n" ;
	alert(msg);
	}

	if (x == "2") {
	msg  = "____________________________________________________\n\n" ;
	msg += " When this document is saved the Administrator will be alerted\n";
	msg += "                  about your intention to post it.\n\n";
	msg += "Your document will either be Published or Not Approved\n";
	msg += "This process is not automatic, please check back later.\n";
	msg += "____________________________________________________\n" ;
	alert(msg);
	}
}

function Autofresh() {
	if (intcount > 4) intcount = 1;
	if (!document.images) return;
	document.images['myCam'].src = '/_images/articles/fdVV2005Feature' + intcount++ + '_cms.jpg?' + Math.random();
	setTimeout('Autofresh()',(30000)); // refresh every n secs
}

function Autofreshec() {
	if (intcount > 11) intcount = 1;
	if (!document.images) return;
	document.images['myCam'].src = '/_images/eidulos.hardware.slides/fdVV2005Feature' + intcount++ + '_cms.jpg?' + Math.random();
	setTimeout('Autofreshec()',(30000)); // refresh every n secs
}

function MM_swapImgRestore() { //v3.0  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;}function MM_preloadImages() { //v3.0  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}}function MM_findObj(n, d) { //v4.01  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);  if(!x && d.getElementById) x=d.getElementById(n); return x;}function MM_swapImage() { //v3.0  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}}
function focus_cursor(x){
	document.forms[0].elements[x].focus();
//	document.forms[0].elements[1].focus();
}
