
/*
 * Superfish v1.4.8 - jQuery menu widget
 * Copyright (c) 2008 Joel Birch
 *
 * Dual licensed under the MIT and GPL licenses:
 * 	http://www.opensource.org/licenses/mit-license.php
 * 	http://www.gnu.org/licenses/gpl.html
 *
 * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
 */

;(function($){
	$.fn.superfish = function(op){

		var sf = $.fn.superfish,
			c = sf.c,
			$arrow = $(['<span class="',c.arrowClass,'"> &#187;</span>'].join('')),
			over = function(){
				var $$ = $(this), menu = getMenu($$);
				clearTimeout(menu.sfTimer);
				$$.showSuperfishUl().siblings().hideSuperfishUl();
			},
			out = function(){
				var $$ = $(this), menu = getMenu($$), o = sf.op;
				clearTimeout(menu.sfTimer);
				menu.sfTimer=setTimeout(function(){
					o.retainPath=($.inArray($$[0],o.$path)>-1);
					$$.hideSuperfishUl();
					if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}
				},o.delay);	
			},
			getMenu = function($menu){
				var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];
				sf.op = sf.o[menu.serial];
				return menu;
			},
			addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); };
			
		return this.each(function() {
			var s = this.serial = sf.o.length;
			var o = $.extend({},sf.defaults,op);
			o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){
				$(this).addClass([o.hoverClass,c.bcClass].join(' '))
					.filter('li:has(ul)').removeClass(o.pathClass);
			});
			sf.o[s] = sf.op = o;
			
			$('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
				if (o.autoArrows) addArrow( $('>a:first-child',this) );
			})
			.not('.'+c.bcClass)
				.hideSuperfishUl();
			
			var $a = $('a',this);
			$a.each(function(i){
				var $li = $a.eq(i).parents('li');
				$a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});
			});
			o.onInit.call(this);
			
		}).each(function() {
			var menuClasses = [c.menuClass];
			if (sf.op.dropShadows  && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
			$(this).addClass(menuClasses.join(' '));
		});
	};

	var sf = $.fn.superfish;
	sf.o = [];
	sf.op = {};
	sf.IE7fix = function(){
		var o = sf.op;
		if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined)
			this.toggleClass(sf.c.shadowClass+'-off');
		};
	sf.c = {
		bcClass     : 'sf-breadcrumb',
		menuClass   : 'sf-js-enabled',
		anchorClass : 'sf-with-ul',
		arrowClass  : 'sf-sub-indicator',
		shadowClass : 'sf-shadow'
	};
	sf.defaults = {
		hoverClass	: 'sfHover',
		pathClass	: 'overideThisToUse',
		pathLevels	: 1,
		delay		: 800,
		animation	: {opacity:'show'},
		speed		: 'normal',
		autoArrows	: true,
		dropShadows : true,
		disableHI	: false,		// true disables hoverIntent detection
		onInit		: function(){}, // callback functions
		onBeforeShow: function(){},
		onShow		: function(){},
		onHide		: function(){}
	};
	$.fn.extend({
		hideSuperfishUl : function(){
			var o = sf.op,
				not = (o.retainPath===true) ? o.$path : '';
			o.retainPath = false;
			var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass)
					.find('>ul').hide().css('visibility','hidden');
			o.onHide.call($ul);
			return this;
		},
		showSuperfishUl : function(){
			var o = sf.op,
				sh = sf.c.shadowClass+'-off',
				$ul = this.addClass(o.hoverClass)
					.find('>ul:hidden').css('visibility','visible');
			sf.IE7fix.call($ul);
			o.onBeforeShow.call($ul);
			$ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); });
			return this;
		}
	});

})(jQuery);



/**
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne <brian@cherne.net>
*/
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);



/*
 * FancyBox - jQuery Plugin
 * Simple and fancy lightbox alternative
 *
 * Examples and documentation at: http://fancybox.net
 * 
 * Copyright (c) 2008 - 2010 Janis Skarnelis
 * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
 * 
 * Version: 1.3.4 (11/11/2010)
 * Requires: jQuery v1.3+
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */

;(function(b){var m,t,u,f,D,j,E,n,z,A,q=0,e={},o=[],p=0,d={},l=[],G=null,v=new Image,J=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,W=/[^\.]\.(swf)\s*$/i,K,L=1,y=0,s="",r,i,h=false,B=b.extend(b("<div/>")[0],{prop:0}),M=b.browser.msie&&b.browser.version<7&&!window.XMLHttpRequest,N=function(){t.hide();v.onerror=v.onload=null;G&&G.abort();m.empty()},O=function(){if(false===e.onError(o,q,e)){t.hide();h=false}else{e.titleShow=false;e.width="auto";e.height="auto";m.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>');
F()}},I=function(){var a=o[q],c,g,k,C,P,w;N();e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));w=e.onStart(o,q,e);if(w===false)h=false;else{if(typeof w=="object")e=b.extend(e,w);k=e.title||(a.nodeName?b(a).attr("title"):a.title)||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(k===""&&e.orig&&e.titleFromAlt)k=e.orig.attr("alt");c=e.href||(a.nodeName?b(a).attr("href"):a.href)||null;if(/^(?:javascript)/i.test(c)||
c=="#")c=null;if(e.type){g=e.type;if(!c)c=e.content}else if(e.content)g="html";else if(c)g=c.match(J)?"image":c.match(W)?"swf":b(a).hasClass("iframe")?"iframe":c.indexOf("#")===0?"inline":"ajax";if(g){if(g=="inline"){a=c.substr(c.indexOf("#"));g=b(a).length>0?"inline":"ajax"}e.type=g;e.href=c;e.title=k;if(e.autoDimensions)if(e.type=="html"||e.type=="inline"||e.type=="ajax"){e.width="auto";e.height="auto"}else e.autoDimensions=false;if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick=
false;e.enableEscapeButton=false;e.showCloseButton=false}e.padding=parseInt(e.padding,10);e.margin=parseInt(e.margin,10);m.css("padding",e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(j.children())});switch(g){case "html":m.html(e.content);F();break;case "inline":if(b(a).parent().is("#fancybox-content")===true){h=false;break}b('<div class="fancybox-inline-tmp" />').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(j.children())}).bind("fancybox-cancel",
function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity();v=new Image;v.onerror=function(){O()};v.onload=function(){h=true;v.onerror=v.onload=null;e.width=v.width;e.height=v.height;b("<img />").attr({id:"fancybox-img",src:v.src,alt:e.title}).appendTo(m);Q()};v.src=c;break;case "swf":e.scrolling="no";C='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+e.width+'" height="'+e.height+'"><param name="movie" value="'+c+
'"></param>';P="";b.each(e.swf,function(x,H){C+='<param name="'+x+'" value="'+H+'"></param>';P+=" "+x+'="'+H+'"'});C+='<embed src="'+c+'" type="application/x-shockwave-flash" width="'+e.width+'" height="'+e.height+'"'+P+"></embed></object>";m.html(C);F();break;case "ajax":h=false;b.fancybox.showActivity();e.ajax.win=e.ajax.success;G=b.ajax(b.extend({},e.ajax,{url:c,data:e.ajax.data||{},error:function(x){x.status>0&&O()},success:function(x,H,R){if((typeof R=="object"?R:G).status==200){if(typeof e.ajax.win==
"function"){w=e.ajax.win(c,x,H,R);if(w===false){t.hide();return}else if(typeof w=="string"||typeof w=="object")x=w}m.html(x);F()}}}));break;case "iframe":Q()}}else O()}},F=function(){var a=e.width,c=e.height;a=a.toString().indexOf("%")>-1?parseInt((b(window).width()-e.margin*2)*parseFloat(a)/100,10)+"px":a=="auto"?"auto":a+"px";c=c.toString().indexOf("%")>-1?parseInt((b(window).height()-e.margin*2)*parseFloat(c)/100,10)+"px":c=="auto"?"auto":c+"px";m.wrapInner('<div style="width:'+a+";height:"+c+
";overflow: "+(e.scrolling=="auto"?"auto":e.scrolling=="yes"?"scroll":"hidden")+';position:relative;"></div>');e.width=m.width();e.height=m.height();Q()},Q=function(){var a,c;t.hide();if(f.is(":visible")&&false===d.onCleanup(l,p,d)){b.event.trigger("fancybox-cancel");h=false}else{h=true;b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");f.is(":visible")&&d.titlePosition!=="outside"&&f.css("height",f.height());l=o;p=q;d=e;if(d.overlayShow){u.css({"background-color":d.overlayColor,
opacity:d.overlayOpacity,cursor:d.hideOnOverlayClick?"pointer":"auto",height:b(document).height()});if(!u.is(":visible")){M&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});u.show()}}else u.hide();i=X();s=d.title||"";y=0;n.empty().removeAttr("style").removeClass();if(d.titleShow!==false){if(b.isFunction(d.titleFormat))a=d.titleFormat(s,l,p,d);else a=s&&s.length?
d.titlePosition=="float"?'<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+s+'</td><td id="fancybox-title-float-right"></td></tr></table>':'<div id="fancybox-title-'+d.titlePosition+'">'+s+"</div>":false;s=a;if(!(!s||s==="")){n.addClass("fancybox-title-"+d.titlePosition).html(s).appendTo("body").show();switch(d.titlePosition){case "inside":n.css({width:i.width-d.padding*2,marginLeft:d.padding,marginRight:d.padding});
y=n.outerHeight(true);n.appendTo(D);i.height+=y;break;case "over":n.css({marginLeft:d.padding,width:i.width-d.padding*2,bottom:d.padding}).appendTo(D);break;case "float":n.css("left",parseInt((n.width()-i.width-40)/2,10)*-1).appendTo(f);break;default:n.css({width:i.width-d.padding*2,paddingLeft:d.padding,paddingRight:d.padding}).appendTo(f)}}}n.hide();if(f.is(":visible")){b(E.add(z).add(A)).hide();a=f.position();r={top:a.top,left:a.left,width:f.width(),height:f.height()};c=r.width==i.width&&r.height==
i.height;j.fadeTo(d.changeFade,0.3,function(){var g=function(){j.html(m.contents()).fadeTo(d.changeFade,1,S)};b.event.trigger("fancybox-change");j.empty().removeAttr("filter").css({"border-width":d.padding,width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2});if(c)g();else{B.prop=0;b(B).animate({prop:1},{duration:d.changeSpeed,easing:d.easingChange,step:T,complete:g})}})}else{f.removeAttr("style");j.css("border-width",d.padding);if(d.transitionIn=="elastic"){r=V();j.html(m.contents());
f.show();if(d.opacity)i.opacity=0;B.prop=0;b(B).animate({prop:1},{duration:d.speedIn,easing:d.easingIn,step:T,complete:S})}else{d.titlePosition=="inside"&&y>0&&n.show();j.css({width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2}).html(m.contents());f.css(i).fadeIn(d.transitionIn=="none"?0:d.speedIn,S)}}}},Y=function(){if(d.enableEscapeButton||d.enableKeyboardNav)b(document).bind("keydown.fb",function(a){if(a.keyCode==27&&d.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if((a.keyCode==
37||a.keyCode==39)&&d.enableKeyboardNav&&a.target.tagName!=="INPUT"&&a.target.tagName!=="TEXTAREA"&&a.target.tagName!=="SELECT"){a.preventDefault();b.fancybox[a.keyCode==37?"prev":"next"]()}});if(d.showNavArrows){if(d.cyclic&&l.length>1||p!==0)z.show();if(d.cyclic&&l.length>1||p!=l.length-1)A.show()}else{z.hide();A.hide()}},S=function(){if(!b.support.opacity){j.get(0).style.removeAttribute("filter");f.get(0).style.removeAttribute("filter")}e.autoDimensions&&j.css("height","auto");f.css("height","auto");
s&&s.length&&n.show();d.showCloseButton&&E.show();Y();d.hideOnContentClick&&j.bind("click",b.fancybox.close);d.hideOnOverlayClick&&u.bind("click",b.fancybox.close);b(window).bind("resize.fb",b.fancybox.resize);d.centerOnScroll&&b(window).bind("scroll.fb",b.fancybox.center);if(d.type=="iframe")b('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" '+(b.browser.msie?'allowtransparency="true""':"")+' scrolling="'+e.scrolling+'" src="'+d.href+'"></iframe>').appendTo(j);
f.show();h=false;b.fancybox.center();d.onComplete(l,p,d);var a,c;if(l.length-1>p){a=l[p+1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}if(p>0){a=l[p-1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}},T=function(a){var c={width:parseInt(r.width+(i.width-r.width)*a,10),height:parseInt(r.height+(i.height-r.height)*a,10),top:parseInt(r.top+(i.top-r.top)*a,10),left:parseInt(r.left+(i.left-r.left)*a,10)};if(typeof i.opacity!=="undefined")c.opacity=a<0.5?0.5:a;f.css(c);
j.css({width:c.width-d.padding*2,height:c.height-y*a-d.padding*2})},U=function(){return[b(window).width()-d.margin*2,b(window).height()-d.margin*2,b(document).scrollLeft()+d.margin,b(document).scrollTop()+d.margin]},X=function(){var a=U(),c={},g=d.autoScale,k=d.padding*2;c.width=d.width.toString().indexOf("%")>-1?parseInt(a[0]*parseFloat(d.width)/100,10):d.width+k;c.height=d.height.toString().indexOf("%")>-1?parseInt(a[1]*parseFloat(d.height)/100,10):d.height+k;if(g&&(c.width>a[0]||c.height>a[1]))if(e.type==
"image"||e.type=="swf"){g=d.width/d.height;if(c.width>a[0]){c.width=a[0];c.height=parseInt((c.width-k)/g+k,10)}if(c.height>a[1]){c.height=a[1];c.width=parseInt((c.height-k)*g+k,10)}}else{c.width=Math.min(c.width,a[0]);c.height=Math.min(c.height,a[1])}c.top=parseInt(Math.max(a[3]-20,a[3]+(a[1]-c.height-40)*0.5),10);c.left=parseInt(Math.max(a[2]-20,a[2]+(a[0]-c.width-40)*0.5),10);return c},V=function(){var a=e.orig?b(e.orig):false,c={};if(a&&a.length){c=a.offset();c.top+=parseInt(a.css("paddingTop"),
10)||0;c.left+=parseInt(a.css("paddingLeft"),10)||0;c.top+=parseInt(a.css("border-top-width"),10)||0;c.left+=parseInt(a.css("border-left-width"),10)||0;c.width=a.width();c.height=a.height();c={width:c.width+d.padding*2,height:c.height+d.padding*2,top:c.top-d.padding-20,left:c.left-d.padding-20}}else{a=U();c={width:d.padding*2,height:d.padding*2,top:parseInt(a[3]+a[1]*0.5,10),left:parseInt(a[2]+a[0]*0.5,10)}}return c},Z=function(){if(t.is(":visible")){b("div",t).css("top",L*-40+"px");L=(L+1)%12}else clearInterval(K)};
b.fn.fancybox=function(a){if(!b(this).length)return this;b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(c){c.preventDefault();if(!h){h=true;b(this).blur();o=[];q=0;c=b(this).attr("rel")||"";if(!c||c==""||c==="nofollow")o.push(this);else{o=b("a[rel="+c+"], area[rel="+c+"]");q=o.index(this)}I()}});return this};b.fancybox=function(a,c){var g;if(!h){h=true;g=typeof c!=="undefined"?c:{};o=[];q=parseInt(g.index,10)||0;if(b.isArray(a)){for(var k=
0,C=a.length;k<C;k++)if(typeof a[k]=="object")b(a[k]).data("fancybox",b.extend({},g,a[k]));else a[k]=b({}).data("fancybox",b.extend({content:a[k]},g));o=jQuery.merge(o,a)}else{if(typeof a=="object")b(a).data("fancybox",b.extend({},g,a));else a=b({}).data("fancybox",b.extend({content:a},g));o.push(a)}if(q>o.length||q<0)q=0;I()}};b.fancybox.showActivity=function(){clearInterval(K);t.show();K=setInterval(Z,66)};b.fancybox.hideActivity=function(){t.hide()};b.fancybox.next=function(){return b.fancybox.pos(p+
1)};b.fancybox.prev=function(){return b.fancybox.pos(p-1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a);o=l;if(a>-1&&a<l.length){q=a;I()}else if(d.cyclic&&l.length>1){q=a>=l.length?0:l.length-1;I()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");N();e.onCancel(o,q,e);h=false}};b.fancybox.close=function(){function a(){u.fadeOut("fast");n.empty().hide();f.hide();b.event.trigger("fancybox-cleanup");j.empty();d.onClosed(l,p,d);l=e=[];p=q=0;d=e={};h=false}if(!(h||f.is(":hidden"))){h=
true;if(d&&false===d.onCleanup(l,p,d))h=false;else{N();b(E.add(z).add(A)).hide();b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");j.find("iframe").attr("src",M&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");d.titlePosition!=="inside"&&n.empty();f.stop();if(d.transitionOut=="elastic"){r=V();var c=f.position();i={top:c.top,left:c.left,width:f.width(),height:f.height()};if(d.opacity)i.opacity=1;n.empty().hide();B.prop=1;
b(B).animate({prop:0},{duration:d.speedOut,easing:d.easingOut,step:T,complete:a})}else f.fadeOut(d.transitionOut=="none"?0:d.speedOut,a)}}};b.fancybox.resize=function(){u.is(":visible")&&u.css("height",b(document).height());b.fancybox.center(true)};b.fancybox.center=function(a){var c,g;if(!h){g=a===true?1:0;c=U();!g&&(f.width()>c[0]||f.height()>c[1])||f.stop().animate({top:parseInt(Math.max(c[3]-20,c[3]+(c[1]-j.height()-40)*0.5-d.padding)),left:parseInt(Math.max(c[2]-20,c[2]+(c[0]-j.width()-40)*0.5-
d.padding))},typeof a=="number"?a:200)}};b.fancybox.init=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('<div id="fancybox-tmp"></div>'),t=b('<div id="fancybox-loading"><div></div></div>'),u=b('<div id="fancybox-overlay"></div>'),f=b('<div id="fancybox-wrap"></div>'));D=b('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(f);
D.append(j=b('<div id="fancybox-content"></div>'),E=b('<a id="fancybox-close"></a>'),n=b('<div id="fancybox-title"></div>'),z=b('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),A=b('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));E.click(b.fancybox.close);t.click(b.fancybox.cancel);z.click(function(a){a.preventDefault();b.fancybox.prev()});A.click(function(a){a.preventDefault();b.fancybox.next()});
b.fn.mousewheel&&f.bind("mousewheel.fb",function(a,c){if(h)a.preventDefault();else if(b(a.target).get(0).clientHeight==0||b(a.target).get(0).scrollHeight===b(a.target).get(0).clientHeight){a.preventDefault();b.fancybox[c>0?"prev":"next"]()}});b.support.opacity||f.addClass("fancybox-ie");if(M){t.addClass("fancybox-ie6");f.addClass("fancybox-ie6");b('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")+'" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(D)}}};
b.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:false,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing",
easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};b(document).ready(function(){b.fancybox.init()})})(jQuery);


