MooTools.More={version:"1.2.4.2dev",build:"%build%"};Fx.Elements=new Class({Extends:Fx.CSS,initialize:function(b,a){this.elements=this.subject=$$(b);this.parent(a);},compute:function(g,h,j){var c={};for(var d in g){var a=g[d],e=h[d],f=c[d]={};for(var b in a){f[b]=this.parent(a[b],e[b],j);}}return c;},set:function(b){for(var c in b){var a=b[c];for(var d in a){this.render(this.elements[c],d,a[d],this.options.unit);}}return this;},start:function(c){if(!this.check(c)){return this;}var h={},j={};for(var d in c){var f=c[d],a=h[d]={},g=j[d]={};for(var b in f){var e=this.prepare(this.elements[d],b,f[b]);a[b]=e.from;g[b]=e.to;}}return this.parent(h,j);}});var Drag=new Class({Implements:[Events,Options],options:{snap:6,unit:"px",grid:false,style:true,limit:false,handle:false,invert:false,preventDefault:false,modifiers:{x:"left",y:"top"}},initialize:function(){var b=Array.link(arguments,{options:Object.type,element:$defined});this.element=document.id(b.element);this.document=this.element.getDocument();this.setOptions(b.options||{});var a=$type(this.options.handle);this.handles=((a=="array"||a=="collection")?$$(this.options.handle):document.id(this.options.handle))||this.element;this.mouse={now:{},pos:{}};this.value={start:{},now:{}};this.selection=(Browser.Engine.trident)?"selectstart":"mousedown";this.bound={start:this.start.bind(this),check:this.check.bind(this),drag:this.drag.bind(this),stop:this.stop.bind(this),cancel:this.cancel.bind(this),eventStop:$lambda(false)};this.attach();},attach:function(){this.handles.addEvent("mousedown",this.bound.start);return this;},detach:function(){this.handles.removeEvent("mousedown",this.bound.start);return this;},start:function(c){if(c.rightClick){return;}if(this.options.preventDefault){c.preventDefault();}this.mouse.start=c.page;this.fireEvent("beforeStart",this.element);var a=this.options.limit;this.limit={x:[],y:[]};for(var d in this.options.modifiers){if(!this.options.modifiers[d]){continue;}if(this.options.style){this.value.now[d]=this.element.getStyle(this.options.modifiers[d]).toInt();}else{this.value.now[d]=this.element[this.options.modifiers[d]];}if(this.options.invert){this.value.now[d]*=-1;}this.mouse.pos[d]=c.page[d]-this.value.now[d];if(a&&a[d]){for(var b=2;b--;b){if($chk(a[d][b])){this.limit[d][b]=$lambda(a[d][b])();}}}}if($type(this.options.grid)=="number"){this.options.grid={x:this.options.grid,y:this.options.grid};}this.document.addEvents({mousemove:this.bound.check,mouseup:this.bound.cancel});this.document.addEvent(this.selection,this.bound.eventStop);},check:function(a){if(this.options.preventDefault){a.preventDefault();}var b=Math.round(Math.sqrt(Math.pow(a.page.x-this.mouse.start.x,2)+Math.pow(a.page.y-this.mouse.start.y,2)));if(b>this.options.snap){this.cancel();this.document.addEvents({mousemove:this.bound.drag,mouseup:this.bound.stop});this.fireEvent("start",[this.element,a]).fireEvent("snap",this.element);}},drag:function(a){if(this.options.preventDefault){a.preventDefault();}this.mouse.now=a.page;for(var b in this.options.modifiers){if(!this.options.modifiers[b]){continue;}this.value.now[b]=this.mouse.now[b]-this.mouse.pos[b];if(this.options.invert){this.value.now[b]*=-1;}if(this.options.limit&&this.limit[b]){if($chk(this.limit[b][1])&&(this.value.now[b]>this.limit[b][1])){this.value.now[b]=this.limit[b][1];}else{if($chk(this.limit[b][0])&&(this.value.now[b]<this.limit[b][0])){this.value.now[b]=this.limit[b][0];}}}if(this.options.grid[b]){this.value.now[b]-=((this.value.now[b]-(this.limit[b][0]||0))%this.options.grid[b]);}if(this.options.style){this.element.setStyle(this.options.modifiers[b],this.value.now[b]+this.options.unit);}else{this.element[this.options.modifiers[b]]=this.value.now[b];}}this.fireEvent("drag",[this.element,a]);},cancel:function(a){this.document.removeEvent("mousemove",this.bound.check);this.document.removeEvent("mouseup",this.bound.cancel);if(a){this.document.removeEvent(this.selection,this.bound.eventStop);this.fireEvent("cancel",this.element);}},stop:function(a){this.document.removeEvent(this.selection,this.bound.eventStop);this.document.removeEvent("mousemove",this.bound.drag);this.document.removeEvent("mouseup",this.bound.stop);if(a){this.fireEvent("complete",[this.element,a]);}}});Element.implement({makeResizable:function(a){var b=new Drag(this,$merge({modifiers:{x:"width",y:"height"}},a));this.store("resizer",b);return b.addEvent("drag",function(){this.fireEvent("resize",b);}.bind(this));}});Drag.Move=new Class({Extends:Drag,options:{droppables:[],container:false,precalculate:false,includeMargins:true,checkDroppables:true},initialize:function(b,a){this.parent(b,a);b=this.element;this.droppables=$$(this.options.droppables);this.container=document.id(this.options.container);if(this.container&&$type(this.container)!="element"){this.container=document.id(this.container.getDocument().body);}var c=b.getStyles("left","right","position");if(c.left=="auto"||c.top=="auto"){b.setPosition(b.getPosition(b.getOffsetParent()));}if(c.position=="static"){b.setStyle("position","absolute");}this.addEvent("start",this.checkDroppables,true);this.overed=null;},start:function(a){if(this.container){this.options.limit=this.calculateLimit();}if(this.options.precalculate){this.positions=this.droppables.map(function(b){return b.getCoordinates();});}this.parent(a);},calculateLimit:function(){var d=this.element.getOffsetParent(),g=this.container.getCoordinates(d),f={},c={},b={},i={},k={};["top","right","bottom","left"].each(function(o){f[o]=this.container.getStyle("border-"+o).toInt();b[o]=this.element.getStyle("border-"+o).toInt();c[o]=this.element.getStyle("margin-"+o).toInt();i[o]=this.container.getStyle("margin-"+o).toInt();k[o]=d.getStyle("padding-"+o).toInt();},this);var e=this.element.offsetWidth+c.left+c.right,n=this.element.offsetHeight+c.top+c.bottom,h=0,j=0,m=g.right-f.right-e,a=g.bottom-f.bottom-n;if(this.options.includeMargins){h+=c.left;j+=c.top;}else{m+=c.right;a+=c.bottom;}if(this.element.getStyle("position")=="relative"){var l=this.element.getCoordinates(d);l.left-=this.element.getStyle("left").toInt();l.top-=this.element.getStyle("top").toInt();h+=f.left-l.left;j+=f.top-l.top;m+=c.left-l.left;a+=c.top-l.top;if(this.container!=d){h+=i.left+k.left;j+=(Browser.Engine.trident4?0:i.top)+k.top;}}else{h-=c.left;j-=c.top;if(this.container==d){m-=f.left;a-=f.top;}else{h+=g.left+f.left;j+=g.top+f.top;}}return{x:[h,m],y:[j,a]};},checkAgainst:function(c,b){c=(this.positions)?this.positions[b]:c.getCoordinates();var a=this.mouse.now;return(a.x>c.left&&a.x<c.right&&a.y<c.bottom&&a.y>c.top);},checkDroppables:function(){var a=this.droppables.filter(this.checkAgainst,this).getLast();if(this.overed!=a){if(this.overed){this.fireEvent("leave",[this.element,this.overed]);}if(a){this.fireEvent("enter",[this.element,a]);}this.overed=a;}},drag:function(a){this.parent(a);if(this.options.checkDroppables&&this.droppables.length){this.checkDroppables();}},stop:function(a){this.checkDroppables();this.fireEvent("drop",[this.element,this.overed,a]);this.overed=null;return this.parent(a);}});Element.implement({makeDraggable:function(a){var b=new Drag.Move(this,a);this.store("dragger",b);return b;}});var Asset={javascript:function(f,d){d=$extend({onload:$empty,document:document,check:$lambda(true)},d);var b=new Element("script",{src:f,type:"text/javascript"});var e=d.onload.bind(b),a=d.check,g=d.document;delete d.onload;delete d.check;delete d.document;b.addEvents({load:e,readystatechange:function(){if(["loaded","complete"].contains(this.readyState)){e();}}}).set(d);if(Browser.Engine.webkit419){var c=(function(){if(!$try(a)){return;}$clear(c);e();}).periodical(50);}return b.inject(g.head);},css:function(b,a){return new Element("link",$merge({rel:"stylesheet",media:"screen",type:"text/css",href:b},a)).inject(document.head);},image:function(c,b){b=$merge({onload:$empty,onabort:$empty,onerror:$empty},b);var d=new Image();var a=document.id(d)||new Element("img");["load","abort","error"].each(function(e){var f="on"+e;var g=b[f];delete b[f];d[f]=function(){if(!d){return;}if(!a.parentNode){a.width=d.width;a.height=d.height;}d=d.onload=d.onabort=d.onerror=null;g.delay(1,a,a);a.fireEvent(e,a,1);};});d.src=a.src=c;if(d&&d.complete){d.onload.delay(1);}return a.set(b);},images:function(d,c){c=$merge({onComplete:$empty,onProgress:$empty,onError:$empty,properties:{}},c);d=$splat(d);var a=[];var b=0;return new Elements(d.map(function(e){return Asset.image(e,$extend(c.properties,{onload:function(){c.onProgress.call(this,b,d.indexOf(e));b++;if(b==d.length){c.onComplete();}},onerror:function(){c.onError.call(this,b,d.indexOf(e));b++;if(b==d.length){c.onComplete();}}}));}));}};;function linkFade(lfDiv){$$(lfDiv).each(function(div){var mouseFxs=new Fx.Tween(div,{duration:300,link:'cancel'});div.set('opacity',0.6);div.addEvents({'mouseover':function(){mouseFxs.start('opacity',[0.6,1]);},'mouseout':function(){mouseFxs.start('opacity',[1,0.6]);}});});}
function linkFadeMenu(lfDiv,color_end){$each($$(lfDiv),function(el){var original=el.getStyle('color');var morph=new Fx.Morph(el,{'duration':'300',link:'cancel'});el.addEvents({'mouseenter':function(){morph.start({'color':color_end})},'mouseleave':function(){morph.start({'color':original})}});});}
function linkFadeSubMenu(lfDiv,color_end){$each($$(lfDiv),function(el){var original=el.getStyle('color');var morph=new Fx.Morph(el,{'duration':'300',link:'cancel'});el.addEvents({'mouseenter':function(){morph.start({'color':color_end});morph.start({'background-color':"#DDD"})},'mouseleave':function(){morph.start({'color':original});morph.start({'background-color':"#EEE"})}});});}
function linkFadeIndex(lfDiv,color_start,color_end){$$(lfDiv).each(function(div){var mouseFxs=new Fx.Morph(div,{duration:300,link:'cancel'});div.addEvents({'mouseover':function(){mouseFxs.start({'color':[color_start,color_end],'background-color':['#222','#333']});},'mouseout':function(){mouseFxs.start({'color':[color_end,color_start],'background-color':['#333','#222']});}});});}
function customCheck(el){if(el.value.test(/^(http|https|ftp)\:\/\/[a-z0-9\-\.]+\.[a-z]{2,3}(:[a-z0-9]*)?\/?([a-z0-9\-\._\?\,\'\/\\\+&amp;%\$#\=~])*$/)){el.errors.push("Something wrong in the message (don\'t use link tag).");return false;}else{return true;}}
var Agent=navigator.userAgent.toLowerCase();var Opera=(Agent.indexOf("opera")!=-1);var Msie=(Agent.indexOf("msie")!=-1)&&document.all&&!Opera;var Safari=(Agent.indexOf("safari")!=-1);function addEventListenerBk(el,ev,fn){try{el.addEventListener(ev,fn,false);}catch(e){try{el.detachEvent('on'+ev,fn);el.attachEvent('on'+ev,fn);}catch(e){el['on'+ev]=fn;}}}
function removeEventListenerBk(el,ev,fn){try{el.removeEventListener(ev,fn,false);}catch(e){try{el.detachEvent('on'+ev,fn);}catch(e){el['on'+ev]=null;}}}
var ShortKeys=function(e){if(!e)e=window.event;if(!e.target)e.target=e.srcElement;if(e.target.form)return true;url='';switch(e.keyCode){case 39:case 13:url=SKUrl[0];break;case 37:url=SKUrl[1];break;case 40:url=SKUrl[2];break;case 38:url=SKUrl[3];break;}
if(url){removeEventListenerBk(document,Opera?'keypress':'keydown',ShortKeys);if(url.substring(0,1)=='/')window.location.pathname=url;else window.location.href=url;if(e.preventDefault)e.preventDefault();else e.returnValue=false;return false;}}
window.addEvent('domready',function(){linkFadeMenu('#menu .inactive a','#000');linkFadeSubMenu('#submenu li a','#000');});;var Mediabox;(function(){var B,h,Q,I,P,o,G,l,n,k,K,z,u,A=new Image(),W=new Image(),s=false,x=false,T,b,j,c,V,F,N,U,X,e,E,R,H,y,C,p,i="none",f,d="mediaBox",D,m;window.addEvent("domready",function(){document.id(document.body).adopt($$([T=new Element("div",{id:"mbOverlay"}).addEvent("click",O),b=new Element("div",{id:"mbCenter"})]).setStyle("display","none"));j=new Element("div",{id:"mbImage"}).injectInside(b);c=new Element("div",{id:"mbBottom"}).injectInside(b).adopt(closeLink=new Element("a",{id:"mbCloseLink",href:"#"}).addEvent("click",O),e=new Element("a",{id:"mbNextLink",href:"#"}).addEvent("click",g),U=new Element("a",{id:"mbPrevLink",href:"#"}).addEvent("click",L),F=new Element("div",{id:"mbTitle"}),X=new Element("div",{id:"mbNumber"}),N=new Element("div",{id:"mbCaption"}));z={overlay:new Fx.Tween(T,{property:"opacity",duration:0}).set(0),image:new Fx.Tween(j,{property:"opacity",duration:360,onComplete:J}),bottom:new Fx.Tween(c,{property:"opacity",duration:240}).set(0)}});Mediabox={close:function(){O()},open:function(aa,Z,Y){B=$extend({text:["<big>&laquo;</big>","<big>&raquo;</big>","<big>&times;</big>"],loop:true,keyboard:true,alpha:true,stopKey:false,overlayOpacity:1,resizeOpening:true,resizeDuration:240,resizeTransition:false,initialWidth:320,initialHeight:180,defaultWidth:640,defaultHeight:360,showCaption:true,showCounter:false,counterText:"({x} of {y})",imgBackground:false,top:10,imgPadding:100,html5:"true",scriptaccess:"true",fullscreen:"true",fullscreenNum:"1",autoplay:"true",autoplayNum:"1",autoplayYes:"yes",volume:"100",medialoop:"true",bgcolor:"#FFFFFF",wmode:"opaque",useNB:true,playerpath:"/NonverBlaster.swf",controlColor:"FFFFFF",controlBackColor:"000000",showTimecode:"true",JWplayerpath:"/player.swf",backcolor:"000000",frontcolor:"999999",lightcolor:"000000",screencolor:"000000",controlbar:"over",controller:"true",flInfo:"true",ytBorder:"0",ytColor1:"000000",ytColor2:"333333",ytQuality:"&ap=%2526fmt%3D18",ytRel:"0",ytInfo:"1",ytSearch:"0",vmTitle:"1",vmByline:"1",vmPortrait:"1",vmColor:"ffffff"},Y||{});U.set("html",B.text[0]);e.set("html",B.text[1]);closeLink.set("html",B.text[2]);m=b.getStyle("padding-left").toInt()+j.getStyle("margin-left").toInt()+j.getStyle("padding-left").toInt();if((Browser.Engine.gecko)&&(Browser.Engine.version<19)){s=true;B.overlayOpacity=1;T.className="mbOverlayFF"}if((Browser.Engine.trident)&&(Browser.Engine.version<5)){x=true;T.className="mbOverlayIE";T.setStyle("position","absolute");M()}if(typeof aa=="string"){aa=[[aa,Z,Y]];Z=0}h=aa;B.loop=B.loop&&(h.length>1);r();t(true);o=window.getScrollTop()+(window.getHeight()/2);l=window.getScrollLeft()+(window.getWidth()/2);z.resize=new Fx.Morph(b,$extend({duration:B.resizeDuration,onComplete:S},B.resizeTransition?{transition:B.resizeTransition}:{}));b.setStyles({top:o,left:l,width:B.initialWidth,height:B.initialHeight,marginTop:-(B.initialHeight/2)-m,marginLeft:-(B.initialWidth/2)-m,display:""});z.overlay.start(B.overlayOpacity);return a(Z)}};Element.implement({mediabox:function(Y,Z){$$(this).mediabox(Y,Z);return this}});Elements.implement({mediabox:function(Y,ab,aa){ab=ab||function(ac){y=ac.rel.split(/[\[\]]/);y=y[1];return[ac.href,ac.title,y]};aa=aa||function(){return true};var Z=this;Z.addEvent("contextmenu",function(ac){if(this.toString().match(/\.gif|\.jpg|\.jpeg|\.png/i)){ac.stop()}});Z.removeEvents("click").addEvent("click",function(){var ad=Z.filter(aa,this);var ae=[];var ac=[];ad.each(function(ag,af){if(ac.indexOf(ag.toString())<0){ae.include(ad[af]);ac.include(ad[af].toString())}});return Mediabox.open(ae.map(ab),ac.indexOf(this.toString()),Y)});return Z}});function M(){T.setStyles({top:window.getScrollTop(),left:window.getScrollLeft()})}function r(){k=window.getWidth();K=window.getHeight();T.setStyles({width:k,height:K})}function t(Y){if(Browser.Engine.gecko){["object",window.ie?"select":"embed"].forEach(function(aa){Array.forEach(document.getElementsByTagName(aa),function(ab){if(Y){ab._mediabox=ab.style.visibility}ab.style.visibility=Y?"hidden":ab._mediabox})})}T.style.display=Y?"":"none";var Z=Y?"addEvent":"removeEvent";if(x){window[Z]("scroll",M)}window[Z]("resize",r);if(B.keyboard){document[Z]("keydown",v)}}function v(Y){if(B.alpha){switch(Y.code){case 27:case 88:case 67:O();break;case 37:case 80:L();break;case 39:case 78:g()}}else{switch(Y.code){case 27:O();break;case 37:L();break;case 39:g()}}if(B.stopKey){return false}}function L(){return a(I)}function g(){return a(P)}function a(Y){if(Y>=0){j.set("html","");Q=Y;I=((Q||!B.loop)?Q:h.length)-1;P=Q+1;if(P==h.length){P=B.loop?0:-1}w();b.className="mbLoading";if(!h[Y][2]){h[Y][2]=""}R=h[Y][2].split(" ");H=R.length;if(H>1){C=(R[H-2].match("%"))?(window.getWidth()*((R[H-2].replace("%",""))*0.01))+"px":R[H-2]+"px";p=(R[H-1].match("%"))?(window.getHeight()*((R[H-1].replace("%",""))*0.01))+"px":R[H-1]+"px"}else{C="";p=""}E=h[Y][0];E=encodeURI(E).replace("(","%28").replace(")","%29");V=h[Q][1].split("::");if(E.match(/quietube\.com/i)){f=E.split("v.php/");E=f[1]}else{if(E.match(/\/\/yfrog/i)){i=(E.substring(E.length-1));if(i.match(/b|g|j|p|t/i)){i="image"}if(i=="s"){i="flash"}if(i.match(/f|z/i)){i="video"}E=E+":iphone"}}if(E.match(/\.gif|\.jpg|\.jpeg|\.png/i)||i=="image"){i="img";u=new Image();u.onload=q;u.src=E}else{if(E.match(/\.mp3|\.aac/i)||i=="audio"){i="obj";C=C||B.defaultWidth;p=p||"20px";if(B.useNB){u=new Swiff(""+B.playerpath+"?mediaURL="+E+"&allowSmoothing=true&autoPlay="+B.autoplay+"&buffer=6&showTimecode="+B.showTimecode+"&loop="+B.medialoop+"&controlColor="+B.controlColor+"&controlBackColor="+B.controlBackColor+"&defaultVolume="+B.volume+"&scaleIfFullScreen=true&showScalingButton=true&crop=false",{id:"MediaboxSWF",width:C,height:p,params:{wmode:B.wmode,bgcolor:B.bgcolor,allowscriptaccess:B.scriptaccess,allowfullscreen:B.fullscreen}})}else{u=new Swiff(""+B.JWplayerpath+"?file="+E+"&backcolor="+B.backcolor+"&frontcolor="+B.frontcolor+"&lightcolor="+B.lightcolor+"&screencolor="+B.screencolor+"&autostart="+B.autoplay,{id:"MediaboxSWF",width:C,height:p,params:{wmode:B.wmode,bgcolor:B.bgcolor,allowscriptaccess:B.scriptaccess,allowfullscreen:B.fullscreen}})}q()}else{if(E.match(/\.swf/i)||i=="flash"){i="obj";C=C||B.defaultWidth;p=p||B.defaultHeight;u=new Swiff(E,{id:"MediaboxSWF",width:C,height:p,params:{wmode:B.wmode,bgcolor:B.bgcolor,allowscriptaccess:B.scriptaccess,allowfullscreen:B.fullscreen}});q()}else{if(E.match(/\.mov|\.m4v|\.m4a|\.aiff|\.avi|\.caf|\.dv|\.mid|\.m3u|\.mp3|\.mp2|\.mp4|\.qtz/i)||i=="qt"){i="qt";C=C||B.defaultWidth;p=(parseInt(p)+16)+"px"||B.defaultHeight;u=new Quickie(E,{id:"MediaboxQT",width:C,height:p,container:"mbImage",attributes:{controller:B.controller,autoplay:B.autoplay,volume:B.volume,loop:B.medialoop,bgcolor:B.bgcolor}});q()}else{if(E.match(/dailymotion\.com/i)){i="obj";C=C||"480px";p=p||"381px";u=new Swiff(E,{id:d,width:C,height:p,params:{wmode:B.wmode,bgcolor:B.bgcolor,allowscriptaccess:B.scriptaccess,allowfullscreen:B.fullscreen}});q()}else{if(E.match(/facebook\.com/i)){i="obj";C=C||"320px";p=p||"240px";f=E.split("v=");f=f[1].split("&");d=f[0];u=new Swiff("http://www.facebook.com/v/"+d,{movie:"http://www.facebook.com/v/"+d,classid:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",width:C,height:p,params:{wmode:B.wmode,bgcolor:B.bgcolor,allowscriptaccess:B.scriptaccess,allowfullscreen:B.fullscreen}});q()}else{if(E.match(/flickr\.com/i)){i="obj";C=C||"500px";p=p||"375px";f=E.split("/");d=f[5];u=new Swiff("http://www.flickr.com/apps/video/stewart.swf",{id:d,classid:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",width:C,height:p,params:{flashvars:"photo_id="+d+"&amp;show_info_box="+B.flInfo,wmode:B.wmode,bgcolor:B.bgcolor,allowscriptaccess:B.scriptaccess,allowfullscreen:B.fullscreen}});q()}else{if(E.match(/youtube\.com\/watch/i)){f=E.split("v=");if(B.html5){i="url";C=C||"640px";p=p||"385px";d="mediaId_"+new Date().getTime();u=new Element("iframe",{src:"http://www.youtube.com/embed/"+f[1],id:d,width:C,height:p,frameborder:0});q()}else{i="obj";d=f[1];if(d.match(/fmt=22/i)){D="&ap=%2526fmt%3D22";C=C||"640px";p=p||"385px"}else{if(d.match(/fmt=18/i)){D="&ap=%2526fmt%3D18";C=C||"560px";p=p||"345px"}else{D=B.ytQuality;C=C||"480px";p=p||"295px"}}u=new Swiff("http://www.youtube.com/v/"+d+"&autoplay="+B.autoplayNum+"&fs="+B.fullscreenNum+D+"&border="+B.ytBorder+"&color1=0x"+B.ytColor1+"&color2=0x"+B.ytColor2+"&rel="+B.ytRel+"&showinfo="+B.ytInfo+"&showsearch="+B.ytSearch,{id:d,width:C,height:p,params:{wmode:B.wmode,bgcolor:B.bgcolor,allowscriptaccess:B.scriptaccess,allowfullscreen:B.fullscreen}});q()}}else{if(E.match(/youtube\.com\/view/i)){i="obj";f=E.split("p=");d=f[1];C=C||"480px";p=p||"385px";u=new Swiff("http://www.youtube.com/p/"+d+"&autoplay="+B.autoplayNum+"&fs="+B.fullscreenNum+D+"&border="+B.ytBorder+"&color1=0x"+B.ytColor1+"&color2=0x"+B.ytColor2+"&rel="+B.ytRel+"&showinfo="+B.ytInfo+"&showsearch="+B.ytSearch,{id:d,width:C,height:p,params:{wmode:B.wmode,bgcolor:B.bgcolor,allowscriptaccess:B.scriptaccess,allowfullscreen:B.fullscreen}});q()}else{if(E.match(/vimeo\.com/i)){C=C||"640px";p=p||"360px";f=E.split("/");d=f[3];if(B.html5){i="url";d="mediaId_"+new Date().getTime();u=new Element("iframe",{src:"http://player.vimeo.com/video/"+f[3]+"?portrait="+B.vmPortrait,id:d,width:C,height:p,frameborder:0});q()}else{i="obj";u=new Swiff("http://www.vimeo.com/moogaloop.swf?clip_id="+d+"&amp;server=www.vimeo.com&amp;fullscreen="+B.fullscreenNum+"&amp;autoplay="+B.autoplayNum+"&amp;show_title="+B.vmTitle+"&amp;show_byline="+B.vmByline+"&amp;show_portrait="+B.vmPortrait+"&amp;color="+B.vmColor,{id:d,width:C,height:p,params:{wmode:B.wmode,bgcolor:B.bgcolor,allowscriptaccess:B.scriptaccess,allowfullscreen:B.fullscreen}});q()}}else{if(E.match(/\#mb_/i)){i="inline";C=C||B.defaultWidth;p=p||B.defaultHeight;URLsplit=E.split("#");u=document.id(URLsplit[1]).get("html");q()}else{i="url";C=C||B.defaultWidth;p=p||B.defaultHeight;d="mediaId_"+new Date().getTime();u=new Element("iframe",{src:E,id:d,width:C,height:p,frameborder:0});q()}}}}}}}}}}}}return false}function q(){if(i=="img"){C=u.width;p=u.height;if(B.imgBackground){j.setStyles({backgroundImage:"url("+E+")",display:""})}else{if(p>=K-B.imgPadding&&(p/K)>=(C/k)){p=K-B.imgPadding;C=u.width=parseInt((p/u.height)*C);u.height=p}else{if(C>=k-B.imgPadding&&(p/K)<(C/k)){C=k-B.imgPadding;p=u.height=parseInt((C/u.width)*p);u.width=C}}if(Browser.Engine.trident){u=document.id(u)}u.addEvent("mousedown",function(Y){Y.stop()}).addEvent("contextmenu",function(Y){Y.stop()});j.setStyles({backgroundImage:"none",display:""});u.inject(j)}}else{if(i=="obj"){if(Browser.Plugins.Flash.version<8){j.setStyles({backgroundImage:"none",display:""});j.set("html",'<div id="mbError"><b>Error</b><br/>Adobe Flash is either not installed or not up to date, please visit <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" title="Get Flash" target="_new">Adobe.com</a> to download the free player.</div>');C=B.DefaultWidth;p=B.DefaultHeight}else{j.setStyles({backgroundImage:"none",display:""});u.inject(j)}}else{if(i=="qt"){j.setStyles({backgroundImage:"none",display:""});u}else{if(i=="inline"){j.setStyles({backgroundImage:"none",display:""});j.set("html",u)}else{if(i=="url"){j.setStyles({backgroundImage:"none",display:""});u.inject(j)}else{j.setStyles({backgroundImage:"none",display:""});j.set("html",'<div id="mbError"><b>Error</b><br/>A file type error has occoured, please visit <a href="iaian7.com/webcode/mediaboxAdvanced" title="mediaboxAdvanced" target="_new">iaian7.com</a> or contact the website author for more information.</div>');C=B.defaultWidth;p=B.defaultHeight}}}}}j.setStyles({width:C,height:p});N.setStyles({width:C});F.set("html",(B.showCaption)?V[0]:"");N.set("html",(B.showCaption&&(V.length>1))?V[1]:"");X.set("html",(B.showCounter&&(h.length>1))?B.counterText.replace(/{x}/,Q+1).replace(/{y}/,h.length):"");C=j.offsetWidth;p=j.offsetHeight+c.offsetHeight;if(p>=o+o){G=-o+B.top}else{G=-(p/2)}if(C>=l+l){n=-l}else{n=-(C/2)}if(B.resizeOpening){z.resize.start({width:C,height:p,marginTop:G-m,marginLeft:n-m})}else{b.setStyles({width:C,height:p,marginTop:G-m,marginLeft:n-m});S()}}function S(){z.image.start(1)}function J(){b.className="";if(I>=0){U.style.display=""}if(P>=0){e.style.display=""}z.bottom.start(1)}function w(){if(u){u.onload=$empty}z.resize.cancel();z.image.cancel().set(0);z.bottom.cancel().set(0);$$(U,e).setStyle("display","none")}function O(){if(Q>=0){u.onload=$empty;j.set("html","");for(var Y in z){z[Y].cancel()}b.setStyle("display","none");z.overlay.chain(t).start(0)}return false}})();Mediabox.scanPage=function(){var a=$$("a").filter(function(b){return b.rel&&b.rel.test(/^lightbox/i)});$$(a).mediabox({},null,function(c){var b=this.rel.replace(/[[]|]/gi," ");var d=b.split(" ");return(this==c)||((this.rel.length>8)&&c.rel.match(d[1]))})};window.addEvent("domready",Mediabox.scanPage);;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;;var FormCheck=new Class({Implements:[Options,Events],options:{tipsClass:"fc-tbx",errorClass:"fc-error",fieldErrorClass:"fc-field-error",submit:true,trimValue:false,validateDisabled:false,submitByAjax:false,ajaxResponseDiv:false,ajaxEvalScripts:false,onAjaxRequest:$empty,onAjaxSuccess:$empty,onAjaxFailure:$empty,onSubmit:$empty,onValidateSuccess:$empty,onValidateFailure:$empty,display:{showErrors:0,titlesInsteadNames:0,errorsLocation:1,indicateErrors:1,indicateErrorsInit:0,keepFocusOnError:0,checkValueIfEmpty:1,addClassErrorToField:0,removeClassErrorOnTipClosure:0,fixPngForIe:1,replaceTipsEffect:1,flashTips:0,closeTipsButton:1,tipsPosition:"right",tipsOffsetX:-45,tipsOffsetY:0,listErrorsAtTop:false,scrollToFirst:true,fadeDuration:300},alerts:{required:"This field is required.",alpha:"This field accepts alphabetic characters only.",alphanum:"This field accepts alphanumeric characters only.",nodigit:"No digits are accepted.",digit:"Please enter a valid integer.",digitltd:"The value must be between %0 and %1",number:"Please enter a valid number.",email:"Please enter a valid email.",image:"This field should only contain image types",phone:"Please enter a valid phone.",phone_inter:"Please enter a valid international phone number.",url:"Please enter a valid url.",confirm:"This field is different from %0",differs:"This value must be different of %0",length_str:"The length is incorrect, it must be between %0 and %1",length_fix:"The length is incorrect, it must be exactly %0 characters",lengthmax:"The length is incorrect, it must be at max %0",lengthmin:"The length is incorrect, it must be at least %0",words_min:"This field must concain at least %0 words, currently: %1 words",words_range:"This field must contain %0-%1 words, currently: %2 words",words_max:"This field must contain at max %0 words, currently: %1 words",checkbox:"Please check the box",radios:"Please select a radio",select:"Please choose a value"},regexp:{required:/[^.*]/,alpha:/^[a-z ._-]+$/i,alphanum:/^[a-z0-9 ._-]+$/i,digit:/^[-+]?[0-9]+$/,nodigit:/^[^0-9]+$/,number:/^[-+]?\d*\.?\d+$/,email:/^([a-zA-Z0-9_\.\-\+%])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,image:/.(jpg|jpeg|png|gif|bmp)$/i,phone:/^[\d\s ().-]+$/,phone_inter:/^\+{0,1}[0-9 \(\)\.\-]+$/,url:/^(http|https|ftp)\:\/\/[a-z0-9\-\.]+\.[a-z]{2,3}(:[a-z0-9]*)?\/?([a-z0-9\-\._\?\,\'\/\\\+&amp;%\$#\=~])*$/i}},initialize:function(c,a){if(this.form=$(c)){this.form.isValid=true;this.regex=["length"];this.setOptions(a);if(typeof(formcheckLanguage)!="undefined"){this.options.alerts=$merge(this.options.alerts,formcheckLanguage)}this.validations=[];this.alreadyIndicated=false;this.firstError=false;var b=new Hash(this.options.regexp);b.each(function(e,d){this.regex.push(d)},this);this.form.getElements("*[class*=validate]").each(function(d){if(d.get("tag")=="select"||d.get("tag")=="input"||d.get("tag")=="textarea"){this.register(d)}},this);this.form.addEvents({submit:this.onSubmit.bind(this)});if(this.options.display.fixPngForIe){this.fixIeStuffs()}document.addEvent("mousewheel",function(){this.isScrolling=false}.bind(this))}},register:function(el,position){el.validation=[];el.getProperty("class").split(" ").each(function(classX){if(classX.match(/^validate(\[.+\])$/)){var valid=true;if(el.type=="radio"){this.validations.each(function(valider){if(valider.name==el.name){valid=false}},this)}var validators=eval(classX.match(/^validate(\[.+\])$/)[1]);for(var i=0;i<validators.length;i++){el.validation.push(validators[i]);if(validators[i].match(/^confirm\[/)){var field=eval(validators[i].match(/^.+(\[.+\])$/)[1].replace(/([A-Z0-9\._-]+)/i,"'$1'"));if(this.form[field].validation.contains("required")){el.validation.push("required")}}if(validators[i].match(/^target:.+/)){el.target=validators[i].match(/^target:(.+)/)[1]}}if(position&&position<=this.validations.length){var newValidations=[];this.validations.each(function(valider,i){if(position==i+1&&valid){newValidations.push(el);this.addListener(el)}newValidations.push(valider)},this);this.validations=newValidations}else{if(valid){this.validations.push(el);this.addListener(el)}}}},this)},dispose:function(a){this.validations.erase(a)},addListener:function(b){b.errors=[];if(this.options.display.indicateErrorsInit){this.validations.each(function(c){if(!this.manageError(c,"submit")){this.form.isValid=false}},this);return true}if(b.validation[0]=="submit"){b.addEvent("click",function(c){if(this.onSubmit(c)){this.form.submit()}}.bind(this));return true}if(this.isChildType(b)==false){b.addEvent("blur",function(){(function(){if(!this.fxRunning&&(b.element||this.options.display.showErrors==1)&&(this.options.display.checkValueIfEmpty||b.value)){this.manageError(b,"blur")}}.bind(this)).delay(100)}.bind(this))}else{if(this.isChildType(b)==true){var a=this.form.getElements('input[name="'+b.getProperty("name")+'"]');a.each(function(c){c.addEvent("blur",function(){(function(){if((b.element||this.options.display.showErrors==1)&&(this.options.display.checkValueIfEmpty||b.value)){this.manageError(b,"click")}}.bind(this)).delay(100)}.bind(this))},this)}}},validate:function(el){el.errors=[];el.isOk=true;if(!this.options.validateDisabled&&el.get("disabled")){return true}if(this.options.trimValue&&el.value){el.value=el.value.trim()}el.validation.each(function(rule){if(this.isChildType(el)){if(this.validateGroup(el)==false){el.isOk=false}}else{var ruleArgs=[];if(rule.match(/target:.+/)){return}if(rule.match(/^.+\[/)){var ruleMethod=rule.split("[")[0];ruleArgs=eval(rule.match(/^.+(\[.+\])$/)[1].replace(/([A-Z0-9\._-]+)/i,"'$1'"))}else{var ruleMethod=rule}if(this.regex.contains(ruleMethod)&&el.get("tag")!="select"){if(this.validateRegex(el,ruleMethod,ruleArgs)==false){el.isOk=false}}if(ruleMethod=="confirm"){if(this.validateConfirm(el,ruleArgs)==false){el.isOk=false}}if(ruleMethod=="differs"){if(this.validateDiffers(el,ruleArgs)==false){el.isOk=false}}if(ruleMethod=="words"){if(this.validateWords(el,ruleArgs)==false){el.isOk=false}}if(el.get("tag")=="select"||(el.type=="checkbox"&&ruleMethod=="required")){if(this.simpleValidate(el)==false){el.isOk=false}}if(rule.match(/%[A-Z0-9\._-]+$/i)||(el.isOk&&rule.match(/~[A-Z0-9\._-]+$/i))){if(eval(rule.slice(1)+"(el)")==false){el.isOk=false}}}},this);if(el.isOk){return true}else{return false}},simpleValidate:function(a){if(a.get("tag")=="select"&&a.selectedIndex<=0){a.errors.push(this.options.alerts.select);return false}else{if(a.type=="checkbox"&&a.checked==false){a.errors.push(this.options.alerts.checkbox);return false}}return true},validateRegex:function(c,b,d){var e="";if(d[1]&&b=="length"){if(d[1]==-1){this.options.regexp.length=new RegExp("^[\\s\\S]{"+d[0]+",}$");e=this.options.alerts.lengthmin.replace("%0",d[0])}else{if(d[0]==d[1]){this.options.regexp.length=new RegExp("^[\\s\\S]{"+d[0]+"}$");e=this.options.alerts.length_fix.replace("%0",d[0])}else{this.options.regexp.length=new RegExp("^[\\s\\S]{"+d[0]+","+d[1]+"}$");e=this.options.alerts.length_str.replace("%0",d[0]).replace("%1",d[1])}}}else{if(d[0]&&b=="length"){this.options.regexp.length=new RegExp("^.{0,"+d[0]+"}$");e=this.options.alerts.lengthmax.replace("%0",d[0])}else{e=this.options.alerts[b]}}if(d[1]&&b=="digit"){var a=true;if(!this.options.regexp.digit.test(c.value)){c.errors.push(this.options.alerts[b]);a=false}if(d[1]==-1){var f=(c.value.toInt()>=d[0].toInt());e=this.options.alerts.digitmin.replace("%0",d[0])}else{var f=(c.value.toInt()>=d[0].toInt()&&c.value.toInt()<=d[1].toInt());e=this.options.alerts.digitltd.replace("%0",d[0]).replace("%1",d[1])}if(a==false||f==false){c.errors.push(e);return false}}else{if(this.options.regexp[b].test(c.value)==false){c.errors.push(e);return false}}return true},validateConfirm:function(b,c){var a=c[0];if(b.value!=this.form[a].value){if(this.options.display.titlesInsteadNames){var d=this.options.alerts.confirm.replace("%0",this.form[a].getProperty("title"))}else{var d=this.options.alerts.confirm.replace("%0",a)}b.errors.push(d);return false}return true},validateDiffers:function(a,c){var b=c[0];if(a.value==this.form[b].value){if(this.options.display.titlesInsteadNames){var d=this.options.alerts.differs.replace("%0",this.form[b].getProperty("title"))}else{var d=this.options.alerts.differs.replace("%0",b)}a.errors.push(d);return false}return true},validateWords:function(c,d){var b=d[0];var a=d[1];var e=c.value.replace(/[ \t\v\n\r\f\p]/m," ").replace(/[,.;:]/g," ").clean().split(" ");if(a==-1){if(e.length<b){c.errors.push(this.options.alerts.words_min.replace("%0",b).replace("%1",e.length));return false}}else{if(b>0){if(e.length<b||e.length>a){c.errors.push(this.options.alerts.words_range.replace("%0",b).replace("%1",a).replace("%2",e.length));return false}}else{if(e.length>a){c.errors.push(this.options.alerts.words_max.replace("%0",a).replace("%1",e.length));return false}}}return true},isFormValid:function(){this.form.isValid=true;this.validations.each(function(b){var a=this.manageError(b,"testonly");if(!a){this.form.isValid=false}},this);return this.form.isValid},isChildType:function(a){return($defined(a.type)&&a.type=="radio")?true:false},validateGroup:function(d){d.errors=[];var a=this.form[d.getProperty("name")];d.group=a;var c=false;for(var b=0;b<a.length;b++){if(a[b].checked){c=true}}if(c==false){d.errors.push(this.options.alerts.radios);return false}else{return true}},listErrorsAtTop:function(a){if(!this.form.element){this.form.element=new Element("div",{id:"errorlist","class":this.options.errorClass}).injectTop(this.form)}if($type(a)=="collection"){new Element("p").set("html","<span>"+a[0].name+" : </span>"+a[0].errors[0]).injectInside(this.form.element)}else{if((a.validation.contains("required")&&a.errors.length>0)||(a.errors.length>0&&a.value&&a.validation.contains("required")==false)){a.errors.each(function(b){new Element("p").set("html","<span>"+a.name+" : </span>"+b).injectInside(this.form.element)},this)}}window.fireEvent("resize")},manageError:function(a,c){var b=this.validate(a);if(c=="testonly"){return b}if((!b&&a.validation.flatten()[0].contains("confirm["))||(!b&&a.validation.contains("required"))||(!a.validation.contains("required")&&a.value&&!b)){if(this.options.display.listErrorsAtTop==true&&c=="submit"){this.listErrorsAtTop(a)}if(this.options.display.indicateErrors==2||this.alreadyIndicated==false||a.name==this.alreadyIndicated.name){if(!this.firstError){this.firstError=a}this.alreadyIndicated=a;if(this.options.display.keepFocusOnError&&a.name==this.firstError.name){(function(){a.focus()}).delay(20)}this.addError(a);return false}}else{if((b||(!a.validation.contains("required")&&!a.value))){this.removeError(a);return true}}return true},addError:function(c){var f=c.target?$(c.target).getCoordinates():c.getCoordinates();if(!c.element&&this.options.display.indicateErrors!=0){if(this.options.display.errorsLocation==1){var e=(this.options.display.tipsPosition=="left")?f.left:f.right;var b={opacity:0,position:"absolute","float":"left",left:e+this.options.display.tipsOffsetX};c.element=new Element("div",{"class":this.options.tipsClass,styles:b}).injectInside(document.body);this.addPositionEvent(c)}else{if(this.options.display.errorsLocation==2){c.element=new Element("div",{"class":this.options.errorClass,styles:{opacity:0}}).injectBefore(c)}else{if(this.options.display.errorsLocation==3){c.element=new Element("div",{"class":this.options.errorClass,styles:{opacity:0}});if($type(c.group)=="object"||$type(c.group)=="collection"){c.element.injectAfter(c.group[c.group.length-1])}else{c.element.injectAfter(c)}}}}}if(c.element&&c.element!=true){c.element.empty();if(this.options.display.errorsLocation==1){var d=[];c.errors.each(function(g){d.push(new Element("p").set("html",g))});var a=this.makeTips(d).injectInside(c.element);if(this.options.display.closeTipsButton){a.getElements("a.close").addEvent("mouseup",function(){this.removeError(c,"tip")}.bind(this))}c.element.setStyle("top",f.top-a.getCoordinates().height+this.options.display.tipsOffsetY)}else{c.errors.each(function(g){new Element("p").set("html",g).injectInside(c.element)})}if(!this.options.display.fadeDuration||Browser.Engine.trident&&Browser.Engine.version==5&&this.options.display.errorsLocation<2){c.element.setStyle("opacity",1)}else{c.fx=new Fx.Tween(c.element,{duration:this.options.display.fadeDuration,ignore:true,onStart:function(){this.fxRunning=true}.bind(this),onComplete:function(){this.fxRunning=false;if(c.element&&c.element.getStyle("opacity").toInt()==0){c.element.destroy();c.element=false}}.bind(this)});if(c.element.getStyle("opacity").toInt()!=1){c.fx.start("opacity",1)}}}if(this.options.display.addClassErrorToField&&this.isChildType(c)==false){c.addClass(this.options.fieldErrorClass);c.element=c.element||true}},addPositionEvent:function(a){if(this.options.display.replaceTipsEffect){a.event=function(){var b=a.target?$(a.target).getCoordinates():a.getCoordinates();new Fx.Morph(a.element,{duration:this.options.display.fadeDuration}).start({left:[a.element.getStyle("left"),b.right+this.options.display.tipsOffsetX],top:[a.element.getStyle("top"),b.top-a.element.getCoordinates().height+this.options.display.tipsOffsetY]})}.bind(this)}else{a.event=function(){var b=a.target?$(a.target).getCoordinates():a.getCoordinates();a.element.setStyles({left:b.right+this.options.display.tipsOffsetX,top:b.top-a.element.getCoordinates().height+this.options.display.tipsOffsetY})}.bind(this)}window.addEvent("resize",a.event)},removeError:function(a,b){if((this.options.display.addClassErrorToField&&!this.isChildType(a)&&this.options.display.removeClassErrorOnTipClosure)||(this.options.display.addClassErrorToField&&!this.isChildType(a)&&!this.options.display.removeClassErrorOnTipClosure&&b!="tip")){a.removeClass(this.options.fieldErrorClass)}if(!a.element){return}this.alreadyIndicated=false;a.errors=[];a.isOK=true;window.removeEvent("resize",a.event);if(this.options.display.errorsLocation>=2&&a.element){new Fx.Tween(a.element,{duration:this.options.display.fadeDuration}).start("height",0)}if(!this.options.display.fadeDuration||Browser.Engine.trident&&Browser.Engine.version==5&&this.options.display.errorsLocation==1&&a.element){this.fxRunning=true;a.element.destroy();a.element=false;(function(){this.fxRunning=false}.bind(this)).delay(200)}else{if(a.element&&a.element!=true){a.fx.start("opacity",0)}}},focusOnError:function(b){if(this.options.display.scrollToFirst&&!this.alreadyFocused&&!this.isScrolling){if(!this.options.display.indicateErrors||!this.options.display.errorsLocation){var a=b.getCoordinates().top-30}else{if(this.alreadyIndicated.element){switch(this.options.display.errorsLocation){case 1:var a=b.element.getCoordinates().top;break;case 2:var a=b.element.getCoordinates().top-30;break;case 3:var a=b.getCoordinates().top-30;break}this.isScrolling=true}}if(window.getScroll.y!=a){new Fx.Scroll(window,{onComplete:function(){this.isScrolling=false;if(b.getProperty("type")!="hidden"){b.focus()}}.bind(this)}).start(0,a)}else{this.isScrolling=false;b.focus()}this.alreadyFocused=true}},fixIeStuffs:function(){if(Browser.Engine.trident4){var f=new RegExp("url\\(([.a-zA-Z0-9_/:-]+.png)\\)");var h=new RegExp("(.+)formcheck.css");for(var c=0;c<document.styleSheets.length;c++){if(document.styleSheets[c].href.match(/formcheck\.css$/)){var e=document.styleSheets[c].href.replace(h,"$1");var d=document.styleSheets[c].rules.length;for(var b=0;b<d;b++){var k=document.styleSheets[c].rules[b].style;var g=e+k.backgroundImage.replace(f,"$1");if(g&&g.match(/\.png/i)){var a=(k.backgroundRepeat=="no-repeat")?"crop":"scale";k.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, src='"+g+"', sizingMethod='"+a+"')";k.backgroundImage="none"}}}}}},makeTips:function(c){var e=new Element("table");e.cellPadding="0";e.cellSpacing="0";e.border="0";var d=new Element("tbody").injectInside(e);var b=new Element("tr").injectInside(d);new Element("td",{"class":"tl"}).injectInside(b);new Element("td",{"class":"t"}).injectInside(b);new Element("td",{"class":"tr"}).injectInside(b);var h=new Element("tr").injectInside(d);new Element("td",{"class":"l"}).injectInside(h);var a=new Element("td",{"class":"c"}).injectInside(h);var g=new Element("div",{"class":"err"}).injectInside(a);c.each(function(i){i.injectInside(g)});if(this.options.display.closeTipsButton){new Element("a",{"class":"close"}).injectInside(a)}new Element("td",{"class":"r"}).injectInside(h);var f=new Element("tr").injectInside(d);new Element("td",{"class":"bl"}).injectInside(f);new Element("td",{"class":"b"}).injectInside(f);new Element("td",{"class":"br"}).injectInside(f);return e},reinitialize:function(a){this.validations.each(function(b){if(b.element){b.errors=[];b.isOK=true;if(this.options.display.flashTips==1||a=="forced"){b.element.destroy();b.element=false}}},this);if(this.form.element){this.form.element.empty()}this.alreadyFocused=false;this.firstError=false;this.elementToRemove=this.alreadyIndicated;this.alreadyIndicated=false;this.form.isValid=true},submitByAjax:function(){var a=this.form.getProperty("action");this.fireEvent("ajaxRequest");new Request({url:a,method:this.form.getProperty("method"),data:this.form.toQueryString(),evalScripts:this.options.ajaxEvalScripts,onFailure:function(b){this.fireEvent("ajaxFailure",b)}.bind(this),onSuccess:function(b){this.fireEvent("ajaxSuccess",b);if(this.options.ajaxResponseDiv){$(this.options.ajaxResponseDiv).set("html",b)}}.bind(this)}).send()},onSubmit:function(a){this.reinitialize();this.fireEvent("onSubmit");this.validations.each(function(c){var b=this.manageError(c,"submit");if(!b){this.form.isValid=false}},this);if(this.form.isValid){if(this.options.submitByAjax){new Event(a).stop();this.submitByAjax()}else{if(!this.options.submit){new Event(a).stop()}}this.fireEvent("validateSuccess");return true}else{new Event(a).stop();if(this.elementToRemove&&this.elementToRemove!=this.firstError&&this.options.display.indicateErrors==1){this.removeError(this.elementToRemove)}this.focusOnError(this.firstError);this.fireEvent("validateFailure");return false}}});
