// http://map.bkkpages.com/script/yui/yahoo-min.js
/* Copyright (c) 2006, Yahoo! Inc. All rights reserved.Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt Version: 0.11.4*/ if(typeof YAHOO=="undefined"){YAHOO={};}YAHOO.namespace=function(ns){if(!ns||!ns.length){return null;}var _2=ns.split(".");var _3=YAHOO;for(var i=(_2[0]=="YAHOO")?1:0;i<_2.length;++i){_3[_2[i]]=_3[_2[i]]||{};_3=_3[_2[i]];}return _3;};YAHOO.log=function(_5,_6,_7){var l=YAHOO.widget.Logger;if(l&&l.log){return l.log(_5,_6,_7);}else{return false;}};YAHOO.extend=function(_9,_10){var f=function(){};f.prototype=_10.prototype;_9.prototype=new f();_9.prototype.constructor=_9;_9.superclass=_10.prototype;if(_10.prototype.constructor==Object.prototype.constructor){_10.prototype.constructor=_10;}};YAHOO.namespace("util");YAHOO.namespace("widget");YAHOO.namespace("example");

// http://map.bkkpages.com/script/yui/dom-min.js
/* Copyright (c) 2006, Yahoo! Inc. All rights reserved.  Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt Version: 0.11.3 */ YAHOO.util.Dom=function(){var ua=navigator.userAgent.toLowerCase();var isOpera=(ua.indexOf('opera')>-1);var isSafari=(ua.indexOf('safari')>-1);var isIE=(window.ActiveXObject);var id_counter=0;var util=YAHOO.util;var property_cache={};var toCamel=function(property){var convert=function(prop){var test=/(-[a-z])/i.exec(prop);return prop.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());};while(property.indexOf('-')>-1){property=convert(property);}return property;};var toHyphen=function(property){if(property.indexOf('-')>-1){return property;}var converted='';for(var i=0,len=property.length;i<len;++i){if(property.charAt(i)==property.charAt(i).toUpperCase()){converted=converted+'-'+property.charAt(i).toLowerCase();}else{converted=converted+property.charAt(i);}}return converted;};var cacheConvertedProperties=function(property){property_cache[property]={camel:toCamel(property),hyphen:toHyphen(property)};};return{get:function(el){if(!el){return null;}if(typeof el!='string'&&!(el instanceof Array)){return el;}if(typeof el=='string'){return document.getElementById(el);}else{var collection=[];for(var i=0,len=el.length;i<len;++i){collection[collection.length]=util.Dom.get(el[i]);}return collection;}return null;},getStyle:function(el,property){var f=function(el){var value=null;var dv=document.defaultView;if(!property_cache[property]){cacheConvertedProperties(property);}var camel=property_cache[property]['camel'];var hyphen=property_cache[property]['hyphen'];if(property=='opacity'&&el.filters){value=1;try{value=el.filters.item('DXImageTransform.Microsoft.Alpha').opacity/100;}catch(e){try{value=el.filters.item('alpha').opacity/100;}catch(e){}}}else if(el.style[camel]){value=el.style[camel];}else if(isIE&&el.currentStyle&&el.currentStyle[camel]){value=el.currentStyle[camel];}else if(dv&&dv.getComputedStyle){var computed=dv.getComputedStyle(el,'');if(computed&&computed.getPropertyValue(hyphen)){value=computed.getPropertyValue(hyphen);}}return value;};return util.Dom.batch(el,f,util.Dom,true);},setStyle:function(el,property,val){if(!property_cache[property]){cacheConvertedProperties(property);}var camel=property_cache[property]['camel'];var f=function(el){switch(property){case'opacity':if(isIE&&typeof el.style.filter=='string'){el.style.filter='alpha(opacity='+val*100+')';if(!el.currentStyle||!el.currentStyle.hasLayout){el.style.zoom=1;}}else{el.style.opacity=val;el.style['-moz-opacity']=val;el.style['-khtml-opacity']=val;}break;default:el.style[camel]=val;}};util.Dom.batch(el,f,util.Dom,true);},getXY:function(el){var f=function(el){if(el.offsetParent===null||this.getStyle(el,'display')=='none'){return false;}var parentNode=null;var pos=[];var box;if(el.getBoundingClientRect){box=el.getBoundingClientRect();var doc=document;if(!this.inDocument(el)&&parent.document!=document){doc=parent.document;if(!this.isAncestor(doc.documentElement,el)){return false;}}var scrollTop=Math.max(doc.documentElement.scrollTop,doc.body.scrollTop);var scrollLeft=Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft);return[box.left+scrollLeft,box.top+scrollTop];}else{pos=[el.offsetLeft,el.offsetTop];parentNode=el.offsetParent;if(parentNode!=el){while(parentNode){pos[0]+=parentNode.offsetLeft;pos[1]+=parentNode.offsetTop;parentNode=parentNode.offsetParent;}}if(isSafari&&this.getStyle(el,'position')=='absolute'){pos[0]-=document.body.offsetLeft;pos[1]-=document.body.offsetTop;}}if(el.parentNode){parentNode=el.parentNode;}else{parentNode=null;}while(parentNode&&parentNode.tagName.toUpperCase()!='BODY'&&parentNode.tagName.toUpperCase()!='HTML'){if(util.Dom.getStyle(parentNode,'display')!='inline'){pos[0]-=parentNode.scrollLeft;pos[1]-=parentNode.scrollTop;}if(parentNode.parentNode){parentNode=parentNode.parentNode;}else{parentNode=null;}}return pos;};return util.Dom.batch(el,f,util.Dom,true);},getX:function(el){var f=function(el){return util.Dom.getXY(el)[0];};return util.Dom.batch(el,f,util.Dom,true);},getY:function(el){var f=function(el){return util.Dom.getXY(el)[1];};return util.Dom.batch(el,f,util.Dom,true);},setXY:function(el,pos,noRetry){var f=function(el){var style_pos=this.getStyle(el,'position');if(style_pos=='static'){this.setStyle(el,'position','relative');style_pos='relative';}var pageXY=this.getXY(el);if(pageXY===false){return false;}var delta=[parseInt(this.getStyle(el,'left'),10),parseInt(this.getStyle(el,'top'),10)];if(isNaN(delta[0])){delta[0]=(style_pos=='relative')?0:el.offsetLeft;}if(isNaN(delta[1])){delta[1]=(style_pos=='relative')?0:el.offsetTop;}if(pos[0]!==null){el.style.left=pos[0]-pageXY[0]+delta[0]+'px';}if(pos[1]!==null){el.style.top=pos[1]-pageXY[1]+delta[1]+'px';}var newXY=this.getXY(el);if(!noRetry&&(newXY[0]!=pos[0]||newXY[1]!=pos[1])){this.setXY(el,pos,true);}};util.Dom.batch(el,f,util.Dom,true);},setX:function(el,x){util.Dom.setXY(el,[x,null]);},setY:function(el,y){util.Dom.setXY(el,[null,y]);},getRegion:function(el){var f=function(el){var region=new YAHOO.util.Region.getRegion(el);return region;};return util.Dom.batch(el,f,util.Dom,true);},getClientWidth:function(){return util.Dom.getViewportWidth();},getClientHeight:function(){return util.Dom.getViewportHeight();},getElementsByClassName:function(className,tag,root){var method=function(el){return util.Dom.hasClass(el,className)};return util.Dom.getElementsBy(method,tag,root);},hasClass:function(el,className){var re=new RegExp('(?:^|\\s+)'+className+'(?:\\s+|$)');var f=function(el){return re.test(el['className']);};return util.Dom.batch(el,f,util.Dom,true);},addClass:function(el,className){var f=function(el){if(this.hasClass(el,className)){return;}el['className']=[el['className'],className].join(' ');};util.Dom.batch(el,f,util.Dom,true);},removeClass:function(el,className){var re=new RegExp('(?:^|\\s+)'+className+'(?:\\s+|$)','g');var f=function(el){if(!this.hasClass(el,className)){return;}var c=el['className'];el['className']=c.replace(re,' ');if(this.hasClass(el,className)){this.removeClass(el,className);}};util.Dom.batch(el,f,util.Dom,true);},replaceClass:function(el,oldClassName,newClassName){if(oldClassName===newClassName){return false;};var re=new RegExp('(?:^|\\s+)'+oldClassName+'(?:\\s+|$)','g');var f=function(el){if(!this.hasClass(el,oldClassName)){this.addClass(el,newClassName);return;}el['className']=el['className'].replace(re,' '+newClassName+' ');if(this.hasClass(el,oldClassName)){this.replaceClass(el,oldClassName,newClassName);}};util.Dom.batch(el,f,util.Dom,true);},generateId:function(el,prefix){prefix=prefix||'yui-gen';el=el||{};var f=function(el){if(el){el=util.Dom.get(el);}else{el={};}if(!el.id){el.id=prefix+id_counter++;}return el.id;};return util.Dom.batch(el,f,util.Dom,true);},isAncestor:function(haystack,needle){haystack=util.Dom.get(haystack);if(!haystack||!needle){return false;}var f=function(needle){if(haystack.contains&&!isSafari){return haystack.contains(needle);}else if(haystack.compareDocumentPosition){return!!(haystack.compareDocumentPosition(needle)&16);}else{var parent=needle.parentNode;while(parent){if(parent==haystack){return true;}else if(!parent.tagName||parent.tagName.toUpperCase()=='HTML'){return false;}parent=parent.parentNode;}return false;}};return util.Dom.batch(needle,f,util.Dom,true);},inDocument:function(el){var f=function(el){return this.isAncestor(document.documentElement,el);};return util.Dom.batch(el,f,util.Dom,true);},getElementsBy:function(method,tag,root){tag=tag||'*';root=util.Dom.get(root)||document;var nodes=[];var elements=root.getElementsByTagName(tag);if(!elements.length&&(tag=='*'&&root.all)){elements=root.all;}for(var i=0,len=elements.length;i<len;++i){if(method(elements[i])){nodes[nodes.length]=elements[i];}}return nodes;},batch:function(el,method,o,override){var id=el;el=util.Dom.get(el);var scope=(override)?o:window;if(!el||el.tagName||!el.length){if(!el){return false;}return method.call(scope,el,o);}var collection=[];for(var i=0,len=el.length;i<len;++i){if(!el[i]){id=id[i];}collection[collection.length]=method.call(scope,el[i],o);}return collection;},getDocumentHeight:function(){var scrollHeight=-1,windowHeight=-1,bodyHeight=-1;var marginTop=parseInt(util.Dom.getStyle(document.body,'marginTop'),10);var marginBottom=parseInt(util.Dom.getStyle(document.body,'marginBottom'),10);var mode=document.compatMode;if((mode||isIE)&&!isOpera){switch(mode){case'CSS1Compat':scrollHeight=((window.innerHeight&&window.scrollMaxY)?window.innerHeight+window.scrollMaxY:-1);windowHeight=[document.documentElement.clientHeight,self.innerHeight||-1].sort(function(a,b){return(a-b);})[1];bodyHeight=document.body.offsetHeight+marginTop+marginBottom;break;default:scrollHeight=document.body.scrollHeight;bodyHeight=document.body.clientHeight;}}else{scrollHeight=document.documentElement.scrollHeight;windowHeight=self.innerHeight;bodyHeight=document.documentElement.clientHeight;}var h=[scrollHeight,windowHeight,bodyHeight].sort(function(a,b){return(a-b);});return h[2];},getDocumentWidth:function(){var docWidth=-1,bodyWidth=-1,winWidth=-1;var marginRight=parseInt(util.Dom.getStyle(document.body,'marginRight'),10);var marginLeft=parseInt(util.Dom.getStyle(document.body,'marginLeft'),10);var mode=document.compatMode;if(mode||isIE){switch(mode){case'CSS1Compat':docWidth=document.documentElement.clientWidth;bodyWidth=document.body.offsetWidth+marginLeft+marginRight;break;default:bodyWidth=document.body.clientWidth;docWidth=document.body.scrollWidth;break;}}else{docWidth=document.documentElement.clientWidth;bodyWidth=document.body.offsetWidth+marginLeft+marginRight;}var w=Math.max(docWidth,bodyWidth);return w;},getViewportHeight:function(){var height=-1;var mode=document.compatMode;if((mode||isIE)&&!isOpera){switch(mode){case'CSS1Compat':height=document.documentElement.clientHeight;break;default:height=document.body.clientHeight;}}else{height=self.innerHeight;}return height;},getViewportWidth:function(){var width=-1;var mode=document.compatMode;if(mode||isIE){switch(mode){case'CSS1Compat':width=document.documentElement.clientWidth;break;default:width=document.body.clientWidth;}}else{width=self.innerWidth;}return width;}};}();YAHOO.util.Region=function(t,r,b,l){this.top=t;this[1]=t;this.right=r;this.bottom=b;this.left=l;this[0]=l;};YAHOO.util.Region.prototype.contains=function(region){return(region.left>=this.left&&region.right<=this.right&&region.top>=this.top&&region.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(region){var t=Math.max(this.top,region.top);var r=Math.min(this.right,region.right);var b=Math.min(this.bottom,region.bottom);var l=Math.max(this.left,region.left);if(b>=t&&r>=l){return new YAHOO.util.Region(t,r,b,l);}else{return null;}};YAHOO.util.Region.prototype.union=function(region){var t=Math.min(this.top,region.top);var r=Math.max(this.right,region.right);var b=Math.max(this.bottom,region.bottom);var l=Math.min(this.left,region.left);return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}");};YAHOO.util.Region.getRegion=function(el){var p=YAHOO.util.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Point=function(x,y){if(x instanceof Array){y=x[1];x=x[0];}this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y;};YAHOO.util.Point.prototype=new YAHOO.util.Region();

 // http://map.bkkpages.com/script/yui/event-min.js
 /* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License:http://developer.yahoo.net/yui/license.txt Version: 0.11.4*/ YAHOO.util.CustomEvent=function(_1,_2,_3){this.type=_1;this.scope=_2||window;this.silent=_3;this.subscribers=[];if(!this.silent){}};YAHOO.util.CustomEvent.prototype={subscribe:function(fn,_5,_6){this.subscribers.push(new YAHOO.util.Subscriber(fn,_5,_6));},unsubscribe:function(fn,_7){var _8=false;for(var i=0,len=this.subscribers.length;i<len;++i){var s=this.subscribers[i];if(s&&s.contains(fn,_7)){this._delete(i);_8=true;}}return _8;},fire:function(){var len=this.subscribers.length;if(!len&&this.silent){return;}var _12=[];for(var i=0;i<arguments.length;++i){_12.push(arguments[i]);}if(!this.silent){}for(i=0;i<len;++i){var s=this.subscribers[i];if(s){if(!this.silent){}var _13=(s.override)?s.obj:this.scope;s.fn.call(_13,this.type,_12,s.obj);}}},unsubscribeAll:function(){for(var i=0,len=this.subscribers.length;i<len;++i){this._delete(len-1-i);}},_delete:function(_14){var s=this.subscribers[_14];if(s){delete s.fn;delete s.obj;}this.subscribers.splice(_14,1);},toString:function(){return "CustomEvent: "+"'"+this.type+"', "+"scope: "+this.scope;}};YAHOO.util.Subscriber=function(fn,obj,_16){this.fn=fn;this.obj=obj||null;this.override=(_16);};YAHOO.util.Subscriber.prototype.contains=function(fn,obj){return (this.fn==fn&&this.obj==obj);};YAHOO.util.Subscriber.prototype.toString=function(){return "Subscriber { obj: "+(this.obj||"")+", override: "+(this.override||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var _17=false;var _18=[];var _19=[];var _20=[];var _21=[];var _22=[];var _23=0;var _24=[];var _25=[];var _26=0;return {POLL_RETRYS:200,POLL_INTERVAL:50,EL:0,TYPE:1,FN:2,WFN:3,SCOPE:3,ADJ_SCOPE:4,isSafari:(/Safari|Konqueror|KHTML/gi).test(navigator.userAgent),isIE:(!this.isSafari&&!navigator.userAgent.match(/opera/gi)&&navigator.userAgent.match(/msie/gi)),addDelayedListener:function(el,_28,fn,_29,_30){_19[_19.length]=[el,_28,fn,_29,_30];if(_17){_23=this.POLL_RETRYS;this.startTimeout(0);}},startTimeout:function(_31){var i=(_31||_31===0)?_31:this.POLL_INTERVAL;var _32=this;var _33=function(){_32._tryPreloadAttach();};this.timeout=setTimeout(_33,i);},onAvailable:function(_34,_35,_36,_37){_24.push({id:_34,fn:_35,obj:_36,override:_37});_23=this.POLL_RETRYS;this.startTimeout(0);},addListener:function(el,_38,fn,_39,_40){if(!fn||!fn.call){return false;}if(this._isValidCollection(el)){var ok=true;for(var i=0,len=el.length;i<len;++i){ok=(this.on(el[i],_38,fn,_39,_40)&&ok);}return ok;}else{if(typeof el=="string"){var oEl=this.getEl(el);if(_17&&oEl){el=oEl;}else{this.addDelayedListener(el,_38,fn,_39,_40);return true;}}}if(!el){return false;}if("unload"==_38&&_39!==this){_20[_20.length]=[el,_38,fn,_39,_40];return true;}var _43=(_40)?_39:el;var _44=function(e){return fn.call(_43,YAHOO.util.Event.getEvent(e),_39);};var li=[el,_38,fn,_44,_43];var _47=_18.length;_18[_47]=li;if(this.useLegacyEvent(el,_38)){var _48=this.getLegacyIndex(el,_38);if(_48==-1||el!=_21[_48][0]){_48=_21.length;_25[el.id+_38]=_48;_21[_48]=[el,_38,el["on"+_38]];_22[_48]=[];el["on"+_38]=function(e){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(e),_48);};}_22[_48].push(li);}else{if(el.addEventListener){el.addEventListener(_38,_44,false);}else{if(el.attachEvent){el.attachEvent("on"+_38,_44);}}}return true;},fireLegacyEvent:function(e,_49){var ok=true;var le=_22[_49];for(var i=0,len=le.length;i<len;++i){var li=le[i];if(li&&li[this.WFN]){var _51=li[this.ADJ_SCOPE];var ret=li[this.WFN].call(_51,e);ok=(ok&&ret);}}return ok;},getLegacyIndex:function(el,_53){var key=this.generateId(el)+_53;if(typeof _25[key]=="undefined"){return -1;}else{return _25[key];}},useLegacyEvent:function(el,_55){if(!el.addEventListener&&!el.attachEvent){return true;}else{if(this.isSafari){if("click"==_55||"dblclick"==_55){return true;}}}return false;},removeListener:function(el,_56,fn,_57){if(!fn||!fn.call){return false;}var i,len;if(typeof el=="string"){el=this.getEl(el);}else{if(this._isValidCollection(el)){var ok=true;for(i=0,len=el.length;i<len;++i){ok=(this.removeListener(el[i],_56,fn)&&ok);}return ok;}}if("unload"==_56){for(i=0,len=_20.length;i<len;i++){var li=_20[i];if(li&&li[0]==el&&li[1]==_56&&li[2]==fn){_20.splice(i,1);return true;}}return false;}var _58=null;if("undefined"==typeof _57){_57=this._getCacheIndex(el,_56,fn);}if(_57>=0){_58=_18[_57];}if(!el||!_58){return false;}if(this.useLegacyEvent(el,_56)){var _59=this.getLegacyIndex(el,_56);var _60=_22[_59];if(_60){for(i=0,len=_60.length;i<len;++i){li=_60[i];if(li&&li[this.EL]==el&&li[this.TYPE]==_56&&li[this.FN]==fn){_60.splice(i,1);}}}}else{if(el.removeEventListener){el.removeEventListener(_56,_58[this.WFN],false);}else{if(el.detachEvent){el.detachEvent("on"+_56,_58[this.WFN]);}}}delete _18[_57][this.WFN];delete _18[_57][this.FN];_18.splice(_57,1);return true;},getTarget:function(ev,_62){var t=ev.target||ev.srcElement;return this.resolveTextNode(t);},resolveTextNode:function(_64){if(_64&&_64.nodeName&&"#TEXT"==_64.nodeName.toUpperCase()){return _64.parentNode;}else{return _64;}},getPageX:function(ev){var x=ev.pageX;if(!x&&0!==x){x=ev.clientX||0;if(this.isIE){x+=this._getScrollLeft();}}return x;},getPageY:function(ev){var y=ev.pageY;if(!y&&0!==y){y=ev.clientY||0;if(this.isIE){y+=this._getScrollTop();}}return y;},getXY:function(ev){return [this.getPageX(ev),this.getPageY(ev)];},getRelatedTarget:function(ev){var t=ev.relatedTarget;if(!t){if(ev.type=="mouseout"){t=ev.toElement;}else{if(ev.type=="mouseover"){t=ev.fromElement;}}}return this.resolveTextNode(t);},getTime:function(ev){if(!ev.time){var t=new Date().getTime();try{ev.time=t;}catch(e){return t;}}return ev.time;},stopEvent:function(ev){this.stopPropagation(ev);this.preventDefault(ev);},stopPropagation:function(ev){if(ev.stopPropagation){ev.stopPropagation();}else{ev.cancelBubble=true;}},preventDefault:function(ev){if(ev.preventDefault){ev.preventDefault();}else{ev.returnValue=false;}},getEvent:function(e){var ev=e||window.event;if(!ev){var c=this.getEvent.caller;while(c){ev=c.arguments[0];if(ev&&Event==ev.constructor){break;}c=c.caller;}}return ev;},getCharCode:function(ev){return ev.charCode||((ev.type=="keypress")?ev.keyCode:0);},_getCacheIndex:function(el,_68,fn){for(var i=0,len=_18.length;i<len;++i){var li=_18[i];if(li&&li[this.FN]==fn&&li[this.EL]==el&&li[this.TYPE]==_68){return i;}}return -1;},generateId:function(el){var id=el.id;if(!id){id="yuievtautoid-"+_26;++_26;el.id=id;}return id;},_isValidCollection:function(o){return (o&&o.length&&typeof o!="string"&&!o.tagName&&!o.alert&&typeof o[0]!="undefined");},elCache:{},getEl:function(id){return document.getElementById(id);},clearCache:function(){},_load:function(e){_17=true;var EU=YAHOO.util.Event;EU._simpleRemove(window,"load",EU._load);},_tryPreloadAttach:function(){if(this.locked){return false;}this.locked=true;var _72=!_17;if(!_72){_72=(_23>0);}var _73=[];for(var i=0,len=_19.length;i<len;++i){var d=_19[i];if(d){var el=this.getEl(d[this.EL]);if(el){this.on(el,d[this.TYPE],d[this.FN],d[this.SCOPE],d[this.ADJ_SCOPE]);delete _19[i];}else{_73.push(d);}}}_19=_73;var _75=[];for(i=0,len=_24.length;i<len;++i){var _76=_24[i];if(_76){el=this.getEl(_76.id);if(el){var _77=(_76.override)?_76.obj:el;_76.fn.call(_77,_76.obj);delete _24[i];}else{_75.push(_76);}}}_23=(_73.length===0&&_75.length===0)?0:_23-1;if(_72){this.startTimeout();}this.locked=false;return true;},purgeElement:function(el,_78,_79){var _80=this.getListeners(el,_79);if(_80){for(var i=0,len=_80.length;i<len;++i){var l=_80[i];this.removeListener(el,l.type,l.fn);}}if(_78&&el&&el.childNodes){for(i=0,len=el.childNodes.length;i<len;++i){this.purgeElement(el.childNodes[i],_78,_79);}}},getListeners:function(el,_82){var _83=[];if(_18&&_18.length>0){for(var i=0,len=_18.length;i<len;++i){var l=_18[i];if(l&&l[this.EL]===el&&(!_82||_82===l[this.TYPE])){_83.push({type:l[this.TYPE],fn:l[this.FN],obj:l[this.SCOPE],adjust:l[this.ADJ_SCOPE],index:i});}}}return (_83.length)?_83:null;},_unload:function(e){var EU=YAHOO.util.Event;for(var i=0,len=_20.length;i<len;++i){var l=_20[i];if(l){var _84=(l[EU.ADJ_SCOPE])?l[EU.SCOPE]:window;l[EU.FN].call(_84,EU.getEvent(e),l[EU.SCOPE]);delete _20[i];l=null;}}if(_18&&_18.length>0){var j=_18.length;while(j){var _86=j-1;l=_18[_86];if(l){EU.removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],_86);}l=null;j=j-1;}EU.clearCache();}for(i=0,len=_21.length;i<len;++i){delete _21[i][0];delete _21[i];}EU._simpleRemove(window,"unload",EU._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var dd=document.documentElement,db=document.body;if(dd&&(dd.scrollTop||dd.scrollLeft)){return [dd.scrollTop,dd.scrollLeft];}else{if(db){return [db.scrollTop,db.scrollLeft];}else{return [0,0];}}},_simpleAdd:function(el,_88,fn,_89){if(el.addEventListener){el.addEventListener(_88,fn,(_89));}else{if(el.attachEvent){el.attachEvent("on"+_88,fn);}}},_simpleRemove:function(el,_90,fn,_91){if(el.removeEventListener){el.removeEventListener(_90,fn,(_91));}else{if(el.detachEvent){el.detachEvent("on"+_90,fn);}}}};}();YAHOO.util.Event.on=YAHOO.util.Event.addListener;if(document&&document.body){YAHOO.util.Event._load();}else{YAHOO.util.Event._simpleAdd(window,"load",YAHOO.util.Event._load);}YAHOO.util.Event._simpleAdd(window,"unload",YAHOO.util.Event._unload);YAHOO.util.Event._tryPreloadAttach();}

