/* Plugins */
/*
 *	- Fancybox 1.3.4
 *	- Mousewheel 3.0.4
 *	- jQuery Easing v1.3
 *	- jQuery Raty 1.4.0
 *  - jQuery onStage
 *  - HTML5 Forms Chapter JavaScript Library
 */


// bigTarget.js - A jQuery Plugin
// Version 1.0.1
// Written by Leevi Graham - Technical Director - Newism Web Design & Development
// http://newism.com.au
// Notes: Tooltip code from fitted.js - http://www.trovster.com/lab/plugins/fitted/

// create closure
(function($) {
	// plugin definition
	$.fn.bigTarget = function(options) {
		debug(this);
		// build main options before element iteration
		var opts = $.extend({}, $.fn.bigTarget.defaults, options);
		// iterate and reformat each matched element
		return this.each(function() {
			// set the anchor attributes
			var $a = $(this);
			var href = $a.attr('href');
			var title = $a.attr('title');
			// build element specific options
			var o = $.meta ? $.extend({}, opts, $a.data()) : opts;
			// update element styles
			$a.parents(o.clickZone)
				.hover(function() {
					$h = $(this);
					$h.addClass(o.hoverClass);
					if(typeof o.title != 'undefined' && o.title === true && title != '') {
						$h.attr('title',title);
					}
				}, function() {
					
					$h.removeClass(o.hoverClass);
					if(typeof o.title != 'undefined' && o.title === true && title != '') {
						$h.removeAttr('title');
					}
				})
				// click
				.click(function() {
					if(getSelectedText() == "")
					{
						if($a.is('[rel*=external]')){
							window.open(href);
							return false;
						}
						else {
							//$a.click(); $a.trigger('click');
							window.location = href;
						}
					}
				});
		});
	};
	// private function for debugging
	function debug($obj) {
		if (window.console && window.console.log)
		window.console.log('bigTarget selection count: ' + $obj.size());
	};
	// get selected text
	function getSelectedText(){
		if(window.getSelection){
			return window.getSelection().toString();
		}
		else if(document.getSelection){
			return document.getSelection();
		}
		else if(document.selection){
			return document.selection.createRange().text;
		}
	};
	// plugin defaults
	$.fn.bigTarget.defaults = {
		hoverClass	: 'hover',
		clickZone	: 'li:eq(0)',
		title		: true
	};
// end of closure
})(jQuery);