/* Copyright (c) 2009 Mustafa OZCAN (http://www.mustafaozcan.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 * Version: 1.0.2
 * Requires: jquery.1.3+
 */
jQuery.fn.fixedtableheader = function (options) {
    var settings = jQuery.extend({
        headerrowsize: 1,
        highlightrow: false,
        highlightclass: "highlight"
    }, options);
    this.each(function (i) {
        var $tbl = $(this);
        var $tblhfixed = $tbl.find("tr:lt(" + settings.headerrowsize + ")");
        var headerelement = "th";
        if ($tblhfixed.find(headerelement).length == 0) headerelement = "td";
        if ($tblhfixed.find(headerelement).length > 0) {
            $tblhfixed.find(headerelement).each(function () {
                $(this).css("width", $(this).width());
            });
            var $clonedTable = $tbl.clone().empty();
            var tblwidth = GetTblWidth($tbl);
            $clonedTable.attr("id", "fixedtableheader" + i).css({
                "position": "fixed",
                "top": "0",
                "left": $tbl.offset().left
            }).append($tblhfixed.clone()).width(tblwidth).hide().appendTo($("body"));
            if (settings.highlightrow) $("tr:gt(" + (settings.headerrowsize - 1) + ")", $tbl).hover(function () {
                $(this).addClass(settings.highlightclass);
            }, function () {
                $(this).removeClass(settings.highlightclass);
            });
            $(window).scroll(function () {
                if (jQuery.browser.msie && jQuery.browser.version == "6.0") $clonedTable.css({
                    "position": "absolute",
                    "top": $(window).scrollTop(),
                    "left": $tbl.offset().left
                });
                else $clonedTable.css({
                    "position": "fixed",
                    "top": "0",
                    "left": $tbl.offset().left - $(window).scrollLeft()
                });
                var sctop = $(window).scrollTop();
                var elmtop = $tblhfixed.offset().top;
                if (sctop > elmtop && sctop <= (elmtop + $tbl.height() - $tblhfixed.height())) $clonedTable.show();
                else $clonedTable.hide();
            });
            $(window).resize(function () {
                if ($clonedTable.outerWidth() != $tbl.outerWidth()) {
                    $tblhfixed.find(headerelement).each(function (index) {
                        var w = $(this).width();
                        $(this).css("width", w);
                        $clonedTable.find(headerelement).eq(index).css("width", w);
                    });
                    $clonedTable.width($tbl.outerWidth());
                }
                $clonedTable.css("left", $tbl.offset().left);
            });
        }
    });

    function GetTblWidth($tbl) {
        var tblwidth = $tbl.outerWidth();
        return tblwidth;
    }
};


