(function($){
$.fn.writeError = function(message){
	return this.each(function(){
		var $this = $(this);
		$this.html("<div class=\"ui-widget\"><div class=\"ui-state-error ui-corner-all\" style=\"padding: 0 .7em;\"><p><span class=\"ui-icon ui-icon-alert\" style=\"float:left; margin-right: .3em;\"></span>" + message + "</p></div></div>");
	});
}
})(jQuery);

(function($){
$.fn.writeAlert = function(message){
	return this.each(function(){
		var $this = $(this);
		$this.html("<div class=\"ui-widget\"><div class=\"ui-state-highlight ui-corner-all\" style=\"padding: 0 .7em;\"><p><span class=\"ui-icon ui-icon-info\" style=\"float:left; margin-right: .3em;\"></span>" + message + "</p></div></div>");
	});
}
})(jQuery);

(function($) {
    $.fn.errorStyle = function() {
        this.html(function(i,html){
            var StyledError = "<div class=\"ui-widget\">";
            StyledError += "<div class=\"ui-state-error ui-corner-all\" style=\"padding: 0 .7em;\">";
            StyledError += "<p style=\"padding: 0 1.1em\"><span class=\"ui-icon ui-icon-alert\" style=\"float: left; margin-right: .3em;\">";
            StyledError += "</span> ";
            StyledError += html;
            StyledError += "</p></div></div>";
            return StyledError;
        });
    }
})(jQuery);

(function($) {
    $.fn.highlightStyle = function() {
        this.html(function(i,html){
            var StyledError = "<div class=\"ui-widget\">";
            StyledError += "<div class=\"ui-state-highlight ui-corner-all\" style=\"padding: 0 .7em;\">";
            StyledError += "<p style=\"padding: 0 1.1em\"><span class=\"ui-icon ui-icon-info\" style=\"float: left; margin-right: .3em;\">";
            StyledError += "</span> ";
            StyledError += html;
            StyledError += "</p></div></div>";
            return StyledError;
        });
    }
})(jQuery);

    function colorboxComplete() {
        if (typeof(console) !== 'undefined' && console !== null) {
           console.log('title html: ', $("#cboxTitle").html().trim());
           console.log($.fn.colorbox.settings);
        }

        // unbind the mouseover and mouseleave events
        $("#cboxContent").unbind('mouseenter').unbind('mouseleave');

        var titleHtml = $("#cboxTitle").html();
        titleHtml = jQuery.trim(titleHtml);

        if (titleHtml.length == 0) {
          $("#cboxTitle").hide();
        } else {
          $("#cboxContent").hover(function() {
              $("#cboxTitle").show();
          }, function() {
              $("#cboxTitle").hide();
          });
        }
    }



/**
Vertigo Tip by www.vertigo-project.com
Requires jQuery
*/
this.vtip=function(){this.xOffset=-10;this.yOffset=10;$(".vtip").unbind().hover(function(a){this.t=this.title;this.title="";this.top=(a.pageY+yOffset);this.left=(a.pageX+xOffset);$("body").append('<p id="vtip"><img id="vtipArrow" />'+this.t+"</p>");$("p#vtip #vtipArrow").attr("src","images/vtip_arrow.png");$("p#vtip").css("top",this.top+"px").css("left",this.left+"px").fadeIn("slow")},function(){this.title=this.t;$("p#vtip").fadeOut("slow").remove()}).mousemove(function(a){this.top=(a.pageY+yOffset);this.left=(a.pageX+xOffset);$("p#vtip").css("top",this.top+"px").css("left",this.left+"px")})};jQuery(document).ready(function(a){vtip()});

/** scaleImage **/
       var myWidth = 0;
       if( typeof( window.innerWidth ) == 'number' ) {
         //Non-IE
         myWidth = window.innerWidth;
       } else if( document.documentElement && ( document.documentElement.clientWidth ) ) {
         //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
       }  else if( document.body && ( document.body.clientWidth ) ) {
         //IE 4 compatible
         myWidth = document.body.clientWidth;
       }

       var scaleTo = 800;
       if (myWidth <= 1280) { scaleTo = 600; }
       if (myWidth <= 1024) { scaleTo = 500; }

      (function($){
        $.fn.scaleImage = function(options) {

          var defaults = {
            maxwidth: scaleTo,
            linkclass:'',
            icon:true,
            lightbox:true
          };
          var options = $.extend(defaults, options);

          return this.each(function() {
            obj = $(this);

            var width = obj.width();
            var height = obj.height();
            if (width > options.maxwidth) {
              //Set variables for manipulation
              var ratio = (height / width );
              var new_width = options.maxwidth;
              var new_height = (new_width * ratio);
              var classes = options.linkclass+' scaleImage';

              if (options.lightbox == true) {
                var img_full_link = obj.attr('src');
                // lightbox2
                obj.wrap('<a rel="lightbox2" href="'+img_full_link+'"></a>');
              }

              //Shrink the image and add link to full-sized image
              obj.height(new_height).width(new_width);
              obj.addClass(classes);

              //zoom icon
              if (options.icon == true) {
                obj.after('<div class="thumb-zoom" style="width:' + (scaleTo - 10) + 'px;"><img src="/static/images/icons/icon4.gif" width="16" height="16" align="left" style="margin-right: 10px;" />This image has been automatically resized.  Click to show image at full size.</div>');
              }
            }
          });
        };
      })(jQuery);

