var fx=new Object();fx.Base=function(){};fx.Base.prototype={setOptions:function(options){this.options={duration:500,onComplete:'',transition:fx.sinoidal}
Object.extend(this.options,options||{});},step:function(){var time=(new Date).getTime();if(time>=this.options.duration+this.startTime){this.now=this.to;clearInterval(this.timer);this.timer=null;if(this.options.onComplete)setTimeout(this.options.onComplete.bind(this),10);}
else{var Tpos=(time-this.startTime)/(this.options.duration);this.now=this.options.transition(Tpos)*(this.to-this.from)+this.from;}
this.increase();},custom:function(from,to){if(this.timer!=null)return;this.from=from;this.to=to;this.startTime=(new Date).getTime();this.timer=setInterval(this.step.bind(this),13);},hide:function(){this.now=0;this.increase();},clearTimer:function(){clearInterval(this.timer);this.timer=null;}}
fx.Layout=Class.create();fx.Layout.prototype=Object.extend(new fx.Base(),{initialize:function(el,options){this.el=$(el);this.el.style.overflow="hidden";this.iniWidth=this.el.offsetWidth;this.iniHeight=this.el.offsetHeight;this.setOptions(options);}});fx.Height=Class.create();Object.extend(Object.extend(fx.Height.prototype,fx.Layout.prototype),{increase:function(){this.el.style.height=this.now+"px";},toggle:function(){if(this.el.offsetHeight>0)this.custom(this.el.offsetHeight,0);else this.custom(0,this.el.scrollHeight);}});fx.Width=Class.create();Object.extend(Object.extend(fx.Width.prototype,fx.Layout.prototype),{increase:function(){this.el.style.width=this.now+"px";},toggle:function(){if(this.el.offsetWidth>0)this.custom(this.el.offsetWidth,0);else this.custom(0,this.iniWidth);}});fx.Opacity=Class.create();fx.Opacity.prototype=Object.extend(new fx.Base(),{initialize:function(el,options){this.el=$(el);this.now=1;this.increase();this.setOptions(options);},increase:function(){if(this.now==1&&(/Firefox/.test(navigator.userAgent)))this.now=0.9999;this.setOpacity(this.now);},setOpacity:function(opacity){if(opacity==0&&this.el.style.visibility!="hidden")this.el.style.visibility="hidden";else if(this.el.style.visibility!="visible")this.el.style.visibility="visible";if(window.ActiveXObject)this.el.style.filter="alpha(opacity="+opacity*100+")";this.el.style.opacity=opacity;},toggle:function(){if(this.now>0)this.custom(1,0);else this.custom(0,1);}});fx.sinoidal=function(pos){return((-Math.cos(pos*Math.PI)/2)+0.5);}
fx.linear=function(pos){return pos;}
fx.cubic=function(pos){return Math.pow(pos,3);}
fx.circ=function(pos){return Math.sqrt(pos);}
var bustcachevar=0
var loadstatustext="<div id='loading'><img src='http://www.monfx.com/wp-content/themes/grass/images/loading.gif' /></div>"
var loadedobjects=""
var defaultcontentarray=new Object()
var bustcacheparameter=""
function ajaxpage(url,containerid,targetobj){var page_request=false
if(window.XMLHttpRequest)
page_request=new XMLHttpRequest()
else if(window.ActiveXObject){try{page_request=new ActiveXObject("Msxml2.XMLHTTP")}
catch(e){try{page_request=new ActiveXObject("Microsoft.XMLHTTP")}
catch(e){}}}
else
return false
var ullist=targetobj.parentNode.parentNode.getElementsByTagName("li")
for(var i=0;i<ullist.length;i++)
ullist[i].className=""
targetobj.parentNode.className="selected"
if(url.indexOf("#default")!=-1){document.getElementById(containerid).innerHTML=defaultcontentarray[containerid]
return}
document.getElementById(containerid).innerHTML=loadstatustext
page_request.onreadystatechange=function(){loadpage(page_request,containerid)}
if(bustcachevar)
bustcacheparameter=(url.indexOf("?")!=-1)?"&"+new Date().getTime():"?"+new Date().getTime()
page_request.open('GET',url+bustcacheparameter,true)
page_request.send(null)}
function loadpage(page_request,containerid){if(page_request.readyState==4&&(page_request.status==200||window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText}
function loadobjs(revattribute){if(revattribute!=null&&revattribute!=""){var objectlist=revattribute.split(/\s*,\s*/)
for(var i=0;i<objectlist.length;i++){var file=objectlist[i]
var fileref=""
if(loadedobjects.indexOf(file)==-1){if(file.indexOf(".js")!=-1){fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");fileref.setAttribute("src",file);}
else if(file.indexOf(".css")!=-1){fileref=document.createElement("link")
fileref.setAttribute("rel","stylesheet");fileref.setAttribute("type","text/css");fileref.setAttribute("href",file);}}
if(fileref!=""){document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" "}}}}
function savedefaultcontent(contentid){if(typeof defaultcontentarray[contentid]=="undefined")
defaultcontentarray[contentid]=document.getElementById(contentid).innerHTML}
function startajaxtabs(){for(var i=0;i<arguments.length;i++){var ulobj=document.getElementById(arguments[i])
var ulist=ulobj.getElementsByTagName("li")
for(var x=0;x<ulist.length;x++){var ulistlink=ulist[x].getElementsByTagName("a")[0]
if(ulistlink.getAttribute("rel")){var modifiedurl=ulistlink.getAttribute("href").replace(/^http:\/\/[^\/]+\//i,"http://"+window.location.hostname+"/")
ulistlink.setAttribute("href",modifiedurl)
savedefaultcontent(ulistlink.getAttribute("rel"))
ulistlink.onclick=function(){ajaxpage(this.getAttribute("href"),this.getAttribute("rel"),this)
loadobjs(this.getAttribute("rev"))
return false}
if(ulist[x].className=="selected"){ajaxpage(ulistlink.getAttribute("href"),ulistlink.getAttribute("rel"),ulistlink)
loadobjs(ulistlink.getAttribute("rev"))}}}}}
var stretch;var stretch2;var stretch3;var stretch4;var stretch5;var stretch7;var stretch11;window.onload=function(){stretch4=new fx.Combo('stretch4',{height:true,opacity:false,duration:500});stretch=new fx.Combo('stretch',{height:true,opacity:false,duration:500});stretch2=new fx.Combo('stretch2',{height:true,opacity:false,duration:500});stretch3=new fx.Combo('stretch3',{height:true,opacity:false,duration:500});stretch7=new fx.Combo('stretch7',{height:true,opacity:false,duration:500});stretch11=new fx.Combo('stretch11',{height:true,opacity:false,duration:500});stretch5=new fx.Combo('stretch5',{height:true,opacity:false,duration:500});stretch7.hide();stretch4.hide();stretch11.hide();stretch.hide();}
