jQuery.cookie=function(b,j,m){if(typeof j!="undefined"){m=m||{};if(j===null){j="";m.expires=-1}var e="";if(m.expires&&(typeof m.expires=="number"||m.expires.toUTCString)){var f;if(typeof m.expires=="number"){f=new Date();f.setTime(f.getTime()+(m.expires*24*60*60*1000))}else{f=m.expires}e="; expires="+f.toUTCString()}var l=m.path?"; path="+(m.path):"";var g=m.domain?"; domain="+(m.domain):"";var a=m.secure?"; secure":"";document.cookie=[b,"=",encodeURIComponent(j),e,l,g,a].join("")}else{var d=null;if(document.cookie&&document.cookie!=""){var k=document.cookie.split(";");for(var h=0;h<k.length;h++){var c=jQuery.trim(k[h]);if(c.substring(0,b.length+1)==(b+"=")){d=decodeURIComponent(c.substring(b.length+1));break}}}return d}};

;(function($) {

  // Prevent text bullets on slideshows from being selected
  // http://chris-barr.com/entry/disable_text_selection_with_jquery/
  $.extend($.fn.disableTextSelect = function() {
  	return this.each(function(){
  		if($.browser.mozilla){ //Firefox
  			$(this).css('MozUserSelect','none');
  		}else if($.browser.msie){ //IE
  			$(this).bind('selectstart',function(){return false;});
  		}else{ //Opera, etc.
  			$(this).mousedown(function(){return false;});
  		}
  	});
  });
  $('.labels li').disableTextSelect();

})(jQuery);


// This should be broken out as a plugin
/* Copyright (c) 2009 Jon Rohan (http://dinnermint.org)
 * 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.0
 * Written with jQuery 1.3.2
 */
(function($){$.fn.ghostText = function() {
  return this.each(function(){
    var text = $(this).attr("placeholder");
    if(text!=""&&($(this).val()==""||$(this).val()==text)) {
      $(this).addClass("disabled");
      $(this).val(text);
      $(this).focus(function(){
        $(this).removeClass("disabled");
        if($(this).val()==text) {
          $(this).val("");
        }
      });
      $(this).blur(function(){
        if($(this).val()=="") {
          $(this).val(text);
          $(this).addClass("disabled");
        }
      });
    }
  });
};})(jQuery)