// http://map.bkkpages.com/script/yui/animation-min.js
/* Copyright (c) 2006, Yahoo! Inc. All rights reserved.  Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt Version: 0.11.3 */ YAHOO.util.Anim=function(el,attributes,duration,method){if(el){this.init(el,attributes,duration,method);}};YAHOO.util.Anim.prototype={toString:function(){var el=this.getEl();var id=el.id||el.tagName;return("Anim "+id);},patterns:{noNegatives:/width|height|opacity|padding/i,offsetAttribute:/^((width|height)|(top|left))$/,defaultUnit:/width|height|top$|bottom$|left$|right$/i,offsetUnit:/\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i},doMethod:function(attr,start,end){return this.method(this.currentFrame,start,end-start,this.totalFrames);},setAttribute:function(attr,val,unit){if(this.patterns.noNegatives.test(attr)){val=(val>0)?val:0;}YAHOO.util.Dom.setStyle(this.getEl(),attr,val+unit);},getAttribute:function(attr){var el=this.getEl();var val=YAHOO.util.Dom.getStyle(el,attr);if(val!=='auto'&&!this.patterns.offsetUnit.test(val)){return parseFloat(val);}var a=this.patterns.offsetAttribute.exec(attr)||[];var pos=!!(a[3]);var box=!!(a[2]);if(box||(YAHOO.util.Dom.getStyle(el,'position')=='absolute'&&pos)){val=el['offset'+a[0].charAt(0).toUpperCase()+a[0].substr(1)];}else{val=0;}return val;},getDefaultUnit:function(attr){if(this.patterns.defaultUnit.test(attr)){return'px';}return'';},setRuntimeAttribute:function(attr){var start;var end;var attributes=this.attributes;this.runtimeAttributes[attr]={};var isset=function(prop){return(typeof prop!=='undefined');};if(!isset(attributes[attr]['to'])&&!isset(attributes[attr]['by'])){return false;}start=(isset(attributes[attr]['from']))?attributes[attr]['from']:this.getAttribute(attr);if(isset(attributes[attr]['to'])){end=attributes[attr]['to'];}else if(isset(attributes[attr]['by'])){if(start.constructor==Array){end=[];for(var i=0,len=start.length;i<len;++i){end[i]=start[i]+attributes[attr]['by'][i];}}else{end=start+attributes[attr]['by'];}}this.runtimeAttributes[attr].start=start;this.runtimeAttributes[attr].end=end;this.runtimeAttributes[attr].unit=(isset(attributes[attr].unit))?attributes[attr]['unit']:this.getDefaultUnit(attr);},init:function(el,attributes,duration,method){var isAnimated=false;var startTime=null;var actualFrames=0;el=YAHOO.util.Dom.get(el);this.attributes=attributes||{};this.duration=duration||1;this.method=method||YAHOO.util.Easing.easeNone;this.useSeconds=true;this.currentFrame=0;this.totalFrames=YAHOO.util.AnimMgr.fps;this.getEl=function(){return el;};this.isAnimated=function(){return isAnimated;};this.getStartTime=function(){return startTime;};this.runtimeAttributes={};this.animate=function(){if(this.isAnimated()){return false;}this.currentFrame=0;this.totalFrames=(this.useSeconds)?Math.ceil(YAHOO.util.AnimMgr.fps*this.duration):this.duration;YAHOO.util.AnimMgr.registerElement(this);};this.stop=function(){YAHOO.util.AnimMgr.stop(this);};var onStart=function(){this.onStart.fire();for(var attr in this.attributes){this.setRuntimeAttribute(attr);}isAnimated=true;actualFrames=0;startTime=new Date();};var onTween=function(){var data={duration:new Date()-this.getStartTime(),currentFrame:this.currentFrame};data.toString=function(){return('duration: '+data.duration+', currentFrame: '+data.currentFrame);};this.onTween.fire(data);var runtimeAttributes=this.runtimeAttributes;for(var attr in runtimeAttributes){this.setAttribute(attr,this.doMethod(attr,runtimeAttributes[attr].start,runtimeAttributes[attr].end),runtimeAttributes[attr].unit);}actualFrames+=1;};var onComplete=function(){var actual_duration=(new Date()-startTime)/1000;var data={duration:actual_duration,frames:actualFrames,fps:actualFrames/actual_duration};data.toString=function(){return('duration: '+data.duration+', frames: '+data.frames+', fps: '+data.fps);};isAnimated=false;actualFrames=0;this.onComplete.fire(data);};this._onStart=new YAHOO.util.CustomEvent('_start',this,true);this.onStart=new YAHOO.util.CustomEvent('start',this);this.onTween=new YAHOO.util.CustomEvent('tween',this);this._onTween=new YAHOO.util.CustomEvent('_tween',this,true);this.onComplete=new YAHOO.util.CustomEvent('complete',this);this._onComplete=new YAHOO.util.CustomEvent('_complete',this,true);this._onStart.subscribe(onStart);this._onTween.subscribe(onTween);this._onComplete.subscribe(onComplete);}};YAHOO.util.AnimMgr=new function(){var thread=null;var queue=[];var tweenCount=0;this.fps=200;this.delay=1;this.registerElement=function(tween){queue[queue.length]=tween;tweenCount+=1;tween._onStart.fire();this.start();};this.unRegister=function(tween,index){tween._onComplete.fire();index=index||getIndex(tween);if(index!=-1){queue.splice(index,1);}tweenCount-=1;if(tweenCount<=0){this.stop();}};this.start=function(){if(thread===null){thread=setInterval(this.run,this.delay);}};this.stop=function(tween){if(!tween){clearInterval(thread);for(var i=0,len=queue.length;i<len;++i){if(queue[i].isAnimated()){this.unRegister(tween,i);}}queue=[];thread=null;tweenCount=0;}else{this.unRegister(tween);}};this.run=function(){for(var i=0,len=queue.length;i<len;++i){var tween=queue[i];if(!tween||!tween.isAnimated()){continue;}if(tween.currentFrame<tween.totalFrames||tween.totalFrames===null){tween.currentFrame+=1;if(tween.useSeconds){correctFrame(tween);}tween._onTween.fire();}else{YAHOO.util.AnimMgr.stop(tween,i);}}};var getIndex=function(anim){for(var i=0,len=queue.length;i<len;++i){if(queue[i]==anim){return i;}}return-1;};var correctFrame=function(tween){var frames=tween.totalFrames;var frame=tween.currentFrame;var expected=(tween.currentFrame*tween.duration*1000/tween.totalFrames);var elapsed=(new Date()-tween.getStartTime());var tweak=0;if(elapsed<tween.duration*1000){tweak=Math.round((elapsed/expected-1)*tween.currentFrame);}else{tweak=frames-(frame+1);}if(tweak>0&&isFinite(tweak)){if(tween.currentFrame+tweak>=frames){tweak=frames-(frame+1);}tween.currentFrame+=tweak;}};};YAHOO.util.Bezier=new function(){this.getPosition=function(points,t){var n=points.length;var tmp=[];for(var i=0;i<n;++i){tmp[i]=[points[i][0],points[i][1]];}for(var j=1;j<n;++j){for(i=0;i<n-j;++i){tmp[i][0]=(1-t)*tmp[i][0]+t*tmp[parseInt(i+1,10)][0];tmp[i][1]=(1-t)*tmp[i][1]+t*tmp[parseInt(i+1,10)][1];}}return[tmp[0][0],tmp[0][1]];};};(function(){YAHOO.util.ColorAnim=function(el,attributes,duration,method){YAHOO.util.ColorAnim.superclass.constructor.call(this,el,attributes,duration,method);};YAHOO.extend(YAHOO.util.ColorAnim,YAHOO.util.Anim);var Y=YAHOO.util;var superclass=Y.ColorAnim.superclass;var proto=Y.ColorAnim.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("ColorAnim "+id);};proto.patterns.color=/color$/i;proto.patterns.rgb=/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;proto.patterns.hex=/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;proto.patterns.hex3=/^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;proto.parseColor=function(s){if(s.length==3){return s;}var c=this.patterns.hex.exec(s);if(c&&c.length==4){return[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)];}c=this.patterns.rgb.exec(s);if(c&&c.length==4){return[parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10)];}c=this.patterns.hex3.exec(s);if(c&&c.length==4){return[parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)];}return null;};proto.getAttribute=function(attr){var el=this.getEl();if(this.patterns.color.test(attr)){var val=YAHOO.util.Dom.getStyle(el,attr);if(val=='transparent'){var parent=el.parentNode;val=Y.Dom.getStyle(parent,attr);while(parent&&val=='transparent'){parent=parent.parentNode;val=Y.Dom.getStyle(parent,attr);if(parent.tagName.toUpperCase()=='HTML'){val='ffffff';}}}}else{val=superclass.getAttribute.call(this,attr);}return val;};proto.doMethod=function(attr,start,end){var val;if(this.patterns.color.test(attr)){val=[];for(var i=0,len=start.length;i<len;++i){val[i]=superclass.doMethod.call(this,attr,start[i],end[i]);}val='rgb('+Math.floor(val[0])+','+Math.floor(val[1])+','+Math.floor(val[2])+')';}else{val=superclass.doMethod.call(this,attr,start,end);}return val;};proto.setRuntimeAttribute=function(attr){superclass.setRuntimeAttribute.call(this,attr);if(this.patterns.color.test(attr)){var attributes=this.attributes;var start=this.parseColor(this.runtimeAttributes[attr].start);var end=this.parseColor(this.runtimeAttributes[attr].end);if(typeof attributes[attr]['to']==='undefined'&&typeof attributes[attr]['by']!=='undefined'){end=this.parseColor(attributes[attr].by);for(var i=0,len=start.length;i<len;++i){end[i]=start[i]+end[i];}}this.runtimeAttributes[attr].start=start;this.runtimeAttributes[attr].end=end;}};})();YAHOO.util.Easing={easeNone:function(t,b,c,d){return c*t/d+b;},easeIn:function(t,b,c,d){return c*(t/=d)*t+b;},easeOut:function(t,b,c,d){return-c*(t/=d)*(t-2)+b;},easeBoth:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b;},easeInStrong:function(t,b,c,d){return c*(t/=d)*t*t*t+b;},easeOutStrong:function(t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b;},easeBothStrong:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t+b;return-c/2*((t-=2)*t*t*t-2)+b;},elasticIn:function(t,b,c,d,a,p){if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(!a||a<Math.abs(c)){a=c;var s=p/4;}else var s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;},elasticOut:function(t,b,c,d,a,p){if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(!a||a<Math.abs(c)){a=c;var s=p/4;}else var s=p/(2*Math.PI)*Math.asin(c/a);return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b;},elasticBoth:function(t,b,c,d,a,p){if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)p=d*(.3*1.5);if(!a||a<Math.abs(c)){a=c;var s=p/4;}else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b;},backIn:function(t,b,c,d,s){if(typeof s=='undefined')s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b;},backOut:function(t,b,c,d,s){if(typeof s=='undefined')s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;},backBoth:function(t,b,c,d,s){if(typeof s=='undefined')s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b;},bounceIn:function(t,b,c,d){return c-YAHOO.util.Easing.bounceOut(d-t,0,c,d)+b;},bounceOut:function(t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b;}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b;}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b;}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b;}},bounceBoth:function(t,b,c,d){if(t<d/2)return YAHOO.util.Easing.bounceIn(t*2,0,c,d)*.5+b;return YAHOO.util.Easing.bounceOut(t*2-d,0,c,d)*.5+c*.5+b;}};(function(){YAHOO.util.Motion=function(el,attributes,duration,method){if(el){YAHOO.util.Motion.superclass.constructor.call(this,el,attributes,duration,method);}};YAHOO.extend(YAHOO.util.Motion,YAHOO.util.ColorAnim);var Y=YAHOO.util;var superclass=Y.Motion.superclass;var proto=Y.Motion.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("Motion "+id);};proto.patterns.points=/^points$/i;proto.setAttribute=function(attr,val,unit){if(this.patterns.points.test(attr)){unit=unit||'px';superclass.setAttribute.call(this,'left',val[0],unit);superclass.setAttribute.call(this,'top',val[1],unit);}else{superclass.setAttribute.call(this,attr,val,unit);}};proto.getAttribute=function(attr){if(this.patterns.points.test(attr)){var val=[superclass.getAttribute.call(this,'left'),superclass.getAttribute.call(this,'top')];}else{val=superclass.getAttribute.call(this,attr);}return val;};proto.doMethod=function(attr,start,end){var val=null;if(this.patterns.points.test(attr)){var t=this.method(this.currentFrame,0,100,this.totalFrames)/100;val=Y.Bezier.getPosition(this.runtimeAttributes[attr],t);}else{val=superclass.doMethod.call(this,attr,start,end);}return val;};proto.setRuntimeAttribute=function(attr){if(this.patterns.points.test(attr)){var el=this.getEl();var attributes=this.attributes;var start;var control=attributes['points']['control']||[];var end;var i,len;if(control.length>0&&!(control[0]instanceof Array)){control=[control];}else{var tmp=[];for(i=0,len=control.length;i<len;++i){tmp[i]=control[i];}control=tmp;}if(Y.Dom.getStyle(el,'position')=='static'){Y.Dom.setStyle(el,'position','relative');}if(isset(attributes['points']['from'])){Y.Dom.setXY(el,attributes['points']['from']);}else{Y.Dom.setXY(el,Y.Dom.getXY(el));}start=this.getAttribute('points');if(isset(attributes['points']['to'])){end=translateValues.call(this,attributes['points']['to'],start);var pageXY=Y.Dom.getXY(this.getEl());for(i=0,len=control.length;i<len;++i){control[i]=translateValues.call(this,control[i],start);}}else if(isset(attributes['points']['by'])){end=[start[0]+attributes['points']['by'][0],start[1]+attributes['points']['by'][1]];for(i=0,len=control.length;i<len;++i){control[i]=[start[0]+control[i][0],start[1]+control[i][1]];}}this.runtimeAttributes[attr]=[start];if(control.length>0){this.runtimeAttributes[attr]=this.runtimeAttributes[attr].concat(control);}this.runtimeAttributes[attr][this.runtimeAttributes[attr].length]=end;}else{superclass.setRuntimeAttribute.call(this,attr);}};var translateValues=function(val,start){var pageXY=Y.Dom.getXY(this.getEl());val=[val[0]-pageXY[0]+start[0],val[1]-pageXY[1]+start[1]];return val;};var isset=function(prop){return(typeof prop!=='undefined');};})();(function(){YAHOO.util.Scroll=function(el,attributes,duration,method){if(el){YAHOO.util.Scroll.superclass.constructor.call(this,el,attributes,duration,method);}};YAHOO.extend(YAHOO.util.Scroll,YAHOO.util.ColorAnim);var Y=YAHOO.util;var superclass=Y.Scroll.superclass;var proto=Y.Scroll.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("Scroll "+id);};proto.doMethod=function(attr,start,end){var val=null;if(attr=='scroll'){val=[this.method(this.currentFrame,start[0],end[0]-start[0],this.totalFrames),this.method(this.currentFrame,start[1],end[1]-start[1],this.totalFrames)];}else{val=superclass.doMethod.call(this,attr,start,end);}return val;};proto.getAttribute=function(attr){var val=null;var el=this.getEl();if(attr=='scroll'){val=[el.scrollLeft,el.scrollTop];}else{val=superclass.getAttribute.call(this,attr);}return val;};proto.setAttribute=function(attr,val,unit){var el=this.getEl();if(attr=='scroll'){el.scrollLeft=val[0];el.scrollTop=val[1];}else{superclass.setAttribute.call(this,attr,val,unit);}};})();

