﻿<!--
function newXmlHttp(){
	var xmlhttp = false;
	try{
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}catch(e){
		try{
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}catch(e){
			xmlhttp = false;
		}
	}
	
	if(!xmlhttp && document.createElement){
		xmlhttp = new XMLHttpRequest();
	}
	
	return xmlhttp;
}

function xAgentLogin()
	{
	var url="/script_agent.cfm?n";
	xmlhttp = newXmlHttp();
	xmlhttp.open("GET",url,false);
	xmlhttp.send(null);

	return xmlhttp.responseText;
}

function AgentClickLogOut(){
	if(confirm('Would you like to logout ?')){
		location.href='agent_logout.cfm';
	}
}

function Trim(TRIM_VALUE){
	if(TRIM_VALUE.length < 1){
	  return"";
	}
	TRIM_VALUE = RTrim(TRIM_VALUE);
	TRIM_VALUE = LTrim(TRIM_VALUE);
	if(TRIM_VALUE==""){
	  return "";
	}
	else{
	  return TRIM_VALUE;
	}
}

function RTrim(VALUE){
	var w_space = String.fromCharCode(32);
	var v_length = VALUE.length;
	var strTemp = "";
	if(v_length < 0){
	  return"";
	}
	var iTemp = v_length -1;
	
	while(iTemp > -1){
	  if(VALUE.charAt(iTemp) == w_space){
	  }
	  else{
		strTemp = VALUE.substring(0,iTemp +1);
		break;
			 }
	  iTemp = iTemp-1;
	} //End While
		   return replaceAll(replaceAll(strTemp, '\t', ''), '\r\n', '');
} //End Function
  
function LTrim(VALUE){
	var w_space = String.fromCharCode(32);
	if(v_length < 1){
	return"";
	}
	var v_length = VALUE.length;
	var strTemp = "";
	
	var iTemp = 0;
	
	while(iTemp < v_length){
	  if(VALUE.charAt(iTemp) == w_space){
	  }
	  else{
		strTemp = VALUE.substring(iTemp,v_length);
		break;
	  }
	  iTemp = iTemp + 1;
	} //End While
	return replaceAll(replaceAll(strTemp, '\t', ''), '\r\n', '');;
} //End Function

function replaceAll( str, from, to ){
	var idx = str.indexOf( from );
	while ( idx > -1 ) {
		str = str.replace( from, to ); 
		idx = str.indexOf( from );
	}
	return str;
}

var return_value = Trim(xAgentLogin());
document.write(return_value);
//-->