;(function($) {

/**
* helper variables and function
*/
$.ifixpng = function(customPixel) {
$.ifixpng.pixel = customPixel;
};

$.ifixpng.regexp = {
bg: /^url\(["']?(.*\.png([?].*)?)["']?\)$/i,
img: /.*\.png([?].*)?$/i
},

$.ifixpng.getPixel = function() {
return $.ifixpng.pixel || 'images/pixel.gif';
};

var hack = {
base	: $('base').attr('href'),
ltie7	: $.browser.msie && $.browser.version < 7,
filter	: function(src) {
return "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='"+src+"')";
}
};

$.fn.ifixpng = hack.ltie7 ? function() {
function fixImage(image, source, width, height, hidden) {
image.css({filter:hack.filter(source), width: width, height: height})
.attr({src:$.ifixpng.getPixel()})
.positionFix();
}

return this.each(function() {
var $$ = $(this);
if ($$.is('img') || $$.is('input')) { // hack image tags present in dom
var source, img;
if (this.src && this.src.match($.ifixpng.regexp.img)) { // make sure it is png image
// use source tag value if set 
source = (hack.base && this.src.substring(0,1)!='/' && this.src.indexOf(hack.base) === -1) ? hack.base + this.src : this.src;
// If the width is not set, we have a problem; the image is not probably visible or not loaded
// and we need a work around.
if (!this.width || !this.height) {
$(new Image()).one('load', function() {
fixImage($$, source, this.width, this.height);
$(this).remove();
}).attr('src', source);
// If the image already has dimensions (it's loaded and visible) we can fix it straight away.
} else fixImage($$, source, this.width, this.height);
}
} else if (this.style) { // hack png css properties present inside css
var imageSrc = $$.css('backgroundImage');
// Background repeated images we cannot fix unfortunately
if (imageSrc && imageSrc.match($.ifixpng.regexp.bg) && this.currentStyle.backgroundRepeat == 'no-repeat') {
imageSrc = RegExp.$1;
var x = this.currentStyle.backgroundPositionX || 0, y = this.currentStyle.backgroundPositionY || 0;
if (x || y) {
var css = {}, img;
if (typeof x != 'undefined') {
if (x == 'left') css.left = 0; 
// if right is 0, we have to check if the parent has an odd width, because of an IE bug
else if (x == 'right') css.right = $$.width() % 2 === 1 ? -1 : 0;
else css.left = x;
}
if (typeof y != 'undefined') {
// if bottom is 0, we have to check if the parent has an odd height, because of an IE bug
if (y == 'bottom') css.bottom = $$.height() % 2 === 1 ? -1 : 0; 
else if (y == 'top') css.top = 0;
else css.top = y;
}
img = new Image();
$(img).one('load', function() {
var x,y, expr = {}, prop;
// Now the image is loaded for sure, we can see if the background position needs fixing with an expression (in case of percentages)
if (/center|%/.test(css.top)) {
expr.top = "(this.parentNode.offsetHeight - this.offsetHeight) * " + (css.top == 'center' ? 0.5 : (parseInt(css.top) / 100));
delete css.top;
}
if (/center|%/.test(css.left)) {
expr.left = "(this.parentNode.offsetWidth - this.offsetWidth) * " + (css.left == 'center' ? 0.5 : (parseInt(css.left) / 100));
delete css.left;
}
// Let's add the helper DIV which will simulate the background image
$$.positionFix().css({backgroundImage: 'none'}).prepend(
$('<div></div>').css(css).css({
width: this.width,
height: this.height,
position: 'absolute',
filter: hack.filter(imageSrc)
})
);
if (expr.top || expr.left) {
var elem = $$.children(':first')[0];
for (prop in expr) elem.style.setExpression(prop, expr[prop], 'JavaScript');
}
$(this).remove();
});
img.src = imageSrc;
} else {
$$.css({backgroundImage: 'none', filter:hack.filter(imageSrc)});
}
}
}
});
} : function() { return this; };

/**
* positions selected item relatively
*/
$.fn.positionFix = function() {
return this.each(function() {
var $$ = $(this);
if ($$.css('position') != 'absolute') $$.css({position:'relative'});
});
};

})(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);

/**
 * jQuery Validation Plugin 1.8.0
 *
 * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
 * http://docs.jquery.com/Plugins/Validation
 *
 * Copyright (c) 2006 - 2011 Jörn Zaefferer
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
(function(c){c.extend(c.fn,{validate:function(a){if(this.length){var b=c.data(this[0],"validator");if(b)return b;b=new c.validator(a,this[0]);c.data(this[0],"validator",b);if(b.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){b.cancelSubmit=true});b.settings.submitHandler&&this.find("input, button").filter(":submit").click(function(){b.submitButton=this});this.submit(function(d){function e(){if(b.settings.submitHandler){if(b.submitButton)var f=c("<input type='hidden'/>").attr("name",
b.submitButton.name).val(b.submitButton.value).appendTo(b.currentForm);b.settings.submitHandler.call(b,b.currentForm);b.submitButton&&f.remove();return false}return true}b.settings.debug&&d.preventDefault();if(b.cancelSubmit){b.cancelSubmit=false;return e()}if(b.form()){if(b.pendingRequest){b.formSubmitted=true;return false}return e()}else{b.focusInvalid();return false}})}return b}else a&&a.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing")},valid:function(){if(c(this[0]).is("form"))return this.validate().form();
else{var a=true,b=c(this[0].form).validate();this.each(function(){a&=b.element(this)});return a}},removeAttrs:function(a){var b={},d=this;c.each(a.split(/\s/),function(e,f){b[f]=d.attr(f);d.removeAttr(f)});return b},rules:function(a,b){var d=this[0];if(a){var e=c.data(d.form,"validator").settings,f=e.rules,g=c.validator.staticRules(d);switch(a){case "add":c.extend(g,c.validator.normalizeRule(b));f[d.name]=g;if(b.messages)e.messages[d.name]=c.extend(e.messages[d.name],b.messages);break;case "remove":if(!b){delete f[d.name];
return g}var h={};c.each(b.split(/\s/),function(j,i){h[i]=g[i];delete g[i]});return h}}d=c.validator.normalizeRules(c.extend({},c.validator.metadataRules(d),c.validator.classRules(d),c.validator.attributeRules(d),c.validator.staticRules(d)),d);if(d.required){e=d.required;delete d.required;d=c.extend({required:e},d)}return d}});c.extend(c.expr[":"],{blank:function(a){return!c.trim(""+a.value)},filled:function(a){return!!c.trim(""+a.value)},unchecked:function(a){return!a.checked}});c.validator=function(a,
b){this.settings=c.extend(true,{},c.validator.defaults,a);this.currentForm=b;this.init()};c.validator.format=function(a,b){if(arguments.length==1)return function(){var d=c.makeArray(arguments);d.unshift(a);return c.validator.format.apply(this,d)};if(arguments.length>2&&b.constructor!=Array)b=c.makeArray(arguments).slice(1);if(b.constructor!=Array)b=[b];c.each(b,function(d,e){a=a.replace(RegExp("\\{"+d+"\\}","g"),e)});return a};c.extend(c.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",
validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:c([]),errorLabelContainer:c([]),onsubmit:true,ignore:[],ignoreTitle:false,onfocusin:function(a){this.lastActive=a;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass);this.addWrapper(this.errorsFor(a)).hide()}},onfocusout:function(a){if(!this.checkable(a)&&(a.name in this.submitted||!this.optional(a)))this.element(a)},
onkeyup:function(a){if(a.name in this.submitted||a==this.lastElement)this.element(a)},onclick:function(a){if(a.name in this.submitted)this.element(a);else a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(a,b,d){c(a).addClass(b).removeClass(d)},unhighlight:function(a,b,d){c(a).removeClass(b).addClass(d)}},setDefaults:function(a){c.extend(c.validator.defaults,a)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",
url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:c.validator.format("Please enter no more than {0} characters."),minlength:c.validator.format("Please enter at least {0} characters."),rangelength:c.validator.format("Please enter a value between {0} and {1} characters long."),
range:c.validator.format("Please enter a value between {0} and {1}."),max:c.validator.format("Please enter a value less than or equal to {0}."),min:c.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){function a(e){var f=c.data(this[0].form,"validator");e="on"+e.type.replace(/^validate/,"");f.settings[e]&&f.settings[e].call(f,this[0])}this.labelContainer=c(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&
this.labelContainer||c(this.currentForm);this.containers=c(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var b=this.groups={};c.each(this.settings.groups,function(e,f){c.each(f.split(/\s/),function(g,h){b[h]=e})});var d=this.settings.rules;c.each(d,function(e,f){d[e]=c.validator.normalizeRule(f)});c(this.currentForm).validateDelegate(":text, :password, :file, select, textarea",
"focusin focusout keyup",a).validateDelegate(":radio, :checkbox, select, option","click",a);this.settings.invalidHandler&&c(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){this.checkForm();c.extend(this.submitted,this.errorMap);this.invalid=c.extend({},this.errorMap);this.valid()||c(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);
return this.valid()},element:function(a){this.lastElement=a=this.clean(a);this.prepareElement(a);this.currentElements=c(a);var b=this.check(a);if(b)delete this.invalid[a.name];else this.invalid[a.name]=true;if(!this.numberOfInvalids())this.toHide=this.toHide.add(this.containers);this.showErrors();return b},showErrors:function(a){if(a){c.extend(this.errorMap,a);this.errorList=[];for(var b in a)this.errorList.push({message:a[b],element:this.findByName(b)[0]});this.successList=c.grep(this.successList,
function(d){return!(d.name in a)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){c.fn.resetForm&&c(this.currentForm).resetForm();this.submitted={};this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b=0,d;for(d in a)b++;return b},hideErrors:function(){this.addWrapper(this.toHide).hide()},
valid:function(){return this.size()==0},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{c(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(a){}},findLastActive:function(){var a=this.lastActive;return a&&c.grep(this.errorList,function(b){return b.element.name==a.name}).length==1&&a},elements:function(){var a=this,b={};return c([]).add(this.currentForm.elements).filter(":input").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&
a.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in b||!a.objectLength(c(this).rules()))return false;return b[this.name]=true})},clean:function(a){return c(a)[0]},errors:function(){return c(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext)},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=c([]);this.toHide=c([]);this.currentElements=c([])},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers)},
prepareElement:function(a){this.reset();this.toHide=this.errorsFor(a)},check:function(a){a=this.clean(a);if(this.checkable(a))a=this.findByName(a.name).not(this.settings.ignore)[0];var b=c(a).rules(),d=false,e;for(e in b){var f={method:e,parameters:b[e]};try{var g=c.validator.methods[e].call(this,a.value.replace(/\r/g,""),a,f.parameters);if(g=="dependency-mismatch")d=true;else{d=false;if(g=="pending"){this.toHide=this.toHide.not(this.errorsFor(a));return}if(!g){this.formatAndAdd(a,f);return false}}}catch(h){this.settings.debug&&
window.console&&console.log("exception occured when checking element "+a.id+", check the '"+f.method+"' method",h);throw h;}}if(!d){this.objectLength(b)&&this.successList.push(a);return true}},customMetaMessage:function(a,b){if(c.metadata){var d=this.settings.meta?c(a).metadata()[this.settings.meta]:c(a).metadata();return d&&d.messages&&d.messages[b]}},customMessage:function(a,b){var d=this.settings.messages[a];return d&&(d.constructor==String?d:d[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(arguments[a]!==
undefined)return arguments[a]},defaultMessage:function(a,b){return this.findDefined(this.customMessage(a.name,b),this.customMetaMessage(a,b),!this.settings.ignoreTitle&&a.title||undefined,c.validator.messages[b],"<strong>Warning: No message defined for "+a.name+"</strong>")},formatAndAdd:function(a,b){var d=this.defaultMessage(a,b.method),e=/\$?\{(\d+)\}/g;if(typeof d=="function")d=d.call(this,b.parameters,a);else if(e.test(d))d=jQuery.format(d.replace(e,"{$1}"),b.parameters);this.errorList.push({message:d,
element:a});this.errorMap[a.name]=d;this.submitted[a.name]=d},addWrapper:function(a){if(this.settings.wrapper)a=a.add(a.parent(this.settings.wrapper));return a},defaultShowErrors:function(){for(var a=0;this.errorList[a];a++){var b=this.errorList[a];this.settings.highlight&&this.settings.highlight.call(this,b.element,this.settings.errorClass,this.settings.validClass);this.showLabel(b.element,b.message)}if(this.errorList.length)this.toShow=this.toShow.add(this.containers);if(this.settings.success)for(a=
0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight){a=0;for(b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass)}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return c(this.errorList).map(function(){return this.element})},showLabel:function(a,
b){var d=this.errorsFor(a);if(d.length){d.removeClass().addClass(this.settings.errorClass);d.attr("generated")&&d.html(b)}else{d=c("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(a),generated:true}).addClass(this.settings.errorClass).html(b||"");if(this.settings.wrapper)d=d.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();this.labelContainer.append(d).length||(this.settings.errorPlacement?this.settings.errorPlacement(d,c(a)):d.insertAfter(a))}if(!b&&this.settings.success){d.text("");
typeof this.settings.success=="string"?d.addClass(this.settings.success):this.settings.success(d)}this.toShow=this.toShow.add(d)},errorsFor:function(a){var b=this.idOrName(a);return this.errors().filter(function(){return c(this).attr("for")==b})},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(a){var b=this.currentForm;return c(document.getElementsByName(a)).map(function(d,e){return e.form==
b&&e.name==a&&e||null})},getLength:function(a,b){switch(b.nodeName.toLowerCase()){case "select":return c("option:selected",b).length;case "input":if(this.checkable(b))return this.findByName(b.name).filter(":checked").length}return a.length},depend:function(a,b){return this.dependTypes[typeof a]?this.dependTypes[typeof a](a,b):true},dependTypes:{"boolean":function(a){return a},string:function(a,b){return!!c(a,b.form).length},"function":function(a,b){return a(b)}},optional:function(a){return!c.validator.methods.required.call(this,
c.trim(a.value),a)&&"dependency-mismatch"},startRequest:function(a){if(!this.pending[a.name]){this.pendingRequest++;this.pending[a.name]=true}},stopRequest:function(a,b){this.pendingRequest--;if(this.pendingRequest<0)this.pendingRequest=0;delete this.pending[a.name];if(b&&this.pendingRequest==0&&this.formSubmitted&&this.form()){c(this.currentForm).submit();this.formSubmitted=false}else if(!b&&this.pendingRequest==0&&this.formSubmitted){c(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=
false}},previousValue:function(a){return c.data(a,"previousValue")||c.data(a,"previousValue",{old:null,valid:true,message:this.defaultMessage(a,"remote")})}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(a,b){a.constructor==String?this.classRuleSettings[a]=b:c.extend(this.classRuleSettings,
a)},classRules:function(a){var b={};(a=c(a).attr("class"))&&c.each(a.split(" "),function(){this in c.validator.classRuleSettings&&c.extend(b,c.validator.classRuleSettings[this])});return b},attributeRules:function(a){var b={};a=c(a);for(var d in c.validator.methods){var e=a.attr(d);if(e)b[d]=e}b.maxlength&&/-1|2147483647|524288/.test(b.maxlength)&&delete b.maxlength;return b},metadataRules:function(a){if(!c.metadata)return{};var b=c.data(a.form,"validator").settings.meta;return b?c(a).metadata()[b]:
c(a).metadata()},staticRules:function(a){var b={},d=c.data(a.form,"validator");if(d.settings.rules)b=c.validator.normalizeRule(d.settings.rules[a.name])||{};return b},normalizeRules:function(a,b){c.each(a,function(d,e){if(e===false)delete a[d];else if(e.param||e.depends){var f=true;switch(typeof e.depends){case "string":f=!!c(e.depends,b.form).length;break;case "function":f=e.depends.call(b,b)}if(f)a[d]=e.param!==undefined?e.param:true;else delete a[d]}});c.each(a,function(d,e){a[d]=c.isFunction(e)?
e(b):e});c.each(["minlength","maxlength","min","max"],function(){if(a[this])a[this]=Number(a[this])});c.each(["rangelength","range"],function(){if(a[this])a[this]=[Number(a[this][0]),Number(a[this][1])]});if(c.validator.autoCreateRanges){if(a.min&&a.max){a.range=[a.min,a.max];delete a.min;delete a.max}if(a.minlength&&a.maxlength){a.rangelength=[a.minlength,a.maxlength];delete a.minlength;delete a.maxlength}}a.messages&&delete a.messages;return a},normalizeRule:function(a){if(typeof a=="string"){var b=
{};c.each(a.split(/\s/),function(){b[this]=true});a=b}return a},addMethod:function(a,b,d){c.validator.methods[a]=b;c.validator.messages[a]=d!=undefined?d:c.validator.messages[a];b.length<3&&c.validator.addClassRules(a,c.validator.normalizeRule(a))},methods:{required:function(a,b,d){if(!this.depend(d,b))return"dependency-mismatch";switch(b.nodeName.toLowerCase()){case "select":return(a=c(b).val())&&a.length>0;case "input":if(this.checkable(b))return this.getLength(a,b)>0;default:return c.trim(a).length>
0}},remote:function(a,b,d){if(this.optional(b))return"dependency-mismatch";var e=this.previousValue(b);this.settings.messages[b.name]||(this.settings.messages[b.name]={});e.originalMessage=this.settings.messages[b.name].remote;this.settings.messages[b.name].remote=e.message;d=typeof d=="string"&&{url:d}||d;if(this.pending[b.name])return"pending";if(e.old===a)return e.valid;e.old=a;var f=this;this.startRequest(b);var g={};g[b.name]=a;c.ajax(c.extend(true,{url:d,mode:"abort",port:"validate"+b.name,
dataType:"json",data:g,success:function(h){f.settings.messages[b.name].remote=e.originalMessage;var j=h===true;if(j){var i=f.formSubmitted;f.prepareElement(b);f.formSubmitted=i;f.successList.push(b);f.showErrors()}else{i={};h=h||f.defaultMessage(b,"remote");i[b.name]=e.message=c.isFunction(h)?h(a):h;f.showErrors(i)}e.valid=j;f.stopRequest(b,j)}},d));return"pending"},minlength:function(a,b,d){return this.optional(b)||this.getLength(c.trim(a),b)>=d},maxlength:function(a,b,d){return this.optional(b)||
this.getLength(c.trim(a),b)<=d},rangelength:function(a,b,d){a=this.getLength(c.trim(a),b);return this.optional(b)||a>=d[0]&&a<=d[1]},min:function(a,b,d){return this.optional(b)||a>=d},max:function(a,b,d){return this.optional(b)||a<=d},range:function(a,b,d){return this.optional(b)||a>=d[0]&&a<=d[1]},email:function(a,b){return this.optional(b)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(a)},
url:function(a,b){return this.optional(b)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},
date:function(a,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(a))},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(a)},number:function(a,b){return this.optional(b)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},creditcard:function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9-]+/.test(a))return false;var d=0,e=0,f=false;a=a.replace(/\D/g,"");for(var g=a.length-1;g>=
0;g--){e=a.charAt(g);e=parseInt(e,10);if(f)if((e*=2)>9)e-=9;d+=e;f=!f}return d%10==0},accept:function(a,b,d){d=typeof d=="string"?d.replace(/,/g,"|"):"png|jpe?g|gif";return this.optional(b)||a.match(RegExp(".("+d+")$","i"))},equalTo:function(a,b,d){d=c(d).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){c(b).valid()});return a==d.val()}}});c.format=c.validator.format})(jQuery);
(function(c){var a={};if(c.ajaxPrefilter)c.ajaxPrefilter(function(d,e,f){e=d.port;if(d.mode=="abort"){a[e]&&a[e].abort();a[e]=f}});else{var b=c.ajax;c.ajax=function(d){var e=("port"in d?d:c.ajaxSettings).port;if(("mode"in d?d:c.ajaxSettings).mode=="abort"){a[e]&&a[e].abort();return a[e]=b.apply(this,arguments)}return b.apply(this,arguments)}}})(jQuery);
(function(c){!jQuery.event.special.focusin&&!jQuery.event.special.focusout&&document.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.handle.call(this,e)}c.event.special[b]={setup:function(){this.addEventListener(a,d,true)},teardown:function(){this.removeEventListener(a,d,true)},handler:function(e){arguments[0]=c.event.fix(e);arguments[0].type=b;return c.event.handle.apply(this,arguments)}}});c.extend(c.fn,{validateDelegate:function(a,
b,d){return this.bind(b,function(e){var f=c(e.target);if(f.is(a))return d.apply(f,arguments)})}})})(jQuery);


(function(a){a.fn.extend({autocomplete:function(b,c){var d=typeof b=="string";c=a.extend({},a.Autocompleter.defaults,{url:d?b:null,data:d?null:b,delay:d?a.Autocompleter.defaults.delay:10,max:c&&!c.scroll?10:150},c);c.highlight=c.highlight||function(e){return e};c.formatMatch=c.formatMatch||c.formatItem;return this.each(function(){new a.Autocompleter(this,c)})},result:function(b){return this.bind("result",b)},search:function(b){return this.trigger("search",[b])},flushCache:function(){return this.trigger("flushCache")},setOptions:function(b){return this.trigger("setOptions",[b])},unautocomplete:function(){return this.trigger("unautocomplete")}});a.Autocompleter=function(l,g){var c={UP:38,RIGHT:39,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34,BACKSPACE:8};var b=a(l).attr("autocomplete","off").addClass(g.inputClass);var j;var p="";var m=a.Autocompleter.Cache(g);var e=0;var u;var x={mouseDownOnSelect:true};var r=a.Autocompleter.Select(g,l,d,x);var w;a.browser.opera&&a(l.form).bind("submit.autocomplete",function(){if(w){w=false;return false}});b.bind((a.browser.opera?"keypress":"keydown")+".autocomplete",function(y){u=y.keyCode;switch(y.keyCode){case c.UP:y.preventDefault();if(r.visible()){r.prev()}else{t(0,true)}break;case c.DOWN:y.preventDefault();if(r.visible()){r.next()}else{t(0,true)}break;case c.PAGEUP:y.preventDefault();if(r.visible()){r.pageUp()}else{t(0,true)}break;case c.PAGEDOWN:y.preventDefault();if(r.visible()){r.pageDown()}else{t(0,true)}break;case g.multiple&&a.trim(g.multipleSeparator)==","&&c.COMMA:case c.TAB:case c.RIGHT:case c.RETURN:if(d()){y.preventDefault();w=true;return false}break;case c.ESC:r.hide();break;default:clearTimeout(j);j=setTimeout(t,g.delay);break}}).focus(function(){e++}).blur(function(){e=0;if(!x.mouseDownOnSelect){s()}}).click(function(){if(e++>1&&!r.visible()){t(0,true)}}).bind("search",function(){var y=(arguments.length>1)?arguments[1]:null;function z(D,C){var A;if(C&&C.length){for(var B=0;B<C.length;B++){if(C[B].result.toLowerCase()==D.toLowerCase()){A=C[B];break}}}if(typeof y=="function"){y(A)}else{b.trigger("result",A&&[A.data,A.value])}}a.each(h(b.val()),function(A,B){f(B,z,z)})}).bind("flushCache",function(){m.flush()}).bind("setOptions",function(){a.extend(g,arguments[1]);if("data" in arguments[1]){m.populate()}}).bind("unautocomplete",function(){r.unbind();b.unbind();a(l.form).unbind(".autocomplete")});function d(){var z=r.selected();if(!z){return false}var y=z.result;p=y;if(g.multiple){var A=h(b.val());if(A.length>1){y=A.slice(0,A.length-1).join(g.multipleSeparator)+g.multipleSeparator+y}y+=g.multipleSeparator}b.val(y);v();b.trigger("result",[z.data,z.value]);return true}function t(A,z){if(u==c.DEL){r.hide();return}var y=b.val();if(!z&&y==p){return}p=y;y=i(y);if(y.length>=g.minChars){b.addClass(g.loadingClass);if(!g.matchCase){y=y.toLowerCase()}f(y,k,v)}else{n();r.hide()}}function h(z){if(!z){return[""]}var A=z.split(g.multipleSeparator);var y=[];a.each(A,function(B,C){if(a.trim(C)){y[B]=a.trim(C)}});return y}function i(y){if(!g.multiple){return y}var z=h(y);return z[z.length-1]}function q(y,z){if(g.autoFill&&(i(b.val()).toLowerCase()==y.toLowerCase())&&u!=c.BACKSPACE){b.val(b.val()+z.substring(i(p).length));a.Autocompleter.Selection(l,p.length,p.length+z.length)}}function s(){clearTimeout(j);j=setTimeout(v,200)}function v(){var y=r.visible();r.hide();clearTimeout(j);n();if(g.mustMatch){b.search(function(z){if(!z){if(g.multiple){var A=h(b.val()).slice(0,-1);b.val(A.join(g.multipleSeparator)+(A.length?g.multipleSeparator:""))}else{b.val("")}}})}if(y){a.Autocompleter.Selection(l,l.value.length,l.value.length)}}function k(z,y){if(y&&y.length&&e){n();r.display(y,z);q(z,y[0].value);r.show()}else{v()}}function f(z,B,y){if(!g.matchCase){z=z.toLowerCase()}var A=m.load(z);if(A&&A.length){B(z,A)}else{if((typeof g.url=="string")&&(g.url.length>0)){var C={timestamp:+new Date()};a.each(g.extraParams,function(D,E){C[D]=typeof E=="function"?E():E});a.ajax({mode:"abort",port:"autocomplete"+l.name,dataType:g.dataType,url:g.url,data:a.extend({q:i(z),limit:g.max},C),success:function(E){var D=g.parse&&g.parse(E)||o(E);m.add(z,D);B(z,D)}})}else{r.emptyList();y(z)}}}function o(B){var y=[];var A=B.split("\n");for(var z=0;z<A.length;z++){var C=a.trim(A[z]);if(C){C=C.split("|");y[y.length]={data:C,value:C[0],result:g.formatResult&&g.formatResult(C,C[0])||C[0]}}}return y}function n(){b.removeClass(g.loadingClass)}};a.Autocompleter.defaults={inputClass:"ac_input",resultsClass:"ac_results",loadingClass:"ac_loading",minChars:1,delay:400,matchCase:false,matchSubset:true,matchContains:false,cacheLength:10,max:100,mustMatch:false,extraParams:{},selectFirst:true,formatItem:function(b){return b[0]},formatMatch:null,autoFill:false,width:0,multiple:false,multipleSeparator:", ",highlight:function(c,b){return c.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+b.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")+")(?![^<>]*>)(?![^&;]+;)","gi"),"<strong>$1</strong>")},scroll:true,scrollHeight:180};a.Autocompleter.Cache=function(c){var f={};var d=0;function h(l,k){if(!c.matchCase){l=l.toLowerCase()}var j=l.indexOf(k);if(j==-1){return false}return j==0||c.matchContains}function g(j,i){if(d>c.cacheLength){b()}if(!f[j]){d++}f[j]=i}function e(){if(!c.data){return false}var k={},j=0;if(!c.url){c.cacheLength=1}k[""]=[];for(var m=0,l=c.data.length;m<l;m++){var p=c.data[m];p=(typeof p=="string")?[p]:p;var o=c.formatMatch(p,m+1,c.data.length);if(o===false){continue}var n=o.charAt(0).toLowerCase();if(!k[n]){k[n]=[]}var q={value:o,data:p,result:c.formatResult&&c.formatResult(p)||o};k[n].push(q);if(j++<c.max){k[""].push(q)}}a.each(k,function(r,s){c.cacheLength++;g(r,s)})}setTimeout(e,25);function b(){f={};d=0}return{flush:b,add:g,populate:e,load:function(n){if(!c.cacheLength||!d){return null}if(!c.url&&c.matchContains){var m=[];for(var j in f){if(j.length>0){var o=f[j];a.each(o,function(p,k){if(h(k.value,n)){m.push(k)}})}}return m}else{if(f[n]){return f[n]}else{if(c.matchSubset){for(var l=n.length-1;l>=c.minChars;l--){var o=f[n.substr(0,l)];if(o){var m=[];a.each(o,function(p,k){if(h(k.value,n)){m[m.length]=k}});return m}}}}}return null}}};a.Autocompleter.Select=function(e,j,l,p){var i={ACTIVE:"ac_over"};var k,f=-1,r,m="",s=true,c,o;function n(){if(!s){return}c=a("<div/>").hide().addClass(e.resultsClass).css("position","absolute").insertAfter(j);o=a("<ul/>").appendTo(c).mouseover(function(t){if(q(t).nodeName&&q(t).nodeName.toUpperCase()=="LI"){f=a("li",o).removeClass(i.ACTIVE).index(q(t));a(q(t)).addClass(i.ACTIVE)}clearTimeout(window.fade_tab_on_tab_hover_out);clearTimeout(window.fade_panel_on_tab_hover_out);clearTimeout(window.fade_panel_on_panel_hover_out);a("#panels .panel").stop();a("#panels .panel").css("opacity","1");a("#license").addClass("hovered")}).click(function(t){a(q(t)).addClass(i.ACTIVE);l();j.focus();return false}).mousedown(function(){p.mouseDownOnSelect=true}).mouseup(function(){p.mouseDownOnSelect=false});if(e.width>0){c.css("width",e.width)}s=false}function q(u){var t=u.target;while(t&&t.tagName!="LI"){t=t.parentNode}if(!t){return[]}return t}function h(t){k.slice(f,f+1).removeClass(i.ACTIVE);g(t);var v=k.slice(f,f+1).addClass(i.ACTIVE);if(e.scroll){var u=0;k.slice(0,f).each(function(){u+=this.offsetHeight});if((u+v[0].offsetHeight-o.scrollTop())>o[0].clientHeight){o.scrollTop(u+v[0].offsetHeight-o.innerHeight())}else{if(u<o.scrollTop()){o.scrollTop(u)}}}}function g(t){f+=t;if(f<0){f=k.size()-1}else{if(f>=k.size()){f=0}}}function b(t){return e.max&&e.max<t?e.max:t}function d(){o.empty();var u=b(r.length);for(var v=0;v<u;v++){if(!r[v]){continue}var w=e.formatItem(r[v].data,v+1,u,r[v].value,m);if(w===false){continue}var t=a("<li/>").html(e.highlight(w,m)).addClass(v%2==0?"ac_even":"ac_odd").appendTo(o)[0];a.data(t,"ac_data",r[v])}k=o.find("li");if(e.selectFirst){k.slice(0,1).addClass(i.ACTIVE);f=0}if(a.fn.bgiframe){o.bgiframe()}}return{display:function(u,t){n();r=u;m=t;d();if(u[0].result=="No results"){a("#ajax_content").empty().hide();a("#license_contact_info").show()}else{a("#ajax_content").empty().hide();a("#license_contact_info").hide()}},next:function(){h(1)},prev:function(){h(-1)},pageUp:function(){if(f!=0&&f-8<0){h(-f)}else{h(-8)}},pageDown:function(){if(f!=k.size()-1&&f+8>k.size()){h(k.size()-1-f)}else{h(8)}},hide:function(){c&&c.hide();k&&k.removeClass(i.ACTIVE);f=-1},visible:function(){return c&&c.is(":visible")},current:function(){return this.visible()&&(k.filter("."+i.ACTIVE)[0]||e.selectFirst&&k[0])},show:function(){var v=a(j).offset();c.css({width:typeof e.width=="string"||e.width>0?e.width:a(j).width(),clear:"left",position:"relative"}).show();if(e.scroll){o.scrollTop(0);o.css({maxHeight:e.scrollHeight,overflow:"auto"});if(a.browser.msie&&typeof document.body.style.maxHeight==="undefined"){var t=0;k.each(function(){t+=this.offsetHeight});var u=t>e.scrollHeight;o.css("height",u?e.scrollHeight:t);if(!u){k.width(o.width()-parseInt(k.css("padding-left"))-parseInt(k.css("padding-right")))}}}},selected:function(){var t=k&&k.filter("."+i.ACTIVE).removeClass(i.ACTIVE);return t&&t.length&&a.data(t[0],"ac_data")},emptyList:function(){o&&o.empty()},unbind:function(){c&&c.remove()}}};a.Autocompleter.Selection=function(d,e,c){if(d.createTextRange){var b=d.createTextRange();b.collapse(true);b.moveStart("character",e);b.moveEnd("character",c);b.select()}else{if(d.setSelectionRange){d.setSelectionRange(e,c)}else{if(d.selectionStart){d.selectionStart=e;d.selectionEnd=c}}}d.focus()}})(jQuery);

/*
 * jPlayer Plugin for jQuery JavaScript Library
 * http://www.happyworm.com/jquery/jplayer
 *
 * Copyright (c) 2009 - 2010 Happyworm Ltd
 * Dual licensed under the MIT and GPL licenses.
 *  - http://www.opensource.org/licenses/mit-license.php
 *  - http://www.gnu.org/copyleft/gpl.html
 *
 * Author: Mark J Panaghiston
 * Version: 2.0.0
 * Date: 20th December 2010
 */

(function(c,h){c.fn.jPlayer=function(a){var b=typeof a==="string",d=Array.prototype.slice.call(arguments,1),f=this;a=!b&&d.length?c.extend.apply(null,[true,a].concat(d)):a;if(b&&a.charAt(0)==="_")return f;b?this.each(function(){var e=c.data(this,"jPlayer"),g=e&&c.isFunction(e[a])?e[a].apply(e,d):e;if(g!==e&&g!==h){f=g;return false}}):this.each(function(){var e=c.data(this,"jPlayer");if(e){e.option(a||{})._init();e.option(a||{})}else c.data(this,"jPlayer",new c.jPlayer(a,this))});return f};c.jPlayer=
function(a,b){if(arguments.length){this.element=c(b);this.options=c.extend(true,{},this.options,a);var d=this;this.element.bind("remove.jPlayer",function(){d.destroy()});this._init()}};c.jPlayer.event={ready:"jPlayer_ready",resize:"jPlayer_resize",error:"jPlayer_error",warning:"jPlayer_warning",loadstart:"jPlayer_loadstart",progress:"jPlayer_progress",suspend:"jPlayer_suspend",abort:"jPlayer_abort",emptied:"jPlayer_emptied",stalled:"jPlayer_stalled",play:"jPlayer_play",pause:"jPlayer_pause",loadedmetadata:"jPlayer_loadedmetadata",
loadeddata:"jPlayer_loadeddata",waiting:"jPlayer_waiting",playing:"jPlayer_playing",canplay:"jPlayer_canplay",canplaythrough:"jPlayer_canplaythrough",seeking:"jPlayer_seeking",seeked:"jPlayer_seeked",timeupdate:"jPlayer_timeupdate",ended:"jPlayer_ended",ratechange:"jPlayer_ratechange",durationchange:"jPlayer_durationchange",volumechange:"jPlayer_volumechange"};c.jPlayer.htmlEvent=["loadstart","abort","emptied","stalled","loadedmetadata","loadeddata","canplaythrough","ratechange"];c.jPlayer.pause=
function(){c.each(c.jPlayer.prototype.instances,function(a,b){b.data("jPlayer").status.srcSet&&b.jPlayer("pause")})};c.jPlayer.timeFormat={showHour:false,showMin:true,showSec:true,padHour:false,padMin:true,padSec:true,sepHour:":",sepMin:":",sepSec:""};c.jPlayer.convertTime=function(a){a=new Date(a*1E3);var b=a.getUTCHours(),d=a.getUTCMinutes();a=a.getUTCSeconds();b=c.jPlayer.timeFormat.padHour&&b<10?"0"+b:b;d=c.jPlayer.timeFormat.padMin&&d<10?"0"+d:d;a=c.jPlayer.timeFormat.padSec&&a<10?"0"+a:a;return(c.jPlayer.timeFormat.showHour?
b+c.jPlayer.timeFormat.sepHour:"")+(c.jPlayer.timeFormat.showMin?d+c.jPlayer.timeFormat.sepMin:"")+(c.jPlayer.timeFormat.showSec?a+c.jPlayer.timeFormat.sepSec:"")};c.jPlayer.uaMatch=function(a){a=a.toLowerCase();var b=/(opera)(?:.*version)?[ \/]([\w.]+)/,d=/(msie) ([\w.]+)/,f=/(mozilla)(?:.*? rv:([\w.]+))?/;a=/(webkit)[ \/]([\w.]+)/.exec(a)||b.exec(a)||d.exec(a)||a.indexOf("compatible")<0&&f.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}};c.jPlayer.browser={};var m=c.jPlayer.uaMatch(navigator.userAgent);
if(m.browser){c.jPlayer.browser[m.browser]=true;c.jPlayer.browser.version=m.version}c.jPlayer.prototype={count:0,version:{script:"2.0.0",needFlash:"2.0.0",flash:"unknown"},options:{swfPath:"js",solution:"html, flash",supplied:"mp3",preload:"metadata",volume:0.8,muted:false,backgroundColor:"#000000",cssSelectorAncestor:"#jp_interface_1",cssSelector:{videoPlay:".jp-video-play",play:".jp-play",pause:".jp-pause",stop:".jp-stop",seekBar:".jp-seek-bar",playBar:".jp-play-bar",mute:".jp-mute",unmute:".jp-unmute",
volumeBar:".jp-volume-bar",volumeBarValue:".jp-volume-bar-value",currentTime:".jp-current-time",duration:".jp-duration"},idPrefix:"jp",errorAlerts:false,warningAlerts:false},instances:{},status:{src:"",media:{},paused:true,format:{},formatType:"",waitForPlay:true,waitForLoad:true,srcSet:false,video:false,seekPercent:0,currentPercentRelative:0,currentPercentAbsolute:0,currentTime:0,duration:0},_status:{volume:h,muted:false,width:0,height:0},internal:{ready:false,instance:h,htmlDlyCmdId:h},solution:{html:true,
flash:true},format:{mp3:{codec:'audio/mpeg; codecs="mp3"',flashCanPlay:true,media:"audio"},m4a:{codec:'audio/mp4; codecs="mp4a.40.2"',flashCanPlay:true,media:"audio"},oga:{codec:'audio/ogg; codecs="vorbis"',flashCanPlay:false,media:"audio"},wav:{codec:'audio/wav; codecs="1"',flashCanPlay:false,media:"audio"},webma:{codec:'audio/webm; codecs="vorbis"',flashCanPlay:false,media:"audio"},m4v:{codec:'video/mp4; codecs="avc1.42E01E, mp4a.40.2"',flashCanPlay:true,media:"video"},ogv:{codec:'video/ogg; codecs="theora, vorbis"',
flashCanPlay:false,media:"video"},webmv:{codec:'video/webm; codecs="vorbis, vp8"',flashCanPlay:false,media:"video"}},_init:function(){var a=this;this.element.empty();this.status=c.extend({},this.status,this._status);this.internal=c.extend({},this.internal);this.formats=[];this.solutions=[];this.require={};this.htmlElement={};this.html={};this.html.audio={};this.html.video={};this.flash={};this.css={};this.css.cs={};this.css.jq={};this.status.volume=this._limitValue(this.options.volume,0,1);this.status.muted=
this.options.muted;this.status.width=this.element.css("width");this.status.height=this.element.css("height");this.element.css({"background-color":this.options.backgroundColor});c.each(this.options.supplied.toLowerCase().split(","),function(e,g){var i=g.replace(/^\s+|\s+$/g,"");if(a.format[i]){var j=false;c.each(a.formats,function(n,k){if(i===k){j=true;return false}});j||a.formats.push(i)}});c.each(this.options.solution.toLowerCase().split(","),function(e,g){var i=g.replace(/^\s+|\s+$/g,"");if(a.solution[i]){var j=
false;c.each(a.solutions,function(n,k){if(i===k){j=true;return false}});j||a.solutions.push(i)}});this.internal.instance="jp_"+this.count;this.instances[this.internal.instance]=this.element;this.element.attr("id")===""&&this.element.attr("id",this.options.idPrefix+"_jplayer_"+this.count);this.internal.self=c.extend({},{id:this.element.attr("id"),jq:this.element});this.internal.audio=c.extend({},{id:this.options.idPrefix+"_audio_"+this.count,jq:h});this.internal.video=c.extend({},{id:this.options.idPrefix+
"_video_"+this.count,jq:h});this.internal.flash=c.extend({},{id:this.options.idPrefix+"_flash_"+this.count,jq:h,swf:this.options.swfPath+(this.options.swfPath!==""&&this.options.swfPath.slice(-1)!=="/"?"/":"")+"Jplayer.swf"});this.internal.poster=c.extend({},{id:this.options.idPrefix+"_poster_"+this.count,jq:h});c.each(c.jPlayer.event,function(e,g){if(a.options[e]!==h){a.element.bind(g+".jPlayer",a.options[e]);a.options[e]=h}});this.htmlElement.poster=document.createElement("img");this.htmlElement.poster.id=
this.internal.poster.id;this.htmlElement.poster.onload=function(){if(!a.status.video||a.status.waitForPlay)a.internal.poster.jq.show()};this.element.append(this.htmlElement.poster);this.internal.poster.jq=c("#"+this.internal.poster.id);this.internal.poster.jq.css({width:this.status.width,height:this.status.height});this.internal.poster.jq.hide();this.require.audio=false;this.require.video=false;c.each(this.formats,function(e,g){a.require[a.format[g].media]=true});this.html.audio.available=false;if(this.require.audio){this.htmlElement.audio=
document.createElement("audio");this.htmlElement.audio.id=this.internal.audio.id;this.html.audio.available=!!this.htmlElement.audio.canPlayType}this.html.video.available=false;if(this.require.video){this.htmlElement.video=document.createElement("video");this.htmlElement.video.id=this.internal.video.id;this.html.video.available=!!this.htmlElement.video.canPlayType}this.flash.available=this._checkForFlash(10);this.html.canPlay={};this.flash.canPlay={};c.each(this.formats,function(e,g){a.html.canPlay[g]=
a.html[a.format[g].media].available&&""!==a.htmlElement[a.format[g].media].canPlayType(a.format[g].codec);a.flash.canPlay[g]=a.format[g].flashCanPlay&&a.flash.available});this.html.desired=false;this.flash.desired=false;c.each(this.solutions,function(e,g){if(e===0)a[g].desired=true;else{var i=false,j=false;c.each(a.formats,function(n,k){if(a[a.solutions[0]].canPlay[k])if(a.format[k].media==="video")j=true;else i=true});a[g].desired=a.require.audio&&!i||a.require.video&&!j}});this.html.support={};
this.flash.support={};c.each(this.formats,function(e,g){a.html.support[g]=a.html.canPlay[g]&&a.html.desired;a.flash.support[g]=a.flash.canPlay[g]&&a.flash.desired});this.html.used=false;this.flash.used=false;c.each(this.solutions,function(e,g){c.each(a.formats,function(i,j){if(a[g].support[j]){a[g].used=true;return false}})});this.html.used||this.flash.used||this._error({type:c.jPlayer.error.NO_SOLUTION,context:"{solution:'"+this.options.solution+"', supplied:'"+this.options.supplied+"'}",message:c.jPlayer.errorMsg.NO_SOLUTION,
hint:c.jPlayer.errorHint.NO_SOLUTION});this.html.active=false;this.html.audio.gate=false;this.html.video.gate=false;this.flash.active=false;this.flash.gate=false;if(this.flash.used){var b="id="+escape(this.internal.self.id)+"&vol="+this.status.volume+"&muted="+this.status.muted;if(c.browser.msie&&Number(c.browser.version)<=8){var d='<object id="'+this.internal.flash.id+'"';d+=' classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"';d+=' codebase="'+document.URL.substring(0,document.URL.indexOf(":"))+
'://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"';d+=' type="application/x-shockwave-flash"';d+=' width="0" height="0">';d+="</object>";var f=[];f[0]='<param name="movie" value="'+this.internal.flash.swf+'" />';f[1]='<param name="quality" value="high" />';f[2]='<param name="FlashVars" value="'+b+'" />';f[3]='<param name="allowScriptAccess" value="always" />';f[4]='<param name="bgcolor" value="'+this.options.backgroundColor+'" />';b=document.createElement(d);for(d=0;d<f.length;d++)b.appendChild(document.createElement(f[d]));
this.element.append(b)}else{f='<embed name="'+this.internal.flash.id+'" id="'+this.internal.flash.id+'" src="'+this.internal.flash.swf+'"';f+=' width="0" height="0" bgcolor="'+this.options.backgroundColor+'"';f+=' quality="high" FlashVars="'+b+'"';f+=' allowScriptAccess="always"';f+=' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';this.element.append(f)}this.internal.flash.jq=c("#"+this.internal.flash.id);this.internal.flash.jq.css({width:"0px",
height:"0px"})}if(this.html.used){if(this.html.audio.available){this._addHtmlEventListeners(this.htmlElement.audio,this.html.audio);this.element.append(this.htmlElement.audio);this.internal.audio.jq=c("#"+this.internal.audio.id)}if(this.html.video.available){this._addHtmlEventListeners(this.htmlElement.video,this.html.video);this.element.append(this.htmlElement.video);this.internal.video.jq=c("#"+this.internal.video.id);this.internal.video.jq.css({width:"0px",height:"0px"})}}this.html.used&&!this.flash.used&&
window.setTimeout(function(){a.internal.ready=true;a.version.flash="n/a";a._trigger(c.jPlayer.event.ready)},100);c.each(this.options.cssSelector,function(e,g){a._cssSelector(e,g)});this._updateInterface();this._updateButtons(false);this._updateVolume(this.status.volume);this._updateMute(this.status.muted);this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide();c.jPlayer.prototype.count++},destroy:function(){this._resetStatus();this._updateInterface();this._seeked();this.css.jq.currentTime.length&&
this.css.jq.currentTime.text("");this.css.jq.duration.length&&this.css.jq.duration.text("");this.status.srcSet&&this.pause();c.each(this.css.jq,function(a,b){b.unbind(".jPlayer")});this.element.removeData("jPlayer");this.element.unbind(".jPlayer");this.element.empty();this.instances[this.internal.instance]=h},enable:function(){},disable:function(){},_addHtmlEventListeners:function(a,b){var d=this;a.preload=this.options.preload;a.muted=this.options.muted;a.addEventListener("progress",function(){if(b.gate&&
!d.status.waitForLoad){d._getHtmlStatus(a);d._updateInterface();d._trigger(c.jPlayer.event.progress)}},false);a.addEventListener("timeupdate",function(){if(b.gate&&!d.status.waitForLoad){d._getHtmlStatus(a);d._updateInterface();d._trigger(c.jPlayer.event.timeupdate)}},false);a.addEventListener("durationchange",function(){if(b.gate&&!d.status.waitForLoad){d.status.duration=this.duration;d._getHtmlStatus(a);d._updateInterface();d._trigger(c.jPlayer.event.durationchange)}},false);a.addEventListener("play",
function(){if(b.gate&&!d.status.waitForLoad){d._updateButtons(true);d._trigger(c.jPlayer.event.play)}},false);a.addEventListener("playing",function(){if(b.gate&&!d.status.waitForLoad){d._updateButtons(true);d._seeked();d._trigger(c.jPlayer.event.playing)}},false);a.addEventListener("pause",function(){if(b.gate&&!d.status.waitForLoad){d._updateButtons(false);d._trigger(c.jPlayer.event.pause)}},false);a.addEventListener("waiting",function(){if(b.gate&&!d.status.waitForLoad){d._seeking();d._trigger(c.jPlayer.event.waiting)}},
false);a.addEventListener("canplay",function(){if(b.gate&&!d.status.waitForLoad){a.volume=d._volumeFix(d.status.volume);d._trigger(c.jPlayer.event.canplay)}},false);a.addEventListener("seeking",function(){if(b.gate&&!d.status.waitForLoad){d._seeking();d._trigger(c.jPlayer.event.seeking)}},false);a.addEventListener("seeked",function(){if(b.gate&&!d.status.waitForLoad){d._seeked();d._trigger(c.jPlayer.event.seeked)}},false);a.addEventListener("suspend",function(){if(b.gate&&!d.status.waitForLoad){d._seeked();
d._trigger(c.jPlayer.event.suspend)}},false);a.addEventListener("ended",function(){if(b.gate&&!d.status.waitForLoad){if(!c.jPlayer.browser.webkit)d.htmlElement.media.currentTime=0;d.htmlElement.media.pause();d._updateButtons(false);d._getHtmlStatus(a,true);d._updateInterface();d._trigger(c.jPlayer.event.ended)}},false);a.addEventListener("error",function(){if(b.gate&&!d.status.waitForLoad){d._updateButtons(false);d._seeked();if(d.status.srcSet){d.status.waitForLoad=true;d.status.waitForPlay=true;
d.status.video&&d.internal.video.jq.css({width:"0px",height:"0px"});d._validString(d.status.media.poster)&&d.internal.poster.jq.show();d.css.jq.videoPlay.length&&d.css.jq.videoPlay.show();d._error({type:c.jPlayer.error.URL,context:d.status.src,message:c.jPlayer.errorMsg.URL,hint:c.jPlayer.errorHint.URL})}}},false);c.each(c.jPlayer.htmlEvent,function(f,e){a.addEventListener(this,function(){b.gate&&!d.status.waitForLoad&&d._trigger(c.jPlayer.event[e])},false)})},_getHtmlStatus:function(a,b){var d=0,
f=0,e=0,g=0;d=a.currentTime;f=this.status.duration>0?100*d/this.status.duration:0;if(typeof a.seekable==="object"&&a.seekable.length>0){e=this.status.duration>0?100*a.seekable.end(a.seekable.length-1)/this.status.duration:100;g=100*a.currentTime/a.seekable.end(a.seekable.length-1)}else{e=100;g=f}if(b)f=g=d=0;this.status.seekPercent=e;this.status.currentPercentRelative=g;this.status.currentPercentAbsolute=f;this.status.currentTime=d},_resetStatus:function(){this.status=c.extend({},this.status,c.jPlayer.prototype.status)},
_trigger:function(a,b,d){a=c.Event(a);a.jPlayer={};a.jPlayer.version=c.extend({},this.version);a.jPlayer.status=c.extend(true,{},this.status);a.jPlayer.html=c.extend(true,{},this.html);a.jPlayer.flash=c.extend(true,{},this.flash);if(b)a.jPlayer.error=c.extend({},b);if(d)a.jPlayer.warning=c.extend({},d);this.element.trigger(a)},jPlayerFlashEvent:function(a,b){if(a===c.jPlayer.event.ready&&!this.internal.ready){this.internal.ready=true;this.version.flash=b.version;this.version.needFlash!==this.version.flash&&
this._error({type:c.jPlayer.error.VERSION,context:this.version.flash,message:c.jPlayer.errorMsg.VERSION+this.version.flash,hint:c.jPlayer.errorHint.VERSION});this._trigger(a)}if(this.flash.gate)switch(a){case c.jPlayer.event.progress:this._getFlashStatus(b);this._updateInterface();this._trigger(a);break;case c.jPlayer.event.timeupdate:this._getFlashStatus(b);this._updateInterface();this._trigger(a);break;case c.jPlayer.event.play:this._seeked();this._updateButtons(true);this._trigger(a);break;case c.jPlayer.event.pause:this._updateButtons(false);
this._trigger(a);break;case c.jPlayer.event.ended:this._updateButtons(false);this._trigger(a);break;case c.jPlayer.event.error:this.status.waitForLoad=true;this.status.waitForPlay=true;this.status.video&&this.internal.flash.jq.css({width:"0px",height:"0px"});this._validString(this.status.media.poster)&&this.internal.poster.jq.show();this.css.jq.videoPlay.length&&this.css.jq.videoPlay.show();this.status.video?this._flash_setVideo(this.status.media):this._flash_setAudio(this.status.media);this._error({type:c.jPlayer.error.URL,
context:b.src,message:c.jPlayer.errorMsg.URL,hint:c.jPlayer.errorHint.URL});break;case c.jPlayer.event.seeking:this._seeking();this._trigger(a);break;case c.jPlayer.event.seeked:this._seeked();this._trigger(a);break;default:this._trigger(a)}return false},_getFlashStatus:function(a){this.status.seekPercent=a.seekPercent;this.status.currentPercentRelative=a.currentPercentRelative;this.status.currentPercentAbsolute=a.currentPercentAbsolute;this.status.currentTime=a.currentTime;this.status.duration=a.duration},
_updateButtons:function(a){this.status.paused=!a;if(this.css.jq.play.length&&this.css.jq.pause.length)if(a){this.css.jq.play.hide();this.css.jq.pause.show()}else{this.css.jq.play.show();this.css.jq.pause.hide()}},_updateInterface:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.width(this.status.seekPercent+"%");this.css.jq.playBar.length&&this.css.jq.playBar.width(this.status.currentPercentRelative+"%");this.css.jq.currentTime.length&&this.css.jq.currentTime.text(c.jPlayer.convertTime(this.status.currentTime));
this.css.jq.duration.length&&this.css.jq.duration.text(c.jPlayer.convertTime(this.status.duration))},_seeking:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.addClass("jp-seeking-bg")},_seeked:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.removeClass("jp-seeking-bg")},setMedia:function(a){var b=this;this._seeked();clearTimeout(this.internal.htmlDlyCmdId);var d=this.html.audio.gate,f=this.html.video.gate,e=false;c.each(this.formats,function(g,i){var j=b.format[i].media==="video";
c.each(b.solutions,function(n,k){if(b[k].support[i]&&b._validString(a[i])){var l=k==="html";if(j)if(l){b.html.audio.gate=false;b.html.video.gate=true;b.flash.gate=false}else{b.html.audio.gate=false;b.html.video.gate=false;b.flash.gate=true}else if(l){b.html.audio.gate=true;b.html.video.gate=false;b.flash.gate=false}else{b.html.audio.gate=false;b.html.video.gate=false;b.flash.gate=true}if(b.flash.active||b.html.active&&b.flash.gate||d===b.html.audio.gate&&f===b.html.video.gate)b.clearMedia();else if(d!==
b.html.audio.gate&&f!==b.html.video.gate){b._html_pause();b.status.video&&b.internal.video.jq.css({width:"0px",height:"0px"});b._resetStatus()}if(j){if(l){b._html_setVideo(a);b.html.active=true;b.flash.active=false}else{b._flash_setVideo(a);b.html.active=false;b.flash.active=true}b.css.jq.videoPlay.length&&b.css.jq.videoPlay.show();b.status.video=true}else{if(l){b._html_setAudio(a);b.html.active=true;b.flash.active=false}else{b._flash_setAudio(a);b.html.active=false;b.flash.active=true}b.css.jq.videoPlay.length&&
b.css.jq.videoPlay.hide();b.status.video=false}e=true;return false}});if(e)return false});if(e){if(this._validString(a.poster))if(this.htmlElement.poster.src!==a.poster)this.htmlElement.poster.src=a.poster;else this.internal.poster.jq.show();else this.internal.poster.jq.hide();this.status.srcSet=true;this.status.media=c.extend({},a);this._updateButtons(false);this._updateInterface()}else{this.status.srcSet&&!this.status.waitForPlay&&this.pause();this.html.audio.gate=false;this.html.video.gate=false;
this.flash.gate=false;this.html.active=false;this.flash.active=false;this._resetStatus();this._updateInterface();this._updateButtons(false);this.internal.poster.jq.hide();this.html.used&&this.require.video&&this.internal.video.jq.css({width:"0px",height:"0px"});this.flash.used&&this.internal.flash.jq.css({width:"0px",height:"0px"});this._error({type:c.jPlayer.error.NO_SUPPORT,context:"{supplied:'"+this.options.supplied+"'}",message:c.jPlayer.errorMsg.NO_SUPPORT,hint:c.jPlayer.errorHint.NO_SUPPORT})}},
clearMedia:function(){this._resetStatus();this._updateButtons(false);this.internal.poster.jq.hide();clearTimeout(this.internal.htmlDlyCmdId);if(this.html.active)this._html_clearMedia();else this.flash.active&&this._flash_clearMedia()},load:function(){if(this.status.srcSet)if(this.html.active)this._html_load();else this.flash.active&&this._flash_load();else this._urlNotSetError("load")},play:function(a){a=typeof a==="number"?a:NaN;if(this.status.srcSet)if(this.html.active)this._html_play(a);else this.flash.active&&
this._flash_play(a);else this._urlNotSetError("play")},videoPlay:function(){this.play()},pause:function(a){a=typeof a==="number"?a:NaN;if(this.status.srcSet)if(this.html.active)this._html_pause(a);else this.flash.active&&this._flash_pause(a);else this._urlNotSetError("pause")},pauseOthers:function(){var a=this;c.each(this.instances,function(b,d){a.element!==d&&d.data("jPlayer").status.srcSet&&d.jPlayer("pause")})},stop:function(){if(this.status.srcSet)if(this.html.active)this._html_pause(0);else this.flash.active&&
this._flash_pause(0);else this._urlNotSetError("stop")},playHead:function(a){a=this._limitValue(a,0,100);if(this.status.srcSet)if(this.html.active)this._html_playHead(a);else this.flash.active&&this._flash_playHead(a);else this._urlNotSetError("playHead")},mute:function(){this.status.muted=true;this.html.used&&this._html_mute(true);this.flash.used&&this._flash_mute(true);this._updateMute(true);this._updateVolume(0);this._trigger(c.jPlayer.event.volumechange)},unmute:function(){this.status.muted=false;
this.html.used&&this._html_mute(false);this.flash.used&&this._flash_mute(false);this._updateMute(false);this._updateVolume(this.status.volume);this._trigger(c.jPlayer.event.volumechange)},_updateMute:function(a){if(this.css.jq.mute.length&&this.css.jq.unmute.length)if(a){this.css.jq.mute.hide();this.css.jq.unmute.show()}else{this.css.jq.mute.show();this.css.jq.unmute.hide()}},volume:function(a){a=this._limitValue(a,0,1);this.status.volume=a;this.html.used&&this._html_volume(a);this.flash.used&&this._flash_volume(a);
this.status.muted||this._updateVolume(a);this._trigger(c.jPlayer.event.volumechange)},volumeBar:function(a){if(!this.status.muted&&this.css.jq.volumeBar){var b=this.css.jq.volumeBar.offset();a=a.pageX-b.left;b=this.css.jq.volumeBar.width();this.volume(a/b)}},volumeBarValue:function(a){this.volumeBar(a)},_updateVolume:function(a){this.css.jq.volumeBarValue.length&&this.css.jq.volumeBarValue.width(a*100+"%")},_volumeFix:function(a){var b=0.0010*Math.random();return a+(a<0.5?b:-b)},_cssSelectorAncestor:function(a,
b){this.options.cssSelectorAncestor=a;b&&c.each(this.options.cssSelector,function(d,f){self._cssSelector(d,f)})},_cssSelector:function(a,b){var d=this;if(typeof b==="string")if(c.jPlayer.prototype.options.cssSelector[a]){this.css.jq[a]&&this.css.jq[a].length&&this.css.jq[a].unbind(".jPlayer");this.options.cssSelector[a]=b;this.css.cs[a]=this.options.cssSelectorAncestor+" "+b;this.css.jq[a]=b?c(this.css.cs[a]):[];this.css.jq[a].length&&this.css.jq[a].bind("click.jPlayer",function(f){d[a](f);c(this).blur();
return false});b&&this.css.jq[a].length!==1&&this._warning({type:c.jPlayer.warning.CSS_SELECTOR_COUNT,context:this.css.cs[a],message:c.jPlayer.warningMsg.CSS_SELECTOR_COUNT+this.css.jq[a].length+" found for "+a+" method.",hint:c.jPlayer.warningHint.CSS_SELECTOR_COUNT})}else this._warning({type:c.jPlayer.warning.CSS_SELECTOR_METHOD,context:a,message:c.jPlayer.warningMsg.CSS_SELECTOR_METHOD,hint:c.jPlayer.warningHint.CSS_SELECTOR_METHOD});else this._warning({type:c.jPlayer.warning.CSS_SELECTOR_STRING,
context:b,message:c.jPlayer.warningMsg.CSS_SELECTOR_STRING,hint:c.jPlayer.warningHint.CSS_SELECTOR_STRING})},seekBar:function(a){if(this.css.jq.seekBar){var b=this.css.jq.seekBar.offset();a=a.pageX-b.left;b=this.css.jq.seekBar.width();this.playHead(100*a/b)}},playBar:function(a){this.seekBar(a)},currentTime:function(){},duration:function(){},option:function(a,b){var d=a;if(arguments.length===0)return c.extend(true,{},this.options);if(typeof a==="string"){var f=a.split(".");if(b===h){for(var e=c.extend(true,
{},this.options),g=0;g<f.length;g++)if(e[f[g]]!==h)e=e[f[g]];else{this._warning({type:c.jPlayer.warning.OPTION_KEY,context:a,message:c.jPlayer.warningMsg.OPTION_KEY,hint:c.jPlayer.warningHint.OPTION_KEY});return h}return e}e=d={};for(g=0;g<f.length;g++)if(g<f.length-1){e[f[g]]={};e=e[f[g]]}else e[f[g]]=b}this._setOptions(d);return this},_setOptions:function(a){var b=this;c.each(a,function(d,f){b._setOption(d,f)});return this},_setOption:function(a,b){var d=this;switch(a){case "cssSelectorAncestor":this.options[a]=
b;c.each(d.options.cssSelector,function(f,e){d._cssSelector(f,e)});break;case "cssSelector":c.each(b,function(f,e){d._cssSelector(f,e)})}return this},resize:function(a){this.html.active&&this._resizeHtml(a);this.flash.active&&this._resizeFlash(a);this._trigger(c.jPlayer.event.resize)},_resizePoster:function(){},_resizeHtml:function(){},_resizeFlash:function(a){this.internal.flash.jq.css({width:a.width,height:a.height})},_html_initMedia:function(){this.status.srcSet&&!this.status.waitForPlay&&this.htmlElement.media.pause();
this.options.preload!=="none"&&this._html_load();this._trigger(c.jPlayer.event.timeupdate)},_html_setAudio:function(a){var b=this;c.each(this.formats,function(d,f){if(b.html.support[f]&&a[f]){b.status.src=a[f];b.status.format[f]=true;b.status.formatType=f;return false}});this.htmlElement.media=this.htmlElement.audio;this._html_initMedia()},_html_setVideo:function(a){var b=this;c.each(this.formats,function(d,f){if(b.html.support[f]&&a[f]){b.status.src=a[f];b.status.format[f]=true;b.status.formatType=
f;return false}});this.htmlElement.media=this.htmlElement.video;this._html_initMedia()},_html_clearMedia:function(){if(this.htmlElement.media){this.htmlElement.media.id===this.internal.video.id&&this.internal.video.jq.css({width:"0px",height:"0px"});this.htmlElement.media.pause();this.htmlElement.media.src="";c.browser.msie&&Number(c.browser.version)>=9||this.htmlElement.media.load()}},_html_load:function(){if(this.status.waitForLoad){this.status.waitForLoad=false;this.htmlElement.media.src=this.status.src;
try{this.htmlElement.media.load()}catch(a){}}clearTimeout(this.internal.htmlDlyCmdId)},_html_play:function(a){var b=this;this._html_load();this.htmlElement.media.play();if(!isNaN(a))try{this.htmlElement.media.currentTime=a}catch(d){this.internal.htmlDlyCmdId=setTimeout(function(){b.play(a)},100);return}this._html_checkWaitForPlay()},_html_pause:function(a){var b=this;a>0?this._html_load():clearTimeout(this.internal.htmlDlyCmdId);this.htmlElement.media.pause();if(!isNaN(a))try{this.htmlElement.media.currentTime=
a}catch(d){this.internal.htmlDlyCmdId=setTimeout(function(){b.pause(a)},100);return}a>0&&this._html_checkWaitForPlay()},_html_playHead:function(a){var b=this;this._html_load();try{if(typeof this.htmlElement.media.seekable==="object"&&this.htmlElement.media.seekable.length>0)this.htmlElement.media.currentTime=a*this.htmlElement.media.seekable.end(this.htmlElement.media.seekable.length-1)/100;else if(this.htmlElement.media.duration>0&&!isNaN(this.htmlElement.media.duration))this.htmlElement.media.currentTime=
a*this.htmlElement.media.duration/100;else throw"e";}catch(d){this.internal.htmlDlyCmdId=setTimeout(function(){b.playHead(a)},100);return}this.status.waitForLoad||this._html_checkWaitForPlay()},_html_checkWaitForPlay:function(){if(this.status.waitForPlay){this.status.waitForPlay=false;this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide();if(this.status.video){this.internal.poster.jq.hide();this.internal.video.jq.css({width:this.status.width,height:this.status.height})}}},_html_volume:function(a){if(this.html.audio.available)this.htmlElement.audio.volume=
a;if(this.html.video.available)this.htmlElement.video.volume=a},_html_mute:function(a){if(this.html.audio.available)this.htmlElement.audio.muted=a;if(this.html.video.available)this.htmlElement.video.muted=a},_flash_setAudio:function(a){var b=this;try{c.each(this.formats,function(f,e){if(b.flash.support[e]&&a[e]){switch(e){case "m4a":b._getMovie().fl_setAudio_m4a(a[e]);break;case "mp3":b._getMovie().fl_setAudio_mp3(a[e])}b.status.src=a[e];b.status.format[e]=true;b.status.formatType=e;return false}});
if(this.options.preload==="auto"){this._flash_load();this.status.waitForLoad=false}}catch(d){this._flashError(d)}},_flash_setVideo:function(a){var b=this;try{c.each(this.formats,function(f,e){if(b.flash.support[e]&&a[e]){switch(e){case "m4v":b._getMovie().fl_setVideo_m4v(a[e])}b.status.src=a[e];b.status.format[e]=true;b.status.formatType=e;return false}});if(this.options.preload==="auto"){this._flash_load();this.status.waitForLoad=false}}catch(d){this._flashError(d)}},_flash_clearMedia:function(){this.internal.flash.jq.css({width:"0px",
height:"0px"});try{this._getMovie().fl_clearMedia()}catch(a){this._flashError(a)}},_flash_load:function(){try{this._getMovie().fl_load()}catch(a){this._flashError(a)}this.status.waitForLoad=false},_flash_play:function(a){try{this._getMovie().fl_play(a)}catch(b){this._flashError(b)}this.status.waitForLoad=false;this._flash_checkWaitForPlay()},_flash_pause:function(a){try{this._getMovie().fl_pause(a)}catch(b){this._flashError(b)}if(a>0){this.status.waitForLoad=false;this._flash_checkWaitForPlay()}},
_flash_playHead:function(a){try{this._getMovie().fl_play_head(a)}catch(b){this._flashError(b)}this.status.waitForLoad||this._flash_checkWaitForPlay()},_flash_checkWaitForPlay:function(){if(this.status.waitForPlay){this.status.waitForPlay=false;this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide();if(this.status.video){this.internal.poster.jq.hide();this.internal.flash.jq.css({width:this.status.width,height:this.status.height})}}},_flash_volume:function(a){try{this._getMovie().fl_volume(a)}catch(b){this._flashError(b)}},
_flash_mute:function(a){try{this._getMovie().fl_mute(a)}catch(b){this._flashError(b)}},_getMovie:function(){return document[this.internal.flash.id]},_checkForFlash:function(a){var b=false,d;if(window.ActiveXObject)try{new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+a);b=true}catch(f){}else if(navigator.plugins&&navigator.mimeTypes.length>0)if(d=navigator.plugins["Shockwave Flash"])if(navigator.plugins["Shockwave Flash"].description.replace(/.*\s(\d+\.\d+).*/,"$1")>=a)b=true;return c.browser.msie&&
Number(c.browser.version)>=9?false:b},_validString:function(a){return a&&typeof a==="string"},_limitValue:function(a,b,d){return a<b?b:a>d?d:a},_urlNotSetError:function(a){this._error({type:c.jPlayer.error.URL_NOT_SET,context:a,message:c.jPlayer.errorMsg.URL_NOT_SET,hint:c.jPlayer.errorHint.URL_NOT_SET})},_flashError:function(a){this._error({type:c.jPlayer.error.FLASH,context:this.internal.flash.swf,message:c.jPlayer.errorMsg.FLASH+a.message,hint:c.jPlayer.errorHint.FLASH})},_error:function(a){this._trigger(c.jPlayer.event.error,
a);if(this.options.errorAlerts)this._alert("Error!"+(a.message?"\n\n"+a.message:"")+(a.hint?"\n\n"+a.hint:"")+"\n\nContext: "+a.context)},_warning:function(a){this._trigger(c.jPlayer.event.warning,h,a);if(this.options.errorAlerts)this._alert("Warning!"+(a.message?"\n\n"+a.message:"")+(a.hint?"\n\n"+a.hint:"")+"\n\nContext: "+a.context)},_alert:function(a){alert("jPlayer "+this.version.script+" : id='"+this.internal.self.id+"' : "+a)}};c.jPlayer.error={FLASH:"e_flash",NO_SOLUTION:"e_no_solution",NO_SUPPORT:"e_no_support",
URL:"e_url",URL_NOT_SET:"e_url_not_set",VERSION:"e_version"};c.jPlayer.errorMsg={FLASH:"jPlayer's Flash fallback is not configured correctly, or a command was issued before the jPlayer Ready event. Details: ",NO_SOLUTION:"No solution can be found by jPlayer in this browser. Neither HTML nor Flash can be used.",NO_SUPPORT:"It is not possible to play any media format provided in setMedia() on this browser using your current options.",URL:"Media URL could not be loaded.",URL_NOT_SET:"Attempt to issue media playback commands, while no media url is set.",
VERSION:"jPlayer "+c.jPlayer.prototype.version.script+" needs Jplayer.swf version "+c.jPlayer.prototype.version.needFlash+" but found "};c.jPlayer.errorHint={FLASH:"Check your swfPath option and that Jplayer.swf is there.",NO_SOLUTION:"Review the jPlayer options: support and supplied.",NO_SUPPORT:"Video or audio formats defined in the supplied option are missing.",URL:"Check media URL is valid.",URL_NOT_SET:"Use setMedia() to set the media URL.",VERSION:"Update jPlayer files."};c.jPlayer.warning=
{CSS_SELECTOR_COUNT:"e_css_selector_count",CSS_SELECTOR_METHOD:"e_css_selector_method",CSS_SELECTOR_STRING:"e_css_selector_string",OPTION_KEY:"e_option_key"};c.jPlayer.warningMsg={CSS_SELECTOR_COUNT:"The number of methodCssSelectors found did not equal one: ",CSS_SELECTOR_METHOD:"The methodName given in jPlayer('cssSelector') is not a valid jPlayer method.",CSS_SELECTOR_STRING:"The methodCssSelector given in jPlayer('cssSelector') is not a String or is empty.",OPTION_KEY:"The option requested in jPlayer('option') is undefined."};
c.jPlayer.warningHint={CSS_SELECTOR_COUNT:"Check your css selector and the ancestor.",CSS_SELECTOR_METHOD:"Check your method name.",CSS_SELECTOR_STRING:"Check your css selector is a string.",OPTION_KEY:"Check your option name."}})(jQuery);