/**
  *
  *	jQuery onStage
  * @author Simon Woelfl
  * 
  */
  
  (function($)
  {
  	$.fn.onStage = function(options)
      {
  		$.fn.onStage.defaults = {
  			auto : false, // Autoplay?
  			speed : 5000, // Speed in ms
  			duration : 1000, // effect duration
  			effect: "fade", //e.g. slide, fall, fade
  			preview: true,
  			controls: true,
  			btnNext: ">",
  			btnPrev: "<",
  			btnPlay: "Play",
  			btnPause: "Pause",
  			infinity: true,
  			loop: true,
  			scenesOnStage: 1,
  			move: 1
  		};
  		
  		var opts = $.extend({}, $.fn.onStage.defaults, options);
  		
  		return this.each(function()
  		{
  			var $this = $(this);
  			var onStageTimeout = '';
  			var playing = false;
  			
  			$this.addClass("onStage").addClass(opts.effect);
  				
  			var $first = $this.find(".scene:first").addClass("first");
  			var $last = $this.find(".scene:last").addClass("last");
  			var $stage = $this.find(".stage");
  			var $preview = $this.find(".preview");
  			var $controls = $this.find(".controls").first();
  			
			build();
  			
  			var sceneCount = $this.find(".scene").length;
  			var sceneWidth = $this.find(".scene.first").width();
  			var sceneHeight = $this.find(".scene.first").height();
  			
  			init();
  			
  			if($this.find(".scene:not(.clone)").length > 1){
	  			createControls();
	  			if(opts.auto){
	  				play();
	  			}
	  		}else{
	  			$controls.hide();
	  		}
  			
  			function build(){
  				if($stage.length == 0){
  					var stage = jQuery('<div class="stage"></div>');
  					$this.append(stage);
  					$stage = $(stage);
  					$stage.append($this.find('.scene'));
  					$stage.appendTo($this);
  				}
  				
  				$this.find(".scene").each(function(){
  					jQuery(this).addClass("scene" + jQuery(this).index());
  				});
  				
  				if(opts.infinity){
  					$stage.find(".scene:lt("+ opts.scenesOnStage +")").each(function(){
  						$(this).clone().addClass('clone').appendTo($stage);
  					});
  				}
  				
  				//set position for animation with css-transition
  				$stage.css('left', '0px');
  				//set width/height for each scene
  				$this.find('.scene').each(function(){
  					$(this).css({
  						width: Math.round($this.width()/opts.scenesOnStage),
  						height: $this.height()
  					})
  				});
  			}
  			
  			function init(){
  				
  				switch(opts.effect){					
  				
  					case "slide":
  						$stage.width( sceneWidth * sceneCount );
  						$stage.height( sceneHeight );
  						break;
  						
  					case "fall":
  						$stage.height( sceneHeight * sceneCount );
  						$stage.css("top", (-1) * (sceneCount-1) * sceneHeight);
  						break;
  					
  					default:
  						$this.find(".scene").hide();
  				}
  				
  				$first.show().addClass("active");
  				$this.find("UL:first LI:first").addClass("active");
  			}
  			
  			function createControls(){
  				//build controls
  				if($controls.length == 0 && opts.controls){
  					var controlsDiv = document.createElement('div');
  					controlsDiv.setAttribute('class','controls');
  					$this.append(controlsDiv);
  					$controls = $(controlsDiv);
  				}
  				var $prev = $controls.find(".prev");
  				if($prev.length == 0 && opts.controls && opts.btnPrev != ""){
  					var prevSpan = document.createElement('span');
  					prevSpan.setAttribute('class','prev');
  					prevSpan.appendChild(document.createTextNode(opts.btnPrev));
  					$controls.append(prevSpan);
  				}
  				var $play = $controls.find(".play");
  				if($play.length == 0 && opts.controls && opts.btnPlay != ""){
  					var playSpan = document.createElement('span');
  					playSpan.setAttribute('class','play');
  					playSpan.appendChild(document.createTextNode(opts.btnPlay));
  					$controls.append(playSpan);
  				}
  				var $pause = $controls.find(".pause");
  				if($pause.length == 0 && opts.controls && opts.btnPause != ""){
  					var pauseSpan = document.createElement('span');
  					pauseSpan.setAttribute('class','pause');
  					pauseSpan.appendChild(document.createTextNode(opts.btnPause));
  					$controls.append(pauseSpan);
  				}
  				var $next = $controls.find(".next");
  				if($next.length == 0 && opts.controls && opts.btnNext != ""){
  					var nextSpan = document.createElement('span');
  					nextSpan.setAttribute('class','next');
  					nextSpan.appendChild(document.createTextNode(opts.btnNext));
  					$controls.append(nextSpan);
  				}
  				
  				//build preview
  				if($preview.length == 0){
  					var previewUl = document.createElement('ul');
  					previewUl.setAttribute('class', 'preview');
  					if(!opts.preview)
  						previewUl.setAttribute('style', 'display: none;');
  					for (var i = 0; i <= $this.find('.scene:not(.clone)').length / opts.move-opts.scenesOnStage; i++){
  						previewUl.appendChild(document.createElement('li'));
  					}
  					$this.append(previewUl);
  					$preview = $(previewUl);
  				}
  				$this.find(".preview LI:first").addClass("first");
  				$this.find(".preview LI:last").addClass("last");
  				
  				//add events
  				$this.find(".next").click(function(){
  					next();
  					pause();
  				});
  				
  				$this.find(".prev").click(function(){
  					prev();
  					pause();
  				});
  				
  				$this.find(".play").click(function(){
  					play();
  				});
  				$this.find(".pause").click(function(){
  					pause();
  				});
  				
  				$this.find("UL.preview LI").click(function(){
  					show(jQuery(this).index());
  				});
  			}
  			
  			function show( scene ){
  				pause();
  				if(opts.auto){
  					play();
  				}
  				// Animationen sollen sich nicht überschneiden
  				if (playing) return;
  				else playing = true;
  					
  				if(scene == "first"){
  					$this.find(".scene.active").removeClass("active");
  					$this.find(".scene:eq(0):not(.clone)").addClass("active");
  					$stage.css("left", "0px");
  					playing = false;
  				}else if(scene == "last"){
  					$this.find(".scene.active").removeClass("active");
  					$this.find(".scene.first.clone").addClass("active");
  					$stage.css("left", (-1) * $this.find(".scene.first.clone").position().left+"px");
  					playing = false;
  				}else{
  								
  					var $old = $this.find(".scene.active");
  					var $next = $this.find(".scene:eq("+scene+")");
  					var $oldlabel = $this.find("UL:first LI.active");
  					var $label = $this.find("UL:first LI:eq("+scene+")");
  					var oldPosition = $old.position();
  					var nextPosition = $next.position();
  					switch(opts.effect){
  					
  						case "slide":
  							$stage.animate({
  									left: '+=' + (oldPosition.left - nextPosition.left)
  								}, {
  									"duration":opts.duration, 
  									"queue":false, 
  									"complete":function() {
	  									playing = false;
	  								}
  								}
  							);
  							break;
  							
  						case "fall":
  						
  							$stage.animate({
  									top: '+=' + (nextPosition.top - oldPosition.top)
  								}, opts.duration, 'linear', function() {
  									playing = false;
  								}
  							);
  							break;
  						
  						default:
  							$old.fadeOut(opts.duration);
  							$next.fadeIn(opts.duration);
  							playing = false;
  					}
  					$old.removeClass("active");
  					$next.addClass("active");
  					$oldlabel.removeClass("active");
  					$label.addClass("active");
  				}
  			}
  			
  			function next() {
  				$active = $stage.find('.active');
  				if($active.is(".first.clone")){
  					show("first");
  					$active = $stage.find('.active');
  				}
  				
  				show($active.index()+opts.move);
  			}
  			
  			function prev() {
  				$active = $stage.find('.active');
  				if($active.is(".first:not(.clone)")){
  					show("last");
  					$active = $stage.find('.active');
  				}
  				
  				show($active.index()-opts.move);
  			}
  			
  			function play() { 
				onStageTimeout = setTimeout(next, opts.speed);
  				$this.find(".play").css('display', 'none');
  				$this.find(".pause").css('display', 'inline');
  			}
  			
  			function pause() {
  				clearTimeout(onStageTimeout);
  				$this.find(".pause").css('display', 'none');
  				$this.find(".play").css('display', 'inline');
  			}
  		});
      };
  })(jQuery);
  

 /**
  * jQuery Raty - A Star Rating Plugin - http://wbotelhos.com/raty
  * 
  * @author  Washington Botelho
  * @twitter wbotelhos
  * @version 1.4.0
  * 
  * Licensed under The MIT License
  * http://opensource.org/licenses/mit-license.php
  * 
  */
 
 (function(f){f.fn.raty=function(r){if(this.length==0){a("Selector invalid or missing!");return;}else{if(this.length>1){return this.each(function(){f.fn.raty.apply(f(this),[r]);});}}var o=f.extend({},f.fn.raty.defaults,r),v=f(this),m=this.attr("id"),n=0,w=o.starOn,s="",u=o.target,l=(o.width)?o.width:(o.number*o.size+o.number*4);if(m===undefined){m="raty-"+v.index();v.attr("id",m);}if(o.number>20){o.number=20;}else{if(o.number<0){o.number=0;}}if(o.path.substring(o.path.length-1,o.path.length)!="/"){o.path+="/";}v.data("options",o);if(!isNaN(parseInt(o.start))&&o.start>0){n=(o.start>o.number)?o.number:o.start;}for(var t=1;t<=o.number;t++){w=(n>=t)?o.starOn:o.starOff;s=(t<=o.hintList.length&&o.hintList[t-1]!==null)?o.hintList[t-1]:t;v.append('<img id="'+m+"-"+t+'" src="'+o.path+w+'" alt="'+t+'" title="'+s+'" class="'+m+'"/>').append((t<o.number)?"&nbsp;":"");}if(o.iconRange&&n>0){b(m,n,o);}var q=f("<input/>",{id:m+"-score",type:"hidden",name:o.scoreName}).appendTo(v);if(n>0){q.val(n);}if(o.half){c(v,f("input#"+m+"-score").val(),o);}if(!o.readOnly){if(u!==null){u=f(u);if(u.length==0){a("Target selector invalid or missing!");}}if(o.cancel){var p=f("img."+m),x='<img src="'+o.path+o.cancelOff+'" alt="x" title="'+o.cancelHint+'" class="button-cancel"/>';if(o.cancelPlace=="left"){v.prepend(x+"&nbsp;");}else{v.append("&nbsp;").append(x);}f("#"+m+" img.button-cancel").mouseenter(function(){f(this).attr("src",o.path+o.cancelOn);p.attr("src",o.path+o.starOff);d(u,"",o);}).mouseleave(function(){f(this).attr("src",o.path+o.cancelOff);v.mouseout();}).click(function(y){f("input#"+m+"-score").removeAttr("value");if(o.click){o.click.apply(v,[null,y]);}});v.css("width",l+o.size+4);}else{v.css("width",l);}v.css("cursor","pointer");h(v,o,u);}else{v.css("cursor","default");j(v,n,o);}return v;};function h(n,m,o){var q=n.attr("id"),p=f("input#"+q+"-score"),l=n.children("img."+q);n.mouseleave(function(){e(n,p.val(),m);g(o,p,m);});l.bind(((m.half)?"mousemove":"mouseover"),function(s){b(q,this.alt,m);if(m.half){var r=parseFloat(((s.pageX-f(this).offset().left)/m.size).toFixed(1));r=(r>=0&&r<0.5)?0.5:1;n.data("score",parseFloat(this.alt)+r-1);c(n,n.data("score"),m);}else{b(q,this.alt,m);}d(o,this.alt,m);}).click(function(r){p.val(m.half?n.data("score"):this.alt);if(m.click){m.click.apply(n,[p.val(),r]);}});}function g(n,o,l){if(n!==null){var m="";if(l.targetKeep){m=o.val();if(l.targetType=="hint"){if(o.val()==""&&l.cancel){m=l.cancelHint;}else{m=l.hintList[Math.ceil(o.val())-1];}}}if(i(n)){n.val(m);}else{n.html(m);}}}function k(p,m,l){var n=undefined;if(m==undefined){a("Specify an ID or class to be the target of the action.");return;}if(m){if(m.indexOf(".")>=0){var o;return f(m).each(function(){o="#"+f(this).attr("id");if(l=="start"){f.fn.raty.start(p,o);}else{if(l=="click"){f.fn.raty.click(p,o);}else{if(l=="readOnly"){f.fn.raty.readOnly(p,o);}}}});}n=f(m);if(!n.length){a('"'+m+'" is a invalid identifier for the public funtion $.fn.raty.'+l+"().");return;}}return n;}function a(l){if(window.console&&window.console.log){window.console.log(l);}}function b(l,n,m){var o=f("img."+l).length,t=0,r=0,s,p;for(var q=1;q<=o;q++){s=f("img#"+l+"-"+q);if(q<=n){if(m.iconRange&&m.iconRange.length>t){p=m.iconRange[t][0];r=m.iconRange[t][1];if(q<=r){s.attr("src",m.path+p);}if(q==r){t++;}}else{s.attr("src",m.path+m.starOn);}}else{s.attr("src",m.path+m.starOff);}}}function j(m,n,l){if(n!=0){n=parseInt(n);hint=(n>0&&l.number<=l.hintList.length&&l.hintList[n-1]!==null)?l.hintList[n-1]:n;}else{hint=l.noRatedMsg;}m.attr("title",hint).children("img").attr("title",hint);}function i(l){return l.is("input")||l.is("select")||l.is("textarea");}function e(m,n,l){var o=m.attr("id");if(isNaN(parseInt(n))){m.children("img."+o).attr("src",l.path+l.starOff);f("input#"+o+"-score").removeAttr("value");return;}if(n<0){n=0;}else{if(n>l.number){n=l.number;}}b(o,n,l);if(n>0){f("input#"+o+"-score").val(n);if(l.half){c(m,n,l);}}if(l.readOnly||m.css("cursor")=="default"){j(m,n,l);}}function d(o,n,l){if(o!==null){var m=n;if(l.targetType=="hint"){if(n==0&&l.cancel){m=l.cancelHint;}else{m=l.hintList[n-1];}}if(i(o)){o.val(m);}else{o.html(m);}}}function c(n,p,m){var q=n.attr("id"),l=Math.ceil(p),o=(l-p).toFixed(1);if(o>0.25&&o<=0.75){l=l-0.5;f("img#"+q+"-"+Math.ceil(l)).attr("src",m.path+m.starHalf);}else{if(o>0.75){l--;}else{f("img#"+q+"-"+l).attr("src",m.path+m.starOn);}}}f.fn.raty.cancel=function(l,n){var m=(n===undefined)?false:true;if(m){f.fn.raty.click("",l,"cancel");}else{f.fn.raty.start("",l,"cancel");}return f.fn.raty;};f.fn.raty.click=function(o,m){var n=k(o,m,"click"),l=f(m).data("options");e(n,o,l);if(l.click){l.click.apply(n,[o]);}else{a('You must add the "click: function(score, evt) { }" callback.');}return f.fn.raty;};f.fn.raty.readOnly=function(o,m){var n=k(o,m,"readOnly"),l=f(m).data("options"),p=n.children("img.button-cancel");if(p[0]){(o)?p.hide():p.show();}if(o){f("img."+n.attr("id")).unbind();n.css("cursor","default").unbind();}else{h(n,l);n.css("cursor","pointer");}return f.fn.raty;};f.fn.raty.start=function(o,m){var n=k(o,m,"start"),l=f(m).data("options");e(n,o,l);return f.fn.raty;};f.fn.raty.defaults={cancel:false,cancelHint:"cancel this rating!",cancelOff:"cancel-off.png",cancelOn:"cancel-on.png",cancelPlace:"left",click:null,half:false,hintList:["bad","poor","regular","good","gorgeous"],noRatedMsg:"not rated yet",number:5,path:"img/",iconRange:[],readOnly:false,scoreName:"score",size:16,starHalf:"star-half.png",starOff:"star-off.png",starOn:"star-on.png",start:0,target:null,targetKeep:false,targetType:"hint",width:null};})(jQuery);



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

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