// http://map.bkkpages.com/script/yui/connection-min.js
/* Copyright (c) 2006, Yahoo! Inc. All rights reserved.  Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt Version: 0.11.3 */
YAHOO.util.Connect={_msxml_progid:['MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP'],_http_header:{},_has_http_headers:false,_use_default_post_header:true,_default_post_header:'application/x-www-form-urlencoded',_isFormSubmit:false,_isFileUpload:false,_formNode:null,_sFormData:null,_poll:{},_timeOut:{},_polling_interval:50,_transaction_id:0,setProgId:function(id)
{this._msxml_progid.unshift(id);},setDefaultPostHeader:function(b)
{this._use_default_post_header=b;},setPollingInterval:function(i)
{if(typeof i=='number'&&isFinite(i)){this._polling_interval=i;}},createXhrObject:function(transactionId)
{var obj,http;try
{http=new XMLHttpRequest();obj={conn:http,tId:transactionId};}
catch(e)
{for(var i=0;i<this._msxml_progid.length;++i){try
{http=new ActiveXObject(this._msxml_progid[i]);obj={conn:http,tId:transactionId};break;}
catch(e){}}}
finally
{return obj;}},getConnectionObject:function()
{var o;var tId=this._transaction_id;try
{o=this.createXhrObject(tId);if(o){this._transaction_id++;}}
catch(e){}
finally
{return o;}},asyncRequest:function(method,uri,callback,postData)
{var o=this.getConnectionObject();if(!o){return null;}
else{if(this._isFormSubmit){if(this._isFileUpload){this.uploadFile(o.tId,callback,uri);this.releaseObject(o);return;}
if(method=='GET'){uri+="?"+this._sFormData;}
else if(method=='POST'){postData=(postData?this._sFormData+"&"+postData:this._sFormData);}
this._sFormData='';}
o.conn.open(method,uri,true);if(this._isFormSubmit||(postData&&this._use_default_post_header)){this.initHeader('Content-Type',this._default_post_header);if(this._isFormSubmit){this._isFormSubmit=false;}}
if(this._has_http_headers){this.setHeader(o);}
this.handleReadyState(o,callback);o.conn.send(postData?postData:null);return o;}},handleReadyState:function(o,callback)
{var oConn=this;if(callback&&callback.timeout){this._timeOut[o.tId]=window.setTimeout(function(){oConn.abort(o,callback,true);},callback.timeout);}
this._poll[o.tId]=window.setInterval(function(){if(o.conn&&o.conn.readyState==4){window.clearInterval(oConn._poll[o.tId]);delete oConn._poll[o.tId];if(callback&&callback.timeout){delete oConn._timeOut[o.tId];}
oConn.handleTransactionResponse(o,callback);}},this._polling_interval);},handleTransactionResponse:function(o,callback,isAbort)
{if(!callback){this.releaseObject(o);return;}
var httpStatus,responseObject;try
{if(o.conn.status!==undefined&&o.conn.status!=0){httpStatus=o.conn.status;}
else{httpStatus=13030;}}
catch(e){httpStatus=13030;}
if(httpStatus>=200&&httpStatus<300){try
{responseObject=this.createResponseObject(o,callback.argument);if(callback.success){if(!callback.scope){callback.success(responseObject);}
else{callback.success.apply(callback.scope,[responseObject]);}}}
catch(e){}}
else{try
{switch(httpStatus){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:responseObject=this.createExceptionObject(o.tId,callback.argument,(isAbort?isAbort:false));if(callback.failure){if(!callback.scope){callback.failure(responseObject);}
else{callback.failure.apply(callback.scope,[responseObject]);}}
break;default:responseObject=this.createResponseObject(o,callback.argument);if(callback.failure){if(!callback.scope){callback.failure(responseObject);}
else{callback.failure.apply(callback.scope,[responseObject]);}}}}
catch(e){}}
this.releaseObject(o);responseObject=null;},createResponseObject:function(o,callbackArg)
{var obj={};var headerObj={};try
{var headerStr=o.conn.getAllResponseHeaders();var header=headerStr.split('\n');for(var i=0;i<header.length;i++){var delimitPos=header[i].indexOf(':');if(delimitPos!=-1){headerObj[header[i].substring(0,delimitPos)]=header[i].substring(delimitPos+2);}}}
catch(e){}
obj.tId=o.tId;obj.status=o.conn.status;obj.statusText=o.conn.statusText;obj.getResponseHeader=headerObj;obj.getAllResponseHeaders=headerStr;obj.responseText=o.conn.responseText;obj.responseXML=o.conn.responseXML;if(typeof callbackArg!==undefined){obj.argument=callbackArg;}
return obj;},createExceptionObject:function(tId,callbackArg,isAbort)
{var COMM_CODE=0;var COMM_ERROR='communication failure';var ABORT_CODE=-1;var ABORT_ERROR='transaction aborted';var obj={};obj.tId=tId;if(isAbort){obj.status=ABORT_CODE;obj.statusText=ABORT_ERROR;}
else{obj.status=COMM_CODE;obj.statusText=COMM_ERROR;}
if(callbackArg){obj.argument=callbackArg;}
return obj;},initHeader:function(label,value)
{if(this._http_header[label]===undefined){this._http_header[label]=value;}
else{this._http_header[label]=value+","+this._http_header[label];}
this._has_http_headers=true;},setHeader:function(o)
{for(var prop in this._http_header){if(this._http_header.hasOwnProperty(prop)){o.conn.setRequestHeader(prop,this._http_header[prop]);}}
delete this._http_header;this._http_header={};this._has_http_headers=false;},setForm:function(formId,isUpload,secureUri)
{this._sFormData='';if(typeof formId=='string'){var oForm=(document.getElementById(formId)||document.forms[formId]);}
else if(typeof formId=='object'){var oForm=formId;}
else{return;}
if(isUpload){this.createFrame(secureUri?secureUri:null);this._isFormSubmit=true;this._isFileUpload=true;this._formNode=oForm;return;}
var oElement,oName,oValue,oDisabled;var hasSubmit=false;for(var i=0;i<oForm.elements.length;i++){oElement=oForm.elements[i];oDisabled=oForm.elements[i].disabled;oName=oForm.elements[i].name;oValue=oForm.elements[i].value;if(!oDisabled&&oName)
{switch(oElement.type)
{case'select-one':case'select-multiple':for(var j=0;j<oElement.options.length;j++){if(oElement.options[j].selected){if(window.ActiveXObject){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oElement.options[j].attributes['value'].specified?oElement.options[j].value:oElement.options[j].text)+'&';}
else{this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oElement.options[j].hasAttribute('value')?oElement.options[j].value:oElement.options[j].text)+'&';}}}
break;case'radio':case'checkbox':if(oElement.checked){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';}
break;case'file':case undefined:case'reset':case'button':break;case'submit':if(hasSubmit==false){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';hasSubmit=true;}
break;default:this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';break;}}}
this._isFormSubmit=true;this._sFormData=this._sFormData.substr(0,this._sFormData.length-1);},createFrame:function(secureUri){var frameId='yuiIO'+this._transaction_id;if(window.ActiveXObject){var io=document.createElement('<IFRAME id="'+frameId+'" name="'+frameId+'">');if(typeof secureUri=='boolean'){io.src='javascript:false';}
else{io.src=secureUri;}}
else{var io=document.createElement('IFRAME');io.id=frameId;io.name=frameId;}
io.style.position='absolute';io.style.top='-1000px';io.style.left='-1000px';document.body.appendChild(io);},uploadFile:function(id,callback,uri){var frameId='yuiIO'+id;var io=document.getElementById(frameId);this._formNode.action=uri;this._formNode.enctype='multipart/form-data';this._formNode.method='POST';this._formNode.target=frameId;this._formNode.submit();this._formNode=null;this._isFileUpload=false;this._isFormSubmit=false;var uploadCallback=function()
{var obj={};obj.tId=id;obj.responseText=io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;obj.responseXML=io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;obj.argument=callback.argument;if(callback.upload){if(!callback.scope){callback.upload(obj);}
else{callback.upload.apply(callback.scope,[obj]);}}
if(YAHOO.util.Event){YAHOO.util.Event.removeListener(io,"load",uploadCallback);}
else if(window.ActiveXObject){io.detachEvent('onload',uploadCallback);}
else{io.removeEventListener('load',uploadCallback,false);}
setTimeout(function(){document.body.removeChild(io);},100);};if(YAHOO.util.Event){YAHOO.util.Event.addListener(io,"load",uploadCallback);}
else if(window.ActiveXObject){io.attachEvent('onload',uploadCallback);}
else{io.addEventListener('load',uploadCallback,false);}},abort:function(o,callback,isTimeout)
{if(this.isCallInProgress(o)){o.conn.abort();window.clearInterval(this._poll[o.tId]);delete this._poll[o.tId];if(isTimeout){delete this._timeOut[o.tId];}
this.handleTransactionResponse(o,callback,true);return true;}
else{return false;}},isCallInProgress:function(o)
{if(o.conn){return o.conn.readyState!=4&&o.conn.readyState!=0;}
else{return false;}},releaseObject:function(o)
{o.conn=null;o=null;}};

// http://map.bkkpages.com/script/swfobject.js
/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;

// http://www.bkkpages.com/script/script.js
//global constants
gc_bStyleSwitch			= false; 									// enable stylesheet switching (wide and narrow screen versions)
gc_sMapVer 					= "";											// map viewer
gc_sPromoID					= "";
gc_bLiveServer  		= true;

// global variables
var g_bPageLoaded 	= false;									// onload check
var g_bMapLoaded 		= false;
var g_iDictionaryTimer;

// google adsense
google_ad_client = "pub-4953866699319456";
google_ad_width = 125;
google_ad_height = 125;
google_ad_format = "125x125_as";
google_ad_type = "text_image";
//2007-02-08: search
google_ad_channel = "2344555607";
google_color_border = "D9DEED";
google_color_bg = "D9DEED";
google_color_link = "0023A4";
google_color_text = "333333";
google_color_url = "0023A4";

// event handlers
window.onresize =	CheckStylesheet;
window.onload 	=	InitialisePage;
YAHOO.util.Event.addListener("header", "mouseover", SubMenuHideAll);
YAHOO.util.Event.addListener("navigation", "mouseover", SubMenuHideAll);
YAHOO.util.Event.addListener("footer", "mouseover", SubMenuHideAll);

// image cache controls
var g_objImageCache = new Object();
var g_iImageIndex = 0;

// page initialisation values
var g_sInitialiseAction = "";

// pulse coords
var g_iPulseTimer = 0;
var g_iPulseX = 0;
var g_iPulseY = 0;
var g_iCoordX = 0;
var g_iCoordY = 0;


/* ---------------------------------------------------------
Core Functions
--------------------------------------------------------- */
function CacheImage(sFilename) {
	g_objImageCache[g_iImageIndex] = new Image();
	g_objImageCache[g_iImageIndex].src = sFilename;
	g_iImageIndex++;
}

function DrawAd120x90(sDirectSelection) {
   if (!document.phpAds_used) document.phpAds_used = ',';
   phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);

   document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
   document.write ("http://ads.bkkpages.net/adjs.php?n=" + phpAds_random);
   document.write ("&amp;what=zone:2&amp;block=1&amp;blockcampaign=1");
   document.write ("&amp;exclude=" + document.phpAds_used);
   if (document.referrer)
      document.write ("&amp;referer=" + escape(document.referrer));
   document.write ("'><" + "/script>");

/*
	if (gc_bLiveServer == true) {
		if (!document.phpAds_used) document.phpAds_used = ',';
		phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);
    document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
    document.write ("http://ads.bkkpages.com/adjs.php?n=" + phpAds_random);
    document.write ("&amp;what=zone:7&amp;target=_blank&amp;block=1&amp;blockcampaign=1");
    document.write ("&amp;exclude=" + document.phpAds_used);
    if (document.referrer)
      document.write ("&amp;referer=" + escape(document.referrer));
    document.write ("'><" + "/script>");
	} else {
		// document.write ("<a href=\"http://www.popo-shop.com\" target=\"_blank\">");
		// document.write ("<img src=\"temp/popo.jpg\" alt=\"Popo Shop!\" /></a>");
	}
*/
}

function DrawAd300x250() {
   if (!document.phpAds_used) document.phpAds_used = ',';
   phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);

   document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
   document.write ("http://ads.bkkpages.net/adjs.php?n=" + phpAds_random);
   document.write ("&amp;what=zone:1&amp;block=1&amp;blockcampaign=1");
   document.write ("&amp;exclude=" + document.phpAds_used);
   if (document.referrer)
      document.write ("&amp;referer=" + escape(document.referrer));
   document.write ("'><" + "/script>");

/*
	if (gc_bLiveServer == true) {
		if (!document.phpAds_used) document.phpAds_used = ',';
		phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);
    document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
    document.write ("http://ads.bkkpages.com/adjs.php?n=" + phpAds_random);
    document.write ("&amp;what=zone:6&amp;target=_blank");
    document.write ("&amp;exclude=" + document.phpAds_used);
    if (document.referrer)
      document.write ("&amp;referer=" + escape(document.referrer));
    document.write ("'><" + "/script>");
	} else {
		document.write ("<a href=\"http://www.popo-shop.com\" target=\"_blank\">");
		document.write ("<img src=\"temp/popo.jpg\" alt=\"Popo Shop!\" /></a>");
	}
*/
}

function DrawAd468x60(sDirectSelection) {
	if (gc_bLiveServer == true) {
		if (!document.phpAds_used) document.phpAds_used = ',';
		phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);

		document.write ("<" + "script type='text/javascript' src='");
		document.write ("http://ads.bkkpages.net/adjs.php?n=" + phpAds_random);
		document.write ("&amp;what=" + sDirectSelection + "|ignoreme@468x60" +
										"&amp;target=_blank&amp;block=1&amp;blockcampaign=1");
		document.write ("&amp;exclude=" + document.phpAds_used);
		if (document.referrer)
		  document.write ("&amp;referer=" + escape(document.referrer));
		document.write ("'><" + "/script>");
	}
}

