$(document).ready(function(){(gDom=whiich.unit.getDomIfExist('div#w-masthead'))&&whiich.module.masthead(gDom);(gDom=whiich.unit.getDomIfExist('div#w-search'))&&whiich.module.search(gDom)});whiich={};whiich.unit={getDomIfExist:function(xpath){var dom=$(xpath);return(dom.length>0)?dom:null}};whiich.config={searchUrl:'/server/search.php'};whiich.tmpVars={};whiich.common={autoComplete:function(modId,conId){var wDS=new YAHOO.widget.DS_XHR(whiich.config.searchUrl,['\n','\t']);wDS.responseType=YAHOO.widget.DS_XHR.TYPE_FLAT;var wAC=new YAHOO.widget.AutoComplete(modId,conId,wDS);wAC.maxResultsDisplayed=10;wAC.minQueryLength=3;wAC.queryDelay=0.3;wAC.highlightClassName='highlight';wAC.formatResult=function(oResultItem,sQuery){YAHOO.util.Dom.removeClass(document.getElementById(modId),'loading');var sKey=oResultItem[0];this.querystring=sQuery;return sKey.replace(sQuery,'<q>'+sQuery+'</q>')};YAHOO.widget.AutoComplete.prototype._sendQuery=function(sQuery){if(this.minQueryLength==-1){this._toggleContainer(false);YAHOO.log("Property minQueryLength is set to -1","info",this.toString());return}var aDelimChar=(this.delimChar)?this.delimChar:null;if(aDelimChar){var nDelimIndex=-1;for(var i=aDelimChar.length-1;i>=0;i--){var nNewIndex=sQuery.lastIndexOf(aDelimChar[i]);if(nNewIndex>nDelimIndex){nDelimIndex=nNewIndex}}if(aDelimChar[i]==" "){for(var j=aDelimChar.length-1;j>=0;j--){if(sQuery[nDelimIndex-1]==aDelimChar[j]){nDelimIndex--;break}}}if(nDelimIndex>-1){var nQueryStart=nDelimIndex+1;while(sQuery.charAt(nQueryStart)==" "){nQueryStart+=1}this._sSavedQuery=sQuery.substring(0,nQueryStart);sQuery=sQuery.substr(nQueryStart)}else if(sQuery.indexOf(this._sSavedQuery)<0){this._sSavedQuery=null}}if((sQuery&&(sQuery.length<this.minQueryLength))||(!sQuery&&this.minQueryLength>0)){if(this._nDelayID!=-1){clearTimeout(this._nDelayID)}this._toggleContainer(false);YAHOO.util.Dom.removeClass(document.getElementById(modId),'loading');YAHOO.log("Query \""+sQuery+"\" is too short","info",this.toString());return}sQuery=encodeURIComponent(sQuery);this._nDelayID=-1;sQuery=this.doBeforeSendQuery(sQuery);YAHOO.util.Dom.addClass(this._oTextbox,'loading');this.dataRequestEvent.fire(this,sQuery);YAHOO.log("Sending query \""+sQuery+"\"","info",this.toString());this.dataSource.getResults(this._populateList,sQuery,this)}},setDomsShowAndHide:function(target,doms,sw,css,speed){if(sw==undefined)sw=true;speed=speed||'slow';sw=sw?false:true;var css=sw?css[0]:css[1];$(target).removeClass().addClass(css);sw?$(doms).show(speed):$(doms).hide(speed);return sw},getFlashMovieByName:function(name){if($.browser.msie){return window[name]}else{return document[name]}},getDomByMcId:function(mcid){var dom=$('*[@mc='+mcid+']');return dom.length!=0?dom:null},worldHoverChangeCss:function(dom,tabDom,contDom){$(tabDom).filter('li').attr('class','TitleOff');$(dom).filter('li').attr('class','TitleOn');var index=strstr($(dom).attr('id'),'_');$(contDom).filter('div').css({'display':'none'});$('#tabadcontent'+index).filter('div').css({'display':'block'})},worldHover:function(tabDom,contDom){$(tabDom).hover(function(e){whiich.common.worldHoverChangeCss(e.target,tabDom,contDom);var targetName=$(this).text();var targetMcId=$(this).attr('mc');whiich.common.getFlashMovieByName("flashMap").callHighlight(targetMcId,targetName)},function(e){var targetName=$(this).text();var targetMcId=$(this).attr('mc');whiich.common.getFlashMovieByName("flashMap").callUnhighlight(targetMcId,targetName)})},showFlash:function(swf,width,height,vars,domId){var so=new SWFObject('/map/'+swf,"flashMap",width,height,"8","#ffffff");so.addParam("wmode","transparent");so.addParam("allowScriptAccess","always");so.addVariable("coIds",vars);so.write(domId)},gmap:{map:null,init:function(dom,lat,lon,zoom){$('body').unload(function(){GUnload()});var lat=lat||0;var lon=lon||0;var zoom=zoom||0;if(lat==0&&lon==0)return;if(!GBrowserIsCompatible())return;this.map=this.map||new GMap2(dom);this.map.addControl(new GLargeMapControl());this.map.addControl(new GMapTypeControl());this.map.addControl(new GOverviewMapControl());var point=new GLatLng(lat,lon);this.map.setCenter(point,zoom);var marker=new GMarker(point);this.map.addOverlay(marker)},locateByLatLng:function(lat,lon,zoom){if(!this.map)return;var point=new GLatLng(lat,lon);this.map.setCenter(point,zoom);var marker=new GMarker(point);this.map.addOverlay(marker)}}};whiich.module={masthead:function(subDom){var searchInput=subDom.find('input').get(0);var form=subDom.find('form').get(0);$(form).submit(function(){if($(searchInput).val()==''){return false}});whiich.common.autoComplete('s-keyword','s-tip')},search:function(subDom){var searchInput=subDom.find('input').get(0);var form=subDom.find('form').get(0);$(form).submit(function(){if($(searchInput).val()==''){return false}});whiich.common.autoComplete('s-keyword1','s-tip1')}};
