
var G={SEARCH_URL:'/result.php',q:null,where:null,l:null,type:null};var Gle={lat:null,lang:null};var googleJS=new Array();var jsAddArr=new Array();var batch=new Array();var theme_url='';window.onerror=function(a,b,c)
{var s=a+' '+b+' '+c;if(window['console']){console.log(s);}
else
{}}
function var_dump(obj)
{var s='';for(var x in obj)
{s+="\n"+x+" : ";if('function'==typeof obj[x]){s+='function(){...}';}else{s+=obj[x].toString();}}}
String.prototype.trim=function(){return this.replace(/^\s+/,"").replace(/\s+$/,"");}
function $2(id){return document.getElementById(id);}
var Srch={txt:'Enter Keyword',onFocus:function()
{if(G.q)
{var q=G.q;q.value=q.value.trim();if(Srch.txt==q.value)
{q.value='';q.style.color='#000';}}},onBlur:function(){if(G.q){var q=G.q;q.value=q.value.trim();if(''==q.value)
{q.value=Srch.txt;q.style.color='#bebebe';}}}}
function Event(evt)
{this.e=null
this.target=null;this.tag='';this.text='';this.init=function()
{this.e=evt||window.event;if(null!=this.e)
{this.target=this.e.target||this.e.srcElement;this.tag=this.target.nodeName.toUpperCase();this.text=this.target.textContent||this.target.innerText;}};this.StopPropagation=function()
{var e=this.e;if(e&&e.stopPropagation)e.stopPropagation();else if(window.event)window.event.cancelBubble=true;};this.init(evt);}
function parseURL(url){var a=document.createElement('a');a.href=url;return{host:a.hostname,params:(function(){var ret={},seg=a.search.replace(/^\?/,'').split('&'),len=seg.length,i=0,s;for(;i<len;i++){if(!seg[i]){continue;}
s=seg[i].split('=');ret[s[0]]=unescape(s[1]);}
return ret;})()};}
function jscss(o,c1,a,c2)
{a=a||'add';c2=c2||'';switch(a){case'swap':o.className=!jscss(o,c1,'check')?o.className.replace(c2,c1):o.className.replace(c1,c2);break;case'add':if(!jscss(o,c1,'check')){o.className+=o.className?' '+c1:c1;}
break;case'remove':var rep=o.className.match(' '+c1)?' '+c1:c1;o.className=o.className.replace(rep,'');break;case'check':return new RegExp('\\b'+c1+'\\b').test(o.className)
break;}}
var tab={tabCount:0,tabPar:null,conPar:null,init:function()
{this.tabPar=$2('div_parent_tab');this.conPar=$2('div_parent_content');if(this.conPar)
{this.tabCount=this.conPar.childNodes.length;}},getId:function(q,tp,lc)
{var eq=escape(unescape(q.trim()).replace(/ /g,'+'));lc=lc||'';if('local'==tp)
{if(''==lc)
{lc=$2('l').value;}
lc='_'+lc+'_';}
else
{lc='';}
var ret={'tid':'div_'+eq+'_'+tp+lc+'_tab','cid':'div_'+eq+'_'+tp+lc+'_child_content'};return ret;},remove:function(q,tp,lc)
{lc=lc||'';if(1>=this.tabCount)
{return;}
var aid=this.getId(q,tp,lc);var ot=document.getElementById(aid['tid']);var oc=document.getElementById(aid['cid']);var activateFirst=false;if(jscss(ot,'cur','check'))
{activateFirst=true;}
var p=ot.parentNode;p.removeChild(ot);p=oc.parentNode;p.removeChild(oc);this.tabCount--;this.setCloseLink();if(activateFirst)
{this.activateFirst();}},activateFirst:function()
{if(Ajax.loading)
{return false;}
var o=this.tabPar.getElementsByTagName('DIV');if(o)
{if(0<o.length)
{var id=o[0].id
var ar=id.split('_');if(2<=ar.length)
{tab.activate(ar[1],ar[2]);}}}},add:function(q,tp,h)
{q=q.trim();if(Srch.txt==q)
{return false;}
var aid=this.getId(q,tp);this.setTitle(q,tp,aid['tid']);this.setContent(q,tp,aid['cid'],h);document.getElementById(aid['tid']).style.background='transparent';this.activate(q,tp);},setTitle:function(q,tp,tid)
{var ot=$2(tid);if(null==ot)
{ot=document.createElement('div');ot.id=tid;ot.className='tab';ot.style.float='left';if(7<q.length)
{q=q.substring(0,7)+'...';}
var h='';h+='<div class="s'+tp+'"><div class="selected_text">';h+='<a onclick="return oncloseTab(this)" href="#close" class="ra">x</a>';h+='<a onclick="return onclickTab(this);" href="#open" class="la">'+q+'</a>';h+='</div></div>';ot.innerHTML=h;this.tabPar.appendChild(ot);this.tabCount++;this.setCloseLink();}
return ot;},setContent:function(q,tp,cid,h)
{var oc=$2(cid);if(null==oc)
{oc=document.createElement('div');}
oc.style.display='none';oc.id=cid;oc.className="div_child_content";oc.innerHTML=h;this.conPar.appendChild(oc);return oc;},activate:function(q,tp,lc)
{lc=lc||'';if(tp=='local')
{document.getElementById('map_what').value=q;var str=document.getElementById('map_what').value;var str1=str.replace(' ','+');document.getElementById('map_what').value=str1;if(lc=='')
{document.getElementById('map_where').value=G.where.value;}
else
{document.getElementById('map_where').value=lc;}}
if(Ajax.loading&&tp=='local')
{return false;}
var aid=this.getId(q,tp,lc);var l=this.conPar.childNodes.length;var i=0;for(i=0;i<l;i++)
{if('DIV'==this.conPar.childNodes[i].nodeName)
{if(aid['cid']==this.conPar.childNodes[i].id)
{this.conPar.childNodes[i].style.display='';}
else
{this.conPar.childNodes[i].style.display='none';}}}
var l=this.tabPar.childNodes.length;var i=0;for(i=0;i<l;i++)
{if('DIV'==this.tabPar.childNodes[i].nodeName)
{if(aid['tid']==this.tabPar.childNodes[i].id)
{jscss(this.tabPar.childNodes[i],'cur','add');}
else
{jscss(this.tabPar.childNodes[i],'cur','remove');}}}},addAjaxResp:function(q,tp,p,makeNewCall,url)
{G.q.focus();if(tp=='local')
{document.getElementById('l').blur();}
p=p||1;q=q||'';var qt=G.qt.value;makeNewCall=makeNewCall||false;var url=url||G.SEARCH_URL+'?';q=q.trim();if((''==q)||(Srch.txt==q))
{return;}
if((null==this.tabPar)||(null==this.conPar))
{this.init();}
if((null==this.tabPar)||(null==this.conPar))
{if(tp!='local')
{location.href=url+'q='+encodeURIComponent(q)+'&type='+tp+'&qt='+qt+'&rs=1';}
else
{var l=G.where.value.trim();if(l=='')
{l='us';}
location.href=url+'q='+encodeURIComponent(q)+'&type='+tp+'&qt='+qt+'&rs=1&where='+l;}
return;}
var aid=this.getId(q,tp);var ajxLoader='<div class="xhr">&nbsp;</div>';if(null==$2(aid['cid']))
{this.add(q,tp,ajxLoader);makeNewCall=true;}
if(makeNewCall)
{var rp={};rp['q']=q;rp['type']=tp;rp['ajax']=1;rp['p']=p;if(tp=='local')
{rp['where']=G.where.value.trim();if(rp['where'].toLowerCase()=='where')
{}
rp['PI']=p;}
rp['qt']=qt;rp['dt']=new Date().getTime();rp['s']=1;var arrtmp=parseURL(url);if(null!=arrtmp.params)
{for(var kk in arrtmp.params)
{rp[kk]=arrtmp.params[kk];}}
$2(aid['cid']).innerHTML=ajxLoader;Ajax.updater(url,rp,aid['cid']);}
else
{tab.activate(q,tp);}},setCloseLink:function()
{switch(this.tabCount)
{case 1:jscss(this.tabPar.childNodes[0],'single','add');break;case 2:jscss(this.tabPar.childNodes[0],'single','remove');break;default:}}};var Ajax={loading:false,updater:function(url,param,id)
{var x=this.getXHR(),k,sparam='';Ajax.loading=true;url=url.trim();if('?'!=url.substr(url.length-1,2))
{url+='?';}
else
{url+='&';}
for(k in param)
{sparam+=encodeURIComponent(k)+'='+encodeURIComponent(param[k])+'&';}
x.open("GET",url+sparam,true);x.onreadystatechange=function()
{if(x.readyState==4)
{var js,i,l,c=$2(id);c.innerHTML=x.responseText;window['js']=js=c.getElementsByTagName('pre')
l=0+js.length;var browserName=navigator.appName;for(i=0;i<l;i++)
{try
{if(browserName=="Microsoft Internet Explorer")
{js[i].innerText=js[i].innerText.replace('&lt;','<').replace('&gt;','>');eval(js[i].innerText);}
else
{js[i].textContent=js[i].textContent.replace('&lt;','<').replace('&gt;','>');eval(js[i].textContent);}}
catch(e)
{var_dump(e);}}
Ajax.loading=false;}}
x.setRequestHeader("Content-type","application/x-www-form-urlencoded");x.send(sparam);},getXHR:function()
{var o=false;if(window.XMLHttpRequest&&!(window.ActiveXObject))
{try
{o=new XMLHttpRequest();}
catch(e)
{o=false;}}
else if(window.ActiveXObject)
{try
{o=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e)
{try
{o=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e)
{o=false;}}}
return o;}};function onclickTab(obj)
{G.q.focus();var ar=obj.parentNode.parentNode.parentNode.id.split('_');ar[3]=ar[3]||'';tab.activate(ar[1],ar[2],ar[3]);if(Ajax.loading)
{var tabLen=document.getElementById('div_parent_content').childNodes.length;var CurrTabId=document.getElementById('div_parent_content').childNodes[tabLen-1].id;var ttt=CurrTabId.split('_');what=ttt[1];where=ttt[3];tab.activate(what,ar[2],where);}
return false;}
function oncloseTab(obj)
{var ar=obj.parentNode.parentNode.parentNode.id.split('_');ar[3]=ar[3]||'';tab.remove(ar[1],ar[2],ar[3]);return false;}
function onclickGo()
{if(G.q.value=="Enter Keyword"||G.q.value=="What")
{return false;}
if(G.where.value==" "||G.where.value=="Where")
{return false;}
var q=G.q;q.value=q.value.trim();if(''!=q.value)
{tab.addAjaxResp(q.value,G.type.value);}
return false;}
function hideshow(id,vsb)
{var i=id;var v=vsb;document.getElementById(i).style.display=v;}
function onclickLink(obj,tp)
{var defValue='';if(((G.q.value=="Enter Keyword")&&(tp=='local'))||((G.q.value=="What")&&(tp!='local')))
{G.q.value='';G.q.focus();}
var w=G.where.value;if(w.toLowerCase()=='where'&&tp=='local')
{return false;}
if(tp!='local')
{defValue='Enter Keyword';}
else
{defValue='What';}
var tp='';document.getElementById('frm').className='frm_web';document.getElementById("nolocal").className="vi qw";document.getElementById("q").className="vi cinput";document.getElementById("cap1").innerHTML='&nbsp;';document.getElementById("cap2").innerHTML='&nbsp;';$2('lc').style.display='none';switch(obj.id)
{case'ai':tp='image';break;case'av':tp='video';break;case'al':tp='local';document.getElementById('frm').className='frm_'+tp;$2('lc').style.display='block';document.getElementById('nolocal').className='';document.getElementById("q").className="vi winput";document.getElementById("cap1").innerHTML='(Business, Products and Services)';document.getElementById("cap2").innerHTML='(city,&nbsp;state&nbsp;or&nbsp;zip)';defValue='What';break;case'tw':tp='twitter';break;case'aw':default:tp='web';break;}
G.def.q.setDefText(defValue);G.ai.focus();G.q.focus();G.ai.style['fontWeight']=('ai'==obj.id)?'bold':'normal';G.av.style['fontWeight']=('av'==obj.id)?'bold':'normal';G.al.style['fontWeight']=('al'==obj.id)?'bold':'normal';G.aw.style['fontWeight']=('aw'==obj.id)?'bold':'normal';G.tw.style['fontWeight']=('tw'==obj.id)?'bold':'normal';G.type.value=tp;G.q.value=G.q.value.trim();if(tp!='local'&&G.q.value!='What'&&G.q.value!="Enter Keyword")
{tab.addAjaxResp(G.q.value,tp);}
else if(G.q.value!='What'&&G.q.value!="Enter Keyword")
{tab.addAjaxResp(G.q.value,tp);}
return false;}
function onclkRelQ(evt)
{var ret=true,e=new Event(evt);var q='';if(null!=e.target)
{if('A'==e.tag)
{if(''==e.target.className)
{if(G.type.value!='local')
{q=e.text;tab.addAjaxResp(q,G.type.value);}
else
{q=G.q.value;tab.addAjaxResp(q,G.type.value,1,true,e.target.href);}
e.StopPropagation();e=null;}}
ret=false;}
return false;}
function moreLess(obj,id)
{if('more'==obj.className)
{$2(id).style.display='';obj.className='less';obj.innerHTML=obj.innerHTML.replace('More','Less');}
else
{$2(id).style.display='none';obj.className='more';obj.innerHTML=obj.innerHTML.replace('Less','More');}
return false;}
function onclkPgn(evt)
{var ret=true,e=new Event(evt);if(null!=e.target)
{if('A'==e.tag)
{var aurl=parseURL(e.target.href);var tp=aurl['params']['type']||G.type.value;if(tp=='local')
{var PI=aurl['params']['PI']||1;tab.addAjaxResp(aurl['params']['q'],tp,aurl['params']['PI'],true);}
else
{var p=aurl['params']['p']||1;tab.addAjaxResp(aurl['params']['q'],tp,aurl['params']['p'],true);}
e.StopPropagation();e=null;ret=false;}}
return ret;}
function screenLockUnloack(show_flag,url,aw,ah)
{var l1=window['l1']||document.getElementById("l1");var l2=window['l2']||document.getElementById("l2");if(!l1)
{l1=document.createElement('DIV');l1['id']='l1';l1['className']='l1';document.body.appendChild(l1);l2=document.createElement('DIV');l2['id']='l2';l2['className']='l2';document.body.appendChild(l2);}
window['l1']=l1;window['l2']=l2;if(show_flag)
{$2('q').focus();l2['innerHTML']='<iframe src="'+url+'"  width="'+aw+'" scrolling="no" height="'+ah+'" frameborder="0"></iframe>';var w=screen.availWidth,h=screen.availHeight;var ml=((w-aw)/2),mt=100;var scrolly=typeof window.pageYOffset!='undefined'?window.pageYOffset:document.documentElement.scrollTop;var scrollx=typeof window.pageXOffset!='undefined'?window.pageXOffset:document.documentElement.scrollLeft;l2.style.top=(scrolly+mt)+"px";l2.style.left=ml+"px";l2.style.display="block";l1.style.width=w+"px";l1.style.height=h+"px";l1.style.display="block";}
else
{l1.style.display='none';l2.style.display='none';}}
function onOvrRQ(evt)
{var ret=true,e=new Event(evt);if(null!=e.target)
{if('A'==e.tag)
{var t=e.target;if('more'!=t.className)
{var a=parseURL(t.href);if(a.params.q)
{a.params.q=a.params.q.replace(/\+/g,' ');t.setAttribute('alt',a.params.q);t.setAttribute('title',a.params.q);}}}}}
function selectMarker(index,what,where)
{what=what||'';where=where||'';if(what==''||where=='')
{var what=document.getElementById('map_what').value;var where=document.getElementById('map_where').value;}
var host=window.location.hostname;var prefixImgId=""+theme_url+""+'/num/';what=what.replace(' ','+');var jsIndex=what+'_'+where;if(index<=99){var imgId=prefixImgId+index+'-hover.gif';}
else{var imgId=prefixImgId+'dot'+'-hover.gif';}
if(batch[jsIndex][index])
{batch[jsIndex][index].setImage(imgId);batch[jsIndex][index].openInfoWindowHtml('<b>'+'<font color=\'#1365AB\'>'+jsAddArr[jsIndex][index]['company_name']+'</font></b>'+'<br><br>'+jsAddArr[jsIndex][index]['address']);}
var divId='resultDiv-biz'+what+where+index;var browserName=navigator.appName;if(browserName=="Microsoft Internet Explorer")
{document.getElementById(divId).className='result-box-over';}
else
{document.getElementById(divId).setAttribute('class','result-box-over');}}
function unSelectMarker(index,what,where)
{what=what||'';where=where||'';if(what==''||where=='')
{var what=document.getElementById('map_what').value;var where=document.getElementById('map_where').value;}
var host=window.location.hostname;var prefixImgId=""+theme_url+""+'/num/';what=what.replace(' ','+');var jsIndex=what+'_'+where;if(index<=99){var imgId=prefixImgId+index+'.gif';}
else{var imgId=prefixImgId+'dot'+'.gif';}
if(batch[jsIndex][index])
{batch[jsIndex][index].setImage(imgId);batch[jsIndex][index].closeInfoWindow();}
var divId='resultDiv-biz'+what+where+index;var browserName=navigator.appName;if(browserName=="Microsoft Internet Explorer")
{document.getElementById(divId).className='result-box-over';}
else{document.getElementById(divId).setAttribute('class','result-box');}}
function loadMaps()
{google.load('maps','2',{'callback':mapsLoaded});}
function mapsLoaded()
{var gmapId='';var what=document.getElementById('map_what').value;var where=document.getElementById('map_where').value;var tabLen=document.getElementById('div_parent_content').childNodes.length;var CurrTabId=document.getElementById('div_parent_content').childNodes[tabLen-1].id;var ttt=CurrTabId.split('_');what=ttt[1];where=ttt[3];what=what.replace(' ','+');var jsIndex=what+'_'+where;gmapId=document.getElementById('googleMapId_'+what+'_'+where).value;var map=new google.maps.Map2(document.getElementById(gmapId));var latLng=document.getElementById('lat_'+what+'_'+where).value;var brokenstring=latLng.split(",");var baseIcon=new GIcon(G_DEFAULT_ICON);baseIcon.iconSize=new GSize(17,17);baseIcon.shadowSize=new GSize(37,34);baseIcon.iconAnchor=new GPoint(9,34);baseIcon.infoWindowAnchor=new GPoint(9,2);map.addControl(new GSmallMapControl());for(var m in jsAddArr[jsIndex])
{var mb=createMarkerAjax(new GLatLng(jsAddArr[jsIndex][m]['latitude'],jsAddArr[jsIndex][m]['longitude']),m,baseIcon,what,where);if(!batch[jsIndex]){batch[jsIndex]=new Array();}
batch[jsIndex][m]=mb;map.addOverlay(mb);var resultBox='';resultBox=document.getElementById(jsAddArr[jsIndex][m]['divId']);if(resultBox)
{var browserName=navigator.appName;if(browserName=="Microsoft Internet Explorer")
{if(navigator.appVersion>=8)
{resultBox.setAttribute('onMouseOver',"new Function(selectMarker("+m+"))");resultBox.setAttribute('onMouseOut',"new Function(unSelectMarker("+m+"))");}
else
{function createOnclick(scope_)
{var scope=scope_;var callMe=function()
{selectMarker(scope);};return callMe;};resultBox.onmouseover=createOnclick(m);}}
else
{resultBox.setAttribute('onMouseOver',"new Function(selectMarker("+m+"))");resultBox.setAttribute('onMouseOut',"new Function(unSelectMarker("+m+"))");}}}
map.setCenter(new google.maps.LatLng(brokenstring[0],brokenstring[1]),13);}
function createMarkerAjax(point,index,baseIcon,what,where)
{var letter=1;var host=window.location.hostname;var imagesPrefix=""+theme_url+""+'/num/';var what=what.replace(' ','');var jsIndex=what+'_'+where;var letteredIcon=new GIcon(baseIcon);if(index<=99)
{letteredIcon.image=imagesPrefix+index+'.gif';}
else
{letteredIcon.image=imagesPrefix+'dot'+'.gif';}
markerOptions={icon:letteredIcon};var marker=new GMarker(point,markerOptions);GEvent.addListener(marker,'mouseover',function()
{var windowHTML=('<b>'+'<font color=\'#1365AB\'>'+jsAddArr[jsIndex][index]['company_name']+'</font></b>'+'<br><br>'+jsAddArr[jsIndex][index]['address']);marker.openInfoWindowHtml(windowHTML);selectMarker(index,what,where);});GEvent.addListener(marker,'mouseout',function()
{unSelectMarker(index,what,where);});GEvent.addListener(marker,'click',function()
{window.open(jsAddArr[jsIndex][index]['url'],'mywindow',menubar=1,resizable=1,width=350,height=250);});return marker;}
function sfhover2(li)
{li.className+=" sfhover";}
function sfout2(li)
{li.className=li.className.replace(new RegExp(" sfhover\\b"),"");}
var Defaultvalue=function(txt,id)
{var txt,obj;this.init=function(txt,id)
{this.txt=txt;this.obj=$2(id);var this2=this;this.obj.onfocus=function(){this2.onFocus();}
this.obj.onblur=function(){this2.onBlur();}};this.onFocus=function()
{this.obj.value=this.obj.value.trim();if(this.txt==this.obj.value)
{this.obj.value='';this.obj.style.color='#000';}};this.onBlur=function()
{this.obj.value=this.obj.value.trim();if(''==this.obj.value)
{this.obj.value=this.txt;this.obj.style.color='#bebebe';}};this.setDefText=function(txt)
{this.txt=txt;}
this.init(txt,id);}