function InitialisePage(sAction, vValue1, vValue2) {
	if (g_bPageLoaded != true) {
		g_bPageLoaded = true;

		// show clock
		var objSWFClock = new SWFObject(('http://map.bkkpages.com/swf/swf_clock.swf?' + gc_sClockVer), "SWFclock", "73", "67", "8", "#FFFFFF");
		objSWFClock.addVariable("sClock", gc_sClockData);
		objSWFClock.useExpressInstall("http://www.bkkpages.com/script/expressinstall.swf");
		objSWFClock.write("clock");

		// show map
		if (gc_sMapVer != "") {
			var objSWFMap = new SWFObject(('swf_map.swf?' + gc_sMapVer), "SWFmap", "330", "330", "8", "#e6e6e2");
			objSWFMap.addParam("swliveconnect", true);
			objSWFMap.addParam("wmode", "transparent");
			objSWFMap.addVariable("mapmode", gc_sMapMode);
			objSWFMap.addVariable("zoom", gc_sMapZoom);
			objSWFMap.addVariable("homeX", gc_sMapHomeX);
			objSWFMap.addVariable("homeY", gc_sMapHomeY);
			objSWFMap.addVariable("category", gc_sMapCategory);
			objSWFMap.addVariable("live", gc_sMapLive);
			objSWFMap.addVariable("dirpage", gc_sMapDirPage);
			objSWFMap.addVariable("dirsize", gc_sMapDirSize);
			objSWFMap.addVariable("mapversion", gc_sMapImgVersion);
			objSWFMap.addVariable("userid", gc_iMapUserID);
			objSWFMap.addVariable("sortby", gc_sSortBy);
			objSWFMap.write("map");
		}

		// show promo scroller
		if (gc_sPromoID != "") {
			var objSWFPromo = new SWFObject('http://map.bkkpages.com/swf/swf_promotions.swf', "SWFpromo", "371", "50", "8", "#ededed");
			objSWFPromo.addParam("wmode", "transparent");
			objSWFPromo.addVariable("promoID", gc_sPromoID);
			if (gc_bLiveServer == true) {
				objSWFPromo.addVariable("live", "true");
			} else {
				objSWFPromo.addVariable("live", "false");
			}
			objSWFPromo.write("promoscroll");
		}

		// stylesheet switching
		CheckStylesheet();

		// initialise actions
		switch (g_sInitialiseAction) {
			case "Advertise":
				CacheImage("http://map.bkkpages.com/images/advertise/next_off.gif");
				CacheImage("http://map.bkkpages.com/images/advertise/prev_off.gif");
				CacheImage("http://map.bkkpages.com/images/advertise/next_on.gif");
				CacheImage("http://map.bkkpages.com/images/advertise/prev_on.gif");
				CacheImage("http://map.bkkpages.com/images/advertise/bullet.gif");
				break;
			case "Climate":
				var objSWFClimate = new SWFObject('http://map.bkkpages.com/swf_climate.swf', "SWFclimate", "766", "340", "8", "#FFFFFF");
				objSWFClimate.addVariable("iDayNumber", gc_iDayOfYear);
				objSWFClimate.addParam("wmode", "transparent");
				objSWFClimate.write("climate");
				break;
			case "CurrencyConvert":
				CacheImage("http://map.bkkpages.com/images/flags/aud_on.gif");
				CacheImage("http://map.bkkpages.com/images/flags/cad_on.gif");
				CacheImage("http://map.bkkpages.com/images/flags/chf_on.gif");
				CacheImage("http://map.bkkpages.com/images/flags/cny_on.gif");
				CacheImage("http://map.bkkpages.com/images/flags/dkk_on.gif");
				CacheImage("http://map.bkkpages.com/images/flags/eur_on.gif");
				CacheImage("http://map.bkkpages.com/images/flags/gbp_on.gif");
				CacheImage("http://map.bkkpages.com/images/flags/idr_on.gif");
				CacheImage("http://map.bkkpages.com/images/flags/ils_on.gif");
				CacheImage("http://map.bkkpages.com/images/flags/inr_on.gif");
				CacheImage("http://map.bkkpages.com/images/flags/jpy_on.gif");
				CacheImage("http://map.bkkpages.com/images/flags/krw_on.gif");
				CacheImage("http://map.bkkpages.com/images/flags/myr_on.gif");
				CacheImage("http://map.bkkpages.com/images/flags/mxn_on.gif");
				CacheImage("http://map.bkkpages.com/images/flags/nok_on.gif");
				CacheImage("http://map.bkkpages.com/images/flags/nzd_on.gif");
				CacheImage("http://map.bkkpages.com/images/flags/sek_on.gif");
				CacheImage("http://map.bkkpages.com/images/flags/sgd_on.gif");
				CacheImage("http://map.bkkpages.com/images/flags/usd_on.gif");
				CacheImage("http://map.bkkpages.com/images/flags/zar_on.gif");
				CacheImage("http://map.bkkpages.com/images/flags/aud_off.gif");
				CacheImage("http://map.bkkpages.com/images/flags/cad_off.gif");
				CacheImage("http://map.bkkpages.com/images/flags/chf_off.gif");
				CacheImage("http://map.bkkpages.com/images/flags/cny_off.gif");
				CacheImage("http://map.bkkpages.com/images/flags/dkk_off.gif");
				CacheImage("http://map.bkkpages.com/images/flags/eur_off.gif");
				CacheImage("http://map.bkkpages.com/images/flags/gbp_off.gif");
				CacheImage("http://map.bkkpages.com/images/flags/idr_off.gif");
				CacheImage("http://map.bkkpages.com/images/flags/ils_off.gif");
				CacheImage("http://map.bkkpages.com/images/flags/inr_off.gif");
				CacheImage("http://map.bkkpages.com/images/flags/jpy_off.gif");
				CacheImage("http://map.bkkpages.com/images/flags/krw_off.gif");
				CacheImage("http://map.bkkpages.com/images/flags/myr_off.gif");
				CacheImage("http://map.bkkpages.com/images/flags/mxn_off.gif");
				CacheImage("http://map.bkkpages.com/images/flags/nok_off.gif");
				CacheImage("http://map.bkkpages.com/images/flags/nzd_off.gif");
				CacheImage("http://map.bkkpages.com/images/flags/sek_off.gif");
				CacheImage("http://map.bkkpages.com/images/flags/sgd_off.gif");
				CacheImage("http://map.bkkpages.com/images/flags/usd_off.gif");
				CacheImage("http://map.bkkpages.com/images/flags/zar_off.gif");
				break;
			case "GetInvolvedDirectory":
				CacheImage("http://map.bkkpages.com/images/getinvolved/upgrade_off.gif");
				CacheImage("http://map.bkkpages.com/images/getinvolved/update_off.gif");
				CacheImage("http://map.bkkpages.com/images/getinvolved/upgrade_on.gif");
				CacheImage("http://map.bkkpages.com/images/getinvolved/update_on.gif");
				break;
			case "GetInvolvedIntro":
				var objSWFGetInvolved = new SWFObject('swf_getinvolved.swf?1', "SWFgetinvolved", "990", "300", "8", "#FFFFFF");
				objSWFGetInvolved.addVariable("sLive", g_sLiveServer);
				objSWFGetInvolved.addParam("wmode", "transparent");
				objSWFGetInvolved.write("getinvolved");
				CacheImage("http://map.bkkpages.com/images/getinvolved/submit_off.gif");
				CacheImage("http://map.bkkpages.com/images/getinvolved/submit_on.gif");
				break;
			case "Homepage":
				CacheImage("http://map.bkkpages.com/images/header/home_tabs_blank.gif");
				CacheImage("http://map.bkkpages.com/images/header/home_tabs_bg.gif");
				CacheImage("http://map.bkkpages.com/images/header/home_tabs_palace.jpg");
				CacheImage("http://map.bkkpages.com/images/header/home_tabs_whatson.jpg");
				CacheImage("http://map.bkkpages.com/images/header/home_tabs_skyline.jpg");
				g_iHomeTimer = window.setInterval(HomepageWhatsOn, 60000);
				g_iHomeTabTimer = window.setInterval(HomeTabRotate, gc_iHomeTabSpeed);
				break;
			case "MapPulse":
				g_iPulseTimer = setTimeout(AutoPulse, 1000);
				break;
			case "MapPulsePremium":
				var objSWFPic = new SWFObject('http://map.bkkpages.com/swf/swf_picture.swf', "SWFpicture", "184", "217", "8", "#FFFFFF");
				objSWFPic.addParam("wmode", "transparent");
				objSWFPic.addVariable("sLive", gc_sMapLive);
				objSWFPic.addVariable("sID", g_iPremiumID);
				objSWFPic.write("premium");
				g_iPulseTimer = setTimeout(AutoPulse, 1000);
				break;
			case "NeighbourhoodNudge":
				var objSWFNudge = new SWFObject(('swf_nudge.swf?' + gc_sNudgeVer), "SWFnudge", "324", "322", "8", "#ededed");
				objSWFNudge.addParam("wmode", "transparent");
				objSWFNudge.write("nudge")
				break;
		}

		// cache core images
		CacheImage("http://map.bkkpages.com/images/user/menubg_off.gif");
		CacheImage("http://map.bkkpages.com/images/user/menubg_on.gif");
		CacheImage("http://map.bkkpages.com/images/user/menubg_selectedoff.gif");
		CacheImage("http://map.bkkpages.com/images/user/menubg_selectedon.gif");
		CacheImage("http://map.bkkpages.com/images/user/menubg_divider.gif");
	}
}