var KEY={UP:38,RIGHT:39,DOWN:40,SPACE:32,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34,BACKSPACE:8};var current=0;jQuery(document).ready(function(){function d(f){return f[0]}function b(f){}function c(f){}function e(f){if(!f[1]||f[1]==""){return false}a(f[1],f[0])}function a(g,f){if(g.indexOf("browse")==-1){dcsMultiTrack("DCS.dcsuri","/leadgensearch","WT.ti","BMI.com | LeadGen Search","DCSext.q",f);window.location.href=g+"?q="+php_urlencode(f)}else{jQuery("#ajax_content").fadeOut().load(g.substr(18),function(){jQuery("#ajax_content").fadeIn(function(){jQuery("#ajax_content div.leadgen_content p a:eq(0)").focus().addClass("focused")});current=0;jQuery("#ajax_content div.leadgen_content p a").click(function(i){i.preventDefault();var h=jQuery(this).attr("href");a(h,f)}).bind((jQuery.browser.opera?"keypress":"keydown"),function(i){var h=jQuery("#ajax_content div.leadgen_content p a").length-1;switch(i.keyCode){case KEY.UP:i.preventDefault();jQuery("#ajax_content div.leadgen_content p a:eq("+current+")").removeClass("focused");current=(current==0)?h:current-1;jQuery("#ajax_content div.leadgen_content p a:eq("+current+")").focus().addClass("focused");break;case KEY.DOWN:i.preventDefault();jQuery("#ajax_content div.leadgen_content p a:eq("+current+")").removeClass("focused");current=(current==h)?0:current+1;jQuery("#ajax_content div.leadgen_content p a:eq("+current+")").focus().addClass("focused");break;case KEY.SPACE:case KEY.RIGHT:case KEY.TAB:case KEY.RETURN:i.preventDefault();jQuery(this).click();break;case KEY.ESC:i.preventDefault();jQuery(this).blur();break;default:i.preventDefault();break}}).bind("mouseout",function(h){jQuery(this).blur().removeClass("focused")})})}}jQuery("#licensing-keywords").flushCache();jQuery("#licensing-keywords").autocomplete("/leadgen/test",{formatItem:d,onItemSelect:b,scrollHeight:120}).result(function(g,f){e(f)})});function php_urlencode(a){a=escape(a);return a.replace(/[*+\/@]|%20/g,function(b){switch(b){case"*":b="%2A";break;case"+":b="%2B";break;case"/":b="%2F";break;case"@":b="%40";break;case"$":b="%24";break;case":":b="%3A";break;case";":b="%3B";break;case"&":b="%26";break;case"?":b="%3F";break;case"=":b="%3D";break;case",":b="%2C";break;case"%20":b="+";break}return b})};

