		var html = "";
		var direction = "<div align=left  style='font-weight:bold; color:#FF0000' class=direction_name>Tìm đường đi: <a href=javascript:toHere() style=text-decoration: none>To here<\/a>"+
		" - <a href=javascript:fromHere() class=direction_name style=text-decoration: none>From here<\/a> <div>";
	function fromHere(){
		
		var fromHtml = "<form action=javascript:getDirectionFromHere() name=FROM>"+html+	"<div  align=left id=direction>";
		fromHtml += "<table border=0><tr><td width=95  class=direction_name style='font-weight:bold; color:#FF0000'>Direction:</td><td class=direction_name><a href=javascript:toHere()  class=direction_name style='font-weight:bold; color:#FF0000'>To here<\/a> - <b>From here<\/b><\/td><\/tr>";
		fromHtml += "<tr><td class=direction_name>End address:</td><td><input type=text name=toAddress id=toAddress style=width:120px; value=\"Địa chỉ của quý vị\" onfocus=\"this.value=''\" onblur=\"if(this.value=='')this.value=''\" class='form'><\/td><\/tr>";
		fromHtml += "<tr><td>&nbsp;</td><td><input type=submit value=\"Find\"  style=width:120px;  class='buttom_search'><\/td><\/tr><\/div><\/form>";		
 		document.getElementById('form_map').innerHTML=fromHtml;
	}

	function toHere(){
		var toHtml = "<form action=javascript:getDirectionToHere() name=TO>"+html;
		toHtml += "<table border=0><tr><td width=95 class=direction_name style='font-weight:bold; color:#FF0000'>Direction:</td><td class=direction_name><b>To here<\/b> - <a href=javascript:fromHere()  class=direction_name style='font-weight:bold; color:#FF0000'>From here<\/a>";
		toHtml += "<tr><td class=direction_name>Start address:</td><td><input type=text name=fromAddress id=fromAddress  style=width:120px; class='form' value=\"Địa chỉ của quý vị\" onfocus=\"this.value=''\" onblur=\"if(this.value=='')this.value=''\"><\/td><\/tr>";
		toHtml += "<tr><td>&nbsp;</td><td><input type=submit value=\"Find\"   style=width:120px; class='buttom_search'><\/td><\/tr><\/div><\/form>";
 		document.getElementById('form_map').innerHTML=toHtml;
	}
	function getDirectionToHere(){
		var fullAddressTo = address_;
		var fullAddressFrom = document.TO.fromAddress.value;
		if(fullAddressFrom=="Địa chỉ của quý vị"){
			fullAddressFrom=fullAddressTo;	
		}
	/*	if(fullAddressFrom.trim().equals("")){
			return;
		}*/
		fullAddressFrom = replaceAll(fullAddressFrom," ","+");
		fullAddressTo = replaceAll(fullAddressTo," ","+");
		var gohtml = "http://maps.google.com/maps?saddr="+fullAddressFrom+"&daddr="+fullAddressTo;
		open(gohtml,"GoogleMap", "toolbar=no,menubar=no,width=800,height=600,resizable=yes");
	}
	function getDirectionFromHere(){
		var fullAddressFrom = address_;
		var fullAddressTo = document.FROM.toAddress.value; 
		if(fullAddressTo=="Địa chỉ của quý vị"){
			fullAddressTo=fullAddressFrom;	
		}
		/*if(fullAddressTo.trim().equals("")){
			return;
		}*/
		fullAddressFrom = replaceAll(fullAddressFrom," ","+");
		fullAddressTo = replaceAll(fullAddressTo," ","+");
		var gohtml = "http://maps.google.com/maps?saddr="+fullAddressFrom+"&daddr="+fullAddressTo;
		open(gohtml,"GoogleMap", "toolbar=no,menubar=no,width=800,height=600,resizable=yes");

	}	
	
	function replaceAll(oldStr,findStr,repStr) {
  		var srchNdx = 0;

  		var newStr = ""; 
		while (oldStr.indexOf(findStr,srchNdx) != -1)  
  		{
	    	newStr += oldStr.substring(srchNdx,oldStr.indexOf(findStr,srchNdx));
            newStr += repStr;
            srchNdx = (oldStr.indexOf(findStr,srchNdx) + findStr.length);
            
  		}
  		newStr += oldStr.substring(srchNdx,oldStr.length);
		return newStr;
	}