function IsNumeric(vValue) {
	vValue = vValue.trim();

	// check acceptable characters
	for (var iIndex = 0; iIndex < vValue.length; iIndex++) {
		bCharValid = ValidChar(vValue.charAt(iIndex), "-0123456789.");
		if (bCharValid != true) {
			return false;
		}
	}

	// check repetition of minus sign
	iPointCount = 0;
	for (var iIndex = 0; iIndex < vValue.length; iIndex++) {
		if (vValue.charAt(iIndex) == "-") {
			iPointCount++;
			if (iPointCount > 1) {
				return false;
			}
		}
	}

	// check repetition of digital point
	iPointCount = 0;
	for (var iIndex = 0; iIndex < vValue.length; iIndex++) {
		if (vValue.charAt(iIndex) == ".") {
			iPointCount++;
			if (iPointCount > 1) {
				return false;
			}
		}
	}

	return true;
}

function Logout() {
	SetLoginRedirect('');
	if (gc_bLiveServer == true) {
		self.location.href='http://www.bkkpages.com/db_user_logout.php';
	} else {
		self.location.href='db_user_logout.php';
	}
}

function MapLoaded() {
	g_bMapLoaded = true;
}

function SetLoginRedirect(sURL) {
	// retrieve url
	if (sURL.length < 1) {
		sURL = self.location.href;
	}

	// dont allow 'neighbourhood' pages
	if ((sURL.indexOf("page_neighbourhood") == -1) &&
		  (sURL.indexOf(".com/neighbourhood") == -1) &&
		  (sURL.indexOf(".com/add-neighbourhood") == -1)) {
  	var dtCookieDate = new Date();
  	dtCookieDate.setFullYear(dtCookieDate.getFullYear() + 1);
  	document.cookie = ("sLoginRedir=" + sURL + ";path=/;expires=" + dtCookieDate.toGMTString());
	}
}

