
var smsBoxSizeEffect=null;var smsBoxOpacity1=null;var smsBoxOpacity2=null;var smsMenuItemEffect=null;function showSMSForm(elLink){if(elLink&&elLink.blur)
elLink.blur();if(smsBoxSizeEffect!=null&&smsBoxSizeEffect.isRunning())
return;if(smsBoxSizeEffect==null||!smsBoxSizeEffect.isExpanded()){if(document.getElementById("active_smsklubben")){if(!smsMenuItemEffect)
smsMenuItemEffect=new OpacityFadeEffect(0.3);smsMenuItemEffect.startFadeEffect(document.getElementById("active_smsklubben"),null,false,fadeOutSMSMenuItem,1.0);}
var elBoxBg=document.getElementById("smsclubbox_bg");var elBoxContainer=document.getElementById("smsclubbox_content_container");elBoxBg.style.height=elBoxBg.style.width="0px";elBoxContainer.style.height=elBoxContainer.style.height="0px";setElementsByIdsDisplayBlock("smsclubbox_bg","smsclubbox_content","smsclubbox_content_container","smsformcontainer");setElementsByIdsDisplayNone("smsformsuccess");if(smsBoxOpacity1==null){smsBoxOpacity1=new OpacityFadeEffect(0.3);smsBoxOpacity2=new OpacityFadeEffect(0.3);}
smsBoxOpacity1.startFadeEffect(document.getElementById("smsclubbox_bg"),null,false,null,0.8);smsBoxOpacity2.startFadeEffect(document.getElementById("smsclubbox_content"),null,false,null,1.0);smsBoxSizeEffect=new SetPosSizeElementEffect(elBoxBg,elBoxContainer,0,606,0,403,smsBoxExpansionDoneCallback,0.3,false);smsBoxSizeEffect.toggleExpansion();}else{smsBoxOpacity1.startFadeEffect(document.getElementById("smsclubbox_bg"),null,true,null,0.0);smsBoxOpacity2.startFadeEffect(document.getElementById("smsclubbox_content"),null,true,smsBoxFadedOut,0.0);if(document.getElementById("active_smsklubben")){smsMenuItemEffect.startFadeEffect(document.getElementById("active_smsklubben"),null,false,fadeOutSMSMenuItem,1.0);}}}
function fadeOutSMSMenuItem(){smsMenuItemEffect.startFadeEffect(document.getElementById("active_smsklubben"),null,true,null,0.0);}
function smsBoxFadedOut(){smsBoxSizeEffect.expanded=false;setElementsByIdsDisplayNone("smsclubbox_bg","smsclubbox_content","smsclubbox_content_container","smsformcontainer","smsformsuccess");}
function smsBoxExpansionDoneCallback(){if(!smsBoxSizeEffect.isExpanded()){setElementsByIdsDisplayNone("smsclubbox_bg","smsclubbox_content");}}
function initNewsScroll(){var scroll=new Scroll("news_scrollbox","news_scrollinfo",580);scroll.msDelay=30;scroll.dx=2;var el=document.getElementById("news_scrollinfo");if(el){var comment=el.innerHTML;scroll.scroll('stop');el.innerHTML=comment;var elMeasuretext=document.getElementById("measuretext");elMeasuretext.innerHTML=comment;scroll.initScroll(elMeasuretext.clientWidth||elMeasuretext.offsetWidth);elMeasuretext.innerHTML="";el.style.visibility="visible";scroll.scroll('start');}}
function submitSMSClubForm(elForm){if(!fSMSClubBusy){fSMSClubBusy=true;var poststr="signup=true&"+FormCollect(elForm);setElementsByIdsDisplayInline("smssignupsubmitindicator");return new AJAXRequest("POST","/oleo_sms_club.php",poststr,"",processSMSClubSignupXML);}}
var fSMSClubBusy=false;function processSMSClubSignupXML(myAJAX){if(myAJAX.readyState==4){fSMSClubBusy=false;setElementsByIdsDisplayNone("smssignupsubmitindicator");setElementsByIdsHidden("year_birth_error");document.smsForm.name.className="inputfield";document.smsForm.mobile.className="inputfield";if(myAJAX.status==200){var xml=myAJAX.responseXML;if(xml.documentElement){var status=xml.documentElement.getElementsByTagName("status")[0].firstChild.nodeValue;if(status=='OK'){setElementsByIdsDisplayNone("smsformcontainer");var el=document.getElementById("smsformsuccess");el.innerHTML="Tack för din ansökan till Oléo SMS-klubb!";el.style.display="block";}else if(status=="login"){alert("Logga in först...");}else{handleSMSClubSignupError(xml);}}}}}
function handleSMSClubSignupError(xml){var fielderrors=xml.documentElement.getElementsByTagName("error");var errorsText="";var fFocused=false;for(var i=0;i<fielderrors.length;i++){var field=fielderrors[i].getAttributeNode("field").nodeValue;var error=fielderrors[i].firstChild.nodeValue;var el=null;if(field=="year_birth"){el=document.getElementById("year_birth_error");if(el){el.innerHTML="* Välj år";setElementsByIdsVisible("year_birth_error");}}else if(field=="no_group"){alert("Kryssa för minst ett intresseområde");}else{el=document.smsForm[field];if(el){el.className+=" error";}}
if(!fFocused){if(field=="year_birth"||field=="no_group"){fFocused=true;}else if(el){scrollToWindowElement(el);el.focus();fFocused=true;}}}}
function SetPosSizeElementEffect(el,el2,fromWidth,toWidth,fromHeight,toHeight,callback,duration,xAlignRightOffset){SetWidthElementEffect.base.constructor.call(this);this.effectDuration=duration?duration:0.3;this.el=el;this.el2=el2;this.fromWidth=fromWidth;this.toWidth=toWidth;this.fromHeight=fromHeight;this.toHeight=toHeight;this.effectEndFunction=callback;this.expanded=false;this.xAlignRightOffset=xAlignRightOffset;}
SetPosSizeElementEffect.inherits(BaseEffect);SetPosSizeElementEffect.prototype.setExpandedState=function(state){this.expanded=state;}
SetPosSizeElementEffect.prototype.isExpanded=function(){return this.expanded;}
SetPosSizeElementEffect.prototype.getElement=function(){return this.el;}
SetPosSizeElementEffect.prototype.quickCollapse=function(){if(this.expanded||this.effectInterval){if(this.effectInterval){clearInterval(this.effectInterval);this.effectInterval=null;}
this.expanded=false;}}
SetPosSizeElementEffect.prototype.toggleExpansion=function(){if(this.effectInterval)
return;this.el.style.width=(this.expanded?this.toWidth:this.fromWidth)+"px";if(this.setHidden)
this.el.style.visibility='visible';var _expanded=this.expanded;this.startEffect();return _expanded;}
SetPosSizeElementEffect.prototype.renderEffect=function(pos,cFrame){if(this.expanded){var width=this.toWidth+Math.round(pos*(this.fromWidth-this.toWidth));var height=this.toHeight+Math.round(pos*(this.fromHeight-this.toHeight));this.el.style.width=width+"px";this.el.style.height=height+"px";this.el2.style.width=width+"px";this.el2.style.height=height+"px";}else{var width=this.fromWidth+Math.round(pos*(this.toWidth-this.fromWidth));var height=this.fromHeight+Math.round(pos*(this.toHeight-this.fromHeight));this.el.style.width=width+"px";this.el.style.height=height+"px";this.el2.style.width=width+"px";this.el2.style.height=height+"px";if(this.xAlignRightOffset){var left=this.xAlignRightOffset-width;this.el.style.marginLeft=left+"px";this.el2.style.marginLeft=left+"px";}}}
SetPosSizeElementEffect.prototype.renderEffectDone=function(){this.expanded=!this.expanded;var self=this;if(this.effectEndFunction)
this.effectEndFunction(self);}