<!--
//***********************************************************************************************************
//# Name		JavaScript.js
//# Version		61.10
//# Modified	12/08/2003 13:01
//# Copyright Rocktime Ltd/Kieron Matthews 2000 - 2003.
//# Not to be used in whole or part without written permission from Rocktime.
//***********************************************************************************************************

//***********************************************************************************************************
// Vars
//***********************************************************************************************************
	var SubmittedOnce;
	var browser_version;
	var browser_type;
	var fdRTCCurrentDir;

//***********************************************************************************************************
// Browser Detection For Style Sheet
// Put into header tags and run as window is loaded
//***********************************************************************************************************

	SubmittedOnce = 'no';

	browser_version= parseInt(navigator.appVersion);
	browser_type = navigator.appName;

	if (browser_type == "Netscape" && (browser_version >= 4)) {
		document.write("<link REL='stylesheet' HREF='/css/ns.css' TYPE='text/css'>");
	}

//***********************************************************************************************************
// Old Versions
//***********************************************************************************************************

	function NewWindow(theURL,winname, w, h, scroll) {
		OpenNewWindow(theURL,winname, w, h, scroll, false)
	}

	function NewWindow2(theURL,winname, w, h, options) {
		OpenNewWindowCentered(theURL,winname, w, h, options, false)
	}

	function NewWindow3(theURL,winname, w, h, winl, wint, options) {
		OpenNewWindowPositioned(theURL,winname, w, h, winl, wint, options, false)
	}

//***********************************************************************************************************
// Open New Window
// called by OpenNewWindow(this.href,'name','400','400','yes', rethandel)
// rethandel = true to return window handel
//***********************************************************************************************************

	function OpenNewWindow(theURL,winname, w, h, scroll, rethandel) {
		var winl = (screen.width - w) / 2;
		var wint = (screen.height - h) / 2;
		winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',screenX='+winl+',screenY='+wint+',scrollbars='+scroll+',resizable'
		win = window.open(theURL, winname, winprops)
		if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
		if (rethandel){return win;}
	}

//***********************************************************************************************************
// Open New Window Centered
// called by OpenNewWindowCentered(this.href,'name','400','400','options-see-below', rethandel)
// options copyhistory,directories,location,menubar,resizable,scrollbars,status,toolbar [include to switch on]
//***********************************************************************************************************

	function OpenNewWindowCentered(theURL,winname, w, h, options, rethandel) {
		var winl = (screen.width - w) / 2;
		var wint = (screen.height - h) / 2;
		winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',screenX='+winl+',screenY='+wint+','+options
		win = window.open(theURL, winname, winprops)
		if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
		if (rethandel){return win;}
	}

//***********************************************************************************************************
// Open New Window Positioned
// OpenNewWindowPositioned(this.href,'name','400','400','0','0','options-see-below', rethandel)
// options copyhistory,directories,location,menubar,resizable,scrollbars,status,toolbar [include to switch on]
//***********************************************************************************************************

	function OpenNewWindowPositioned(theURL,winname, w, h, winl, wint, options, rethandel) {
		winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',screenX='+winl+',screenY='+wint+','+options
		win = window.open(theURL, winname, winprops)
		if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
		if (rethandel){return win;}
	}

//***********************************************************************************************************
// Open New Window Full Screen
// called by OpenNewWindowFullScreen('indexfull.asp','newwindow', rethandel)
//***********************************************************************************************************

	function OpenNewWindowFullScreen(theURL,winname, rethandel) {
		var attribs = "scrollbars"
		attribs += ",width=" + (screen.width-10) + ",height=" + (screen.height-30) + ",top=0,left=0,screenX=0,screenY=0";
		var newWindow = window.open(theURL, winname, attribs);
		if (rethandel){return win;}
	}

//***********************************************************************************************************
// SubmitOnce
// Allow button to be pressed only once
//***********************************************************************************************************

	function SubmitOnce(ButtonText, ButtonObject, FormObject) {
		if ( SubmittedOnce == 'no' ){
			ButtonObject.value = ButtonText;
			ButtonObject.disabled = true;
			SubmittedOnce = 'yes';
			document.forms[FormObject].submit();
		}
	}

//***********************************************************************************************************
// confirm delete
// Show confirmation dialog
//***********************************************************************************************************
	function ConfirmDelete (confirmpage) {
		temp = window.confirm('Is it OK to delete this record? \n\nNOTE : This operation is irreversible!');
		if (temp) {
			if (confirmpage == '') {
				return true;
			}
			else {
				document.location = confirmpage;
			}
		}
		if (confirmpage == '') {
			return false;
		}
	}

//***********************************************************************************************************
// confirm delete2
// Show confirmation dialog twice
//***********************************************************************************************************

	function ConfirmDelete2 (confirmpage) {
		temp = window.confirm('Is it OK to delete this record? \n\nNOTE : This operation is irreversible!');

		if (temp) {
			temp2 = window.confirm('Are you REALLY sure you want to delete this record??? \n\nNOTE : This operation REALLY IS irreversible!');
			if (temp2) {
				if (confirmpage == '') {
					return true;
				}
				else {
					document.location = confirmpage;
				}
			}
		}
		if (confirmpage == '') {
			return false;
		}
	}

//***********************************************************************************************************
// confirm delete3
// Show confirmation dialog with custom message
//***********************************************************************************************************

	function ConfirmDelete3 (confirmpage, confirmMessage) {
		temp = window.confirm(confirmMessage);

		if (temp) {
			if (confirmpage == '') {
				return true;
			}
			else {
				document.location = confirmpage;
			}
		}
		if (confirmpage == '') {
			return false;
		}
	}