/*	SWFObject v2.2 <http://code.google.com/p/swfobject/> 
	is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/
var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();

//** Step Carousel Viewer- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com
//** Script Download/ http://www.dynamicdrive.com/dynamicindex4/stepcarousel.htm
//** Usage Terms: http://www.dynamicdrive.com/notice.htm
//** Current version 1.91 (Aug 15th, 11'): See http://www.dynamicdrive.com/dynamicindex4/stepcarouselchangelog.txt for details

// this file is slightly modified by phr/mokolabs

// in setup:function(config), removed the document.write command.

jQuery.noConflict();var stepcarousel={ajaxloadingmsg:'<div style="margin: 1em; font-weight: bold"><img src="ajaxloadr.gif" style="vertical-align: middle" /> Fetching Content. Please wait...</div>',defaultbuttonsfade:.4,configholder:{},getCSSValue:function(a){return a=="auto"?0:parseInt(a)},getremotepanels:function(a,b){b.$belt.html(this.ajaxloadingmsg);a.ajax({url:b.contenttype[1],async:true,error:function(a){b.$belt.html("Error fetching content.<br />Server Response: "+a.responseText)},success:function(c){b.$belt.html(c);b.$panels=b.$gallery.find("."+b.panelclass);stepcarousel.alignpanels(a,b)}})},getoffset:function(a,b){return a.offsetParent?a[b]+this.getoffset(a.offsetParent,b):a[b]},getCookie:function(a){var b=new RegExp(a+"=[^;]+","i");if(document.cookie.match(b))return document.cookie.match(b)[0].split("=")[1];return null},setCookie:function(a,b){document.cookie=a+"="+b},fadebuttons:function(a,b){a.$leftnavbutton.fadeTo("fast",b==0?this.defaultbuttonsfade:1);a.$rightnavbutton.fadeTo("fast",b==a.lastvisiblepanel?this.defaultbuttonsfade:1);if(b==a.lastvisiblepanel){stepcarousel.stopautostep(a)}},addnavbuttons:function(a,b,c){b.$leftnavbutton=a('<img src="'+b.defaultbuttons.leftnav[0]+'">').css({zIndex:50,position:"absolute",left:b.offsets.left+b.defaultbuttons.leftnav[1]+"px",top:b.offsets.top+b.defaultbuttons.leftnav[2]+"px",cursor:"hand",cursor:"pointer"}).attr({title:"Back "+b.defaultbuttons.moveby+" panels"}).appendTo("body");b.$rightnavbutton=a('<img src="'+b.defaultbuttons.rightnav[0]+'">').css({zIndex:50,position:"absolute",left:b.offsets.left+b.$gallery.get(0).offsetWidth+b.defaultbuttons.rightnav[1]+"px",top:b.offsets.top+b.defaultbuttons.rightnav[2]+"px",cursor:"hand",cursor:"pointer"}).attr({title:"Forward "+b.defaultbuttons.moveby+" panels"}).appendTo("body");b.$leftnavbutton.bind("click",function(){stepcarousel.stepBy(b.galleryid,-b.defaultbuttons.moveby)});b.$rightnavbutton.bind("click",function(){stepcarousel.stepBy(b.galleryid,b.defaultbuttons.moveby)});if(b.panelbehavior.wraparound==false){this.fadebuttons(b,c)}return b.$leftnavbutton.add(b.$rightnavbutton)},alignpanels:function(a,b){var c=0;b.paneloffsets=[c];b.panelwidths=[];b.$panels.each(function(d){var e=a(this);e.css({"float":"none",position:"absolute",left:c+"px"});e.bind("click",function(a){return b.onpanelclick(a.target)});c+=stepcarousel.getCSSValue(e.css("marginRight"))+parseInt(e.get(0).offsetWidth||e.css("width"));b.paneloffsets.push(c);b.panelwidths.push(c-b.paneloffsets[b.paneloffsets.length-2])});b.paneloffsets.pop();var d=0;var e=b.$panels.length-1;b.lastvisiblepanel=e;for(var f=b.$panels.length-1;f>=0;f--){d+=f==e?b.panelwidths[e]:b.paneloffsets[f+1]-b.paneloffsets[f];if(b.gallerywidth>d){b.lastvisiblepanel=f}}b.$belt.css({width:c+"px"});b.currentpanel=b.panelbehavior.persist?parseInt(this.getCookie(b.galleryid+"persist")):0;b.currentpanel=typeof b.currentpanel=="number"&&b.currentpanel<b.$panels.length?b.currentpanel:0;var g=b.paneloffsets[b.currentpanel]+(b.currentpanel==0?0:b.beltoffset);b.$belt.css({left:-g+"px"});if(b.defaultbuttons.enable==true){var h=this.addnavbuttons(a,b,b.currentpanel);a(window).bind("load resize",function(){b.offsets={left:stepcarousel.getoffset(b.$gallery.get(0),"offsetLeft"),top:stepcarousel.getoffset(b.$gallery.get(0),"offsetTop")};b.$leftnavbutton.css({left:b.offsets.left+b.defaultbuttons.leftnav[1]+"px",top:b.offsets.top+b.defaultbuttons.leftnav[2]+"px"});b.$rightnavbutton.css({left:b.offsets.left+b.$gallery.get(0).offsetWidth+b.defaultbuttons.rightnav[1]+"px",top:b.offsets.top+b.defaultbuttons.rightnav[2]+"px"})})}if(b.autostep&&b.autostep.enable){var i=b.$gallery.add(typeof h!="undefined"?h:null);i.bind("click",function(){b.autostep.status="stopped";stepcarousel.stopautostep(b)});i.hover(function(){stepcarousel.stopautostep(b);b.autostep.hoverstate="over"},function(){if(b.steptimer&&b.autostep.hoverstate=="over"&&b.autostep.status!="stopped"){b.steptimer=setInterval(function(){stepcarousel.autorotate(b.galleryid)},b.autostep.pause);b.autostep.hoverstate="out"}});b.steptimer=setInterval(function(){stepcarousel.autorotate(b.galleryid)},b.autostep.pause)}this.createpaginate(a,b);this.statusreport(b.galleryid);b.oninit();b.onslideaction(this)},stepTo:function(a,b){var c=stepcarousel.configholder[a];if(typeof c=="undefined"){return}stepcarousel.stopautostep(c);var b=Math.min(b-1,c.paneloffsets.length-1);var d=c.paneloffsets[b]+(b==0?0:c.beltoffset);if(c.panelbehavior.wraparound==false&&c.defaultbuttons.enable==true){this.fadebuttons(c,b)}c.$belt.animate({left:-d+"px"},c.panelbehavior.speed,function(){c.onslideaction(this)});c.currentpanel=b;this.statusreport(a)},stepBy:function(a,b,c){var d=stepcarousel.configholder[a];if(typeof d=="undefined"){return}if(!c)stepcarousel.stopautostep(d);var e=b>0?"forward":"back";var f=d.currentpanel+b;if(d.panelbehavior.wraparound==false){f=e=="back"&&f<=0?0:e=="forward"?Math.min(f,d.lastvisiblepanel):f;if(d.defaultbuttons.enable==true){stepcarousel.fadebuttons(d,f)}}else{if(f>d.lastvisiblepanel&&e=="forward"){f=d.currentpanel<d.lastvisiblepanel?d.lastvisiblepanel:0}else if(f<0&&e=="back"){f=d.currentpanel>0?0:d.lastvisiblepanel}}var g=d.paneloffsets[f]+(f==0?0:d.beltoffset);if(d.panelbehavior.wraparound==true&&d.panelbehavior.wrapbehavior=="pushpull"&&(f==0&&e=="forward"||d.currentpanel==0&&e=="back")){d.$belt.animate({left:-d.paneloffsets[d.currentpanel]-(e=="forward"?100:-30)+"px"},"normal",function(){d.$belt.animate({left:-g+"px"},d.panelbehavior.speed,function(){d.onslideaction(this)})})}else d.$belt.animate({left:-g+"px"},d.panelbehavior.speed,function(){d.onslideaction(this)});d.currentpanel=f;this.statusreport(a)},autorotate:function(a){var b=stepcarousel.configholder[a];b.$belt.stop(true,true);this.stepBy(a,b.autostep.moveby,true)},stopautostep:function(a){clearTimeout(a.steptimer)},statusreport:function(a){var b=stepcarousel.configholder[a];if(b.statusvars.length==3){var c=b.currentpanel;var d=0;for(var e=c;e<b.paneloffsets.length;e++){d+=b.panelwidths[e];if(d>b.gallerywidth){break}}c+=1;e=e+1==c?c:e;var f=[c,e,b.panelwidths.length];for(var g=0;g<b.statusvars.length;g++){window[b.statusvars[g]]=f[g];b.$statusobjs[g].text(f[g]+" ")}}stepcarousel.selectpaginate(jQuery,a)},createpaginate:function(a,b){if(b.$paginatediv.length==1){var c=b.$paginatediv.find('img["data-over"]:eq(0)');var d=[],e=[],f=[],g=c.attr("data-moveby")||1;var h=(g==1?0:1)+Math.floor((b.lastvisiblepanel+1)/g);var i=a("<div>").append(c.clone()).html();srcs=[c.attr("src"),c.attr("data-over"),c.attr("data-select")];for(var j=0;j<h;j++){var k=Math.min(j*g,b.lastvisiblepanel);f.push(i.replace(/>$/,' data-index="'+j+'" data-moveto="'+k+'" title="Move to Panel '+(k+1)+'">')+"\n");d.push(k)}var l=a("<span></span>").replaceAll(c).append(f.join("")).find("img");l.css({cursor:"pointer"});b.$paginatediv.bind("click",function(c){var d=a(c.target);if(d.is("img")&&d.attr("data-over")){stepcarousel.stepTo(b.galleryid,parseInt(d.attr("data-moveto"))+1)}});b.$paginatediv.bind("mouseover mouseout",function(c){var d=a(c.target);if(d.is("img")&&d.attr("data-over")){if(parseInt(d.attr("data-index"))!=b.pageinfo.curselected)d.attr("src",srcs[c.type=="mouseover"?1:0])}});b.pageinfo={controlpoints:d,$controls:l,srcs:srcs,prevselected:null,curselected:null}}},selectpaginate:function(a,b){var c=stepcarousel.configholder[b];if(c.$paginatediv.length==1){for(var d=0;d<c.pageinfo.controlpoints.length;d++){if(c.pageinfo.controlpoints[d]<=c.currentpanel)c.pageinfo.curselected=d}if(typeof c.pageinfo.prevselected!=null)c.pageinfo.$controls.eq(c.pageinfo.prevselected).attr("src",c.pageinfo.srcs[0]);c.pageinfo.$controls.eq(c.pageinfo.curselected).attr("src",c.pageinfo.srcs[2]);c.pageinfo.prevselected=c.pageinfo.curselected}},loadcontent:function(a,b){var c=stepcarousel.configholder[a];c.contenttype=["ajax",b];stepcarousel.stopautostep(c);stepcarousel.resetsettings($,c);stepcarousel.init(jQuery,c)},init:function(a,b){b.gallerywidth=b.$gallery.width();b.offsets={left:stepcarousel.getoffset(b.$gallery.get(0),"offsetLeft"),top:stepcarousel.getoffset(b.$gallery.get(0),"offsetTop")};b.$belt=b.$gallery.find("."+b.beltclass);b.$panels=b.$gallery.find("."+b.panelclass);b.panelbehavior.wrapbehavior=b.panelbehavior.wrapbehavior||"pushpull";b.$paginatediv=a("#"+b.galleryid+"-paginate");if(b.autostep)b.autostep.pause+=b.panelbehavior.speed;b.onpanelclick=typeof b.onpanelclick=="undefined"?function(a){}:b.onpanelclick;b.onslideaction=typeof b.onslide=="undefined"?function(){}:function(c){a(c).stop();b.onslide()};b.oninit=typeof b.oninit=="undefined"?function(){}:b.oninit;b.beltoffset=stepcarousel.getCSSValue(b.$belt.css("marginLeft"));b.statusvars=b.statusvars||[];b.$statusobjs=[a("#"+b.statusvars[0]),a("#"+b.statusvars[1]),a("#"+b.statusvars[2])];b.currentpanel=0;stepcarousel.configholder[b.galleryid]=b;if(b.contenttype[0]=="ajax"&&typeof b.contenttype[1]!="undefined")stepcarousel.getremotepanels(a,b);else stepcarousel.alignpanels(a,b)},resetsettings:function(a,b){b.$gallery.unbind();b.$belt.stop();b.$panels.remove();if(b.$leftnavbutton){b.$leftnavbutton.remove();b.$rightnavbutton.remove()}if(b.$paginatediv.length==1){b.$paginatediv.unbind();b.pageinfo.$controls.eq(0).attr("src",b.pageinfo.srcs[0]).removeAttr("data-index").removeAttr("data-moveto").removeAttr("title").end().slice(1).remove()}if(b.autostep)b.autostep.status=null;if(b.panelbehavior.persist){stepcarousel.setCookie(window[b.galleryid+"persist"],0)}},setup:function(a){jQuery(document).ready(function(b){a.$gallery=b("#"+a.galleryid);stepcarousel.init(b,a)});jQuery(window).bind("unload",function(){stepcarousel.resetsettings($,a);if(a.panelbehavior.persist)stepcarousel.setCookie(a.galleryid+"persist",a.currentpanel);jQuery.each(a,function(a,b){b=null});a=null})}}


// Switch to no conflict mode
jQuery.noConflict();

// Slidebox function
(function ($) {
  /* Add a function to jQuery to slidebox any elements */
  jQuery.fn.slidebox = function() {
    var slidebox = this;
    var originalPosition = slidebox.css('right');
    var boxAnimations = {
      open: function() {
        slidebox.animate({
          'right': '0px'
        }, 200);
      },
      close: function() {
        slidebox.stop(true).animate({
          'right': originalPosition
        }, 50);
      }
    }

    $(window).scroll(function() {
      var distanceTop = $('#last').offset().top - $(window).height();

      if ($(window).scrollTop() > distanceTop) {
        boxAnimations.open();
      } else {
        boxAnimations.close();
      }
    });
  }

  $(function() { /* onload */
    if (jQuery('#last').length > 0) {
      $('#slidebox').slidebox();
      $('#close').click(function() {
        $('#slidebox').hide();
      });
    }
  });
})(jQuery);