/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
* Licensed under the MIT License (LICENSE.txt).
*
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
* Thanks to: Seamus Leahy for adding deltaX and deltaY
*
* Version: 3.0.4
*
* Requires: 1.2.2+
*/

(function(d){function g(a){var b=a||window.event,i=[].slice.call(arguments,1),c=0,h=0,e=0;a=d.event.fix(b);a.type="mousewheel";if(a.wheelDelta)c=a.wheelDelta/120;if(a.detail)c=-a.detail/3;e=c;if(b.axis!==undefined&&b.axis===b.HORIZONTAL_AXIS){e=0;h=-1*c}if(b.wheelDeltaY!==undefined)e=b.wheelDeltaY/120;if(b.wheelDeltaX!==undefined)h=-1*b.wheelDeltaX/120;i.unshift(a,c,h,e);return d.event.handle.apply(this,i)}var f=["DOMMouseScroll","mousewheel"];d.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=
f.length;a;)this.addEventListener(f[--a],g,false);else this.onmousewheel=g},teardown:function(){if(this.removeEventListener)for(var a=f.length;a;)this.removeEventListener(f[--a],g,false);else this.onmousewheel=null}};d.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery);

/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2008 George McGinley Smith
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
*/

// t: current time, b: begInnIng value, c: change In value, d: duration
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('h.i[\'1a\']=h.i[\'z\'];h.O(h.i,{y:\'D\',z:9(x,t,b,c,d){6 h.i[h.i.y](x,t,b,c,d)},17:9(x,t,b,c,d){6 c*(t/=d)*t+b},D:9(x,t,b,c,d){6-c*(t/=d)*(t-2)+b},13:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t+b;6-c/2*((--t)*(t-2)-1)+b},X:9(x,t,b,c,d){6 c*(t/=d)*t*t+b},U:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t+1)+b},R:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t+b;6 c/2*((t-=2)*t*t+2)+b},N:9(x,t,b,c,d){6 c*(t/=d)*t*t*t+b},M:9(x,t,b,c,d){6-c*((t=t/d-1)*t*t*t-1)+b},L:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t+b;6-c/2*((t-=2)*t*t*t-2)+b},K:9(x,t,b,c,d){6 c*(t/=d)*t*t*t*t+b},J:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t*t*t+1)+b},I:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t*t+b;6 c/2*((t-=2)*t*t*t*t+2)+b},G:9(x,t,b,c,d){6-c*8.C(t/d*(8.g/2))+c+b},15:9(x,t,b,c,d){6 c*8.n(t/d*(8.g/2))+b},12:9(x,t,b,c,d){6-c/2*(8.C(8.g*t/d)-1)+b},Z:9(x,t,b,c,d){6(t==0)?b:c*8.j(2,10*(t/d-1))+b},Y:9(x,t,b,c,d){6(t==d)?b+c:c*(-8.j(2,-10*t/d)+1)+b},W:9(x,t,b,c,d){e(t==0)6 b;e(t==d)6 b+c;e((t/=d/2)<1)6 c/2*8.j(2,10*(t-1))+b;6 c/2*(-8.j(2,-10*--t)+2)+b},V:9(x,t,b,c,d){6-c*(8.o(1-(t/=d)*t)-1)+b},S:9(x,t,b,c,d){6 c*8.o(1-(t=t/d-1)*t)+b},Q:9(x,t,b,c,d){e((t/=d/2)<1)6-c/2*(8.o(1-t*t)-1)+b;6 c/2*(8.o(1-(t-=2)*t)+1)+b},P:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6-(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b},H:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6 a*8.j(2,-10*t)*8.n((t*d-s)*(2*8.g)/p)+c+b},T:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d/2)==2)6 b+c;e(!p)p=d*(.3*1.5);e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);e(t<1)6-.5*(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b;6 a*8.j(2,-10*(t-=1))*8.n((t*d-s)*(2*8.g)/p)*.5+c+b},F:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*(t/=d)*t*((s+1)*t-s)+b},E:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},16:9(x,t,b,c,d,s){e(s==u)s=1.l;e((t/=d/2)<1)6 c/2*(t*t*(((s*=(1.B))+1)*t-s))+b;6 c/2*((t-=2)*t*(((s*=(1.B))+1)*t+s)+2)+b},A:9(x,t,b,c,d){6 c-h.i.v(x,d-t,0,c,d)+b},v:9(x,t,b,c,d){e((t/=d)<(1/2.k)){6 c*(7.q*t*t)+b}m e(t<(2/2.k)){6 c*(7.q*(t-=(1.5/2.k))*t+.k)+b}m e(t<(2.5/2.k)){6 c*(7.q*(t-=(2.14/2.k))*t+.11)+b}m{6 c*(7.q*(t-=(2.18/2.k))*t+.19)+b}},1b:9(x,t,b,c,d){e(t<d/2)6 h.i.A(x,t*2,0,c,d)*.5+b;6 h.i.v(x,t*2-d,0,c,d)*.5+c*.5+b}});',62,74,'||||||return||Math|function|||||if|var|PI|jQuery|easing|pow|75|70158|else|sin|sqrt||5625|asin|||undefined|easeOutBounce|abs||def|swing|easeInBounce|525|cos|easeOutQuad|easeOutBack|easeInBack|easeInSine|easeOutElastic|easeInOutQuint|easeOutQuint|easeInQuint|easeInOutQuart|easeOutQuart|easeInQuart|extend|easeInElastic|easeInOutCirc|easeInOutCubic|easeOutCirc|easeInOutElastic|easeOutCubic|easeInCirc|easeInOutExpo|easeInCubic|easeOutExpo|easeInExpo||9375|easeInOutSine|easeInOutQuad|25|easeOutSine|easeInOutBack|easeInQuad|625|984375|jswing|easeInOutBounce'.split('|'),0,{}))