//***********************************************************************************************************
// confirm delete4
// Show confirmation dialog twice with custom messages
//***********************************************************************************************************

	function ConfirmDelete4 (confirmpage, confirmMessage1, confirmMessage2) {
		temp = window.confirm(confirmMessage1);

		if (temp) {
			temp2 = window.confirm(confirmMessage2);
			if (temp2) {
				if (confirmpage == '') {
					return true;
				}
				else {
					document.location = confirmpage;
				}
			}
		}
		if (confirmpage == '') {
			return false;
		}
	}

//***********************************************************************************************************
// Rollover for tables
// Highlight on
//***********************************************************************************************************

	function changeto(highlightcolor){
		source=event.srcElement
		if (source.tagName=="TR"||source.tagName=="TABLE")
		return
		while(source.tagName!="TR")
		source=source.parentElement
		if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")
		source.style.backgroundColor=highlightcolor
	}

//***********************************************************************************************************
// Highlight off
//***********************************************************************************************************

	function changeback(originalcolor){
		if (event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")
		return
		if (event.toElement!=source)
		source.style.backgroundColor=''
	}

//***********************************************************************************************************
//Base conversions
//***********************************************************************************************************

//***********************************************************************************************************
// Base n to Dec
//***********************************************************************************************************

	var a64 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/";

	function BaseN2Dec( s, OutputBase) {
		var x = 0, i, t, TempOutputBase, TempArray, packing;
		TempOutPutBase = OutputBase + ",8";
		TempArray = TempOutPutBase.split(",");
		TempOutPutBase = TempArray[0];
		packing = TempArray[1];

		if ((TempOutPutBase < 2) || (TempOutPutBase > a64.length)){
			x = -1;
		}
		else {
			for (i = 0; i < s.length; i++) {
				t = a64.indexOf( s.charAt(i), 0 );
				if ((t >= TempOutPutBase) || (t < 0)){
					x = -1;
					break;
				}
				x = (x * TempOutPutBase) + a64.indexOf( s.charAt(i), 0 );
			}
		}
		return x;
	}

//***********************************************************************************************************
// Dec to Base n with x digits (packing=0 no fixed digits)
//***********************************************************************************************************

	function Dec2BaseN( x, OutputBase) {
		var s = "", TempOutputBase, TempArray, packing;
		var i, t;

		TempOutPutBase = OutputBase + ",8";
		TempArray = TempOutPutBase.split(",");
		TempOutPutBase = TempArray[0];
		packing = TempArray[1];

		if ((TempOutPutBase < 2) || (TempOutPutBase > a64.length)){
			s = "-1";
		}
		else {
			if (x == 0){
				s = "0";
			}
			else {
				while (x > 0) {
		            s = a64.charAt( x % TempOutPutBase) + s;
		            x = Math.floor( x / TempOutPutBase );
				}
			}
		}
		if (packing != 0) {
			for (i = s.length; i < packing; i++){
				s = "0" + s;
			}
		}
		return s;
	}

//***********************************************************************************************************
// Encrpyt String
//***********************************************************************************************************

	function EnCrypt(strCryptThis, Encryption_Key , OutputBase){

		var strChar, iKeyChar, iStringChar, i, TempOutPutBase, TempArray, packing, iCryptChar, strEncrypted, TempKeyChar;
		strEncrypted = "";
		TempOutPutBase = OutputBase + ",8";
		TempArray = TempOutPutBase.split(",");
		TempOutPutBase = TempArray[0];
		packing = TempArray[1];
		if (strCryptThis != ""){
			out = "\'";
			while (strCryptThis.indexOf(out)>-1) {
				pos= strCryptThis.indexOf(out);
				strCryptThis = "" + (strCryptThis.substring(0, pos) + strCryptThis.substring((pos + 1), strCryptThis.length));
			}
			out = "\"";
			while (strCryptThis.indexOf(out)>-1) {
				pos= strCryptThis.indexOf(out);
				strCryptThis = "" + (strCryptThis.substring(0, pos) + strCryptThis.substring((pos + 1), strCryptThis.length));
			}
			for (i = 0; i < strCryptThis.length; i++){
				TempKeyChar = Encryption_Key.substr((i*packing), packing);
				iKeyChar = BaseN2Dec(TempKeyChar, OutputBase, packing);
				iStringChar = strCryptThis.charCodeAt(i);
				iCryptChar = iStringChar + iKeyChar;
				if (iCryptChar > 255){
					iCryptChar = iCryptChar - 256;
				}
				iCryptChar = iKeyChar^iStringChar;
				strEncrypted = strEncrypted + Dec2BaseN(iCryptChar, OutputBase);
			}
		}
		return strEncrypted;
	}

//***********************************************************************************************************
// Encrpyt username and password before send
//***********************************************************************************************************

	function PreSend(User, Pass, Encryption_KeyU, Encryption_KeyP, OutputBase){

		var TempUser, TempPass;

		if (User){
			TempUser = User.value;
			TempUser = EnCrypt(TempUser, Encryption_KeyU, OutputBase);
			User.value = TempUser;
		}

		if (Pass){
			TempPass = Pass.value;
			TempPass = EnCrypt(TempPass, Encryption_KeyP, OutputBase);
			Pass.value = TempPass;
		}

		return true;
	}

//***********************************************************************************************************
// Diag
//***********************************************************************************************************

	function Diag(tempVar){
		document.UPForm.debug.value = document.UPForm.debug.value + tempVar + "\n";
	}

//***********************************************************************************************************
// Other JS includes
//***********************************************************************************************************


// -->