// What is BMI? panel
function what_is_bmi_panel() {

    // Set default cookie    
  var what_is_bmi = jQuery.cookie('what_is_bmi');
  if (what_is_bmi == null) {
    jQuery.cookie('what_is_bmi', 'show', { path: '/', domain: 'bmi.com', expires: 3650 });
    var what_is_bmi = jQuery.cookie('what_is_bmi');
  }
  
  // Show panel if user hasn't closed it
  if (what_is_bmi == 'show') {
    jQuery('.what_is_bmi').css('display','block');
  }
  
  // Hide panel when close box is clicked
  jQuery('.what_is_bmi img').click(function() {
    jQuery('.what_is_bmi').slideUp(400);
    jQuery.cookie('what_is_bmi', 'hide', { path: '/', domain: 'bmi.com', expires: 3650 });
  });
  
}

// Show header panel
function show_header_panel() {

  var fade_tab_on_tab_hover_out;
  var fade_panel_on_tab_hover_out;
  var fade_panel_on_panel_hover_out;

  // Preload header images
  var image1 = jQuery('<img />').attr('src', '/images/app/header_line.gif');
  var image2 = jQuery('<img />').attr('src', '/images/app/header_line_hover.gif');
  var image3 = jQuery('<img />').attr('src', '/images/app/header_panel.png');
  var image4 = jQuery('<img />').attr('src', '/images/app/go.png');
  var image5 = jQuery('<img />').attr('src', '/images/app/button_left.png');
  var image6 = jQuery('<img />').attr('src', '/images/app/button_right.png');

  // TABS
  jQuery("#nav li").hover(
    
    // HOVER OVER
    function () {
      
      // Get active tab/panel
      var active = jQuery(this).attr("id");
      
      // If active panel is fading out, stop fade and reset opacity
      clearTimeout(fade_panel_on_panel_hover_out); 
      jQuery('#panels .panel.' + active).stop();
      jQuery('#panels .panel.' + active).css('opacity', '1');
      
      // Remove highlight from other tabs
      jQuery('#nav li').each(function (i) {
        if (jQuery(this).attr("id") != active) {
          jQuery(this).removeClass('hovered');
        }
      });
            
      // Hide all panels (except the panel for the selected tab)
      jQuery('#panels .panel').each(function (i) {
        if (jQuery(this).attr("class").split(' ')[0] != active) {
          jQuery(this).hide();
        }
      });
      
      // Show active panel
      jQuery('#panels .' + active).show();
    }, 
    
    // HOVER OUT
    function () {
      
      // Get active tab/panel
      var active = jQuery(this).attr("id");
      
      // Remove highlight from tab
      fade_tab_on_tab_hover_out = setTimeout(function() {jQuery('#' + active).removeClass('hovered');}, 50);       
      
      // Fade out panel (if tab or panel isn't selected)
      fade_panel_on_tab_hover_out = setTimeout(function() {jQuery('#panels .panel.' + active).fadeOut(500);}, 50);             
      
    }
  );
  
  // PANELS
  jQuery("#panels .panel").hover(
    
    // HOVER OVER
    function () {
      
      // Get active tab/panel
      var active = jQuery(this).attr("class").split(' ')[0];
            
      // Stop panels from fading (if mousing down from tabs)
      clearTimeout(fade_tab_on_tab_hover_out); 
      clearTimeout(fade_panel_on_tab_hover_out);
      clearTimeout(fade_panel_on_panel_hover_out); 
      
      // If panel is fading out, stop fade and reset opacity
      jQuery('#panels .panel').stop();
      jQuery('#panels .panel').css('opacity', '1');
    
      // Select tab (since we're not hovering over it)
      jQuery("#" + active).addClass('hovered');
            
    }, 
    
    // HOVER OUT
    function () {
      // Get active tab/panel
      var active = jQuery(this).attr("class").split(' ')[0];
            
      // Fade out panel and tab
      fade_panel_on_panel_hover_out = setTimeout(function() {
        
        jQuery("#" + active).removeClass('hovered');
        jQuery('#panels .panel.' + active).fadeOut(250);
        
      }, 500);       
      
    }
  );
  
}