/**
 * jp
 * WP FRAMEWORK 0.5
 * @package JS-JP-WP FRAMEWORK
 * TODO: make it all an object, design from ground up
 */

/**
 * MAIN CONTROLLER
 */
 
 var Global = {};
function _clstr_init_sections()
{
	/**
	 * INITILIAZE
	 */
	var $						= (arguments.length > 0) ? arguments[0] : null;
	var sections		= (arguments.length > 1) ? arguments[1] : null;
	var args				= (arguments.length > 2) ? arguments[2] : null;
	
	if ( args !== null ) args = args.get();
	
	if ( $ !== null && sections !== null )
	{
		// if sections is an array (only with jquery):
		if ($.isArray(sections))
		{
			// loop thru each value
			$.each(sections,function(i, section){
				init_section($, section, args);
			});
		}
	}
	
	var baseUrl			= location.host;
	
	init_section($, 'common_dom_ready', args);
}




/**
 * PAGE BY PAGE / CONDITIONAL INIT
 */
function init_section()
{
	var $						= (arguments.length > 0) ? arguments[0] : null;
	var section			= (arguments.length > 1) ? arguments[1] : null;
	var args				= (arguments.length > 2) ? arguments[2] : null;
	
	if ( $ !== null )
	{
		var $_body			= $('body');
		var $_wrapper		= $('#wrapper');
		var $_container	= $('#container');
		var $_content		= $('#content');
		
		// add/remove javascript identification classes
		$_body.addClass('JS');
		$_wrapper.removeClass('nojs');
	}

	/**
	 * COMMON/GLOBAL
	 */
	if (section == 'common_dom_ready')
	{
		
	} // end if 'common'
	
	
	
	/**
	 * HOME
	 */
	if (section == 'home')
	{
		
	} // end if 'home'
	
	
	
	/**
	 * VOTING
	 */
	if (section == 'voting')
	{
		/**
		 * Collapse infobox
		 */
		$infobox = $('#vote-instructions');
		$infobox_entry = $('.entry', $infobox[0]);
		
		$infobox.live('click', function(e){
			$infobox_entry.slideToggle();
			$infobox.toggleClass('collapsed');
		});
		$infobox.hover(function(){
			$(this).addClass('hover');
		},function(){
			$(this).removeClass('hover');
		});
		
		/**
		 * Floating vote bar
		 */
		var $vbar				= $('#vote-bar');
		var $vbox				= $('#vote-bar-box');
		var $vbox_title	= $vbox.find('h6').first();
		var $vbox_inner	= $('#vote-bar-box-inner');
		var $vbox_open	= $('#vote-bar-box-open');
		var $vbox_list	= $('#vote-bar-box-list');
		var $vbox_del		= $vbox_list.find('.co-delete-vote');
		var $vbox_stats	= $('#voted-status');
		var $vote_li		= $vbox_list.find('li');
		
		var max_votes		= parseInt(args.max_votes);
		var num_votes		= parseInt(args.num_votes);
		var votes_left	= max_votes - num_votes;
		var maxed_votes	= (max_votes === num_votes);
		
		var _cont_o = 0;
		var _cont_h = $_container.height();
		
		var _bar_h = $vbar.height();
		
		var cont_bot = (_cont_o.top + _cont_h) - _bar_h;
		
		$('html,body').scroll(function(){
			var _bar_o = $vbar.offset();
			
			if ( cont_bot > (_bar_o.top-50) )
			{
				$vbar.css('position','static');
			}
		});
		
		/**
		 * Expand / collpase bottom bar voted list
		 */
		$vbox_title.click(function(e)
		{
			var mycb = (arguments.length > 1 && typeof arguments[1] == 'function')
							 ? arguments[1] 
							 : function(){};
			
			$vbar.toggleClass('collapsed');
			
			if ( $vbar.hasClass('collapsed') )
			{
				$vbox_inner.fadeOut(200, function(e){
					$vbox.animate({
						height: 35,
						bottom: 0
					}, 250, function(e)
					{
						$vbox_open.fadeIn(150);
						
						mycb();
					});
				});
			}
			else {
				$vbox_open.fadeOut(150, function(){
					$vbox.animate({
						height: 245,
						bottom: 0
					}, 250, function(){
						$vbox_inner.fadeIn();
					});
				});
			}
		});
		
		$vbox_open.click(function(){ $vbox_title.trigger('click'); });
		
		/**
		 * Delete a company from list of voted on companies
		 */
		$vbox_del.live('click', function(e)
		{
			if (tn_state != 'ok')
				return false;
			
			var cid = $(this).attr('id').match(/\d+/)[0];
			
			/**
			 * DEBUG
			 *
			console.group('del_vote');
			lg( $(e.target) );
			lg( e.target );
			lg( $(this) );
			lg( this );			
			lg( cid );
			lg('uri:'+ajax_url);
			console.groupEnd('del_vote');
			/**/
			
			
			
			ajax_url = args.url + '?medium=ajax&action=del_vote&cid='+cid;
			
		
			
			$.ajax({
				dataType	: 'json',
				url				: ajax_url,
				error			: function(xhr, status, err)
				{
					alert('There was a problem with your request, please reload the page and try again'+"\n"+'If the problem persists please contact us as soon as possible.');
					/**
					 * DEBUG
					 *
					console.group('xhr');
					lg(status);
					lg(err);
					console.groupEnd('xhr');
					/**/
				},
				success		: function(data, status, xhr)
				{
					/**
					 * DEBUG
					 *
					console.group('xhr');
					lg(status);
					lg(data);
					console.groupEnd('xhr');
					/**/
					
					if ( data.status == 'error' )
					{
						alert(data.error);
						/**
						lg('xhr err');
						lg(data.error)
						lg(data.error_id)
						/**/
					}
					else {
						updateVoteCount({ action: 'del', cid: cid});
					}
					
				}
			});
		});
		
		/**
		 * Grid hover
		 */
		var slide_over = false;
		
		var $co_grid = $('#vote-grid');
		var $co_tn = $co_grid.find('.co-tn');
		var $co_action = $co_grid.find('.co-action');
		
		var $hvr_tn = hvr_tn_id = false;
		var hvr_tn_mouse = { x:0, y:0 };
		var tn_orig_pos;
		var $hvr_tns = [];
		
		var tn_state = 'ok';
		var tn_timer_count = 0;
		var tn_timer_max_poll = 10;
		var tn_timer;
		
		var cols = 5;
		var rows = Math.floor($co_tn.length / 5);
		
		$('.fb').fancybox();
		
		/**
		 * Ajax defaults
		 */
		var $ajax_loader = false;
		$_container.ajaxStart(function()
		{
			$_container.addClass('disabled ajax-loading');
			$co_grid.fadeTo(222, 0.4);
			$vbar.fadeTo(222, 0.3);
			tn_state = 'xhr';
		});
		$_container.ajaxComplete(function()
		{
			if ( tn_state != 'ok' )
				tn_state = 'xhrdone';
			var check_cnt = 0;
			var check_state = function(){
				check_cnt += 1;
				/**
				lg( 'is xhr done-------' );
				lg( 'check_cnt: '+check_cnt );
				lg( 'tn_state: '+tn_state );
				lg( ' ... ' ); lg('');
				/**/
				if (tn_state == 'ok' || check_cnt == 10)
				{
					tn_state = 'ok';
					clearInterval(xhr_done);
					$_container.removeClass('disabled ajax-loading');
					$co_grid.fadeTo(177, 1);
					$vbar.fadeTo(177, 1);
				}
			};
			var xhr_done = setInterval(check_state, 500);
		});
		
		/**
		 * Update votes
		 */
		 function updateVoteCount()
		{
			$vote_li		= $vbox_list.find('li');
			
			num_votes = $vote_li.filter(':not(.empty)').length;
			
			//alert(num_votes);
			
			maxed_votes = (num_votes === max_votes);
			
			var mode = 'none';
			var cid = 0;
			
			if ( arguments.length === 1 )
			{
				cid = parseInt(arguments[0].cid);
				mode = arguments[0].action;
			}
			
			
			
			/**
			lg( mode );
			lg( cid );
			/**/
			
			if (mode == 'add' && cid != 0)
			{
						
				var $del_li = $vote_li.filter('.empty')
				var x = $del_li.length;
				var $tn = $co_tn.filter('#co-'+cid);
				
				//alert('called');
		
					// Check for duplicate candidate entries and prevent adding
					if($('#co-delete-'+cid).length>0) return false;	
				/**
				lg( '----------' );
				lg( $del_li )
				lg( x );
				lg( $tn );
				lg( '----------' );
				/**/
				
				$del_li.remove();
				
				
				$vbox_list.append('<li id=\'candidate-'+cid+ '\' class=\'candidate\'>' + $tn.find('h2').first().html() + 
					'<span class="co-delete-vote" id="co-delete-' + cid + '">X</span></li>');
				
				$tn.addClass('co-tn-voted');
				$co_grid.find('#co-'+cid+'-hover').addClass('co-tn-voted');
				
				if (x > 0)
				{
					for(i=1; i < x; i++)
						$vbox_list.append('<li class="empty">&nbsp;</li>');
				}
			}
			else if (mode == 'del' && cid != 0)
			{
				lg( $vbox_list.find('#co-delete-'+cid) );
				lg( '#co-delete-'+cid );
				$vbox_list.find('#co-delete-'+cid).parent('li').remove();
				$co_tn.filter('#co-'+cid).removeClass('co-tn-voted');
				$co_grid.find('#co-'+cid+'-hover').removeClass('co-tn-voted');
				$vbox_list.append('<li class="empty"></li>');
			}
			
			/**
			 * Calculate number of votes
			 */
			$vote_li		= $vbox_list.find('li');
			num_votes = parseInt($vote_li.filter(':not(.empty)').length);
			maxed_votes = (num_votes === max_votes);
			votes_left = max_votes - num_votes;
			tn_state = 'ok';
			
			var num_candidates =$('.candidate').length;
			
			 
			 
			if (num_candidates == 5)	 
			
			{
			$('#vote_submit_btn').attr('disabled', false);
				$vbox_stats.html( 'Thank you for choosing your candidates. Please submit your vote');
				alert('Thank you for choosing your candidates. You can now submit your vote. You can also change your candidates at any time');

			}
			else 
			{
				$('#vote_submit_btn').attr('disabled', true);
					$vbox_stats.html( 'You must choose 5 candidates to vote for');

			}
			
			
			
			
			
				
			
			
			/**/
			lg('nv:'+num_votes);
			lg('mv:'+maxed_votes);
		
			/**/
		
		}
		
		// Thumbnail or link clicked, actionable items use class '.co-action'
		// action will produce popup for company
		$co_action.live('click', function(e)
		{
			if (tn_state != 'ok')
				return false;
			
			e.preventDefault();
			
			var $act = $(e.target);
			var action_type = $act.hasClass('co-vote') ? 'vote' : 'popup';
			
			var $tn = ($act.hasClass('.co-tn')) ? $act : $act.parents('.co-tn');
			var cid = parseInt($tn.attr('id').match(/\d+/i)[0]);
			
			if (action_type == 'vote')
			{
				$.ajax({
					dataType	: 'json',
					url				: $act.attr('href'),
					error			: function(xhr, status, err)
					{
						alert('There was a problem with your request, please reload the page and try again'+"\n"+'If the problem persists please contact us as soon as possible.');
						/**
						 * DEBUG
						 *
						console.group('xhr');
						lg(status);
						lg(err);
						console.groupEnd('xhr');
						/**/
					},
					success		: function(data, status, xhr)
					{
						/**
						 * DEBUG
						 * 
						lg(status);
						lg(data);
						/**/
						if ( data && data.status == 'error' )
						{
							alert(data.error);
							/**
							 * DEBUG
							 *
							lg(data.error)
							lg(data.error_id)
							/**/
							tn_state = 'ok';
						}
						else {
							updateVoteCount({ action: 'add', cid: cid});
						}
					}
				});
			}
			
			if (action_type == 'popup')
			{
				
				lg ( $tn.find('.co-more').html() );
				$.fancybox({
					type						: 'iframe',
					//content					: $tn.find('#co-more-'+cid).html(),
					href						: $tn.find('.co-see-more').attr('href'),
					width						: 800,
					height					: 600,
					autoDimensions	: false
				});
				
			}
			
			
			/**
			 * DEBUG
			 *
			dbg = [
				 $act,
				action_type,
				$tn,
				cid
			];
			lg(dbg);
			/**/
			
			
			return false;
		});
		
		// Hover over thumbnail will make the thumbnail expand based on position
		// Need these values to calculate position and animations correctly
		var tn_orig_width		= $co_tn.width();
		var tn_orig_height	= $co_tn.height();
		
		var tn_outter_width	= $co_tn.outerWidth( true );
		var tn_margin_width	= parseInt($co_tn.css('margin-right'));
		var tn_border_width	= parseInt($co_tn.css('border-right-width'));
		
		var tn_hover_width	= (tn_outter_width * 3) - tn_margin_width - (tn_border_width * 2);
		
		var tn_enlargen_space = 35;
		
		var tn_enlargen_width = tn_orig_width + (tn_enlargen_space * 2);
		var tn_enlargen_height = tn_orig_height + (tn_enlargen_space * 2);
		
		var tn_positions		= {
			c3:			tn_outter_width,
			c4:			(tn_outter_width * 2),
			c5:			(tn_outter_width * 2)
		};

		/**
		 * DEBUG
		 *
		lg( tn_positions );
		lg( tn_outter_width );
		lg( tn_hover_width );
		lg( tn_margin_width );
		lg( tn_border_width );
		lg( $co_tn );
		/**/
		
		Global.updateVotes = updateVoteCount;
		
		function tnAniReset()
		{
			if ( tn_timer_count < tn_timer_max_poll ){
				tn_timer_count++;
			} else {
				tn_timer_count = 0;
				clearInterval(tn_timer);
				tn_state = 'ok';
			}
		}
		
		
		
		
		
		function isInVoteList(cid)
		{
				
				var candidate  = $('#candidate-'+cid);
				return (candidate.length >0 )? true : false; 
				
		}
		
		Global.isInVoteList = isInVoteList;
		
		
		
		function tnHoverOut(e, tn)
		{
			tn_state = 'ani';
			
			var $tn = $(this);
			
			var tn_col = $tn.data('ci_tn_col');
			var tn_orig_pos = $tn.data('ci_tn_position');
			var tn_left = tn_orig_pos.left;
			var tn_top = tn_orig_pos.top;
			
			/*
			if (slide_over)
			{
				if (tn_col === 3)
					tn_left = tn_positions.c3 + tn_outter_width;
				else if (tn_col === 4)
					tn_left = tn_positions.c4 + tn_outter_width;
				else if (tn_col === 5)
					tn_left = tn_positions.c5 + tn_outter_width;
			}
			*/
			
			$tn.animate({
				width		: tn_orig_width,
				height	: tn_orig_height,
				top			: tn_top,
				left		: tn_left,
				opacity	: 0
			}, 150, function()
			{
				$tn.hide();
				
				tn_state = 'ok';
				
				/*
				if ( !hvrTnStatus() && $(tn).length )
				{
					lg('tn'); lg(tn);
					tnSetup(tn);
				}
				*/
			});
		} // end tnHoverOut()
		
		function tnAnimationFinished()
		{
			// Use hoverintent jquery plugin for better mouse interaction
			var hi_config = {
				over:			function(){},
				timeout:	100,
				out:			tnHoverOut
			};
			
			$(this).hoverIntent(hi_config);
			
			clearInterval(tn_timer);
			
			tn_state = 'ok';
		} // end tnAnimationFinished()
		
		function animateTn(tn)
		{
			tnAniReset();
			
			if (tn_state == 'ok')
			{
				$hvr_tn = tn;
				
				tn_state = 'ani';
				clearInterval(tn_timer);
				
				var tn_col = $hvr_tn.data('ci_tn_col');
				var tn_orig_pos = $hvr_tn.data('ci_tn_position');
				var tn_left = tn_orig_pos.left;
				var tn_top = tn_orig_pos.top;
				var tn_width = tn_hover_width;
				var tn_height = tn_orig_height;
				
				/**
				 * DEBUG
				 *
				lg('hvr_tn');
				lg($hvr_tn);
				lg(tn_orig_pos);
				lg(tn_left);
				lg(tn_col);
				/**/
				
				// Show the new cloned thumbnail and animate it to slide
				if ( slide_over )
				{
					if (tn_col === 3)
						tn_left = tn_positions.c3;
					else if (tn_col === 4)
						tn_left = tn_positions.c4;
					else if (tn_col === 5)
						tn_left = tn_positions.c5;
				}
				else {
					var tn_row = $hvr_tn.data('ci_tn_row');
					var tn_col = $hvr_tn.data('ci_tn_col');
					
						tn_top = tn_orig_pos.top - tn_enlargen_space;
					
					
						tn_left = tn_orig_pos.left - tn_enlargen_space;
					
					
					var tn_width = tn_enlargen_width;
					var tn_height = tn_enlargen_height;
				}
				
				/**
				 * DEBUG
				 *
				console.group('row/col');
				lg('row:'+tn_row);
				lg('col:'+tn_col);
				console.groupEnd('row/col');
				
				lg(tn_left);
				/**/
				
				if ( !$vbar.hasClass('collapsed') && !$vbox.is(':animated') )
					$vbox_title.trigger('click');
				
				// Animate based on position
				$hvr_tn.css({display:'block',opacity:0}).animate(
					{
						width		: tn_width,
						height		: tn_height,
						top			: tn_top,
						left		: tn_left,
						opacity	: 1
					},
					150,
					tnAnimationFinished
				);
			}
			
		} // end animateTn()
		
		function tnSetup(tn)
		{
			// create hover thumbnail id
			var $tn = $(tn);
			
			hvr_tn_id = $tn.attr('id') + '-hover';
			
			/**
			 * DEBUG
			 *
			lg(tn);
			lg(hvr_tn_id);
			/**/
			
			// get new thumbnail
			$hvr_tn = $('#' + hvr_tn_id);
			
			tn_orig_pos = $tn.position();
			
			// Setup clone
			if ( ! $hvr_tn.length)
			{
				$hvr_tn = $tn.clone();
				
				// get grid number
				var tn_classes = $hvr_tn.attr('class').split(' ');
				
				var idx = row = col = false;
				
				$.each(tn_classes, function(i, val)
				{
					if (val.indexOf('x-') !== -1)
						idx = parseInt(val.replace('x-',''));
						
					if (val.indexOf('y-') !== -1)
						row = parseInt(val.replace('y-',''));
				});
				
				if ( idx > 0 )
					col = idx % cols;
				
				if (col === 0)
					col = 5;
					
				if ( ! slide_over)
					$hvr_tn.addClass('enlargen');
				
				$hvr_tn.attr('id', hvr_tn_id)
					.addClass('hover')
					.bind('ci_hidetn', tnHoverOut)
					.data('ci_tn_idx', idx)
					.data('ci_tn_col', col)
					.data('ci_tn_row', row)
					.data('ci_tn_position', tn_orig_pos)
					.css({
							left				: tn_orig_pos.left,
							top					: tn_orig_pos.top,
							marginRight	: 0,
							opacity			: 0
						})
					.appendTo($co_grid);
				/*
				lg( 'idxtn:' + ($hvr_tns.indexOf($hvr_tn) == -1) )
				lg( $hvr_tns );
				
				if ($hvr_tns.indexOf($hvr_tn) == -1)
					$hvr_tns.push($hvr_tn[0]);
				*/
			}
			
			/**
			 * DEBUG
			 *
			dbg = {
				1: $tn,
				2: $hvr_tn,
				3: tn_orig_pos,
				rows:		rows,
				row:		$hvr_tn.data('ci_tn_col'),
				col:		$hvr_tn.data('ci_tn_row')
			};
			lg(dbg);
			/**/
			
			animateTn($hvr_tn);
			tn_timer = setInterval( function(){animateTn($hvr_tn);}, 175);
		}
		
		function tnHover(e)
		{
			if (tn_state != 'ok')
				return false;
			/*
			if ($hvr_tns.length)
				$hvr_tns.filter(':visible').not(':animated').trigger('ci_hidetn');
			*/
			//lg( $co_tn );
			/*
			if ($hvr_tns.length)
				lg( $hvr_tns.filter(':visible') );
			*/
			
			$co_grid.find('.hover').filter(':visible').not(':animated').trigger('ci_hidetn');
			
			tnSetup(this);
			
			/*
			// Hide old hovered tn
			if ( hvrTnStatus() )
			{
				lg('yar');
				$hvr_tn.stop();
				$hvr_tn.trigger('ci_hidetn', [this]);
			}
			else {
				lg('nar');
				
			}
			*/
		} // end tnHover		
		
		function hvrTnStatus()
		{
			var hvr_status = ( $hvr_tn !== false && $hvr_tn.length && $hvr_tn.is(':visible') && !$hvr_tn.is(':animated') );
				
			/** 
			 * DEBUG
			 *
			console.group('hvrstatus');
			
			lg( ( $hvr_tn !== false ) );
			
			if ( $hvr_tn !== false )
				lg( ( $hvr_tn.length ) );
			
			if ( $hvr_tn !== false && $hvr_tn.length )
			{
				lg( $hvr_tn.is(':visible') );
				lg( !$hvr_tn.is(':animated') );
			}
				
			lg( $hvr_tn );
			lg( hvr_status );
			
			console.groupEnd('hvrstatus');
			
			/**********/
			
			return hvr_status;
		}
		
		// Setup polling to hide expanded boxes
		var mouseX = 0;
		var mouseY = 0;
		var get_m = true;
		var m_timer = setInterval( function(){
			if ( hvrTnStatus() )
			{
				var is_over = false;
				
				var tn_offset = $hvr_tn.offset();
				
				var tn_mpos = {
					left:		tn_offset.left,
					right:	tn_offset.left + tn_hover_width,
					top:		tn_offset.top,
					bottom:	tn_offset.top + tn_orig_height
				};
				
				if ( mouseX > tn_mpos.left 
						 && mouseX < tn_mpos.right
						 && mouseY > tn_mpos.top
						 && mouseY < tn_mpos.bottom )
				{
					is_over = true;
				}
				
				if ( ! is_over)
					$hvr_tn.trigger('ci_hidetn');
				
				/**
				 * DEBUG
				 *
				var dbg = {
					'tnid':			$hvr_tn.attr('id'),
					'is_over':	is_over,
					'tno':			tn_offset,
					'mx':				mouseX,
					'my':				mouseY,
					'tn_mpos':	tn_mpos
				};
				lg_open('mouse');
				lg(dbg);
				lg_close();
				/**/
				
			}
		}, 2000 );
		clearInterval(m_timer);
		
		/*
		m_polling = setInterval( function() {
			get_m = !get_m;
		}, 200);
		
		$(document).mousemove( function(e) {
			if ( get_m )
			{
				mouseX = e.pageX; 
				mouseY = e.pageY;
			}
		});
		*/
		// Use hoverintent jquery plugin for better mouse interaction
		var hi_config = {
			over:			tnHover,
			timeout:	150,
			out:			function(){}
		};
		$co_tn.hoverIntent(hi_config);
		
	} // end if 'voting'
	
	
	
} // end function init_section


/**
 * PAGE BY PAGE / CONDITIONAL FUNCTIONS
 */



/**
 * DEBUGGING FUNCTIONS
 */
function lg($msg)
{
	try {
		return (window.console && console.log($msg)) ? true : false;
	}
	catch(e){}
}
function lg_open(id)
{
	if (id == undefined) id = 'DEBUG';
	lg(' ');
	lg('//---------------//');
	lg(id);
}
function lg_close()
{
	lg('//---------------//');
	lg(' ');
}




function _clstr_var()
{
	var varz = {};
	
	this.add = function(v)
	{
		var idx = (arguments.length > 0) ? arguments[0] : '';
		var data = (arguments.length > 1) ? arguments[1] : '';
		eval( 'varz.'+idx+'=data;' );
	}
	this.get = function()
	{
		return varz;
	}
}