/*
 *
 * TERMS OF USE - EASING EQUATIONS
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2001 Robert Penner
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
 */
 
 /* ==========================================================
 * bootstrap-twipsy.js v1.4.0
 * http://twitter.github.com/bootstrap/javascript.html#twipsy
 * Adapted from the original jQuery.tipsy by Jason Frame
 * ==========================================================
 * Copyright 2011 Twitter, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ========================================================== */


!function( $ ) {

  "use strict"

 /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
  * ======================================================= */

  var transitionEnd

  $(document).ready(function () {

    $.support.transition = (function () {
      var thisBody = document.body || document.documentElement
        , thisStyle = thisBody.style
        , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
      return support
    })()

    // set CSS transition event type
    if ( $.support.transition ) {
      transitionEnd = "TransitionEnd"
      if ( $.browser.webkit ) {
      	transitionEnd = "webkitTransitionEnd"
      } else if ( $.browser.mozilla ) {
      	transitionEnd = "transitionend"
      } else if ( $.browser.opera ) {
      	transitionEnd = "oTransitionEnd"
      }
    }

  })


 /* TWIPSY PUBLIC CLASS DEFINITION
  * ============================== */

  var Twipsy = function ( element, options ) {
    this.$element = $(element)
    this.options = options
    this.enabled = true
    this.fixTitle()
  }

  Twipsy.prototype = {

    show: function() {
      var pos
        , actualWidth
        , actualHeight
        , placement
        , $tip
        , tp

      if (this.hasContent() && this.enabled) {
        $tip = this.tip()
        this.setContent()

        if (this.options.animate) {
          $tip.addClass('fade')
        }

        $tip
          .remove()
          .css({ top: 0, left: 0, display: 'block' })
          .prependTo(document.body)

        pos = $.extend({}, this.$element.offset(), {
          width: this.$element[0].offsetWidth
        , height: this.$element[0].offsetHeight
        })

        actualWidth = $tip[0].offsetWidth
        actualHeight = $tip[0].offsetHeight

        placement = maybeCall(this.options.placement, this, [ $tip[0], this.$element[0] ])

        switch (placement) {
          case 'below':
            tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}
            break
          case 'above':
            tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}
            break
          case 'left':
            tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset}
            break
          case 'right':
            tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset}
            break
        }

        $tip
          .css(tp)
          .addClass(placement)
          .addClass('in')
      }
    }

  , setContent: function () {
      var $tip = this.tip()
      $tip.find('.twipsy-inner')[this.options.html ? 'html' : 'text'](this.getTitle())
      $tip[0].className = 'twipsy'
    }

  , hide: function() {
      var that = this
        , $tip = this.tip()

      $tip.removeClass('in')

      function removeElement () {
        $tip.remove()
      }

      $.support.transition && this.$tip.hasClass('fade') ?
        $tip.bind(transitionEnd, removeElement) :
        removeElement()
    }

  , fixTitle: function() {
      var $e = this.$element
      if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
        $e.attr('data-original-title', $e.attr('title') || '').removeAttr('title')
      }
    }

  , hasContent: function () {
      return this.getTitle()
    }

  , getTitle: function() {
      var title
        , $e = this.$element
        , o = this.options

        this.fixTitle()

        if (typeof o.title == 'string') {
          title = $e.attr(o.title == 'title' ? 'data-original-title' : o.title)
        } else if (typeof o.title == 'function') {
          title = o.title.call($e[0])
        }

        title = ('' + title).replace(/(^\s*|\s*$)/, "")

        return title || o.fallback
    }

  , tip: function() {
      return this.$tip = this.$tip || $('<div class="twipsy" />').html(this.options.template)
    }

  , validate: function() {
      if (!this.$element[0].parentNode) {
        this.hide()
        this.$element = null
        this.options = null
      }
    }

  , enable: function() {
      this.enabled = true
    }

  , disable: function() {
      this.enabled = false
    }

  , toggleEnabled: function() {
      this.enabled = !this.enabled
    }

  , toggle: function () {
      this[this.tip().hasClass('in') ? 'hide' : 'show']()
    }

  }


 /* TWIPSY PRIVATE METHODS
  * ====================== */

   function maybeCall ( thing, ctx, args ) {
     return typeof thing == 'function' ? thing.apply(ctx, args) : thing
   }

 /* TWIPSY PLUGIN DEFINITION
  * ======================== */

  $.fn.twipsy = function (options) {
    $.fn.twipsy.initWith.call(this, options, Twipsy, 'twipsy')
    return this
  }

  $.fn.twipsy.initWith = function (options, Constructor, name) {
    var twipsy
      , binder
      , eventIn
      , eventOut

    if (options === true) {
      return this.data(name)
    } else if (typeof options == 'string') {
      twipsy = this.data(name)
      if (twipsy) {
        twipsy[options]()
      }
      return this
    }

    options = $.extend({}, $.fn[name].defaults, options)

    function get(ele) {
      var twipsy = $.data(ele, name)

      if (!twipsy) {
        twipsy = new Constructor(ele, $.fn.twipsy.elementOptions(ele, options))
        $.data(ele, name, twipsy)
      }

      return twipsy
    }

    function enter() {
      var twipsy = get(this)
      twipsy.hoverState = 'in'

      if (options.delayIn == 0) {
        twipsy.show()
      } else {
        twipsy.fixTitle()
        setTimeout(function() {
          if (twipsy.hoverState == 'in') {
            twipsy.show()
          }
        }, options.delayIn)
      }
    }

    function leave() {
      var twipsy = get(this)
      twipsy.hoverState = 'out'
      if (options.delayOut == 0) {
        twipsy.hide()
      } else {
        setTimeout(function() {
          if (twipsy.hoverState == 'out') {
            twipsy.hide()
          }
        }, options.delayOut)
      }
    }

    if (!options.live) {
      this.each(function() {
        get(this)
      })
    }

    if (options.trigger != 'manual') {
      binder   = options.live ? 'live' : 'bind'
      eventIn  = options.trigger == 'hover' ? 'mouseenter' : 'focus'
      eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur'
      this[binder](eventIn, enter)[binder](eventOut, leave)
    }

    return this
  }

  $.fn.twipsy.Twipsy = Twipsy

  $.fn.twipsy.defaults = {
    animate: true
  , delayIn: 0
  , delayOut: 0
  , fallback: ''
  , placement: 'above'
  , html: false
  , live: false
  , offset: 0
  , title: 'title'
  , trigger: 'hover'
  , template: '<div class="twipsy-arrow"></div><div class="twipsy-inner"></div>'
  }

  $.fn.twipsy.rejectAttrOptions = [ 'title' ]

  $.fn.twipsy.elementOptions = function(ele, options) {
    var data = $(ele).data()
      , rejects = $.fn.twipsy.rejectAttrOptions
      , i = rejects.length

    while (i--) {
      delete data[rejects[i]]
    }

    return $.extend({}, options, data)
  }

}( window.jQuery || window.ender );

