<!--
//***********************************************************************************************************
//# Name		JavaScript.js
//# Version		52.00
//# Modified	18/02/2003 14:51
//***********************************************************************************************************

//***********************************************************************************************************
// 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='" + VirtualDir + "/css/ns.css' TYPE='text/css'>");
	}

//***********************************************************************************************************
// Pop up centered window
// called by :<a href="http://www.yahoo.com/" onclick="NewWindow(this.href,'name','400','400','yes');return false;">Popup Yahoo.com</a>
//***********************************************************************************************************

	function NewWindow(theURL,winname, w, h, scroll) {
		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(); }
	}

//***********************************************************************************************************
// Pop up centered window as above but with options
// called by :<a href="http://www.yahoo.com/" onclick="NewWindow(this.href,'name','400','400','options-see-below');return false;">Popup Yahoo.com</a>
// options copyhistory,directories,location,menubar,resizable,scrollbars,status,toolbar [include to switch on]
//***********************************************************************************************************

	function NewWindow2(theURL,winname, w, h, options) {
		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(); }
	}

//***********************************************************************************************************
// Pop up positioned window
// called by :<a href="http://www.yahoo.com/" onclick="NewWindow(this.href,'name','400','400','0','0','options-see-below');return false;">Popup Yahoo.com</a>
// options copyhistory,directories,location,menubar,resizable,scrollbars,status,toolbar [include to switch on]
//***********************************************************************************************************

	function NewWindow3(theURL,winname, w, h, winl, wint, options) {
		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(); }
	}

//***********************************************************************************************************
// fullscreen
// called by onload="fullScreen('indexfull.asp','newwindow');"
//***********************************************************************************************************

	function fullScreen(theURL,winname) {
		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);
	}

//***********************************************************************************************************
// 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 != ""){
//				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;

		TempUser = User.value;
		TempPass = Pass.value;

		TempUser = EnCrypt(TempUser, Encryption_KeyU, OutputBase);
		TempPass = EnCrypt(TempPass, Encryption_KeyP, OutputBase);

		User.value = TempUser;
		Pass.value = TempPass;
		return true;
	}

//***********************************************************************************************************
// Diag
//***********************************************************************************************************

	function Diag(tempVar){
		document.UPForm.debug.value = document.UPForm.debug.value + tempVar + "\n";
	}



// -->