/* ---------------------------------------------------------
AdSense
--------------------------------------------------------- */
function AdSenseStyle(sStyle) {
	switch (sStyle) {
		case "125x125d9deed":
			google_ad_width 			= 125;
			google_ad_height 			= 125;
			google_ad_format 			= "125x125_as";
			google_ad_type 				= "text_image";
			//2007-02-08: search
			google_ad_channel 		= "2344555607";
			google_color_border 	= "D9DEED";
			google_color_bg 			= "D9DEED";
			google_color_link 		= "0023A4";
			google_color_text 		= "333333";
			google_color_url 			= "0023A4";
			break;
		case "234x60d9deed":
			google_ad_width 			= 234;
			google_ad_height 			= 60;
			google_ad_format 			= "234x60_as";
			google_ad_type 				= "text";
			// footer
			google_ad_channel 		= "8721092803";
			google_color_border 	= "D9DEED";
			google_color_bg 			= "D9DEED";
			google_color_link 		= "0023A4";
			google_color_text 		= "333333";
			google_color_url 			= "0023A4";
			break;
		case "468x60d9deed":
			google_ad_width 			= 468;
			google_ad_height 			= 60;
			google_ad_format 			= "468x60_as";
			google_ad_type 				= "text_image";
			// footer
			google_ad_channel 		= "8721092803";
			google_color_border 	= "D9DEED";
			google_color_bg 			= "D9DEED";
			google_color_link 		= "0023A4";
			google_color_text 		= "333333";
			google_color_url 			= "0023A4";
			break;
		case "468x60ededed":
			google_ad_width 			= 468;
			google_ad_height 			= 60;
			google_ad_format 			= "468x60_as";
			google_ad_type 				= "text";
			// footer
			google_ad_channel 		= "8721092803";
			google_color_border 	= "EDEDED";
			google_color_bg 			= "EDEDED";
			google_color_link 		= "0023A4";
			google_color_text 		= "333333";
			google_color_url 			= "0023A4";
			break;
	}
}


