<!--

	var SERVER_CONTROLLER = new Array();	

	SERVER_CONTROLLER[1] = "im.aspx?wci=imcontrol&wce=action";
	SERVER_CONTROLLER[2] = "nfupdate.aspx?wci=picformat&wce=preview";
	SERVER_CONTROLLER[3] = "newfriends.aspx?";
	SERVER_CONTROLLER[4] = "speeddating.aspx?wci=speeddatecontrol&wce=action";
	SERVER_CONTROLLER[5] = "member.aspx?wci=editprofile&wce=action";	
	SERVER_CONTROLLER[6] = "join.aspx?";
	SERVER_CONTROLLER[7] = "newfriends.aspx?wci=ExecuteRequest";
	SERVER_CONTROLLER[8] = "speeddating.aspx?wci=speeddate&wce=action";
	SERVER_CONTROLLER[9] = "member.aspx?";
	SERVER_CONTROLLER[10] = "im.aspx?";
	
	
	/**
	 * Executes a server request by patching the header request in the
	 * current document. The parameters specified will be attached to
	 * the request.
	 *
	 */

	var jsrefreshFunction = 'executeRequest(\'action=refresh\')';

	function CanDoExecuteRequest(){
		if( document.getElementById && document.childNodes && document.createElement && document.getElementsByTagName) {
			return true;
		}else{
			return false;
		}
	}

	function canexecuteRequest(){
		if( document.getElementById && document.childNodes && document.createElement ) {
			return true;
		}else{
			return false;
		}
	}

	function executeRequest(params, n) {
		
		parameters = new String(params).split(',');
		var scriptUrl = SERVER_CONTROLLER[n] + '&rnd=' + Math.random();
		for (var i = 0; i < parameters.length; i++) {
			if(parameters[i] != ''){
				scriptUrl += "&" + parameters[i];
			}
		}
		if(CanDoExecuteRequest() == true){
	
			var head = document.getElementsByTagName('head').item(0);
			var old  = document.getElementById('lastLoadedCmds');
			if (old) head.removeChild(old);

			script = document.createElement('script');

			script.src = scriptUrl + '&execreq=Y';
			script.type = 'text/javascript';
			script.defer = true;
			script.id = 'lastLoadedCmds';
			void(head.appendChild(script));
		}else{
			//browser does not support this functionality;
			//DSO
			window.top.location.href = scriptUrl;
		}

	} // > function executeRequest(...)

	/**
	 * Dynamically updates the content of a frame.
	 * 
	 */
	function update(frame, id, html, bApp) {
		
		var bAppend = false;
		if(bApp){
			bAppend = true;
		}
		//alert(frame);
		var doc = eval(frame + '.document');
		
		if (doc.layers) {
			alert('here1');
			var l = doc[id];
			alert('here2');
			l.document.open();
			l.document.write(html);
			l.document.close();
		} else if (doc.all && doc.all[id]) {
			if(bAppend){
				doc.all[id].innerHTML += html;
			}else{
				doc.all[id].innerHTML = html;
			}
		} else if (doc.createRange) {

			var l = doc.getElementById(id);
			var r = doc.createRange();

			if(!bAppend){
				while (l.hasChildNodes()) {			
					l.removeChild(l.lastChild);
				}
				r.setStartAfter(l);
				
			}
			try
			{
			var docFrag = r.createContextualFragment(html);
			l.appendChild(docFrag);
			}
			catch (e)
			{
			/*	alert(e.description);
				alert(html);*/
				if (bAppend)
				{
					l.innerHTML += (html);
				}else{
					l.innerHTML = (html);
				}
			}
		}
	} // > function update(...)

	function updatevar(frame, id, v) {

		eval(frame + '.' + 'doswitch(\'' + v + '\')');
		return;		

	var ovar = eval(frame + '.' + id);
	alert(ovar + ' - ' + v);
		ovar = v;
	alert(ovar + ' = ' + v);	
	}

	function updateLastMessage(html) {
		update('top.fmeimmain', 'lastmessage', html);
	}

	function updateOptions(id, html) {
		update('top.fmeimmain', id, html);
	}

	function updateIcon(id, html) {
		update('self', id, html);
	}

	function updateControl(id, html) {
		update('parent.fmecontrolmain', id, html);
	}
	
	function updateMessages(html, append) {
		update('top.fmeimmain.messageiframe', 'messages', html, append);
	}

	function updateSpeedDateMessages(id, html) {
		update('top.fmecontrolmain.messageiframe', id, html);upda
	}
	
	
	function updatePrivateMessages(id, html) {
		update('parent.messages', id, html);
	}

	function updateInvites(id, html) {
		update('parent.messages', id, html);
	}	

	function updateUsers(id, html) {
		update('parent.users', id, html);
		onUsersChanged(undefined);
	}
	
	function updateRooms(id, html) {
		update('parent.rooms', id, html);
	}

	function updateInviteList(id, html) {
		update('parent.messages', id, html);
	}		
	
	function updateRoomsPrivate(id, html) {
		update('parent.roomsprivate', id, html);
	}
	
	function updatelobbymembers(id, html) {

		update('self', id, html);
		
	}
	
	function onUsersChanged(data) {
		if (typeof data == 'undefined')
			return;
		
		if ((typeof parent.message != 'undefined') && (typeof parent.message.onUsersChanged != 'undefined'))
			parent.message.onUsersChanged(data);
	}
	
	function focusMessageArea() {
		if ((typeof parent.message != 'undefined') && (typeof parent.message.frmControl != 'undefined') && (typeof parent.message.frmControl.message != 'undefined')) {
			
			parent.message.focus();
			
			parent.message.frmControl.message.focus();
		}
	}
	
	function scrollToBottom(fme,bottom) {
		
		var doc = top.fmeimmain.messageiframe.document;
		var wnd = top.fmeimmain.messageiframe;

		var y = doc.height ? doc.height : doc.body.scrollHeight;
		
		wnd.scrollTo(
			0, 
			((bottom == 'true') ? y : 0)
		);
	}
	
	function updateLastMessageKey(nVal){
     	LastMsgKey = nVal;			
		return;
	}

	function setMessageFocus(){
		var oMsg = top.fmeimmain.frmControl.document.getElementById('messagebox');
		if (oMsg){
			oMsg.focus();
		}	
	}
	
// -->