/* ===========================================================
 * bootstrap-popover.js v1.4.0
 * http://twitter.github.com/bootstrap/javascript.html#popover
 * ===========================================================
 * Copyright 2011 Twitter, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =========================================================== */


!function( $ ) {

 "use strict"

  var Popover = function ( element, options ) {
    this.$element = $(element)
    this.options = options
    this.enabled = true
    this.fixTitle()
  }

  /* NOTE: POPOVER EXTENDS BOOTSTRAP-TWIPSY.js
     ========================================= */

  Popover.prototype = $.extend({}, $.fn.twipsy.Twipsy.prototype, {

    setContent: function () {
      var $tip = this.tip()
      $tip.find('.title')[this.options.html ? 'html' : 'text'](this.getTitle())
      $tip.find('.content p')[this.options.html ? 'html' : 'text'](this.getContent())
      $tip[0].className = 'popover'
    }

  , hasContent: function () {
      return this.getTitle() || this.getContent()
    }

  , getContent: function () {
      var content
       , $e = this.$element
       , o = this.options

      if (typeof this.options.content == 'string') {
        content = $e.attr(this.options.content)
      } else if (typeof this.options.content == 'function') {
        content = this.options.content.call(this.$element[0])
      }

      return content
    }

  , tip: function() {
      if (!this.$tip) {
        this.$tip = $('<div class="popover" />')
          .html(this.options.template)
      }
      return this.$tip
    }

  })


 /* POPOVER PLUGIN DEFINITION
  * ======================= */

  $.fn.popover = function (options) {
    if (typeof options == 'object') options = $.extend({}, $.fn.popover.defaults, options)
    $.fn.twipsy.initWith.call(this, options, Popover, 'popover')
    return this
  }

  $.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, {
    placement: 'right'
  , content: 'data-content'
  , template: '<div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div>'
  })

  $.fn.twipsy.rejectAttrOptions.push( 'content' )

}( window.jQuery || window.ender );


