function showLayer( whichLayer, visible){ var elem, vis; if( document.getElementById ) elem = document.getElementById( whichLayer ); else if( document.all ) elem = document.all[whichLayer]; else if( document.layers ) elem = document.layers[whichLayer]; vis = elem.style; if(visible == null) { if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined) vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none'; vis.display = (vis.display==''||vis.display=='block')?'none':'block'; } else { vis.display = (visible==true)?'block':'none'; } } function setLayer(whichLayer) { if(whichLayer.indexOf('find_company_div')!=-1) { showLayer(whichLayer,true); showLayer('plan_route_div',false); } else { showLayer(whichLayer,true); showLayer('find_company_div',false); } } function getNearest(lat,lon,lang) { ajaxFunction('nearby','ajaxGetNearestEnities.php?lat='+lat+'&lon='+lon+'&lang='+lang); } function ajaxFunction(tagId, url) { var xmlhttp; if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else if (window.ActiveXObject){ // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } else { alert("Your browser does not support XMLHTTP!"); } xmlhttp.onreadystatechange=function() { if(xmlhttp.readyState==4) { document.getElementById(tagId).innerHTML = xmlhttp.responseText; } } xmlhttp.open("GET",url,true); xmlhttp.send(null); } $(document).ready(function(){ $("#keywords").autocomplete("ajax.getKeyword.php", { multiple: true, mustMatch: true, formatItem: function(row) { //chkKeyword("keyword"); return row[0]; } }); }); function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); } func(); } } }