/* ---------------------------------------------------------
Currency Exchange
--------------------------------------------------------- */
function AddCommas(nStr) {
	// http://www.mredkj.com/javascript/nfbasic.html
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}

function CurrencyExchange(iConversionRate, sCurrCode) {
	bToTHB = (document.getElementById("exchange_direction").value == "toTHB");
	vFromValue = document.getElementById("exchange_amount").value;

	// check for "", ".", "-" & "-."
	if ((vFromValue.length < 1) || (vFromValue == ".") || (vFromValue == "-") || (vFromValue == "-.") || (vFromValue == ".-")) {
		vFromValue = "0";
	}

	if (IsNumeric(vFromValue) == true) {
		vFromValue = parseFloat(vFromValue);
		if (bToTHB == true) {
			iToValue = (vFromValue / iConversionRate);
			sToValue = AddCommas(iToValue.toFixed(3));
			if (sToValue.length > 15) {
				sHTML = "<div class=\"small\">" + AddCommas(vFromValue) + " " + sCurrCode + " = </div>" +
								"<div class=\"medium\">" + sToValue + "<span>THB</span></div>";
			} else {
				sHTML = "<div class=\"small\">" + AddCommas(vFromValue) + " " + sCurrCode + " = </div>" +
								"<div class=\"big\">" + sToValue + "<span>THB</span></div>";
			}
		} else {
			iToValue = (vFromValue * iConversionRate);
			sToValue = AddCommas(iToValue.toFixed(3));
			if(sToValue.length > 15) {
				sHTML = "<div class=\"small\">" + AddCommas(vFromValue) + " THB = </div>" +
								"<div class=\"medium\">" + sToValue + "<span>" + sCurrCode + "<span></div>";
			} else {
				sHTML = "<div class=\"small\">" + AddCommas(vFromValue) + " THB = </div>" +
								"<div class=\"big\">" + sToValue + "<span>" + sCurrCode + "<span></div>";
			}
		}
	} else {
		sHTML = "The value you entered is not numeric. Please try again.";
	}
	document.getElementById("exchange_result").innerHTML = sHTML;
}


/* ---------------------------------------------------------
Directory
--------------------------------------------------------- */
function DirectoryShow(iCoordX, iCoordY, bActive) {
  sString = ("a" + iCoordX + "b" + iCoordY + "c");
  objImg = document.getElementsByTagName("img");
  for (var iIndex = 0; iIndex < objImg.length; iIndex++) {
    sID = objImg[iIndex].id;
    sImage = "http://map.bkkpages.com/images/directory/pointer_";
    if (objImg[iIndex].src.indexOf('pointerP', 0) > -1) {
      sImage = "http://map.bkkpages.com/images/directory/pointerP_";
    }
    if (sID.substr(0, sString.length) == sString) {
      if (bActive == true) {
        objImg[iIndex].src = (sImage + "on.gif");
      } else {
        objImg[iIndex].src = (sImage + "off.gif");
      }
    } else {
      if (objImg[iIndex].alt == "pointer graphic") {
        objImg[iIndex].src = (sImage + "off.gif");
      }
    }
  }
}

function DirectorySort(sValue, sCategory) {
	self.location.href = ("db_directory_sort.php?sort=" + sValue + "&category=" + sCategory);
}


/* ---------------------------------------------------------
Form Validation
--------------------------------------------------------- */
String.prototype.trim = function() {
   return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
   return this.replace(/^\s+/g,"");
}
String.prototype.rtrim = function() {
   return this.replace(/\s+$/g,"");
}

function ValidateEmail(sString) {
	// trim leading and trailing spaces
	sString = sString.trim();

	// check for spaces
	sString = sString.toLowerCase();
	for (var iIndex = 0; iIndex < sString.length; iIndex++) {
		bCharValid = ValidChar(sString.charAt(iIndex),
													 "abcdefghijklmnopqrstuvwxyz0123456789@-_.");
		if (bCharValid != true) {
			return false;
		}
	}

	// check for single '@' sign
	arrEmail = sString.split("@");
	if (arrEmail.length != 2) {
		return false;
	}

	// check before '@' sign
	if (arrEmail[0].length < 1) {
		return false;
	}

	// check after '@' sign
	arrDomain = arrEmail[1].split(".");
	if (arrDomain.length < 2) {
		return false;
	}
	for (var iIndex = 0; iIndex < arrDomain.length; iIndex++) {
		if ((arrDomain[iIndex].length < 1) || (arrDomain[iIndex].length > 64)) {
			return false;
		}
	}

	// email is valid
	return true;
}

function ValidateForm(objForm) {
	bValid = ValidateEmail(objForm.contact_email.value);
	if (bValid != true) {
		alert("The email address you entered was invalid. Please try again.");
		return false;
	}
}

function ValidChar(sSingle, sChars) {
	bValid = false;
	for (var iIndex = 0; iIndex < sChars.length; iIndex++) {
		if (sSingle == sChars.charAt(iIndex)) {
			return true;
		}
	}
	return false;
}


/* ---------------------------------------------------------
Get Involved
--------------------------------------------------------- */
function GIFindBusiness(sValue) {
  var sXMLURL = ("xml_findbusiness.php?search=" + sValue);
  var Callback = {
    success: function(objXML) {
      objBiz = objXML.responseXML.documentElement.getElementsByTagName("business");
			arrBiz = new Array();
      for (var iIndex = 0; iIndex < objBiz.length; iIndex++) {
				arrBiz.push("<span class=\"link\" style=\" font-size: 14px;\" onclick=\"GISelectBusiness('" +
		      				  objBiz[iIndex].getAttribute("url") + "')\">" +
		      				  objBiz[iIndex].getAttribute("title") + "</span>" +
      				  		"<div class=\"giFindBusinessAddress\">" +
      				  		objBiz[iIndex].getAttribute("address") + "</div>\n");
      }
      if (arrBiz.length > 0) {
				arrBiz = GIDisplayBusiness(arrBiz, 4, "findbusiness1");
				arrBiz = GIDisplayBusiness(arrBiz, 3, "findbusiness2");
				arrBiz = GIDisplayBusiness(arrBiz, 2, "findbusiness3");
				arrBiz = GIDisplayBusiness(arrBiz, 1, "findbusiness4");
      	document.getElementById("giFindBusinessResults").style.display = "block";
      	document.getElementById("giFindBusinessNoResult").style.display = "none";
      } else {
      	document.getElementById("giFindBusinessResults").style.display = "none";
      	document.getElementById("giFindBusinessNoResult").style.display = "block";
      }
    }
  }
  if (sValue.length > 1) {
    var AJAX = YAHOO.util.Connect.asyncRequest('GET', sXMLURL, Callback, null);
  } else {
    document.getElementById("giFindBusinessResults").style.display = "none";
    document.getElementById("giFindBusinessNoResult").style.display = "none";
  }
}

function GIDisplayBusiness(arrBiz, iColumn, sTDID) {
	sHTML = "";
	for (var iIndex = 0; iIndex < Math.ceil(arrBiz.length / iColumn); iIndex++) {
		sHTML += arrBiz[iIndex];
	}
	document.getElementById(sTDID).innerHTML = sHTML;
	return arrBiz.slice(Math.ceil(arrBiz.length / iColumn));
}

function GISelectBusiness(sURL) {
	document.getElementById("business_id").value = sURL;
	document.getElementById("business_form").submit();
}


/* ---------------------------------------------------------
Homepage
--------------------------------------------------------- */
function HomepageWhatsOn() {
  var Callback = {
    success: function(objXML) {
      objEvent = objXML.responseXML.documentElement.getElementsByTagName("event");
      sHTML = "";
      for (var iIndex = 0; iIndex < objEvent.length; iIndex++) {
      	sHTML += "<div class=\"HomeWhatsOnLabel\"><a href=\"" +
      					 objEvent[iIndex].getAttribute("eurl") +
      		       "\" class=\"noUnderline\" style=\"font-weight: bold;\">" +
      		       objEvent[iIndex].getAttribute("etitle") +
      		       "</a> @ <a href=\"" + objEvent[iIndex].getAttribute("vurl") +
      		       "\" class=\"noUnderline\" style=\"font-weight: bold;\">" +
      		       objEvent[iIndex].getAttribute("vname") +
      		       "</a></div><div class=\"HomeWhatsOnTime\">Starts in " +
      		       objEvent[iIndex].getAttribute("st") + "</div>";
      }
      document.getElementById("HomepageWhatsOn").innerHTML = sHTML;
    }
  }
  var AJAX = YAHOO.util.Connect.asyncRequest('GET', "xml_homepage_whatson.php", Callback, null);
}


/* ---------------------------------------------------------
Location Setting
--------------------------------------------------------- */
function PassLocation(iX, iY, sURL) {
  var dtCookieDate = new Date();
  dtCookieDate.setFullYear(dtCookieDate.getFullYear() + 1);
  document.cookie = ("location=" + iX + "." + iY +
                     ";path=/;expires=" + dtCookieDate.toGMTString());
  self.location.href = sURL;
}

function SetLocation() {
  var dtCookieDate = new Date();
  dtCookieDate.setFullYear(dtCookieDate.getFullYear() + 1);
  document.cookie = ("location=" + g_iCoordX + "." + g_iCoordY +
                     ";path=/;expires=" + dtCookieDate.toGMTString());
  self.location.href = gc_sNeighbourhoodSet;
}

function NudgeMap(iX, iY) {
  document.SWFmap.SetVariable("g_iNudgeX", iX);
  document.SWFmap.SetVariable("g_iNudgeY", iY);
}

function SetCoords(iX, iY) {
  g_iCoordX = iX;
  g_iCoordY = iY;
}


/* ---------------------------------------------------------
Map Slide and Pulse
--------------------------------------------------------- */
function AutoPulse() {
  clearTimeout(g_iPulseTimer);
  Pulse(g_iPulseX, g_iPulseY);
  g_iPulseTimer = setTimeout(AutoPulse, 2500);
}

function Pulse(iCoordX, iCoordY) {
	if (g_bMapLoaded == true) {
	  document.SWFmap.SetVariable("g_iPulseX", iCoordX);
  	document.SWFmap.SetVariable("g_iPulseY", iCoordY);
  	document.SWFmap.SetVariable("g_iPulseActive", 1);
  }
}