/*
 * HTML5 Forms Chapter JavaScript Library
 * http://thecssninja.com/javascript/H5F
 *
 * Copyright (c) 2010-2011 Ryan Seddon - http://thecssninja.com/
 * Dual-licensed under the BSD and MIT licenses.
 * http://thecssninja.com/H5F/license.txt
 */
var H5F=H5F||{};(function(d){var field=d.createElement("input"),emailPatt=/^[a-z0-9_.%+\-]+@[0-9a-z.\-]+\.[a-z.]{2,6}$/i,urlPatt=/[a-z][\-\.+a-z]*:\/\//i,nodes=/^(input|select|textarea)$/i,isSubmit,usrPatt,curEvt,args,custMsg="",setup,validation,validity,checkField,checkValidity,setCustomValidity,support,pattern,placeholder,range,required,valueMissing,listen,unlisten,preventActions,getTarget,addClass,removeClass,isHostMethod;setup=function(form,settings){var isCollection=!form.nodeType||false;var opts={validClass:"valid",invalidClass:"error",requiredClass:"required",placeholderClass:"placeholder"};if(typeof settings=="object"){for(var i in opts){if(typeof settings[i]=="undefined"){settings[i]=opts[i];}}}
args=settings||opts;if(isCollection){for(var k=0,len=form.length;k<len;k++){validation(form[k]);}}else{validation(form);}};validation=function(form){var f=form.elements,flen=f.length,isRequired,noValidate=!!(form.attributes["novalidate"]);listen(form,"invalid",checkField,true);listen(form,"blur",checkField,true);listen(form,"input",checkField,true);listen(form,"keyup",checkField,true);listen(form,"focus",checkField,true);listen(form,"submit",function(e){isSubmit=true;if(!noValidate&&!form.checkValidity()){preventActions(e);}},false);if(!support()){form.checkValidity=function(){return checkValidity(form);};while(flen--){isRequired=!!(f[flen].attributes["required"]);if(f[flen].nodeName!=="FIELDSET"){validity(f[flen]);}}}};validity=function(el){var elem=el,missing=valueMissing(elem),attrs={type:elem.getAttribute("type"),pattern:elem.getAttribute("pattern"),placeholder:elem.getAttribute("placeholder")},isType=/^(email|url)$/i,evt=/^(input|keyup)$/i,fType=((isType.test(attrs.type))?attrs.type:((attrs.pattern)?attrs.pattern:false)),patt=pattern(elem,fType),step=range(elem,"step"),min=range(elem,"min"),max=range(elem,"max"),customError=(custMsg!=="");elem.checkValidity=function(){return checkValidity.call(this,elem);};elem.setCustomValidity=function(msg){setCustomValidity.call(elem,msg);};elem.validationMessage=custMsg;elem.validity={valueMissing:missing,patternMismatch:patt,rangeUnderflow:min,rangeOverflow:max,stepMismatch:step,customError:customError,valid:(!missing&&!patt&&!step&&!min&&!max&&!customError)};if(attrs.placeholder&&!evt.test(curEvt)){placeholder(elem);}};checkField=function(e){var el=getTarget(e)||e,events=/^(input|keyup|focusin|focus)$/i,ignoredTypes=/^(submit|image|button|reset)$/i,checkForm=true;if(nodes.test(el.nodeName)&&!(ignoredTypes.test(el.type)||ignoredTypes.test(el.nodeName))){curEvt=e.type;if(!support()){validity(el);}
if(el.validity.valid){removeClass(el,[args.invalidClass,args.requiredClass]);addClass(el,args.validClass);}else if(!events.test(curEvt)){if(el.validity.valueMissing){removeClass(el,[args.invalidClass,args.validClass]);addClass(el,args.requiredClass);}else{removeClass(el,[args.validClass,args.requiredClass]);addClass(el,args.invalidClass);}}else if(el.validity.valueMissing){removeClass(el,[args.requiredClass,args.invalidClass,args.validClass]);}
if(curEvt==="input"&&checkForm){unlisten(el.form,"keyup",checkField,true);checkForm=false;}}};checkValidity=function(el){var f,ff,isRequired,hasPattern,invalid=false;if(el.nodeName==="FORM"){f=el.elements;for(var i=0,len=f.length;i<len;i++){ff=f[i];isRequired=!!(ff.attributes["required"]);hasPattern=!!(ff.attributes["pattern"]);if(ff.nodeName!=="FIELDSET"&&(isRequired||hasPattern&&isRequired)){checkField(ff);if(!ff.validity.valid&&!invalid){if(isSubmit){ff.focus();}
invalid=true;}}}
return!invalid;}else{checkField(el);return el.validity.valid;}};setCustomValidity=function(msg){var el=this;custMsg=msg;el.validationMessage=custMsg;};support=function(){return(isHostMethod(field,"validity")&&isHostMethod(field,"checkValidity"));};pattern=function(el,type){if(type==="email"){return!emailPatt.test(el.value);}else if(type==="url"){return!urlPatt.test(el.value);}else if(!type){return false;}else{var placeholder=el.getAttribute("placeholder"),val=el.value;usrPatt=new RegExp('^(?:'+type+')$');if(val===placeholder){return true;}else if(val===""){return false;}else{return!usrPatt.test(el.value);}}};placeholder=function(el){var attrs={placeholder:el.getAttribute("placeholder")},focus=/^(focus|focusin|submit)$/i,node=/^(input|textarea)$/i,ignoredType=/^password$/i,isNative=!!("placeholder"in field);if(!isNative&&node.test(el.nodeName)&&!ignoredType.test(el.type)){if(el.value===""&&!focus.test(curEvt)){el.value=attrs.placeholder;listen(el.form,'submit',function(){curEvt='submit';placeholder(el);},true);addClass(el,args.placeholderClass);}else if(el.value===attrs.placeholder&&focus.test(curEvt)){el.value="";removeClass(el,args.placeholderClass);}}};range=function(el,type){var min=parseInt(el.getAttribute("min"),10)||0,max=parseInt(el.getAttribute("max"),10)||false,step=parseInt(el.getAttribute("step"),10)||1,val=parseInt(el.value,10),mismatch=(val-min)%step;if(!valueMissing(el)&&!isNaN(val)){if(type==="step"){return(el.getAttribute("step"))?(mismatch!==0):false;}else if(type==="min"){return(el.getAttribute("min"))?(val<min):false;}else if(type==="max"){return(el.getAttribute("max"))?(val>max):false;}}else if(el.getAttribute("type")==="number"){return true;}else{return false;}};required=function(el){var required=!!(el.attributes["required"]);return(required)?valueMissing(el):false;};valueMissing=function(el){var placeholder=el.getAttribute("placeholder"),isRequired=!!(el.attributes["required"]);return!!(isRequired&&(el.value===""||el.value===placeholder));};listen=function(node,type,fn,capture){if(isHostMethod(window,"addEventListener")){node.addEventListener(type,fn,capture);}else if(isHostMethod(window,"attachEvent")&&typeof window.event!=="undefined"){if(type==="blur"){type="focusout";}else if(type==="focus"){type="focusin";}
node.attachEvent("on"+type,fn);}};unlisten=function(node,type,fn,capture){if(isHostMethod(window,"removeEventListener")){node.removeEventListener(type,fn,capture);}else if(isHostMethod(window,"detachEvent")&&typeof window.event!=="undefined"){node.detachEvent("on"+type,fn);}};preventActions=function(evt){evt=evt||window.event;if(evt.stopPropagation&&evt.preventDefault){evt.stopPropagation();evt.preventDefault();}else{evt.cancelBubble=true;evt.returnValue=false;}};getTarget=function(evt){evt=evt||window.event;return evt.target||evt.srcElement;};addClass=function(e,c){var re;if(!e.className){e.className=c;}
else{re=new RegExp('(^|\\s)'+c+'(\\s|$)');if(!re.test(e.className)){e.className+=' '+c;}}};removeClass=function(e,c){var re,m,arr=(typeof c==="object")?c.length:1,len=arr;if(e.className){if(e.className==c){e.className='';}
else{while(arr--){re=new RegExp('(^|\\s)'+((len>1)?c[arr]:c)+'(\\s|$)');m=e.className.match(re);if(m&&m.length==3){e.className=e.className.replace(re,(m[1]&&m[2])?' ':'');}}}}};isHostMethod=function(o,m){var t=typeof o[m],reFeaturedMethod=new RegExp('^function|object$','i');return!!((reFeaturedMethod.test(t)&&o[m])||t=='unknown');};window["H5F"]={setup:setup};})(document);