/** jquery corner plugin */
;(function($){var style=document.createElement('div').style;var moz=style['MozBorderRadius']!==undefined;var webkit=style['WebkitBorderRadius']!==undefined;var radius=style['borderRadius']!==undefined||style['BorderRadius']!==undefined;var mode=document.documentMode||0;var noBottomFold=$.browser.msie&&(($.browser.version<8&&!mode)||mode<8);$.support=$.support||{};$.support.borderRadius=moz||webkit||radius;var expr=$.browser.msie&&(function(){var div=document.createElement('div');try{div.style.setExpression('width','0+0');div.style.removeExpression('width')}catch(e){return false}return true})();function sz(el,p){return parseInt($.css(el,p))||0};function hex2(s){var s=parseInt(s).toString(16);return(s.length<2)?'0'+s:s};function gpc(node){while(node){var v=$.css(node,'backgroundColor');if(v&&v!='transparent'&&v!='rgba(0, 0, 0, 0)'){if(v.indexOf('rgb')>=0){var rgb=v.match(/\d+/g);return'#'+hex2(rgb[0])+hex2(rgb[1])+hex2(rgb[2])}return v}if(node.nodeName.toLowerCase()=='html')break;node=node.parentNode}return'#ffffff'};function getWidth(fx,i,width){switch(fx){case'round':return Math.round(width*(1-Math.cos(Math.asin(i/width))));case'cool':return Math.round(width*(1+Math.cos(Math.asin(i/width))));case'sharp':return Math.round(width*(1-Math.cos(Math.acos(i/width))));case'bite':return Math.round(width*(Math.cos(Math.asin((width-i-1)/width))));case'slide':return Math.round(width*(Math.atan2(i,width/i)));case'jut':return Math.round(width*(Math.atan2(width,(width-i-1))));case'curl':return Math.round(width*(Math.atan(i)));case'tear':return Math.round(width*(Math.cos(i)));case'wicked':return Math.round(width*(Math.tan(i)));case'long':return Math.round(width*(Math.sqrt(i)));case'sculpt':return Math.round(width*(Math.log((width-i-1),width)));case'dogfold':case'dog':return(i&1)?(i+1):width;case'dog2':return(i&2)?(i+1):width;case'dog3':return(i&3)?(i+1):width;case'fray':return(i%2)*width;case'notch':return width;case'bevelfold':case'bevel':return i+1}};$.fn.corner=function(options){if(this.length==0){if(!$.isReady&&this.selector){var s=this.selector,c=this.context;$(function(){$(s,c).corner(options)})}return this}return this.each(function(index){var $this=$(this);var o=[$this.attr($.fn.corner.defaults.metaAttr)||'',options||''].join(' ').toLowerCase();var keep=/keep/.test(o);var cc=((o.match(/cc:(#[0-9a-f]+)/)||[])[1]);var sc=((o.match(/sc:(#[0-9a-f]+)/)||[])[1]);var width=parseInt((o.match(/(\d+)px/)||[])[1])||5;var re=/round|bevelfold|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dogfold|dog/;var fx=((o.match(re)||['round'])[0]);var fold=/dogfold|bevelfold/.test(o);var edges={T:0,B:1};var opts={TL:/top|tl|left/.test(o),TR:/top|tr|right/.test(o),BL:/bottom|bl|left/.test(o),BR:/bottom|br|right/.test(o)};if(!opts.TL&&!opts.TR&&!opts.BL&&!opts.BR)opts={TL:1,TR:1,BL:1,BR:1};if($.fn.corner.defaults.useNative&&fx=='round'&&(radius||moz||webkit)&&!cc&&!sc){if(opts.TL)$this.css(radius?'border-top-left-radius':moz?'-moz-border-radius-topleft':'-webkit-border-top-left-radius',width+'px');if(opts.TR)$this.css(radius?'border-top-right-radius':moz?'-moz-border-radius-topright':'-webkit-border-top-right-radius',width+'px');if(opts.BL)$this.css(radius?'border-bottom-left-radius':moz?'-moz-border-radius-bottomleft':'-webkit-border-bottom-left-radius',width+'px');if(opts.BR)$this.css(radius?'border-bottom-right-radius':moz?'-moz-border-radius-bottomright':'-webkit-border-bottom-right-radius',width+'px');return}var strip=document.createElement('div');$(strip).css({overflow:'hidden',height:'1px',minHeight:'1px',fontSize:'1px',backgroundColor:sc||'transparent',borderStyle:'solid'});var pad={T:parseInt($.css(this,'paddingTop'))||0,R:parseInt($.css(this,'paddingRight'))||0,B:parseInt($.css(this,'paddingBottom'))||0,L:parseInt($.css(this,'paddingLeft'))||0};if(typeof this.style.zoom!=undefined)this.style.zoom=1;if(!keep)this.style.border='none';strip.style.borderColor=cc||gpc(this.parentNode);var cssHeight=$(this).outerHeight();for(var j in edges){var bot=edges[j];if((bot&&(opts.BL||opts.BR))||(!bot&&(opts.TL||opts.TR))){strip.style.borderStyle='none '+(opts[j+'R']?'solid':'none')+' none '+(opts[j+'L']?'solid':'none');var d=document.createElement('div');$(d).addClass('jquery-corner');var ds=d.style;bot?this.appendChild(d):this.insertBefore(d,this.firstChild);if(bot&&cssHeight!='auto'){if($.css(this,'position')=='static')this.style.position='relative';ds.position='absolute';ds.bottom=ds.left=ds.padding=ds.margin='0';if(expr)ds.setExpression('width','this.parentNode.offsetWidth');else ds.width='100%'}else if(!bot&&$.browser.msie){if($.css(this,'position')=='static')this.style.position='relative';ds.position='absolute';ds.top=ds.left=ds.right=ds.padding=ds.margin='0';if(expr){var bw=sz(this,'borderLeftWidth')+sz(this,'borderRightWidth');ds.setExpression('width','this.parentNode.offsetWidth - '+bw+'+ "px"')}else ds.width='100%'}else{ds.position='relative';ds.margin=!bot?'-'+pad.T+'px -'+pad.R+'px '+(pad.T-width)+'px -'+pad.L+'px':(pad.B-width)+'px -'+pad.R+'px -'+pad.B+'px -'+pad.L+'px'}for(var i=0;i<width;i++){var w=Math.max(0,getWidth(fx,i,width));var e=strip.cloneNode(false);e.style.borderWidth='0 '+(opts[j+'R']?w:0)+'px 0 '+(opts[j+'L']?w:0)+'px';bot?d.appendChild(e):d.insertBefore(e,d.firstChild)}if(fold&&$.support.boxModel){if(bot&&noBottomFold)continue;for(var c in opts){if(!opts[c])continue;if(bot&&(c=='TL'||c=='TR'))continue;if(!bot&&(c=='BL'||c=='BR'))continue;var common={position:'absolute',border:'none',margin:0,padding:0,overflow:'hidden',backgroundColor:strip.style.borderColor};var $horz=$('<div/>').css(common).css({width:width+'px',height:'1px'});switch(c){case'TL':$horz.css({bottom:0,left:0});break;case'TR':$horz.css({bottom:0,right:0});break;case'BL':$horz.css({top:0,left:0});break;case'BR':$horz.css({top:0,right:0});break}d.appendChild($horz[0]);var $vert=$('<div/>').css(common).css({top:0,bottom:0,width:'1px',height:width+'px'});switch(c){case'TL':$vert.css({left:width});break;case'TR':$vert.css({right:width});break;case'BL':$vert.css({left:width});break;case'BR':$vert.css({right:width});break}d.appendChild($vert[0])}}}}})};$.fn.uncorner=function(){if(radius||moz||webkit)this.css(radius?'border-radius':moz?'-moz-border-radius':'-webkit-border-radius',0);$('div.jquery-corner',this).remove();return this};$.fn.corner.defaults={useNative:true,metaAttr:'data-corner'}})(jQuery);
// ColorBox v1.3.15 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
// Copyright (c) 2010 Jack Moore - jack@colorpowered.com
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
(function(b,ib){var t="none",M="LoadedContent",c=false,v="resize.",o="y",q="auto",e=true,L="nofollow",m="x";function f(a,c){a=a?' id="'+i+a+'"':"";c=c?' style="'+c+'"':"";return b("<div"+a+c+"/>")}function p(a,b){b=b===m?n.width():n.height();return typeof a==="string"?Math.round(/%/.test(a)?b/100*parseInt(a,10):parseInt(a,10)):a}function U(b){return a.photo||/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(b)}function cb(a){for(var c in a)if(b.isFunction(a[c])&&c.substring(0,2)!=="on")a[c]=a[c].call(l);a.rel=a.rel||l.rel||L;a.href=a.href||b(l).attr("href");a.title=a.title||l.title;return a}function w(c,a){a&&a.call(l);b.event.trigger(c)}function jb(){var b,e=i+"Slideshow_",c="click."+i,f,k;if(a.slideshow&&h[1]){f=function(){F.text(a.slideshowStop).unbind(c).bind(V,function(){if(g<h.length-1||a.loop)b=setTimeout(d.next,a.slideshowSpeed)}).bind(W,function(){clearTimeout(b)}).one(c+" "+N,k);j.removeClass(e+"off").addClass(e+"on");b=setTimeout(d.next,a.slideshowSpeed)};k=function(){clearTimeout(b);F.text(a.slideshowStart).unbind([V,W,N,c].join(" ")).one(c,f);j.removeClass(e+"on").addClass(e+"off")};a.slideshowAuto?f():k()}}function db(c){if(!O){l=c;a=cb(b.extend({},b.data(l,r)));h=b(l);g=0;if(a.rel!==L){h=b("."+G).filter(function(){return (b.data(this,r).rel||this.rel)===a.rel});g=h.index(l);if(g===-1){h=h.add(l);g=h.length-1}}if(!u){u=D=e;j.show();if(a.returnFocus)try{l.blur();b(l).one(eb,function(){try{this.focus()}catch(a){}})}catch(f){}x.css({opacity:+a.opacity,cursor:a.overlayClose?"pointer":q}).show();a.w=p(a.initialWidth,m);a.h=p(a.initialHeight,o);d.position(0);X&&n.bind(v+P+" scroll."+P,function(){x.css({width:n.width(),height:n.height(),top:n.scrollTop(),left:n.scrollLeft()})}).trigger("scroll."+P);w(fb,a.onOpen);Y.add(H).add(I).add(F).add(Z).hide();ab.html(a.close).show()}d.load(e)}}var gb={transition:"elastic",speed:300,width:c,initialWidth:"600",innerWidth:c,maxWidth:c,height:c,initialHeight:"450",innerHeight:c,maxHeight:c,scalePhotos:e,scrolling:e,inline:c,html:c,iframe:c,photo:c,href:c,title:c,rel:c,opacity:.9,preloading:e,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:c,returnFocus:e,loop:e,slideshow:c,slideshowAuto:e,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:c,onLoad:c,onComplete:c,onCleanup:c,onClosed:c,overlayClose:e,escKey:e,arrowKey:e},r="colorbox",i="cbox",fb=i+"_open",W=i+"_load",V=i+"_complete",N=i+"_cleanup",eb=i+"_closed",Q=i+"_purge",hb=i+"_loaded",E=b.browser.msie&&!b.support.opacity,X=E&&b.browser.version<7,P=i+"_IE6",x,j,A,s,bb,T,R,S,h,n,k,J,K,Z,Y,F,I,H,ab,B,C,y,z,l,g,a,u,D,O=c,d,G=i+"Element";d=b.fn[r]=b[r]=function(c,f){var a=this,d;if(!a[0]&&a.selector)return a;c=c||{};if(f)c.onComplete=f;if(!a[0]||a.selector===undefined){a=b("<a/>");c.open=e}a.each(function(){b.data(this,r,b.extend({},b.data(this,r)||gb,c));b(this).addClass(G)});d=c.open;if(b.isFunction(d))d=d.call(a);d&&db(a[0]);return a};d.init=function(){var l="hover",m="clear:left";n=b(ib);j=f().attr({id:r,"class":E?i+"IE":""});x=f("Overlay",X?"position:absolute":"").hide();A=f("Wrapper");s=f("Content").append(k=f(M,"width:0; height:0; overflow:hidden"),K=f("LoadingOverlay").add(f("LoadingGraphic")),Z=f("Title"),Y=f("Current"),I=f("Next"),H=f("Previous"),F=f("Slideshow").bind(fb,jb),ab=f("Close"));A.append(f().append(f("TopLeft"),bb=f("TopCenter"),f("TopRight")),f(c,m).append(T=f("MiddleLeft"),s,R=f("MiddleRight")),f(c,m).append(f("BottomLeft"),S=f("BottomCenter"),f("BottomRight"))).children().children().css({"float":"left"});J=f(c,"position:absolute; width:9999px; visibility:hidden; display:none");b("body").prepend(x,j.append(A,J));s.children().hover(function(){b(this).addClass(l)},function(){b(this).removeClass(l)}).addClass(l);B=bb.height()+S.height()+s.outerHeight(e)-s.height();C=T.width()+R.width()+s.outerWidth(e)-s.width();y=k.outerHeight(e);z=k.outerWidth(e);j.css({"padding-bottom":B,"padding-right":C}).hide();I.click(d.next);H.click(d.prev);ab.click(d.close);s.children().removeClass(l);b("."+G).live("click",function(a){if(!(a.button!==0&&typeof a.button!=="undefined"||a.ctrlKey||a.shiftKey||a.altKey)){a.preventDefault();db(this)}});x.click(function(){a.overlayClose&&d.close()});b(document).bind("keydown",function(b){if(u&&a.escKey&&b.keyCode===27){b.preventDefault();d.close()}if(u&&a.arrowKey&&!D&&h[1])if(b.keyCode===37&&(g||a.loop)){b.preventDefault();H.click()}else if(b.keyCode===39&&(g<h.length-1||a.loop)){b.preventDefault();I.click()}})};d.remove=function(){j.add(x).remove();b("."+G).die("click").removeData(r).removeClass(G)};d.position=function(f,d){function b(a){bb[0].style.width=S[0].style.width=s[0].style.width=a.style.width;K[0].style.height=K[1].style.height=s[0].style.height=T[0].style.height=R[0].style.height=a.style.height}var e,h=Math.max(document.documentElement.clientHeight-a.h-y-B,0)/2+n.scrollTop(),g=Math.max(n.width()-a.w-z-C,0)/2+n.scrollLeft();e=j.width()===a.w+z&&j.height()===a.h+y?0:f;A[0].style.width=A[0].style.height="9999px";j.dequeue().animate({width:a.w+z,height:a.h+y,top:h,left:g},{duration:e,complete:function(){b(this);D=c;A[0].style.width=a.w+z+C+"px";A[0].style.height=a.h+y+B+"px";d&&d()},step:function(){b(this)}})};d.resize=function(b){if(u){b=b||{};if(b.width)a.w=p(b.width,m)-z-C;if(b.innerWidth)a.w=p(b.innerWidth,m);k.css({width:a.w});if(b.height)a.h=p(b.height,o)-y-B;if(b.innerHeight)a.h=p(b.innerHeight,o);if(!b.innerHeight&&!b.height){b=k.wrapInner("<div style='overflow:auto'></div>").children();a.h=b.height();b.replaceWith(b.children())}k.css({height:a.h});d.position(a.transition===t?0:a.speed)}};d.prep=function(m){var c="hidden";function l(s){var p,f,m,c,l=h.length,q=a.loop;d.position(s,function(){function s(){E&&j[0].style.removeAttribute("filter")}if(u){E&&o&&k.fadeIn(100);k.show();w(hb);Z.show().html(a.title);if(l>1){typeof a.current==="string"&&Y.html(a.current.replace(/\{current\}/,g+1).replace(/\{total\}/,l)).show();I[q||g<l-1?"show":"hide"]().html(a.next);H[q||g?"show":"hide"]().html(a.previous);p=g?h[g-1]:h[l-1];m=g<l-1?h[g+1]:h[0];a.slideshow&&F.show();if(a.preloading){c=b.data(m,r).href||m.href;f=b.data(p,r).href||p.href;c=b.isFunction(c)?c.call(m):c;f=b.isFunction(f)?f.call(p):f;if(U(c))b("<img/>")[0].src=c;if(U(f))b("<img/>")[0].src=f}}K.hide();a.transition==="fade"?j.fadeTo(e,1,function(){s()}):s();n.bind(v+i,function(){d.position(0)});w(V,a.onComplete)}})}if(u){var o,e=a.transition===t?0:a.speed;n.unbind(v+i);k.remove();k=f(M).html(m);k.hide().appendTo(J.show()).css({width:function(){a.w=a.w||k.width();a.w=a.mw&&a.mw<a.w?a.mw:a.w;return a.w}(),overflow:a.scrolling?q:c}).css({height:function(){a.h=a.h||k.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}()}).prependTo(s);J.hide();b("#"+i+"Photo").css({cssFloat:t,marginLeft:q,marginRight:q});X&&b("select").not(j.find("select")).filter(function(){return this.style.visibility!==c}).css({visibility:c}).one(N,function(){this.style.visibility="inherit"});a.transition==="fade"?j.fadeTo(e,0,function(){l(0)}):l(e)}};d.load=function(u){var n,c,s,q=d.prep;D=e;l=h[g];u||(a=cb(b.extend({},b.data(l,r))));w(Q);w(W,a.onLoad);a.h=a.height?p(a.height,o)-y-B:a.innerHeight&&p(a.innerHeight,o);a.w=a.width?p(a.width,m)-z-C:a.innerWidth&&p(a.innerWidth,m);a.mw=a.w;a.mh=a.h;if(a.maxWidth){a.mw=p(a.maxWidth,m)-z-C;a.mw=a.w&&a.w<a.mw?a.w:a.mw}if(a.maxHeight){a.mh=p(a.maxHeight,o)-y-B;a.mh=a.h&&a.h<a.mh?a.h:a.mh}n=a.href;K.show();if(a.inline){f().hide().insertBefore(b(n)[0]).one(Q,function(){b(this).replaceWith(k.children())});q(b(n))}else if(a.iframe){j.one(hb,function(){var c=b("<iframe frameborder='0' style='width:100%; height:100%; border:0; display:block'/>")[0];c.name=i+ +new Date;c.src=a.href;if(!a.scrolling)c.scrolling="no";if(E)c.allowtransparency="true";b(c).appendTo(k).one(Q,function(){c.src="//about:blank"})});q(" ")}else if(a.html)q(a.html);else if(U(n)){c=new Image;c.onload=function(){var e;c.onload=null;c.id=i+"Photo";b(c).css({border:t,display:"block",cssFloat:"left"});if(a.scalePhotos){s=function(){c.height-=c.height*e;c.width-=c.width*e};if(a.mw&&c.width>a.mw){e=(c.width-a.mw)/c.width;s()}if(a.mh&&c.height>a.mh){e=(c.height-a.mh)/c.height;s()}}if(a.h)c.style.marginTop=Math.max(a.h-c.height,0)/2+"px";h[1]&&(g<h.length-1||a.loop)&&b(c).css({cursor:"pointer"}).click(d.next);if(E)c.style.msInterpolationMode="bicubic";setTimeout(function(){q(c)},1)};setTimeout(function(){c.src=n},1)}else n&&J.load(n,function(d,c,a){q(c==="error"?"Request unsuccessful: "+a.statusText:b(this).children())})};d.next=function(){if(!D){g=g<h.length-1?g+1:0;d.load()}};d.prev=function(){if(!D){g=g?g-1:h.length-1;d.load()}};d.close=function(){if(u&&!O){O=e;u=c;w(N,a.onCleanup);n.unbind("."+i+" ."+P);x.fadeTo("fast",0);j.stop().fadeTo("fast",0,function(){w(Q);k.remove();j.add(x).css({opacity:1,cursor:q}).hide();setTimeout(function(){O=c;w(eb,a.onClosed)},1)})}};d.element=function(){return b(l)};d.settings=gb;b(d.init)})(jQuery,this);
function getRefToDiv(divID) {
        return document.getElementById(divID); 
}

function showDiv(divID_as_a_string) {
	$('#' + divID_as_a_string).toggle();
/*
    //get a reference as above ...
    var myReference = getRefToDiv(divID_as_a_string);
    if ( myReference.style.display == 'block' ) {
        myReference.style.display = 'none';
    } else {
        myReference.style.display = 'block';
    }
*/
}

function hideDiv(divID_as_a_string) {
	$('#' + divID_as_a_string).hide();
/*
    //get a reference as above ...
    var myReference = getRefToDiv(divID_as_a_string);
    myReference.style.display = 'none';
*/
}

function get_cookie ( cookie_name )
{
  var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );

  if ( results ) {
    return ( unescape ( results[2] ) );
  }
  else {
    return null;
  }
}

var curcontentindex = 0;
var announcementBoxChildren = [];

function checkIndex(curcontentindex) {

     if ((typeof(curcontentindex) == 'undefined') || curcontentindex === null) { curcontentindex = 0; }


     if (curcontentindex == "00" || curcontentindex == "0" ) { curcontentindex = 0; }
     if (curcontentindex == "01" || curcontentindex == "1" ) { curcontentindex = 1; }
     if (curcontentindex == "02" || curcontentindex == "2" ) { curcontentindex = 2; }
     if (curcontentindex == "03" || curcontentindex == "3" ) { curcontentindex = 3; }
     if (curcontentindex == "04" || curcontentindex == "4" ) { curcontentindex = 4; }
     if (curcontentindex == "05" || curcontentindex == "5" ) { curcontentindex = 5; }
     if (curcontentindex == "06" || curcontentindex == "6" ) { curcontentindex = 6; }
     if (curcontentindex == "07" || curcontentindex == "7" ) { curcontentindex = 7; }
     if (curcontentindex == "08" || curcontentindex == "8" ) { curcontentindex = 8; }
     if (curcontentindex == "09" || curcontentindex == "9" ) { curcontentindex = 9; }

	if (curcontentindex >= announcementBoxChildren.length) { curcontentindex = 0; }
	if (curcontentindex < 0) { curcontentindex = announcementBoxChildren.length - 1; }

     if ((curcontentindex === '') || (curcontentindex === null)) { curcontentindex = 0; }
    return curcontentindex;
}

try {
  curcontentindex = get_cookie("mts2curcontentindex");
  if ((curcontentindex === '') || (curcontentindex === null)) {
    curcontentindex = 0;
  }
} catch(e) {
  curcontentindex = 0;
}

var mouseoverBol = 0;

function rotateNewsTo(rotateTo)
{

	if (announcementBoxChildren.length === 0) { return; }

	curcontentindex = checkIndex(rotateTo);

	if (typeof(document.getElementById('announcementbox')) !== 'undefined' && document.getElementById('announcementbox') !== null) {

		if (typeof(document.getElementById('announcementboxinner')) !== 'undefined' && document.getElementById('announcementboxinner') !== null) {
			document.getElementById('announcementboxinner').innerHTML ='<a style="cursor:pointer" onClick="javascript:rotateNewsTo(' + (curcontentindex - 1) + ')">&laquo;</a> ' + (curcontentindex + 1)  + ' of ' + announcementBoxChildren.length + ' <a style="cursor:pointer" onClick="javascript:rotateNewsTo(' + (curcontentindex + 1) + ')">&raquo;</a>';
		}

		// Hide everything...
		for (var i = 0; i < announcementBoxChildren.length; i++) {
			announcementBoxChildren[i].style.display = 'none';
		}

		// Figure out the X'th (plus 1) child of announcement box and show it (and hide the rest)
		announcementBoxChildren[curcontentindex].style.display = 'inline';		

		document.cookie = "mts2curcontentindex=" + curcontentindex + "; domain=modthesims.info";
	}
}

function rotatecontent(){

  if (mouseoverBol == 1) {
    setTimeout(function(){ rotatecontent(); }, 100);
  } else {

     //get current message index (to show it):
     curcontentindex=(curcontentindex<announcementBoxChildren.length-1)? curcontentindex+1 : 0;
     //get previous message index (to hide it):

     rotateNewsTo(curcontentindex);

  }
}

function startNewsRotation(){
 if (document.all || document.getElementById){

	if (typeof(oUser) != 'undefined' && oUser !== null && oUser.userid == 1) {
		//console.log('Starting news rotation...');
	}


	//   getElementByClass("announcebit");

if (typeof(document.getElementById('announcementbox')) !== 'undefined' && document.getElementById('announcementbox') !== null) {

	var tempChildren = document.getElementById('announcementbox').getElementsByTagName('div');
	var inc=0;	
	for (var i=0; i<tempChildren.length; i++){
		if (tempChildren[i].className=='announcebit') {
			announcementBoxChildren[inc] = tempChildren[i];
			inc++;
		}
	}
	
	if (typeof(oUser) != 'undefined' && oUser != null && oUser.userid == 1) {
		//console.log('announcementBoxChildren: ', announcementBoxChildren);
	}

	rotateNewsTo(curcontentindex);

   document.getElementById('announcementbox').onmouseover=function(){ mouseoverBol=1; };
   document.getElementById('announcementbox').onmouseout=function(){ mouseoverBol=0; };

   var timer = setInterval("rotatecontent()", 10000);
   }
 }
}

function showThanks() {
  var myReference = getRefToDiv('thanksList');
  if (myReference.style.display == 'block') {
    myReference.style.display = 'none';
  } else {
    myReference.style.display = 'block';
  }
}

function showSpoiler(block) {
   // by The Small One
   block.nextSibling.nextSibling.style.display ="block";
   block.parentNode.removeChild(block);
}
/** jquery.lovebuttons.js **/
(function($) {

	$.fn.lovebutton = function(options){

	       var settings = {
        	    threshold    : 0,
	            failurelimit : 0,
        	    event        : "scroll",
	            effect       : "show",
        	    container    : window
	        };

        	if(options) {
	            $.extend(settings, options);
        	}

	        /* Fire one scroll event per scroll. Not one scroll event per image. */
        	var elements = this;
		var triggerScroll;
	        if ("scroll" == settings.event) {
                    $(settings.container).bind("scroll", function(event) {

                        var counter = 0;
                        elements.each(function() {
                            if ($.abovethetop(this, settings) ||
                                $.leftofbegin(this, settings)) {
                                    /* Nothing. */
                            } else if (!$.belowthefold(this, settings) &&
                                !$.rightoffold(this, settings)) {
                                    $(this).trigger("appear");
                            } else {
                                if (counter++ > settings.failurelimit) {
                                    return false;
                                }
                            }
                        });
                        /* Remove image from array so it is not looped next time. */
                        var temp = $.grep(elements, function(element) {
                            return !element.loaded;
                        });
                        elements = $(temp);
                    });
		};

		this.each(function(){
			var self = this;

			var rel = $(self).attr('rel');

			$(this).find('li.lovebutton_1').bind('click', function() { clickButton(self, rel, 1); });
			$(this).find('li.lovebutton_2').bind('click', function() { clickButton(self, rel, 2); });
			$(this).find('li.lovebutton_3').bind('click', function() { clickButton(self, rel, 3); });
			$(this).find('li.lovebutton_4').bind('click', function() { clickButton(self, rel, 4); });
			$(this).find('li.lovebutton_5').bind('click', function() { clickButton(self, rel, 5); });
			$(this).find('li.lovebutton_6').bind('click', function() { clickButton(self, rel, 6); });
			$(this).find('li.lovebutton_7').bind('click', function() { clickButton(self, rel, 7); });
	

			$(this).find('#lovebutton_' + rel + '_helpful').bind('click', function() { makeHelpful(self, rel, 6, 0); });
			$(this).find('#lovebutton_' + rel + '_unhelpful').bind('click', function() { makeHelpful(self, rel, 6, 5); });

		        if ("scroll" != settings.event ||
                	    undefined == $(self).attr("src") ||
	                    ($.abovethetop(self, settings) ||
        	             $.leftofbegin(self, settings) ||
                	     $.belowthefold(self, settings) ||
	                     $.rightoffold(self, settings) )) {

        		        self.loaded = false;
	                } else {
           			self.loaded = true;
            		}

	                /* When appear is triggered load original image. */
 		        $(self).one("appear", function() {
                	if (!this.loaded) {
				process(self);
				self.loaded = true;
        	        };
            });

            /* When wanted event is triggered load original image */
            /* by triggering appear.                              */
            if ("scroll" != settings.event) {
                $(self).bind(settings.event, function(event) {
                    if (!self.loaded) {
                        $(self).trigger("appear");
                    }
                });
            }

		});

	        /* Force initial check if images should appear. */
        	$(settings.container).trigger(settings.event);

	        return this;

	};

	function makeHelpful(self, itemid, itemtype, amount) {
		$(self).find('li.lovebutton_' + itemtype + ' > span.loveamount').text('(' + amount + ')');
		$.ajax({
			type: "POST",
			url: "/lovebuttons.php?method=makehelpful&itemid="+itemid+"&itemtype="+itemtype,
			cache: false,
			data: "userid="+bbuserinfo.userid+"&amount="+amount,
			dataType: "text",
			success: function(data) {
			}
		});

		if (amount == 0) { 
			$.unhidePost(itemid); 
			$('#lovebutton_' + itemid + '_helpful').hide();
			$('#lovebutton_' + itemid + '_unhelpful').show();

		}
		if (amount == 5) { 
			$.hidePost(itemid); 
			$('#lovebutton_' + itemid + '_helpful').hide();
			$('#lovebutton_' + itemid + '_unhelpful').show();
		}

		return false;
	}

	

	function clickButton(self, itemid, itemtype) {
		var fontWeight = $(self).find('li.lovebutton_' + itemtype + ' > span.loveamount').css("font-weight");

		$(self).find('li.lovebutton_' + itemtype + ' > span.loveamount').css("font-style", "italic");
		$.ajax({
			type: "POST",
			url: "/lovebuttons.php?method=insert&itemid="+itemid+"&itemtype="+itemtype,
			cache: false,
			data: "userid="+bbuserinfo.userid,
			dataType: "text",
			success: function(data) {
				$(self).find('li.lovebutton_' + itemtype + ' > span.loveamount').text('('+data+')');
				if (fontWeight == "bold") {
					$(self).find('li.lovebutton_' + itemtype).css("font-weight", "normal");
				} else {
					$(self).find('li.lovebutton_' + itemtype).css("font-weight", "bold");
				}
			}
		});
		$(self).find('li.lovebutton_' + itemtype + ' > span.loveamount').css("font-style", "normal");
		return false;
	};

	function process(loveButtonUL) {
		var rel = $(loveButtonUL).attr('rel');
		
		if (!rel || (rel == '')) {
		} else {
			getCounts(loveButtonUL, rel);
		}
	};

	function showCounts(lB, data) {
		if (data) {
			if (data.love1 > 0) $(lB).find('li.lovebutton_1 > span.loveamount').text('(' + data.love1 + ')');
			if (data.userlove1 > 0) $(lB).find('li.lovebutton_1').css('font-weight', 'bold');
			if (data.love2 > 0) $(lB).find('li.lovebutton_2 > span.loveamount').text('(' + data.love2 + ')');
			if (data.userlove2 > 0) $(lB).find('li.lovebutton_2').css('font-weight', 'bold');
			if (data.love3 > 0) $(lB).find('li.lovebutton_3 > span.loveamount').text('(' + data.love3 + ')');
			if (data.userlove3 > 0) $(lB).find('li.lovebutton_3').css('font-weight', 'bold');
			if (data.love4 > 0) $(lB).find('li.lovebutton_4 > span.loveamount').text('(' + data.love4 + ')');
			if (data.userlove4 > 0) $(lB).find('li.lovebutton_4').css('font-weight', 'bold');
			if (data.love5 > 0) $(lB).find('li.lovebutton_5 > span.loveamount').text('(' + data.love5 + ')');
			if (data.userlove5 > 0) $(lB).find('li.lovebutton_5').css('font-weight', 'bold');

			// Love button 6 is the "unhelpful" button... it's only really used for CF and the Help forums and shouldn't be used elsewhere.
			if (data.love6 > 0) $(lB).find('li.lovebutton_6 > span.loveamount').text('(' + data.love6 + ')');
			if (data.userlove6 > 0) $(lB).find('li.lovebutton_6').css('font-weight', 'bold');

			if (data.love6 >= 5) {
				$.hidePost(data.postid);
			}


			if (data.love7 > 0) $(lB).find('li.lovebutton_7 > span.loveamount').text('(' + data.love7 + ')');
			if (data.userlove7 > 0) $(lB).find('li.lovebutton_7').css('font-weight', 'bold');
		}
	}

	function getCounts(lB, postid) {
		$('#lovebutton_' + postid + '_unhelpful').show();
		$.ajax({
			type: "POST",
			url: "/lovebuttons.php?method=listcounts&itemid="+postid,
			cache: false,
			data: "userid="+bbuserinfo.userid,
			dataType: "json",
			success: function(data) { showCounts(lB, data); }
		});
	};

    /* Convenience methods in jQuery namespace.           */
    /* Use as  $.belowthefold(element, {threshold : 100, container : window}) */

    $.unhidePost = function(postid) {
                                $('#hidebits_left_' + postid).show();
                                $('#hidebits_right_' + postid).show();
                                $('#hidebits_sig_' + postid).show();
                                $('#hidebits_bottomleft_' + postid).show();
                                $('#hidebits_bottom_' + postid).show();

                                $('#messagebits_right_' + postid).hide();
	
				$('#postbit_' + postid).removeClass('semitransparent50');

    };

    $.hidePost = function(postid) {
                                $('#hidebits_left_' + postid).hide(300);
                                $('#hidebits_right_' + postid).hide(300);
                                $('#hidebits_sig_' + postid).hide(300);
                                $('#hidebits_bottomleft_' + postid).hide(300);
                                $('#hidebits_bottom_' + postid).hide(300);

                                $('#postbit_' + postid).addClass('semitransparent50');
				
				$('#messagebits_right_' + postid).show().html('This post has been marked as Unhelpful, and has been hidden.  <a href="java\script:void(0)" onclick="$.unhidePost(' + postid + ');">Click here</a> to show the contents.');

				$('#lovebutton_' + postid + '_helpful').show();
				$('#lovebutton_' + postid + '_unhelpful').hide();

    }


    $.belowthefold = function(element, settings) {
        if (settings.container === undefined || settings.container === window) {
            var fold = $(window).height() + $(window).scrollTop();
        } else {
            var fold = $(settings.container).offset().top + $(settings.container).height();
        }
        return fold <= $(element).offset().top - settings.threshold;
    };

    $.rightoffold = function(element, settings) {
        if (settings.container === undefined || settings.container === window) {
            var fold = $(window).width() + $(window).scrollLeft();
        } else {
            var fold = $(settings.container).offset().left + $(settings.container).width();
        }
        return fold <= $(element).offset().left - settings.threshold;
    };

    $.abovethetop = function(element, settings) {
        if (settings.container === undefined || settings.container === window) {
            var fold = $(window).scrollTop();
        } else {
            var fold = $(settings.container).offset().top;
        }
        return fold >= $(element).offset().top + settings.threshold  + $(element).height();
    };

    $.leftofbegin = function(element, settings) {
        if (settings.container === undefined || settings.container === window) {
            var fold = $(window).scrollLeft();
        } else {
            var fold = $(settings.container).offset().left;
        }
        return fold >= $(element).offset().left + settings.threshold + $(element).width();
    };


})(jQuery);

/*
 * Lazy Load - jQuery plugin for lazy loading images
 *
 * Copyright (c) 2007-2009 Mika Tuupola
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Project home:
 *   http://www.appelsiini.net/projects/lazyload
 *
 * Version:  1.5.0
 *
 */

function consoleLog(){
	if(window.console){
		try {
			console.log.apply(this, arguments);
		}catch(e){}
	}
}


(function($) {

    $.fn.lazyload = function(options) {
        var settings = {
            threshold    : 0,
            failurelimit : 0,
            event        : "scroll",
            effect       : "show",
            container    : window
        };
                
        if(options) {
            $.extend(settings, options);
        }

	consoleLog('lazyload settings: ', settings);

        /* Fire one scroll event per scroll. Not one scroll event per image. */
        var elements = this;
        if ("scroll" == settings.event) {
	    consoleLog("Scroll event fired");
            $(settings.container).bind("scroll", function(event) {
                
                var counter = 0;
                elements.each(function() {
                    if ($.abovethetop(this, settings) ||
                        $.leftofbegin(this, settings)) {
                            /* Nothing. */
                    } else if (!$.belowthefold(this, settings) &&
                        !$.rightoffold(this, settings)) {
                            $(this).trigger("appear");
                    } else {
                        if (counter++ > settings.failurelimit) {
                            return false;
                        }
                    }
                });
                /* Remove image from array so it is not looped next time. */
                var temp = $.grep(elements, function(element) {
                    return !element.loaded;
                });
                elements = $(temp);
            });
        }
        
        this.each(function() {
            var self = this;
            
            /* Save original only if it is not defined in HTML. */
            if (undefined == $(self).attr("original")) {
                $(self).attr("original", $(self).attr("src"));     
            }

            if ("scroll" != settings.event || 
                    undefined == $(self).attr("src") || 
                    settings.placeholder == $(self).attr("src") || 
		    $(self).attr("src") == "/clear.gif" ||
                    ($.abovethetop(self, settings) ||
                     $.leftofbegin(self, settings) || 
                     $.belowthefold(self, settings) || 
                     $.rightoffold(self, settings) )) {
                        
                if (settings.placeholder) {
                    $(self).attr("src", settings.placeholder);      
                } else {
                    $(self).removeAttr("src");
                }
                self.loaded = false;
            } else {
                self.loaded = true;
            }

            consoleLog('self: ', self);
            
            /* When appear is triggered load original image. */
            $(self).one("appear", function() {
                if (!this.loaded) {
			consoleLog('triggering appear: ' + !this.loaded);
                    $("<img />")
                        .bind("error", function() {
                                $(self).attr("src", "/static/images/image_not_found.jpg");
                                self.loaded = true;
                        })
                        .bind("load", function() {
                            $(self)
                                .hide()
                                .attr("src", $(self).attr("original"))
                                [settings.effect](settings.effectspeed);
                            self.loaded = true;
                        })
                        .attr("src", $(self).attr("original"));
                };
            });

            /* When wanted event is triggered load original image */
            /* by triggering appear.                              */
            if ("scroll" != settings.event) {
                $(self).bind(settings.event, function(event) {
                    if (!self.loaded) {
                        $(self).trigger("appear");
                    }
                });
            }
        });
        
        /* Force initial check if images should appear. */
        $(settings.container).trigger(settings.event);
        
        return this;

    };

    /* Convenience methods in jQuery namespace.           */
    /* Use as  $.belowthefold(element, {threshold : 100, container : window}) */

    $.belowthefold = function(element, settings) {
        if (settings.container === undefined || settings.container === window) {
            var fold = $(window).height() + $(window).scrollTop();
        } else {
            var fold = $(settings.container).offset().top + $(settings.container).height();
        }
        return fold <= $(element).offset().top - settings.threshold;
    };
    
    $.rightoffold = function(element, settings) {
        if (settings.container === undefined || settings.container === window) {
            var fold = $(window).width() + $(window).scrollLeft();
        } else {
            var fold = $(settings.container).offset().left + $(settings.container).width();
        }
        return fold <= $(element).offset().left - settings.threshold;
    };
        
    $.abovethetop = function(element, settings) {
        if (settings.container === undefined || settings.container === window) {
            var fold = $(window).scrollTop();
        } else {
            var fold = $(settings.container).offset().top;
        }
        return fold >= $(element).offset().top + settings.threshold  + $(element).height();
    };
    
    $.leftofbegin = function(element, settings) {
        if (settings.container === undefined || settings.container === window) {
            var fold = $(window).scrollLeft();
        } else {
            var fold = $(settings.container).offset().left;
        }
        return fold >= $(element).offset().left + settings.threshold + $(element).width();
    };
    /* Custom selectors for your convenience.   */
    /* Use as $("img:below-the-fold").something() */

    $.extend($.expr[':'], {
        "below-the-fold" : "$.belowthefold(a, {threshold : 0, container: window})",
        "above-the-fold" : "!$.belowthefold(a, {threshold : 0, container: window})",
        "right-of-fold"  : "$.rightoffold(a, {threshold : 0, container: window})",
        "left-of-fold"   : "!$.rightoffold(a, {threshold : 0, container: window})"
    });
    
})(jQuery);
/**
 * jQuery.ScrollTo - Easy element scrolling using jQuery.
 * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 5/25/2009
 * @author Ariel Flesler
 * @version 1.4.2
 *
 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
 */
;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);

(function($){$.extend({tablesorter:new function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'.',debug:false};function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms");}this.benchmark=benchmark;function log(s){if(typeof console!="undefined"&&typeof console.debug!="undefined"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug="";}var rows=table.tBodies[0].rows;if(table.tBodies[0].rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i<l;i++){var p=false;if($.metadata&&($($headers[i]).metadata()&&$($headers[i]).metadata().sorter)){p=getParserById($($headers[i]).metadata().sorter);}else if((table.config.headers[i]&&table.config.headers[i].sorter)){p=getParserById(table.config.headers[i].sorter);}if(!p){p=detectParserForColumn(table,cells[i]);}if(table.config.debug){parsersDebug+="column:"+i+" parser:"+p.id+"\n";}list.push(p);}}if(table.config.debug){log(parsersDebug);}return list;};function detectParserForColumn(table,node){var l=parsers.length;for(var i=1;i<l;i++){if(parsers[i].is($.trim(getElementText(table.config,node)),table,node)){return parsers[i];}}return parsers[0];}function getParserById(name){var l=parsers.length;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==name.toLowerCase()){return parsers[i];}}return false;}function buildCache(table){if(table.config.debug){var cacheTime=new Date();}var totalRows=(table.tBodies[0]&&table.tBodies[0].rows.length)||0,totalCells=(table.tBodies[0].rows[0]&&table.tBodies[0].rows[0].cells.length)||0,parsers=table.config.parsers,cache={row:[],normalized:[]};for(var i=0;i<totalRows;++i){var c=table.tBodies[0].rows[i],cols=[];cache.row.push($(c));for(var j=0;j<totalCells;++j){cols.push(parsers[j].format(getElementText(table.config,c.cells[j]),table,c.cells[j]));}cols.push(i);cache.normalized.push(cols);cols=null;};if(table.config.debug){benchmark("Building cache for "+totalRows+" rows:",cacheTime);}return cache;};function getElementText(config,node){if(!node)return"";var t="";if(config.textExtraction=="simple"){if(node.childNodes[0]&&node.childNodes[0].hasChildNodes()){t=node.childNodes[0].innerHTML;}else{t=node.innerHTML;}}else{if(typeof(config.textExtraction)=="function"){t=config.textExtraction(node);}else{t=$(node).text();}}return t;}function appendToTable(table,cache){if(table.config.debug){var appendTime=new Date()}var c=cache,r=c.row,n=c.normalized,totalRows=n.length,checkCell=(n[0].length-1),tableBody=$(table.tBodies[0]),rows=[];for(var i=0;i<totalRows;i++){rows.push(r[n[i][checkCell]]);if(!table.config.appender){var o=r[n[i][checkCell]];var l=o.length;for(var j=0;j<l;j++){tableBody[0].appendChild(o[j]);}}}if(table.config.appender){table.config.appender(table,rows);}rows=null;if(table.config.debug){benchmark("Rebuilt table:",appendTime);}applyWidget(table);setTimeout(function(){$(table).trigger("sortEnd");},0);};function buildHeaders(table){if(table.config.debug){var time=new Date();}var meta=($.metadata)?true:false,tableHeadersRows=[];for(var i=0;i<table.tHead.rows.length;i++){tableHeadersRows[i]=0;};$tableHeaders=$("thead th",table);$tableHeaders.each(function(index){this.count=0;this.column=index;this.order=formatSortingOrder(table.config.sortInitialOrder);if(checkHeaderMetadata(this)||checkHeaderOptions(table,index))this.sortDisabled=true;if(!this.sortDisabled){$(this).addClass(table.config.cssHeader);}table.config.headerList[index]=this;});if(table.config.debug){benchmark("Built headers:",time);log($tableHeaders);}return $tableHeaders;};function checkCellColSpan(table,rows,row){var arr=[],r=table.tHead.rows,c=r[row].cells;for(var i=0;i<c.length;i++){var cell=c[i];if(cell.colSpan>1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i<l;i++){getWidgetById(c[i]).format(table);}}function getWidgetById(name){var l=widgets.length;for(var i=0;i<l;i++){if(widgets[i].id.toLowerCase()==name.toLowerCase()){return widgets[i];}}};function formatSortingOrder(v){if(typeof(v)!="Number"){i=(v.toLowerCase()=="desc")?1:0;}else{i=(v==(0||1))?v:0;}return i;}function isValueInArray(v,a){var l=a.length;for(var i=0;i<l;i++){if(a[i][0]==v){return true;}}return false;}function setHeadersCss(table,$headers,list,css){$headers.removeClass(css[0]).removeClass(css[1]);var h=[];$headers.each(function(offset){if(!this.sortDisabled){h[this.column]=$(this);}});var l=list.length;for(var i=0;i<l;i++){h[list[i][0]].addClass(css[list[i][1]]);}}function fixColumnWidth(table,$headers){var c=table.config;if(c.widthFixed){var colgroup=$('<colgroup>');$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($('<col>').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;i<l;i++){var s=sortList[i],o=c.headerList[s[0]];o.count=s[1];o.count++;}}function multisort(table,sortList,cache){if(table.config.debug){var sortTime=new Date();}var dynamicExp="var sortWrapper = function(a,b) {",l=sortList.length;for(var i=0;i<l;i++){var c=sortList[i][0];var order=sortList[i][1];var s=(getCachedSortType(table.config.parsers,c)=="text")?((order==0)?"sortText":"sortTextDesc"):((order==0)?"sortNumeric":"sortNumericDesc");var e="e"+i;dynamicExp+="var "+e+" = "+s+"(a["+c+"],b["+c+"]); ";dynamicExp+="if("+e+") { return "+e+"; } ";dynamicExp+="else { ";}var orgOrderCol=cache.normalized[0].length-1;dynamicExp+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(var i=0;i<l;i++){dynamicExp+="}; ";}dynamicExp+="return 0; ";dynamicExp+="}; ";eval(dynamicExp);cache.normalized.sort(sortWrapper);if(table.config.debug){benchmark("Sorting on "+sortList.toString()+" and dir "+order+" time:",sortTime);}return cache;};function sortText(a,b){return((a<b)?-1:((a>b)?1:0));};function sortTextDesc(a,b){return((b<a)?-1:((b>a)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);$this=$(this);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){$this.trigger("sortStart");var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){var $cell=$(this);var i=this.column;this.order=this.count++%2;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!=null){var a=config.sortForce;for(var j=0;j<a.length;j++){if(a[j][0]!=i){config.sortList.push(a[j]);}}}config.sortList.push([i,this.order]);}else{if(isValueInArray(i,config.sortList)){for(var j=0;j<config.sortList.length;j++){var s=config.sortList[j],o=config.headerList[s[0]];if(s[0]==i){o.count=s[1];o.count++;s[1]=o.count%2;}}}else{config.sortList.push([i,this.order]);}};setTimeout(function(){setHeadersCss($this[0],$headers,config.sortList,sortCSS);appendToTable($this[0],multisort($this[0],config.sortList,cache));},1);return false;}}).mousedown(function(){if(config.cancelSelection){this.onselectstart=function(){return false};return false;}});$this.bind("update",function(){this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);}).bind("sorton",function(e,list){$(this).trigger("sortStart");config.sortList=list;var sortList=config.sortList;updateHeaderSortCount(this,sortList);setHeadersCss(this,$headers,sortList,sortCSS);appendToTable(this,multisort(this,sortList,cache));}).bind("appendCache",function(){appendToTable(this,cache);}).bind("applyWidgetId",function(e,id){getWidgetById(id).format(this);}).bind("applyWidgets",function(){applyWidget(this);});if($.metadata&&($(this).metadata()&&$(this).metadata().sortlist)){config.sortList=$(this).metadata().sortlist;}if(config.sortList.length>0){$this.trigger("sorton",[config.sortList]);}applyWidget(this);});};this.addParser=function(parser){var l=parsers.length,a=true;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==parser.id.toLowerCase()){a=false;}}if(a){parsers.push(parser);};};this.addWidget=function(widget){widgets.push(widget);};this.formatFloat=function(s){var i=parseFloat(s);return(isNaN(i))?0:i;};this.formatInt=function(s){var i=parseInt(s);return(isNaN(i))?0:i;};this.isDigit=function(s,config){var DECIMAL='\\'+config.decimal;var exp='/(^[+]?0('+DECIMAL+'0+)?$)|(^([-+]?[1-9][0-9]*)$)|(^([-+]?((0?|[1-9][0-9]*)'+DECIMAL+'(0*[1-9][0-9]*)))$)|(^[-+]?[1-9]+[0-9]*'+DECIMAL+'0+$)/';return RegExp(exp).test($.trim(s));};this.clearTableBody=function(table){if($.browser.msie){function empty(){while(this.firstChild)this.removeChild(this.firstChild);}empty.apply(table.tBodies[0]);}else{table.tBodies[0].innerHTML="";}};}});$.fn.extend({tablesorter:$.tablesorter.construct});var ts=$.tablesorter;ts.addParser({id:"text",is:function(s){return true;},format:function(s){return $.trim(s.toLowerCase());},type:"text"});ts.addParser({id:"digit",is:function(s,table){var c=table.config;return $.tablesorter.isDigit(s,c);},format:function(s){return $.tablesorter.formatFloat(s);},type:"numeric"});ts.addParser({id:"currency",is:function(s){return/^[£$€?.]/.test(s);},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/[^0-9.]/g),""));},type:"numeric"});ts.addParser({id:"ipAddress",is:function(s){return/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s);},format:function(s){var a=s.split("."),r="",l=a.length;for(var i=0;i<l;i++){var item=a[i];if(item.length==2){r+="0"+item;}else{r+=item;}}return $.tablesorter.formatFloat(r);},type:"numeric"});ts.addParser({id:"url",is:function(s){return/^(https?|ftp|file):\/\/$/.test(s);},format:function(s){return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//),''));},type:"text"});ts.addParser({id:"isoDate",is:function(s){return/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(s);},format:function(s){return $.tablesorter.formatFloat((s!="")?new Date(s.replace(new RegExp(/-/g),"/")).getTime():"0");},type:"numeric"});ts.addParser({id:"percent",is:function(s){return/\%$/.test($.trim(s));},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g),""));},type:"numeric"});ts.addParser({id:"usLongDate",is:function(s){return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/));},format:function(s){return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"shortDate",is:function(s){return/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s);},format:function(s,table){var c=table.config;s=s.replace(/\-/g,"/");if(c.dateFormat=="us"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$1/$2");}else if(c.dateFormat=="uk"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$2/$1");}else if(c.dateFormat=="dd/mm/yy"||c.dateFormat=="dd-mm-yy"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/,"$1/$2/$3");}return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"time",is:function(s){return/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s);},format:function(s){return $.tablesorter.formatFloat(new Date("2000/01/01 "+s).getTime());},type:"numeric"});ts.addParser({id:"metadata",is:function(s){return false;},format:function(s,table,cell){var c=table.config,p=(!c.parserMetadataName)?'sortValue':c.parserMetadataName;return $(cell).metadata()[p];},type:"numeric"});ts.addWidget({id:"zebra",format:function(table){if(table.config.debug){var time=new Date();}$("tr:visible",table.tBodies[0]).filter(':even').removeClass(table.config.widgetZebra.css[1]).addClass(table.config.widgetZebra.css[0]).end().filter(':odd').removeClass(table.config.widgetZebra.css[0]).addClass(table.config.widgetZebra.css[1]);if(table.config.debug){$.tablesorter.benchmark("Applying Zebra widget",time);}}});})(jQuery);(function($) {
	$.extend({
		tablesorterPager: new function() {
			
			function updatePageDisplay(c) {
				var s = $(c.cssPageDisplay,c.container).val((c.page+1) + c.seperator + c.totalPages);	
			}
			
			function setPageSize(table,size) {
				var c = table.config;
				c.size = size;
				c.totalPages = Math.ceil(c.totalRows / c.size);
				c.pagerPositionSet = false;
				moveToPage(table);
				fixPosition(table);
			}
			
			function fixPosition(table) {
				var c = table.config;
				if(!c.pagerPositionSet && c.positionFixed) {
					var c = table.config, o = $(table);
					if(o.offset) {
						c.container.css({
							top: o.offset().top + o.height() + 'px',
							position: 'absolute'
						});
					}
					c.pagerPositionSet = true;
				}
			}
			
			function moveToFirstPage(table) {
				var c = table.config;
				c.page = 0;
				moveToPage(table);
			}
			
			function moveToLastPage(table) {
				var c = table.config;
				c.page = (c.totalPages-1);
				moveToPage(table);
			}
			
			function moveToNextPage(table) {
				var c = table.config;
				c.page++;
				if(c.page >= (c.totalPages-1)) {
					c.page = (c.totalPages-1);
				}
				moveToPage(table);
			}
			
			function moveToPrevPage(table) {
				var c = table.config;
				c.page--;
				if(c.page <= 0) {
					c.page = 0;
				}
				moveToPage(table);
			}
						
			
			function moveToPage(table) {
				var c = table.config;
				if(c.page < 0 || c.page > (c.totalPages-1)) {
					c.page = 0;
				}
				
				renderTable(table,c.rowsCopy);
			}
			
			function renderTable(table,rows) {
				
				var c = table.config;
				var l = rows.length;
				var s = (c.page * c.size);
				var e = (s + c.size);
				if(e > rows.length ) {
					e = rows.length;
				}
				
				
				var tableBody = $(table.tBodies[0]);
				
				// clear the table body
				
				$.tablesorter.clearTableBody(table);
				
				for(var i = s; i < e; i++) {
					
					//tableBody.append(rows[i]);
					
					var o = rows[i];
					var l = o.length;
					for(var j=0; j < l; j++) {
						
						tableBody[0].appendChild(o[j]);

					}
				}
				
				fixPosition(table,tableBody);
				
				$(table).trigger("applyWidgets");
				
				if( c.page >= c.totalPages ) {
        			moveToLastPage(table);
				}
				
				updatePageDisplay(c);
			}
			
			this.appender = function(table,rows) {
				
				var c = table.config;
				
				c.rowsCopy = rows;
				c.totalRows = rows.length;
				c.totalPages = Math.ceil(c.totalRows / c.size);
				
				renderTable(table,rows);
			};
			
			this.defaults = {
				size: 10,
				offset: 0,
				page: 0,
				totalRows: 0,
				totalPages: 0,
				container: null,
				cssNext: '.next',
				cssPrev: '.prev',
				cssFirst: '.first',
				cssLast: '.last',
				cssPageDisplay: '.pagedisplay',
				cssPageSize: '.pagesize',
				seperator: "/",
				positionFixed: true,
				appender: this.appender
			};
			
			this.construct = function(settings) {
				
				return this.each(function() {	
					
					config = $.extend(this.config, $.tablesorterPager.defaults, settings);
					
					var table = this, pager = config.container;
				
					$(this).trigger("appendCache");
					
					config.size = parseInt($(".pagesize",pager).val());
					
					$(config.cssFirst,pager).click(function() {
						moveToFirstPage(table);
						return false;
					});
					$(config.cssNext,pager).click(function() {
						moveToNextPage(table);
						return false;
					});
					$(config.cssPrev,pager).click(function() {
						moveToPrevPage(table);
						return false;
					});
					$(config.cssLast,pager).click(function() {
						moveToLastPage(table);
						return false;
					});
					$(config.cssPageSize,pager).change(function() {
						setPageSize(table,parseInt($(this).val()));
						return false;
					});
				});
			};
			
		}
	});
	// extend plugin scope
	$.fn.extend({
        tablesorterPager: $.tablesorterPager.construct
	});
	
})(jQuery);				
/** vbulletin_menu.js **/
var vbmenu_usepopups=true;var vbmenu_registered=new Array();var vbmenu_initialized=new Array();var vbmenu_activemenus=new Array();var vbmenu_currentactive=false;var slidetimer=false;var vbmenu_opensteps=10;var vbmenu_doslide=true;var vbmenu_dofade=false;var vbmenu_datefields=new Array();var vbmenu_submenus=new Array();var vbmenu_bottommenus=new Array();function e_by_gum(eventobj)
{if(!eventobj||is_ie)
{window.event.cancelBubble=true;return window.event;}
else
{if(eventobj.target.type=='submit')
{eventobj.target.form.submit();}
eventobj.stopPropagation();return eventobj;}}
function inspectObject(obj,maxLevels,level)
{var str='',type,msg;if(level==null)level=0;if(maxLevels==null)maxLevels=1;if(maxLevels<1)
return'Error: Levels number must be > 0';if(obj==null)
return'Error: Object NULL';str+='  ';for(property in obj)
{try
{type=typeof(obj[property]);str+='('+type+') '+property+
((obj[property]==null)?(': null'):(''))+'';if((type=='object')&&(obj[property]!=null)&&(level+1<maxLevels))
str+=inspect(obj[property],maxLevels,level+1);}
catch(err)
{if(typeof(err)=='string')msg=err;else if(err.message)msg=err.message;else if(err.description)msg=err.description;else msg='Unknown';str+='(Error) '+property+': '+msg+'';}}
str+="\n";return str;}
function fetch_object_posleft(elm)
{var left=elm.offsetLeft;if(typeof(vbmenu_submenus[elm.id])!="undefined")
{left-=elm.offsetLeft;left+=elm.offsetParent.offsetWidth;}
while((elm=elm.offsetParent)!=null)
{left+=elm.offsetLeft;}
return left;}
function fetch_object_postop(elm)
{var top=elm.offsetTop;if(typeof(vbmenu_submenus[elm.id])!="undefined")
{top-=elm.offsetHeight+3;}
while((elm=elm.offsetParent)!=null)
{top+=elm.offsetTop;}
return top;}
function vbmenu_doregister(controlid,nowrite,datefield)
{if(document.getElementsByTagName)
{if(!nowrite){nowrite=0;}
var controlobj=fetch_object(controlid);if(controlobj)
{if(datefield)
{vbmenu_datefields[controlid]=datefield;}
vbmenu_registered[vbmenu_registered.length]=controlid;if(nowrite==0)
{document.write('<img src="'+IMGDIR_MISC+'/menu_open.gif" alt="" border="0" />');}
if(nowrite==2)
{document.write('<img style="float:right" src="/static/ddlevelsfiles/arrow-right.gif" alt="" border="0" />');vbmenu_submenus[controlid]=2;}
if(nowrite==3)
{document.write('<img src="'+IMGDIR_MISC+'/menu_open.gif" alt="" border="0" />');vbmenu_bottommenus[controlid]=3;}
return true;}}
return false;}
function vbmenu_getmenuid(controlid)
{var dotpos=controlid.indexOf(".");if(dotpos!=-1)
{return controlid.substr(0,dotpos);}
else
{return controlid;}}
function vbmenu_eventhandler_mouseover(e)
{e=do_an_e(e);vbmenu_hover(this);}
function vbmenu_eventhandler_click(e)
{e=do_an_e(e);vbmenu_open(this);}
function vbmenu_close_submenus()
{if(vbmenu_currentactive)
{for(key in vbmenu_activemenus)
{if(typeof(vbmenu_submenus[vbmenu_getmenuid(key)])!="undefined")
{fetch_object(vbmenu_getmenuid(key)+"_menu").style.display="none";vbmenu_activemenus[key]=false;}}}
vbmenu_currentactive=false;if(slidetimer)
{clearTimeout(slidetimer);slidetimer=false;}
if(is_ie)
{selects=document.getElementsByTagName("select");for(var i=0;i<selects.length;i++)
{selects[i].style.visibility="visible";}}}
function vbmenu_close()
{if(vbmenu_currentactive)
{for(key in vbmenu_activemenus)
{if(vbmenu_activemenus[key]==true){fetch_object(vbmenu_getmenuid(key)+"_menu").style.display="none";vbmenu_activemenus[key]=false;}}}
vbmenu_currentactive=false;if(slidetimer)
{clearTimeout(slidetimer);slidetimer=false;}
if(is_ie)
{selects=document.getElementsByTagName("select");for(var i=0;i<selects.length;i++)
{selects[i].style.visibility="visible";}}}
function vbmenu_hover(elm)
{for(key in vbmenu_activemenus)
{if(vbmenu_activemenus[key]==true&&key!=elm.id)
{vbmenu_open(elm);return;}}}
function vbmenu_overlap(selectobj,m)
{s=new Array();s['L']=fetch_object_posleft(selectobj);s['T']=fetch_object_postop(selectobj);s['R']=s['L']+selectobj.offsetWidth;s['B']=s['T']+selectobj.offsetHeight;if(s['L']>=m['L']&&s['L']<=m['R']&&((s['T']>=m['T']&&s['T']<=m['B'])||(s['B']>=m['T']&&s['B']<=m['B']))){return true;}
else if(s['R']>=m['L']&&s['R']<=m['R']&&((s['T']>=m['T']&&s['T']<=m['B'])||(s['B']>=m['T']&&s['B']<=m['B']))){return true;}
else if(s['B']>=m['T']&&s['T']<=m['B']&&((s['L']>=m['L']&&s['L']<=m['R'])||(s['R']>=m['R']&&s['R']<=m['R']))){return true;}
else if(m['B']>=s['T']&&m['T']<=s['B']&&((m['L']>=s['L']&&m['L']<=s['R'])||(m['R']>=s['R']&&m['R']<=s['R']))){return true;}
else{return false;}}
function vbmenu_open(elm)
{var openmenu=vbmenu_currentactive;if(openmenu==elm.id)
{return false;}
var menuid=vbmenu_getmenuid(elm.id)+"_menu";var menuobj=fetch_object(menuid);var force_right_slide=false;var issubmenu=false;if(typeof(vbmenu_submenus[elm.id])!="undefined")
{issubmenu=true;vbmenu_close_submenus();}
else
{issubmenu=false;vbmenu_close();}
if(typeof(vbmenu_datefields[elm.id])!="undefined")
{force_right_slide=true;fetch_object(elm.id+"_output").innerHTML=fetch_object(vbmenu_datefields[elm.id]).value;}
else
{force_right_slide=false}
vbmenu_activemenus[elm.id]=true;vbmenu_currentactive=elm.id;var leftpx=fetch_object_posleft(elm);var toppx=fetch_object_postop(elm)+elm.offsetHeight;menuobj.style.display="";var slidedir='left';if(force_right_slide||(leftpx+menuobj.offsetWidth)>=document.body.clientWidth)
{leftpx=leftpx+elm.offsetWidth-menuobj.offsetWidth;slidedir="right";}
else
{slidedir="left";}
if(is_ie)
{leftpx+=(slidedir=="left")?-2:2;}
if(typeof(vbmenu_bottommenus[elm.id])!="undefined")
{var myWidth=0,myHeight=0;if(typeof(window.innerWidth)=='number'){myWidth=window.innerWidth;myHeight=window.innerHeight;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){myWidth=document.documentElement.clientWidth;myHeight=document.documentElement.clientHeight;}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){myWidth=document.body.clientWidth;myHeight=document.body.clientHeight;}
toppx=myHeight-menuobj.offsetHeight-30;menuobj.style.position='fixed';}
menuobj.style.left=leftpx+"px";menuobj.style.top=toppx+"px";menuobj.style.zIndex=99;if(is_ie)
{menuarea={"L":leftpx,"T":toppx,"R":leftpx+menuobj.offsetWidth,"B":toppx+menuobj.offsetHeight};selects=document.getElementsByTagName("select");for(var i=0;i<selects.length;i++)
{if(vbmenu_overlap(selects[i],menuarea))
{selects[i].style.visibility="hidden";}}}
if(vbmenu_doslide&&!is_opera&&!is_ie4)
{if(vbmenu_dofade&&is_ie)
{menuobj.filters.item('DXImageTransform.Microsoft.alpha').opacity=0;}
var intervalX=Math.ceil(menuobj.offsetWidth/vbmenu_opensteps);var intervalY=Math.ceil(menuobj.offsetHeight/vbmenu_opensteps);if(slidedir=="left")
{menuobj.style.clip="rect(auto, 0px, 0px, auto)";vbmenu_slide_left(menuid,intervalX,intervalY,0,0,0);}
else
{menuobj.style.clip="rect(auto, auto, 0px, "+(menuobj.offsetWidth)+"px)";vbmenu_slide_right(menuid,intervalX,intervalY,menuobj.offsetWidth,0,0);}}
return false;}
function vbmenu_slide_left(menuid,intervalX,intervalY,clipX,clipY,opacity)
{var menuobj=fetch_object(menuid);if(clipX<menuobj.offsetWidth||clipY<menuobj.offsetHeight)
{if(vbmenu_dofade&&is_ie)
{opacity+=10;menuobj.filters.item('DXImageTransform.Microsoft.alpha').opacity=opacity;}
clipX+=intervalX;clipY+=intervalY;menuobj.style.clip="rect(auto, "+clipX+"px, "+clipY+"px, auto)";slidetimer=setTimeout("vbmenu_slide_left('"+menuid+"', "+intervalX+", "+intervalY+", "+clipX+", "+clipY+", "+opacity+");",0);}
else
{clearTimeout(slidetimer);}}
function vbmenu_slide_right(menuid,intervalX,intervalY,clipX,clipY,opacity)
{menuobj=fetch_object(menuid);if(clipX>0||clipY<menuobj.offsetHeight)
{if(vbmenu_dofade&&is_ie)
{opacity+=10;menuobj.filters.item('DXImageTransform.Microsoft.alpha').opacity=opacity;}
clipX-=intervalX;clipY+=intervalY;menuobj.style.clip="rect(auto, "+menuobj.offsetWidth+"px, "+clipY+"px, "+clipX+"px)";slidetimer=setTimeout("vbmenu_slide_right('"+menuid+"', "+intervalX+", "+intervalY+", "+clipX+", "+clipY+", "+opacity+");",0);}
else
{clearTimeout(slidetimer);}}
function vbmenu_navtolink(e)
{childLinks=this.getElementsByTagName("a");if(childLinks[0])
{if(is_ie)
{childLinks[0].click();window.event.cancelBubble=true;}
else
{if(e.shiftKey)
{window.open(childLinks[0].href);e.stopPropagation();e.preventDefault();}
else
{window.location=childLinks[0].href;e.stopPropagation();e.preventDefault();}}}}
function vbmenu_switch_option_bg(e)
{if(is_moz)
{moz_rclick(e);}
this.className=(this.className=="vbmenu_option")?"vbmenu_hilite":"vbmenu_option";vbmenu_hand_pointer(this);}
function vbmenu_hand_pointer(obj)
{try
{obj.style.cursor="pointer";}
catch(e)
{obj.style.cursor="hand";}}
function vbmenu_init(controlid)
{var menuid=vbmenu_getmenuid(controlid)+"_menu";var menuobj=fetch_object(menuid);if(document.getElementsByTagName&&menuobj)
{var controlobj=fetch_object(controlid);vbmenu_hand_pointer(controlobj);controlobj.unselectable=true;controlobj.onclick=vbmenu_eventhandler_click;controlobj.onmouseover=vbmenu_eventhandler_mouseover;if(typeof(vbmenu_initialized[menuid])!="undefined")
{return;}
var popupobj=fetch_object(menuid);popupobj.style.display="none";popupobj.style.position="absolute";popupobj.style.left="0px";popupobj.style.top="0px";popupobj.onclick=e_by_gum;var tables=popupobj.getElementsByTagName("table");if(tables.length>0)
{tables[0].width="";}
if(is_ie)
{popupobj.style.filter+="progid:DXImageTransform.Microsoft.alpha(enabled=1,opacity=100)";popupobj.style.filter+="progid:DXImageTransform.Microsoft.shadow(direction=135,color=#8E8E8E,strength=3)";}
var tds=popupobj.getElementsByTagName("td");for(var i=0;i<tds.length;i++)
{if(tds[i].className=="vbmenu_option")
{tds[i].style.cursor="default";if(tds[i].title=="nohilite")
{tds[i].title="";}
else
{tds[i].onmouseover=vbmenu_switch_option_bg;tds[i].onmouseout=vbmenu_switch_option_bg;tds[i].onclick=vbmenu_navtolink;if(!is_saf&&!is_kon)
{try
{var links=tds[i].getElementsByTagName("a");for(var j=0;j<links.length;j++)
{if(typeof(links[j].onclick)=="undefined")
{links[j].onclick=e_by_gum;}}}
catch(e)
{}}}}
else if(is_moz)
{tds[i].onmouseover=moz_rclick;tds[i].onmouseout=moz_rclick;}}
vbmenu_initialized[menuid]=true;}}
function returnfalse()
{return false;}
function moz_rclick(e)
{if(e.type=='mouseover')
{document.onclick='';}
else
{document.onclick=vbmenu_close;}}