// Show form hints (with inputs using "title" attribute)
function show_form_hints() {
  var el = jQuery('input[Title]');

  // Show display text
  el.each(function(i) {
    jQuery(this).attr('value', jQuery(this).attr('title'));
  });

  // Hook up the blur & focus
  el.focus(function() {
    if (jQuery(this).attr('value') == jQuery(this).attr('title'))
      jQuery(this).attr('value', '');
  }).blur(function() {
    if (jQuery(this).attr('value') == '')
      jQuery(this).attr('value', jQuery(this).attr('title'));
  });
}

// Switches content in tab sets
function switch_tabs() {
  
  jQuery('#flipbox a').hover(
    function() {
    
    // Get a list of tab names
    var tab_names = Array();
    jQuery('#flipbox a').map(function(){
      tab_names.push(jQuery(this).attr("id").replace("tab_",""));
    });

    // Hide all tabs
    for (i = 0; i < tab_names.length; i++) {
      jQuery('#' + tab_names[i]).hide();
      jQuery('#tab_' + tab_names[i]).parent().removeClass('active');
    }
    
    // Show the selected tab
    jQuery(jQuery(this).attr("id").replace("tab_","#")).show();
    jQuery(this).parent().addClass('active');
    
    },
    
    function() {
    }
  );
  
}

// Toggles visibility of sidebar lists
// in News, Events, Benefits, etc.
function toggle_sidebar_lists() {
  
  // Toggle single list
  jQuery('div h6').click(function() {
    jQuery(this).next().toggle();
  });
  
  // Toggle all lists
  jQuery('.toggle').click(function() {
    if (jQuery('.toggle a').text() == 'expand') {
      jQuery('.toggle a').text('collapse');
      jQuery('div h6').next().show();
    } else {
      jQuery('.toggle a').text('expand');
      jQuery('div h6').next().hide();
    }
  });
  
}

// Highlights the Events mini calendar on hover
function highlight_mini_calendar_on_hover() {
  
  jQuery('#highlight_mini_calendar').hover(
    function() {
      jQuery('#highlight_mini_calendar table').addClass('mini_calendar_over');
    }, function() {
      jQuery('#highlight_mini_calendar table').removeClass('mini_calendar_over');
    }
  );

}

// Grab the next musicworld article for the slidebox
function get_next_musicworld_article() {
  
  if (jQuery('#slidebox').length > 0) {

    if (jQuery('#current').parent().next().attr("class") == "ad") {
      var next_page = jQuery('#current').parent().next().next().find("a").attr("href");
      var next_title = jQuery('#current').parent().next().next().find("span").text();
      var next_image = jQuery('#current').parent().next().next().find("img").attr("src");
    } else {
      var next_page = jQuery('#current').parent().next().find("a").attr("href");
      var next_title = jQuery('#current').parent().next().find("span").text();
      var next_image = jQuery('#current').parent().next().find("img").attr("src");
    }
    
    if (next_page == undefined) {
      next_page = '/musicworld/';
      next_title = "View the current issue of MusicWorld";
    }
    
    jQuery("#slidebox #next_page a").html(next_title + " &raquo;");
    jQuery("#slidebox #next_page a").attr("href", next_page);
    
    if (next_page == '/musicworld/') {
      jQuery("#slidebox #next_image").hide();
    } else {
      jQuery("#slidebox #next_image").html('<a href="' + next_page + '"></a>');
      jQuery("#slidebox #next_image a").html('<img src="' + next_image + '" width="225" height="128" />');
    }
  }
  
}

