(function(){CNB.TR={};CNB.initNavOverlay=function(){try{var a=$("header-sec");var d=a.getElements(".nav-sec li");var c=a.getElements(".overlay-pop");var b=new CNB.Pop(d,c,{offset:{x:0,y:-2}}).load();var f=$("member-tools");var d=f.getElements(".my-profile");var c=f.getElements(".overlay-pop");var b=new CNB.Pop(d,c,{offset:{x:0,y:-2}}).load()}catch(e){}};CNB.TR.LandingPad=new Class({initialize:function(){this.state=Cookie.read("landing-pad");this.container=$("landing");this.btn=this.container.getElements(".landing-collapse");this.content=this.container.getElements(".landing-pad")},load:function(){if(this.state=="collapsed"){this.hide()}else{this.btn.set("text","Collapse -")}this.btn.addEvent("click",this.toggle.bind(this))},toggle:function(){if(this.state=="collapsed"){this.show()}else{this.hide()}},show:function(){this.state="expanded";this.content.setStyle("display","block");this.setCookie(this.state);this.btn.set("text","Collapse -")},hide:function(){this.state="collapsed";this.content.setStyle("display","none");this.setCookie(this.state);this.btn.set("text","Expand +")},setCookie:function(a){Cookie.write("landing-pad",a,{duration:30,domain:CNB.getCookieHost(),path:"/"})}});CNB.clickableSkin={load:function(c,b,a){this.elements=$$(c);this.container=$(a);this.content=$(b);if(!$chk(this.elements)||!$chk(this.container)||!$chk(this.content)){return false}this.container.setStyle("position","relative");this.setClickableArea();window.addEvent("resize",this.setClickableArea.bind(this))},setClickableArea:function(){var e=this.container.getScrollSize();var d=this.content.getSize();var c=e.x-d.x;var b=(c>0)?Math.floor(c/2):0;var a=e.y;if(b>0&&a>0){this.elements.each(function(g,f){g.setStyles({position:"absolute","z-index":"1",top:"0",left:0,width:b,height:a});if(f==1){g.setStyles({left:"auto",right:"0"})}})}}};CNB.Overlay.loadEmail=function(b){var c=function(g,f){g.stop();a.loader.add();var d=new Request.JSON({url:f.getProperty("action"),data:f.toJSON(),onSuccess:function(e){if(e.status=="success"){a.notify("Your message has been sent.")}else{a.notify("Sorry we can't send your message at this time.")}},onComplete:a.loader.remove.bind(a.loader),onFailure:function(e){a.notify("Sorry we can't send your message at this time.")}}).post()};var a=new CNB.Overlay.Async(b);a.addOneEvent("contentReady",function(d){var e=new CNB.Validator(d.getElement("form"),{onValidateSuccess:c})});a.open()};CNB.SubscribePromo=new Class({initialize:function(b,a){this.loggedOutForm=$(a);this.loggedInForm=$(b);this.loader=new CNB.Loading(this.loggedInForm);this.loggedOutForm.addEvent("submit",this.loggedOutSubmit.bind(this));this.validate=new CNB.Validator(this.loggedInForm,{onValidateSuccess:CNB.Reg.checkLoggedIn.bindWithEvent(CNB.Reg,this.loggedInSubmit.bind(this))})},loggedOutSubmit:function(a){a.stop();CNB.Reg.join({data:this.loggedOutForm.toJSON()})},loggedInSubmit:function(){this.loader.add();var a=new Request.JSON({url:this.loggedInForm.getProperty("action"),data:$merge(this.loggedInForm.toJSON(),{appId:"243",updateUser:true}),onSuccess:this.subscribeResponse.bind(this),onComplete:this.loader.remove.bind(this.loader),onFailure:function(b){this.subscribeResponse({status:"failure"})}}).post()},subscribeResponse:function(a){switch(a.status){case"success":msg="Thank you for subscribing.";break;default:msg="Sorry, we encountered a problem, and can't process your request at this time."}this.loggedInForm.empty().set("html",'<p class="heavy c-6">'+msg+"</p>")}});CNB.RegOverlay=new Class({initialize:function(){this.isUser=(Cookie.read("purs_3")!=null)?true:false;this.hasViewed=(Cookie.read("reg-overlay")!=null)?true:false},load:function(){if(this.isUser||this.hasViewed){return false}var b=location.pathname;var a=location.hostname;if(b.contains("/members/")){return false}if(!CNB.hasCookiesEnabled()){return false}this.overlay=new CNB.Overlay({id:"reg-pop-overlay",containerClass:"contain-overlay-14",content:this.buildContent(),onClose:function(){DW.redir({ctype:"reg-ol;act",cval:""})},onOpen:function(){DW.redir({ctype:"reg-ol;act",cval:"load"});Cookie.write("reg-overlay","1",{duration:30,domain:CNB.getCookieHost(),path:"/"})}}).open()},buildContent:function(){var a='<div class="hed hed-2"> <h6 class="h s-7 s-2">&#3650;&#3619;&#3591;&#3648;&#3619;&#3637;&#3618;&#3609;&#3648;&#3617;&#3639;&#3629;&#3591;&#3648;&#3594;&#3637;&#3618;&#3591;&#3619;&#3634;&#3618;&#3618;&#3636;&#3609;&#3604;&#3637;&#3605;&#3657;&#3629;&#3609;&#3619;&#3633;&#3610;</h6></div>';var c=new Element("div",{html:a});var f='<div align="justify"><font color=#A60000><b>     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#3611;&#3619;&#3632;&#3585;&#3634;&#3624;&#3592;&#3634;&#3585;&#3591;&#3634;&#3609;&#3624;&#3641;&#3609;&#3618;&#3660;&#3623;&#3636;&#3607;&#3618;&#3610;&#3619;&#3636;&#3585;&#3634;&#3619;&#3649;&#3621;&#3632;&#3585;&#3634;&#3619;&#3626;&#3639;&#3610;&#3588;&#3657;&#3609;&#3626;&#3635;&#3627;&#3619;&#3633;&#3610;&#3610;&#3640;&#3588;&#3588;&#3621;&#3634;&#3585;&#3619;&#3607;&#3656;&#3634;&#3609;&#3651;&#3604;&#3607;&#3637;&#3656;&#3605;&#3657;&#3629;&#3591;&#3585;&#3634;&#3619;&#3604;&#3634;&#3623;&#3650;&#3627;&#3621;&#3604;&#3652;&#3615;&#3621;&#3660;&#3648;&#3629;&#3585;&#3626;&#3634;&#3619;&#3588;&#3635;&#3626;&#3633;&#3656;&#3591;&#3627;&#3619;&#3639;&#3629;&#3611;&#3619;&#3632;&#3585;&#3634;&#3624;&#3605;&#3656;&#3634;&#3591; &#3651;&#3627;&#3657;&#3607;&#3656;&#3634;&#3609;&#3607;&#3635;&#3585;&#3634;&#3619; <a href="http://www.mcr-school.ac.th/index4.php?sub=register">&#3626;&#3617;&#3633;&#3588;&#3619;&#3648;&#3611;&#3655;&#3609;&#3626;&#3617;&#3634;&#3594;&#3636;&#3585;</a> &#3586;&#3629;&#3591;&#3648;&#3623;&#3655;&#3610;&#3652;&#3594;&#3605;&#3660;&#3650;&#3619;&#3591;&#3648;&#3619;&#3637;&#3618;&#3609;&#3648;&#3617;&#3639;&#3629;&#3591;&#3648;&#3594;&#3637;&#3618;&#3591;&#3619;&#3634;&#3618;&#3650;&#3604;&#3618;&#3651;&#3594;&#3657; &#3594;&#3639;&#3656;&#3629; - &#3626;&#3585;&#3640;&#3621; &#3586;&#3629;&#3591;&#3607;&#3656;&#3634;&#3609; &#3649;&#3621;&#3632;&#3607;&#3635;&#3585;&#3634;&#3619;&#3648;&#3586;&#3657;&#3634;&#3626;&#3641;&#3656;&#3619;&#3632;&#3610;&#3610;&#3648;&#3614;&#3639;&#3656;&#3629;&#3604;&#3634;&#3623;&#3650;&#3627;&#3621;&#3604;&#3652;&#3615;&#3621;&#3660;&#3648;&#3629;&#3585;&#3626;&#3634;&#3619;&#3604;&#3633;&#3591;&#3585;&#3621;&#3656;&#3634;&#3623;</b></font><a href="http://www.mcr-school.ac.th/index4.php?sub=viewinformation&amp;id=108">&#3619;&#3634;&#3618;&#3621;&#3632;&#3648;&#3629;&#3637;&#3618;&#3604;</a></div><iframe name="mcr_news" src="http://www.mcr-school.ac.th/mcrinformationf.php" frameborder="0" width="100%" height="320"></iframe><div align=right><a href=mailto:webmaster@mcr-school.ac.th>By WEBMASTER</a></div></div><div align =center><font size=4><a href=index2.php>&#3648;&#3586;&#3657;&#3634;&#3626;&#3641;&#3656;&#3627;&#3609;&#3657;&#3634;&#3627;&#3621;&#3633;&#3585;&#3650;&#3619;&#3591;&#3648;&#3619;&#3637;&#3618;&#3609;&#3648;&#3617;&#3639;&#3629;&#3591;&#3648;&#3594;&#3637;&#3618;&#3591;&#3619;&#3634;&#3618;</a></font></div>';var d=new Element("div",{"class":"content view-2 pad-1_5-a",html:f}).inject(c);var e=new Element("div",{"class":"lvl-btn clear space-1"}).inject(d,"bottom");var b=new Element("a",{"class":"",text:"",events:{click:function(){DW.redir({ctype:"reg-ol;act",cval:"signmeup"});this.overlay.remove();CNB.Reg.join({regSrc:"reg-over"})}.bind(this)}}).inject(e,"top");var j=new Element("span",{"class":"other-options right-1 s-11 sink-0_3",html:" &nbsp;|&nbsp; "}).inject(e,"bottom");var g=new Element("a",{text:"","class":"",events:{click:function(){this.overlay.removeEvents("");DW.redir({ctype:"reg-ol;act",cval:"nothanks"})}.bind(this)}}).inject(j,"top");var h=new Element("a",{html:"",events:{click:function(){DW.redir({ctype:"reg-ol;act",cval:"currentmember"});this.overlay.remove();if(typeof CNB.Reg.logIn!="undefined"){CNB.Reg.logIn({regSource:"reg-over"})}else{CNB.Reg.login({regSrc:"reg-over"})}}.bind(this)}}).inject(j,"bottom");return c}});CNB.Overlay.loadEmail=function(b){var c=function(g,f){g.stop();a.loader.add();var d=new Request.JSON({url:f.getProperty("action"),data:f.toJSON(),onSuccess:function(e){CNB.log(e);if(e.status=="success"){a.notify("Your message has been sent.")}else{a.notify("Sorry we can't send your message at this time.")}},onComplete:a.loader.remove.bind(a.loader),onFailure:function(e){a.notify("Sorry we can't send your message at this time.")}}).post()};var a=new CNB.Overlay.Async(b);a.addOneEvent("contentReady",function(d){var e=new CNB.Validator(d.getElement("form"),{onValidateSuccess:c})});a.open()};CNB.SearchSection=new Class({Implements:Options,options:{defaultSection:""},initialize:function(a,b){this.setOptions(b);this.container=$(a);this.form=this.container.getElement("form");this.overlay=this.container.getElement(".overlay-search");this.sectionOptions=this.overlay.getElements("a")},load:function(){this.sectionOptions.each(function(b){b.addEvent("click",this.handleClick.bindWithEvent(this,b))}.bind(this));var a=new CNB.Pop(this.form,this.overlay,{offset:{x:-5,y:5}}).load();if($chk(this.options.defaultSection)){this.setOnState(this.overlay.getElement("a[section="+this.options.defaultSection+"]"));this.setSection(this.options.defaultSection)}this.form.addEvent("submit",this.handleSubmitEvent.bind(this))},handleClick:function(c,a){c.stop();var b=a.getProperty("section");this.setSection(b);this.setOnState(a)},setOnState:function(a){this.sectionOptions.each(function(b){b.removeClass("on")});a.addClass("on")},setSection:function(b){switch(b){case"reviews":action="";title="Search Reviews";break;case"downloads":action="";title="Search Downloads";break;case"whitepapers":action="";title="Search Whitepapers";break;default:action="";title="Search All"}this.form.setProperty("action",action);var a=this.form.getElement("input");if(a.hasClass("placeholder")){a.set("value",title)}a.setProperty("placeholder",title)},handleSubmitEvent:function(b){b.stop();var a=this.form.getElement("input");a.set("value",a.get("value").toLowerCase());this.form.submit()}});CNB.PopSelect=new Class({Extends:CNB.Pop,options:{setSelectionOnClick:true,setMinWidth:true},initialize:function(c,d,b){this.parent(c,d,b);this.addEvent("open",function(e){if(this.options.setMinWidth){this.setMinWidth()}}.bind(this));var a=this.tabs[0].getStyle("width");this.tabs[0].setStyle("min-width",Math.ceil(a));this.contents[0].getElements("a").each(function(e){e.addEvent("click",this.handleClickEvent.bindWithEvent(this,e));if(e.hasClass("on")){this.setSelection(e)}},this)},handleClickEvent:function(b,a){if(this.options.setSelectionOnClick){this.setSelection(a);if(this.options.setMinWidth){this.setMinWidth()}}},setSelection:function(b){var c=b.getElement(".value");if(!c){c=b}var a=c.get("text");this.tabs[0].getElement(".selection").set("text",a)},setMinWidth:function(){var a=this.tabs[0].getStyle("width");this.contents[0].setStyle("min-width",a)}});CNB.PopSelect.MultiInit=function(b,c,a){b.each(function(f,e){var d=new CNB.PopSelect(f,c[e],a).load()})};CNB.ExcerptContent=new Class({Implements:Options,options:{limit:200,containerElement:"p",textMore:"Read More&nbsp;+",textLess:"Show Less&nbsp;-",suffix:"..."},initialize:function(a,b){this.setOptions(b);this.container=$(a);if(!this.container){return false}this.content=a.get("text").clean();if(this.content.length>this.options.limit){this.build();this.hide()}},build:function(){this.excerptContainer=new Element(this.options.containerElement,{"class":"content-show-more",html:this.getExcerpt(this.content)+" "});this.moreBtn=new Element("a",{"class":"btn-more more",html:this.options.textMore}).addEvent("click",this.show.bind(this)).inject(this.excerptContainer,"bottom");this.lessBtn=new Element("a",{"class":"btn-less more",html:this.options.textLess}).addEvent("click",this.hide.bind(this)).inject(this.container,"bottom");this.excerptContainer.inject(this.container,"before")},getExcerpt:function(b){var a=b.split("");if(a.length>this.options.limit){for(i=a.length-1;i>-1;--i){if(i>this.options.limit){a.length=i}else{if(" "===a[i]){a.length=i;break}}}a.push(this.options.suffix)}return a.join("")},show:function(){this.excerptContainer.setStyle("display","none");this.container.setStyle("display","block")},hide:function(a,b){this.excerptContainer.setStyle("display","block");this.container.setStyle("display","none")}});CNB.CharCounter=new Class({Implements:[Options,Events],options:{max:"6000",updateElementId:"chars-left",limitClass:"limit-chars"},initialize:function(a,b){this.setOptions(b);this.input=$(a);this.checkElement();this.input.addEvent("keydown",function(){this.checkElement()}.bind(this))},checkElement:function(){var b=this.input.get("value").length;var a=this.options.max.toInt()-b;if(b>=this.options.max.toInt()){$(this.options.updateElementId).set("text",0);if(!$(this.options.updateElementId).hasClass(this.options.limitClass)){$(this.options.updateElementId).addClass(this.options.limitClass)}}else{$(this.options.updateElementId).set("text",(a));if($(this.options.updateElementId).hasClass(this.options.limitClass)){$(this.options.updateElementId).removeClass(this.options.limitClass)}if(a<=5){$(this.options.updateElementId).addClass(this.options.limitClass)}}}});CNB.TR.SiteAction=new Class({Implements:[Options,Events],options:{url:"",data:{},regSrc:"site-action"},initialize:function(b,a){this.setOptions(a);this.anchor=$(b);if(!this.anchor){return false}this.data=this.options.data;this.url=this.options.url},makeRequest:function(){if(this.anchor.retrieve("isActive")){return false}this.anchor.store("isActive",true);this.anchor.addClass("loading");var a=new Request.JSON({url:this.url,data:this.data,onSuccess:function(b){if(typeof b=="undefined"||typeof b.status=="undefined"){CNB.log("json data is no good");return false}this.fireEvent(b.status,b)}.bind(this),onComplete:function(){this.fireEvent("complete");this.anchor.store("isActive",false);this.anchor.removeClass("loading")}.bind(this),onFailure:function(b){this.fireEvent("failure")}.bind(this)}).get()},gateRequest:function(){CNB.Reg.gatedEvent(null,this.makeRequest.bind(this),this.options.regSrc,"Please Log In First")}});CNB.TR.Favorite=new Class({Extends:CNB.TR.SiteAction,options:{onSuccess:function(a){if(a.actionType=="remove"){this.anchor.removeClass("is-favorite")}else{this.anchor.addClass("is-favorite")}},onFailure:function(){CNB.log("favorite failure")},regSrc:"favorite"},initialize:function(c,b,a){c.stop();this.parent(b,a);this.url=this.anchor.getProperty("href")},add:function(){this.data.actionType="add";this.gateRequest()},remove:function(){this.data.actionType="remove";this.gateRequest()},toggle:function(){if(this.anchor.hasClass("is-favorite")){this.remove()}else{this.add()}}});CNB.TR.toggleFavorite=function(c,a){var b=new CNB.TR.Favorite(c,a).toggle()};CNB.initCbsSitesPromo=function(a){a=$(a);if(!a){return false}window.rubicsResponse=function(c){a.set("html",c.rubics.response.bodyText).addClass("cbs-sites-promo")};var b=document.createElement("script");b.type="text/javascript";b.src="http://rok.com.com/rok-get?app_handle=netxp1&unit_sp=45&brand=9&wrapper=json";(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(b)};window.addEvent("domready",function(){var b=new CNB.RegOverlay().load();var a=$$(".skinClick");if($chk(a)){CNB.clickableSkin.load(a,"content","mantle_skin")}CNB.initCbsSitesPromo("cbs-sites-rubics-promo");$(document.body).addEvent("click:relay(a[siteaction=favorite])",CNB.TR.toggleFavorite)})})();
