try {
    document.execCommand("BackgroundImageCache", false, true);
} catch(e) {}
window.document.overflowX = "hidden";
var fs=false;
var myMap=null;
/*** proxy connection ***/
var myPxyServer = "";
var myPxyPort = "";
var myPxyPath = "AAPIProxy.swf";
/*** servers connection ***/
var mqMapServer = "map.aol.mapquest.com";
var mqGcServer = "geocode.aol.mapquest.com";
var mqRtServer = "route.aol.mapquest.com";
var mqSptServer = "spatial.aol.mapquest.com";
var port = "80";
var mqPath = "mq";
/*** global variables ***/
var sPoint;
var mapdir = false;
var sug = false;
var sugBox = false;
var boxId='';
var divId='';
var ch_id='maps_single';
var adrses = new MQLocationCollectionCollection();
var ptype = "Index";
var strInput = '';
var sessionId = null;
var myBoundingBox = new MQRectLL(new MQLatLng(),new MQLatLng());
var mmBB = new MQRectLL(new MQLatLng(),new MQLatLng());
var latLongMm = new MQLatLngCollection();
var latLongMms = new MQLatLngCollection();
var latLongMme = new MQLatLngCollection();
var myRtColl = new MQLocationCollection("MQGeoAddress");
var indexes = new Array(0,0);
var addrStart = new Array();
var addrEnd = new Array();
var revAddrStart = new Array();
var revAddrEnd = new Array();
var mmap = 0;
var miniMap = null;
var desInd=0;
var xmlHttp=null;
var sLatLong = new MQLatLngCollection();
var eLatLong = new MQLatLngCollection();
var psLatLong = new MQLatLng();
var peLatLong = new MQLatLng();
var myRes = new MQRouteResults();
var pstr = '';
var dstr = '';
var strFrom="";
var strTo="";
var totStr=new Array();
var iti=false;
var origin = new MQLatLng();
var zoom =0;
var dstate=false;
var wasRoute = false;
var wasMap = 0;
var reve = false;
var titleLine='';
var defCountry='';
var myTrkStr = '';
eventId=null;
var tlstr = '';
var actcountry='';
var actaddr = new Array();

var startState = new MQMapState();
var revMapState = new MQMapState();
var actMapState = new MQMapState();
var revRouteState = new MQMapState();
var revZoom = 2;
var revId = null;
var stzoom = 2;
var actzoom = 2;
var mapzoom = 2;
var revzoom = 2;

var myAddressColl = new MQLocationCollection();
var revAddressColl = new MQLocationCollection();
var itiBack = false;

var rimg = document.createElement("img");