// Switches the Events calendar to the selected month
function switch_calendar_to_selected_month() {
  
  jQuery('#calendar_selector').change(function() {
  	location.href = jQuery('#calendar_selector').val();
  });
  
  jQuery('#highlight_mini_calendar').click(function() {
  	location.href = jQuery('#highlight_mini_calendar').attr('href');
  });
  
}

// Replaces breadcrumb page title headline with Flash animation
function animate_page_title() {
	var title = jQuery("#title")[0];
	
	if (title) {
    var flashvars = {};
    var params = {};
    params.wmode = "transparent";
    params.quality = "high";
    params.bgcolor = "#FFFFFF";
    var attributes = {};
    swfobject.embedSWF('/flash/title.swf?title=' + 
                        title.innerHTML, 
                        "title", 
                        "200", 
                        "20", 
                        "8", 
                        false, 
                        flashvars, 
                        params, 
                        attributes);
	}
}

function search_tool() {
  
  // Switch to website search
  jQuery('.website').click(function() {
    jQuery('.repertoire').attr('checked', false);
    jQuery('#website').show();
    jQuery('#repertoire').hide();
  });
  
  // Switch to repertoire search
  jQuery('.repertoire').click(function() {
    jQuery('.website').attr('checked', false);
    jQuery('#website').hide();
    jQuery('#repertoire').show();
  });
  
  // Keep search query fields in sync
  jQuery('#web_search').change(function() {
  	jQuery('#rep_search').val(jQuery('#web_search').val());
  });
  jQuery('#rep_search').change(function() {
  	jQuery('#web_search').val(jQuery('#rep_search').val());
  });

}

function toggle_years_on_timeline() {
  jQuery('#timeline ul').hide();
  jQuery('#timeline h3:first span + span').addClass("minus");
  jQuery('#timeline h3:first span + span').removeClass("plus");
  jQuery('#timeline ul:first').show();
  jQuery('#timeline h3').click(function() {
    if (jQuery(this).next("ul").is(":visible")) {
      jQuery(this).next("ul").slideUp();
      jQuery(this).find("span + span").addClass("plus");
      jQuery(this).find("span + span").removeClass("minus");
    } else {
      jQuery(this).next("ul").slideDown();
      jQuery(this).find("span + span").removeClass("plus");
      jQuery(this).find("span + span").addClass("minus");
    }
  });
}

function make_pngs_work_in_explorer() {
  
  // Set transparent pixel
  jQuery.ifixpng('/images/app/pixel.gif');
  
  // Set pngs to make transparent
  jQuery('img, #overlay, .go').ifixpng();

}

function make_form_submits_work_in_explorer() {
  // http://thefutureoftheweb.com/blog/submit-a-form-in-ie-with-enter
  
  // Force IE to submit forms when enter/return is pressed
  // (but on login form check that user and pass are valid)
  jQuery('.ols_login input').keydown(function(e){
            
      // Process enter/return key press
      if (e.keyCode == 13) {
        
        // Login Form
        if (jQuery('.ols_login').length > 0) {
          if (jQuery('#realuser').val() != '' && jQuery('#realpass').val() != '') {
            if (jQuery('#realuser').val() != 'Username' && jQuery('#realpass').val() != 'Password') {
              jQuery(this).parents('form').submit();
            }
          }
        
        // Other forms
        } else {
          jQuery(this).parents('form').submit();
        }
        
        // Disable stupid IE beep sound
        return false;
      }
  });

}

function toggle_login_panel_go_button() {
  
  // Login panel go button
  jQuery('.ols_login input').keyup(function(e){
    
    // Toggle button state if inputs are valid
    if (jQuery('#realuser').val() != '' && jQuery('#realpass').val() != '') {
      if (jQuery('#realuser').val() != 'Username' && jQuery('#realpass').val() != 'Password') {
        jQuery('.ols_login .go').attr('src', '/images/app/go.png');
      } else {
        jQuery('.ols_login .go').attr('src', '/images/app/go_faded.png');
      }
    } else {
      jQuery('.ols_login .go').attr('src', '/images/app/go_faded.png');
    }
          
  }); 
  
}

function slideshow() {

  // Get active image and label
  var $active_image = jQuery('#feature .images li.active');
  var $active_label = jQuery('#feature .labels li.active');

  // Get next image and label
  var $next_image =  $active_image.next().length ? $active_image.next()
      : jQuery('#feature .images li:first');
  var $next_label =  $active_label.next().length ? $active_label.next()
      : jQuery('#feature .labels li:first');
             
  // Animate between images
  $next_image.css({opacity: 0.0})
    .addClass('active')
    .animate({opacity: 1.0}, 700, function() {
        $active_image.removeClass('active');
    });
  
  // Animate between labels
  $active_label.removeClass('active');
  $next_label.addClass('active');
  $active_label.slideUp(300, function() {
    $active_label.appendTo("#feature .labels").show();
  });
    
}

function reshuffle_slides(selected_label) {
  
  // Reshuffle (only if new label is clicked)
  if (jQuery('#feature .labels li.active').attr("id") != selected_label.attr("id")) {
    
    // IMAGES

      // Grab active image
      var $active_image = jQuery('#feature .images li.active');
  
      // Grab next image
      if (selected_label.attr("id").length > 6) {
        next = "#image" + selected_label.attr("id").substring(5,7);
      } else {
        next = "#image" + selected_label.attr("id").substring(5,6);
      }
      
      var $next_image = jQuery(next);
  
      // Animate between images
      $next_image.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 300, function() {
            $active_image.removeClass('active');
        });
      
    // LABELS
    
      // Grab active label
      var $active_label = jQuery('#feature .labels li.active');
        
      // Remove active class
      $active_label.removeClass('active');
      
      // Set active class to selected label
      selected_label.addClass('active');
      
      // Move previous labels to bottom of stack
      jQuery(jQuery.makeArray(selected_label.prevAll()).reverse()).each(function() {
        jQuery(this).slideUp(200, function() {
          jQuery(this).appendTo("#feature .labels").show();
        });
      });
  
  }

}

function genres_slideshow() {
  
  // Get active image and label
  var $active_image = jQuery('#features.genres .feature.active');

  // Get next image and label
  var $next_image =  $active_image.next().length ? $active_image.next()
      : jQuery('#features.genres .feature:first');
             
  // Animate between images
  $next_image.css({opacity: 0.0})
    .addClass('active')
    .animate({opacity: 1.0}, 700, function() {
        $active_image.removeClass('active');
    });
  
}

function rotate_indie_album_sets() {

  if (jQuery("#set1").is(':visible')) {
    jQuery("#set1").fadeOut(500);
    jQuery("#set2").fadeIn(500);
  } else {
    jQuery("#set1").fadeIn(500);
    jQuery("#set2").fadeOut(500);      
  }

}

function setup_video(carousel_id) {
  stepcarousel.setup({
    galleryid: carousel_id, //id of carousel DIV
    beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
    panelclass: 'panel3', //class of panel DIVs each holding content
    autostep: {enable:false, moveby:1, pause:3000},
    panelbehavior: {speed:500, wraparound:false, persist:true},
    defaultbuttons: {enable: true, moveby: 1, leftnav: ['/images/app/arrow_gray_left.png', -20, 40], rightnav: ['/images/app/arrow_gray_right.png', 5, 40]},
    statusvars: ['statusA', 'statusB', 'statusC'], //register 3 variables that contain current panel (start), current panel (last), and total panels
    contenttype: ['inline'] //content setting ['inline'] or ['ajax', 'path_to_external_file']
  });
}

function show_video_carousels() {
  
  // Setup default video carousel if available
  if (jQuery("#video_carousel").length && jQuery(".dynamic_carousel").length == 0) {
    setup_video("video_carousel");
  }
  
  // Spawn fancybox for video carousels
  jQuery(".stepcarousel .youtube_video a").live('click', function() {
   jQuery.fancybox({
     'padding'   : 0,
     'autoScale'   : false,
     'transitionIn'  : 'none',
     'transitionOut' : 'none',
     'title'     : this.title,
     'width'   : 680,
     'height'    : 495,
     'href'      : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/') + '&autoplay=1',
     'type'      : 'swf',
     'swf'     : {
       'wmode'   : 'transparent',
       'allowfullscreen' : 'true'
     }
   });
  
   return false;
  });
  
  // Play icon opacity rollovers
  jQuery('.youtube_video .overlay img').live('mouseover mouseout',function() {
    if (event.type == "mouseover") {
      jQuery(this).css('opacity', '0.4');
    } else {
      jQuery(this).css('opacity', '1.0');
    }
  });
  
}

function make_community_links_open_new_windows() {
  
  if (window.location.pathname.match(/^\/community/i)) {
    jQuery(".thread .post .container a").each(function() {
      if (jQuery(this).attr("href").match(/bmi.com/) == null && jQuery(this).attr("target") == '') {
        jQuery(this).attr("target", "_blank");
        jQuery(this).addClass("offsite");
      }
    });
  }
  
}

function handle_mobile_clients() {
  
  // Switch to mobile web app (if requested)
  jQuery('.switch_to_mobile').live('click', function(){
    jQuery.cookie('mobile', null, { path: '/', domain: 'bmi.com'});
    location.href = "/mobile";
  });
  
  // Supported mobile browsers
  if (navigator.userAgent.match(/Android/i) ||
      navigator.userAgent.match(/webOS/i) || 
      navigator.userAgent.match(/iPhone/i) || 
      navigator.userAgent.match(/iPod/i)) {
        
      // External links (with target=_blank)
      if (location.href.match(/mobile=skip/i)) {
                
        // Hide switcher
        jQuery(document).ready(function(){
          jQuery("#switcher").hide();
        });
        
      // Normal links
      } else {
        
        // Switch to mobile for some URLs
        var current_path = window.location.pathname;
        var routes = new Array();
        var mobile_enabled = false;

        // List of mobile optimized URLs
        routes.push('/');
        routes.push('/about');
        routes.push('/benefits');
        routes.push('/business');
        routes.push('/creators');
        routes.push('/events');
        routes.push('/license');
        routes.push('/login');
        routes.push('/join');
        routes.push('/musicworld');
        routes.push('/news/all_news');
        routes.push('/search');
        routes.push('/video');

        // Enable mobile app if matching URL is found
        for (x in routes) {
          if (current_path.match("^" + routes[x] + "\/?$")) {
            mobile_enabled = true;
            break;
          }
        }

        // Redirect news entry pages to mobile template
        if (current_path.match('^/news/entry/(\\d+)$')) {
          jQuery("body").hide();
          window.stop();
          window.location.pathname = '/news/entry_mobile/' + RegExp.$1;
          throw new Error('redirecting to mobile');
        }
        
        // Redirect contact page to mobile page
        if (current_path.match('^/about/entry/533331/test')) {
          jQuery("body").hide();
          window.stop();
          window.location.pathname = '/mobile/load/creators_offices';
          throw new Error('redirecting to mobile');
        }

        // Redirect event entry pages to mobile template
        if (current_path.match('^/events/entry/(\\d+)*$')) {
          jQuery("body").hide();
          window.stop();
          window.location.pathname = '/events/entry_mobile/' + RegExp.$1;
          throw new Error('redirecting to mobile');
        }
        
        if (mobile_enabled == true) {
          
          // Add mobile switcher        
          var html = '<p id="switcher"><span>';
          html = html + '<a href="#" class="switch_to_mobile">Switch to mobile version</a></span></p>';
          jQuery("#version_selector").after(html);

          // Show version selector overlay
          if (jQuery.cookie('mobile') == 'skip') {
          } else {
            jQuery("#version_selector").show();

            jQuery("#select_desktop").click(function(event){
              jQuery.cookie("mobile", "skip", { path: '/', domain: 'bmi.com', expires: 30 });
              jQuery("#version_selector").slideUp(300);
            });
            jQuery("#select_mobile").click(function(event){
              jQuery.cookie("mobile", null);
              location.href = "/mobile";
            });
          }

        }

      }
  }
}

// Let's roll!
jQuery(document).ready(function(){
    
  show_header_panel();
  
  show_form_hints();
  
  animate_page_title();
  
  search_tool();

  toggle_years_on_timeline();

  switch_calendar_to_selected_month();
  
  highlight_mini_calendar_on_hover();

  get_next_musicworld_article();
  
  toggle_sidebar_lists();
    
  switch_tabs();

  what_is_bmi_panel();

  toggle_login_panel_go_button();

  make_community_links_open_new_windows();

  show_video_carousels();

  make_pngs_work_in_explorer();
  
  make_form_submits_work_in_explorer();
    
  handle_mobile_clients();
  
  // Show form ghost text
  jQuery(".ghost_text").ghostText();
  
  // Genres slideshow (if slides are present)
  if (jQuery('#features').length) {    
    setInterval("genres_slideshow()", 7000 );
  }
  
  // Slideshow (if slides are present)
  if (jQuery('#feature').length) {
    
    // Slideshow
    slides = setInterval(slideshow, 7000);
    
    // Jump to slide
    jQuery("#feature .labels li").click(function () { 
      
      // Stop slideshow
      clearInterval(slides);

      // Reshuffle slides
      reshuffle_slides(jQuery(this));
                
      // Restart slideshow at current position
      slides =  setInterval(slideshow, 7000);
      
    });
    
  }
  
  // Indie Page album sets
  if (jQuery('#indie_header').length) {

    // Show detail when hovering over album cover
    jQuery("#indie_header .set img").hover(
      function () {
        set = jQuery(this).parent().attr("id").substring(3,4);
        detail = (jQuery(this).parent().children().index(this) + 1);        
        jQuery("#details" + set + " .detail" + detail).fadeIn(100);
      }
    );

    // Hide detail when hovering out
    jQuery("#indie_header .details div").hover(
      function () {
        jQuery('#indie_header .details div').not(this).hide();
        clearInterval(indie_slides);
      },
      function () {
        jQuery(this).fadeOut(100);
        indie_slides = setInterval("rotate_indie_album_sets();", 5000);
      }
    );

    // Rotate slides
    indie_slides = setInterval("rotate_indie_album_sets();", 5000);
  
  }
  
});



// SLIDER
// Slideshow with JSON and jQuery
// Patrick Crowley


// FUNCTIONS

function load_slides_from(scope, limit) {

  // Prevent IE8 from loading two slideshows
  if (jQuery(".slides").length > 0) {
    return;
  }
    
  // Assign variables
  var scope = scope;
  var limit = limit;
  var params = [];
  var json_url = "/photos/json";
  
  // Build params
  if (limit > 0) {
    params.push("limit=" + limit);
  }
  
  if (location.pathname == "/") {
    params.push("status=not_home");
  }
  
  if (typeof scope === 'string') {
    if (scope != 'all') {
      if (scope.indexOf("|") > 0) {
        params.push("category=" + scope);
      } else {
        params.push("event=" + scope);
      }
    }
  }
  
  if (typeof scope === 'number') {
    params.push("category=" + scope);
  }
  
  if (params.length > 0) {
    params = "?" + params.join('&');
  }
  
  // Add empty slider markup
  load_slider_markup();
  
  // Number of slides
  var number_of_slides = 0;

  // Load JSON feed and cache
  jQuery.getJSON(json_url + params,
    function(data){
    
      // phr mod: if there are no slides hide the slideshow
      if (data.photos.length == 0) {
        jQuery('.slider').css('display','none');
      } 
      else {

		  jQuery(".slider").append('<div class="counter" data="' + data.photos.length + '">&nbsp;</div');
				
		  jQuery.each(data.photos, function(i,item) {
			var $slides = jQuery('.slides');
					
			// Update event name and caption for first slide
			if (i == 0) {
			  jQuery(".event_name").find("span").html(item.event);
			  jQuery(".caption").find("span").html(item.caption);
			}
			
			// Add new slide
			$slides.append('<li class="slide"></li>');
			
			// Save slide metadata
			var $slide = jQuery('.slides').find("li").last();
			var host = "http://www.bmi.com";
			$slide.attr("link", host + item.link);
			$slide.attr("event", item.event);
			$slide.attr("caption", item.caption);
			$slide.attr("src", host + encodeURI(item.photo));
			$slide.attr("cheat_crop", item.cheat_crop);
	
	
			// Activate first slide
			if (i == 0) {
			  var $first_slide = jQuery('.slides').find("li").first();
			  
			  $first_slide.addClass("active_slide");
			  $first_slide.append('<img src="' + host + encodeURI(item.photo) + '" />');
        // $first_slide.append('<img src="" />');
        // $first_slide.find("img").attr("src", host + encodeURI(item.photo));
        
			  // Apply cheat_crop to first slide if needed
			  if ($first_slide.attr("cheat_crop") != '') {
				jQuery($first_slide).find("img").css("margin-top", "-" + $first_slide.attr("cheat_crop") + "px");
			  }
			}
			
		  });
      }
    });
    
  // Start slideshow
  slider_show = setInterval(rotate_slides, 5000);
  
}