function SlideMap(iCoordX, iCoordY) {
	if (g_bMapLoaded == true) {
	  Pulse(iCoordX, iCoordY);
  	document.SWFmap.SetVariable("g_iSlideTargetX", iCoordX);
  	document.SWFmap.SetVariable("g_iSlideTargetY", iCoordY);
  	document.SWFmap.SetVariable("g_iSlideProcess", 1);
  }
}


/* ---------------------------------------------------------
Message Block
--------------------------------------------------------- */
function MessageBlockClose() {
   var attributes = {
      height: { to: 1 }
   };

   var anim = new YAHOO.util.Anim('MessageBlock', attributes, 0.5, YAHOO.util.Easing.backIn);
	 anim.onComplete.subscribe(MessageBlockDestroy);
   anim.animate();
}

function MessageBlockDestroy() {
	document.getElementById('MessageBlock').style.display = 'none';
}



/* ---------------------------------------------------------
Search Box
--------------------------------------------------------- */
function SearchBox(objSearch, bFocus, sSearchDefault) {
  if (bFocus == true) {
    if (objSearch.value == sSearchDefault) {
      objSearch.value = "";
    }
    SearchDictionary(objSearch);
  } else {
    if (objSearch.value == "") {
      objSearch.value = sSearchDefault;
    }
  }
}

function SearchValidate(objForm) {
	bSearch = true;
	switch (objForm.search.value.toLowerCase()) {
		case "":
		case "search...":
			bSearch = false;
			objForm.search.value = "Type something...";
			break;
		case "type anything...":
		case "type something...":
			bSearch = false;
			objForm.search.value = "Type anything...";
			break;
	}
	return bSearch;
}

function SearchDictionary(objSearchBox) {
	// put values into array
	arrValues = objSearchBox.value.ltrim().split(" ");

	// find last valid segment
	iCurrentItem = (arrValues.length - 1);
	while (arrValues[iCurrentItem].length < 1) {
		iCurrentItem--;
		if (iCurrentItem < 0) {
			SearchDictionaryHide();
			return false;
		}
	}

	// exit if too short
	sSearchTerm = arrValues[iCurrentItem].split("&").join("");
	if (sSearchTerm.length < 3) {
		SearchDictionaryHide();
		return false;
	}

	// perform search
	var sXMLURL = ("xml_dictionary.php?search=" + sSearchTerm);
  var Callback = {
    success: function(objXML) {
      objDict = objXML.responseXML.documentElement.getElementsByTagName("word");
			arrDict = new Array();
      if (objDict.length > 0) {
      	sHTML = "";
      	iClassNumber = 0;
      	for (var iIndex = 0; iIndex < objDict.length; iIndex++) {
      		iClassNumber++;
      		if (iClassNumber > 2) {
      			iClassNumber = 1;
      		}
      		sHTML += ("<div class=\"off" + iClassNumber + "\" onmouseover=\"SearchDictionaryMouseOver(this);\" onmouseout=\"SearchDictionaryMouseOut(this, " + iClassNumber + ");\" onclick=\"SearchDictionaryClick(this)\">" + objDict[iIndex].getAttribute("value") + "</div>\n");
      	}
      	sHTML += "<img src=\"http://map.bkkpages.com/images/searchbottom.gif\" />";
      	document.getElementById("Dictionary").innerHTML = sHTML;
				document.getElementById("Dictionary").style.display = "block";
      } else {
				SearchDictionaryHide();
      }
    }
  }
  var AJAX = YAHOO.util.Connect.asyncRequest('GET', sXMLURL, Callback, null);
}

function SearchDictionaryClick(objDiv) {
	// get search box
	objInput = document.getElementsByTagName("input");
	for (var iIndex = 0; iIndex < objInput.length; iIndex++) {
		if (objInput[iIndex].className = "searchtext") {
			objSearchBox = objInput[iIndex];
			break;
		}
	}

	// put values into array
	arrValues = objSearchBox.value.ltrim().split(" ");

	// find last valid segment
	iCurrentItem = (arrValues.length - 1);
	while (arrValues[iCurrentItem].length < 1) {
		iCurrentItem--;
		if (iCurrentItem < 0) {
			SearchDictionaryHide();
			return false;
		}
	}

	// replace segment
	arrValues[iCurrentItem] = objDiv.innerHTML
	objSearchBox.value = arrValues.join(" ");
	SearchDictionaryHide();
}

function SearchDictionaryHide() {
	document.getElementById("Dictionary").style.display = "none";
}

function SearchDictionaryMouseOver(objDiv) {
	objDiv.className = "on";
	clearTimeout(g_iDictionaryTimer);
}

function SearchDictionaryMouseOut(objDiv, iClassNumber) {
	objDiv.className = ("off" + iClassNumber);
	g_iDictionaryTimer = setTimeout(SearchDictionaryHide, 150);
}


/* ---------------------------------------------------------
Style Switching
--------------------------------------------------------- */
function CheckStylesheet() {
	if (gc_bStyleSwitch == true) {
		// find screeen width
		iWidth = 1024;
		if (window.innerWidth){
			iWidth = window.innerWidth;
		}	else if (document.documentElement && (document.documentElement.clientWidth != 0)) {
			iWidth = document.documentElement.clientWidth;
		} else if (document.body) {
			iWidth = document.body.clientWidth;
		}
		if (iWidth < 1000) {
			sStyle = "www800";
		} else {
			sStyle = "www1024";
		}

		// set appropriate style
		objLink = document.getElementsByTagName("link");
		for (var iIndex = 0; iIndex < objLink.length; iIndex++) {
			if ((objLink[iIndex].getAttribute("rel").indexOf("style") > -1) && (objLink[iIndex].getAttribute("title"))) {
				if (objLink[iIndex].getAttribute("title") == sStyle) {
					if (objLink[iIndex].disabled != false) {
						objLink[iIndex].disabled = false;
					}
				} else {
					if (objLink[iIndex].disabled != true) {
						objLink[iIndex].disabled = true;
					}
				}
			}
		}

		// set cookie
		var objDate = new Date();
		objDate.setFullYear(objDate.getFullYear() + 1);
		document.cookie = ("sCSS=" + sStyle + "; expires=" + objDate.toGMTString());
	}
}


/* ---------------------------------------------------------
Tabs
--------------------------------------------------------- */
function HomeTabMouseAction(bHover) {
	window.clearInterval(g_iHomeTabTimer);
	if (bHover != true) {
		g_iHomeTabTimer = window.setInterval(HomeTabRotate, gc_iHomeTabSpeed);
	}
}

function HomeTabRotate() {
	window.clearInterval(g_iHomeTabTimer);
	g_iCurrentHomeTab++;
	if (g_iCurrentHomeTab >= gc_iHomeTabCount) {
		g_iCurrentHomeTab = 0;
	}
	ShowHomeTab(g_iCurrentHomeTab);
	g_iHomeTabTimer = window.setInterval(HomeTabRotate, gc_iHomeTabSpeed);
}

function ShowHomeTab(iTabIndex) {
	g_iCurrentHomeTab = iTabIndex;
	objTabs = document.getElementsByTagName("li");
	for (iIndex = 0; iIndex < objTabs.length; iIndex++) {
		if ((objTabs[iIndex].className == "focused") || (objTabs[iIndex].className == "blurred")) {
			if (objTabs[iIndex].id == ("tab" + iTabIndex)) {
				objTabs[iIndex].className = "focused";
			} else {
				objTabs[iIndex].className = "blurred";
			}
		}
	}

	objDivs = document.getElementsByTagName("div");
	for (iIndex = 0; iIndex < objDivs.length; iIndex++) {
		if ((objDivs[iIndex].className == "tabcontentOnHome") || (objDivs[iIndex].className == "tabcontentOffHome")) {
			if (objDivs[iIndex].id == ("tabcontent" + iTabIndex)) {
				objDivs[iIndex].className = "tabcontentOnHome";
			} else {
				objDivs[iIndex].className = "tabcontentOffHome";
			}
		}
	}
}

function ShowTab(iTabIndex) {
	objTabs = document.getElementsByTagName("li");
	for (iIndex = 0; iIndex < objTabs.length; iIndex++) {
		if ((objTabs[iIndex].className == "focused") || (objTabs[iIndex].className == "blurred")) {
			if (objTabs[iIndex].id == ("tab" + iTabIndex)) {
				objTabs[iIndex].className = "focused";
			} else {
				objTabs[iIndex].className = "blurred";
			}
		}
	}

	objDivs = document.getElementsByTagName("div");
	for (iIndex = 0; iIndex < objDivs.length; iIndex++) {
		if ((objDivs[iIndex].className == "tabcontentOn") || (objDivs[iIndex].className == "tabcontentOff")) {
			if (objDivs[iIndex].id == ("tabcontent" + iTabIndex)) {
				objDivs[iIndex].className = "tabcontentOn";
			} else {
				objDivs[iIndex].className = "tabcontentOff";
			}
		}
	}
}


/* ---------------------------------------------------------
User Menus
--------------------------------------------------------- */
function SubMenuHideAll() {
	arrDiv = YAHOO.util.Dom.getElementsByClassName("subshow", "div", "userbar");
	if (arrDiv.length > 0) {
		for (iIndex = 0; iIndex < arrDiv.length; iIndex++) {
			arrDiv[iIndex].className = "subhide";
		}
	}
}

function SubMenuShow(objLI, sID) {
	SubMenuHideAll();
	document.getElementById(sID).className = "subshow";
}

function UserAddFavourite(iID, bLoggedIn) {
  var dtCookieDate = new Date();
  dtCookieDate.setFullYear(dtCookieDate.getFullYear() + 1);
  document.cookie = ("favid=" + iID +
                     ";path=/;expires=" + dtCookieDate.toGMTString());
  document.cookie = ("favurl=" + window.location +
                     ";path=/;expires=" + dtCookieDate.toGMTString());
  if (bLoggedIn == true) {
		self.location.href = "http://www.bkkpages.com/db_user_addfavourite.php";
	} else {
		self.location.href = "http://www.bkkpages.com/login";
	}
}

function UserChangeLocation(iID) {
	self.location.href = ("http://www.bkkpages.com/db_user_changelocation.php?id=" + iID + "&redirect=" + window.location);
}

function UserEditLocation(iID, sURL) {
  var dtCookieDate = new Date();
  dtCookieDate.setFullYear(dtCookieDate.getFullYear() + 1);
  document.cookie = ("changelocation=" + iID +
                     ";path=/;expires=" + dtCookieDate.toGMTString());
  self.location.href = sURL;
}


/* ---------------------------------------------------------
What's On
--------------------------------------------------------- */
function WhatsOnSort(sSort, sURL, sDate) {
	self.location.href = ("db_whatson_sort.php?sort=" + sSort + "&cat=" + sURL + "&date=" + sDate);
}

function WhatsOnMonth(iMonth) {
	if (g_bPageLoaded == true) {
		arrMonth = new Array();
		for (var i = 0; i < 5; i++) {
			if (i == iMonth) {
				document.getElementById("month" + i).className = "whatsonmonthOn";
				arrMonth[i] = new YAHOO.util.Anim(('calendar' + i), {height: {to: 152}}, 0.3);
			} else {
				document.getElementById("month" + i).className = "whatsonmonthOff";
				arrMonth[i] = new YAHOO.util.Anim(('calendar' + i), {height: {to: 1}}, 0.3);
			}
			arrMonth[i].animate();
		}
	}
}