/*******************/
var c = true;
var usStates = new Array('Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California',
	'Colorado', 'Connecticut', 'Delaware', 'District of Columbia', 'Florida', 
	'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas',
	'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan',
	'Minnesota', 'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada',
	'New Hampshire', 'New Jersey', 'New Mexico', 'New York', 'North Carolina',
	'North Dakota', 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Puerto Rico',
	'Rhode Island', 'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah',
	'Vermont', 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming');
var usStatesAbr = new Array('AL', 'AK', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'DC', 'FL', 'GA', 'HI', 'ID', 'IL', 'IN', 'IA', 'KS',
	'KY', 'LA', 'ME', 'MD', 'MA', 'MI',	'MN', 'MS', 'MO', 'MT', 'NE', 'NV',	'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'OH', 'OK', 'OR', 'PA', 'PR',
	'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI', 'WY');


/******************************************************************** start new map on load *******************************************************/

function start_geo_map()
{
    var geoExec = new MQExec(mqGcServer, mqPath, port, myPxyServer, myPxyPath, myPxyPort);
	var gaCollection = new MQLocationCollection("MQGeoAddress");
	var gAddress = new MQAddress(); 
	defCountry = get_country('country');
	gAddress.setCountry(defCountry);
	
	geoExec.geocode(gAddress, gaCollection, new MQAutoGeocodeCovSwitch(),on_gc_end_geo);
}
function on_gc_end_geo(GcRetLocColl)
{
	
	myMap = new MQTileMap(document.getElementById('image_map_src'),2,GcRetLocColl.get(0).getMQLatLng(),"map");
	myMap.setSize(new MQSize(705,440));
	myPoint = new MQPoi(GcRetLocColl.get(0).getMQLatLng());
	myPoint.setInfoTitleHTML(get_country('country'));
	origin = GcRetLocColl.get(0).getMQLatLng();
	zoom=2;
	myMap.setCenter(origin,zoom);
	myMap.addPoi(myPoint);
	
	var rctrl = new icq_revert();
	myMap.addControl(rctrl, new MQMapCornerPlacement(MQMapCorner.TOP_LEFT, new MQSize(15,325)));
	
	myLZControl = new MQLargeZoomControl(myMap);
    myMap.addControl(myLZControl, new MQMapCornerPlacement(MQMapCorner.TOP_LEFT, new MQSize(5,15)));
    myVControl = new MQViewControl(myMap);
    myMap.addControl(myVControl, new MQMapCornerPlacement(MQMapCorner.TOP_RIGHT, new MQSize(0,0)));
	usa_prop('country', 'state', 'mstate');
	close_obj('preload');
	startState.setCenter(myMap.getCenter());
	actMapState.setCenter(myMap.getCenter());
	if(tb)
		do_geocode();
	if(sline)
	{
		document.getElementById('search_keyword').value=keyw;
		line_geo();
	}	
}


/****************************************************************** end on load map ***************************************************************/
/***************************************************************** start geocoding function ********************************************************/
function do_geocode() 
{
	tb=false;
    geoExec = new MQExec(mqGcServer, mqPath, port, myPxyServer, myPxyPath, myPxyPort);
	var st = "";
    var address = new MQAddress();
	var gaCollection = new MQLocationCollection("MQGeoAddress");
	var count = get_country('country');	
	revMapState.setCenter(myMap.getCenter());
	revZoom = myMap.getZoomLevel();
	ch_id='maps_single';
	address.setStreet(document.getElementById("street").value);
	address.setCity(document.getElementById("city").value);
	address.setState(document.getElementById("state").value);
	address.setPostalCode(document.getElementById("postalcode").value);
	address.setCountry(count);
	document.getElementById('resultsDiv').style.display = "none";
	//myMap.removeAllPois();
	myMap.removeRouteHighlight();
	document.getElementById('preload').style.display = "block";
	fs=true;
	document.getElementById('map_header').innerHTML = document.getElementById('lg').value=="English"?"Search results for ":"Suchergebnisse fur ";
	geoExec.geocode(address, gaCollection, new MQAutoGeocodeCovSwitch(),on_gc_end);
	
}
function close_box()
{
	document.getElementById('sugDiv').style.display = "none";
	document.getElementById('sugDivSide').style.display = "none";
}
function on_gc_end(GcRetLocColl)
{
	mapdir=false;
	var str = new Array;
	
	var collSize = GcRetLocColl.getSize();
	var succeed=true;
	var s = false;
	wasMap++;
	ptype = "Result";
	setOmni();
	var i=0;
	var g=0;
	if(itiBack){
		collSize=1;
		g=indexes[1];
	}

	itiBack=false;
	if(collSize>1)
	{
		adrses = new MQLocationCollectionCollection();
		for(i;i<collSize;i++)
		{
			geoAddr = GcRetLocColl.get(i);
			str[i] = '<div style="float:left;width:15px;">'+(i+1)+'.</div><a id="a_'+i+'" href="javascript:get_i(' + i + ');close_box();close_obj(\'d0\');">';
			if(geoAddr.getStreet()){
				str[i] += GcRetLocColl.get(i).getStreet()+'</a>';
				s=true;
			} else if(geoAddr.getCity()){
				if(!s)
					str[i] += geoAddr.getCity() + '</a>';
				else
					str[i] += '<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+geoAddr.getCity()+'</a>';
				
				zoom = 9;}
			if(geoAddr.getState()){
					str[i] += ',&nbsp;' + geoAddr.getState();
				zoom = 9;}
			if(geoAddr.getCounty()){
				if(!s)
					str[i] += '<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + geoAddr.getCounty();
				else
					str[i] += ', ' + geoAddr.getCounty();
				zoom = 9;}
			if(geoAddr.getPostalCode()){
				str[i] += (!geoAddr.getCity()?'':',&nbsp;') + geoAddr.getPostalCode() + (!geoAddr.getCity()?'</a>':'');
				zoom = 9;}
			
			

			adrses.add(geoAddr);
			str[i] += '<br>';
			sug = true;
		}
		
		suggession_box(false, 'a', str, sugBox);
		var dh = document.getElementById("txtSide").height;
		height = parseInt(dh);
		sugBox=false;

	}
	else
	{
		geoAddr = GcRetLocColl.get(g);
			if(sugBox&&!c&&geoAddr.getCity()==''){
				set_country('country', actcountry);
				document.getElementById('street').value=actaddr[0];
				document.getElementById('city').value=actaddr[1];
				document.getElementById('state').value=actaddr[2];
				document.getElementById('postalcode').value=actaddr[3];
				suggession_box(true, 'c', '', sugBox);
				
				sugBox=false;
			}
			else if(document.getElementById('city').value!=''&&geoAddr.getCity()=='')//||document.getElementById('city').value.toUpperCase()!=geoAddr.getCity().toUpperCase()&&c)
			{
				clear_all(true);
				//set_country('country', actcountry);
				//document.getElementById('street').value=actaddr[0];
				//document.getElementById('city').value=actaddr[1];
				//document.getElementById('state').value=actaddr[2];
				//document.getElementById('postalcode').value=actaddr[3];
				suggession_box(true, 'b', '', sugBox);
				sugBox=false;
			}
			else
			{
				close_obj('preload');
				myMap.removeAllPois();
				tlstr = '';
				origin = GcRetLocColl.get(g).getMQLatLng();
				myPoint = new MQPoi(origin);
				myPoint.setInfoTitleHTML(geoAddr.getState()?(get_country('country')+", "+geoAddr.getCity()+", "+geoAddr.getState()):(geoAddr.getCity()?(get_country('country')+", "+geoAddr.getCity()):get_country('country')));
				myPoint.setInfoContentHTML('<div style="width:200px;"><hr>'+(geoAddr.getStreet()?geoAddr.getCity()+', '+geoAddr.getStreet():geoAddr.getCity())+(geoAddr.getPostalCode()?', '+geoAddr.getPostalCode()+'</div>':'</div>'));
				myMap.addPoi(myPoint);
				geoAddr.getStreet()?zoom = 14:zoom=9;
				geoAddr.getCity()?zoom=9:zoom=2;
				myMap.setCenter(origin,zoom);
				if(geoAddr.getStreet())
					tlstr = geoAddr.getStreet();
				if(geoAddr.getCity()){
					tlstr==''?'':tlstr+=', ';
					tlstr += geoAddr.getCity();
					document.getElementById('city').value = geoAddr.getCity();
				}
				tlstr==''?'':tlstr+=', ';
				tlstr += get_country('country');
				document.getElementById('search_keyword').value = tlstr;
				if(get_country('country')=='United States'&&geoAddr.getState()){
						document.getElementById('state').value=geoAddr.getState();
				}
				document.getElementById('cont_header').innerHTML = tlstr;
				usa_prop('country', 'state', 'mstate');
				actMapState.setCenter(myMap.getCenter());
				getKeyword();
				offers_on(false);
				sugBox=false;
				mapzoom = myMap.getZoomLevel();
			}
			
	}
	actMapState.setCenter(myMap.getCenter());
}
/***************************************************************** end geocoding function ************************************************************/
/************************************************************* start geocode from top search line ****************************************************/
function line_geo()
{
	
	sugBox = true;
	if(mapdir)
		map_on();
	if(document.getElementById('search_keyword').value==""){
		suggession_box(true, 'e', '', sugBox);
	}
	else
	{
		var str = document.getElementById('search_keyword').value;
		var sLine = document.getElementById('search_keyword').value.split(", ");
		var len1 = document.getElementById('country').length;
		var len2 = sLine.length;
		var flag = false;
		actcountry = get_country('country');
		actaddr[0]=document.getElementById('street').value;
		actaddr[1]=document.getElementById('city').value;
		actaddr[2]=document.getElementById('state').value;
		actaddr[3]=document.getElementById('postalcode').value;
		clear_all(true);
		if(sLine[len2-1].toUpperCase()=='US'||sLine[len2-1].toUpperCase()=='USA'){
				sLine[len2-1]='United States';
				document.getElementById('s-line').innerHTML=sstr_usa;}
		else document.getElementById('s-line').innerHTML=sstr;
		for(var i=0; i<len1; i++)
		{
			if(document.getElementById('country')[i].text.toUpperCase()==sLine[len2-1].toUpperCase()){
				document.getElementById('country').selectedIndex = i;
				c=true;
				break;
			}
			else if(i==(len1-1)){
				str += ', '+defCountry;
				c=false;
				document.getElementById('search_keyword').value = str;
				sLine = document.getElementById('search_keyword').value.split(", ");
				len2 = sLine.length;
				set_country('country', defCountry);
				
			}
		}
		if(len2>1){
			for(var j=0; j<usStatesAbr.length; j++)
			{
				if(get_country('country')=="United States"&&(sLine[len2-2]==usStatesAbr[j]||sLine[len2-2]==usStates[j])){
					document.getElementById('state').value = usStatesAbr[j];
				}
			}
			if(j<usStatesAbr.length-1){
				if(len2>3)
					document.getElementById('address').value=sLine[len2-4];
				document.getElementById('city').value = sLine[len2-3];
			}
			else{
				if(len2>2)
					document.getElementById('street').value=sLine[len2-3];
				document.getElementById('city').value=sLine[len2-2];
			}
		}
		do_geocode();
	}
	
}
/************************************************************* end geocode from top search line ****************************************************/
/************************************************************* start print function ***************************************************************/
function print_this_map()
{
	document.ptr_form.ptype.value=ptype;
	document.ptr_form.center.value=myMap.getCenter();
	document.ptr_form.frompoi.value=psLatLong;
	document.ptr_form.topoi.value=peLatLong;
	document.ptr_form.sfrompoi.value=sLatLong.get(0);
	document.ptr_form.etopoi.value=eLatLong.get(eLatLong.getSize()-1);
	document.ptr_form.zoom.value=myMap.getZoomLevel();
	document.ptr_form.sessid.value = sessionId;
	document.ptr_form.title.value=document.getElementById('cont_header').innerHTML==''?defCountry:document.getElementById('cont_header').innerHTML;
	document.ptr_form.total.value=totStr[0]+"&nbsp;|&nbsp;"+totStr[1];
	document.ptr_form.route.value=document.getElementById('s2-i').innerHTML;
	document.ptr_form.id.value=mapdir;
	document.ptr_form.target = "_blank";
	document.ptr_form.submit();
}
/************************************************************* end print fnction ******************************************************************/
/********************************************* define country selected *********************************************************************************/
function get_country(id)
{
	var i = document.getElementById(id).selectedIndex;
	var coun = document.getElementById(id)[i].text;
	return coun;
}
function set_country(id, con_name)
{
	for(var i=0; i<document.getElementById(id).length;i++)
	{
		if(document.getElementById(id)[i].text==con_name)
		{
			document.getElementById(id).selectedIndex=i;
			break;
		}
	}
	if(i==document.getElementById(id).length)
		return false;
	else
		return true;
}
/******************************************* end of defining country **********************************************************************************/
/******************************************************* adding search address into search line *********************************************************/
function s_text()
{
	var txt = "";
	if(document.getElementById("street").value!="")
	{
		txt = document.getElementById("street").value;
	}
	if(document.getElementById("city").value!="")
	{
		if(txt!="")
			txt +=", ";
		txt += document.getElementById("city").value;
	}
	if(get_country('state')!="")
	{
		if(txt!="")
			txt +=", ";
		txt += document.getElementById("state").value;
	}
		if(txt!="")
			txt +=", ";
		txt += get_country('country');	
	document.getElementById('search_keyword').value = txt;
}
/****************************************** end adding address into search line *************************************************************************/
/****************************************** start sugessions box **************************************************************************************/
function get_i(ind)
{
	myMap.removeAllPois();
	tlstr='';
	origin = adrses.get(ind).getMQLatLng();
	geoAddr = adrses.get(ind);
	myPoint = new MQPoi(origin);
	myPoint.setInfoTitleHTML(geoAddr.getState()?(get_country('country')+", "+geoAddr.getCity()+", "+geoAddr.getState()):(geoAddr.getCity()?(get_country('country')+", "+geoAddr.getCity()+", "+geoAddr.getState()):get_country('country')+', '+geoAddr.getState()));
	myPoint.setInfoContentHTML('<div style="width:200px;"><hr>'+(geoAddr.getStreet()?geoAddr.getCity()+', '+geoAddr.getStreet():geoAddr.getCity())+(geoAddr.getPostalCode()?', '+geoAddr.getPostalCode()+'</div>':'</div>'));
	if(myMap==null)start_geo_map();
	myMap.addPoi(myPoint);
	myMap.setCenter(origin,zoom);
	document.getElementById('preload').style.display = "none";
	sugBox=false;
	if(geoAddr.getState()&&get_country('country')=='United States')
		document.getElementById('state').value=geoAddr.getState();
	if(geoAddr.getPostalCode())
		document.getElementById('postalcode').value=geoAddr.getPostalCode();
	if(geoAddr.getStreet())
		tlstr = geoAddr.getStreet();
	if(geoAddr.getCity()){
		tlstr==''?'':tlstr+=', ';
		tlstr += geoAddr.getCity();
		document.getElementById('city').value = geoAddr.getCity();
	}
	tlstr==''?'':tlstr+=', ';
	tlstr += get_country('country');
	document.getElementById('search_keyword').value = tlstr;
	if(get_country('country')=='United States'&&geoAddr.getState()){
		document.getElementById('state').value=geoAddr.getState();
	}
	document.getElementById('cont_header').innerHTML = tlstr;	
	actMapState.setCenter(myMap.getCenter());
	getKeyword();
	offers_on(false);
	sugBox=false;
	mapzoom = myMap.getZoomLevel();
}
/******************************************* end sugessions box ****************************************************************************************/
/******************************************* start usa properties **************************************************************************************/
function usa_prop(o_id, f_id, t_id)
{
	if(get_country(o_id)=='United States')
		document.getElementById('s-line').innerHTML=sstr_usa;
	else
		document.getElementById('s-line').innerHTML=sstr;
	
	if(get_country(o_id)!='United States'){
		document.getElementById(f_id).disabled=true;
		document.getElementById(t_id).style.color="#9b9999";}
	else{
		document.getElementById(f_id).disabled=false;
		document.getElementById(t_id).style.color="#444444";}
}
/******************************************* end usa properties *****************************************************************************************/
/******************************************* start clear fields ******************************************************************************************/
function clear_all(sb)
{
	if(!sb)clear_line();
	if(ptype != "Index"){
		
		document.getElementById('city').value="";
		document.getElementById('street').value="";
		document.getElementById('postalcode').value="";
		document.getElementById('state').value="";
		sug = false;
	}
	usa_prop('country', 'state', 'mstate');
}
/********************************************** end clear fields ****************************************************************************************/
/***************************************************** add data into route form *************************************************************************/
function change_rform()
{
	for (var x=7;x<16;x++){
		if(x==11)x++;
		document.getElementById('in_'+x).value="";
	}
	document.getElementById('dest_country').selectedIndex = document.getElementById('orig_country').selectedIndex;
	usa_prop('orig_country', 'in_9', 'from_in_9');
	usa_prop('dest_country', 'in_14', 'to_in_14');
}
function change_toform()
{
	usa_prop('dest_country', 'in_14', 'to_in_14');
}
/************************************************** end adding data into route form **********************************************************************/
/*********************************************** map search form on ************************************************************************************/
function map_on()
{
	if(mapdir){
		revRouteState.setCenter(myMap.getCenter());
		revzoom = myMap.getZoomLevel();
	}
	document.getElementById('s1-3').style.display="none";
	document.getElementById('s1-2').style.display="block";
	document.getElementById('dir_header').style.display = "none";
	document.getElementById('map_header').style.display = "block";
	
	
	document.getElementById('mapTab').style.cssText = "height:26px; line-height:26px; color:#ffffff; text-decoration:none;border-top:none; background-color:#87bac4;cursor:auto;";
	document.getElementById('routeTab').style.cssText = "height:21px; line-height:21px; color:#3e90a0; text-decoration:none;border-top:3px solid #ffffff; background-color:#e4f3f6;cursor: pointer;";
	document.getElementById('itinTab').style.cssText = "height:21px; line-height:21px; color:#3e90a0; text-decoration:none;border-top:3px solid #ffffff; background-color:#e4f3f6;cursor: pointer;";
	if(!iti){
		document.getElementById('itinTab').style.color="#B8C2C4";
	}
	document.getElementById('s2-m').style.display = 'block';
	document.getElementById('s2').style.display = 'none';
	document.getElementById('s2-i').style.display = 'none';
	usa_prop('country', 'state', 'mstate');
	mapdir = false;
	document.getElementById('cont_header').innerHTML = (fs?tlstr:'');
	
	if(wasMap>0){
		do_map_state(actMapState, zoom);
	}
	else
	{
		
		if(iti)
		{
			set_country('country', get_country('dest_country'));
			document.getElementById('street').value = document.getElementById('in_12').value;
			document.getElementById('city').value = document.getElementById('in_13').value;
			document.getElementById('postalcode').value = document.getElementById('in_15').value;
			document.getElementById('state').value = document.getElementById('in_14').value;
			itiBack = true;
			do_geocode();
		}
		else{
			do_map_state(startState, stzoom);
		}
	}
}
/************************************************** end map search form on ****************************************************************************/
/*************************************************** route form on ***********************************************************************************/
function route_on()
{
	//document.getElementById('revert').onclick = function(){do_revert(0);}
	if(!mapdir){zoom = myMap.getZoomLevel();actMapState.setCenter(myMap.getCenter());}
	//else actzoom = myMap.getZoomLevel();
	document.getElementById('s1-3').style.display="none";
	document.getElementById('s1-2').style.display="block";
	document.getElementById('map_header').style.display = "none";
	document.getElementById('dir_header').style.display = "block";
	
	document.getElementById('mapTab').style.cssText = "height:21px; line-height:21px; color:#3e90a0; text-decoration:none;border-top:3px solid #ffffff; background-color:#e4f3f6;cursor: pointer;";
	document.getElementById('routeTab').style.cssText = "height:26px; line-height:26px; color:#ffffff; text-decoration:none;border-top:none;background-color:#87bac4;cursor:auto;";
	document.getElementById('itinTab').style.cssText = "height:21px; line-height:21px; color:#3e90a0; text-decoration:none;border-top:3px solid #ffffff; background-color:#e4f3f6;cursor: pointer;";
	if(!iti){
		do_map_state(startState, stzoom);
		document.getElementById('itinTab').style.color="#B8C2C4";
		if(set_country('dest_country', get_country('country'))){
		document.getElementById('in_12').value = document.getElementById('street').value;
		document.getElementById('in_13').value = document.getElementById('city').value;
		document.getElementById('in_15').value = document.getElementById('postalcode').value;
		document.getElementById('in_14').value = document.getElementById('state').value;}
	}
	else{
		if(!mapdir){
		myMap.removeAllPois();
		myMap.restoreState();
		myMap.addRouteHighlight(mmBB, "http://map.access.mapquest.com", sessionId, true);
		myMap.setCenter(revRouteState.getCenter());
		myMap.setZoomLevel(revzoom);
		add_point("a1.png", sLatLong.get(0), addrStart, myMap, 39, 39);
		add_point("b1.png", eLatLong.get(eLatLong.getSize()-1), eLatLong.get(eLatLong.getSize()-1), myMap, 39, 39);
		myMap.addRouteHighlight(myBoundingBox, "http://map.access.mapquest.com", sessionId, false);
		/*myBoundingBox = new MQRectLL(sLatLong.get(0),myRtColl.get(1).getMQLatLng());
		myMap.addRouteHighlight(myBoundingBox, "http://map.access.mapquest.com", sessionId, false);
		if(myMap.getZoomLevel()!=revzoom)
		{
			myMap.setCenter(revRouteState.getCenter());
			myMap.setZoomLevel(revzoom);
		}*/
		}
	}
	document.getElementById('s2').style.display = 'block';
	document.getElementById('s2-m').style.display = 'none';
	document.getElementById('s2-i').style.display = 'none';
	document.getElementById('search_keyword').value = "";
	
	document.getElementById('cont_header').innerHTML = titleLine;
	mapdir = true;
	document.getElementById("mainDiv").style.height=screen.availHeight;
	usa_prop('orig_country', 'in_9', 'from_in_9');
	usa_prop('dest_country', 'in_14', 'to_in_14');
}
/********************************************************** end route form on *****************************************************************************/
/********************************************************** itinerary on **********************************************************************************/
function itinerary_on(val)
{
	if(!mapdir){zoom = myMap.getZoomLevel();actMapState.setCenter(myMap.getCenter());mapdir=true;
		add_point("a1.png", sLatLong.get(0), addrStart, myMap, 39, 39);
		add_point("b1.png", eLatLong.get(eLatLong.getSize()-1), addrEnd, myMap, 39, 39);
		myMap.addRouteHighlight(mmBB, "http://map.access.mapquest.com", sessionId, true);
		myMap.setCenter(revRouteState.getCenter());
		myMap.setZoomLevel(revzoom);
		myMap.addRouteHighlight(myBoundingBox, "http://map.access.mapquest.com", sessionId, false);}
	else actzoom = myMap.getZoomLevel();
	if(val){
		document.getElementById('s1-2').style.display="none";
		document.getElementById('s1-3').style.display="block";
		document.getElementById('map_header').style.display = "none";
		document.getElementById('dir_header').style.display = "block";
	
		document.getElementById('mapTab').style.cssText = "height:21px; line-height:21px; color:#3e90a0; text-decoration:none;border-top:3px solid #ffffff; background-color:#e4f3f6;cursor: pointer;";
		document.getElementById('itinTab').style.cssText = "height:26px; line-height:26px; color:#ffffff; text-decoration:none; border-top:none; background-color:#87bac4;cursor:auto;";
		document.getElementById('routeTab').style.cssText = "height:21px; line-height:21px; color:#3e90a0; text-decoration:none;border-top:3px solid #ffffff; background-color:#e4f3f6;cursor: pointer;";
		
		document.getElementById('s2').style.display = 'none';
		document.getElementById('s2-m').style.display = 'none';
		document.getElementById('s2-i').style.display = 'block';
		document.getElementById("mainDiv").style.height=screen.height;
		document.getElementById('cont_header').innerHTML = titleLine;
		
		iti=true;
	}
}
/********************************************************** end itinerary on ******************************************************************************/
/********************************************************** start page name change ************************************************************************/
function get_page_name()
{
	if(mapdir)
		document.getElementById('tp').value = "Direction Result";
	else
		document.getElementById('tp').value = "Result";
}
/********************************************************* end page name change ***************************************************************************/
/****************************************************** start close function ********************************************************************************/
function close_obj(divId)
{
	document.getElementById(divId).style.display = "none";
}
////////////////////////////////////////////////////////////////////////////////////
function fix_ie6(obj, h, w){
	if(navigator.appName == "Microsoft Internet Explorer"){
			if(navigator.userAgent.indexOf('MSIE 6')>0){
				if(obj.src){
					var span = document.createElement("span");
					if(obj.id)
						span.id = obj.id;
					if(obj.className)
						span.className = obj.className;
					if(obj.title)
						span.title = obj.title;
					if(obj.style.cssText)
						span.style.cssText = obj.style.cssText;
					span.style.display = "inline-block";
					span.style.width = w;
					span.style.height = h;
					if(obj.left)span.style.left = obj.left;
					if(obj.right)span.style.right = obj.right;
					if(obj.top)span.style.top = obj.top;
					if(obj.bottom)span.style.bottom = boj.bottom;
					span.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'" + obj.src + "\', sizingMethod='scale')"; 
					return span;
				}
				else {
					var bkgrndImg = obj.style.backgroundImage;
					if(bkgrndImg){
						bkgrndImg = bkgrndImg.substring(4, bkgrndImg.length - 1);
						obj.style.backgroundImage = "";
						obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'" + bkgrndImg + "\', sizingMethod='scale')"; 
					}
				}
				
			}
		}
		return obj;
}
function suggession_box(alrt, title, string, box)
{
	boxId=box?"txt":"txtSide";
	divId=box?"sugDiv":"sugDivSide";
	document.getElementById('sugDiv').innerHTML = '<div class="h1-5t" id="txt"></div>';
	document.getElementById('sugDivSide').innerHTML = '<div class="h1-5t" id="txtSide"></div>';
	var left = 15;
	var rstr = "";
	var tstr = "";
	var list = "";
	for(var stl=0; stl<string.length; stl++)
	{
		list +=string[stl];
	}
	var sprite = alrt?"http://c.icq.com/maps/img/box.png":"http://c.icq.com/maps/img/box-b.png";
	var top = box?12:0;
	var bleft = box?0:12;
	var width = alrt?250:195;
	document.getElementById("sugDiv").style.cssText=alrt?"width:250px;":"width:195px;";
	document.getElementById("sugDivSide").style.cssText = alrt?"width:256px":"width:211px";
	/*** main box ***/
	this.box = document.createElement("div");
	this.box.style.position = "relative";
	this.box.display = "block";
	this.box.style.cssText = "height:auto;";
	this.box.style.width = width;
	this.box.top = 20;
	this.box.style.overflow = "hidden";
	this.box.style.zIndex = "999";
	this.box.id = "sb";
	
	switch(title)
	{
		case 'a':
			tstr = tstrA;
			break;
		case 'b':
			tstr = tstrB;
			break;
		case 'c':
			tstr = tstrC;
			break;
		case 'd':
			tstr = tstrD;
			break;
		case 'e':
			tstr = tstrE;
			break;
		case 'f':
			tstr = tstrF;
	}
	document.getElementById('d0').style.height= screen.height+50;
	document.getElementById('d0').style.display = "block";
	
	/*** left corner ***/
	var lc = document.createElement("div");
	lc.style.height = 63;
	lc.style.lineHeight = 63;
	lc.style.width = 12;
	lc.style.left = bleft;
	lc.style.top = top;
	lc.style.position = "absolute";
	lc.style.display = "block";
	lc.style.overflow = "hidden";
	lc.style.zIndex = 999;
	//lc = fix_ie6(lc, 63, 12);
	var lcImg = document.createElement("img");
	lcImg.src = sprite;
	lcImg.style.position = "absolute";
	lcImg.style.left = 0;
	lcImg.style.top = 0;
	lcImg.style.zIndex = 999;
	//lcImg = this._fixIE6PNG(rev, 63, 12);
	this.lcImg = fix_ie6(lcImg, 63, 12);
	lc.appendChild(lcImg);
	this.box.appendChild(lc);
	/*** right corner ***/
	var rc = document.createElement("div");
	rc.style.height = 63;
	rc.style.lineHeight = 63;
	rc.style.width = 12;
	rc.style.right = 0;
	rc.style.top = top;
	rc.style.position = "absolute";
	rc.style.display = "block";
	rc.style.overflow = "hidden";
	rc.style.zIndex = 999;
	//rc = fix_ie6(rc, 63, 12);
	var rcImg = document.createElement("img");
	rcImg.src = sprite;
	rcImg.style.position = "absolute";
	rcImg.style.right = 0;
	rcImg.style.top = 0;
	rcImg.style.zIndex = 999;
	this.rcImg = fix_ie6(rcImg, 63, 12);
	rc.appendChild(rcImg);
	this.box.appendChild(rc);
	/*** left bottom corner ***/
	var lbc = document.createElement("div");
	lbc.style.height = 30;
	lbc.style.lineHeight = 30;
	lbc.style.width = 12;
	lbc.style.left = bleft;
	lbc.style.bottom = 0;
	lbc.style.position = "absolute";
	lbc.style.display = "block";
	lbc.style.overflow = "hidden";
	lbc.style.zIndex = 999;
	//lbc = fix_ie6(lbc, 30, 12);
	var lbcImg = document.createElement("img");
	lbcImg.src = sprite;
	lbcImg.style.position = "absolute";
	lbcImg.style.left = 0;
	lbcImg.style.bottom = -39;
	lbcImg.style.zIndex = 999;
	this.lbcImg = fix_ie6(lbcImg, 30, 12);
	lbc.appendChild(lbcImg);
	this.box.appendChild(lbc);
	/*** right bottom corner ***/
	var rbc = document.createElement("div");
	rbc.style.height = 30;
	rbc.style.lineHeight = 30;
	rbc.style.width = 12;
	rbc.style.right = 0;
	rbc.style.bottom = 0;
	rbc.style.position = "absolute";
	rbc.style.display = "block";
	rbc.style.overflow = "hidden";
	rbc.style.zIndex = 999;
	//rbc = fix_ie6(rbc, 30, 12);
	var rbcImg = document.createElement("img");
	rbcImg.src = sprite;
	rbcImg.style.position = "absolute";
	rbcImg.style.right = 0;
	rbcImg.style.bottom = -39;
	rbcImg.style.zIndex = 999;
	this.rbcImg = fix_ie6(rbcImg, 30, 12);
	rbc.appendChild(rbcImg);
	this.box.appendChild(rbc);
	/*** top box line ***/
	var tl = document.createElement("div");
	tl.style.height = 63;
	tl.style.lineHeight = 63;
	tl.style.width = width-20;
	/***/
	tl.style.right = 12;
	tl.style.top = top;
	tl.style.position = "absolute";
	tl.style.display = "block";
	tl.style.overflow = "hidden";
	tl.style.zIndex = 999;
	//tl = fix_ie6(tl, 63, 196);
	var tlImg = document.createElement("img");
	tlImg.src = sprite;
	tlImg.style.position = "absolute";
	tlImg.style.left = -20;
	tlImg.style.top = 0;
	tlImg.style.zIndex = 999;
	this.tlImg = fix_ie6(tlImg, 63, width-20);
	tl.appendChild(tlImg);
	this.box.appendChild(tl);
	/*** bottom box line ***/
	var bl = document.createElement("div");
	bl.style.height = 30;
	bl.style.lineHeight = 30;
	bl.style.width = width-20;
	bl.style.right=12;
	bl.style.bottom = 0;
	bl.style.position = "absolute";
	bl.style.display = "block";
	bl.style.overflow = "hidden";
	bl.style.zIndex = 999;
	//bl = fix_ie6(bl, 30, width-24);
	var blImg = document.createElement("img");
	blImg.src = sprite;
	blImg.style.position = "absolute";
	blImg.style.left = -20;
	blImg.style.bottom = -39;
	blImg.style.zIndex = 999;
	this.blImg = fix_ie6(blImg, 30, width-20);
	bl.appendChild(blImg);
	this.box.appendChild(bl);
	/*** left box line ***/
	var ll = document.createElement("div");
	//ll.style.cssText = "height:auto;";
	//ll.style.cssText= "height:auto";
	ll.style.width = "10px";
	if(navigator.appName=='Microsoft Internet Explorer'&&navigator.userAgent.indexOf('MSIE 6')>0)
		ll.style.height = 20+29*string.length;
	ll.style.left = bleft;
	ll.style.top = top+63;
	ll.style.bottom = 30;
	ll.style.position = "absolute";
	ll.style.display = "block";
	ll.style.overflow = "hidden";
	ll.style.zIndex = "999";
	var lll = document.createElement("div");
	lll.style.height =600;
	lll.style.lineHeight = 600;
	lll.style.width = "10px";
	lll.style.left = 0;
	lll.style.top = 0;
	lll.style.display = "block";
	lll.style.overflow = "hidden";
	lll.style.position = "absolute";
	lll.style.zIndex = "999";
	var llImg = document.createElement("img");
	llImg.src = "http://c.icq.com/maps/img/box.png";
	llImg.style.position = "absolute";
	llImg.style.left = 0;
	llImg.style.top = -10;
	llImg.style.zIndex = 999;
	llImg.style.overflow = "hidden";
	this.llImg = fix_ie6(llImg, 10, 10);
	lll.appendChild(llImg);
	ll.appendChild(lll);
	this.box.appendChild(ll);
	/*** right box line ***/
	var rl = document.createElement("div");
	//rl.style.cssText = "height:auto;";
	rl.style.width = 10;
	if(navigator.appName=='Microsoft Internet Explorer'&&navigator.userAgent.indexOf('MSIE 6')>0)
		rl.style.height = 20+29*string.length;
	rl.style.right = 0;
	rl.style.top = top+63;
	rl.style.bottom = 30;
	rl.style.position = "absolute";
	rl.style.display = "inline-block";
	rl.style.overflow = "hidden";
	rl.style.zIndex = 999;
	//this.rl = fix_ie6(rl, 1, 10);
	var rll = document.createElement("div");
	rll.style.height = 600;
	rll.style.lineHeight = 600;
	rll.style.width = 10;
	rll.style.right = 0;
	rll.style.top = 0;
	rll.style.bottom = 0;
	rll.style.display = "inline-block";
	rll.style.position = "absolute";
	rll.style.overflow = "hidden";
	rll.style.zIndex = 999;
	this.rll = fix_ie6(rll, 1, 10);
	var rlImg = document.createElement("img");
	rlImg.src = "http://c.icq.com/maps/img/box.png";
	rlImg.style.position = "absolute";
	rlImg.style.right = 0;
	rlImg.style.top = -10;
	rlImg.style.zIndex = 999;
	this.rlImg = fix_ie6(rlImg, 10, 10);
	rll.appendChild(rlImg);
	rl.appendChild(rll);
	this.box.appendChild(rl);
	/*** background ***/
	var bgr = document.createElement("div");
	if(navigator.appName=='Microsoft Internet Explorer'&&navigator.userAgent.indexOf('MSIE 6')>0)
	{
		bgr.style.width = width-10;
		bgr.style.height = 20+29*string.length;
	}
	bgr.style.top = top+63;
	bgr.style.left = bleft+5;
	bgr.style.right = 5;
	bgr.style.bottom = 30;
	bgr.style.position = "absolute";
	bgr.style.display = "block";
	bgr.style.overflow = "hidden";
	bgr.style.zIndex = 999;
	var bgrd=document.createElement("div");
	bgrd.style.width = 300;
	bgrd.style.height = 400;
	bgrd.style.lineHeight = 400;
	bgrd.style.top = 0;
	bgrd.style.left = 0;
	bgrd.style.position = "absolute";
	bgrd.style.display = "block";
	bgrd.style.zIndex = 999;
	var bgrImg = document.createElement("img");
	bgrImg.src = "http://c.icq.com/maps/img/box.png";
	bgrImg.style.position = "absolute";
	bgrImg.style.left = -20;
	bgrImg.style.top = -20;
	bgrImg.style.zIndex = 999;
	this.bgrImg = fix_ie6(bgrImg, 400, 400);
	bgrd.appendChild(bgrImg);
	bgr.appendChild(bgrd);
	this.box.appendChild(bgr);
	/*** top treangle ***/
	if(box){
		var tr = document.createElement("div");
		tr.style.height = "16px";
		tr.style.lineHeight = "16px";
		tr.style.width = "20px";
		tr.style.right = alrt?20:0;
		tr.style.top = 0;
		tr.style.position = "absolute";
		tr.style.display = "block";
		tr.style.overflow = "hidden";
		tr.style.zIndex = "999";
		//tr = fix_ie6(tr, 16, 20);
		var trImg = document.createElement("img");
		trImg.src = sprite;
		trImg.style.position = "absolute";
		trImg.style.top = -652;
		trImg.style.left = -101;
		this.trImg = fix_ie6(trImg, 16, 20);
		tr.appendChild(trImg);
		this.box.appendChild(tr);}
	/*** left treangle ***/
	if(!box){
		var tr = document.createElement("div");
		tr.style.height = 20;
		tr.style.lineHeight = 20;
		tr.style.width = 16;
		tr.style.top = 15;
		tr.style.left = 0;
		tr.style.position = "absolute";
		tr.style.display = "block";
		tr.style.overflow = "hidden";
		tr.style.zIndex = 999;
		//tr = fix_ie6(tr, 20, 16);
		var trImg = document.createElement("img");
		trImg.src = sprite;
		trImg.style.position = "absolute";
		trImg.style.top = -656;
		trImg.style.left = -223;
		this.trImg = fix_ie6(trImg, 20, 16);
		tr.appendChild(trImg);
		this.box.appendChild(tr);}
	/*** close ***/
	var close = document.createElement("div");
	close.style.height = "15px";
	close.style.lineHeight = "15px";
	close.style.width = "15px";
	close.style.right = 8;
	close.style.top = top+7;
	close.style.position = "absolute";
	close.style.display = "block";
	close.style.overflow = "hidden";
	close.style.zIndex = "999";
	//close = fix_ie6(close, 15, 15);
	var closeImg = document.createElement("img");
	closeImg.src = "http://c.icq.com/maps/img/box.png";
	closeImg.style.position = "absolute";
	closeImg.style.top = -654;
	closeImg.style.left = -281;
	this.closeImg = fix_ie6(closeImg, 15, 15);
	closeImg.style.zIndex = 1000;
	closeImg.style.cursor = "pointer";
	closeImg.onclick = function(){
			document.getElementById(divId).style.display = "none";
			document.getElementById('d0').style.display = "none";
			document.getElementById('preload').style.display = "none";
			clear_line();
		}
	close.appendChild(closeImg);
	this.box.appendChild(close);
	/*** alert img ***/
	if(alrt){
		left = 45;
		var al = document.createElement("div");
		al.id = "alrt";
		al.style.height = "25px";
		al.style.lineHeight = 25;
		al.style.width = "27px";
		al.style.top = top+13;
		al.style.left = 12+bleft;
		al.style.position = "absolute";
		al.style.display = "block";
		al.style.overflow = "hidden";
		al.style.zIndex = "999";
		//al = fix_ie6(al, 25, 27);
		var alImg = document.createElement("img");
		alImg.src = "http://c.icq.com/maps/img/box.png";
		alImg.style.position = "absolute";
		alImg.style.top = -652;
		alImg.style.left = -250;
		alImg.style.zIndex = "999";
		this.alImg = fix_ie6(alImg, 25, 27);
		al.appendChild(alImg);
		this.box.appendChild(al);
	}
	/*** title text ***/
	var titd = document.createElement("div");
	titd.style.width=alrt?170:125;
	titd.style.top = top+13;
	titd.style.left = left+bleft;
	titd.style.position = "absolute";
	titd.style.display = "block";
	titd.style.overflow = "hidden";
	titd.style.zIndex = 999;
	var ttxt = document.createElement("span");
	ttxt.style.width = alrt?170:125;
	ttxt.style.cssText = "font-weight:700;";
	ttxt.innerHTML = tstr;
	titd.appendChild(ttxt);
	this.box.appendChild(titd);
	/*** bottom text ***/
	var rstr = alrt?"Please ":"or ";
	rstr += "<a href='javascript:close_box();close_obj(\"d0\");close_obj(\"preload\");clear_line();'>refine your search</a>";
	if(!alrt){
		var bdiv = document.createElement("div");
		bdiv.style.width = alrt?170:125;
		bdiv.style.bottom = 0;
		bdiv.style.height = 25;
		bdiv.style.left = left+bleft;
		bdiv.style.position = "absolute";
		bdiv.style.display = "block";
		bdiv.style.overflow = "hidden";
		bdiv.style.zIndex = 999;
		var btxt = document.createElement("span");
		btxt.style.width = alrt?170:125;
		btxt.innerHTML = rstr;
		bdiv.appendChild(btxt);
		this.box.appendChild(bdiv);
	}
	
	/*** ||| ***/
	if(!alrt&&box)document.getElementById(boxId).style.cssText="margin-left:15px;margin-bottom:40px;";
	
	else if(!alrt&&!box)document.getElementById(boxId).style.cssText="margin-left:32px;margin-bottom:40px;";
	else if(alrt&&!box)document.getElementById(boxId).style.cssText="margin-left:56px;";
	document.getElementById(boxId).innerHTML = (alrt&&title!='e')?rstr:"<br>"+list+"<br>";
	
	document.getElementById(divId).appendChild(this.box);
	document.getElementById(divId).style.display = "block";
}
/***************************************************** end close function **********************************************************************************/
/*********************************************************** change language coockie **********************************************************************/
function change_to_lang(lang)
{
	var gl_expireDate = new Date;
	gl_expireDate.setMonth(gl_expireDate.getMonth()+1);
	SetCookie("icq_lang", lang , gl_expireDate,"/");
	window.location.reload(true);
}
/********************************************************* end change language coockie *********************************************************************/
/********************************************************* top line search function **********************************************/
function execSearch(page_mode,index_page)
{
	if(page_mode=='more')
	{
		if (document.getElementById('d2-2-1-1-1-2').style.visibility == 'hidden' || document.getElementById('d2-2-1-1-1-2').style.visibility == '')
			document.getElementById('d2-2-1-1-1-2').style.visibility = 'visible';
		else
			document.getElementById('d2-2-1-1-1-2').style.visibility = 'hidden';
		return;
	}
	else{
		if(page_mode!='maps'){
			submitSrch(page_mode, false);
		}
	}
}
function submitSrch(page, was_sbm)
{
	var keyword = document.getElementById("search_keyword").value;
	if	(keyword != ''){
		location = "/search/search.php?search_keyword="+keyword+"&range="+page;
	}
	else 
		location = '/search/?range='+page;
}
function removeMorebox()
{
	document.getElementById('d2-2-1-1-1-2').style.visibility = 'hidden';
}
function changeBckground(stat,id)
{
 	if (stat == 'over')
 	{
 		document.getElementById(id).style.backgroundColor = "#ACE377";
 		document.getElementById(id).style.color = "#177011";
 	}
 	else
 	{
 		document.getElementById(id).style.backgroundColor = "#FFFFFF";
 		document.getElementById(id).style.color = "#4040D9";
 	}
 	
 
}
/**************************************************** end top line searching function *******************************************/
/**************************************************** start route functions *********************************************************************************/
/************************************* getting addresses data ************************************/
function check_nor(country, city)
{
	if(get_country(country)=='Norway'&&document.getElementById(city).value=='')
		document.getElementById(city).value='Oslo';
}
function doFlashRoute(){

	var myTAddress = new MQAddress();
	var myFAddress = new MQAddress();
	var myGExec = new MQExec(mqGcServer,mqPath,port);
	if(wasRoute)
	{
		revAddressColl = myAddressColl;
		reve = true;
	}
	myAddressColl = new MQLocationCollection();
	var myGcResultCollColl = new MQLocationCollectionCollection();
	var gaCollection = new MQLocationCollection("MQGeoAddress");
	var country = '';
	check_nor('orig_country', 'in_8');
	check_nor('dest_country', 'in_13');
	if((get_country('orig_country')!=get_country('dest_country'))&&(get_country('orig_country')=='Brazil'||get_country('orig_country')=='New Zealand'||get_country('orig_country')=='United States'||get_country('dest_country')=='Brazil'||get_country('dest_country')=='New Zealand'||get_country('dest_country')=='United States'))
	{
		suggession_box(true, 'f', '', false);}
	else{
		ch_id='maps_directions';
		myMap.removeRouteHighlight();
		myMap.removeAllPois();
		myFAddress.setStreet(document.getElementById("in_7").value);
		myFAddress.setCity(document.getElementById("in_8").value);
		myFAddress.setState(document.getElementById("in_9").value);
		myFAddress.setPostalCode(document.getElementById("in_10").value);
		country = get_country('orig_country');
		myFAddress.setCountry(country);
		myTAddress.setStreet(document.getElementById("in_12").value);
		myTAddress.setCity(document.getElementById("in_13").value);
		myTAddress.setState(document.getElementById("in_14").value);
		myTAddress.setPostalCode(document.getElementById("in_15").value);
		country = get_country('dest_country');
		myTAddress.setCountry(country);
		myAddressColl.add(myFAddress);
		myAddressColl.add(myTAddress);
		document.getElementById('preload').style.display = "block";
		
		ptype="Direction Result";
		document.getElementById('print_btn').onclick="";
		document.getElementById('dir_header').innerHTML = document.getElementById('lg').value=="English"?"Search results for directions from ":"Fahrtrouten von ";
		myGExec.batchGeocode(myAddressColl,myGcResultCollColl,new MQAutoGeocodeCovSwitch(),onFlashRtGcEnd);
	}
}
/************************************* open proxy session *************************************/
function onFlashRtGcEnd(myGcResultCollColl){

	myCollColl = myGcResultCollColl;
	myRExec = new MQExec(mqRtServer,mqPath,port,myPxyServer, myPxyPath,myPxyPort);
	myRExec.createSessionEx(new MQSession(),onFlashRtSessCreate);
}
/************************************ getting session id **************************************/
function onFlashRtSessCreate(mySessionId){

	sessionId = mySessionId;
	var rStr=new Array();
	if(myCollColl.get(0).getSize()>1){
		for(var m=0;m<myCollColl.get(0).getSize();m++)
		{
			rStr[m] = '<div style="float:left;width:15px;">'+(m+1)+'.</div><a href="javascript:getOrInd('+m+');">'+myCollColl.get(0).get(m).getCity()+", "+myCollColl.get(0).get(m).getState()+"</a><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
			rStr[m] += myCollColl.get(0).get(m).getCounty()+(myCollColl.get(0).get(m).getPostalCode()?myCollColl.get(0).get(m).getPostalCode():'');
			if(myCollColl.get(0).get(m).getStreet())
				rStr[m]+=myCollColl.get(0).get(m).getStreet();
			rStr[m] +="<br>";
		}
		suggession_box(false, 'a', rStr, sugBox);
	}
	else
		getOrInd(0);
}
/******************************getting origin address **********************/
function getOrInd(orIndGet)
{

	indexes[0]=orIndGet;
	var resStr=new Array();
	if(myCollColl.get(1).getSize()>1){

		for(desInd=0;desInd<myCollColl.get(1).getSize();desInd++){
			resStr[desInd] = '<div style="float:left;width:15px;">'+(desInd+1)+".</div><a href='javascript:getDesInd("+desInd+");close_box();'>"+myCollColl.get(1).get(desInd).getCity()+", "+myCollColl.get(1).get(desInd).getState()+"</a></br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
			resStr[desInd] += myCollColl.get(1).get(desInd).getCounty()+(myCollColl.get(1).get(desInd).getPostalCode()?myCollColl.get(1).get(desInd).getPostalCode():'');
			if(myCollColl.get(1).get(desInd).getStreet())
				resStr[desInd]+=myCollColl.get(1).get(desInd).getStreet();
			resStr[desInd] +="<br>";
		}
		suggession_box(false, 'a', resStr, sugBox);
		document.getElementById('sugDivSide').style.top = 380;
	}
	else {
		getDesInd(0);

	}	
}
/********************** getting destination address ***************************/
function getDesInd(desIndGet)
{

	indexes[1]=desIndGet;
	close_obj("sugDivSide");
	get_route_points();
}
/********************************** getting addresses data *******************************/
function get_route_points()
{

	dstate=false;
	var myRtResults = new MQRouteResults();
	
	var myOptions = new MQRouteOptions();
	var addStr = new MQStringCollection();
	if(document.getElementById('avoidLimitedAccess').checked)
		addStr.add(MQCONSTANT.MQROUTEOPTIONS_AVOID_ATTRIBUTE_LIMITED_ACCESS);
	if(document.getElementById('avoidTolls').checked)
		addStr.add(MQCONSTANT.MQROUTEOPTIONS_AVOID_ATTRIBUTE_TOLL_ROAD);
	if(document.getElementById('avoidFerry').checked)
		addStr.add(MQCONSTANT.MQROUTEOPTIONS_AVOID_ATTRIBUTE_FERRY);
	if(document.getElementById('route_type1').checked)
		myOptions.setRouteType(new MQRouteType(0));
	if(document.getElementById('route_type2').checked)
		myOptions.setRouteType(new MQRouteType(1));
	myOptions.setAvoidAttrList(addStr);
	myOptions.setCoverageName("");
	myOptions.setMaxShapePointsPerManeuver(200);
	myOptions.setLanguage(document.getElementById("lg").value);
	myRtColl = new MQLocationCollection("MQGeoAddress");
	myRtColl.add(myCollColl.get(0).get(indexes[0]));
	myRtColl.add(myCollColl.get(1).get(indexes[1]));
	addrStart = add_se_pois(myRtColl.get(0),'orig_country');
	addrEnd = add_se_pois(myRtColl.get(1),'dest_country');
	strFrom='';
	strTo='';
	if(document.getElementById('in_8').value!=''&&myRtColl.get(0).getCity()==''){
		suggession_box(true, 'b', '', sugBox);
	}else if(document.getElementById('in_13').value!=''&&myRtColl.get(1).getCity()==''){
		suggession_box(true, 'b', '', sugBox);}else{
		//myBoundingBox = new MQRectLL(myRtColl.get(0).getMQLatLng(),myRtColl.get(1).getMQLatLng());
		if(myRtColl.get(0).getStreet()){
			document.getElementById('in_7').value = myRtColl.get(0).getStreet();
			strFrom = myRtColl.get(0).getStreet()+"&nbsp;";}
		if(myRtColl.get(0).getCity())
			strFrom += myRtColl.get(0).getCity()+", ";
		strFrom += get_country('orig_country');
		
		if(myRtColl.get(0).getPostalCode())
			document.getElementById('in_10').value = myRtColl.get(0).getPostalCode();

		if(myRtColl.get(1).getStreet()){
			document.getElementById('in_12').value = myRtColl.get(1).getStreet();
			strTo = myRtColl.get(1).getStreet()+"&nbsp;";}
		if(myRtColl.get(1).getCity())
			strTo += myRtColl.get(1).getCity()+", ";
		strTo += get_country('dest_country');
		if(get_country('orig_country')=='United States'){
			if(myRtColl.get(0).getState()){
				document.getElementById('in_9').value = myRtColl.get(0).getState();
				strFrom += "&nbsp;"+myRtColl.get(0).getState();}
			if(myRtColl.get(1).getState()){
				document.getElementById('in_14').value = myRtColl.get(1).getState();
				strTo += "&nbsp;"+myRtColl.get(1).getState();}
		}
		if(myRtColl.get(0).getState()==myRtColl.get(1).getState())
			dstate=true;
		if(myRtColl.get(1).getPostalCode())
			document.getElementById('in_15').value = myRtColl.get(1).getPostalCode();
		var to = document.getElementById('lg').value=="English"?"to":"nach";
		titleLine = "&nbsp;<span style='font-size:14px;font-weight:normal;'>"+strFrom+"</span>&nbsp;"+to+"&nbsp;<span style='font-size:14px;font-weight:normal;'>"+strTo+"</span>"
		document.getElementById('cont_header').innerHTML = titleLine;
		offers_on(true);
		myRExec.doRoute(myRtColl,myOptions,myRtResults,sessionId,null,on_rt_end);
	}
}
/*********************************** getting routing results ******************************************************/
function on_rt_end(myRouteRes){
	revId = null;
	var myTrkRtColl = new MQTrekRouteCollection();
	var myManeuverColl = new MQManeuverCollection();
	var myRouteOL = new MQLineOverlay();
	sLatLong = new MQLatLngCollection();
	eLatLong = new MQLatLngCollection();
	psLatLong = new MQLatLng();
	peLatLong = new MQLatLng();
	var myManStr = '';
	myTrkStr = '';
	var indll;
	var intX=0;
	latLongMm = new MQLatLngCollection();
	latLongMms = new MQLatLngCollection();
	latLongMme = new MQLatLngCollection();
	if((strFrom==strTo)&&dstate){
			suggession_box(true, 'd', '', sugBox);
	}
	else{
		
		var myMinutes = myRouteRes.getTime()/60;
		if (myMinutes > 60) {
			if (myMinutes/60 == 1) {
				var myTotTime = '1 hr ';
			}
			else {
				var myTotTime = Math.round((myMinutes/60)*100)/100 + ' hrs';
			}
		}
		else {
			var myTotTime = myMinutes + ' min';
		}
		var myDist = Math.round(myRouteRes.getDistance()*100)/100;
		myTrkRtColl = myRouteRes.getTrekRoutes();
		myManeuverColl = myTrkRtColl.get(0).getManeuvers();
		sLatLong = myManeuverColl.get(0).getShapePoints();
		eLatLong = myManeuverColl.get(myManeuverColl.getSize()-1).getShapePoints();
		myTrkStr = '<table class="t-rr" cellspacing="0" cellpadding="0">';
		var strSize = myManeuverColl.getSize();
		for (intX; intX < myManeuverColl.getSize(); intX ++){
			myTrkStr += '<tr><td width="20">'+(intX+1)+':</td>';
			latLong = myManeuverColl.get(intX).getShapePoints();
			if(latLong.getSize()%2!=0)
				indll = (latLong.getSize()-1)/2;
			else
				indll = latLong.getSize()/2;
			latLongMm.add(latLong.get(indll));
			latLongMms.add(latLong.get(0));
			latLongMme.add(latLong.get(latLong.getSize()-1));
			
			myManDist = Math.round(myManeuverColl.get(intX).getDistance()*100)/100;
			myManStr = myManeuverColl.get(intX).getNarrative();
			//////////////////////////////////////////////////////////
			myTrkStr += '<td id="rstr_'+intX+'" onmouseover="open_zoom('+intX+')" onclick="ztstr('+intX+')">'+myManStr;
			myTrkStr += '<br><div id="trk_'+intX+'" style="display:none;"><a class="trk_in" id="trk_in_'+intX+'" href="javascript:ztstr('+intX+')">Zoom to Street&nbsp;<img src="http://c.icq.com/maps/img/zoom_ic.gif" border="0" width="14" height="14" alt="" align="absmiddle"></a>';
			myTrkStr += '<a class="trk_out" id="trk_out_'+intX+'" href="javascript:zout('+intX+')">Zoom Out&nbsp;<img src="http://c.icq.com/maps/img/zoom_out_ic.gif" border="0" width="14" height="14" alt="" align="absmiddle"></a></div></td>';
			
			myManDist = rndDis(myManDist);
			myTrkStr += '<td width="70" align="center">'+myManDist+'&nbsp;km</td></tr>';
			
			myTrkStr += '<tr><td colspan="3" class="trk_res">&nbsp;</td></tr>';
			pstr+=myManStr+'!';
			dstr+=myManDist+'!';
		}
		myTrkStr += '</table>';
		myDist = rndDis(myDist);
		totStr=new Array('<b>'+totime+'</b>&nbsp;'+ myDist + '&nbsp;km','<b>'+totdis+'</b>&nbsp;' + myTotTime)
		myMap.bestFit(true, 2,4);
		document.getElementById('s1-3t').innerHTML=totStr[0]+'<br>'+totStr[1];
		document.getElementById('route_res').innerHTML = myTrkStr;
		
		itinerary_on(true);
		document.getElementById('pointA').innerHTML = strFrom;
		document.getElementById('pointB').innerHTML = strTo;

		document.getElementById('preload').style.display = "none";
		document.getElementById('d0').style.display = "none";
		add_point("a1.png", sLatLong.get(0), addrStart, myMap, 39, 39);
		add_point("b1.png", eLatLong.get(eLatLong.getSize()-1), addrEnd, myMap, 39, 39);
		myBoundingBox = new MQRectLL(sLatLong.get(0),eLatLong.get(eLatLong.getSize()-1));
		myMap.addRouteHighlight(myBoundingBox, "http://map.access.mapquest.com", sessionId, true);
		
		setOmni();
		getKeyword();
		document.getElementById('print_btn').onclick=function() {print_this_map();}
		myMap.saveState();
		wasRoute=true;
		psLatLong = sLatLong.get(0);
		peLatLong = eLatLong.get(eLatLong.getSize()-1);
		revZoom = myMap.getZoomLevel();
		
	}
}
/********************* star km calculation ***************************************************/
function rndDis(dis)
{
	dis = dis*1.609;
	var result = Math.round(dis*Math.pow(10,2))/Math.pow(10,2);
	return result;
}
function se_ztstr(start)
{
	if(start){
		myMap.setCenter(sLatLong.get(0));
		document.getElementById("trk_in_a").style.display="none";
		document.getElementById("trk_out_a").style.display="block";
		document.getElementById("trk_in_b").style.display="block";
		document.getElementById("trk_out_b").style.display="none";
	}
	else{
		myMap.setCenter(eLatLong.get(0));
		document.getElementById("trk_in_b").style.display="none";
		document.getElementById("trk_out_b").style.display="block";
		document.getElementById("trk_in_a").style.display="block";
		document.getElementById("trk_out_a").style.display="none";
	}
}
function ztstr(pid)
{
	//add_point("401_"+(pid+1)+".gif", latLongMms.get(pid),"", myMap, 20, 20);
	//add_point("401_"+(pid+2)+".gif", latLongMme.get(pid),"", myMap, 20, 20);
	psLatLong = latLongMms.get(pid);
	peLatLong = latLongMme.get(pid);
	mmBB = new MQRectLL(latLongMms.get(pid), latLongMme.get(pid));
	myMap.addRouteHighlight(mmBB, "http://map.access.mapquest.com", sessionId, true);
	var i=0;
	while(document.getElementById('trk_'+i))
	{
		if(document.getElementById('rstr_'+i))document.getElementById('rstr_'+i).style.fontWeight='normal';
		document.getElementById("trk_in_"+i).style.display="block";
		document.getElementById("trk_out_"+i).style.display="none";
		i++;
	}
	document.getElementById('icq-rev').onclick = function(){do_revert(1);}
	revId = pid;
	if(document.getElementById('rstr_'+pid))document.getElementById('rstr_'+pid).style.fontWeight=700;
	document.getElementById("trk_in_"+pid).style.display="none";
	document.getElementById("trk_out_"+pid).style.display="block";
}
function zout(id)
{
	myMap.restoreState();
	myMap.removeAllPois();
	myMap.addRouteHighlight(myBoundingBox, "http://map.access.mapquest.com", sessionId, true);
	add_point("a1.png", sLatLong.get(0), addrStart, myMap, 39, 39);
	add_point("b1.png", eLatLong.get(eLatLong.getSize()-1), addrEnd, myMap, 39, 39);
	document.getElementById("trk_in_"+id).style.display="block";
	document.getElementById("trk_out_"+id).style.display="none";
	psLatLong = sLatLong.get(0);
	peLatLong = eLatLong.get(eLatLong.getSize()-1);
	document.getElementById('icq-rev').onclick = function(){do_revert(0);}
	revId=null;
}
function open_zoom(x)
{
	var i=0;
	while(document.getElementById('trk_'+i))
	{
		document.getElementById('trk_'+i).style.display="none";
		i++;
	}
	document.getElementById('trk_'+x).style.display="block";
}
/********************* start adding country name into pois ************************************/
function add_se_pois(coll, id)
{
	var o = 0;
	var addr = new Array();
	
	addr[o]=get_country(id);
	if(coll.getCity()){
		o++;
		addr[o] = coll.getCity();
	}
	if(coll.getStreet()){
		o++;
		addr[o] = coll.getStreet();
	}
	
	return addr;
}
/************************** start adding new point **************************************************/
function add_point(img, ll, info, mapName, w, h)
{
	myIcon = new MQMapIcon();
	myIcon.setImage("http://c.icq.com/maps/img/"+img,w,h,true,false);
	nPoint = new MQPoi(ll);
	if(info!="")
		nPoint.setInfoTitleHTML(info);
	nPoint.setIcon(myIcon);
	mapName.addPoi(nPoint);
}
/************************* start open mini map ***********************************************/
function open_mm(mmid)
{
	var id = mmid;
	start_minimap(mmid);
	document.getElementById('a_'+id).style.display = "none";
	document.getElementById(id).style.display = "block";
}
/******************************* starting minimap *******************************************/
function start_minimap(pid)
{
	var miniMap = null;
	miniMap = new MQTileMap(document.getElementById(pid));
	miniMap.removeRouteHighlight();
	miniMap.removeAllPois();
	miniMap.setSize(new MQSize(150,100));
	myZoomCont = new MQZoomControl;
	miniMap.addControl(myZoomCont, new MQMapCornerPlacement(MQMapCorner.TOP_LEFT, new MQSize(0,0)));
	miniMap.setCenter(latLongMm.get(pid), 10);
	add_point("403_"+(pid+1)+".gif", latLongMms.get(pid),"", miniMap, 20, 20);
	add_point("403_"+(pid+2)+".gif", latLongMme.get(pid),"", miniMap, 20, 20);
	mmBB = new MQRectLL(latLongMms.get(pid), latLongMme.get(pid));
	miniMap.addRouteHighlight(mmBB, "http://map.access.mapquest.com", sessionId, true);
}
/********************************************************************** end route functions *******************************************************************/
/**************************************************** start revert control ***************************************************/
function icq_revert()
{
	this.map = null;
	this._fixIE6PNG = function(obj, h, w){
		if(navigator.appName == "Microsoft Internet Explorer"){
			if(navigator.userAgent.indexOf('MSIE 6')>0){
				if(obj.src){
					var span = document.createElement("span");
					if(obj.id)
						span.id = obj.id;
					if(obj.className)
						span.className = obj.className;
					if(obj.title)
						span.title = obj.title;
					if(obj.style.cssText)
						span.style.cssText = obj.style.cssText;
					span.style.display = "inline-block";
					span.style.width = w;
					span.style.height = h;
					span.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'" + obj.src + "\', sizingMethod='scale')"; 
					return span;
				}
				else {
					var bkgrndImg = obj.style.backgroundImage;
					if(bkgrndImg){
						bkgrndImg = bkgrndImg.substring(4, bkgrndImg.length - 1);
						obj.style.backgroundImage = "";
						obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'" + bkgrndImg + "\', sizingMethod='scale')"; 
					}
				}
				
			}
		}
		return obj;
	}
	this._render = function(){
		this.elem = document.createElement("span"); 
		this.elem.style.position = "absolute"; 
		this.elem.display = "block";
		this.elem.style.height = "23px";
		this.elem.style.lineHeight = "23px";
		this.elem.style.width = "26px";
		this.elem.top = "0px";
		this.elem.style.overflow = "hidden";
		this.elem.style.zIndex = 200;
		var rev = document.createElement("div");
		rev.id = "revert";
		rev.style.height = "23px";
		rev.style.lineHeight = "23px";
		rev.style.width = "26px";
		rev.style.position = "relative";
		rev.style.display = "block";
		rev.overflow = "hidden";
		rev.style.zIndex = 200;
		rev = this._fixIE6PNG(rev, "23px", "26px");
		
		rimg.id = "icq-rev";
		rimg.src = "http://c.icq.com/maps/img/revert.png";
		rimg.alt = "revert";
		rimg.style.position = "relative";
		rimg.style.left = "-27px";
		rimg.style.top = "0px";
		rimg.style.bottom = "0px";
		rimg.style.zIndex = 200;
		rimg.style.cursor = "pointer";
		rimg.onmouseover = function(){rimg.style.left = "-53px";}
		rimg.onmouseout = function(){rimg.style.left = "-27px";}
		rimg.onclick = function(){do_revert(0);}
		//img.onclick = fu
		rev.appendChild(rimg);
		this.elem.appendChild(rev);
	}
	
	this.getHeight = function(){ return 23;};
	this.getWidth = function(){ return 26;};
	this.getPosition = function(){ return this.position;};
	
	this.setSliderPosition = function(){
		this.elem.style.top =  0;
	}
	this.initialize = function(map){
			this.map = map;
			MQEventManager.addListener(this.map, "revert", this.eventCallback("setSliderPosition"));

			this.setSliderPosition();
	}
	this.eventCallback = function(f_0){
		var c21 = this;
		return function(event){if(!event){event = window.event;}c21[f_0](event);};
	}
	this._render();
}
function do_revert(r)
{
	if(!r&&(mapzoom!=myMap.getZoomLevel()||myMap.getCenter()!=actMapState.getCenter()))//&&ptype!="Index")
		r=1;
	if(r)
	{
		
		if(wasRoute&&mapdir){
			myMap.removeAllPois();
			myMap.restoreState();
			myMap.addRouteHighlight(myBoundingBox, "http://map.access.mapquest.com", sessionId, true);
			add_point("a1.png", sLatLong.get(0), addrStart, myMap, 39, 39);
			add_point("b1.png", eLatLong.get(eLatLong.getSize()-1), addrEnd, myMap, 39, 39);
			if(revId!=null){
				document.getElementById("trk_in_"+revId).style.display="block";
				document.getElementById("trk_out_"+revId).style.display="none";
				document.getElementById("rstr_"+revId).style.fontWeight='normal';
			}
			psLatLong = sLatLong.get(0);
			peLatLong = eLatLong.get(eLatLong.getSize()-1);
			actzoom = myMap.getZoomLevel();
			revId=null;
		}
		else if(!mapdir){
			myMap.setZoomLevel(mapzoom);
			myMap.setCenter(actMapState.getCenter());
		}
		else 
		{
			myMap.setZoomLevel(mapzoom);
			myMap.setCenter(startState.getCenter());
		}
		document.getElementById('icq-rev').onclick = function(){do_revert(0);}
	}
}
function do_map_state(state, z)
{
	myMap.removeAllPois();
	myMap.removeRouteHighlight();
	myMap.setCenter(state.getCenter(),z);
	myMap.addPoi(new MQPoi(state.getCenter()));
}
function do_route_state()
{
	var myGcResultCollColl = new MQLocationCollectionCollection();
	var myGExec = new MQExec(mqGcServer,mqPath,port);
	document.getElementById('preload').style.display = "block";
	set_country('orig_country',revAddressColl.get(0).getCountry());
	set_country('dest_country',revAddressColl.get(1).getCountry());
	if(revAddressColl.get(0).getStreet())
		document.getElementById('in_7').value=revAddressColl.get(0).getStreet();
	if(revAddressColl.get(0).getCity())
		document.getElementById('in_8').value=revAddressColl.get(0).getCity();
	if(revAddressColl.get(0).getPostalCode())
		document.getElementById('in_10').value=revAddressColl.get(0).getPostalCode();
	if(revAddressColl.get(0).getState())
		document.getElementById('in_9').value = revAddressColl.get(0).getState();
	if(revAddressColl.get(1).getStreet())
		document.getElementById('in_12').value=revAddressColl.get(1).getStreet();
	if(revAddressColl.get(1).getCity())
		document.getElementById('in_13').value=revAddressColl.get(1).getCity();
	if(revAddressColl.get(1).getPostalCode())
		document.getElementById('in_15').value=revAddressColl.get(1).getPostalCode();
	if(revAddressColl.get(1).getState())
		document.getElementById('in_14').value = revAddressColl.get(1).getState();
	doFlashRoute();
}
/************************************************************ end revert control *************************************************************/
/******************************************************** start omniture ********************************************************************/
var data=null;
function setOmni()
{
	data = getXmlHttpObject();
	if (data==null)
	{
		alert("Your browser does not support AJAX!");
		return;
	}
	else
	{
		data.onreadystatechange = on_omni_response;
		data.open("POST", 'omni.php');
		data.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		data.send('lang='+lango+'&ptype='+ptype);
		
	}
}

function on_omni_response()
{
	try
	{
		if ( (data.readyState != 4) || (data.status != 200))
			return;
		var res_str = data.responseText;
	}
	catch(e)
	{
	}
}
/***************************************************************** end omniture ******************************************************************/
/************************************************* start google sp links **********************************************************************/

function getKeyword()
{
	var keyw='';
	xmlHttp = getXmlHttpObject();
	if (xmlHttp==null)
	{
		alert("Your browser does not support AJAX!");
		return;
	}
	else
	{
		if(ch_id=='maps_single')
		{
			country = get_country('country');
			keyw = country;
			if(document.getElementById('city').value!='')
				keyw+='+'+document.getElementById('city').value;
		}
				
		else
		{
			country = get_country('dest_country');
			keyw = country;
			if(document.getElementById('in_13').value!='')
				keyw+=' '+document.getElementById('in_13').value;
		}
		xmlHttp.onreadystatechange = on_ads_response;
		xmlHttp.open("POST", 'google.php');
		xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlHttp.send('keyword='+keyw+'&ch_id=maps&page_type='+ch_id);
	}
}

function on_ads_response()
{
	try
	{
		if ((xmlHttp.readyState != 4) || (xmlHttp.status != 200))
			return;
		var res_text = xmlHttp.responseText;
		if(screen.width<1200){
			document.getElementById('goog').innerHTML=res_text;
			document.getElementById('goog').style.display = "block";
			document.getElementById('adver').style.display = "none";
		}
		else{
			document.getElementById('adver').innerHTML = res_text;
			document.getElementById('adver').style.display = "block";
			document.getElementById('goog').style.display = "none"}
	}
	catch(e)
	{
	}
}
function getXmlHttpObject()
{
	
	try
    {    
		// Firefox, Opera 8.0+, Safari    
		xmlHttp=new XMLHttpRequest();    
	}
  	catch (e)
 	{    
		// Internet Explorer    
		try
      	{      
			xmlHttp=new ActiveXObject("Msxl2.XMLHTTP");      
		}
    		catch (e)
      		{      
			try
        	{        
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");    
			}
      			catch (e)
        		{        
				alert("Your browser does not support AJAX!"); 
				return false;        
				}      
			}    
		}
  
	return xmlHttp; 
}
/************************************** end sponsored links *****************************************/
/************************************** start offers function ********************************************/
function offers_on(mapdir)
{
	var el = "";
	var chi = 's';
	var country = '';
	var l=1;
	if(mapdir){
		chi = 'd';
		country = get_country('dest_country');
	}
	else{
		country=get_country('country');
	}
	document.getElementById('off_con').innerHTML = country;
	document.getElementById('dc1').style.overflow.visible;
	document.getElementById('h3').style.display = "block";
	if(navigator.appName=="Netscape")
		document.getElementById('h3').style.display = "table";
	for(var t=1;t<6;t++)
	{
		while(document.getElementById('off_'+t+'_'+l))
		{
			var str='';
			var newStr='/search/results.php?q=';
			el = document.getElementById('off_'+t+'_'+l).innerHTML;
			str=el.split(" ");
			for(var j=0;j<str.length;j++){
				newStr+=str[j]+"+";
			}
			newStr += "in+	"+country+"&ch_id=maps_"+chi+"1&sp=1";
			document.getElementById('off_'+t+'_'+l).href = newStr;
			l++;
		}
		l=1;
	}
}
function clear_line()
{
	document.getElementById('search_keyword').value="";
}
/**************************************** end offers function ********************************************************/