function advance_slides_to(direction, speed) {
  var $active_slide = jQuery('.slides li.active_slide');
  var speed = typeof(speed) != 'undefined' ? speed : 700;

  // Next slide
  if (direction == 'next') {
    var $next_slide =  $active_slide.next().length ? $active_slide.next()
      : jQuery('.slides li:first');
    
    if ($next_slide.find("img").length == 0) {
      $next_slide.append('<img src=' + $next_slide.attr("src") +  ' />');
      var $next_image = $next_slide.find("img");
      jQuery($next_image).load(function () {
        switch_to_next_slide($next_slide, $active_slide, speed);
      });
    } else {
      switch_to_next_slide($next_slide, $active_slide, speed);
    }
    
  }
  
  // Previous slide
  if (direction == 'previous') {
    var $previous_slide =  $active_slide.prev().length ? $active_slide.prev()
      : jQuery('.slides li:last');
    
    if ($previous_slide.find("img").length == 0) {
      $previous_slide.append('<img src=' + $previous_slide.attr("src") +  ' />');
      var $previous_image = $previous_slide.find("img");
      jQuery($previous_image).load(function () {
        switch_to_previous_slide($previous_slide, $active_slide, speed);
      });
    } else {
      switch_to_previous_slide($previous_slide, $active_slide, speed);
    }
  }
  
}

function load_slider_markup() {
  document.write('<div class="slider"></div>');
  jQuery('.slider').append('<div class="event_name"><span></span></div>');
  jQuery('.slider').append('<div class="navigation"></div>');
  jQuery('.navigation').append('<a href="#" class="view_photo"><span>View photo</span></a>');
  jQuery('.navigation').append('<a href="#" class="previous"></a>');
  jQuery('.navigation').append('<a href="#" class="next"></a>');
  jQuery('.slider').append('<div class="curtain"></div>');
  jQuery('.slider').append('<ul class="slides"></ul>');
  jQuery('.slider').append('<div class="caption"><span></span></div>');
}

function resize_caption_for(slide, height) {
  slide.find('.caption').css('margin-top', function(index) {
    return height - slide.find('.caption').height();
  });
}

function rotate_slides() {
  if (jQuery('.slides').children().length > 1) {
    advance_slides_to('next');
  }
}

function switch_to_next_slide(next_slide, active_slide, speed) {
  next_slide.css({opacity: 0.0})
    .addClass('active_slide')
    .animate({opacity: 1.0}, speed, function() {
      active_slide.removeClass('active_slide');
  });
  update_meta_information_for(next_slide);
}

function switch_to_previous_slide(previous_slide, active_slide, speed) {
  previous_slide.css({opacity: 1.0})
  previous_slide.addClass('active_slide');
  active_slide.css({opacity: 1.0})
    .animate({opacity: 0}, speed, function() {
      active_slide.removeClass('active_slide');
  });
  update_meta_information_for(previous_slide);
}

function update_meta_information_for(slide) {
  jQuery(".event_name").find("span").html(slide.attr("event"));
  jQuery(".caption").find("span").html(slide.attr("caption"));
  if (slide.attr("cheat_crop") != '') {
    jQuery(slide).find("img").css("margin-top", "-" + slide.attr("cheat_crop") + "px");
  }
}


// BEHAVIOR

jQuery(document).ready(function() {
  
  // Fade in first slide and nav
  jQuery(".caption").ready(function () { 
    
    // Show slide navigation on hover
    jQuery(".navigation").hover(function(){
      jQuery(this).fadeTo(300, 1.0);
     },function(){
        jQuery(this).fadeTo(500, 0);
    });

    // Jump to next slide
    jQuery(".next").click(function () {
      if (jQuery("li").is(":animated")) {
        return false;
      }
      clearInterval(slider_show);
      advance_slides_to('next', 350);
      return false;
  	});

    // Jump to previous slide
    jQuery(".previous").click(function () {
      if (jQuery("li").is(":animated")) {
        return false;
      }
      clearInterval(slider_show);
      advance_slides_to('previous', 350);
      return false;
  	});

    // Jump to image link if clicked
    jQuery(".view_photo").click(function () { 
      location.href = jQuery('.active_slide').attr('link');
    });
    
    // Animate navigation
    jQuery('.navigation a').animate({opacity: 1.0}, 1400, function() {
      jQuery('.event_name span').animate({opacity: 1.0}, 1000);
      jQuery('.caption span').animate({opacity: 0.6}, 1000);
      jQuery('.curtain').animate({opacity: 0}, 1000, function() {
        jQuery('.curtain').hide();
      });
    });
  
  });

});

function load_audio_from(list_of_songs, event_name) {
  var event_name = event_name;

  // MARKUP
  document.write('<div id="jquery_jplayer_1" class="jp-jplayer"></div><div class="jp-audio"><div class="jp-type-playlist"><div id="jp_interface_1" class="jp-interface"> <ul class="jp-controls"> <li><a href="#" class="jp-play" tabindex="1">play</a></li><li><a href="#" class="jp-pause" tabindex="1">pause</a></li><li><a href="#" class="jp-stop" tabindex="1">stop</a></li><li><a href="#" class="jp-mute" tabindex="1">mute</a></li><li><a href="#" class="jp-unmute" tabindex="1">unmute</a></li><li><a href="#" class="jp-previous" tabindex="1">previous</a></li><li><a href="#" class="jp-next" tabindex="1">next</a></li> </ul><div class="jp-progress"><div class="jp-seek-bar"><div class="jp-play-bar"></div> </div> </div><div class="jp-volume-bar"><div class="jp-volume-bar-value"></div> </div><div class="jp-current-time"></div><div class="jp-duration"></div> </div><div id="jp_playlist_1" class="jp-playlist"> <ul></ul> </div></div></div>');
  
  // SETUP PLAYLIST
  var Playlist = function(instance, playlist, options) {
    var self = this;

    this.instance = instance; // String: To associate specific HTML with this playlist
    this.playlist = playlist; // Array of Objects: The playlist
    this.options = options; // Object: The jPlayer constructor options for this playlist

    this.current = 0;

    this.cssId = {
      jPlayer: "jquery_jplayer_",
      interface: "jp_interface_",
      playlist: "jp_playlist_"
    };
    this.cssSelector = {};

    jQuery.each(this.cssId, function(entity, id) {
      self.cssSelector[entity] = "#" + id + self.instance;
    });

    if(!this.options.cssSelectorAncestor) {
      this.options.cssSelectorAncestor = this.cssSelector.interface;
    }

    jQuery(this.cssSelector.jPlayer).jPlayer(this.options);

    jQuery(this.cssSelector.interface + " .jp-previous").click(function() {
      self.playlistPrev();
      jQuery(this).blur();
      return false;
    });

    jQuery(this.cssSelector.interface + " .jp-next").click(function() {
      self.playlistNext();
      jQuery(this).blur();
      return false;
    });
  };

  Playlist.prototype = {
    // phr note: changed counter i to k to work around ee tag substitution on i in square brackets
    // also had so swap a couple of single quotes with double quotes so ee wouldn't try to insert html entities
    displayPlaylist: function() {
      var self = this;
      jQuery(this.cssSelector.playlist + " ul").empty();
      for (k=0; k < this.playlist.length; k++) {
        var listItem = (k === this.playlist.length-1) ? '<li class="jp-playlist-last">' : '<li>';
        listItem += "<a href='#' id='" + this.cssId.playlist + this.instance + "_item_" + k +"' tabindex='1'>"+ this.playlist[k].name +"</a>";

        // Create links to free media
        if(this.playlist[k].free) {
          var first = true;
          listItem += "<div class='jp-free-media'>(";
          jQuery.each(this.playlist[k], function(property,value) {
            if(jQuery.jPlayer.prototype.format[property]) { // Check property is a media format.
              if(first) {
                first = false;
              } else {
                listItem += " | ";
              }
              listItem += "<a id='" + self.cssId.playlist + self.instance + "_item_" + k + "_" + property + "' href='" + value + "' tabindex='1'>" + property + "</a>";
            }
          });
          listItem += ")</span>";
        }

        listItem += "</li>";

        // Associate playlist items with their media
        jQuery(this.cssSelector.playlist + " ul").append(listItem);
        jQuery(this.cssSelector.playlist + "_item_" + k).data("index", k).click(function() {
          var index = jQuery(this).data("index");
          if(self.current !== index) {
            self.playlistChange(index);
          } else {
            jQuery(self.cssSelector.jPlayer).jPlayer("play");
          }
          jQuery(this).blur();
          return false;
        });

        // Disable free media links to force access via right click
        if(this.playlist[k].free) {
          jQuery.each(this.playlist[k], function(property,value) {
            if(jQuery.jPlayer.prototype.format[property]) { // Check property is a media format.
              jQuery(self.cssSelector.playlist + "_item_" + k + "_" + property).data("index", k).click(function() {
                var index = jQuery(this).data("index");
                jQuery(self.cssSelector.playlist + "_item_" + index).click();
                jQuery(this).blur();
                return false;
              });
            }
          });
        }
      }
    },
    playlistInit: function(autoplay) {
      if(autoplay) {
        this.playlistChange(this.current);
      } else {
        this.playlistConfig(this.current);
      }
    },
    playlistConfig: function(index) {
      jQuery(this.cssSelector.playlist + "_item_" + this.current).removeClass("jp-playlist-current").parent().removeClass("jp-playlist-current");
      jQuery(this.cssSelector.playlist + "_item_" + index).addClass("jp-playlist-current").parent().addClass("jp-playlist-current");
      this.current = index;
      jQuery(this.cssSelector.jPlayer).jPlayer("setMedia", this.playlist[this.current]);
    },
    playlistChange: function(index) {
      this.playlistConfig(index);
      jQuery(this.cssSelector.jPlayer).jPlayer("play");
    },
    playlistNext: function() {
      var index = (this.current + 1 < this.playlist.length) ? this.current + 1 : 0;
      this.playlistChange(index);
    },
    playlistPrev: function() {
      var index = (this.current - 1 >= 0) ? this.current - 1 : this.playlist.length - 1;
      this.playlistChange(index);
    }
  };
  
  // PLAYLIST
  var audioPlaylist = new Playlist("1", list_of_songs, {
    ready: function() {
      audioPlaylist.displayPlaylist();
      audioPlaylist.playlistInit(true); // Parameter is a boolean for autoplay.
    },
    ended: function() {
      audioPlaylist.playlistNext();
    },
    play: function() {
      // Grab play event information
      var artist_and_song = jQuery(".jp-playlist-current .jp-playlist-current").text();
      if (location.href.match(/https/i)) {
        var source = "Facebook";
      } else {
        var source = "BMI";
      }
      
      // Send play event to Google Analytics
      if (event_name != undefined) {
        pageTracker._trackEvent('Plays', event_name + ": " + artist_and_song, source);
      }
      
      // Debugger
      if (window.console && 'function' === typeof window.console.log) {
        if (event_name == undefined) {
          console.log("EVENT NAME IS MISSING");
          console.log("Please add event name to load_audio_from() like so:");
          console.log("load_audio_from(list_of_songs_to_play, 'Grammys 2011');");
        } else {
          console.log("Category => Plays")
          console.log("Action => " + event_name + ": " + artist_and_song);
          console.log("Label => " + source)
        }
      }
      
      jQuery(this).jPlayer("pauseOthers");
    },
    swfPath: "http://www.bmi.com/javascripts/jQuery.jPlayer.2.0.0",
    supplied: "oga, mp3"
  });
}


// VIDEO SLIDER
// Video slideshow carousel
// Patrick Crowley


// FUNCTIONS

function is_integer(value){ 
  if((parseFloat(value) == parseInt(value)) && !isNaN(value)){
      return true;
  } else { 
      return false;
  } 
}

function position(i) {
  var order = '';
  var i = i + 1;
  if (i == 1 || i == 4 || i == 7 || i == 10 || i == 13 || i == 16 || i == 19 || i == 22 || i == 25 || i == 28) {
    order = "first";
  } else if (i == 2 || i == 5 || i == 8 || i == 11 || i == 14 || i == 17 || i == 20 || i == 23 || i == 26 || i == 29) {
    order = "second";
  } else {
    order = "third";
  }
  return order;
}

function load_video_markup() {
  // Video carousel
  document.write('<div id="video_carousel" class="stepcarousel dynamic_carousel"></div>');
  jQuery('#video_carousel').append('<div class="belt"></div>');
  
  // Video navigation
  jQuery('#video_carousel').after('<div id="video_nav"></div>');
  jQuery('#video_nav').append('<div id="video_carousel-paginate"><img src="/images/app/pip_c.png" data-over="/images/app/pip_a.png" data-select="/images/app/pip_6.png" data-moveby="1" /></div>');
  jQuery('#video_nav').append('<div id="more_video"></div>');
}

function load_video_from() {
  
  // Assign variables
  var params = [];
  var json_url = "/video/json";
  var param_names = ["category","year"];
  for (i=0;i<=1;i++) {
    eval("var " + param_names[i] + " = " + "'" + arguments[i] + "'");
  }
  
  // Build params
  if (category != 'undefined' && category != 'all') {
    params.push("category=" + category); 
  }
  
  if (year != 'undefined') {
    params.push("year=" + year); 
  }
  
  if (params.length > 0) {
    params = "?" + params.join('&');
  }
  
  // Debugger
  if (window.console && 'function' === typeof window.console.log) {
    if (category != 'undefined') {
      console.log("category: " + category);
    }
    console.log("year: " + year);
    console.log("params: " + params);
  }
  
  // Add empty video markup
  load_video_markup();

  // Add videos
  jQuery.getJSON(json_url + params,
    function(data) {
    
      // Hide carousel if no videos found
      if (data.video.length == '0') {
        
        jQuery('#video_carousel').remove();
        jQuery('#video_nav').remove();
        
      } else {
        jQuery.each(data.video, function(i,item) {
          
          // Group videos into sets of three
          if (i == 0 || is_integer((i)/3) == true) {
            jQuery('.belt').append('<div class="panel3"></div>');
          }
          
          // Add video 
          jQuery('#video_carousel').find(".panel3").last().append('<div id="' + item.youtube_id + '" class="youtube_video ' + position(i) + '"></div>');
          jQuery('#video_carousel').find(".youtube_video").last().append('<a href="http://www.youtube.com/watch?v=' + item.youtube_id + '&amp;fs=1" title="' + item.title + '"></a>');
          jQuery('#video_carousel').find(".youtube_video").last().find("a").append('<div class="overlay"><img src="http://www.bmi.com/images/app/video-play-button-layer-50.png" width="50" alt="play" /></div>');
          jQuery('#video_carousel').find(".youtube_video").last().find("a").append('<img src="http://www.bmi.com' + item.thumbnail + '" width="174" height="99" class="thumbnail" alt="thumbnail image" />');
                    
          // Spin up carousel after last video insertion
          if ((data.video.length - i) == 1) {
            if (category != 'undefined' && category != 'all') {
              if (typeof category === 'string') {
                if (category.match(/\|/)) {
                  category = category.split("|")[0];
                }
              }
              jQuery('#more_video').append('<p><a href="/video/tag/C' + category + '">More videos</a></p>');
            } else {
              jQuery('#more_video').append('<p><a href="/video">More videos</a></p>');
            }
            
            setup_video('video_carousel');
          }
          
        });
      }
    });
}



