;/*	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}}}}();;function Lvl_openWin(u,n,w,h,l,t,c,f,x) 
{
	var ww=((screen.width-w)/2);
	if(c==1)
	{
		l=ww;
		t=(screen.height-h)/2;
	}
	if(c==2)
	{
		l=ww
	}
	f+=',top='+t+',left='+l;
	LvlWin = window.open(u,n,f);
	if(x==1)
	{
		LvlWin.focus()
	}
	document.MM_returnValue=false;
}
function checkFormFocus(e, f) {
	if(window.event) // IE
		keynum = e.keyCode
	else if(e.which) // Netscape/Firefox/Opera
		keynum = e.which
	
	if(keynum == 13) {
		document.forms[f].submit();
		return true;
	}
	return true;
}
function getWindowWidth(){
	if(window.innerWidth) return window.innerWidth;
	if(document.documentElement && document.documentElement.clientWidth){
		return document.documentElement.clientWidth;
	}
	else if(document.body && document.body.clientWidth){
		return document.body.clientWidth;
	}
	return 0;
}

function getWindowHeight(){
	if(window.innerHeight) return window.innerHeight;
	if(document.documentElement && document.documentElement.clientHeight){
		return document.documentElement.clientHeight;
	}
	else if(document.body && document.body.clientHeight){
	return document.body.clientHeight;
	}
	return 0;
}
// VIDEOPLAYER FUNCTIONS
function openWinPlayer(u,n,w,h,l,t,c,f,x) {
	var ww=((screen.width-w)/2);
	if(c==1)
	{
		l=ww;
		t=(screen.height-h)/2;
	}
	if(c==2)
	{
		l=ww
	}
	f += ',top ='+t+',left='+l;
	LvlWin = window.open(u,n,f);
	if(x==1)
	{
		LvlWin.focus()
	}
	// hack Syrous 
	LvlWin.resizeTo(w, h);
	if(c==1)
	{
		var bw = (screen.width-w)/2;
		var bh = (screen.height-h)/2;
		LvlWin.moveTo(bw, bh);
	}
	document.MM_returnValue=false;
}
function open_player(video_id) {
	var width=screen.availWidth;
	var height=screen.availHeight;
	// Case kleiner gleich 1024 ffnet PLayer Fullscreen mit der vorhanden Screengre
	if(width<=1024)
	{
		openWinPlayer('videoplayer-' + video_id + ".htm",'v2b_videoplayer',width,height,'0','0','1','width=' + width + ',height=' + height,'1');	
	}
	// Case grer 1024 und kleiner gleich 1280
	else if ((width > 1024) && (width <= 1280))
	{
		width = 1058;
		height = 770;
	}
	// Case grer 1280 und kleiner gleich 1280
	else if (width > 1280)
	{
		width = 1306;
		height = 855;
	}
	openWinPlayer('videoplayer-' + video_id + ".htm",'v2b_videoplayer',width,height,'0','0','1','width=' + width + ',height=' + height, '1');	
}
function open_mct(mct_id) {
	var width=screen.availWidth;
	var height=screen.availHeight;
	// Case kleiner gleich 1024 ffnet PLayer Fullscreen mit der vorhanden Screengre
	if(width<=1024)
	{
		openWinPlayer('mctplayer.cfm?mct_id=' + mct_id,'v2b_mctplayer',width,height,'0','0','1','width=' + width + ',height=' + height,'1');	
	}
	// Case grer 1024 und kleiner gleich 1280
	else if ((width > 1024) && (width <= 1280))
	{
		width = 1058;
		height = 770;
	}
	// Case grer 1280 und kleiner gleich 1280
	else if (width > 1280)
	{
		width = 1306;
		height = 855;
	}
	openWinPlayer('mctplayer.cfm?mct_id=' + mct_id,'v2b_mctplayer',width,height,'0','0','1','width=' + width + ',height=' + height, '1');	
}
function resizePlayer(){
	var width=screen.availWidth;
	var height=screen.availHeight;
	var bw = 0;
	var bh = 0;
	window.moveTo(bw, bh);
	window.resizeTo(width, height);
}
function resetPlayer()
{
	var width=screen.availWidth;
	var height=screen.availHeight;
	// Case kleiner gleich 1024 ffnet PLayer Fullscreen mit der vorhanden Screengre
	if(width<=1024)
	{
		width = 1024;
	}
	// Case grer 1024 und kleiner gleich 1280
	else if ((width > 1024) && (width <= 1280))
	{
		width = 1058;
		height = 770;
	}
	// Case grer 1280 und kleiner gleich 1280
	else if (width > 1280)
	{
		width = 1306;
		height = 855;
	}
	window.resizeTo(width, height);
	var bw = (screen.width - width)/2;
	var bh = (screen.height - height)/2;
	window.moveTo(bw, bh);	
}

//---------------------------------------------------------------------------------------------------------------
function goToTop()
{		
	if(document.documentElement.scrollTop != "undefined" && document.documentElement.scrollTop != 0)
	{
		document.documentElement.scrollTop = 0;
	}
	else
	{
		if(document.body.scrollTop != "undefined" && document.body.scrollTop != 0)
			document.body.scrollTop = 0;
	}	
}

//---------------------------------------------------------------------------------------------------------------
function addArticle(product_id) 
{
	var params = new Object(); 
	params.product_id = product_id;
	new Ajax.Request("custom/modules/shop/shop_ajax.cfc?method=addArticleAJAX", {
		method: 'post',
		parameters : params,
		onSuccess: function(transport) {
			var numProducts = transport.responseText.evalJSON();
			
			var cart_data_span = $("cart_data");
			var cart_label_span = $("cart_label");
			if(numProducts > 0)
			{
				cart_data_span.innerHTML = "(" + numProducts + ")";
				cart_label_span.style.fontWeight = "bold";
			}
			else
			{
				cart_data_span.innerHTML = "";	
				cart_label_span.style.fontWeight = "normal";
			}
		}
	});
}

//---------------------------------------------------------------------------------------------------------------
function videoplayerCallback(action, id) 
{
	// console.log("action: " + action + ", id: " + id);
}

//---------------------------------------------------------------------------------------------------------------
function isMobileBrowser(a){if(/android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))){return true}else{return false}}



;/**
 * Copy the value of an input field's title attribute to its value attribute.
 * Clear the input field on focus if its value is the same as its title.
 * Repopulate the input field on blur if it is empty.
 * Hide the input field's associated label if it has one.
 */
var autoPopulate = {
	sInputClass:'populate', // Class name for input elements to autopopulate
	sHiddenClass:'structural', // Class name that gets assigned to hidden label elements
	bHideLabels:true, // If true, labels are hidden
	/**
	 * Main function
	 */
	init:function() {
		// Check for DOM support
		if (!document.getElementById || !document.createTextNode) {return;}
		// Find all input elements with the given className
		var arrInputs = autoPopulate.getElementsByClassName(document, 'input', autoPopulate.sInputClass);
		var iInputs = arrInputs.length;
		var oInput;
		for (var i=0; i<iInputs; i++) {
			oInput = arrInputs[i];
			// Make sure it's a text input
			if (oInput.type != 'text') { continue; }
			// Hide the input's label
			if (autoPopulate.bHideLabels) { autoPopulate.hideLabel(oInput.id); }
			// If value is empty and title is not, assign title to value
			if ((oInput.value == '') && (oInput.title != '')) { oInput.value = oInput.title; }
			// Add event handlers for focus and blur
			autoPopulate.addEvent(oInput, 'focus', function() {
				// If value and title are equal on focus, clear value
				if (this.value == this.title) {
					this.value = '';
					this.select(); // Make input caret visible in IE
				}
			});
			autoPopulate.addEvent(oInput, 'blur', function() {
				// If the field is empty on blur, assign title to value
				if (!this.value.length) { this.value = this.title; }
			});
		}
	},
	hideLabel:function(sId) {
		var arrLabels = document.getElementsByTagName('label');
		var iLabels = arrLabels.length;
		var oLabel;
		for (var i=0; i<iLabels; i++) {
			oLabel = arrLabels[i];
			if (oLabel.htmlFor == sId) {
				oLabel.className = oLabel.className + ' ' + autoPopulate.sHiddenClass;
			}
		}
	},
	/**
	 * getElementsByClassName function included here for portability.
	 * Remove if you are already using one.
	 * Written by Jonathan Snook, http://www.snook.ca/jonathan
	 * Add-ons by Robert Nyman, http://www.robertnyman.com
	 */
	getElementsByClassName:function(oElm, strTagName, strClassName) {
	    var arrElements = (strTagName == "*" && document.all)? document.all : oElm.getElementsByTagName(strTagName);
	    var arrReturnElements = new Array();
	    strClassName = strClassName.replace(/\-/g, "\\-");
	    var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
	    var oElement;
	    for(var i=0; i<arrElements.length; i++){
	        oElement = arrElements[i];      
	        if(oRegExp.test(oElement.className)){
	            arrReturnElements.push(oElement);
	        }   
	    }
	    return (arrReturnElements)
	},
	/**
	 * addEvent function included here for portability.
	 * Remove if you are already using an addEvent/DOMReady function.
	 * Found at http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html
	 */
	addEvent:function(obj, type, fn) {
		if (obj.addEventListener)
			obj.addEventListener(type, fn, false);
		else if (obj.attachEvent) {
			obj["e"+type+fn] = fn;
			obj[type+fn] = function() {obj["e"+type+fn](window.event);}
			obj.attachEvent("on"+type, obj[type+fn]);
		}
	}
};

/**
 * Init on window load.
 * Replace this with a call to your own addEvent/DOMReady function if you use one.
 */
autoPopulate.addEvent(window, 'load', autoPopulate.init);;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}('G Y={6Q:\'1.6.0.2\',1w:{2N:!!(1i.5J&&!1i.6R),3J:!!1i.6R,3j:3K.3L.2O(\'bp/\')>-1,5K:3K.3L.2O(\'5K\')>-1&&3K.3L.2O(\'8A\')==-1,8B:!!3K.3L.1k(/bq.*br.*8C/)},2P:{5L:!!V.2b,4R:!!1i.4S,5M:V.2Q(\'2k\').3M&&V.2Q(\'2k\').3M!==V.2Q(\'6S\').3M},5N:\'<4T[^>]*>([\\\\S\\\\s]*?)<\\/4T>\',8D:/^\\/\\*-bs-([\\s\\S]*)\\*\\/\\s*$/,2q:q(){},K:q(x){o x}};E(Y.1w.8B)Y.2P.5M=1d;G 1E={1L:q(){G a=17,4U=$A(1c);E(J.1M(4U[0]))a=4U.3N();q 2r(){C.22.2B(C,1c)}J.U(2r,1E.W);2r.6T=a;2r.8E=[];E(a){G b=q(){};b.18=a.18;2r.18=1e b;a.8E.14(2r)}N(G i=0;i<4U.M;i++)2r.4V(4U[i]);E(!2r.18.22)2r.18.22=Y.2q;2r.18.bt=2r;o 2r}};1E.W={4V:q(a){G b=C.6T&&C.6T.18;G c=J.4g(a);E(!J.4g({24:1f}).M)c.14("24","8F");N(G i=0,M=c.M;i<M;i++){G d=c[i],1g=a[d];E(b&&J.1M(1g)&&1g.8G().2C()=="$2Y"){G e=1g,1g=J.U((q(m){o q(){o b[m].2B(C,1c)}})(d).3O(e),{8F:q(){o e},24:q(){o e.24()}})}C.18[d]=1g}o C}};G 3P={};J.U=q(a,b){N(G c 1s b)a[c]=b[c];o a};J.U(J,{1W:q(a){1N{E(J.1X(a))o\'3k\';E(a===17)o\'17\';o a.1W?a.1W():1B(a)}1Y(e){E(e 8H bu)o\'...\';3l e;}},2s:q(a){G b=2R a;4h(b){1O\'3k\':1O\'q\':1O\'bv\':o;1O\'bw\':o a.24()}E(a===17)o\'17\';E(a.2s)o a.2s();E(J.2Z(a))o;G c=[];N(G d 1s a){G e=J.2s(a[d]);E(!J.1X(e))c.14(d.2s()+\': \'+e)}o\'{\'+c.1P(\', \')+\'}\'},3m:q(a){o $H(a).3m()},31:q(a){o a&&a.31?a.31():1B.4i(a)},4g:q(a){G b=[];N(G c 1s a)b.14(c);o b},25:q(a){G b=[];N(G c 1s a)b.14(a[c]);o b},1Z:q(a){o J.U({},a)},2Z:q(a){o a&&a.2t==1},3n:q(a){o a!=17&&2R a=="2D"&&\'bx\'1s a&&\'1P\'1s a},6U:q(a){o a 8H 2S},1M:q(a){o 2R a=="q"},2l:q(a){o 2R a=="5O"},3Q:q(a){o 2R a=="by"},1X:q(a){o 2R a=="3k"}});J.U(6V.18,{8G:q(){G a=C.24().1k(/^[\\s\\(]*q[^(]*\\((.*?)\\)/)[1].32(",").5P("2T");o a.M==1&&!a[0]?[]:a},1o:q(){E(1c.M<2&&J.1X(1c[0]))o C;G a=C,2c=$A(1c),2D=2c.3N();o q(){o a.2B(2D,2c.1z($A(1c)))}},bz:q(){G b=C,2c=$A(1c),2D=2c.3N();o q(a){o b.2B(2D,[a||1i.bA].1z(2c))}},5Q:q(){E(!1c.M)o C;G a=C,2c=$A(1c);o q(){o a.2B(C,2c.1z($A(1c)))}},6W:q(){G a=C,2c=$A(1c),8I=2c.3N()*8J;o 1i.bB(q(){o a.2B(a,2c)},8I)},3O:q(a){G b=C;o q(){o a.2B(C,[b.1o(C)].1z($A(1c)))}},3o:q(){E(C.6X)o C.6X;G a=C;o C.6X=q(){o a.2B(17,[C].1z($A(1c)))}}});6V.18.3p=6V.18.6W.5Q(0.bC);bD.18.2s=q(){o\'"\'+C.bE()+\'-\'+(C.bF()+1).3q(2)+\'-\'+C.bG().3q(2)+\'T\'+C.bH().3q(2)+\':\'+C.bI().3q(2)+\':\'+C.bJ().3q(2)+\'Z"\'};G 8K={8L:q(){G a;N(G i=0,M=1c.M;i<M;i++){G b=1c[i];1N{a=b();1F}1Y(e){}}o a}};3a.18.1k=3a.18.2d;3a.8M=q(a){o 1B(a).1x(/([.*+?^=!:${}()|[\\]\\/\\\\])/g,\'\\\\$1\')};G 8N=1E.1L({22:q(a,b){C.4W=a;C.4X=b;C.5R=1d;C.4Y()},4Y:q(){C.4j=8O(C.4Z.1o(C),C.4X*8J)},6Y:q(){C.4W(C)},6Z:q(){E(!C.4j)o;8P(C.4j);C.4j=17},4Z:q(){E(!C.5R){1N{C.5R=1f;C.6Y()}bK{C.5R=1d}}}});J.U(1B,{4i:q(a){o a==17?\'\':1B(a)},8Q:{\'\\b\':\'\\\\b\',\'\\t\':\'\\\\t\',\'\\n\':\'\\\\n\',\'\\f\':\'\\\\f\',\'\\r\':\'\\\\r\',\'\\\\\':\'\\\\\\\\\'}});J.U(1B.18,{2m:q(a,b){G c=\'\',3r=C,1k;b=1c.4k.70(b);1q(3r.M>0){E(1k=3r.1k(a)){c+=3r.3s(0,1k.50);c+=1B.4i(b(1k));3r=3r.3s(1k.50+1k[0].M)}19{c+=3r,3r=\'\'}}o c},8R:q(b,c,d){c=C.2m.70(c);d=J.1X(d)?1:d;o C.2m(b,q(a){E(--d<0)o a[0];o c(a)})},8S:q(a,b){C.2m(a,b);o 1B(C)},bL:q(a,b){a=a||30;b=J.1X(b)?\'...\':b;o C.M>a?C.3s(0,a-b.M)+b:1B(C)},2T:q(){o C.1x(/^\\s+/,\'\').1x(/\\s+$/,\'\')},8T:q(){o C.1x(/<\\/?[^>]+>/8U,\'\')},3b:q(){o C.1x(1e 3a(Y.5N,\'8V\'),\'\')},8W:q(){G b=1e 3a(Y.5N,\'8V\');G c=1e 3a(Y.5N,\'bM\');o(C.1k(b)||[]).2e(q(a){o(a.1k(c)||[\'\',\'\'])[1]})},3R:q(){o C.8W().2e(q(a){o 5S(a)})},5T:q(){G a=1c.4k;a.2U.bN=C;o a.2k.3t},8X:q(){G c=1e I(\'2k\');c.3t=C.8T();o c.2o[0]?(c.2o.M>1?$A(c.2o).2E(\'\',q(a,b){o a+b.71}):c.2o[0].71):\'\'},5U:q(e){G f=C.2T().1k(/([^?#]*)(#.*)?$/);E(!f)o{};o f[1].32(e||\'&\').2E({},q(a,b){E((b=b.32(\'=\'))[0]){G c=72(b.3N());G d=b.M>1?b.1P(\'=\'):b[0];E(d!=3k)d=72(d);E(c 1s a){E(!J.3n(a[c]))a[c]=[a[c]];a[c].14(d)}19 a[c]=d}o a})},2u:q(){o C.32(\'\')},73:q(){o C.3s(0,C.M-1)+1B.bO(C.8Y(C.M-1)+1)},5V:q(a){o a<1?\'\':1e 1I(a+1).1P(C)},74:q(){G a=C.32(\'-\'),75=a.M;E(75==1)o a[0];G b=C.5W(0)==\'-\'?a[0].5W(0).2f()+a[0].4l(1):a[0];N(G i=1;i<75;i++)b+=a[i].5W(0).2f()+a[i].4l(1);o b},51:q(){o C.5W(0).2f()+C.4l(1).1G()},bP:q(){o C.2m(/::/,\'/\').2m(/([A-Z]+)([A-Z][a-z])/,\'#{1}52#{2}\').2m(/([a-z\\d])([A-Z])/,\'#{1}52#{2}\').2m(/-/,\'52\').1G()},bQ:q(){o C.2m(/52/,\'-\')},1W:q(c){G d=C.2m(/[\\bR-\\bS\\\\]/,q(a){G b=1B.8Q[a[0]];o b?b:\'\\\\bT\'+a[0].8Y().3q(2,16)});E(c)o\'"\'+d.1x(/"/g,\'\\\\"\')+\'"\';o"\'"+d.1x(/\'/g,\'\\\\\\\'\')+"\'"},2s:q(){o C.1W(1f)},76:q(a){o C.8R(a||Y.8D,\'#{1}\')},8Z:q(){G a=C;E(a.3S())o 1d;a=C.1x(/\\\\./g,\'@\').1x(/"[^"\\\\\\n\\r]*"/g,\'\');o(/^[,:{}\\[\\]0-9.\\-+bU-u \\n\\r\\t]*$/).2d(a)},4m:q(a){G b=C.76();1N{E(!a||b.8Z())o 5S(\'(\'+b+\')\')}1Y(e){}3l 1e bV(\'bW bX 90 5O: \'+C.1W());},1p:q(a){o C.2O(a)>-1},77:q(a){o C.2O(a)===0},91:q(a){G d=C.M-a.M;o d>=0&&C.78(a)===d},4n:q(){o C==\'\'},3S:q(){o/^\\s*$/.2d(C)},92:q(a,b){o 1e 2g(C,b).2b(a)}});E(Y.1w.3j||Y.1w.2N)J.U(1B.18,{5T:q(){o C.1x(/&/g,\'&93;\').1x(/</g,\'&94;\').1x(/>/g,\'&95;\')},8X:q(){o C.1x(/&93;/g,\'&\').1x(/&94;/g,\'<\').1x(/&95;/g,\'>\')}});1B.18.2m.70=q(b){E(J.1M(b))o b;G c=1e 2g(b);o q(a){o c.2b(a)}};1B.18.bY=1B.18.5U;J.U(1B.18.5T,{2k:V.2Q(\'2k\'),2U:V.96(\'\')});97(1B.18.5T)2k.4o(2U);G 2g=1E.1L({22:q(a,b){C.98=a.24();C.99=b||2g.9a},2b:q(f){E(J.1M(f.79))f=f.79();o C.98.2m(C.99,q(a){E(f==17)o\'\';G b=a[1]||\'\';E(b==\'\\\\\')o a[2];G c=f,53=a[3];G d=/^([^.[]+|\\[((?:.*?[^\\\\])?)\\])(\\.|\\[|$)/;a=d.9b(53);E(a==17)o b;1q(a!=17){G e=a[1].77(\'[\')?a[2].2m(\'\\\\\\\\]\',\']\'):a[1];c=c[e];E(17==c||\'\'==a[3])1F;53=53.4l(\'[\'==a[3]?a[1].M:a[0].M);a=d.9b(53)}o b+1B.4i(c)})}});2g.9a=/(^|.|\\r|\\n)(#\\{(.*?)\\})/;G $1F={};G 26={1l:q(b,c){G d=0;b=b.1o(c);1N{C.3c(q(a){b(a,d++)})}1Y(e){E(e!=$1F)3l e;}o C},9c:q(a,b,c){b=b?b.1o(c):Y.K;G d=-a,7a=[],7b=C.2u();1q((d+=a)<7b.M)7a.14(7b.3s(d,d+a));o 7a.7c(b,c)},7d:q(c,d){c=c?c.1o(d):Y.K;G e=1f;C.1l(q(a,b){e=e&&!!c(a,b);E(!e)3l $1F;});o e},9d:q(c,d){c=c?c.1o(d):Y.K;G e=1d;C.1l(q(a,b){E(e=!!c(a,b))3l $1F;});o e},7c:q(c,d){c=c?c.1o(d):Y.K;G e=[];C.1l(q(a,b){e.14(c(a,b))});o e},5X:q(c,d){c=c.1o(d);G e;C.1l(q(a,b){E(c(a,b)){e=a;3l $1F;}});o e},4p:q(c,d){c=c.1o(d);G e=[];C.1l(q(a,b){E(c(a,b))e.14(a)});o e},bZ:q(c,d,e){d=d?d.1o(e):Y.K;G f=[];E(J.2l(c))c=1e 3a(c);C.1l(q(a,b){E(c.1k(a))f.14(d(a,b))});o f},1p:q(b){E(J.1M(C.2O))E(C.2O(b)!=-1)o 1f;G c=1d;C.1l(q(a){E(a==b){c=1f;3l $1F;}});o c},c0:q(b,c){c=J.1X(c)?17:c;o C.9c(b,q(a){1q(a.M<b)a.14(c);o a})},2E:q(c,d,e){d=d.1o(e);C.1l(q(a,b){c=d(c,a,b)});o c},5P:q(b){G c=$A(1c).3s(1);o C.2e(q(a){o a[b].2B(a,c)})},c1:q(c,d){c=c?c.1o(d):Y.K;G e;C.1l(q(a,b){a=c(a,b);E(e==17||a>=e)e=a});o e},c2:q(c,d){c=c?c.1o(d):Y.K;G e;C.1l(q(a,b){a=c(a,b);E(e==17||a<e)e=a});o e},c3:q(c,d){c=c?c.1o(d):Y.K;G e=[],7e=[];C.1l(q(a,b){(c(a,b)?e:7e).14(a)});o[e,7e]},4q:q(b){G c=[];C.1l(q(a){c.14(a[b])});o c},c4:q(c,d){c=c.1o(d);G e=[];C.1l(q(a,b){E(!c(a,b))e.14(a)});o e},9e:q(e,f){e=e.1o(f);o C.2e(q(a,b){o{1g:a,54:e(a,b)}}).c5(q(c,d){G a=c.54,b=d.54;o a<b?-1:a>b?1:0}).4q(\'1g\')},2u:q(){o C.2e()},c6:q(){G c=Y.K,2c=$A(1c);E(J.1M(2c.1Q()))c=2c.c7();G d=[C].1z(2c).2e($A);o C.2e(q(a,b){o c(d.4q(b))})},9f:q(){o C.2u().M},1W:q(){o\'#<26:\'+C.2u().1W()+\'>\'}};J.U(26,{2e:26.7c,7f:26.5X,20:26.4p,4r:26.4p,c8:26.1p,c9:26.2u,ca:26.7d,cb:26.9d});q $A(a){E(!a)o[];E(a.2u)o a.2u();G b=a.M||0,15=1e 1I(b);1q(b--)15[b]=a[b];o 15}E(Y.1w.3j){$A=q(a){E(!a)o[];E(!(J.1M(a)&&a==\'[2D cc]\')&&a.2u)o a.2u();G b=a.M||0,15=1e 1I(b);1q(b--)15[b]=a[b];o 15}}1I.9g=$A;J.U(1I.18,26);E(!1I.18.7g)1I.18.7g=1I.18.55;J.U(1I.18,{3c:q(a){N(G i=0,M=C.M;i<M;i++)a(C[i])},9h:q(){C.M=0;o C},2C:q(){o C[0]},1Q:q(){o C[C.M-1]},cd:q(){o C.20(q(a){o a!=17})},9i:q(){o C.2E([],q(a,b){o a.1z(J.3n(b)?b.9i():[b])})},56:q(){G b=$A(1c);o C.20(q(a){o!b.1p(a)})},55:q(a){o(a!==1d?C:C.2u()).7g()},ce:q(){o C.M>1?C:C[0]},9j:q(d){o C.2E([],q(a,b,c){E(0==c||(d?a.1Q()!=b:!a.1p(b)))a.14(b);o a})},cf:q(c){o C.9j().4p(q(b){o c.5X(q(a){o b===a})})},1Z:q(){o[].1z(C)},9f:q(){o C.M},1W:q(){o\'[\'+C.2e(J.1W).1P(\', \')+\']\'},2s:q(){G c=[];C.1l(q(a){G b=J.2s(a);E(!J.1X(b))c.14(b)});o\'[\'+c.1P(\', \')+\']\'}});E(J.1M(1I.18.9k))1I.18.3c=1I.18.9k;E(!1I.18.2O)1I.18.2O=q(a,i){i||(i=0);G b=C.M;E(i<0)i=b+i;N(;i<b;i++)E(C[i]===a)o i;o-1};E(!1I.18.78)1I.18.78=q(a,i){i=cg(i)?C.M:(i<0?C.M+i:i)+1;G n=C.3s(0,i).55().2O(a);o(n<0)?n:i-n-1};1I.18.2u=1I.18.1Z;q $w(a){E(!J.2l(a))o[];a=a.2T();o a?a.32(/\\s+/):[]}E(Y.1w.3J){1I.18.1z=q(){G a=[];N(G i=0,M=C.M;i<M;i++)a.14(C[i]);N(G i=0,M=1c.M;i<M;i++){E(J.3n(1c[i])){N(G j=0,9l=1c[i].M;j<9l;j++)a.14(1c[i][j])}19{a.14(1c[i])}}o a}}J.U(3T.18,{ch:q(){o C.3q(2,16)},73:q(){o C+1},5V:q(a){$R(0,C,1f).1l(a);o C},3q:q(a,b){G c=C.24(b||10);o\'0\'.5V(a-c.M)+c},2s:q(){o ci(C)?C.24():\'17\'}});$w(\'cj ck cl cm\').1l(q(a){3T.18[a]=co[a].3o()});q $H(a){o 1e 2S(a)};G 2S=1E.1L(26,(q(){q 7h(a,b){E(J.1X(b))o a;o a+\'=\'+9m(1B.4i(b))}o{22:q(a){C.3u=J.6U(a)?a.57():J.1Z(a)},3c:q(a){N(G b 1s C.3u){G c=C.3u[b],5Y=[b,c];5Y.4s=b;5Y.1g=c;a(5Y)}},58:q(a,b){o C.3u[a]=b},7i:q(a){o C.3u[a]},cp:q(a){G b=C.3u[a];7j C.3u[a];o b},57:q(){o J.1Z(C.3u)},4g:q(){o C.4q(\'4s\')},25:q(){o C.4q(\'1g\')},50:q(b){G c=C.5X(q(a){o a.1g===b});o c&&c.4s},cq:q(a){o C.1Z().3U(a)},3U:q(c){o 1e 2S(c).2E(C,q(a,b){a.58(b.4s,b.1g);o a})},3m:q(){o C.2e(q(a){G b=9m(a.4s),25=a.1g;E(25&&2R 25==\'2D\'){E(J.3n(25))o 25.2e(7h.5Q(b)).1P(\'&\')}o 7h(b,25)}).1P(\'&\')},1W:q(){o\'#<2S:{\'+C.2e(q(a){o a.2e(J.1W).1P(\': \')}).1P(\', \')+\'}>\'},2s:q(){o J.2s(C.57())},1Z:q(){o 1e 2S(C)}}})());2S.18.79=2S.18.57;2S.9g=$H;G 9n=1E.1L(26,{22:q(a,b,c){C.59=a;C.7k=b;C.9o=c},3c:q(a){G b=C.59;1q(C.1p(b)){a(b);b=b.73()}},1p:q(a){E(a<C.59)o 1d;E(C.9o)o a<C.7k;o a<=C.7k}});G $R=q(a,b,c){o 1e 9n(a,b,c)};G 1t={9p:q(){o 8K.8L(q(){o 1e 9q()},q(){o 1e 9r(\'cr.9s\')},q(){o 1e 9r(\'cs.9s\')})||1d},7l:0};1t.4t={5a:[],3c:q(a){C.5a.3c(a)},9t:q(a){E(!C.1p(a))C.5a.14(a)},ct:q(a){C.5a=C.5a.56(a)},5Z:q(b,c,d,f){C.1l(q(a){E(J.1M(a[b])){1N{a[b].2B(a,[c,d,f])}1Y(e){}}})}};J.U(1t.4t,26);1t.4t.9t({60:q(){1t.7l++},3v:q(){1t.7l--}});1t.7m=1E.1L({22:q(a){C.1b={28:\'5b\',61:1f,9u:\'62/x-cu-6S-cv\',7n:\'cw-8\',2v:\'\',4m:1f,7o:1f};J.U(C.1b,a||{});C.1b.28=C.1b.28.1G();E(J.2l(C.1b.2v))C.1b.2v=C.1b.2v.5U();19 E(J.6U(C.1b.2v))C.1b.2v=C.1b.2v.57()}});1t.3V=1E.1L(1t.7m,{7p:1d,22:q($2Y,b,c){$2Y(c);C.1R=1t.9p();C.2V(b)},2V:q(a){C.3W=a;C.28=C.1b.28;G b=J.1Z(C.1b.2v);E(![\'7i\',\'5b\'].1p(C.28)){b[\'cx\']=C.28;C.28=\'5b\'}C.2v=b;E(b=J.3m(b)){E(C.28==\'7i\')C.3W+=(C.3W.1p(\'?\')?\'&\':\'?\')+b;19 E(/cy|8C|8A/.2d(3K.3L))b+=\'&52=\'}1N{G c=1e 1t.7q(C);E(C.1b.60)C.1b.60(c);1t.4t.5Z(\'60\',C,c);C.1R.cz(C.28.2f(),C.3W,C.1b.61);E(C.1b.61)C.7r.1o(C).3p(1);C.1R.63=C.7s.1o(C);C.9v();C.1S=C.28==\'5b\'?(C.1b.cA||b):17;C.1R.cB(C.1S);E(!C.1b.61&&C.1R.9w)C.7s()}1Y(e){C.3X(e)}},7s:q(){G a=C.1R.2W;E(a>1&&!((a==4)&&C.7p))C.7r(C.1R.2W)},9v:q(){G b={\'X-cC-cD\':\'9q\',\'X-Y-6Q\':Y.6Q,\'cE\':\'2U/cF, 2U/cG, 62/9x, 2U/9x, */*\'};E(C.28==\'5b\'){b[\'7t-1n\']=C.1b.9u+(C.1b.7n?\'; cH=\'+C.1b.7n:\'\');E(C.1R.9w&&(3K.3L.1k(/5K\\/(\\d{4})/)||[0,9y])[1]<9y)b[\'cI\']=\'cJ\'}E(2R C.1b.9z==\'2D\'){G c=C.1b.9z;E(J.1M(c.14))N(G i=0,M=c.M;i<M;i+=2)b[c[i]]=c[i+1];19 $H(c).1l(q(a){b[a.4s]=a.1g})}N(G d 1s b)C.1R.cK(d,b[d])},3Y:q(){G a=C.5c();o!a||(a>=cL&&a<cM)},5c:q(){1N{o C.1R.64||0}1Y(e){o 0}},7r:q(a){G b=1t.3V.9A[a],3d=1e 1t.7q(C);E(b==\'7u\'){1N{C.7p=1f;(C.1b[\'4u\'+3d.64]||C.1b[\'4u\'+(C.3Y()?\'cN\':\'cO\')]||Y.2q)(3d,3d.65)}1Y(e){C.3X(e)}G c=3d.4v(\'7t-1n\');E(C.1b.7o==\'9B\'||(C.1b.7o&&C.66()&&c&&c.1k(/^\\s*(2U|62)\\/(x-)?(cP|cQ)4T(;.*)?\\s*$/i)))C.9C()}1N{(C.1b[\'4u\'+b]||Y.2q)(3d,3d.65);1t.4t.5Z(\'4u\'+b,C,3d,3d.65)}1Y(e){C.3X(e)}E(b==\'7u\'){C.1R.63=Y.2q}},66:q(){G m=C.3W.1k(/^\\s*cR?:\\/\\/[^\\/]*/);o!m||(m[0]==\'#{7v}//#{7w}#{67}\'.92({7v:68.7v,7w:V.7w,67:68.67?\':\'+68.67:\'\'}))},4v:q(a){1N{o C.1R.7x(a)||17}1Y(e){o 17}},9C:q(){1N{o 5S((C.1R.3w||\'\').76())}1Y(e){C.3X(e)}},3X:q(a){(C.1b.9D||Y.2q)(C,a);1t.4t.5Z(\'9D\',C,a)}});1t.3V.9A=[\'cS\',\'cT\',\'cU\',\'cV\',\'7u\'];1t.7q=1E.1L({22:q(a){C.2V=a;G b=C.1R=a.1R,2W=C.2W=b.2W;E((2W>2&&!Y.1w.2N)||2W==4){C.64=C.5c();C.7y=C.9E();C.3w=1B.4i(b.3w);C.65=C.9F()}E(2W==4){G c=b.9G;C.9G=J.1X(c)?17:c;C.cW=C.9H()}},64:0,7y:\'\',5c:1t.3V.18.5c,9E:q(){1N{o C.1R.7y||\'\'}1Y(e){o\'\'}},4v:1t.3V.18.4v,cX:q(){1N{o C.7z()}1Y(e){o 17}},7x:q(a){o C.1R.7x(a)},7z:q(){o C.1R.7z()},9F:q(){G a=C.4v(\'X-90\');E(!a)o 17;a=72(8M(a));1N{o a.4m(C.2V.1b.9I||!C.2V.66())}1Y(e){C.2V.3X(e)}},9H:q(){G a=C.2V.1b;E(!a.4m||(a.4m!=\'9B\'&&!(C.4v(\'7t-1n\')||\'\').1p(\'62/cY\'))||C.3w.3S())o 17;1N{o C.3w.4m(a.9I||!C.2V.66())}1Y(e){C.2V.3X(e)}}});1t.9J=1E.1L(1t.3V,{22:q($2Y,d,e,f){C.69={3Y:(d.3Y||d),7A:(d.7A||(d.3Y?17:d))};f=J.1Z(f);G g=f.3v;f.3v=(q(a,b){C.9K(a.3w);E(J.1M(g))g(a,b)}).1o(C);$2Y(e,f)},9K:q(a){G b=C.69[C.3Y()?\'3Y\':\'7A\'],1b=C.1b;E(!1b.3R)a=a.3b();E(b=$(b)){E(1b.6a){E(J.2l(1b.6a)){G c={};c[1b.6a]=a;b.2w(c)}19 1b.6a(b,a)}19 b.3U(a)}}});1t.cZ=1E.1L(1t.7m,{22:q($2Y,b,c,d){$2Y(d);C.3v=C.1b.3v;C.4X=(C.1b.4X||2);C.3Z=(C.1b.3Z||1);C.7B={};C.69=b;C.3W=c;C.59()},59:q(){C.1b.3v=C.9L.1o(C);C.4Z()},6Z:q(){C.7B.1b.3v=3k;d0(C.4j);(C.3v||Y.2q).2B(C,1c)},9L:q(a){E(C.1b.3Z){C.3Z=(a.3w==C.9M?C.3Z*C.1b.3Z:1);C.9M=a.3w}C.4j=C.4Z.1o(C).6W(C.3Z*C.4X)},4Z:q(){C.7B=1e 1t.9J(C.69,C.3W,C.1b)}});q $(a){E(1c.M>1){N(G i=0,7C=[],M=1c.M;i<M;i++)7C.14($(1c[i]));o 7C}E(J.2l(a))a=V.d1(a);o I.U(a)}E(Y.2P.5L){V.7D=q(a,b){G c=[];G d=V.2b(a,$(b)||V,17,d2.d3,17);N(G i=0,M=d.d4;i<M;i++)c.14(I.U(d.d5(i)));o c}}E(!1i.5d)G 5d={};E(!5d.9N){J.U(5d,{9N:1,d6:2,9O:3,d7:4,d8:5,d9:6,da:7,db:8,dc:9,dd:10,de:11,df:12})}(q(){G d=C.I;C.I=q(a,b){b=b||{};a=a.1G();G c=I.5e;E(Y.1w.2N&&b.21){a=\'<\'+a+\' 21="\'+b.21+\'">\';7j b.21;o I.5f(V.2Q(a),b)}E(!c[a])c[a]=I.U(V.2Q(a));o I.5f(c[a].dg(1d),b)};J.U(C.I,d||{})}).7E(1i);I.5e={};I.W={7F:q(a){o $(a).1a.3e!=\'6b\'},9P:q(a){a=$(a);I[I.7F(a)?\'9Q\':\'9R\'](a);o a},9Q:q(a){$(a).1a.3e=\'6b\';o a},9R:q(a){$(a).1a.3e=\'\';o a},9S:q(a){a=$(a);a.1A.5g(a);o a},3U:q(a,b){a=$(a);E(b&&b.2x)b=b.2x();E(J.2Z(b))o a.3U().2w(b);b=J.31(b);a.3t=b.3b();b.3R.1o(b).3p();o a},1x:q(a,b){a=$(a);E(b&&b.2x)b=b.2x();19 E(!J.2Z(b)){b=J.31(b);G c=a.dh.di();c.dj(a);b.3R.1o(b).3p();b=c.dk(b.3b())}a.1A.7G(b,a);o a},2w:q(a,b){a=$(a);E(J.2l(b)||J.3Q(b)||J.2Z(b)||(b&&(b.2x||b.31)))b={41:b};G c,2w,1h,2o;N(G d 1s b){c=b[d];d=d.1G();2w=I.4w[d];E(c&&c.2x)c=c.2x();E(J.2Z(c)){2w(a,c);2F}c=J.31(c);1h=((d==\'7H\'||d==\'6c\')?a.1A:a).1h.2f();2o=I.6d(1h,c.3b());E(d==\'2h\'||d==\'6c\')2o.55();2o.1l(2w.5Q(a));c.3R.1o(c).3p()}o a},3O:q(a,b,c){a=$(a);E(J.2Z(b))$(b).5f(c||{});19 E(J.2l(b))b=1e I(b,c);19 b=1e I(\'2k\',b);E(a.1A)a.1A.7G(b,a);b.4o(a);o b},1W:q(d){d=$(d);G e=\'<\'+d.1h.1G();$H({\'29\':\'29\',\'1J\':\'5h\'}).1l(q(a){G b=a.2C(),9T=a.1Q();G c=(d[b]||\'\').24();E(c)e+=\' \'+9T+\'=\'+c.1W(1f)});o e+\'>\'},6e:q(a,b){a=$(a);G c=[];1q(a=a[b])E(a.2t==1)c.14(I.U(a));o c},7I:q(a){o $(a).6e(\'1A\')},9U:q(a){o $(a).20("*")},9V:q(a){a=$(a).4x;1q(a&&a.2t!=1)a=a.3x;o $(a)},9W:q(a){E(!(a=$(a).4x))o[];1q(a&&a.2t!=1)a=a.3x;E(a)o[a].1z($(a).5i());o[]},7J:q(a){o $(a).6e(\'9X\')},5i:q(a){o $(a).6e(\'3x\')},dl:q(a){a=$(a);o a.7J().55().1z(a.5i())},1k:q(a,b){E(J.2l(b))b=1e O(b);o b.1k($(a))},dm:q(a,b,c){a=$(a);E(1c.M==1)o $(a.1A);G d=a.7I();o J.3Q(b)?d[b]:O.4y(d,b,c)},dn:q(a,b,c){a=$(a);E(1c.M==1)o a.9V();o J.3Q(b)?a.9U()[b]:a.20(b)[c||0]},dp:q(a,b,c){a=$(a);E(1c.M==1)o $(O.1C.5j(a));G d=a.7J();o J.3Q(b)?d[b]:O.4y(d,b,c)},9Y:q(a,b,c){a=$(a);E(1c.M==1)o $(O.1C.5k(a));G d=a.5i();o J.3Q(b)?d[b]:O.4y(d,b,c)},20:q(){G a=$A(1c),1u=$(a.3N());o O.6f(1u,a)},42:q(){G a=$A(1c),1u=$(a.3N());o O.6f(1u.1A,a).56(1u)},9Z:q(a){a=$(a);G b=a.43(\'29\'),7K=1c.4k;E(b)o b;do{b=\'dq\'+7K.a0++}1q($(b));a.5f(\'29\',b);o b},43:q(a,b){a=$(a);E(Y.1w.2N){G t=I.2G.6g;E(t.25[b])o t.25[b](a,b);E(t.3y[b])b=t.3y[b];E(b.1p(\':\')){o(!a.7L||!a.7L[b])?17:a.7L[b].1g}}o a.7M(b)},5f:q(a,b,c){a=$(a);G d={},t=I.2G.5l;E(2R b==\'2D\')d=b;19 d[b]=J.1X(c)?1f:c;N(G e 1s d){b=t.3y[e]||e;c=d[e];E(t.25[e])b=t.25[e](a,c);E(c===1d||c===17)a.7N(b);19 E(c===1f)a.a1(b,b);19 a.a1(b,c)}o a},a2:q(a){o $(a).4z().2y},a3:q(a){o $(a).4z().1T},5m:q(a){o 1e I.6h(a)},6i:q(a,b){E(!(a=$(a)))o;G c=a.1J;o(c.M>0&&(c==b||1e 3a("(^|\\\\s)"+b+"(\\\\s|$)").2d(c)))},a4:q(a,b){E(!(a=$(a)))o;E(!a.6i(b))a.1J+=(a.1J?\' \':\'\')+b;o a},a5:q(a,b){E(!(a=$(a)))o;a.1J=a.1J.1x(1e 3a("(^|\\\\s+)"+b+"(\\\\s+|$)"),\' \').2T();o a},dr:q(a,b){E(!(a=$(a)))o;o a[a.6i(b)?\'a5\':\'a4\'](b)},ds:q(a){a=$(a);G b=a.4x;1q(b){G c=b.3x;E(b.2t==3&&!/\\S/.2d(b.71))a.5g(b);b=c}o a},4n:q(a){o $(a).3t.3S()},6j:q(b,c){b=$(b),c=$(c);G d=c;E(b.a6)o(b.a6(c)&8)===8;E(b.5n&&!Y.1w.3J){G e=b.5n,a=c.5n,4A=c.3x;E(!4A){do{c=c.1A}1q(!(4A=c.3x)&&c.1A)}E(4A&&4A.5n)o(e>a&&e<4A.5n)}1q(b=b.1A)E(b==d)o 1f;o 1d},a7:q(a){a=$(a);G b=a.44();1i.a7(b[0],b[1]);o a},1D:q(a,b){a=$(a);b=b==\'7O\'?\'6k\':b.74();G c=a.1a[b];E(!c){G d=V.dt.du(a,17);c=d?d[b]:17}E(b==\'2H\')o c?4B(c):1.0;o c==\'6l\'?17:c},dv:q(a){o $(a).1D(\'2H\')},4C:q(a,b){a=$(a);G c=a.1a,1k;E(J.2l(b)){a.1a.7P+=\';\'+b;o b.1p(\'2H\')?a.4D(b.1k(/2H:\\s*(\\d?\\.?\\d*)/)[1]):a}N(G d 1s b)E(d==\'2H\')a.4D(b[d]);19 c[(d==\'7O\'||d==\'6k\')?(J.1X(c.7Q)?\'6k\':\'7Q\'):d]=b[d];o a},4D:q(a,b){a=$(a);a.1a.2H=(b==1||b===\'\')?\'\':(b<0.6m)?0:b;o a},4z:q(a){a=$(a);G b=$(a).1D(\'3e\');E(b!=\'6b\'&&b!=17)o{1T:a.4E,2y:a.4F};G c=a.1a;G d=c.7R;G e=c.1v;G f=c.3e;c.7R=\'6n\';c.1v=\'4G\';c.3e=\'dw\';G g=a.a8;G h=a.a9;c.3e=f;c.1v=e;c.7R=d;o{1T:g,2y:h}},dx:q(a){a=$(a);G b=I.1D(a,\'1v\');E(b==\'4H\'||!b){a.7S=1f;a.1a.1v=\'5o\';E(1i.6R){a.1a.2h=0;a.1a.2I=0}}o a},dy:q(a){a=$(a);E(a.7S){a.7S=3k;a.1a.1v=a.1a.2h=a.1a.2I=a.1a.41=a.1a.6o=\'\'}o a},dz:q(a){a=$(a);E(a.47)o a;a.47=I.1D(a,\'7T\')||\'6l\';E(a.47!==\'6n\')a.1a.7T=\'6n\';o a},dA:q(a){a=$(a);E(!a.47)o a;a.1a.7T=a.47==\'6l\'?\'\':a.47;a.47=17;o a},44:q(a){G b=0,2a=0;do{b+=a.48||0;2a+=a.49||0;a=a.3f}1q(a);o I.4a(2a,b)},5p:q(a){G b=0,2a=0;do{b+=a.48||0;2a+=a.49||0;a=a.3f;E(a){E(a.1h==\'aa\')1F;G p=I.1D(a,\'1v\');E(p!==\'4H\')1F}}1q(a);o I.4a(2a,b)},7U:q(a){a=$(a);E(a.1D(\'1v\')==\'4G\')o;G b=a.5p();G c=b[1];G d=b[0];G e=a.a8;G f=a.a9;a.ab=d-4B(a.1a.2I||0);a.ac=c-4B(a.1a.2h||0);a.ad=a.1a.1T;a.ae=a.1a.2y;a.1a.1v=\'4G\';a.1a.2h=c+\'2p\';a.1a.2I=d+\'2p\';a.1a.1T=e+\'2p\';a.1a.2y=f+\'2p\';o a},7V:q(a){a=$(a);E(a.1D(\'1v\')==\'5o\')o;a.1a.1v=\'5o\';G b=4B(a.1a.2h||0)-(a.ac||0);G c=4B(a.1a.2I||0)-(a.ab||0);a.1a.2h=b+\'2p\';a.1a.2I=c+\'2p\';a.1a.2y=a.ae;a.1a.1T=a.ad;o a},7W:q(a){G b=0,2a=0;do{b+=a.3z||0;2a+=a.3A||0;a=a.1A}1q(a);o I.4a(2a,b)},4I:q(a){E(a.3f)o $(a.3f);E(a==V.1S)o $(a);1q((a=a.1A)&&a!=V.1S)E(I.1D(a,\'1v\')!=\'4H\')o $(a);o $(V.1S)},5q:q(a){G b=0,2a=0;G c=a;do{b+=c.48||0;2a+=c.49||0;E(c.3f==V.1S&&I.1D(c,\'1v\')==\'4G\')1F}1q(c=c.3f);c=a;do{E(!Y.1w.3J||c.1h==\'aa\'){b-=c.3z||0;2a-=c.3A||0}}1q(c=c.1A);o I.4a(2a,b)},af:q(a,b){G c=J.U({ag:1f,ah:1f,ai:1f,aj:1f,48:0,49:0},1c[2]||{});b=$(b);G p=b.5q();a=$(a);G d=[0,0];G e=17;E(I.1D(a,\'1v\')==\'4G\'){e=a.4I();d=e.5q()}E(e==V.1S){d[0]-=V.1S.49;d[1]-=V.1S.48}E(c.ag)a.1a.2I=(p[0]-d[0]+c.49)+\'2p\';E(c.ah)a.1a.2h=(p[1]-d[1]+c.48)+\'2p\';E(c.ai)a.1a.1T=b.4E+\'2p\';E(c.aj)a.1a.2y=b.4F+\'2p\';o a}};I.W.9Z.a0=1;J.U(I.W,{dB:I.W.20,dC:I.W.9W});I.2G={5l:{3y:{1J:\'5h\',ak:\'N\'},25:{}}};E(Y.1w.3J){I.W.1D=I.W.1D.3O(q(d,e,f){4h(f){1O\'2I\':1O\'2h\':1O\'6o\':1O\'41\':E(d(e,\'1v\')===\'4H\')o 17;1O\'2y\':1O\'1T\':E(!I.7F(e))o 17;G g=al(d(e,f),10);E(g!==e[\'2i\'+f.51()])o g+\'2p\';G h;E(f===\'2y\'){h=[\'6p-2h-1T\',\'6q-2h\',\'6q-41\',\'6p-41-1T\']}19{h=[\'6p-2I-1T\',\'6q-2I\',\'6q-6o\',\'6p-6o-1T\']}o h.2E(g,q(a,b){G c=d(e,b);o c===17?a:a-al(c,10)})+\'2p\';5r:o d(e,f)}});I.W.43=I.W.43.3O(q(a,b,c){E(c===\'6r\')o b.6r;o a(b,c)})}19 E(Y.1w.2N){I.W.4I=I.W.4I.3O(q(a,b){b=$(b);G c=b.1D(\'1v\');E(c!==\'4H\')o a(b);b.4C({1v:\'5o\'});G d=a(b);b.4C({1v:c});o d});$w(\'5p 5q\').1l(q(f){I.W[f]=I.W[f].3O(q(a,b){b=$(b);G c=b.1D(\'1v\');E(c!==\'4H\')o a(b);G d=b.4I();E(d&&d.1D(\'1v\')===\'dD\')d.4C({7X:1});b.4C({1v:\'5o\'});G e=a(b);b.4C({1v:c});o e})});I.W.1D=q(a,b){a=$(a);b=(b==\'7O\'||b==\'6k\')?\'7Q\':b.74();G c=a.1a[b];E(!c&&a.7Y)c=a.7Y[b];E(b==\'2H\'){E(c=(a.1D(\'4r\')||\'\').1k(/7Z\\(2H=(.*)\\)/))E(c[1])o 4B(c[1])/am;o 1.0}E(c==\'6l\'){E((b==\'1T\'||b==\'2y\')&&(a.1D(\'3e\')!=\'6b\'))o a[\'2i\'+b.51()]+\'2p\';o 17}o c};I.W.4D=q(b,c){q 80(a){o a.1x(/7Z\\([^\\)]*\\)/8U,\'\')}b=$(b);G d=b.7Y;E((d&&!d.dE)||(!d&&b.1a.7X==\'dF\'))b.1a.7X=1;G e=b.1D(\'4r\'),1a=b.1a;E(c==1||c===\'\'){(e=80(e))?1a.4r=e:1a.7N(\'4r\');o b}19 E(c<0.6m)c=0;1a.4r=80(e)+\'7Z(2H=\'+(c*am)+\')\';o b};I.2G={6g:{3y:{\'5h\':\'1J\',\'N\':\'ak\'},25:{6s:q(a,b){o a.7M(b,2)},an:q(a,b){G c=a.ao(b);o c?c.1g:""},1K:q(a,b){b=a.7M(b);o b?b.24().3s(23,-2):17},5s:q(a,b){o $(a).2J(b)?b:17},1a:q(a){o a.1a.7P.1G()},6r:q(a){o a.6r}}}};I.2G.5l={3y:J.U({dG:\'dH\',dI:\'dJ\'},I.2G.6g.3y),25:{2K:q(a,b){a.2K=!!b},1a:q(a,b){a.1a.7P=b?b:\'\'}}};I.2G.81={};$w(\'dK dL dM dN dO 6t \'+\'dP dQ dR dS\').1l(q(a){I.2G.5l.3y[a.1G()]=a;I.2G.81[a.1G()]=a});(q(v){J.U(v,{ap:v.6s,aq:v.6s,1n:v.6s,4J:v.an,2z:v.5s,2K:v.5s,dT:v.5s,dU:v.5s,dV:v.1K,ar:v.1K,dW:v.1K,dX:v.1K,dY:v.1K,dZ:v.1K,e0:v.1K,e1:v.1K,e2:v.1K,e3:v.1K,e4:v.1K,e5:v.1K,e6:v.1K,e7:v.1K,e8:v.1K,e9:v.1K,ea:v.1K,eb:v.1K})})(I.2G.6g.25)}19 E(Y.1w.5K&&/ec:1\\.8\\.0/.2d(3K.3L)){I.W.4D=q(a,b){a=$(a);a.1a.2H=(b==1)?0.ed:(b===\'\')?\'\':(b<0.6m)?0:b;o a}}19 E(Y.1w.3j){I.W.4D=q(a,b){a=$(a);a.1a.2H=(b==1||b===\'\')?\'\':(b<0.6m)?0:b;E(b==1)E(a.1h==\'at\'&&a.1T){a.1T++;a.1T--}19 1N{G n=V.96(\' \');a.4o(n);a.5g(n)}1Y(e){}o a};I.W.44=q(a){G b=0,2a=0;do{b+=a.48||0;2a+=a.49||0;E(a.3f==V.1S)E(I.1D(a,\'1v\')==\'4G\')1F;a=a.3f}1q(a);o I.4a(2a,b)}}E(Y.1w.2N||Y.1w.3J){I.W.3U=q(b,c){b=$(b);E(c&&c.2x)c=c.2x();E(J.2Z(c))o b.3U().2w(c);c=J.31(c);G d=b.1h.2f();E(d 1s I.4w.3B){$A(b.2o).1l(q(a){b.5g(a)});I.6d(d,c.3b()).1l(q(a){b.4o(a)})}19 b.3t=c.3b();c.3R.1o(c).3p();o b}}E(\'au\'1s V.2Q(\'2k\')){I.W.1x=q(b,c){b=$(b);E(c&&c.2x)c=c.2x();E(J.2Z(c)){b.1A.7G(c,b);o b}c=J.31(c);G d=b.1A,1h=d.1h.2f();E(I.4w.3B[1h]){G e=b.9Y();G f=I.6d(1h,c.3b());d.5g(b);E(e)f.1l(q(a){d.6u(a,e)});19 f.1l(q(a){d.4o(a)})}19 b.au=c.3b();c.3R.1o(c).3p();o b}}I.4a=q(l,t){G a=[l,t];a.2I=l;a.2h=t;o a};I.6d=q(a,b){G c=1e I(\'2k\'),t=I.4w.3B[a];E(t){c.3t=t[0]+b+t[1];t[2].5V(q(){c=c.4x})}19 c.3t=b;o $A(c.2o)};I.4w={7H:q(a,b){a.1A.6u(b,a)},2h:q(a,b){a.6u(b,a.4x)},41:q(a,b){a.4o(b)},6c:q(a,b){a.1A.6u(b,a.3x)},3B:{ee:[\'<3C>\',\'</3C>\',1],6v:[\'<3C><4K>\',\'</4K></3C>\',2],av:[\'<3C><4K><6w>\',\'</6w></4K></3C>\',3],82:[\'<3C><4K><6w><aw>\',\'</aw></6w></4K></3C>\',4],ax:[\'<20>\',\'</20>\',1]}};(q(){J.U(C.3B,{ay:C.3B.6v,az:C.3B.6v,aA:C.3B.82})}).7E(I.4w);I.W.6x={2J:q(a,b){b=I.2G.81[b]||b;G c=$(a).ao(b);o c&&c.ef}};I.W.2A={};J.U(I,I.W);E(!Y.2P.4R&&V.2Q(\'2k\').3M){1i.4S={};1i.4S.18=V.2Q(\'2k\').3M;Y.2P.4R=1f}I.U=(q(){E(Y.2P.5M)o Y.K;G c={},2A=I.W.2A;G d=J.U(q(a){E(!a||a.6y||a.2t!=1||a==1i)o a;G b=J.1Z(c),1h=a.1h,5t,1g;E(2A[1h])J.U(b,2A[1h]);N(5t 1s b){1g=b[5t];E(J.1M(1g)&&!(5t 1s a))a[5t]=1g.3o()}a.6y=Y.2q;o a},{6z:q(){E(!Y.2P.4R){J.U(c,I.W);J.U(c,I.W.6x)}}});d.6z();o d})();I.2J=q(a,b){E(a.2J)o a.2J(b);o I.W.6x.2J(a,b)};I.4V=q(f){G F=Y.2P,T=I.W.2A;E(!f){J.U(1j,1j.W);J.U(1j.I,1j.I.W);J.U(I.W.2A,{"eg":J.1Z(1j.W),"eh":J.1Z(1j.I.W),"ax":J.1Z(1j.I.W),"aB":J.1Z(1j.I.W)})}E(1c.M==2){G g=f;f=1c[1]}E(!g)J.U(I.W,f||{});19{E(J.3n(g))g.1l(U);19 U(g)}q U(a){a=a.2f();E(!I.W.2A[a])I.W.2A[a]={};J.U(I.W.2A[a],f)}q 6A(a,b,c){c=c||1d;N(G d 1s a){G e=a[d];E(!J.1M(e))2F;E(!c||!(d 1s b))b[d]=e.3o()}}q aC(a){G b;G c={"ei":"ej","aB":"ek","P":"el","em":"eo","ep":"eq","er":"es","et":"eu","ev":"ew","ex":"4L","ey":"4L","ez":"4L","eA":"4L","eB":"4L","eC":"4L","Q":"eD","eE":"aD","eF":"aD","A":"eG","at":"eH","eI":"eJ","eK":"aE","eL":"aE","ay":"83","az":"83","6v":"83","av":"eM","aA":"aF","82":"aF","eN":"eO","eP":"eQ"};E(c[a])b=\'84\'+c[a]+\'I\';E(1i[b])o 1i[b];b=\'84\'+a+\'I\';E(1i[b])o 1i[b];b=\'84\'+a.51()+\'I\';E(1i[b])o 1i[b];1i[b]={};1i[b].18=V.2Q(a).3M;o 1i[b]}E(F.4R){6A(I.W,4S.18);6A(I.W.6x,4S.18,1f)}E(F.5M){N(G h 1s I.W.2A){G i=aC(h);E(J.1X(i))2F;6A(T[h],i.18)}}J.U(I,I.W);7j I.2A;E(I.U.6z)I.U.6z();I.5e={}};V.eR={4z:q(){G a={};G B=Y.1w;$w(\'1T 2y\').1l(q(d){G D=d.51();a[d]=(B.3j&&!V.2b)?7K[\'eS\'+D]:(B.3J)?V.1S[\'aG\'+D]:V.3D[\'aG\'+D]});o a},a3:q(){o C.4z().1T},a2:q(){o C.4z().2y},eT:q(){o I.4a(1i.aH||V.3D.3A||V.1S.3A,1i.aI||V.3D.3z||V.1S.3z)}};G O=1E.1L({22:q(a){C.2X=a.2T();C.aJ()},aK:q(){E(!Y.2P.5L)o 1d;G e=C.2X;E(Y.1w.3j&&(e.1p("-1U-1n")||e.1p(":4n")))o 1d;E((/(\\[[\\w-]*?:|:2K)/).2d(C.2X))o 1d;o 1f},aJ:q(){E(C.aK())o C.aL();G e=C.2X,3g=O.5u,h=O.1C,c=O.54,3h,p,m;E(O.4b[e]){C.2L=O.4b[e];o}C.2L=["C.2L = q(aM) {","G r = aM, h = O.1C, c = 1d, n;"];1q(e&&3h!=e&&(/\\S/).2d(e)){3h=e;N(G i 1s 3g){p=3g[i];E(m=e.1k(p)){C.2L.14(J.1M(c[i])?c[i](m):1e 2g(c[i]).2b(m));e=e.1x(m[0],\'\');1F}}}C.2L.14("o h.85(n);\\n}");5S(C.2L.1P(\'\\n\'));O.4b[C.2X]=C.2L},aL:q(){G e=C.2X,3g=O.5u,x=O.1V,3h,m;E(O.4b[e]){C.1V=O.4b[e];o}C.2L=[\'.//*\'];1q(e&&3h!=e&&(/\\S/).2d(e)){3h=e;N(G i 1s 3g){E(m=e.1k(3g[i])){C.2L.14(J.1M(x[i])?x[i](m):1e 2g(x[i]).2b(m));e=e.1x(m[0],\'\');1F}}}C.1V=C.2L.1P(\'\');O.4b[C.2X]=C.1V},6B:q(a){a=a||V;E(C.1V)o V.7D(C.1V,a);o C.2L(a)},1k:q(a){C.86=[];G e=C.2X,3g=O.5u,as=O.87;G b,p,m;1q(e&&b!==e&&(/\\S/).2d(e)){b=e;N(G i 1s 3g){p=3g[i];E(m=e.1k(p)){E(as[i]){C.86.14([i,J.1Z(m)]);e=e.1x(m[0],\'\')}19{o C.6B(V).1p(a)}}}}G c=1f,21,88;N(G i=0,6C;6C=C.86[i];i++){21=6C[0],88=6C[1];E(!O.87[21](a,88)){c=1d;1F}}o c},24:q(){o C.2X},1W:q(){o"#<O:"+C.2X.1W()+">"}});J.U(O,{4b:{},1V:{3E:"//*",1r:"/*",42:"/5v-3F::*[1]",5w:\'/5v-3F::*\',1h:q(m){E(m[1]==\'*\')o\'\';o"[aN-21()=\'"+m[1].1G()+"\' 89 aN-21()=\'"+m[1].2f()+"\']"},1J:"[5x(1z(\' \', @5h, \' \'), \' #{1} \')]",29:"[@29=\'#{1}\']",4M:q(m){m[1]=m[1].1G();o 1e 2g("[@#{1}]").2b(m)},4N:q(m){m[1]=m[1].1G();m[3]=m[5]||m[6];o 1e 2g(O.1V.5y[m[2]]).2b(m)},5z:q(m){G h=O.1V.1H[m[1]];E(!h)o\'\';E(J.1M(h))o h(m);o 1e 2g(O.1V.1H[m[1]]).2b(m)},5y:{\'=\':"[@#{1}=\'#{3}\']",\'!=\':"[@#{1}!=\'#{3}\']",\'^=\':"[eU-97(@#{1}, \'#{3}\')]",\'$=\':"[4l(@#{1}, (5O-M(@#{1}) - 5O-M(\'#{3}\') + 1))=\'#{3}\']",\'*=\':"[5x(@#{1}, \'#{3}\')]",\'~=\':"[5x(1z(\' \', @#{1}, \' \'), \' #{3} \')]",\'|=\':"[5x(1z(\'-\', @#{1}, \'-\'), \'-#{3}-\')]"},1H:{\'2C-1r\':\'[3G(8a-3F::*)]\',\'1Q-1r\':\'[3G(5v-3F::*)]\',\'5A-1r\':\'[3G(8a-3F::* 89 5v-3F::*)]\',\'4n\':"[6D(*) = 0 8b (6D(2U()) = 0 89 eV(2U(), \' \\t\\r\\n\', \'\') = \'\')]",\'2K\':"[@2K]",\'2z\':"[@2z]",\'aO\':"[3G(@2z)]",\'3G\':q(m){G e=m[6],p=O.5u,x=O.1V,3h,v;G a=[];1q(e&&3h!=e&&(/\\S/).2d(e)){3h=e;N(G i 1s p){E(m=e.1k(p[i])){v=J.1M(x[i])?x[i](m):1e 2g(x[i]).2b(m);a.14("("+v.4l(1,v.M-1)+")");e=e.1x(m[0],\'\');1F}}}o"[3G("+a.1P(" 8b ")+")]"},\'1y-1r\':q(m){o O.1V.1H.1y("(6D(./8a-3F::*) + 1) ",m)},\'1y-1Q-1r\':q(m){o O.1V.1H.1y("(6D(./5v-3F::*) + 1) ",m)},\'1y-1U-1n\':q(m){o O.1V.1H.1y("1v() ",m)},\'1y-1Q-1U-1n\':q(m){o O.1V.1H.1y("(1Q() + 1 - 1v()) ",m)},\'2C-1U-1n\':q(m){m[6]="1";o O.1V.1H[\'1y-1U-1n\'](m)},\'1Q-1U-1n\':q(m){m[6]="1";o O.1V.1H[\'1y-1Q-1U-1n\'](m)},\'5A-1U-1n\':q(m){G p=O.1V.1H;o p[\'2C-1U-1n\'](m)+p[\'1Q-1U-1n\'](m)},1y:q(c,m){G d,4c=m[6],8c;E(4c==\'aP\')4c=\'2n+0\';E(4c==\'aQ\')4c=\'2n+1\';E(d=4c.1k(/^(\\d+)$/))o\'[\'+c+"= "+d[1]+\']\';E(d=4c.1k(/^(-?\\d*)?n(([+-])(\\d+))?/)){E(d[1]=="-")d[1]=-1;G a=d[1]?3T(d[1]):1;G b=d[2]?3T(d[2]):0;8c="[((#{8d} - #{b}) eW #{a} = 0) 8b "+"((#{8d} - #{b}) 2k #{a} >= 0)]";o 1e 2g(8c).2b({8d:c,a:a,b:b})}}}},54:{1h:\'n = h.1h(n, r, "#{1}", c);      c = 1d;\',1J:\'n = h.1J(n, r, "#{1}", c);    c = 1d;\',29:\'n = h.29(n, r, "#{1}", c);           c = 1d;\',4M:\'n = h.4M(n, r, "#{1}", c); c = 1d;\',4N:q(m){m[3]=(m[5]||m[6]);o 1e 2g(\'n = h.4N(n, r, "#{1}", "#{3}", "#{2}", c); c = 1d;\').2b(m)},5z:q(m){E(m[6])m[6]=m[6].1x(/"/g,\'\\\\"\');o 1e 2g(\'n = h.5z(n, "#{1}", "#{6}", r, c); c = 1d;\').2b(m)},3E:\'c = "3E";\',1r:\'c = "1r";\',42:\'c = "42";\',5w:\'c = "5w";\'},5u:{5w:/^\\s*~\\s*/,1r:/^\\s*>\\s*/,42:/^\\s*\\+\\s*/,3E:/^\\s/,1h:/^\\s*(\\*|[\\w\\-]+)(\\b|$)?/,29:/^#([\\w\\-\\*]+)(\\b|$)/,1J:/^\\.([\\w\\-\\*]+)(\\b|$)/,5z:/^:((2C|1Q|1y|1y-1Q|5A)(-1r|-1U-1n)|4n|2K|(en|eX)eY|3G)(\\((.*?)\\))?(\\b|$|(?=\\s|[:+~>]))/,4M:/^\\[([\\w]+)\\]/,4N:/\\[((?:[\\w-]*:)?[\\w-]+)\\s*(?:([!^$*~|]?=)\\s*(([\'"])([^\\4]*?)\\4|([^\'"][^\\]]*?)))?\\]/},87:{1h:q(a,b){o b[1].2f()==a.1h.2f()},1J:q(a,b){o I.6i(a,b[1])},29:q(a,b){o a.29===b[1]},4M:q(a,b){o I.2J(a,b[1])},4N:q(a,b){G c=I.43(a,b[1]);o c&&O.5y[b[2]](c,b[5]||b[6])}},1C:{1z:q(a,b){N(G i=0,L;L=b[i];i++)a.14(L);o a},6E:q(a){G b=Y.2q;N(G i=0,L;L=a[i];i++)L.2M=b;o a},4d:q(a){N(G i=0,L;L=a[i];i++)L.2M=3k;o a},50:q(a,b,c){a.2M=Y.2q;E(b){N(G d=a.2o,i=d.M-1,j=1;i>=0;i--){G e=d[i];E(e.2t==1&&(!c||e.2M))e.6F=j++}}19{N(G i=0,j=1,d=a.2o;e=d[i];i++)E(e.2t==1&&(!c||e.2M))e.6F=j++}},85:q(a){E(a.M==0)o a;G b=[],n;N(G i=0,l=a.M;i<l;i++)E(!(n=a[i]).2M){n.2M=Y.2q;b.14(I.U(n))}o O.1C.4d(b)},3E:q(a){G h=O.1C;N(G i=0,15=[],L;L=a[i];i++)h.1z(15,L.3i(\'*\'));o 15},1r:q(a){G h=O.1C;N(G i=0,15=[],L;L=a[i];i++){N(G j=0,1r;1r=L.2o[j];j++)E(1r.2t==1&&1r.1h!=\'!\')15.14(1r)}o 15},42:q(a){N(G i=0,15=[],L;L=a[i];i++){G b=C.5k(L);E(b)15.14(b)}o 15},5w:q(a){G h=O.1C;N(G i=0,15=[],L;L=a[i];i++)h.1z(15,I.5i(L));o 15},5k:q(a){1q(a=a.3x)E(a.2t==1)o a;o 17},5j:q(a){1q(a=a.9X)E(a.2t==1)o a;o 17},1h:q(a,b,c,d){G e=c.2f();G f=[],h=O.1C;E(a){E(d){E(d=="3E"){N(G i=0,L;L=a[i];i++)h.1z(f,L.3i(c));o f}19 a=C[d](a);E(c=="*")o a}N(G i=0,L;L=a[i];i++)E(L.1h.2f()===e)f.14(L);o f}19 o b.3i(c)},29:q(a,b,c,d){G e=$(c),h=O.1C;E(!e)o[];E(!a&&b==V)o[e];E(a){E(d){E(d==\'1r\'){N(G i=0,L;L=a[i];i++)E(e.1A==L)o[e]}19 E(d==\'3E\'){N(G i=0,L;L=a[i];i++)E(I.6j(e,L))o[e]}19 E(d==\'42\'){N(G i=0,L;L=a[i];i++)E(O.1C.5j(e)==L)o[e]}19 a=h[d](a)}N(G i=0,L;L=a[i];i++)E(L==e)o[e];o[]}o(e&&I.6j(e,b))?[e]:[]},1J:q(a,b,c,d){E(a&&d)a=C[d](a);o O.1C.aR(a,b,c)},aR:q(a,b,c){E(!a)a=O.1C.3E([b]);G d=\' \'+c+\' \';N(G i=0,15=[],L,5B;L=a[i];i++){5B=L.1J;E(5B.M==0)2F;E(5B==c||(\' \'+5B+\' \').1p(d))15.14(L)}o 15},4M:q(a,b,c,d){E(!a)a=b.3i("*");E(a&&d)a=C[d](a);G e=[];N(G i=0,L;L=a[i];i++)E(I.2J(L,c))e.14(L);o e},4N:q(a,b,c,d,e,f){E(!a)a=b.3i("*");E(a&&f)a=C[f](a);G g=O.5y[e],15=[];N(G i=0,L;L=a[i];i++){G h=I.43(L,c);E(h===17)2F;E(g(h,d))15.14(L)}o 15},5z:q(a,b,c,d,e){E(a&&e)a=C[e](a);E(!a)a=d.3i("*");o O.1H[b](a,c,d)}},1H:{\'2C-1r\':q(a,b,c){N(G i=0,15=[],L;L=a[i];i++){E(O.1C.5j(L))2F;15.14(L)}o 15},\'1Q-1r\':q(a,b,c){N(G i=0,15=[],L;L=a[i];i++){E(O.1C.5k(L))2F;15.14(L)}o 15},\'5A-1r\':q(a,b,c){G h=O.1C;N(G i=0,15=[],L;L=a[i];i++)E(!h.5j(L)&&!h.5k(L))15.14(L);o 15},\'1y-1r\':q(a,b,c){o O.1H.1y(a,b,c)},\'1y-1Q-1r\':q(a,b,c){o O.1H.1y(a,b,c,1f)},\'1y-1U-1n\':q(a,b,c){o O.1H.1y(a,b,c,1d,1f)},\'1y-1Q-1U-1n\':q(a,b,c){o O.1H.1y(a,b,c,1f,1f)},\'2C-1U-1n\':q(a,b,c){o O.1H.1y(a,"1",c,1d,1f)},\'1Q-1U-1n\':q(a,b,c){o O.1H.1y(a,"1",c,1f,1f)},\'5A-1U-1n\':q(a,b,c){G p=O.1H;o p[\'1Q-1U-1n\'](p[\'2C-1U-1n\'](a,b,c),b,c)},aS:q(a,b,d){E(a==0)o b>0?[b]:[];o $R(1,d).2E([],q(c,i){E(0==(i-b)%a&&(i-b)/a>=0)c.14(i);o c})},1y:q(c,d,e,f,g){E(c.M==0)o[];E(d==\'aP\')d=\'2n+0\';E(d==\'aQ\')d=\'2n+1\';G h=O.1C,15=[],8e=[],m;h.6E(c);N(G i=0,L;L=c[i];i++){E(!L.1A.2M){h.50(L.1A,f,g);8e.14(L.1A)}}E(d.1k(/^\\d+$/)){d=3T(d);N(G i=0,L;L=c[i];i++)E(L.6F==d)15.14(L)}19 E(m=d.1k(/^(-?\\d*)?n(([+-])(\\d+))?/)){E(m[1]=="-")m[1]=-1;G a=m[1]?3T(m[1]):1;G b=m[2]?3T(m[2]):0;G k=O.1H.aS(a,b,c.M);N(G i=0,L,l=k.M;L=c[i];i++){N(G j=0;j<l;j++)E(L.6F==k[j])15.14(L)}}h.4d(c);h.4d(8e);o 15},\'4n\':q(a,b,c){N(G i=0,15=[],L;L=a[i];i++){E(L.1h==\'!\'||(L.4x&&!L.3t.1k(/^\\s*$/)))2F;15.14(L)}o 15},\'3G\':q(a,b,c){G h=O.1C,eZ,m;G d=1e O(b).6B(c);h.6E(d);N(G i=0,15=[],L;L=a[i];i++)E(!L.2M)15.14(L);h.4d(d);o 15},\'aO\':q(a,b,c){N(G i=0,15=[],L;L=a[i];i++)E(!L.2z)15.14(L);o 15},\'2z\':q(a,b,c){N(G i=0,15=[],L;L=a[i];i++)E(L.2z)15.14(L);o 15},\'2K\':q(a,b,c){N(G i=0,15=[],L;L=a[i];i++)E(L.2K)15.14(L);o 15}},5y:{\'=\':q(a,v){o a==v},\'!=\':q(a,v){o a!=v},\'^=\':q(a,v){o a.77(v)},\'$=\':q(a,v){o a.91(v)},\'*=\':q(a,v){o a.1p(v)},\'~=\':q(a,v){o(\' \'+a+\' \').1p(\' \'+v+\' \')},\'|=\':q(a,v){o(\'-\'+a.2f()+\'-\').1p(\'-\'+v.2f()+\'-\')}},32:q(a){G b=[];a.8S(/(([\\w#:.~>+()\\s-]+|\\*|\\[.*?\\])+)\\s*(,|$)/,q(m){b.14(m[1].2T())});o b},aT:q(a,b){G c=$$(b),h=O.1C;h.6E(c);N(G i=0,15=[],1u;1u=a[i];i++)E(1u.2M)15.14(1u);h.4d(c);o 15},4y:q(a,b,c){E(J.3Q(b)){c=b;b=1d}o O.aT(a,b||\'*\')[c||0]},6f:q(a,b){b=O.32(b.1P(\',\'));G c=[],h=O.1C;N(G i=0,l=b.M,8f;i<l;i++){8f=1e O(b[i].2T());h.1z(c,8f.6B(a))}o(l>1)?h.85(c):c}});E(Y.1w.2N){J.U(O.1C,{1z:q(a,b){N(G i=0,L;L=b[i];i++)E(L.1h!=="!")a.14(L);o a},4d:q(a){N(G i=0,L;L=a[i];i++)L.7N(\'2M\');o a}})}q $$(){o O.6f(V,$A(1c))}G 1j={8g:q(a){$(a).8g();o a},aU:q(c,d){E(2R d!=\'2D\')d={6G:!!d};19 E(J.1X(d.6G))d.6G=1f;G e,1g,8h=1d,4e=d.4e;G f=c.2E({},q(a,b){E(!b.2z&&b.21){e=b.21;1g=$(b).2j();E(1g!=17&&(b.1n!=\'4e\'||(!8h&&4e!==1d&&(!4e||e==4e)&&(8h=1f)))){E(e 1s a){E(!J.3n(a[e]))a[e]=[a[e]];a[e].14(1g)}19 a[e]=1g}}o a});o d.6G?f:J.3m(f)}};1j.W={5C:q(a,b){o 1j.aU(1j.4O(a),b)},4O:q(c){o $A($(c).3i(\'*\')).2E([],q(a,b){E(1j.I.4P[b.1h.1G()])a.14(I.U(b));o a})},f0:q(a,b,c){a=$(a);G d=a.3i(\'6H\');E(!b&&!c)o $A(d).2e(I.U);N(G i=0,8i=[],M=d.M;i<M;i++){G e=d[i];E((b&&e.1n!=b)||(c&&e.21!=c))2F;8i.14(I.U(e))}o 8i},8j:q(a){a=$(a);1j.4O(a).5P(\'8j\');o a},8k:q(a){a=$(a);1j.4O(a).5P(\'8k\');o a},aV:q(b){G c=$(b).4O().4p(q(a){o\'6n\'!=a.1n&&!a.2z});G d=c.4p(q(a){o a.2J(\'6t\')&&a.6t>=0}).9e(q(a){o a.6t}).2C();o d?d:c.7f(q(a){o[\'6H\',\'20\',\'8l\'].1p(a.1h.1G())})},f1:q(a){a=$(a);a.aV().aW();o a},2V:q(a,b){a=$(a),b=J.1Z(b||{});G c=b.2v,4J=a.43(\'4J\')||\'\';E(4J.3S())4J=1i.68.ap;b.2v=a.5C(1f);E(c){E(J.2l(c))c=c.5U();J.U(b.2v,c)}E(a.2J(\'28\')&&!b.28)b.28=a.28;o 1e 1t.3V(4J,b)}};1j.I={8m:q(a){$(a).8m();o a},20:q(a){$(a).20();o a}};1j.I.W={5C:q(a){a=$(a);E(!a.2z&&a.21){G b=a.2j();E(b!=3k){G c={};c[a.21]=b;o J.3m(c)}}o\'\'},2j:q(a){a=$(a);G b=a.1h.1G();o 1j.I.4P[b](a)},f2:q(a,b){a=$(a);G c=a.1h.1G();1j.I.4P[c](a,b);o a},9h:q(a){$(a).1g=\'\';o a},f3:q(a){o $(a).1g!=\'\'},aW:q(a){a=$(a);1N{a.8m();E(a.20&&(a.1h.1G()!=\'6H\'||![\'8n\',\'8g\',\'4e\'].1p(a.1n)))a.20()}1Y(e){}o a},8j:q(a){a=$(a);a.f4();a.2z=1f;o a},8k:q(a){a=$(a);a.2z=1d;o a}};G f5=1j.I;G $F=1j.I.W.2j;1j.I.4P={6H:q(a,b){4h(a.1n.1G()){1O\'aX\':1O\'aY\':o 1j.I.4P.aZ(a,b);5r:o 1j.I.4P.8l(a,b)}},aZ:q(a,b){E(J.1X(b))o a.2K?a.1g:17;19 a.2K=!!b},8l:q(a,b){E(J.1X(b))o a.1g;19 a.1g=b},20:q(a,b){E(J.1X(b))o C[a.1n==\'20-f6\'?\'b0\':\'b1\'](a);19{G c,1g,b2=!J.3n(b);N(G i=0,M=a.M;i<M;i++){c=a.1b[i];1g=C.6I(c);E(b2){E(1g==b){c.8o=1f;o}}19 c.8o=b.1p(1g)}}},b0:q(a){G b=a.f7;o b>=0?C.6I(a.1b[b]):17},b1:q(a){G b,M=a.M;E(!M)o 17;N(G i=0,b=[];i<M;i++){G c=a.1b[i];E(c.8o)b.14(C.6I(c))}o b},6I:q(a){o I.U(a).2J(\'1g\')?a.1g:a.2U}};3P.8p=1E.1L(8N,{22:q($2Y,b,c,d){$2Y(d,c);C.1u=$(b);C.3H=C.2j()},6Y:q(){G a=C.2j();E(J.2l(C.3H)&&J.2l(a)?C.3H!=a:1B(C.3H)!=1B(a)){C.4W(C.1u,a);C.3H=a}}});1j.I.b3=1E.1L(3P.8p,{2j:q(){o 1j.I.2j(C.1u)}});1j.b3=1E.1L(3P.8p,{2j:q(){o 1j.5C(C.1u)}});3P.5D=1E.1L({22:q(a,b){C.1u=$(a);C.4W=b;C.3H=C.2j();E(C.1u.1h.1G()==\'6S\')C.b4();19 C.4Y(C.1u)},8q:q(){G a=C.2j();E(C.3H!=a){C.4W(C.1u,a);C.3H=a}},b4:q(){1j.4O(C.1u).1l(C.4Y,C)},4Y:q(a){E(a.1n){4h(a.1n.1G()){1O\'aX\':1O\'aY\':1m.3I(a,\'f8\',C.8q.1o(C));1F;5r:1m.3I(a,\'f9\',C.8q.1o(C));1F}}}});1j.I.5D=1E.1L(3P.5D,{2j:q(){o 1j.I.2j(C.1u)}});1j.5D=1E.1L(3P.5D,{2j:q(){o 1j.5C(C.1u)}});E(!1i.1m)G 1m={};J.U(1m,{fa:8,fb:9,fc:13,fd:27,fe:37,ff:38,fg:39,fh:40,fi:46,fj:36,fk:35,fl:33,fm:34,fn:45,5e:{},8r:q(a){G b;4h(a.1n){1O\'fo\':b=a.fp;1F;1O\'fq\':b=a.2x;1F;5r:o 17}o I.U(b)}});1m.W=(q(){G e;E(Y.1w.2N){G f={0:1,1:4,2:2};e=q(a,b){o a.8n==f[b]}}19 E(Y.1w.3j){e=q(a,b){4h(b){1O 0:o a.6J==1&&!a.b5;1O 1:o a.6J==1&&a.b5;5r:o 1d}}}19{e=q(a,b){o a.6J?(a.6J===b+1):(a.8n===b)}}o{fr:q(a){o e(a,0)},fs:q(a){o e(a,1)},ft:q(a){o e(a,2)},1u:q(a){G b=1m.U(a).b6;o I.U(b.2t==5d.9O?b.1A:b)},4y:q(a,b){G c=1m.1u(a);E(!b)o c;G d=[c].1z(c.7I());o O.4y(d,b,0)},6K:q(a){o{x:a.b7||(a.fu+(V.3D.3A||V.1S.3A)),y:a.b8||(a.fv+(V.3D.3z||V.1S.3z))}},fw:q(a){o 1m.6K(a).x},fx:q(a){o 1m.6K(a).y},6Z:q(a){1m.U(a);a.b9();a.ba();a.fy=1f}}})();1m.U=(q(){G c=J.4g(1m.W).2E({},q(m,a){m[a]=1m.W[a].3o();o m});E(Y.1w.2N){J.U(c,{ba:q(){C.fz=1f},b9:q(){C.fA=1d},1W:q(){o"[2D 1m]"}});o q(a){E(!a)o 1d;E(a.6y)o a;a.6y=Y.2q;G b=1m.6K(a);J.U(a,{b6:a.fB,8r:1m.8r(a),b7:b.x,b8:b.y});o J.U(a,c)}}19{1m.18=1m.18||V.5E("bb").3M;J.U(1m.18,c);o Y.K}})();J.U(1m,(q(){G h=1m.5e;q 8s(a){E(a.8t)o a.8t[0];1c.4k.29=1c.4k.29||1;o a.8t=[++1c.4k.29]}q 8u(a){E(a&&a.1p(\':\'))o"bc";o a}q 6L(a){o h[a]=h[a]||{}}q 6M(a,b){G c=6L(a);o c[b]=c[b]||[]}q bd(b,d,e){G f=8s(b);G c=6M(f,d);E(c.4q("6N").1p(e))o 1d;G g=q(a){E(!1m||!1m.U||(a.8v&&a.8v!=d))o 1d;1m.U(a);e.7E(b,a)};g.6N=e;c.14(g);o g}q 8w(b,d,e){G c=6M(b,d);o c.7f(q(a){o a.6N==e})}q be(a,b,d){G c=6L(a);E(!c[b])o 1d;c[b]=c[b].56(8w(a,b,d))}q bf(){N(G a 1s h)N(G b 1s h[a])h[a][b]=17}E(1i.5J){1i.5J("ar",bf)}o{3I:q(a,b,c){a=$(a);G d=8u(b);G e=bd(a,b,c);E(!e)o a;E(a.6O){a.6O(d,e,1d)}19{a.5J("4u"+d,e)}o a},4f:q(b,c,d){b=$(b);G e=8s(b),21=8u(c);E(!d&&c){6M(e,c).1l(q(a){b.4f(c,a.6N)});o b}19 E(!c){J.4g(6L(e)).1l(q(a){b.4f(a)});o b}G f=8w(e,c,d);E(!f)o b;E(b.bg){b.bg(21,f,1d)}19{b.fC("4u"+21,f)}be(e,c,d);o b},4Q:q(a,b,c){a=$(a);E(a==V&&V.5E&&!a.bh)a=V.3D;G d;E(V.5E){d=V.5E("bb");d.fD("bc",1f,1f)}19{d=V.fE();d.bi="fF"}d.8v=b;d.fG=c||{};E(V.5E){a.bh(d)}19{a.fH(d.bi,d)}o 1m.U(d)}}})());J.U(1m,1m.W);I.4V({4Q:1m.4Q,3I:1m.3I,4f:1m.4f});J.U(V,{4Q:I.W.4Q.3o(),3I:I.W.3I.3o(),4f:I.W.4f.3o(),5F:1d});(q(){G a;q 5G(){E(V.5F)o;E(a)1i.8P(a);V.4Q("fI:5F");V.5F=1f}E(V.6O){E(Y.1w.3j){a=1i.8O(q(){E(/5F|bj/.2d(V.2W))5G()},0);1m.3I(1i,"fJ",5G)}19{V.6O("fK",5G,1d)}}19{V.5l("<4T 29=bk 3p aq=//:><\\/4T>");$("bk").63=q(){E(C.2W=="bj"){C.63=17;5G()}}}})();2S.3m=J.3m;G fL={3e:I.9P};I.W.fM=I.W.6j;G fN={fO:q(a,b){o I.2w(a,{7H:b})},fP:q(a,b){o I.2w(a,{2h:b})},fQ:q(a,b){o I.2w(a,{41:b})},fR:q(a,b){o I.2w(a,{6c:b})}};G $2F=1e fS(\'"3l $2F" fT fU, fV "o" fW\');G 8x={bl:1d,8y:q(){C.bm=1i.aH||V.3D.3A||V.1S.3A||0;C.bn=1i.aI||V.3D.3z||V.1S.3z||0},fX:q(a,x,y){E(C.bl)o C.bo(a,x,y);C.5H=x;C.5I=y;C.2i=I.44(a);o(y>=C.2i[1]&&y<C.2i[1]+a.4F&&x>=C.2i[0]&&x<C.2i[0]+a.4E)},bo:q(a,x,y){G b=I.7W(a);C.5H=x+b[0]-C.bm;C.5I=y+b[1]-C.bn;C.2i=I.44(a);o(C.5I>=C.2i[1]&&C.5I<C.2i[1]+a.4F&&C.5H>=C.2i[0]&&C.5H<C.2i[0]+a.4E)},fY:q(a,b){E(!a)o 0;E(a==\'fZ\')o((C.2i[1]+b.4F)-C.5I)/b.4F;E(a==\'g0\')o((C.2i[0]+b.4E)-C.5H)/b.4E},44:I.W.44,5p:I.W.5p,7U:q(a){8x.8y();o I.7U(a)},7V:q(a){8x.8y();o I.7V(a)},g1:I.W.7W,3f:I.W.4I,g2:I.W.5q,1Z:q(a,b,c){c=c||{};o I.af(b,a,c)}};E(!V.6P)V.6P=q(f){q 8z(a){o a.3S()?17:"[5x(1z(\' \', @5h, \' \'), \' "+a+" \')]"}f.6P=Y.2P.5L?q(a,b){b=b.24().2T();G c=/\\s/.2d(b)?$w(b).2e(8z).1P(\'\'):8z(b);o c?V.7D(\'.//*\'+c,a):[]}:q(b,c){c=c.24().2T();G d=[],5m=(/\\s/.2d(c)?$w(c):17);E(!5m&&!c)o d;G e=$(b).3i(\'*\');c=\' \'+c+\' \';N(G i=0,1r,cn;1r=e[i];i++){E(1r.1J&&(cn=\' \'+1r.1J+\' \')&&(cn.1p(c)||(5m&&5m.7d(q(a){o!a.24().3S()&&cn.1p(\' \'+a+\' \')}))))d.14(I.U(1r))}o d};o q(a,b){o $(b||V.1S).6P(a)}}(I.W);I.6h=1E.1L();I.6h.18={22:q(a){C.1u=$(a)},3c:q(b){C.1u.1J.32(/\\s+/).20(q(a){o a.M>0}).3c(b)},58:q(a){C.1u.1J=a},g3:q(a){E(C.1p(a))o;C.58($A(C).1z(a).1P(\' \'))},9S:q(a){E(!C.1p(a))o;C.58($A(C).56(a).1P(\' \'))},24:q(){o $A(C).1P(\' \')}};J.U(I.6h.18,26);I.4V();',62,996,'||||||||||||||||||||||||return||function||||||||||||this||if||var||Element|Object||node|length|for|Selector||||||extend|document|Methods||Prototype||||||push|results||null|prototype|else|style|options|arguments|false|new|true|value|tagName|window|Form|match|each|Event|type|bind|include|while|child|in|Ajax|element|position|Browser|replace|nth|concat|parentNode|String|handlers|getStyle|Class|break|toLowerCase|pseudos|Array|className|_getEv|create|isFunction|try|case|join|last|transport|body|width|of|xpath|inspect|isUndefined|catch|clone|select|name|initialize||toString|values|Enumerable||method|id|valueL|evaluate|args|test|map|toUpperCase|Template|top|offset|getValue|div|isString|gsub||childNodes|px|emptyFunction|klass|toJSON|nodeType|toArray|parameters|insert|toElement|height|disabled|ByTag|apply|first|object|inject|continue|_attributeTranslations|opacity|left|hasAttribute|checked|matcher|_countedByPrototype|IE|indexOf|BrowserFeatures|createElement|typeof|Hash|strip|text|request|readyState|expression|super|isElement||toHTML|split||||||||RegExp|stripScripts|_each|response|display|offsetParent|ps|le|getElementsByTagName|WebKit|undefined|throw|toQueryString|isArray|methodize|defer|toPaddedString|source|slice|innerHTML|_object|onComplete|responseText|nextSibling|names|scrollTop|scrollLeft|tags|table|documentElement|descendant|sibling|not|lastValue|observe|Opera|navigator|userAgent|__proto__|shift|wrap|Abstract|isNumber|evalScripts|blank|Number|update|Request|url|dispatchException|success|decay||bottom|adjacent|readAttribute|cumulativeOffset|||_overflow|offsetTop|offsetLeft|_returnOffset|_cache|formula|unmark|submit|stopObserving|keys|switch|interpret|timer|callee|substring|evalJSON|empty|appendChild|findAll|pluck|filter|key|Responders|on|getHeader|_insertionTranslations|firstChild|findElement|getDimensions|nextAncestor|parseFloat|setStyle|setOpacity|offsetWidth|offsetHeight|absolute|static|getOffsetParent|action|tbody|Heading|attrPresence|attr|getElements|Serializers|fire|ElementExtensions|HTMLElement|script|properties|addMethods|callback|frequency|registerCallback|onTimerEvent|index|capitalize|_|expr|criteria|reverse|without|toObject|set|start|responders|post|getStatus|Node|cache|writeAttribute|removeChild|class|nextSiblings|previousElementSibling|nextElementSibling|write|classNames|sourceIndex|relative|positionedOffset|viewportOffset|default|_flag|property|patterns|following|laterSibling|contains|operators|pseudo|only|nodeClassName|serialize|EventObserver|createEvent|loaded|fireContentLoadedEvent|xcomp|ycomp|attachEvent|Gecko|XPath|SpecificElementExtensions|ScriptFragment|string|invoke|curry|currentlyExecuting|eval|escapeHTML|toQueryParams|times|charAt|detect|pair|dispatch|onCreate|asynchronous|application|onreadystatechange|status|headerJSON|isSameOrigin|port|location|container|insertion|none|after|_getContentFromAnonymousElement|recursivelyCollect|findChildElements|read|ClassNames|hasClassName|descendantOf|cssFloat|auto|00001|hidden|right|border|padding|title|_getAttr|tabIndex|insertBefore|TBODY|tr|Simulated|_extendedByPrototype|refresh|copy|findElements|token|count|mark|nodeIndex|hash|input|optionValue|which|pointer|getCacheForID|getWrappersForEventName|handler|addEventListener|getElementsByClassName|Version|opera|form|superclass|isHash|Function|delay|_methodized|execute|stop|prepareReplacement|nodeValue|decodeURIComponent|succ|camelize|len|unfilterJSON|startsWith|lastIndexOf|toTemplateReplacements|slices|array|collect|all|falses|find|_reverse|toQueryPair|get|delete|end|activeRequestCount|Base|encoding|evalJS|_complete|Response|respondToReadyState|onStateChange|Content|Complete|protocol|domain|getResponseHeader|statusText|getAllResponseHeaders|failure|updater|elements|_getElementsByXPath|call|visible|replaceChild|before|ancestors|previousSiblings|self|attributes|getAttribute|removeAttribute|float|cssText|styleFloat|visibility|_madePositioned|overflow|absolutize|relativize|cumulativeScrollOffset|zoom|currentStyle|alpha|stripAlpha|has|TD|TableSection|HTML|unique|tokens|assertions|matches|or|preceding|and|predicate|fragment|indexed|selector|reset|submitted|matchingInputs|disable|enable|textarea|focus|button|selected|TimedObserver|onElementEvent|relatedTarget|getEventID|_prototypeEventID|getDOMEventName|eventName|findWrapper|Position|prepare|iter|KHTML|MobileSafari|Safari|JSONFilter|subclasses|valueOf|argumentNames|instanceof|timeout|1000|Try|these|escape|PeriodicalExecuter|setInterval|clearInterval|specialChar|sub|scan|stripTags|gi|img|extractScripts|unescapeHTML|charCodeAt|isJSON|JSON|endsWith|interpolate|amp|lt|gt|createTextNode|with|template|pattern|Pattern|exec|eachSlice|any|sortBy|size|from|clear|flatten|uniq|forEach|arrayLength|encodeURIComponent|ObjectRange|exclusive|getTransport|XMLHttpRequest|ActiveXObject|XMLHTTP|register|contentType|setRequestHeaders|overrideMimeType|xml|2005|requestHeaders|Events|force|evalResponse|onException|getStatusText|_getHeaderJSON|responseXML|_getResponseJSON|sanitizeJSON|Updater|updateContent|updateComplete|lastText|ELEMENT_NODE|TEXT_NODE|toggle|hide|show|remove|attribute|descendants|firstDescendant|immediateDescendants|previousSibling|next|identify|counter|setAttribute|getHeight|getWidth|addClassName|removeClassName|compareDocumentPosition|scrollTo|clientWidth|clientHeight|BODY|_originalLeft|_originalTop|_originalWidth|_originalHeight|clonePosition|setLeft|setTop|setWidth|setHeight|htmlFor|parseInt|100|_getAttrNode|getAttributeNode|href|src|onunload||IMG|outerHTML|TR|td|SELECT|THEAD|TFOOT|TH|TEXTAREA|findDOMClass|Mod|TableCol|TableCell|client|pageXOffset|pageYOffset|compileMatcher|shouldUseXPath|compileXPathMatcher|root|local|enabled|even|odd|byClassName|getIndices|matchElements|serializeElements|findFirstElement|activate|checkbox|radio|inputSelector|selectOne|selectMany|single|Observer|registerFormCallbacks|metaKey|target|pageX|pageY|preventDefault|stopPropagation|HTMLEvents|dataavailable|createWrapper|destroyWrapper|destroyCache|removeEventListener|dispatchEvent|eventType|complete|__onDOMContentLoaded|includeScrollOffsets|deltaX|deltaY|withinIncludingScrolloffsets|AppleWebKit|Apple|Mobile|secure|constructor|RangeError|unknown|boolean|splice|number|bindAsEventListener|event|setTimeout|01|Date|getUTCFullYear|getUTCMonth|getUTCDate|getUTCHours|getUTCMinutes|getUTCSeconds|finally|truncate|im|data|fromCharCode|underscore|dasherize|x00|x1f|u00|Eaeflnr|SyntaxError|Badly|formed|parseQuery|grep|inGroupsOf|max|min|partition|reject|sort|zip|pop|member|entries|every|some|NodeList|compact|reduce|intersect|isNaN|toColorPart|isFinite|abs|round|ceil|floor||Math|unset|merge|Msxml2|Microsoft|unregister|www|urlencoded|UTF|_method|Konqueror|open|postBody|send|Requested|With|Accept|javascript|html|charset|Connection|close|setRequestHeader|200|300|Success|Failure|java|ecma|https|Uninitialized|Loading|Loaded|Interactive|responseJSON|getAllHeaders|json|PeriodicalUpdater|clearTimeout|getElementById|XPathResult|ORDERED_NODE_SNAPSHOT_TYPE|snapshotLength|snapshotItem|ATTRIBUTE_NODE|CDATA_SECTION_NODE|ENTITY_REFERENCE_NODE|ENTITY_NODE|PROCESSING_INSTRUCTION_NODE|COMMENT_NODE|DOCUMENT_NODE|DOCUMENT_TYPE_NODE|DOCUMENT_FRAGMENT_NODE|NOTATION_NODE|cloneNode|ownerDocument|createRange|selectNode|createContextualFragment|siblings|up|down||previous|anonymous_element_|toggleClassName|cleanWhitespace|defaultView|getComputedStyle|getOpacity|block|makePositioned|undoPositioned|makeClipping|undoClipping|getElementsBySelector|childElements|fixed|hasLayout|normal|cellpadding|cellPadding|cellspacing|cellSpacing|colSpan|rowSpan|vAlign|dateTime|accessKey|encType|maxLength|readOnly|longDesc|readonly|multiple|onload|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onfocus|onblur|onkeypress|onkeydown|onkeyup|onsubmit|onreset|onselect|onchange|rv|999999|TABLE|specified|FORM|INPUT|OPTGROUP|OptGroup|TextArea|Paragraph|FIELDSET||FieldSet|UL|UList|OL|OList|DL|DList|DIR|Directory|H1|H2|H3|H4|H5|H6|Quote|INS|DEL|Anchor|Image|CAPTION|TableCaption|COL|COLGROUP|TableRow|FRAMESET|FrameSet|IFRAME|IFrame|viewport|inner|getScrollOffsets|starts|translate|mod|dis|abled|selectorType|getInputs|focusFirstElement|setValue|present|blur|Field|one|selectedIndex|click|change|KEY_BACKSPACE|KEY_TAB|KEY_RETURN|KEY_ESC|KEY_LEFT|KEY_UP|KEY_RIGHT|KEY_DOWN|KEY_DELETE|KEY_HOME|KEY_END|KEY_PAGEUP|KEY_PAGEDOWN|KEY_INSERT|mouseover|fromElement|mouseout|isLeftClick|isMiddleClick|isRightClick|clientX|clientY|pointerX|pointerY|stopped|cancelBubble|returnValue|srcElement|detachEvent|initEvent|createEventObject|ondataavailable|memo|fireEvent|dom|load|DOMContentLoaded|Toggle|childOf|Insertion|Before|Top|Bottom|After|Error|is|deprecated|use|instead|within|overlap|vertical|horizontal|realOffset|page|add'.split('|'),0,{}));// script.aculo.us scriptaculous.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008

// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// 
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
// 
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// For details, see the script.aculo.us web site: http://script.aculo.us/

var Scriptaculous = {
  Version: '1.8.1',
  require: function(libraryName) {
    // inserting via DOM fails in Safari 2.0, so brute force approach
    document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>');
  },
  REQUIRED_PROTOTYPE: '1.6.0',
  load: function() {
    function convertVersionString(versionString){
      var r = versionString.split('.');
      return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]);
    }
 
    if((typeof Prototype=='undefined') || 
       (typeof Element == 'undefined') || 
       (typeof Element.Methods=='undefined') ||
       (convertVersionString(Prototype.Version) < 
        convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE)))
       throw("script.aculo.us requires the Prototype JavaScript framework >= " +
        Scriptaculous.REQUIRED_PROTOTYPE);
    
    $A(document.getElementsByTagName("script")).findAll( function(s) {
      return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
    }).each( function(s) {
      var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
      var includes = s.src.match(/\?.*load=([a-z,]*)/);
      (includes ? includes[1] : 'effects').split(',').each(
       function(include) { Scriptaculous.require(path+include+'.js') });
    });
  }
}

Scriptaculous.load();;// script.aculo.us effects.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008

// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// Contributors:
//  Justin Palmer (http://encytemedia.com/)
//  Mark Pilgrim (http://diveintomark.org/)
//  Martin Bialasinki
// 
// script.aculo.us is freely distributable under the terms of an MIT-style license.
// For details, see the script.aculo.us web site: http://script.aculo.us/ 

// converts rgb() and #xxx to #xxxxxx format,  
// returns self (or first argument) if not convertable  
String.prototype.parseColor = function() {  
  var color = '#';
  if (this.slice(0,4) == 'rgb(') {  
    var cols = this.slice(4,this.length-1).split(',');  
    var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);  
  } else {  
    if (this.slice(0,1) == '#') {  
      if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();  
      if (this.length==7) color = this.toLowerCase();  
    }  
  }  
  return (color.length==7 ? color : (arguments[0] || this));  
};

/*--------------------------------------------------------------------------*/

Element.collectTextNodes = function(element) {  
  return $A($(element).childNodes).collect( function(node) {
    return (node.nodeType==3 ? node.nodeValue : 
      (node.hasChildNodes() ? Element.collectTextNodes(node) : ''));
  }).flatten().join('');
};

Element.collectTextNodesIgnoreClass = function(element, className) {  
  return $A($(element).childNodes).collect( function(node) {
    return (node.nodeType==3 ? node.nodeValue : 
      ((node.hasChildNodes() && !Element.hasClassName(node,className)) ? 
        Element.collectTextNodesIgnoreClass(node, className) : ''));
  }).flatten().join('');
};

Element.setContentZoom = function(element, percent) {
  element = $(element);  
  element.setStyle({fontSize: (percent/100) + 'em'});   
  if (Prototype.Browser.WebKit) window.scrollBy(0,0);
  return element;
};

Element.getInlineOpacity = function(element){
  return $(element).style.opacity || '';
};

Element.forceRerendering = function(element) {
  try {
    element = $(element);
    var n = document.createTextNode(' ');
    element.appendChild(n);
    element.removeChild(n);
  } catch(e) { }
};

/*--------------------------------------------------------------------------*/

var Effect = {
  _elementDoesNotExistError: {
    name: 'ElementDoesNotExistError',
    message: 'The specified DOM element does not exist, but is required for this effect to operate'
  },
  Transitions: {
    linear: Prototype.K,
    sinoidal: function(pos) {
      return (-Math.cos(pos*Math.PI)/2) + 0.5;
    },
    reverse: function(pos) {
      return 1-pos;
    },
    flicker: function(pos) {
      var pos = ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
      return pos > 1 ? 1 : pos;
    },
    wobble: function(pos) {
      return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
    },
    pulse: function(pos, pulses) { 
      pulses = pulses || 5; 
      return (
        ((pos % (1/pulses)) * pulses).round() == 0 ? 
              ((pos * pulses * 2) - (pos * pulses * 2).floor()) : 
          1 - ((pos * pulses * 2) - (pos * pulses * 2).floor())
        );
    },
    spring: function(pos) { 
      return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6)); 
    },
    none: function(pos) {
      return 0;
    },
    full: function(pos) {
      return 1;
    }
  },
  DefaultOptions: {
    duration:   1.0,   // seconds
    fps:        100,   // 100= assume 66fps max.
    sync:       false, // true for combining
    from:       0.0,
    to:         1.0,
    delay:      0.0,
    queue:      'parallel'
  },
  tagifyText: function(element) {
    var tagifyStyle = 'position:relative';
    if (Prototype.Browser.IE) tagifyStyle += ';zoom:1';
    
    element = $(element);
    $A(element.childNodes).each( function(child) {
      if (child.nodeType==3) {
        child.nodeValue.toArray().each( function(character) {
          element.insertBefore(
            new Element('span', {style: tagifyStyle}).update(
              character == ' ' ? String.fromCharCode(160) : character), 
              child);
        });
        Element.remove(child);
      }
    });
  },
  multiple: function(element, effect) {
    var elements;
    if (((typeof element == 'object') || 
        Object.isFunction(element)) && 
       (element.length))
      elements = element;
    else
      elements = $(element).childNodes;
      
    var options = Object.extend({
      speed: 0.1,
      delay: 0.0
    }, arguments[2] || { });
    var masterDelay = options.delay;

    $A(elements).each( function(element, index) {
      new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay }));
    });
  },
  PAIRS: {
    'slide':  ['SlideDown','SlideUp'],
    'blind':  ['BlindDown','BlindUp'],
    'appear': ['Appear','Fade']
  },
  toggle: function(element, effect) {
    element = $(element);
    effect = (effect || 'appear').toLowerCase();
    var options = Object.extend({
      queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
    }, arguments[2] || { });
    Effect[element.visible() ? 
      Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
  }
};

Effect.DefaultOptions.transition = Effect.Transitions.sinoidal;

/* ------------- core effects ------------- */

Effect.ScopedQueue = Class.create(Enumerable, {
  initialize: function() {
    this.effects  = [];
    this.interval = null;    
  },
  _each: function(iterator) {
    this.effects._each(iterator);
  },
  add: function(effect) {
    var timestamp = new Date().getTime();
    
    var position = Object.isString(effect.options.queue) ? 
      effect.options.queue : effect.options.queue.position;
    
    switch(position) {
      case 'front':
        // move unstarted effects after this effect  
        this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
            e.startOn  += effect.finishOn;
            e.finishOn += effect.finishOn;
          });
        break;
      case 'with-last':
        timestamp = this.effects.pluck('startOn').max() || timestamp;
        break;
      case 'end':
        // start effect after last queued effect has finished
        timestamp = this.effects.pluck('finishOn').max() || timestamp;
        break;
    }
    
    effect.startOn  += timestamp;
    effect.finishOn += timestamp;

    if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit))
      this.effects.push(effect);
    
    if (!this.interval)
      this.interval = setInterval(this.loop.bind(this), 15);
  },
  remove: function(effect) {
    this.effects = this.effects.reject(function(e) { return e==effect });
    if (this.effects.length == 0) {
      clearInterval(this.interval);
      this.interval = null;
    }
  },
  loop: function() {
    var timePos = new Date().getTime();
    for(var i=0, len=this.effects.length;i<len;i++) 
      this.effects[i] && this.effects[i].loop(timePos);
  }
});

Effect.Queues = {
  instances: $H(),
  get: function(queueName) {
    if (!Object.isString(queueName)) return queueName;
    
    return this.instances.get(queueName) ||
      this.instances.set(queueName, new Effect.ScopedQueue());
  }
};
Effect.Queue = Effect.Queues.get('global');

Effect.Base = Class.create({
  position: null,
  start: function(options) {
    function codeForEvent(options,eventName){
      return (
        (options[eventName+'Internal'] ? 'this.options.'+eventName+'Internal(this);' : '') +
        (options[eventName] ? 'this.options.'+eventName+'(this);' : '')
      );
    }
    if (options && options.transition === false) options.transition = Effect.Transitions.linear;
    this.options      = Object.extend(Object.extend({ },Effect.DefaultOptions), options || { });
    this.currentFrame = 0;
    this.state        = 'idle';
    this.startOn      = this.options.delay*1000;
    this.finishOn     = this.startOn+(this.options.duration*1000);
    this.fromToDelta  = this.options.to-this.options.from;
    this.totalTime    = this.finishOn-this.startOn;
    this.totalFrames  = this.options.fps*this.options.duration;
    
    eval('this.render = function(pos){ '+
      'if (this.state=="idle"){this.state="running";'+
      codeForEvent(this.options,'beforeSetup')+
      (this.setup ? 'this.setup();':'')+ 
      codeForEvent(this.options,'afterSetup')+
      '};if (this.state=="running"){'+
      'pos=this.options.transition(pos)*'+this.fromToDelta+'+'+this.options.from+';'+
      'this.position=pos;'+
      codeForEvent(this.options,'beforeUpdate')+
      (this.update ? 'this.update(pos);':'')+
      codeForEvent(this.options,'afterUpdate')+
      '}}');
    
    this.event('beforeStart');
    if (!this.options.sync)
      Effect.Queues.get(Object.isString(this.options.queue) ? 
        'global' : this.options.queue.scope).add(this);
  },
  loop: function(timePos) {
    if (timePos >= this.startOn) {
      if (timePos >= this.finishOn) {
        this.render(1.0);
        this.cancel();
        this.event('beforeFinish');
        if (this.finish) this.finish(); 
        this.event('afterFinish');
        return;  
      }
      var pos   = (timePos - this.startOn) / this.totalTime,
          frame = (pos * this.totalFrames).round();
      if (frame > this.currentFrame) {
        this.render(pos);
        this.currentFrame = frame;
      }
    }
  },
  cancel: function() {
    if (!this.options.sync)
      Effect.Queues.get(Object.isString(this.options.queue) ? 
        'global' : this.options.queue.scope).remove(this);
    this.state = 'finished';
  },
  event: function(eventName) {
    if (this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this);
    if (this.options[eventName]) this.options[eventName](this);
  },
  inspect: function() {
    var data = $H();
    for(property in this)
      if (!Object.isFunction(this[property])) data.set(property, this[property]);
    return '#<Effect:' + data.inspect() + ',options:' + $H(this.options).inspect() + '>';
  }
});

Effect.Parallel = Class.create(Effect.Base, {
  initialize: function(effects) {
    this.effects = effects || [];
    this.start(arguments[1]);
  },
  update: function(position) {
    this.effects.invoke('render', position);
  },
  finish: function(position) {
    this.effects.each( function(effect) {
      effect.render(1.0);
      effect.cancel();
      effect.event('beforeFinish');
      if (effect.finish) effect.finish(position);
      effect.event('afterFinish');
    });
  }
});

Effect.Tween = Class.create(Effect.Base, {
  initialize: function(object, from, to) {
    object = Object.isString(object) ? $(object) : object;
    var args = $A(arguments), method = args.last(), 
      options = args.length == 5 ? args[3] : null;
    this.method = Object.isFunction(method) ? method.bind(object) :
      Object.isFunction(object[method]) ? object[method].bind(object) : 
      function(value) { object[method] = value };
    this.start(Object.extend({ from: from, to: to }, options || { }));
  },
  update: function(position) {
    this.method(position);
  }
});

Effect.Event = Class.create(Effect.Base, {
  initialize: function() {
    this.start(Object.extend({ duration: 0 }, arguments[0] || { }));
  },
  update: Prototype.emptyFunction
});

Effect.Opacity = Class.create(Effect.Base, {
  initialize: function(element) {
    this.element = $(element);
    if (!this.element) throw(Effect._elementDoesNotExistError);
    // make this work on IE on elements without 'layout'
    if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout))
      this.element.setStyle({zoom: 1});
    var options = Object.extend({
      from: this.element.getOpacity() || 0.0,
      to:   1.0
    }, arguments[1] || { });
    this.start(options);
  },
  update: function(position) {
    this.element.setOpacity(position);
  }
});

Effect.Move = Class.create(Effect.Base, {
  initialize: function(element) {
    this.element = $(element);
    if (!this.element) throw(Effect._elementDoesNotExistError);
    var options = Object.extend({
      x:    0,
      y:    0,
      mode: 'relative'
    }, arguments[1] || { });
    this.start(options);
  },
  setup: function() {
    this.element.makePositioned();
    this.originalLeft = parseFloat(this.element.getStyle('left') || '0');
    this.originalTop  = parseFloat(this.element.getStyle('top')  || '0');
    if (this.options.mode == 'absolute') {
      this.options.x = this.options.x - this.originalLeft;
      this.options.y = this.options.y - this.originalTop;
    }
  },
  update: function(position) {
    this.element.setStyle({
      left: (this.options.x  * position + this.originalLeft).round() + 'px',
      top:  (this.options.y  * position + this.originalTop).round()  + 'px'
    });
  }
});

// for backwards compatibility
Effect.MoveBy = function(element, toTop, toLeft) {
  return new Effect.Move(element, 
    Object.extend({ x: toLeft, y: toTop }, arguments[3] || { }));
};

Effect.Scale = Class.create(Effect.Base, {
  initialize: function(element, percent) {
    this.element = $(element);
    if (!this.element) throw(Effect._elementDoesNotExistError);
    var options = Object.extend({
      scaleX: true,
      scaleY: true,
      scaleContent: true,
      scaleFromCenter: false,
      scaleMode: 'box',        // 'box' or 'contents' or { } with provided values
      scaleFrom: 100.0,
      scaleTo:   percent
    }, arguments[2] || { });
    this.start(options);
  },
  setup: function() {
    this.restoreAfterFinish = this.options.restoreAfterFinish || false;
    this.elementPositioning = this.element.getStyle('position');
    
    this.originalStyle = { };
    ['top','left','width','height','fontSize'].each( function(k) {
      this.originalStyle[k] = this.element.style[k];
    }.bind(this));
      
    this.originalTop  = this.element.offsetTop;
    this.originalLeft = this.element.offsetLeft;
    
    var fontSize = this.element.getStyle('font-size') || '100%';
    ['em','px','%','pt'].each( function(fontSizeType) {
      if (fontSize.indexOf(fontSizeType)>0) {
        this.fontSize     = parseFloat(fontSize);
        this.fontSizeType = fontSizeType;
      }
    }.bind(this));
    
    this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
    
    this.dims = null;
    if (this.options.scaleMode=='box')
      this.dims = [this.element.offsetHeight, this.element.offsetWidth];
    if (/^content/.test(this.options.scaleMode))
      this.dims = [this.element.scrollHeight, this.element.scrollWidth];
    if (!this.dims)
      this.dims = [this.options.scaleMode.originalHeight,
                   this.options.scaleMode.originalWidth];
  },
  update: function(position) {
    var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position);
    if (this.options.scaleContent && this.fontSize)
      this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType });
    this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale);
  },
  finish: function(position) {
    if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle);
  },
  setDimensions: function(height, width) {
    var d = { };
    if (this.options.scaleX) d.width = width.round() + 'px';
    if (this.options.scaleY) d.height = height.round() + 'px';
    if (this.options.scaleFromCenter) {
      var topd  = (height - this.dims[0])/2;
      var leftd = (width  - this.dims[1])/2;
      if (this.elementPositioning == 'absolute') {
        if (this.options.scaleY) d.top = this.originalTop-topd + 'px';
        if (this.options.scaleX) d.left = this.originalLeft-leftd + 'px';
      } else {
        if (this.options.scaleY) d.top = -topd + 'px';
        if (this.options.scaleX) d.left = -leftd + 'px';
      }
    }
    this.element.setStyle(d);
  }
});

Effect.Highlight = Class.create(Effect.Base, {
  initialize: function(element) {
    this.element = $(element);
    if (!this.element) throw(Effect._elementDoesNotExistError);
    var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || { });
    this.start(options);
  },
  setup: function() {
    // Prevent executing on elements not in the layout flow
    if (this.element.getStyle('display')=='none') { this.cancel(); return; }
    // Disable background image during the effect
    this.oldStyle = { };
    if (!this.options.keepBackgroundImage) {
      this.oldStyle.backgroundImage = this.element.getStyle('background-image');
      this.element.setStyle({backgroundImage: 'none'});
    }
    if (!this.options.endcolor)
      this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff');
    if (!this.options.restorecolor)
      this.options.restorecolor = this.element.getStyle('background-color');
    // init color calculations
    this._base  = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this));
    this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this));
  },
  update: function(position) {
    this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){
      return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart()); }.bind(this)) });
  },
  finish: function() {
    this.element.setStyle(Object.extend(this.oldStyle, {
      backgroundColor: this.options.restorecolor
    }));
  }
});

Effect.ScrollTo = function(element) {
  var options = arguments[1] || { },
    scrollOffsets = document.viewport.getScrollOffsets(),
    elementOffsets = $(element).cumulativeOffset(),
    max = (window.height || document.body.scrollHeight) - document.viewport.getHeight();  

  if (options.offset) elementOffsets[1] += options.offset;

  return new Effect.Tween(null,
    scrollOffsets.top,
    elementOffsets[1] > max ? max : elementOffsets[1],
    options,
    function(p){ scrollTo(scrollOffsets.left, p.round()) }
  );
};

/* ------------- combination effects ------------- */

Effect.Fade = function(element) {
  element = $(element);
  var oldOpacity = element.getInlineOpacity();
  var options = Object.extend({
    from: element.getOpacity() || 1.0,
    to:   0.0,
    afterFinishInternal: function(effect) { 
      if (effect.options.to!=0) return;
      effect.element.hide().setStyle({opacity: oldOpacity}); 
    }
  }, arguments[1] || { });
  return new Effect.Opacity(element,options);
};

Effect.Appear = function(element) {
  element = $(element);
  var options = Object.extend({
  from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0),
  to:   1.0,
  // force Safari to render floated elements properly
  afterFinishInternal: function(effect) {
    effect.element.forceRerendering();
  },
  beforeSetup: function(effect) {
    effect.element.setOpacity(effect.options.from).show(); 
  }}, arguments[1] || { });
  return new Effect.Opacity(element,options);
};

Effect.Puff = function(element) {
  element = $(element);
  var oldStyle = { 
    opacity: element.getInlineOpacity(), 
    position: element.getStyle('position'),
    top:  element.style.top,
    left: element.style.left,
    width: element.style.width,
    height: element.style.height
  };
  return new Effect.Parallel(
   [ new Effect.Scale(element, 200, 
      { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), 
     new Effect.Opacity(element, { sync: true, to: 0.0 } ) ], 
     Object.extend({ duration: 1.0, 
      beforeSetupInternal: function(effect) {
        Position.absolutize(effect.effects[0].element)
      },
      afterFinishInternal: function(effect) {
         effect.effects[0].element.hide().setStyle(oldStyle); }
     }, arguments[1] || { })
   );
};

Effect.BlindUp = function(element) {
  element = $(element);
  element.makeClipping();
  return new Effect.Scale(element, 0,
    Object.extend({ scaleContent: false, 
      scaleX: false, 
      restoreAfterFinish: true,
      afterFinishInternal: function(effect) {
        effect.element.hide().undoClipping();
      } 
    }, arguments[1] || { })
  );
};

Effect.BlindDown = function(element) {
  element = $(element);
  var elementDimensions = element.getDimensions();
  return new Effect.Scale(element, 100, Object.extend({ 
    scaleContent: false, 
    scaleX: false,
    scaleFrom: 0,
    scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
    restoreAfterFinish: true,
    afterSetup: function(effect) {
      effect.element.makeClipping().setStyle({height: '0px'}).show(); 
    },  
    afterFinishInternal: function(effect) {
      effect.element.undoClipping();
    }
  }, arguments[1] || { }));
};

Effect.SwitchOff = function(element) {
  element = $(element);
  var oldOpacity = element.getInlineOpacity();
  return new Effect.Appear(element, Object.extend({
    duration: 0.4,
    from: 0,
    transition: Effect.Transitions.flicker,
    afterFinishInternal: function(effect) {
      new Effect.Scale(effect.element, 1, { 
        duration: 0.3, scaleFromCenter: true,
        scaleX: false, scaleContent: false, restoreAfterFinish: true,
        beforeSetup: function(effect) { 
          effect.element.makePositioned().makeClipping();
        },
        afterFinishInternal: function(effect) {
          effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity});
        }
      })
    }
  }, arguments[1] || { }));
};

Effect.DropOut = function(element) {
  element = $(element);
  var oldStyle = {
    top: element.getStyle('top'),
    left: element.getStyle('left'),
    opacity: element.getInlineOpacity() };
  return new Effect.Parallel(
    [ new Effect.Move(element, {x: 0, y: 100, sync: true }), 
      new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
    Object.extend(
      { duration: 0.5,
        beforeSetup: function(effect) {
          effect.effects[0].element.makePositioned(); 
        },
        afterFinishInternal: function(effect) {
          effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);
        } 
      }, arguments[1] || { }));
};

Effect.Shake = function(element) {
  element = $(element);
  var options = Object.extend({
    distance: 20,
    duration: 0.5
  }, arguments[1] || {});
  var distance = parseFloat(options.distance);
  var split = parseFloat(options.duration) / 10.0;
  var oldStyle = {
    top: element.getStyle('top'),
    left: element.getStyle('left') };
    return new Effect.Move(element,
      { x:  distance, y: 0, duration: split, afterFinishInternal: function(effect) {
    new Effect.Move(effect.element,
      { x: -distance*2, y: 0, duration: split*2,  afterFinishInternal: function(effect) {
    new Effect.Move(effect.element,
      { x:  distance*2, y: 0, duration: split*2,  afterFinishInternal: function(effect) {
    new Effect.Move(effect.element,
      { x: -distance*2, y: 0, duration: split*2,  afterFinishInternal: function(effect) {
    new Effect.Move(effect.element,
      { x:  distance*2, y: 0, duration: split*2,  afterFinishInternal: function(effect) {
    new Effect.Move(effect.element,
      { x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) {
        effect.element.undoPositioned().setStyle(oldStyle);
  }}) }}) }}) }}) }}) }});
};

Effect.SlideDown = function(element) {
  element = $(element).cleanWhitespace();
  // SlideDown need to have the content of the element wrapped in a container element with fixed height!
  var oldInnerBottom = element.down().getStyle('bottom');
  var elementDimensions = element.getDimensions();
  return new Effect.Scale(element, 100, Object.extend({ 
    scaleContent: false, 
    scaleX: false, 
    scaleFrom: window.opera ? 0 : 1,
    scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
    restoreAfterFinish: true,
    afterSetup: function(effect) {
      effect.element.makePositioned();
      effect.element.down().makePositioned();
      if (window.opera) effect.element.setStyle({top: ''});
      effect.element.makeClipping().setStyle({height: '0px'}).show(); 
    },
    afterUpdateInternal: function(effect) {
      effect.element.down().setStyle({bottom:
        (effect.dims[0] - effect.element.clientHeight) + 'px' }); 
    },
    afterFinishInternal: function(effect) {
      effect.element.undoClipping().undoPositioned();
      effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); }
    }, arguments[1] || { })
  );
};

Effect.SlideUp = function(element) {
  element = $(element).cleanWhitespace();
  var oldInnerBottom = element.down().getStyle('bottom');
  var elementDimensions = element.getDimensions();
  return new Effect.Scale(element, window.opera ? 0 : 1,
   Object.extend({ scaleContent: false, 
    scaleX: false, 
    scaleMode: 'box',
    scaleFrom: 100,
    scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
    restoreAfterFinish: true,
    afterSetup: function(effect) {
      effect.element.makePositioned();
      effect.element.down().makePositioned();
      if (window.opera) effect.element.setStyle({top: ''});
      effect.element.makeClipping().show();
    },  
    afterUpdateInternal: function(effect) {
      effect.element.down().setStyle({bottom:
        (effect.dims[0] - effect.element.clientHeight) + 'px' });
    },
    afterFinishInternal: function(effect) {
      effect.element.hide().undoClipping().undoPositioned();
      effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom});
    }
   }, arguments[1] || { })
  );
};

// Bug in opera makes the TD containing this element expand for a instance after finish 
Effect.Squish = function(element) {
  return new Effect.Scale(element, window.opera ? 1 : 0, { 
    restoreAfterFinish: true,
    beforeSetup: function(effect) {
      effect.element.makeClipping(); 
    },  
    afterFinishInternal: function(effect) {
      effect.element.hide().undoClipping(); 
    }
  });
};

Effect.Grow = function(element) {
  element = $(element);
  var options = Object.extend({
    direction: 'center',
    moveTransition: Effect.Transitions.sinoidal,
    scaleTransition: Effect.Transitions.sinoidal,
    opacityTransition: Effect.Transitions.full
  }, arguments[1] || { });
  var oldStyle = {
    top: element.style.top,
    left: element.style.left,
    height: element.style.height,
    width: element.style.width,
    opacity: element.getInlineOpacity() };

  var dims = element.getDimensions();    
  var initialMoveX, initialMoveY;
  var moveX, moveY;
  
  switch (options.direction) {
    case 'top-left':
      initialMoveX = initialMoveY = moveX = moveY = 0; 
      break;
    case 'top-right':
      initialMoveX = dims.width;
      initialMoveY = moveY = 0;
      moveX = -dims.width;
      break;
    case 'bottom-left':
      initialMoveX = moveX = 0;
      initialMoveY = dims.height;
      moveY = -dims.height;
      break;
    case 'bottom-right':
      initialMoveX = dims.width;
      initialMoveY = dims.height;
      moveX = -dims.width;
      moveY = -dims.height;
      break;
    case 'center':
      initialMoveX = dims.width / 2;
      initialMoveY = dims.height / 2;
      moveX = -dims.width / 2;
      moveY = -dims.height / 2;
      break;
  }
  
  return new Effect.Move(element, {
    x: initialMoveX,
    y: initialMoveY,
    duration: 0.01, 
    beforeSetup: function(effect) {
      effect.element.hide().makeClipping().makePositioned();
    },
    afterFinishInternal: function(effect) {
      new Effect.Parallel(
        [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
          new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }),
          new Effect.Scale(effect.element, 100, {
            scaleMode: { originalHeight: dims.height, originalWidth: dims.width }, 
            sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
        ], Object.extend({
             beforeSetup: function(effect) {
               effect.effects[0].element.setStyle({height: '0px'}).show(); 
             },
             afterFinishInternal: function(effect) {
               effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle); 
             }
           }, options)
      )
    }
  });
};

Effect.Shrink = function(element) {
  element = $(element);
  var options = Object.extend({
    direction: 'center',
    moveTransition: Effect.Transitions.sinoidal,
    scaleTransition: Effect.Transitions.sinoidal,
    opacityTransition: Effect.Transitions.none
  }, arguments[1] || { });
  var oldStyle = {
    top: element.style.top,
    left: element.style.left,
    height: element.style.height,
    width: element.style.width,
    opacity: element.getInlineOpacity() };

  var dims = element.getDimensions();
  var moveX, moveY;
  
  switch (options.direction) {
    case 'top-left':
      moveX = moveY = 0;
      break;
    case 'top-right':
      moveX = dims.width;
      moveY = 0;
      break;
    case 'bottom-left':
      moveX = 0;
      moveY = dims.height;
      break;
    case 'bottom-right':
      moveX = dims.width;
      moveY = dims.height;
      break;
    case 'center':  
      moveX = dims.width / 2;
      moveY = dims.height / 2;
      break;
  }
  
  return new Effect.Parallel(
    [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }),
      new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}),
      new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition })
    ], Object.extend({            
         beforeStartInternal: function(effect) {
           effect.effects[0].element.makePositioned().makeClipping(); 
         },
         afterFinishInternal: function(effect) {
           effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); }
       }, options)
  );
};

Effect.Pulsate = function(element) {
  element = $(element);
  var options    = arguments[1] || { };
  var oldOpacity = element.getInlineOpacity();
  var transition = options.transition || Effect.Transitions.sinoidal;
  var reverser   = function(pos){ return transition(1-Effect.Transitions.pulse(pos, options.pulses)) };
  reverser.bind(transition);
  return new Effect.Opacity(element, 
    Object.extend(Object.extend({  duration: 2.0, from: 0,
      afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }
    }, options), {transition: reverser}));
};

Effect.Fold = function(element) {
  element = $(element);
  var oldStyle = {
    top: element.style.top,
    left: element.style.left,
    width: element.style.width,
    height: element.style.height };
  element.makeClipping();
  return new Effect.Scale(element, 5, Object.extend({   
    scaleContent: false,
    scaleX: false,
    afterFinishInternal: function(effect) {
    new Effect.Scale(element, 1, { 
      scaleContent: false, 
      scaleY: false,
      afterFinishInternal: function(effect) {
        effect.element.hide().undoClipping().setStyle(oldStyle);
      } });
  }}, arguments[1] || { }));
};

Effect.Morph = Class.create(Effect.Base, {
  initialize: function(element) {
    this.element = $(element);
    if (!this.element) throw(Effect._elementDoesNotExistError);
    var options = Object.extend({
      style: { }
    }, arguments[1] || { });
    
    if (!Object.isString(options.style)) this.style = $H(options.style);
    else {
      if (options.style.include(':'))
        this.style = options.style.parseStyle();
      else {
        this.element.addClassName(options.style);
        this.style = $H(this.element.getStyles());
        this.element.removeClassName(options.style);
        var css = this.element.getStyles();
        this.style = this.style.reject(function(style) {
          return style.value == css[style.key];
        });
        options.afterFinishInternal = function(effect) {
          effect.element.addClassName(effect.options.style);
          effect.transforms.each(function(transform) {
            effect.element.style[transform.style] = '';
          });
        }
      }
    }
    this.start(options);
  },
  
  setup: function(){
    function parseColor(color){
      if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff';
      color = color.parseColor();
      return $R(0,2).map(function(i){
        return parseInt( color.slice(i*2+1,i*2+3), 16 ) 
      });
    }
    this.transforms = this.style.map(function(pair){
      var property = pair[0], value = pair[1], unit = null;

      if (value.parseColor('#zzzzzz') != '#zzzzzz') {
        value = value.parseColor();
        unit  = 'color';
      } else if (property == 'opacity') {
        value = parseFloat(value);
        if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout))
          this.element.setStyle({zoom: 1});
      } else if (Element.CSS_LENGTH.test(value)) {
          var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/);
          value = parseFloat(components[1]);
          unit = (components.length == 3) ? components[2] : null;
      }

      var originalValue = this.element.getStyle(property);
      return { 
        style: property.camelize(), 
        originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0), 
        targetValue: unit=='color' ? parseColor(value) : value,
        unit: unit
      };
    }.bind(this)).reject(function(transform){
      return (
        (transform.originalValue == transform.targetValue) ||
        (
          transform.unit != 'color' &&
          (isNaN(transform.originalValue) || isNaN(transform.targetValue))
        )
      )
    });
  },
  update: function(position) {
    var style = { }, transform, i = this.transforms.length;
    while(i--)
      style[(transform = this.transforms[i]).style] = 
        transform.unit=='color' ? '#'+
          (Math.round(transform.originalValue[0]+
            (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() +
          (Math.round(transform.originalValue[1]+
            (transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart() +
          (Math.round(transform.originalValue[2]+
            (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() :
        (transform.originalValue +
          (transform.targetValue - transform.originalValue) * position).toFixed(3) + 
            (transform.unit === null ? '' : transform.unit);
    this.element.setStyle(style, true);
  }
});

Effect.Transform = Class.create({
  initialize: function(tracks){
    this.tracks  = [];
    this.options = arguments[1] || { };
    this.addTracks(tracks);
  },
  addTracks: function(tracks){
    tracks.each(function(track){
      track = $H(track);
      var data = track.values().first();
      this.tracks.push($H({
        ids:     track.keys().first(),
        effect:  Effect.Morph,
        options: { style: data }
      }));
    }.bind(this));
    return this;
  },
  play: function(){
    return new Effect.Parallel(
      this.tracks.map(function(track){
        var ids = track.get('ids'), effect = track.get('effect'), options = track.get('options');
        var elements = [$(ids) || $$(ids)].flatten();
        return elements.map(function(e){ return new effect(e, Object.extend({ sync:true }, options)) });
      }).flatten(),
      this.options
    );
  }
});

Element.CSS_PROPERTIES = $w(
  'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' + 
  'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' +
  'borderRightColor borderRightStyle borderRightWidth borderSpacing ' +
  'borderTopColor borderTopStyle borderTopWidth bottom clip color ' +
  'fontSize fontWeight height left letterSpacing lineHeight ' +
  'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+
  'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' +
  'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' +
  'right textIndent top width wordSpacing zIndex');
  
Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;

String.__parseStyleElement = document.createElement('div');
String.prototype.parseStyle = function(){
  var style, styleRules = $H();
  if (Prototype.Browser.WebKit)
    style = new Element('div',{style:this}).style;
  else {
    String.__parseStyleElement.innerHTML = '<div style="' + this + '"></div>';
    style = String.__parseStyleElement.childNodes[0].style;
  }
  
  Element.CSS_PROPERTIES.each(function(property){
    if (style[property]) styleRules.set(property, style[property]); 
  });
  
  if (Prototype.Browser.IE && this.include('opacity'))
    styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);

  return styleRules;
};

if (document.defaultView && document.defaultView.getComputedStyle) {
  Element.getStyles = function(element) {
    var css = document.defaultView.getComputedStyle($(element), null);
    return Element.CSS_PROPERTIES.inject({ }, function(styles, property) {
      styles[property] = css[property];
      return styles;
    });
  };
} else {
  Element.getStyles = function(element) {
    element = $(element);
    var css = element.currentStyle, styles;
    styles = Element.CSS_PROPERTIES.inject({ }, function(results, property) {
      results[property] = css[property];
      return results;
    });
    if (!styles.opacity) styles.opacity = element.getOpacity();
    return styles;
  };
};

Effect.Methods = {
  morph: function(element, style) {
    element = $(element);
    new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || { }));
    return element;
  },
  visualEffect: function(element, effect, options) {
    element = $(element)
    var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1);
    new Effect[klass](element, options);
    return element;
  },
  highlight: function(element, options) {
    element = $(element);
    new Effect.Highlight(element, options);
    return element;
  }
};

$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+
  'pulsate shake puff squish switchOff dropOut').each(
  function(effect) { 
    Effect.Methods[effect] = function(element, options){
      element = $(element);
      Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options);
      return element;
    }
  }
);

$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each( 
  function(f) { Effect.Methods[f] = Element[f]; }
);

Element.addMethods(Effect.Methods);
;Object.extend(String.prototype, {
  // if a string doesn't end with str it appends it
  ensureEndsWith: function(str) {
    return this.endsWith(str) ? this : this + str;
  },
  
  // makes sure that string ends with px (for setting widths and heights)
  px: function() {
    return this.ensureEndsWith('px');
  }
});

Object.extend(Number.prototype, {
  // makes sure that number ends with px (for setting widths and heights)
  px: function() {
    return this.toString().px();
  }
});

var Window = {
  // returns correct dimensions for window, had issues with prototype's sometimes. this was ganked from apple.
  size: function() {
		var width  = window.innerWidth || (window.document.documentElement.clientWidth || window.document.body.clientWidth);
		var height = window.innerHeight || (window.document.documentElement.clientHeight || window.document.body.clientHeight);
		var x      = window.pageXOffset || (window.document.documentElement.scrollLeft || window.document.body.scrollLeft);
		var y      = window.pageYOffset || (window.document.documentElement.scrollTop || window.document.body.scrollTop);
		return {'width':width, 'height':height, 'x':x, 'y':y}
	}
}

var FancyZoomBox = {
  directory : 'images',
  zooming   : false,
  setup     : false,
  
  init: function(directory) {
    if (FancyZoomBox.setup) return;
    FancyZoomBox.setup = true;
    
    var ie = navigator.userAgent.match(/MSIE\s(\d)+/);
    if (ie) {
      var version = parseInt(ie[1]);
      Prototype.Browser['IE' + version.toString()] = true;
	  Prototype.Browser.IE = true;
      Prototype.Browser.ltIE7 = (version < 7) ? true : false;
    }
    
    var html = '<div id="zoom" style="display:none;z-index:999;"> \
                  <table id="zoom_table" style="border-collapse:collapse; width:100%; height:100%;"> \
                    <tbody> \
                      <tr> \
                        <td class="tl" style="background:url(' + FancyZoomBox.directory + '/tl.png) 0 0 no-repeat; width:20px; height:20px; overflow:hidden;" /> \
                        <td class="tm" style="background:url(' + FancyZoomBox.directory + '/tm.png) 0 0 repeat-x; height:20px; overflow:hidden;" /> \
                        <td class="tr" style="background:url(' + FancyZoomBox.directory + '/tr.png) 100% 0 no-repeat; width:20px; height:20px; overflow:hidden;" /> \
                      </tr> \
                      <tr> \
                        <td class="ml" style="background:url(' + FancyZoomBox.directory + '/ml.png) 0 0 repeat-y; width:20px; overflow:hidden;" /> \
                        <td class="mm" style="background:#fff; vertical-align:top; padding:10px;"> \
                          <div id="zoom_content"> \
                          </div> \
                        </td> \
                        <td class="mr" style="background:url(' + FancyZoomBox.directory + '/mr.png) 100% 0 repeat-y;  width:20px; overflow:hidden;" /> \
                      </tr> \
                      <tr> \
                        <td class="bl" style="background:url(' + FancyZoomBox.directory + '/bl.png) 0 100% no-repeat; width:20px; height:20px; overflow:hidden;" /> \
                        <td class="bm" style="background:url(' + FancyZoomBox.directory + '/bm.png) 0 100% repeat-x; height:20px; overflow:hidden;" /> \
                        <td class="br" style="background:url(' + FancyZoomBox.directory + '/br.png) 100% 100% no-repeat; width:20px; height:20px; overflow:hidden;" /> \
                      </tr> \
                    </tbody> \
                  </table> \
                  <a href="#" title="Close" id="zoom_close" style="position:absolute; top:0; right:0;"> \
                    <img src="' + FancyZoomBox.directory + '/btn_overlay_close.png" alt="Close" style="border:none; margin:0; padding:0;" /> \
                  </a> \
                </div>';
    
    var body  = $$('body').first();
    body.insert(html);
    
    FancyZoomBox.zoom = $('zoom');
    FancyZoomBox.zoom_table = $('zoom_table');
    FancyZoomBox.zoom_close = $('zoom_close');
	FancyZoomBox.zoom_content = $('zoom_content');
    FancyZoomBox.zoom_close.observe('click', FancyZoomBox.hide);
    FancyZoomBox.middle_row = $A([$$('td.ml'), $$('td.mm'), $$('td.mr')]).flatten();
    FancyZoomBox.cells = FancyZoomBox.zoom_table.select('td');
    
    // hide zoom if click fired is not inside zoom
    $$('html').first().observe('click', function(e) {
      var click_in_zoom = e.findElement('#zoom'),
          zoom_display  = FancyZoomBox.zoom.getStyle('display');
      if (zoom_display == 'block' && !click_in_zoom) {
        FancyZoomBox.hide(e);
      }
    });

    // esc to close zoom box
    $(document).observe('keyup', function(e) {
      var zoom_display = FancyZoomBox.zoom.getStyle('display');
      if (e.keyCode == Event.KEY_ESC && zoom_display == 'block') {
        FancyZoomBox.hide(e);
      }
    });
    
    // just use gifs as ie6 and below suck
    if (Prototype.Browser.IE7) {
      FancyZoomBox.switchBackgroundImagesTo('gif');
    }    
  },
  
  show: function(e) {
    e.stop();
		if (FancyZoomBox.zooming) return;
		FancyZoomBox.zooming   = true;
		var element            = e.findElement('a');
		var related_div        = element.content_div;
		var width              = (element.zoom_width || related_div.getWidth()) + 60;
		var height             = (element.zoom_height || related_div.getHeight()) + 60;
		var d                  = Window.size();
		var yOffset            = document.viewport.getScrollOffsets()[1];
		FancyZoomBox.finishFunction		= element.finish_function;
		FancyZoomBox.finishFunctionArguments = element.finish_function_arguments;
		// ensure that newTop is at least 0 so it doesn't hide close button
		var newTop             = Math.max((d.height/2) - (height/2) + yOffset, 0);
		var newLeft            = (d.width/2) - (width/2);
		FancyZoomBox.curTop    = e.pointerY();
		FancyZoomBox.curLeft   = e.pointerX();
		//if(document.viewport.getWidth() < width + FancyZoomBox.curLeft)
		//{
		//	FancyZoomBox.curLeft = e.pointerX() - width;
		//}
		FancyZoomBox.moveX     = -(FancyZoomBox.curLeft - newLeft);
		FancyZoomBox.moveY     = -(FancyZoomBox.curTop - newTop);
    FancyZoomBox.zoom.hide().setStyle({
			position	: 'absolute',
			top				: FancyZoomBox.curTop.px(),
			left			: FancyZoomBox.curLeft.px()
		});
	   
		new Effect.Parallel([
			new Effect.Appear(FancyZoomBox.zoom, {sync:true}),
			new Effect.Move(FancyZoomBox.zoom, {x: FancyZoomBox.moveX, y: FancyZoomBox.moveY, sync: true}),
			new Effect.Morph(FancyZoomBox.zoom, {
			  style: {
			    width: width.px(),
			    height: height.px()
			  },
				sync: true,
				beforeStart: function(effect) {
				  // middle row height must be set for IE otherwise it tries to be "logical" with the height
    		  if (Prototype.Browser.IE) {
    		    FancyZoomBox.middle_row.invoke('setStyle', {height:(height-40).px()});
    		  }
					FancyZoomBox.fixBackgroundsForIE();
				},
				afterFinish: function(effect) {
				  FancyZoomBox.zoom_content.innerHTML = related_div.innerHTML;
					FancyZoomBox.unfixBackgroundsForIE();
					FancyZoomBox.zoom_close.show();
					FancyZoomBox.zooming = false;

					if(FancyZoomBox.finishFunction != null && FancyZoomBox.finishFunction != "undefined")
					{
						FancyZoomBox.finishFunction(FancyZoomBox.finishFunctionArguments);
					}
				}
			})
		], { duration: 0.5 });
  },
  
  showAuto: function(element, duration) {
		if (FancyZoomBox.zooming) return;
		FancyZoomBox.zooming   = true;
		var related_div        = element.content_div;
		var width              = (element.zoom_width || related_div.getWidth()) + 60;
		var height             = (element.zoom_height || related_div.getHeight()) + 60;
		var d                  = Window.size();
		var yOffset            = document.viewport.getScrollOffsets()[1];
		// ensure that newTop is at least 0 so it doesn't hide close button
		var newTop             = Math.max((d.height/2) - (height/2) + yOffset, 0);
		var newLeft            = (d.width/2) - (width/2);
		FancyZoomBox.curTop    = 0;
		FancyZoomBox.curLeft   = 0;
		if(document.viewport.getWidth() < width + FancyZoomBox.curLeft)
		{
			FancyZoomBox.curLeft = 0 - width;
		}
		FancyZoomBox.moveX     = -(FancyZoomBox.curLeft - newLeft);
		FancyZoomBox.moveY     = -(FancyZoomBox.curTop - newTop);
    FancyZoomBox.zoom.hide().setStyle({
			position	: 'absolute',
			top				: FancyZoomBox.curTop.px(),
			left			: FancyZoomBox.curLeft.px()
		});
	   
		new Effect.Parallel([
			new Effect.Appear(FancyZoomBox.zoom, {sync:true}),
			new Effect.Move(FancyZoomBox.zoom, {x: FancyZoomBox.moveX, y: FancyZoomBox.moveY, sync: true}),
			new Effect.Morph(FancyZoomBox.zoom, {
			  style: {
			    width: width.px(),
			    height: height.px()
			  },
				sync: true,
				beforeStart: function(effect) {
				  // middle row height must be set for IE otherwise it tries to be "logical" with the height
    		  if (Prototype.Browser.IE) {
    		    FancyZoomBox.middle_row.invoke('setStyle', {height:(height-40).px()});
    		  }
					FancyZoomBox.fixBackgroundsForIE();
				},
				afterFinish: function(effect) {
				  FancyZoomBox.zoom_content.innerHTML = related_div.innerHTML;
					FancyZoomBox.unfixBackgroundsForIE();
					FancyZoomBox.zoom_close.show();
					FancyZoomBox.zooming = false;
				}
			})
		], { duration: duration});
  },
    
  hide: function(e) {
	if(e != undefined)
    	e.stop();
		if (FancyZoomBox.zooming) return;
		FancyZoomBox.zooming = true;		
		new Effect.Parallel([
			new Effect.Move(FancyZoomBox.zoom, {x: FancyZoomBox.moveX*-1, y: FancyZoomBox.moveY*-1, sync: true}),
			new Effect.Morph(FancyZoomBox.zoom, {
			  style: {
			    width: '1'.px(),
			    height: '1'.px()
			  },
				sync					: true,
				beforeStart: function(effect) {
					FancyZoomBox.fixBackgroundsForIE();
					FancyZoomBox.zoom_content.innerHTML = '';
					FancyZoomBox.zoom_close.hide();
				},
				afterFinish: function(effect) {
					FancyZoomBox.unfixBackgroundsForIE();
					FancyZoomBox.zooming = false;
				}
			}),
			new Effect.Fade(FancyZoomBox.zoom, {sync:true})
		], { duration: 0.5 });
  },
  
  // switches the backgrounds of the cells and the close image to png's or gif's
  // fixes ie's issues with fading and appearing transparent png's with 
  // no background and ie6's craptacular handling of transparent png's
  switchBackgroundImagesTo: function(to) {
    FancyZoomBox.cells.each(function(td) {
      var bg = td.getStyle('background-image').gsub(/\.(png|gif|none)\)$/, '.' + to + ')');
      td.setStyle('background-image: ' + bg);
    });
    var close_img = FancyZoomBox.zoom_close.firstDescendant();
    var new_img = close_img.readAttribute('src').gsub(/\.(png|gif|none)$/, '.' + to);
    close_img.writeAttribute('src', new_img);
  },
  
  // prevents the thick black border that happens when appearing or fading png in IE
	fixBackgroundsForIE: function() {
    if (Prototype.Browser.IE) { FancyZoomBox.switchBackgroundImagesTo('gif'); }
	},
		
	// swaps back to png's for prettier shadows
	unfixBackgroundsForIE: function() {
    if (Prototype.Browser.IE) { 
		Prototype.Browser.IE6 = Prototype.Browser.IE && parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5)) == 6;
		if(!Prototype.Browser.IE6) FancyZoomBox.switchBackgroundImagesTo('png'); }
	}
}

var FancyZoom = Class.create({
	initialize: function(element) {
	  this.options = arguments.length > 1 ? arguments[1] : {};
	  FancyZoomBox.init();
	  this.element = $(element);
		if (this.element) {
		  this.element.content_div = $(this.element.readAttribute('href').gsub(/^#/, ''));
		if(this.element.content_div !== null)
  			this.element.content_div.hide();
  		this.element.zoom_width = this.options.width;
  		this.element.zoom_height = this.options.height;
  		this.element.finish_function = this.options.finish_function;
		this.element.finish_function_arguments = this.options.finish_function_arguments;
        this.element.observe('click', FancyZoomBox.show);
		}
	},
	showAuto: function(element, duration) {
		FancyZoomBox.showAuto(element, duration);	
	},
	hide: function(e){
		FancyZoomBox.hide(e);
	}
});;/**
 * SWFAddress 2.4: Deep linking for Flash and Ajax <http://www.asual.com/swfaddress/>
 *
 * SWFAddress is (c) 2006-2009 Rostislav Hristov and contributors
 * This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
 *
 */
if(typeof asual=="undefined"){var asual={}}if(typeof asual.util=="undefined"){asual.util={}}asual.util.Browser=new function(){var b=navigator.userAgent.toLowerCase(),a=/webkit/.test(b),e=/opera/.test(b),c=/msie/.test(b)&&!/opera/.test(b),d=/mozilla/.test(b)&&!/(compatible|webkit)/.test(b),f=parseFloat(c?b.substr(b.indexOf("msie")+4):(b.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1]);this.toString=function(){return"[class Browser]"};this.getVersion=function(){return f};this.isMSIE=function(){return c};this.isSafari=function(){return a};this.isOpera=function(){return e};this.isMozilla=function(){return d}};asual.util.Events=new function(){var c="DOMContentLoaded",j="onstop",k=window,h=document,b=[],a=asual.util,e=a.Browser,d=e.isMSIE(),g=e.isSafari();this.toString=function(){return"[class Events]"};this.addListener=function(n,l,m){b.push({o:n,t:l,l:m});if(!(l==c&&(d||g))){if(n.addEventListener){n.addEventListener(l,m,false)}else{if(n.attachEvent){n.attachEvent("on"+l,m)}}}};this.removeListener=function(p,m,n){for(var l=0,o;o=b[l];l++){if(o.o==p&&o.t==m&&o.l==n){b.splice(l,1);break}}if(!(m==c&&(d||g))){if(p.removeEventListener){p.removeEventListener(m,n,false)}else{if(p.detachEvent){p.detachEvent("on"+m,n)}}}};var i=function(){for(var m=0,l;l=b[m];m++){if(l.t!=c){a.Events.removeListener(l.o,l.t,l.l)}}};var f=function(){if(h.readyState=="interactive"){function l(){h.detachEvent(j,l);i()}h.attachEvent(j,l);k.setTimeout(function(){h.detachEvent(j,l)},0)}};if(d||g){(function(){try{if((d&&h.body)||!/loaded|complete/.test(h.readyState)){h.documentElement.doScroll("left")}}catch(m){return setTimeout(arguments.callee,0)}for(var l=0,m;m=b[l];l++){if(m.t==c){m.l.call(null)}}})()}if(d){k.attachEvent("onbeforeunload",f)}this.addListener(k,"unload",i)};asual.util.Functions=new function(){this.toString=function(){return"[class Functions]"};this.bind=function(f,b,e){for(var c=2,d,a=[];d=arguments[c];c++){a.push(d)}return function(){return f.apply(b,a)}}};var SWFAddressEvent=function(d){this.toString=function(){return"[object SWFAddressEvent]"};this.type=d;this.target=[SWFAddress][0];this.value=SWFAddress.getValue();this.path=SWFAddress.getPath();this.pathNames=SWFAddress.getPathNames();this.parameters={};var c=SWFAddress.getParameterNames();for(var b=0,a=c.length;b<a;b++){this.parameters[c[b]]=SWFAddress.getParameter(c[b])}this.parameterNames=c};SWFAddressEvent.INIT="init";SWFAddressEvent.CHANGE="change";SWFAddressEvent.INTERNAL_CHANGE="internalChange";SWFAddressEvent.EXTERNAL_CHANGE="externalChange";var SWFAddress=new function(){var _getHash=function(){var index=_l.href.indexOf("#");return index!=-1?_ec(_dc(_l.href.substr(index+1))):""};var _getWindow=function(){try{top.document;return top}catch(e){return window}};var _strictCheck=function(value,force){if(_opts.strict){value=force?(value.substr(0,1)!="/"?"/"+value:value):(value==""?"/":value)}return value};var _ieLocal=function(value,direction){return(_msie&&_l.protocol=="file:")?(direction?_value.replace(/\?/,"%3F"):_value.replace(/%253F/,"?")):value};var _searchScript=function(el){if(el.childNodes){for(var i=0,l=el.childNodes.length,s;i<l;i++){if(el.childNodes[i].src){_url=String(el.childNodes[i].src)}if(s=_searchScript(el.childNodes[i])){return s}}}};var _titleCheck=function(){if(_d.title!=_title&&_d.title.indexOf("#")!=-1){_d.title=_title}};var _listen=function(){if(!_silent){var hash=_getHash();var diff=!(_value==hash);if(_safari&&_version<523){if(_length!=_h.length){_length=_h.length;if(typeof _stack[_length-1]!=UNDEFINED){_value=_stack[_length-1]}_update.call(this,false)}}else{if(_msie&&diff){if(_version<7){_l.reload()}else{this.setValue(hash)}}else{if(diff){_value=hash;_update.call(this,false)}}}if(_msie){_titleCheck.call(this)}}};var _bodyClick=function(e){if(_popup.length>0){var popup=window.open(_popup[0],_popup[1],eval(_popup[2]));if(typeof _popup[3]!=UNDEFINED){eval(_popup[3])}}_popup=[]};var _swfChange=function(){for(var i=0,id,obj,value=SWFAddress.getValue(),setter="setSWFAddressValue";id=_ids[i];i++){obj=document.getElementById(id);if(obj){if(obj.parentNode&&typeof obj.parentNode.so!=UNDEFINED){obj.parentNode.so.call(setter,value)}else{if(!(obj&&typeof obj[setter]!=UNDEFINED)){var objects=obj.getElementsByTagName("object");var embeds=obj.getElementsByTagName("embed");obj=((objects[0]&&typeof objects[0][setter]!=UNDEFINED)?objects[0]:((embeds[0]&&typeof embeds[0][setter]!=UNDEFINED)?embeds[0]:null))}if(obj){obj[setter](value)}}}else{if(obj=document[id]){if(typeof obj[setter]!=UNDEFINED){obj[setter](value)}}}}};var _jsDispatch=function(type){this.dispatchEvent(new SWFAddressEvent(type));type=type.substr(0,1).toUpperCase()+type.substr(1);if(typeof this["on"+type]==FUNCTION){this["on"+type]()}};var _jsInit=function(){if(_util.Browser.isSafari()){_d.body.addEventListener("click",_bodyClick)}_jsDispatch.call(this,"init")};var _jsChange=function(){_swfChange();_jsDispatch.call(this,"change")};var _update=function(internal){_jsChange.call(this);if(internal){_jsDispatch.call(this,"internalChange")}else{_jsDispatch.call(this,"externalChange")}_st(_functions.bind(_track,this),10)};var _track=function(){;var value=(_l.pathname+(this.getValue().length > 1 ? '#' + this.getValue() : '')).replace(/\/\//,"/").replace(/^\/$/,"");var fn=_t[_opts.tracker];if(typeof fn==FUNCTION){fn(value)}else{if(typeof _t.pageTracker!=UNDEFINED&&typeof _t.pageTracker._trackPageview==FUNCTION){_t.pageTracker._trackPageview(value)}else{if(typeof _t.urchinTracker==FUNCTION){_t.urchinTracker(value)}}}};var _htmlWrite=function(){var doc=_frame.contentWindow.document;doc.open();doc.write("<html><head><title>"+_d.title+"</title><script>var "+ID+' = "'+_getHash()+'";<\/script></head></html>');doc.close()};var _htmlLoad=function(){var win=_frame.contentWindow;var src=win.location.href;_value=(typeof win[ID]!=UNDEFINED?win[ID]:"");if(_value!=_getHash()){_update.call(SWFAddress,false);_l.hash=_ieLocal(_value,TRUE)}};var _load=function(){if(!_loaded){_loaded=TRUE;if(_msie&&_version<8){var frameset=_d.getElementsByTagName("frameset")[0];_frame=_d.createElement((frameset?"":"i")+"frame");if(frameset){frameset.insertAdjacentElement("beforeEnd",_frame);frameset[frameset.cols?"cols":"rows"]+=",0";_frame.src="javascript:false";_frame.noResize=true;_frame.frameBorder=_frame.frameSpacing=0}else{_frame.src="javascript:false";_frame.style.display="none";_d.body.insertAdjacentElement("afterBegin",_frame)}_st(function(){_events.addListener(_frame,"load",_htmlLoad);if(typeof _frame.contentWindow[ID]==UNDEFINED){_htmlWrite()}},50)}else{if(_safari){if(_version<418){_d.body.innerHTML+='<form id="'+ID+'" style="position:absolute;top:-9999px;" method="get"></form>';_form=_d.getElementById(ID)}if(typeof _l[ID]==UNDEFINED){_l[ID]={}}if(typeof _l[ID][_l.pathname]!=UNDEFINED){_stack=_l[ID][_l.pathname].split(",")}}}_st(_functions.bind(function(){_jsInit.call(this);_jsChange.call(this);_track.call(this)},this),1);if(_msie&&_version>=8){_d.body.onhashchange=_functions.bind(_listen,this);_si(_functions.bind(_titleCheck,this),50)}else{_si(_functions.bind(_listen,this),50)}}};var ID="swfaddress",FUNCTION="function",UNDEFINED="undefined",TRUE=true,FALSE=false,_util=asual.util,_browser=_util.Browser,_events=_util.Events,_functions=_util.Functions,_version=_browser.getVersion(),_msie=_browser.isMSIE(),_mozilla=_browser.isMozilla(),_opera=_browser.isOpera(),_safari=_browser.isSafari(),_supported=FALSE,_t=_getWindow(),_d=_t.document,_h=_t.history,_l=_t.location,_si=setInterval,_st=setTimeout,_dc=decodeURI,_ec=encodeURI,_frame,_form,_url,_title=_d.title,_length=_h.length,_silent=FALSE,_loaded=FALSE,_justset=TRUE,_juststart=TRUE,_ref=this,_stack=[],_ids=[],_popup=[],_listeners={},_value=_getHash(),_opts={history:TRUE,strict:TRUE};if(_msie&&_d.documentMode&&_d.documentMode!=_version){_version=_d.documentMode!=8?7:8}_supported=(_mozilla&&_version>=1)||(_msie&&_version>=6)||(_opera&&_version>=9.5)||(_safari&&_version>=312);if(_supported){if(_opera){history.navigationMode="compatible"}for(var i=1;i<_length;i++){_stack.push("")}_stack.push(_getHash());if(_msie&&_l.hash!=_getHash()){_l.hash="#"+_ieLocal(_getHash(),TRUE)}_searchScript(document);var _qi=_url?_url.indexOf("?"):-1;if(_qi!=-1){var param,params=_url.substr(_qi+1).split("&");for(var i=0,p;p=params[i];i++){param=p.split("=");if(/^(history|strict)$/.test(param[0])){_opts[param[0]]=(isNaN(param[1])?/^(true|yes)$/i.test(param[1]):(parseInt(param[1])!=0))}if(/^tracker$/.test(param[0])){_opts[param[0]]=param[1]}}}if(_msie){_titleCheck.call(this)}if(window==_t){_events.addListener(document,"DOMContentLoaded",_functions.bind(_load,this))}_events.addListener(_t,"load",_functions.bind(_load,this))}else{if((!_supported&&_l.href.indexOf("#")!=-1)||(_safari&&_version<418&&_l.href.indexOf("#")!=-1&&_l.search!="")){_d.open();_d.write('<html><head><meta http-equiv="refresh" content="0;url='+_l.href.substr(0,_l.href.indexOf("#"))+'" /></head></html>');_d.close()}else{_track()}}this.toString=function(){return"[class SWFAddress]"};this.back=function(){_h.back()};this.forward=function(){_h.forward()};this.up=function(){var path=this.getPath();this.setValue(path.substr(0,path.lastIndexOf("/",path.length-2)+(path.substr(path.length-1)=="/"?1:0)))};this.go=function(delta){_h.go(delta)};this.href=function(url,target){target=typeof target!=UNDEFINED?target:"_self";if(target=="_self"){self.location.href=url}else{if(target=="_top"){_l.href=url}else{if(target=="_blank"){window.open(url)}else{_t.frames[target].location.href=url}}}};this.popup=function(url,name,options,handler){try{var popup=window.open(url,name,eval(options));if(typeof handler!=UNDEFINED){eval(handler)}}catch(ex){}_popup=arguments};this.getIds=function(){return _ids};this.getId=function(index){return _ids[0]};this.setId=function(id){_ids[0]=id};this.addId=function(id){this.removeId(id);_ids.push(id)};this.removeId=function(id){for(var i=0;i<_ids.length;i++){if(id==_ids[i]){_ids.splice(i,1);break}}};this.addEventListener=function(type,listener){if(typeof _listeners[type]==UNDEFINED){_listeners[type]=[]}_listeners[type].push(listener)};this.removeEventListener=function(type,listener){if(typeof _listeners[type]!=UNDEFINED){for(var i=0,l;l=_listeners[type][i];i++){if(l==listener){break}}_listeners[type].splice(i,1)}};this.dispatchEvent=function(event){if(this.hasEventListener(event.type)){event.target=this;for(var i=0,l;l=_listeners[event.type][i];i++){l(event)}return TRUE}return FALSE};this.hasEventListener=function(type){return(typeof _listeners[type]!=UNDEFINED&&_listeners[type].length>0)};this.getBaseURL=function(){var url=_l.href;if(url.indexOf("#")!=-1){url=url.substr(0,url.indexOf("#"))}if(url.substr(url.length-1)=="/"){url=url.substr(0,url.length-1)}return url};this.getStrict=function(){return _opts.strict};this.setStrict=function(strict){_opts.strict=strict};this.getHistory=function(){return _opts.history};this.setHistory=function(history){_opts.history=history};this.getTracker=function(){return _opts.tracker};this.setTracker=function(tracker){_opts.tracker=tracker};this.getTitle=function(){return _d.title};this.setTitle=function(title){if(!_supported){return null}if(typeof title==UNDEFINED){return}if(title=="null"){title=""}title=_dc(title);_st(function(){_title=_d.title=title;if(_juststart&&_frame&&_frame.contentWindow&&_frame.contentWindow.document){_frame.contentWindow.document.title=title;_juststart=FALSE}if(!_justset&&_mozilla){_l.replace(_l.href.indexOf("#")!=-1?_l.href:_l.href+"#")}_justset=FALSE},10)};this.getStatus=function(){return _t.status};this.setStatus=function(status){if(!_supported){return null}if(typeof status==UNDEFINED){return}if(status=="null"){status=""}status=_dc(status);if(!_safari){status=_strictCheck((status!="null")?status:"",TRUE);if(status=="/"){status=""}if(!(/http(s)?:\/\//.test(status))){var index=_l.href.indexOf("#");status=(index==-1?_l.href:_l.href.substr(0,index))+"#"+status}_t.status=status}};this.resetStatus=function(){_t.status=""};this.getValue=function(){if(!_supported){return null}return _dc(_strictCheck(_ieLocal(_value,FALSE),FALSE))};this.setValue=function(value){if(!_supported){return null}if(typeof value==UNDEFINED){return}if(value=="null"){value=""}value=_ec(_dc(_strictCheck(value,TRUE)));if(value=="/"){value=""}if(_value==value){return}_justset=TRUE;_value=value;_silent=TRUE;_update.call(SWFAddress,true);_stack[_h.length]=_value;if(_safari){if(_opts.history){_l[ID][_l.pathname]=_stack.toString();_length=_h.length+1;if(_version<418){if(_l.search==""){_form.action="#"+_value;_form.submit()}}else{if(_version<523||_value==""){var evt=_d.createEvent("MouseEvents");evt.initEvent("click",TRUE,TRUE);var anchor=_d.createElement("a");anchor.href="#"+_value;anchor.dispatchEvent(evt)}else{_l.hash="#"+_value}}}else{_l.replace("#"+_value)}}else{if(_value!=_getHash()){if(_opts.history){_l.hash="#"+_dc(_ieLocal(_value,TRUE))}else{_l.replace("#"+_dc(_value))}}}if((_msie&&_version<8)&&_opts.history){_st(_htmlWrite,50)}if(_safari){_st(function(){_silent=FALSE},1)}else{_silent=FALSE}};this.getPath=function(){var value=this.getValue();if(value.indexOf("?")!=-1){return value.split("?")[0]}else{if(value.indexOf("#")!=-1){return value.split("#")[0]}else{return value}}};this.getPathNames=function(){var path=this.getPath(),names=path.split("/");if(path.substr(0,1)=="/"||path.length==0){names.splice(0,1)}if(path.substr(path.length-1,1)=="/"){names.splice(names.length-1,1)}return names};this.getQueryString=function(){var value=this.getValue(),index=value.indexOf("?");if(index!=-1&&index<value.length){return value.substr(index+1)}};this.getParameter=function(param){var value=this.getValue();var index=value.indexOf("?");if(index!=-1){value=value.substr(index+1);var p,params=value.split("&"),i=params.length,r=[];while(i--){p=params[i].split("=");if(p[0]==param){r.push(p[1])}}if(r.length!=0){return r.length!=1?r:r[0]}}};this.getParameterNames=function(){var value=this.getValue();var index=value.indexOf("?");var names=[];if(index!=-1){value=value.substr(index+1);if(value!=""&&value.indexOf("=")!=-1){var params=value.split("&"),i=0;while(i<params.length){names.push(params[i].split("=")[0]);i++}}}return names};this.onInit=null;this.onChange=null;this.onInternalChange=null;this.onExternalChange=null;(function(){var _args;if(typeof FlashObject!=UNDEFINED){SWFObject=FlashObject}if(typeof SWFObject!=UNDEFINED&&SWFObject.prototype&&SWFObject.prototype.write){var _s1=SWFObject.prototype.write;SWFObject.prototype.write=function(){_args=arguments;if(this.getAttribute("version").major<8){this.addVariable("$swfaddress",SWFAddress.getValue());((typeof _args[0]=="string")?document.getElementById(_args[0]):_args[0]).so=this}var success;if(success=_s1.apply(this,_args)){_ref.addId(this.getAttribute("id"))}return success}}if(typeof swfobject!=UNDEFINED){var _s2r=swfobject.registerObject;swfobject.registerObject=function(){_args=arguments;_s2r.apply(this,_args);_ref.addId(_args[0])};var _s2c=swfobject.createSWF;swfobject.createSWF=function(){_args=arguments;var swf=_s2c.apply(this,_args);if(swf){_ref.addId(_args[0].id)}return swf};var _s2e=swfobject.embedSWF;swfobject.embedSWF=function(){_args=arguments;if(typeof _args[8]==UNDEFINED){_args[8]={}}if(typeof _args[8].id==UNDEFINED){_args[8].id=_args[1]}_s2e.apply(this,_args);_ref.addId(_args[8].id)}}if(typeof UFO!=UNDEFINED){var _u=UFO.create;UFO.create=function(){_args=arguments;_u.apply(this,_args);_ref.addId(_args[0].id)}}if(typeof AC_FL_RunContent!=UNDEFINED){var _a=AC_FL_RunContent;AC_FL_RunContent=function(){_args=arguments;_a.apply(this,_args);for(var i=0,l=_args.length;i<l;i++){if(_args[i]=="id"){_ref.addId(_args[i+1])}}}}})()};;/*
	CRIR - Checkbox & Radio Input Replacement
	Author: Chris Erwin (me[at]chriserwin.com)
	www.chriserwin.com/scripts/crir/

	Updated July 27, 2006.
	Jesse Gavin added the AddEvent function to initialize
	the script. He also converted the script to JSON format.
	
	Updated July 30, 2006.
	Added the ability to tab to elements and use the spacebar
	to check the input element. This bit of functionality was
	based on a tip from Adam Burmister.
*/

crir = {
	userAgent: '',
	isSafari: false,
	clickFunctions: new Object(),
	init: function() {
		
		this.userAgent = navigator.userAgent.toLowerCase();
		this.isSafari = ((this.userAgent.indexOf('safari')!=-1)&&(this.userAgent.indexOf('mac')!=-1))?true:false;
		
		if (! this.isSafari) { // the script doesn't work in safari.
			arrLabels = document.getElementsByTagName('label');
		
			searchLabels:
			for (var i=0; i<arrLabels.length; i++) {			
				// get the input element based on the for attribute of the label tag
				if (arrLabels[i].getAttributeNode('for') && arrLabels[i].getAttributeNode('for').value != '') {
					labelElementFor = arrLabels[i].getAttributeNode('for').value;				
					inputElement = document.getElementById(labelElementFor);
				}
				else {				
					continue searchLabels;
				}	
								
				inputElementClass = inputElement.className;	
				crir.clickFunctions[inputElement.id] = inputElement.onclick;
				inputElement.setDisabled = crir.setDisabled;
				inputElement.setChecked = crir.setChecked;

				// if the input is specified to be hidden intiate it
				if (inputElementClass == 'crirHiddenJS') {
					inputElement.className = 'crirHidden';
					
					inputElementType = inputElement.getAttributeNode('type').value;	
					
					// add the appropriate event listener to the input element
					if (inputElementType == "checkbox") {	
						inputElement.onclick = crir.toggleCheckboxLabel;
					}
					else {
						inputElement.onclick = crir.toggleRadioLabel;
					}
					
					// set the initial label state
					if (inputElement.checked) {
						if (inputElementType == 'checkbox') { arrLabels[i].className = 'checkbox_checked'}
						else { arrLabels[i].className = 'radio_checked' }
					}
					else {
						if (inputElementType == 'checkbox') { arrLabels[i].className = 'checkbox_unchecked'}
						else { arrLabels[i].className = 'radio_unchecked' }
					}
				}
				else if (inputElement.nodeName != 'SELECT' && inputElement.getAttributeNode('type').value == 'radio') { // this so even if a radio is not hidden but belongs to a group of hidden radios it will still work.
					arrLabels[i].onclick = crir.toggleRadioLabel;
					inputElement.onclick = crir.toggleRadioLabel;
				}
				
				if(inputElement.disabled)
					arrLabels[i].className = arrLabels[i].className + " disabled";
			}
		}
	},	
	
	findLabel: function (inputElementID) {
		arrLabels = document.getElementsByTagName('label');
	
		searchLoop:
		for (var i=0; i<arrLabels.length; i++) {
			if (arrLabels[i].getAttributeNode('for') && arrLabels[i].getAttributeNode('for').value == inputElementID) {				
				return arrLabels[i];
				break searchLoop;				
			}
		}		
	},	
	
	toggleCheckboxLabel: function () {
		labelElement = crir.findLabel(this.getAttributeNode('id').value);
		if(crir.clickFunctions[this.getAttributeNode('id').value] != null)
			crir.clickFunctions[this.getAttributeNode('id').value]();
		if(labelElement.className == 'checkbox_checked') {
			labelElement.className = "checkbox_unchecked";
		}
		else {
			labelElement.className = "checkbox_checked";
		}
	},	
	
	toggleRadioLabel: function () {			 
		clickedLabelElement = crir.findLabel(this.getAttributeNode('id').value);
		
		var id = this.getAttributeNode('id').value;
		if(crir.clickFunctions[id] != null)
			crir.clickFunctions[id]();
		
		clickedInputElement = this;
		clickedInputElementName = clickedInputElement.getAttributeNode('name').value;
		
		arrInputs = document.getElementsByTagName('input');
	
		// uncheck (label class) all radios in the same group
		for (var i=0; i<arrInputs.length; i++) {			
			inputElementType = arrInputs[i].getAttributeNode('type').value;
			if (inputElementType == 'radio') {
				inputElementName = arrInputs[i].getAttributeNode('name').value;
				inputElementClass = arrInputs[i].className;
				// find radio buttons with the same 'name' as the one we've changed and have a class of chkHidden
				// and then set them to unchecked
				if (inputElementName == clickedInputElementName && inputElementClass == 'crirHidden') {				
					inputElementID = arrInputs[i].getAttributeNode('id').value;
					labelElement = crir.findLabel(inputElementID);
					labelElement.className = 'radio_unchecked';
				}
			}
		}
	
		// if the radio clicked is hidden set the label to checked
		if (clickedInputElement.className == 'crirHidden') {
			clickedLabelElement.className = 'radio_checked';
		}
	},
	
	setDisabled: function (value) {		
		this.disabled = value;
		labelElement = crir.findLabel(this.getAttributeNode('id').value);
		if(value)
		{
			labelElement.className = labelElement.className + " disabled";		
		}
		else
		{
			if(String(labelElement.className).indexOf(" ") > 0)
				labelElement.className = String(labelElement.className).substr(0, String(labelElement.className).indexOf(" "));
		}
	},
	
	setChecked: function (value) {		
		this.checked = value;
		labelElement = crir.findLabel(this.getAttributeNode('id').value);
		if(value)
		{
			labelElement.className = "checkbox_checked";		
		}
		else
		{
			labelElement.className = "checkbox_unchecked";
		}
	},
	
	addEvent: function(element, eventType, doFunction, useCapture){
		if (element.addEventListener) 
		{
			element.addEventListener(eventType, doFunction, useCapture);
			return true;
		} else if (element.attachEvent) {
			var r = element.attachEvent('on' + eventType, doFunction);
			return r;
		} else {
			element['on' + eventType] = doFunction;
		}
	}
}

crir.addEvent(window, 'load', crir.init, false);;/*
 * Generate RFC4122 (v1 and v4) UUIDs
 *
 * Documentation at https://github.com/broofa/node-uuid
 */
(function() {
  var _global = this;

  // Random number generator (feature-detected below)
  var _rng;

  // node.js 'crypto' API
  // http://nodejs.org/docs/v0.6.2/api/crypto.html#randomBytes
  try {
    _rng = require('crypto').randomBytes;
  } catch (e) {}

  // WHATWG crypto api, available in Chrome
  // http://wiki.whatwg.org/wiki/Crypto
  if (!_rng && _global.crypto && crypto.getRandomValues) {
    var _rnds = new Uint32Array(4), _rndBytes = new Array(16);
    var _rng = function() {
      // Get 32-bit rnds
      crypto.getRandomValues(_rnds);

      // Unpack into byte array
      for (var c = 0 ; c < 16; c++) {
        _rndBytes[c] = _rnds[c >> 2] >>> ((c & 0x03) * 8) & 0xff;
      }
      return _rndBytes;
    };
  }

  // Math.random - least desirable option since it does not guarantee
  // cryptographic quality.
  if (!_rng) {
    var _rndBytes = new Array(16);
    _rng = function() {
      var r, b = _rndBytes, i = 0;

      for (var i = 0, r; i < 16; i++) {
        if ((i & 0x03) == 0) r = Math.random() * 0x100000000;
        b[i] = r >>> ((i & 0x03) << 3) & 0xff;
      }

      return b;
    };
  }

  // Buffer class to use
  var BufferClass = typeof(Buffer) == 'function' ? Buffer : Array;

  // Maps for number <-> hex string conversion
  var _byteToHex = [];
  var _hexToByte = {};
  for (var i = 0; i < 256; i++) {
    _byteToHex[i] = (i + 0x100).toString(16).substr(1);
    _hexToByte[_byteToHex[i]] = i;
  }

  /** See docs at https://github.com/broofa/node-uuid */
  function parse(s, buf, offset) {
    var i = (buf && offset) || 0, ii = 0;

    buf = buf || [];
    s.toLowerCase().replace(/[0-9a-f]{2}/g, function(byte) {
      if (ii < 16) { // Don't overflow!
        buf[i + ii++] = _hexToByte[byte];
      }
    });

    // Zero out remaining bytes if string was short
    while (ii < 16) {
      buf[i + ii++] = 0;
    }

    return buf;
  }

  /** See docs at https://github.com/broofa/node-uuid */
  function unparse(buf, offset) {
    var i = offset || 0, bth = _byteToHex;
    return  bth[buf[i++]] + bth[buf[i++]] +
            bth[buf[i++]] + bth[buf[i++]] + '-' +
            bth[buf[i++]] + bth[buf[i++]] + '-' +
            bth[buf[i++]] + bth[buf[i++]] + '-' +
            bth[buf[i++]] + bth[buf[i++]] + '-' +
            bth[buf[i++]] + bth[buf[i++]] +
            bth[buf[i++]] + bth[buf[i++]] +
            bth[buf[i++]] + bth[buf[i++]];
  }

  // Pre allocate array for constructing uuids
  var _buffer = new BufferClass(16);

  //
  // v1 UUID support
  //
  // Inspired by https://github.com/LiosK/UUID.js
  // and http://docs.python.org/library/uuid.html
  //

  // Per 4.1.4 - Offset (in msecs) from JS time to UUID (gregorian) time
  var EPOCH_OFFSET = 12219292800000;

  // random #'s we need to init node and clockseq
  var _seedBytes = _rng(10);

  // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
  var _nodeId = [
    _seedBytes[0] | 0x01,
    _seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5]
  ];

  // Per 4.2.2, randomize (14 bit) clockseq
  var _clockSeq = (_seedBytes[6] << 8 | _seedBytes[7]) & 0x3fff;

  // Previous uuid creation time
  var _last = 0;

  // Count of UUIDs created during current time tick
  var _count = 0;

  /** See docs at https://github.com/broofa/node-uuid */
  function v1(options, buf, offset) {
    var i = buf && offset || 0;
    var b = buf || _buffer;

    options = options || {};

    // JS Numbers aren't capable of representing time in the RFC-specified
    // 100-nanosecond units. To deal with this, we represent time as the usual
    // JS milliseconds, plus an additional 100-nanosecond unit offset.
    var msecs = 0; // JS time (msecs since Unix epoch)
    var nsecs = 0; // additional 100-nanosecond units to add to msecs

    if (options.msecs != null) {
      // Explicit time specified.  Not that this turns off the internal logic
      // around uuid count and clock sequence used insure uniqueness
      msecs = (+options.msecs) + EPOCH_OFFSET;
      nsecs = options.nsecs || 0;
    } else {
      // No time options - Follow the RFC logic (4.2.1.2) for maintaining
      // clock seq and uuid count to help insure UUID uniqueness.

      msecs = new Date().getTime() + EPOCH_OFFSET;

      if (msecs < _last) {
        // Clock regression - Per 4.2.1.2, increment clock seq
        _clockSeq++;
        _count = 0;
      } else {
        // Per 4.2.1.2, use a count of uuid's generated during the current
        // clock cycle to simulate higher resolution clock
        _count = (msecs == _last) ? _count + 1 : 0;
      }
      _last = msecs;

      // Per 4.2.1.2 If generator creates more than one id per uuid 100-ns
      // interval, throw an error
      // (Requires generating > 10M uuids/sec. While unlikely, it's not
      // entirely inconceivable given the benchmark results we're getting)
      if (_count >= 10000) {
        throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');
      }

      nsecs = _count;
    }

    // Per 4.1.4, timestamp composition

    // time_low
    var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
    b[i++] = tl >>> 24 & 0xff;
    b[i++] = tl >>> 16 & 0xff;
    b[i++] = tl >>> 8 & 0xff;
    b[i++] = tl & 0xff;

    // time_mid
    var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;
    b[i++] = tmh >>> 8 & 0xff;
    b[i++] = tmh & 0xff;

    // time_high_and_version
    b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
    b[i++] = tmh >>> 16 & 0xff;

    // Clock sequence
    var cs = options.clockseq != null ? options.clockseq : _clockSeq;

    // clock_seq_hi_and_reserved (Per 4.2.2 - include variant)
    b[i++] = cs >>> 8 | 0x80;

    // clock_seq_low
    b[i++] = cs & 0xff;

    // node
    var node = options.node || _nodeId;
    for (var n = 0; n < 6; n++) {
      b[i + n] = node[n];
    }

    return buf ? buf : unparse(b);
  }

  //
  // v4 UUID support
  //

  /** See docs at https://github.com/broofa/node-uuid */
  function v4(options, buf, offset) {
    // Deprecated - 'format' argument, as supported in v1.2
    var i = buf && offset || 0;
    if (typeof(options) == 'string') {
      buf = options == 'binary' ? new BufferClass(16) : null;
      options = null;
    }

    var rnds = options && options.random || _rng(16);
    // Per 4.4, set bits for version and clock_seq_hi_and_reserved
    rnds[6] = (rnds[6] & 0x0f) | 0x40;
    rnds[8] = (rnds[8] & 0x3f) | 0x80;

    // Copy bytes to buffer, if provided
    if (buf) {
      for (var ii = 0; ii < 16; ii++) {
        buf[i + ii] = rnds[ii];
      }
    }

    return buf || unparse(rnds);
  }

  //
  // Export API
  //

  var uuid = v4;
  uuid.v1 = v1;
  uuid.v4 = v4;
  uuid.parse = parse;
  uuid.unparse = unparse;
  uuid.BufferClass = BufferClass;

  if (typeof(module) != 'undefined') {
    module.exports = uuid;
  } else {
    var _previousRoot = _global.uuid;
    uuid.noConflict = function() {
      _global.uuid = _previousRoot;
      return uuid;
    }
    _global.uuid = uuid;
  }
}());
;/*! jQuery v1.7.1 jquery.com | jquery.org/license */
(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function cb(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function ca(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bE.test(a)?d(a,e):ca(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)ca(a+"["+e+"]",b[e],c,d);else d(a,b)}function b_(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function b$(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bT,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=b$(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=b$(a,c,d,e,"*",g));return l}function bZ(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bP),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bC(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bx:by,g=0,h=e.length;if(d>0){if(c!=="border")for(;g<h;g++)c||(d-=parseFloat(f.css(a,"padding"+e[g]))||0),c==="margin"?d+=parseFloat(f.css(a,c+e[g]))||0:d-=parseFloat(f.css(a,"border"+e[g]+"Width"))||0;return d+"px"}d=bz(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0;if(c)for(;g<h;g++)d+=parseFloat(f.css(a,"padding"+e[g]))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+e[g]+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+e[g]))||0);return d+"px"}function bp(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bo(a){var b=c.createElement("div");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bm(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bm)}function bm(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bk(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bj(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c+(i[c][d].namespace?".":"")+i[c][d].namespace,i[c][d],i[c][d].data)}h.data&&(h.data=f.extend({},h.data))}}function bi(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function U(a){var b=V.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function T(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(O.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(H)return H.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h==="array"?m(g):h==="function"&&(!a.unique||!o.has(g))&&c.push(g)},n=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,l=j||0,j=0,k=c.length;for(;c&&l<k;l++)if(c[l].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}i=!1,c&&(a.once?e===!0?o.disable():c=[]:d&&d.length&&(e=d.shift(),o.fireWith(e[0],e[1])))},o={add:function(){if(c){var a=c.length;m(arguments),i?k=c.length:e&&e!==!0&&(j=a,n(e[0],e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){i&&f<=k&&(k--,f<=l&&l--),c.splice(f--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&o.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(i?a.once||d.push([b,c]):(!a.once||!e)&&n(b,c));return this},fire:function(){o.fireWith(this,arguments);return this},fired:function(){return!!e}};return o};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks("once memory"),c=f.Callbacks("once memory"),d=f.Callbacks("memory"),e="pending",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);return this},always:function(){i.done.apply(i,arguments).fail.apply(i,arguments);return this},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;i.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var b,d,e,g,h,i,j,k,l,m,n,o,p,q=c.createElement("div"),r=c.documentElement;q.setAttribute("className","t"),q.innerHTML="   <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="<div "+n+"><div></div></div>"+"<table "+n+" cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="<div style='width:4px;'></div>",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h=null;if(typeof a=="undefined"){if(this.length){h=f.data(this[0]);if(this[0].nodeType===1&&!f._data(this[0],"parsedAttrs")){e=this[0].attributes;for(var i=0,j=e.length;i<j;i++)g=e[i].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),l(this[0],g,h[g]));f._data(this[0],"parsedAttrs",!0)}}return h}if(typeof a=="object")return this.each(function(){f.data(this,a)});d=a.split("."),d[1]=d[1]?"."+d[1]:"";if(c===b){h=this.triggerHandler("getData"+d[1]+"!",[d[0]]),h===b&&this.length&&(h=f.data(this[0],a),h=l(this[0],a,h));return h===b&&d[1]?this.data(d[0]):h}return this.each(function(){var b=f(this),e=[d[0],c];b.triggerHandler("setData"+d[1]+"!",e),f.data(this,a,c),b.triggerHandler("changeData"+d[1]+"!",e)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks("once memory"),!0))h++,l.add(m);m();return d.promise()}});var o=/[\n\t\r]/g,p=/\s+/,q=/\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(o," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(o," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,"optgroup"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h<g;h++)e=d[h],e&&(c=f.propFix[e]||e,f.attr(a,e,""),a.removeAttribute(v?e:c),u.test(e)&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,"button"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,"button"))return w.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&"set"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&"get"in g&&(e=g.get(a,c))!==null?e:a[c]}},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.attrHooks.tabindex.set=w.set,f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===""&&(b="false"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype="encoding"),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};
f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k<c.length;k++){l=A.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.guid,selector:g,quick:G(g),namespace:n.join(".")},p),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent("on"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d,e){var g=f.hasData(a)&&f._data(a),h,i,j,k,l,m,n,o,p,q,r,s;if(!!g&&!!(o=g.events)){b=f.trim(I(b||"")).split(" ");for(h=0;h<b.length;h++){i=A.exec(b[h])||[],j=k=i[1],l=i[2];if(!j){for(j in o)f.event.remove(a,j+b[h],c,d,!0);continue}p=f.event.special[j]||{},j=(d?p.delegateType:p.bindType)||j,r=o[j]||[],m=r.length,l=l?new RegExp("(^|\\.)"+l.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(n=0;n<r.length;n++)s=r[n],(e||k===s.origType)&&(!c||c.guid===s.guid)&&(!l||l.test(s.namespace))&&(!d||d===s.selector||d==="**"&&s.selector)&&(r.splice(n--,1),s.selector&&r.delegateCount--,p.remove&&p.remove.call(a,s));r.length===0&&m!==r.length&&((!p.teardown||p.teardown.call(a,l)===!1)&&f.removeEvent(a,j,g.handle),delete o[j])}f.isEmptyObject(o)&&(q=g.handle,q&&(q.elem=null),f.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;if(E.test(h+f.event.triggered))return;h.indexOf("!")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length&&!c.isPropagationStopped();l++)m=r[l][0],c.type=r[l][1],q=(f._data(m,"events")||{})[c.type]&&f._data(m,"handle"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d)===!1&&c.preventDefault();c.type=h,!g&&!c.isDefaultPrevented()&&(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)&&o&&e[h]&&(h!=="focus"&&h!=="blur"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,"events")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.namespace,i=[],j,k,l,m,n,o,p,q,r,s,t;g[0]=c,c.delegateTarget=this;if(e&&!c.target.disabled&&(!c.button||c.type!=="click")){m=f(this),m.context=this.ownerDocument||this;for(l=c.target;l!=this;l=l.parentNode||this){o={},q=[],m[0]=l;for(j=0;j<e;j++)r=d[j],s=r.selector,o[s]===b&&(o[s]=r.quick?H(l,r.quick):m.is(s)),o[s]&&q.push(r);q.length&&i.push({elem:l,matches:q})}}d.length>e&&i.push({elem:this,matches:d.slice(e)});for(j=0;j<i.length&&!c.isPropagationStopped();j++){p=i[j],c.currentTarget=p.elem;for(k=0;k<p.matches.length&&!c.isImmediatePropagationStopped();k++){r=p.matches[k];if(h||!c.namespace&&!r.namespace||c.namespace_re&&c.namespace_re.test(r.namespace))c.data=r.data,c.handleObj=r,n=((f.event.special[r.origType]||{}).handle||r.handler).apply(p.elem,g),n!==b&&(c.result=n,n===!1&&(c.preventDefault(),c.stopPropagation()))}}return c.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,d){var e,f,g,h=d.button,i=d.fromElement;a.pageX==null&&d.clientX!=null&&(e=a.target.ownerDocument||c,f=e.documentElement,g=e.body,a.pageX=d.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=d.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?d.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0);return a}},fix:function(a){if(a[f.expando])return a;var d,e,g=a,h=f.event.fixHooks[a.type]||{},i=h.props?this.props.concat(h.props):this.props;a=f.Event(g);for(d=i.length;d;)e=i[--d],a[e]=g[e];a.target||(a.target=g.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey===b&&(a.metaKey=a.ctrlKey);return h.filter?h.filter(a,g):a},special:{ready:{setup:f.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=f.extend(new f.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?f.event.trigger(e,null,b):f.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},f.event.handle=f.event.dispatch,f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!(this instanceof f.Event))return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?K:J):this.type=a,b&&f.extend(this,b),this.timeStamp=a&&a.timeStamp||f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=K;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=K;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=K,this.stopPropagation()},isDefaultPrevented:J,isPropagationStopped:J,isImmediatePropagationStopped:J},f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c=this,d=a.relatedTarget,e=a.handleObj,g=e.selector,h;if(!d||d!==c&&!f.contains(c,d))a.type=e.origType,h=e.handler.apply(this,arguments),a.type=b;return h}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(){if(f.nodeName(this,"form"))return!1;f.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=f.nodeName(c,"input")||f.nodeName(c,"button")?c.form:b;d&&!d._submit_attached&&(f.event.add(d,"submit._submit",function(a){this.parentNode&&!a.isTrigger&&f.event.simulate("submit",this.parentNode,a,!0)}),d._submit_attached=!0)})},teardown:function(){if(f.nodeName(this,"form"))return!1;f.event.remove(this,"._submit")}}),f.support.changeBubbles||(f.event.special.change={setup:function(){if(z.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")f.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),f.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1,f.event.simulate("change",this,a,!0))});return!1}f.event.add(this,"beforeactivate._change",function(a){var b=a.target;z.test(b.nodeName)&&!b._change_attached&&(f.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&f.event.simulate("change",this.parentNode,a,!0)}),b._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){f.event.remove(this,"._change");return z.test(this.nodeName)}}),f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){var d=0,e=function(a){f.event.simulate(b,a.target,f.event.fix(a),!0)};f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.fn.extend({on:function(a,c,d,e,g){var h,i;if(typeof a=="object"){typeof c!="string"&&(d=c,c=b);for(i in a)this.on(i,c,d,a[i],g);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=J;else if(!e)return this;g===1&&(h=e,e=function(a){f().off(a);return h.apply(this,arguments)},e.guid=h.guid||(h.guid=f.guid++));return this.each(function(){f.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on.call(this,a,b,c,d,1)},off:function(a,c,d){if(a&&a.preventDefault&&a.handleObj){var e=a.handleObj;f(a.delegateTarget).off(e.namespace?e.type+"."+e.namespace:e.type,e.selector,e.handler);return this}if(typeof a=="object"){for(var g in a)this.off(g,c,a[g]);return this}if(c===!1||typeof c=="function")d=c,c=b;d===!1&&(d=J);return this.each(function(){f.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){f(this.context).on(a,this.selector,b,c);return this},die:function(a,b){f(this.context).off(a,this.selector||"**",b);return this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f._data(this,"lastToggle"+a.guid)||0)%d;f._data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}if(j.nodeType===1){g||(j[d]=c,j.sizset=h);if(typeof b!="string"){if(j===b){k=!0;break}}else if(m.filter(b,[j]).length>0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}j.nodeType===1&&!g&&(j[d]=c,j.sizset=h);if(j.nodeName.toLowerCase()===b){k=j;break}j=j[a]}e[h]=k}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},m.matches=function(a,b){return m(a,null,null,b)},m.matchesSelector=function(a,b){return m(b,null,null,[a]).length>0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e<f;e++){h=o.order[e];if(g=o.leftMatch[h].exec(a)){i=g[1],g.splice(1,1);if(i.substr(i.length-1)!=="\\"){g[1]=(g[1]||"").replace(j,""),d=o.find[h](g,b,c);if(d!=null){a=a.replace(o.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},m.filter=function(a,c,d,e){var f,g,h,i,j,k,l,n,p,q=a,r=[],s=c,t=c&&c[0]&&m.isXML(c[0]);while(a&&c.length){for(h in o.filter)if((f=o.leftMatch[h].exec(a))!=null&&f[2]){k=o.filter[h],l=f[1],g=!1,f.splice(1,1);if(l.substr(l.length-1)==="\\")continue;s===r&&(r=[]);if(o.preFilter[h]){f=o.preFilter[h](f,s,d,r,e,t);if(!f)g=i=!0;else if(f===!0)continue}if(f)for(n=0;(j=s[n])!=null;n++)j&&(i=k(j,f,n,s),p=e^i,d&&i!=null?p?g=!0:s[n]=!1:p&&(r.push(j),g=!0));if(i!==b){d||(s=r),a=a.replace(o.match[h],"");if(!g)return[];break}}if(a===q)if(g==null)m.error(a);else break;q=a}return s},m.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)};var n=m.getText=function(a){var b,c,d=a.nodeType,e="";if(d){if(d===1||d===9){if(typeof a.textContent=="string")return a.textContent;if(typeof a.innerText=="string")return a.innerText.replace(k,"");for(a=a.firstChild;a;a=a.nextSibling)e+=n(a)}else if(d===3||d===4)return a.nodeValue}else for(b=0;c=a[b];b++)c.nodeType!==8&&(e+=n(c));return e},o=m.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!l.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&m.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&m.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(j,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}m.error(e)},CHILD:function(a,b){var c,e,f,g,h,i,j,k=b[1],l=a;switch(k){case"only":case"first":while(l=l.previousSibling)if(l.nodeType===1)return!1;if(k==="first")return!0;l=a;case"last":while(l=l.nextSibling)if(l.nodeType===1)return!1;return!0;case"nth":c=b[2],e=b[3];if(c===1&&e===0)return!0;f=b[0],g=a.parentNode;if(g&&(g[d]!==f||!a.nodeIndex)){i=0;for(l=g.firstChild;l;l=l.nextSibling)l.nodeType===1&&(l.nodeIndex=++i);g[d]=f}j=a.nodeIndex-e;return c===0?j===0:j%c===0&&j/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,v;c.documentElement.compareDocumentPosition?u=function(a,b){if(a===b){h=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(u=function(a,b){if(a===b){h=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,i=b.parentNode,j=g;if(g===i)return v(a,b);if(!g)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return v(e[k],f[k]);return k===c?v(a,f[k],-1):v(e[k],b,1)},v=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h<i;h++)m(a,g[h],e,c);return m.filter(f,e)};m.attr=f.attr,m.selectors.attrMap={},f.find=m,f.expr=m.selectors,f.expr[":"]=f.expr.filters,f.unique=m.uniqueSort,f.text=m.getText,f.isXMLDoc=m.isXML,f.contains=m.contains}();var L=/Until$/,M=/^(?:parents|prevUntil|prevAll)/,N=/,/,O=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,Q=f.expr.match.POS,R={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(T(this,a,!1),"not",a)},filter:function(a){return this.pushStack(T(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?Q.test(a)?f(a,this.context).index(this[0])>=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d<a.length;d++)f(g).is(a[d])&&c.push({selector:a[d],elem:g,level:h});g=g.parentNode,h++}return c}var i=Q.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(i?i.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|style)/i,bb=/<(?:script|object|embed|option|style)/i,bc=new RegExp("<(?:"+V+")","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*<!(?:\[CDATA\[|\-\-)/,bg={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function()
{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bi(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bp)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i,j=a[0];b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof j=="string"&&j.length<512&&i===c&&j.charAt(0)==="<"&&!bb.test(j)&&(f.support.checkClone||!bd.test(j))&&(f.support.html5Clone||!bc.test(j))&&(g=!0,h=f.fragments[j],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[j]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1></$2>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bn(k[i]);else bn(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||be.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.event.special,g=f.support.deleteExpando;for(var h=0,i;(i=a[h])!=null;h++){if(i.nodeName&&f.noData[i.nodeName.toLowerCase()])continue;c=i[f.expando];if(c){b=d[c];if(b&&b.events){for(var j in b.events)e[j]?f.event.remove(i,j):f.removeEvent(i,j,b.handle);b.handle&&(b.handle.elem=null)}g?delete i[f.expando]:i.removeAttribute&&i.removeAttribute(f.expando),delete d[c]}}}});var bq=/alpha\([^)]*\)/i,br=/opacity=([^)]*)/,bs=/([A-Z]|^ms)/g,bt=/^-?\d+(?:px)?$/i,bu=/^-?\d/,bv=/^([\-+])=([\-+.\de]+)/,bw={position:"absolute",visibility:"hidden",display:"block"},bx=["Left","Right"],by=["Top","Bottom"],bz,bA,bB;f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bz(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bv.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bz)return bz(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){if(a.offsetWidth!==0)return bC(a,b,d);f.swap(a,bw,function(){e=bC(a,b,d)});return e}},set:function(a,b){if(!bt.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cv(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cu("hide",3),a,b,c);var d,e,g=0,h=this.length;for(;g<h;g++)d=this[g],d.style&&(e=f.css(d,"display"),e!=="none"&&!f._data(d,"olddisplay")&&f._data(d,"olddisplay",e));for(g=0;g<h;g++)this[g].style&&(this[g].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cu("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){function g(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(!f.support.inlineBlockNeedsLayout||cv(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)j=new f.fx(this,b,i),h=a[i],cn.test(h)?(o=f._data(this,"toggle"+i)||(h==="toggle"?d?"show":"hide":0),o?(f._data(this,"toggle"+i,o==="show"?"hide":"show"),j[o]()):j[h]()):(k=co.exec(h),l=j.cur(),k?(m=parseFloat(k[2]),n=k[3]||(f.cssNumber[i]?"":"px"),n!=="px"&&(f.style(this,i,(m||1)+n),l=(m||1)/j.cur()*l,f.style(this,i,l+n)),k[1]&&(m=(k[1]==="-="?-1:1)*m+l),j.custom(l,m,n)):j.custom(l,h,""));return!0}var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return e.queue===!1?this.each(g):this.queue(e.queue,g)},stop:function(a,c,d){typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]);return this.each(function(){function h(a,b,c){var e=b[c];f.removeData(a,c,!0),e.stop(d)}var b,c=!1,e=f.timers,g=f._data(this);d||f._unmark(!0,this);if(a==null)for(b in g)g[b]&&g[b].stop&&b.indexOf(".run")===b.length-4&&h(this,g,b);else g[b=a+".run"]&&g[b].stop&&h(this,g,b);for(b=e.length;b--;)e[b].elem===this&&(a==null||e[b].queue===a)&&(d?e[b](!0):e[b].saveState(),c=!0,e.splice(b,1));(!d||!c)&&f.dequeue(this,a)})}}),f.each({slideDown:cu("show",1),slideUp:cu("hide",1),slideToggle:cu("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue?f.dequeue(this,d.queue):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,c,d){function h(a){return e.step(a)}var e=this,g=f.fx;this.startTime=cr||cs(),this.end=c,this.now=this.start=a,this.pos=this.state=0,this.unit=d||this.unit||(f.cssNumber[this.prop]?"":"px"),h.queue=this.options.queue,h.elem=this.elem,h.saveState=function(){e.options.hide&&f._data(e.elem,"fxshow"+e.prop)===b&&f._data(e.elem,"fxshow"+e.prop,e.start)},h()&&f.timers.push(h)&&!cp&&(cp=setInterval(g.tick,g.interval))},show:function(){var a=f._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=a||f.style(this.elem,this.prop),this.options.show=!0,a!==b?this.custom(this.cur(),a):this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f._data(this.elem,"fxshow"+this.prop)||f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b,c,d,e=cr||cs(),g=!0,h=this.elem,i=this.options;if(a||e>=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cp),cp=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=a.now+a.unit:a.elem[a.prop]=a.now}}}),f.each(["width","height"],function(a,b){f.fx.step[b]=function(a){f.style(a.elem,b,Math.max(0,a.now)+a.unit)}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cw=/^t(?:able|d|h)$/i,cx=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cy(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.support.fixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.support.doesNotAddBorder&&(!f.support.doesAddBorderForTableAndCells||!cw.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.support.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.support.fixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window);;/*!
 * jQuery Tools dev - The missing UI library for the Web
 * 
 * tooltip/tooltip.js
 * tooltip/tooltip.dynamic.js
 * tooltip/tooltip.slide.js
 * 
 * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
 * 
 * http://flowplayer.org/tools/
 * 
 */
(function(a){a.tools=a.tools||{version:"dev"},a.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,fadeIE:!1,position:["top","center"],offset:[0,0],relative:!1,cancelDefault:!0,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"<div/>",tipClass:"tooltip"},addEffect:function(a,c,d){b[a]=[c,d]}};var b={toggle:[function(a){var b=this.getConf(),c=this.getTip(),d=b.opacity;d<1&&c.css({opacity:d}),c.show(),a.call()},function(a){this.getTip().hide(),a.call()}],fade:[function(b){var c=this.getConf();!a.browser.msie||c.fadeIE?this.getTip().fadeTo(c.fadeInSpeed,c.opacity,b):(this.getTip().show(),b())},function(b){var c=this.getConf();!a.browser.msie||c.fadeIE?this.getTip().fadeOut(c.fadeOutSpeed,b):(this.getTip().hide(),b())}]};function c(b,c,d){var e=d.relative?b.position().top:b.offset().top,f=d.relative?b.position().left:b.offset().left,g=d.position[0];e-=c.outerHeight()-d.offset[0],f+=b.outerWidth()+d.offset[1],/iPad/i.test(navigator.userAgent)&&(e-=a(window).scrollTop()*0);var h=c.outerHeight()+b.outerHeight();g=="center"&&(e+=h/2),g=="bottom"&&(e+=h),g=d.position[1];var i=c.outerWidth()+b.outerWidth();g=="center"&&(f-=i/2),g=="left"&&(f-=i);return{top:e,left:f}}function d(d,e){var f=this,g=d.add(f),h,i=0,j=0,k=d.attr("title"),l=d.attr("data-tooltip"),m=b[e.effect],n,o=d.is(":input"),p=o&&d.is(":checkbox, :radio, select, :button, :submit"),q=d.attr("type"),r=e.events[q]||e.events[o?p?"widget":"input":"def"];if(!m)throw"Nonexistent effect \""+e.effect+"\"";r=r.split(/,\s*/);if(r.length!=2)throw"Tooltip: bad events configuration for "+q;d.bind(r[0],function(a){clearTimeout(i),e.predelay?j=setTimeout(function(){f.show(a)},e.predelay):f.show(a)}).bind(r[1],function(a){clearTimeout(j),e.delay?i=setTimeout(function(){f.hide(a)},e.delay):f.hide(a)}),k&&e.cancelDefault&&(d.removeAttr("title"),d.data("title",k)),a.extend(f,{show:function(b){if(!h){l?h=a(l):e.tip?h=a(e.tip).eq(0):k?h=a(e.layout).addClass(e.tipClass).appendTo(document.body).hide().append(k):(h=d.next(),h.length||(h=d.parent().next()));if(!h.length)throw"Cannot find tooltip for "+d}if(f.isShown())return f;h.stop(!0,!0);var o=c(d,h,e);e.tip&&h.html(d.data("title")),b=a.Event(),b.type="onBeforeShow",g.trigger(b,[o]);if(b.isDefaultPrevented())return f;o=c(d,h,e),h.css({position:"absolute",top:o.top,left:o.left}),n=!0,m[0].call(f,function(){b.type="onShow",n="full",g.trigger(b)});var p=e.events.tooltip.split(/,\s*/);h.data("__set")||(h.unbind(p[0]).bind(p[0],function(){clearTimeout(i),clearTimeout(j)}),p[1]&&!d.is("input:not(:checkbox, :radio), textarea")&&h.unbind(p[1]).bind(p[1],function(a){a.relatedTarget!=d[0]&&d.trigger(r[1].split(" ")[0])}),e.tip||h.data("__set",!0));return f},hide:function(c){if(!h||!f.isShown())return f;c=a.Event(),c.type="onBeforeHide",g.trigger(c);if(!c.isDefaultPrevented()){n=!1,b[e.effect][1].call(f,function(){c.type="onHide",g.trigger(c)});return f}},isShown:function(a){return a?n=="full":n},getConf:function(){return e},getTip:function(){return h},getTrigger:function(){return d}}),a.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(b,c){a.isFunction(e[c])&&a(f).bind(c,e[c]),f[c]=function(b){b&&a(f).bind(c,b);return f}})}a.fn.tooltip=function(b){var c=this.data("tooltip");if(c)return c;b=a.extend(!0,{},a.tools.tooltip.conf,b),typeof b.position=="string"&&(b.position=b.position.split(/,?\s/)),this.each(function(){c=new d(a(this),b),a(this).data("tooltip",c)});return b.api?c:this}})(jQuery);
(function(a){var b=a.tools.tooltip;b.dynamic={conf:{classNames:"top right bottom left"}};function c(b){var c=a(window),d=c.width()+c.scrollLeft(),e=c.height()+c.scrollTop();return[b.offset().top<=c.scrollTop(),d<=b.offset().left+b.width(),e<=b.offset().top+b.height(),c.scrollLeft()>=b.offset().left]}function d(a){var b=a.length;while(b--)if(a[b])return!1;return!0}a.fn.dynamic=function(e){typeof e=="number"&&(e={speed:e}),e=a.extend({},b.dynamic.conf,e);var f=a.extend(!0,{},e),g=e.classNames.split(/\s/),h;this.each(function(){var b=a(this).tooltip().onBeforeShow(function(b,e){var i=this.getTip(),j=this.getConf();h||(h=[j.position[0],j.position[1],j.offset[0],j.offset[1],a.extend({},j)]),a.extend(j,h[4]),j.position=[h[0],h[1]],j.offset=[h[2],h[3]],i.css({visibility:"hidden",position:"absolute",top:e.top,left:e.left}).show();var k=a.extend(!0,{},f),l=c(i);if(!d(l)){l[2]&&(a.extend(j,k.top),j.position[0]="top",i.addClass(g[0])),l[3]&&(a.extend(j,k.right),j.position[1]="right",i.addClass(g[1])),l[0]&&(a.extend(j,k.bottom),j.position[0]="bottom",i.addClass(g[2])),l[1]&&(a.extend(j,k.left),j.position[1]="left",i.addClass(g[3]));if(l[0]||l[2])j.offset[0]*=-1;if(l[1]||l[3])j.offset[1]*=-1}i.css({visibility:"visible"}).hide()});b.onBeforeShow(function(){var a=this.getConf(),b=this.getTip();setTimeout(function(){a.position=[h[0],h[1]],a.offset=[h[2],h[3]]},0)}),b.onHide(function(){var a=this.getTip();a.removeClass(e.classNames)}),ret=b});return e.api?ret:this}})(jQuery);
(function(a){var b=a.tools.tooltip;a.extend(b.conf,{direction:"up",bounce:!1,slideOffset:10,slideInSpeed:200,slideOutSpeed:200,slideFade:!a.browser.msie});var c={up:["-","top"],down:["+","top"],left:["-","left"],right:["+","left"]};b.addEffect("slide",function(a){var b=this.getConf(),d=this.getTip(),e=b.slideFade?{opacity:b.opacity}:{},f=c[b.direction]||c.up;e[f[1]]=f[0]+"="+b.slideOffset,b.slideFade&&d.css({opacity:0}),d.show().animate(e,b.slideInSpeed,a)},function(b){var d=this.getConf(),e=d.slideOffset,f=d.slideFade?{opacity:0}:{},g=c[d.direction]||c.up,h=""+g[0];d.bounce&&(h=h=="+"?"-":"+"),f[g[1]]=h+"="+e,this.getTip().animate(f,d.slideOutSpeed,function(){a(this).hide(),b.call()})})})(jQuery);
;// JavaScript Document
jQuery.noConflict();;/*
 * touchSwipe - jQuery Plugin
 * http://plugins.jquery.com/project/touchSwipe
 * http://labs.skinkers.com/touchSwipe/
 *
 * Copyright (c) 2010 Matt Bryson (www.skinkers.com)
 * Licensed under the GNU GPL license
 *
 * $version: 1.2.2
 *
 * Changelog
 * $Date: 2010-12-12 (Wed, 12 Dec 2010) $
 * $version: 1.0.0 
 * $version: 1.0.1 - removed multibyte comments
 *
 * $Date: 2011-21-02 (Mon, 21 Feb 2011) $
 * $version: 1.1.0 	- added allowPageScroll property to allow swiping and scrolling of page
 *					- changed handler signatures so one handler can be used for multiple events
 * $Date: 2011-23-02 (Wed, 23 Feb 2011) $
 * $version: 1.2.0 	- added click handler. This is fired if the user simply clicks and does not swipe. The event object and click target are passed to handler.
 *					- If you use the http://code.google.com/p/jquery-ui-for-ipad-and-iphone/ plugin, you can also assign jQuery mouse events to children of a touchSwipe object.
 * $version: 1.2.1 	- removed console log!
 *
 * $version: 1.2.2 	- Fixed bug where scope was not preserved in callback methods. 
 *
 * A jQuery plugin to capture left, right, up and down swipes on touch devices.
 * You can capture 2 finger or 1 finger swipes, set the threshold and define either a catch all handler, or individual direction handlers.
 * Options:
 * 		swipe 		Function 	A catch all handler that is triggered for all swipe directions. Handler is passed 3 arguments, the original event object, the direction of the swipe : "left", "right", "up", "down" and the distance of the swipe.
 * 		swipeLeft	Function 	A handler that is triggered for "left" swipes. Handler is passed 3 arguments, the original event object, the direction of the swipe : "left", "right", "up", "down" and the distance of the swipe.
 * 		swipeRight	Function 	A handler that is triggered for "right" swipes. Handler is passed 3 arguments, the original event object, the direction of the swipe : "left", "right", "up", "down" and the distance of the swipe.
 * 		swipeUp		Function 	A handler that is triggered for "up" swipes. Handler is passed 3 arguments, the original event object, the direction of the swipe : "left", "right", "up", "down" and the distance of the swipe.
 * 		swipeDown	Function 	A handler that is triggered for "down" swipes. Handler is passed 3 arguments, the original event object, the direction of the swipe : "left", "right", "up", "down" and the distance of the swipe.
 *		swipeStatus Function 	A handler triggered for every phase of the swipe. Handler is passed 4 arguments: event : The original event object, phase:The current swipe face, either "start�, "move�, "end� or "cancel�. direction : The swipe direction, either "up�, "down�, "left " or "right�.distance : The distance of the swipe.
 *		click		Function	A handler triggered when a user just clicks on the item, rather than swipes it. If they do not move, click is triggered, if they do move, it is not.
 *
 * 		fingers 	int 		Default 1. 	The number of fingers to trigger the swipe, 1 or 2.
 * 		threshold 	int  		Default 75.	The number of pixels that the user must move their finger by before it is considered a swipe.
 *		triggerOnTouchEnd Boolean Default true If true, the swipe events are triggered when the touch end event is received (user releases finger).  If false, it will be triggered on reaching the threshold, and then cancel the touch event automatically.
 *		allowPageScroll String Default "auto". How the browser handles page scrolls when the user is swiping on a touchSwipe object. 
 *										"auto" : all undefined swipes will cause the page to scroll in that direction.
 *										"none" : the page will not scroll when user swipes.
 *										"horizontal" : will force page to scroll on horizontal swipes.
 *										"vertical" : will force page to scroll on vertical swipes.
 *
 * This jQuery plugin will only run on devices running Mobile Webkit based browsers (iOS 2.0+, android 2.2+)
 */
(function($) 
{
	$.fn.swipe = function(options) 
	{
		if (!this) return false;
		
		// Default thresholds & swipe functions
		var defaults = {
					
			fingers 		: 1,								// int - The number of fingers to trigger the swipe, 1 or 2. Default is 1.
			threshold 		: 75,								// int - The number of pixels that the user must move their finger by before it is considered a swipe. Default is 75.
			
			swipe 			: null,		// Function - A catch all handler that is triggered for all swipe directions. Accepts 2 arguments, the original event object and the direction of the swipe : "left", "right", "up", "down".
			swipeLeft		: null,		// Function - A handler that is triggered for "left" swipes. Accepts 3 arguments, the original event object, the direction of the swipe : "left", "right", "up", "down" and the distance of the swipe.
			swipeRight		: null,		// Function - A handler that is triggered for "right" swipes. Accepts 3 arguments, the original event object, the direction of the swipe : "left", "right", "up", "down" and the distance of the swipe.
			swipeUp			: null,		// Function - A handler that is triggered for "up" swipes. Accepts 3 arguments, the original event object, the direction of the swipe : "left", "right", "up", "down" and the distance of the swipe.
			swipeDown		: null,		// Function - A handler that is triggered for "down" swipes. Accepts 3 arguments, the original event object, the direction of the swipe : "left", "right", "up", "down" and the distance of the swipe.
			swipeStatus		: null,		// Function - A handler triggered for every phase of the swipe. Handler is passed 4 arguments: event : The original event object, phase:The current swipe face, either "start�, "move�, "end� or "cancel�. direction : The swipe direction, either "up�, "down�, "left " or "right�.distance : The distance of the swipe.
			click			: null,		// Function	- A handler triggered when a user just clicks on the item, rather than swipes it. If they do not move, click is triggered, if they do move, it is not.
			
			triggerOnTouchEnd : true,	// Boolean, if true, the swipe events are triggered when the touch end event is received (user releases finger).  If false, it will be triggered on reaching the threshold, and then cancel the touch event automatically.
			allowPageScroll : "auto" 	/* How the browser handles page scrolls when the user is swiping on a touchSwipe object. 
											"auto" : all undefined swipes will cause the page to scroll in that direction.
 											"none" : the page will not scroll when user swipes.
 											"horizontal" : will force page to scroll on horizontal swipes.
 											"vertical" : will force page to scroll on vertical swipes.
										*/
		};
		
		
		//Constants
		var LEFT = "left";
		var RIGHT = "right";
		var UP = "up";
		var DOWN = "down";
		var NONE = "none";
		var HORIZONTAL = "horizontal";
		var VERTICAL = "vertical";
		var AUTO = "auto";
		
		var PHASE_START="start";
		var PHASE_MOVE="move";
		var PHASE_END="end";
		var PHASE_CANCEL="cancel";
		
		
		
		var phase="start";
		
		if (options.allowPageScroll==undefined && (options.swipe!=undefined || options.swipeStatus!=undefined))
			options.allowPageScroll=NONE;
		
		if (options)
			$.extend(defaults, options);
		
		
		/**
		 * Setup each object to detect swipe gestures
		 */
		return this.each(function() 
		{
			var $this = $(this);
			
			var triggerElementID = null; 	// this variable is used to identity the triggering element
			var fingerCount = 0;			// the current number of fingers being used.	
			
			//track mouse points / delta
			var start={x:0, y:0};
			var end={x:0, y:0};
			var delta={x:0, y:0};
			
			
			/**
			* Event handler for a touch start event. 
			* Stops the default click event from triggering and stores where we touched
			*/
			function touchStart(event) 
			{
				phase = PHASE_START;
		
				// get the total number of fingers touching the screen
				fingerCount = event.touches.length;
				
				//clear vars..
				distance=0;
				direction=null;
				
				// check the number of fingers is what we are looking for
				if ( fingerCount == defaults.fingers ) 
				{
					// get the coordinates of the touch
					start.x = end.x = event.touches[0].pageX;
					start.y = end.y = event.touches[0].pageY;
					
					if (defaults.swipeStatus)
						triggerHandler(event, phase);
				} 
				else 
				{
					//touch with more/less than the fingers we are looking for
					touchCancel(event);
				}
			}

			/**
			* Event handler for a touch move event. 
			* If we change fingers during move, then cancel the event
			*/
			function touchMove(event) 
			{
				if (phase == PHASE_END || phase == PHASE_CANCEL)
					return;
				
				end.x = event.touches[0].pageX;
				end.y = event.touches[0].pageY;
					
				direction = caluculateDirection();
				fingerCount = event.touches.length;
				
				phase = PHASE_MOVE
				
				//Check if we need to prevent default evnet (page scroll) or not
				validateDefaultEvent(event, direction);
		
				if ( fingerCount == defaults.fingers ) 
				{
					distance = caluculateDistance();
					
					if (defaults.swipeStatus)
						triggerHandler(event, phase, direction, distance);
					
					//If we trigger whilst dragging, not on touch end, then calculate now...
					if (!defaults.triggerOnTouchEnd)
					{
						// if the user swiped more than the minimum length, perform the appropriate action
						if ( distance >= defaults.threshold ) 
						{
							phase = PHASE_END;
							triggerHandler(event, phase);
							touchCancel(event); // reset the variables
						}
					}
				} 
				else 
				{
					phase = PHASE_CANCEL;
					triggerHandler(event, phase); 
					touchCancel(event);
				}
			}
			
			/**
			* Event handler for a touch end event. 
			* Calculate the direction and trigger events
			*/
			function touchEnd(event) 
			{
				event.preventDefault();
				
				distance = caluculateDistance();
				direction = caluculateDirection();
						
				if (defaults.triggerOnTouchEnd)
				{
					phase = PHASE_END;
					// check to see if more than one finger was used and that there is an ending coordinate
					if ( fingerCount == defaults.fingers && end.x != 0 ) 
					{
						// if the user swiped more than the minimum length, perform the appropriate action
						if ( distance >= defaults.threshold ) 
						{
							triggerHandler(event, phase);
							touchCancel(event); // reset the variables
						} 
						else 
						{
							phase = PHASE_CANCEL;
							triggerHandler(event, phase); 
							touchCancel(event);
						}	
					} 
					else 
					{
						phase = PHASE_CANCEL;
						triggerHandler(event, phase); 
						touchCancel(event);
					}
				}
				else if (phase == PHASE_MOVE)
				{
					phase = PHASE_CANCEL;
					triggerHandler(event, phase); 
					touchCancel(event);
				}
			}
			
			/**
			* Event handler for a touch cancel event. 
			* Clears current vars
			*/
			function touchCancel(event) 
			{
				// reset the variables back to default values
				fingerCount = 0;
				
				start.x = 0;
				start.y = 0;
				end.x = 0;
				end.y = 0;
				delta.x = 0;
				delta.y = 0;
			}
			
			
			/**
			* Trigger the relevant event handler
			* The handlers are passed the original event, the element that was swiped, and in the case of the catch all handler, the direction that was swiped, "left", "right", "up", or "down"
			*/
			function triggerHandler(event, phase) 
			{
				//update status
				if (defaults.swipeStatus)
					defaults.swipeStatus.call($this,event, phase, direction || null, distance || 0);
				
				
				if (phase == PHASE_CANCEL)
				{
					if (defaults.click && fingerCount==1 && (isNaN(distance) || distance==0))
						defaults.click.call($this,event, event.target);
				}
				
				if (phase == PHASE_END)
				{
					//trigger catch all event handler
					if (defaults.swipe)
				{
						
						defaults.swipe.call($this,event, direction, distance);
						
				}
					//trigger direction specific event handlers	
					switch(direction)
					{
						case LEFT :
							if (defaults.swipeLeft)
								defaults.swipeLeft.call($this,event, direction, distance);
							break;
						
						case RIGHT :
							if (defaults.swipeRight)
								defaults.swipeRight.call($this,event, direction, distance);
							break;

						case UP :
							if (defaults.swipeUp)
								defaults.swipeUp.call($this,event, direction, distance);
							break;
						
						case DOWN :	
							if (defaults.swipeDown)
								defaults.swipeDown.call($this,event, direction, distance);
							break;
					}
				}
			}
			
			
			/**
			 * Checks direction of the swipe and the value allowPageScroll to see if we should allow or prevent the default behaviour from occurring.
			 * This will essentially allow page scrolling or not when the user is swiping on a touchSwipe object.
			 */
			function validateDefaultEvent(event, direction)
			{
				if( defaults.allowPageScroll==NONE )
				{
					event.preventDefault();
				}
				else 
				{
					var auto=defaults.allowPageScroll==AUTO;
					
					switch(direction)
					{
						case LEFT :
							if ( (defaults.swipeLeft && auto) || (!auto && defaults.allowPageScroll!=HORIZONTAL))
								event.preventDefault();
							break;
						
						case RIGHT :
							if ( (defaults.swipeRight && auto) || (!auto && defaults.allowPageScroll!=HORIZONTAL))
								event.preventDefault();
							break;

						case UP :
							if ( (defaults.swipeUp && auto) || (!auto && defaults.allowPageScroll!=VERTICAL))
								event.preventDefault();
							break;
						
						case DOWN :	
							if ( (defaults.swipeDown && auto) || (!auto && defaults.allowPageScroll!=VERTICAL))
								event.preventDefault();
							break;
					}
				}
				
			}
			
			
			
			/**
			* Calcualte the length / distance of the swipe
			*/
			function caluculateDistance()
			{
				return Math.round(Math.sqrt(Math.pow(end.x - start.x,2) + Math.pow(end.y - start.y,2)));
			}
			
			/**
			* Calcualte the angle of the swipe
			*/
			function caluculateAngle() 
			{
				var X = start.x-end.x;
				var Y = end.y-start.y;
				var r = Math.atan2(Y,X); //radians
				var angle = Math.round(r*180/Math.PI); //degrees
				
				//ensure value is positive
				if (angle < 0) 
					angle = 360 - Math.abs(angle);
					
				return angle;
			}
			
			/**
			* Calcualte the direction of the swipe
			* This will also call caluculateAngle to get the latest angle of swipe
			*/
			function caluculateDirection() 
			{
				var angle = caluculateAngle();
				
				if ( (angle <= 45) && (angle >= 0) ) 
					return LEFT;
				
				else if ( (angle <= 360) && (angle >= 315) )
					return LEFT;
				
				else if ( (angle >= 135) && (angle <= 225) )
					return RIGHT;
				
				else if ( (angle > 45) && (angle < 135) )
					return DOWN;
				
				else
					return UP;
			}
			
			

			
			
			
			
			// Add gestures to all swipable areas
			try {
				this.addEventListener("touchstart", touchStart, false);
				this.addEventListener("touchmove", touchMove, false);
				this.addEventListener("touchend", touchEnd, false);
				this.addEventListener("touchcancel", touchCancel, false);
			}
			catch(e) {}
		});
	};
	
	
	
	
})(jQuery);;/* 
 * v0.x
 * Author: Martin Veith
*/
(function($) {
	$.fn.XQSlide = function(options) {
		// init XQ 
		$.XQ = $.XQ || {};
		
		$.XQ.Slide = $.XQ.Slide || {};
		
		// default settings
		var settings = {
			// FINAL (unordered)
			autoplay : true,
			carousel : true,
			interval : 3000,
			clickable : true,
			startIndex: 1,
			onPlay : null,
			onPause : null,
			onStop : null,
			onPrevious : null,
			onNext : null,
			onRotate : null,
			ContainerSelector : ".xqslide-container",
			NavigationSelector : ".xqslide-navigation",
			ToolbarSelector : ".xqslide-toolbar",
			ItemSelector : ".xqslide-item",
			pauseOnHover : false,
			transition : "default",
			KeyboardNavigation : true,
			preloading : 0
		};

		$.XQ.IsUndefined = function(type)
		{
			return typeof type == "undefined";	
		}
		
		$.XQ.IsFunction = function(type)
		{
			return typeof type == "function";	
		}

		$.XQ.Slide.Transitions = {
			transitions : {
				"default" : function(transition) {
					this.getCurrentPane().hide();       
					this.getActivePane().show();
					this.finish();	
				},			
				
				"fade" : function(transition) {
					var toptions = $.extend({fadeInSpeed : 444, fadeOutSpeed : 444}, transition),
						t = this;
					
					//fade out 
					this.getCurrentPane().show().fadeOut(Math.min(toptions.fadeInSpeed, toptions.fadeOutSpeed));  
					
					//fade in
					this.getActivePane().stop(true, true).fadeIn(toptions.fadeInSpeed, function() { t.finish(); });
				},
				
				"slide" : function(transition) {
					var toptions = $.extend({Speed : 1000, Direction : "horizontal", easing : "linear"}, transition),
						t = this,
					
						xclass = "xqslider",
						$panes = this.getPanes(),
						$container = this.getContainer(),
						$slider = $container.find(".xqslider:eq(0)"),
						
						Index = this.getIndex(),
						CurrentIndex = this.getCurrentIndex(),
						
						horizontal = (toptions.Direction == "horizontal" || (toptions.Direction == "random" & Math.round(Math.random()))) || (toptions.Direction != "vertical" & toptions.Direction != "random"),
						container_size = horizontal ? $container.innerWidth() : $container.innerHeight(),
						full_size = container_size * $panes.length,
						to_slide = container_size * Index * -1,
						margin = CurrentIndex * container_size * -1,
						cross = false,
						cross_size = full_size * -1,
						
						webkit = $.browser.webkit && (navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/Android/i)), // & window.location.href.indexOf("jstest") > -1;
						webkit_plugin = false, //window.location.href.indexOf("noplugin") > -1;
						webkit_cache = true; //window.location.href.indexOf("cache") > -1;

					$panes.css({position: "relative", "float" : "left"}).show();
					if(!$panes.parent("." + xclass).length)
					{
						$panes.wrapAll('<div class="' + xclass + '"></div>');
						$slider = $container.find("." + xclass + ":eq(0)").css("position", "relative");
						
						$panes.css({height: $container.innerHeight()});
					}
									
					var action = t.log[t.log.length - 1]; 
								
					to_slide_cross = to_slide;			
					if(settings.carousel & action != "show")
					{
						if(Index == $panes.length - 1 & CurrentIndex == 0)
						{
							to_slide = container_size;
							if(action == "next") { cross_size = 0; to_slide = container_size * ($panes.length - 1) * -1; }
							//if (webkit && !webkit_plugin) to_slide = container_size * ($panes.length - 1) * -1;
							cross = true;
							
							to_slide_cross = 0;
						}
						else if(Index == 0 & CurrentIndex == $panes.length - 1)
						{	
							margin = container_size; 	
							to_slide_cross = container_size;
							if(action == "previous") { cross_size = 0; margin = container_size * -1; if($panes.length <= 2) to_slide_cross = container_size * -1; }
							
							cross = true;
						}	
					}
					
					var $pane = t.getCurrentPane(),
						$cache_pane = $pane.next();
					
					if(action == "next")
					{
						if(cross & $panes.length > 2) {
							$cache_pane = $panes.first();
						}
						else
							$cache_pane = $pane.next();
					}
					
					if(action == "previous")
					{
						if(cross)
							$cache_pane = $panes.last();
						else
							$cache_pane = $pane.prev();
					}
					
					if(action == "show")
					{
						$cache_pane = $panes.eq(Index);	
					}

					if(webkit && webkit_cache && (navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/Android/i)))
					{ 
						if($panes.length > 2)
							$panes.not($pane).not($cache_pane).find("img").css({"-webkit-transform-style" : "", "-webkit-transform": ""});

						$cache_pane.find("img").css({"-webkit-transform-style" : "preserve-3d", "-webkit-transform": "translate3d(0, 0, 0)"});
						$pane.find("img").css({"-webkit-transform-style" : "preserve-3d", "-webkit-transform": "translate3d(0, 0, 0)"});
					}
					
					t.log = [];
			
					if(horizontal)
					{
						if(webkit && !webkit_plugin)
							$slider.stop(true, true).css({width : full_size, "-webkit-transform" : "translate(" + margin + "px, 0)", "-webkit-transition-duration" : "0s"});
						
						if(webkit)
							$slider.stop(true, true).css({width : full_size});
						else
							$slider.stop(true, true).css({width : full_size, left : margin});
				
						if(cross)
						{ 
							$panes.last().stop(true, true).css({left : cross_size});
						
							if(webkit)
							{
								to_slide_i = {"-webkit-transform" : "translate(" + to_slide_cross + "px, 0)", "-webkit-transition-duration" : "0s"};	

								$slider.css(to_slide_i);
					
								if($panes.length > 2)
								{
									if(to_slide_cross == 0)
										to_slide = container_size;	
									else
										to_slide = 0;
								}
							}
						}
						
						if(webkit)
						{
							to_slide_new = to_slide;
							to_slide = {webkitTransform : "translate(" + to_slide + ",0)"};
						}
						else
							to_slide = {left : to_slide};
					}
					else
					{
						$slider.stop(true, true).css({width : container_size, height : full_size, marginTop : margin});
						if(cross)
							$panes.last().stop(true, true).css({top : cross_size});
						to_slide = {marginTop : to_slide};
					}
					
					if(webkit && !webkit_plugin)
					{ 
						var time = new Date().getTime();
						
						//$panes.css({"-webkit-transform-style" : "preserve-3d", "-webkit-transform": "translate3d(0, 0, 0)"});

						to_slide = {"-webkit-transform-style" : "preserve-3d", "-webkit-transform" : "translate(" + to_slide_new + "px, 0)", "-webkit-transition-delay" : "now", "-webkit-transition-duration" : (toptions.Speed / 1000) + "s"};
				
						$slider.animate({opacity : 1}, 100, function() { 
							$slider.css(to_slide).animate({opacity : 1}, toptions.Speed, function() {	
								$panes.last().css({left : 0});
								$slider.css({"-webkit-transform" : "translate(" + container_size * Index * -1 + "px, 0)", "-webkit-transition-duration" : "0s"});	
								
								t.finish();			
							});
						});
					}
					else	
					{
						$slider.stop(true, true).animate(to_slide, toptions.Speed, toptions.easing, function() {  
							/*if(horizontal)
								$slider.css({width: container_size, left : 0});
							else
								$slider.css({height: container_size, top : 0});*/
							
							if(webkit && webkit_cache > -1)
							{
								$panes.find("img").css({"-webkit-transform-style" : "", "-webkit-transform": ""});
							}
							
							//reset panes
							if(!webkit)
								t.setPaneStyles(Index);	
								
							$slider.css("left", 0);
							
							t.finish();
						});
					}
				}
			},
			
			addTransition : function(name, fn)
			{
				$.XQ.Slide.Transitions.transitions[name] = fn;
			},
			
			doTransition : function(obj, transitions)
			{
				var transition = $.XQ.Slide.Transitions.validateTransition(obj, transitions, obj.getIndex());			
				$.XQ.Slide.Transitions.transitions[transition.name].call(obj, transition);


			},
			
			validateTransition : function(obj, transitions, index)
			{
				var transition = transitions;
				
				if(typeof transition == "object")
				{

					if(transitions[index] != undefined)
						transition = transitions[index];
				}

				if(transition.name == undefined)
					if(typeof transition == "string")
						transition = {
							name : transition
						};
					else
						transition.name = "default";

				if(transition.name == "random")
				{
					var transitions_length = 0;
					for(var random_transition in $.XQ.Slide.Transitions.transitions)
					{
						transitions_length++;	
					}
					
					var random_transition_index = Math.floor(Math.random() * transitions_length),
						i = 0;
					
					for(random_transition in $.XQ.Slide.Transitions.transitions)
					{
						if(i == random_transition_index)
						{
							transition = {
								name : random_transition
							};
							break;
						}
						i++;
					} 			
				}

				if($.XQ.Slide.Transitions.transitions[transition.name] == undefined)
					transition.name = "default";
					
				return transition;
			}
		};
		
		var SlideShow = function($slideshow, options)
		{
			var $slideshow = $slideshow, 
				$panes, $container, $navigation = [],
		   
				Timeout = "",
			
				Index, CurrentIndex = 0,
		   
		   		images = [],
				randoms = [],

				init = false,
				obj = this,
				
				States = {
					Started : false,
					Stopped : false,
					RotationStopped : false,
					Paused : false,
					Rotation : false
				};
				
			this.log = [];
		
			$.extend(this, {
				getSlideShow : function()
				{
					return $slideshow;
				},
				
				getContainer : function()
				{
					return $container;
				},
				
				getIndex : function()
				{
					return Index;
				},
			   
				getCurrentIndex : function()
				{
					return CurrentIndex;
				},
				
				getStates : function()
				{
					return States;
				},
				
				getTabs : function(index)
				{   
					if(typeof index == "number")
						return $("a", $navigation).not(".next, .previous").eq(index);
						
					return $("a", $navigation).not(".next, .previous");
				},
			   
				getActiveTab : function()
				{   
					return this.getTabs(Index);
				},
		
				getCurrentTab : function()
				{   
					return this.getTabs(CurrentIndex);
				},
				
				getInactiveTabs : function()
				{
					return this.getTabs().not(this.getActiveTab());
				},
			   
				getPanes : function()
				{
					return $panes;
				},
			   
				getActivePane : function()
				{
					return $panes.eq(Index);
				},
		
				getCurrentPane : function()
				{
					return $panes.eq(CurrentIndex);
				},
				
				getInactivePanes : function()
				{
					return $panes.not(this.getActivePane());
				},
				
				setSettings : function(options)
				{
					var startIndex = settings.startIndex;
					$.extend(settings, options || {});	
					
					$slideshow.add(obj);
					$panes = $(settings.ItemSelector, $slideshow); 
					$container = $panes.parents(settings.ContainerSelector); 
					$navigation = $(settings.NavigationSelector, $slideshow);
					$toolbar = $(settings.ToolbarSelector, $slideshow);
					
					if(typeof options.startIndex != undefined)
						settings.startIndex = getRotationIndex(settings.startIndex - 1);
					else
						settings.startIndex = startIndex;
		
					//clickable
					if(settings.clickable)
					{
						$panes.click(function() {
							obj.next(true);	
							return false;
						});
					}
					
					setStates({Started : settings.autoplay, Paused : !settings.autoplay, Stopped : !settings.autoplay});
				
					//pause slideshow on hover
					if(settings.pauseOnHover)
					{
						$container.hover(this.pause, function() { if(!States.Rotation & !States.Stopped & !States.RotationStopped) { obj.play(); } });
					}
				},
				
				getSettings : function()
				{
					return settings;
				},
				
				getInterval : function() 
				{
					if(typeof settings.interval != "number")
						return settings.interval[Index];
					
					return settings.interval;
				},
		   
				play : function()
				{	 
					window.clearTimeout(Timeout);
					setStates({Started : false, RotationStopped : false, Stopped : false, Paused : false});
					if($.isFunction(settings.onPlay)) settings.onPlay.call(this);
					rotate();
				},
			
				stop : function()
				{
					window.clearTimeout(Timeout);
					if(States.Stopped)
						return;
						
					setStates({Stopped : true, RotationStopped : false, Paused : false});
					
					if($.isFunction(settings.onStop)) settings.onStop.call(this);
					randoms = []; 
					rotate({index : settings.startIndex, random : false});
					setStates({Started : false});
				},
			   
				pause : function()
				{
					setStates({Paused : true});
					if($.isFunction(settings.onPause)) settings.onPause.call(this);
					window.clearTimeout(Timeout);
				},
			   
				show : function(index, stop)
				{
					if(index == Index | States.Rotation) 
						return; 
					window.clearTimeout(Timeout);
					setStates({Started : true, RotationStopped : stop, Stopped : false, Paused : false}); 
					obj.log.push("show");
					if($.isFunction(settings.onShow)) settings.onShow.call(this); 
					rotate({index : index, random : false});   
				},
			   
				previous : function(stop)
				{
					if(States.Rotation) return; 
					setStates({Started : true, RotationStopped : stop, Stopped : false, Paused : false});
					obj.log.push("previous");
					if($.isFunction(settings.onPrevious)) settings.onPrevious.call(this);
					rotate({index : Index - 1});
				},  
			   
				next : function(stop)
				{ 
					if(States.Rotation) return;  
					setStates({Started : true, RotationStopped : stop, Stopped : false, Paused : false});
					obj.log.push("next");
					if($.isFunction(settings.onNext)) settings.onNext.call(this);
					rotate({index : Index + 1});
				},
			
				setPaneStyles : function(index)
				{
					var count = $panes.length,
						$pane = $panes.eq(index);
					
					//style panes
					$panes.not($pane).hide();
					
					$panes.stop(true, true).each(function(index) {
						if(!$(this).find("object").length)
							$(this).css({position : "absolute"});
						$(this).css({zIndex : count * 10 - index, top : 0, left : 0, margin : "auto"});																	  
					});
				},
				
				finish : function() { 
					setStates({Rotation : false}); 	 
					
					if(!States.Stopped & !States.Paused & !States.RotationStopped & obj.getInterval() > 0)
					{	
						Timeout = window.setTimeout(function() { 
							obj.next();	
						}, this.getInterval());
					}
					else
						$(".xqslide-progress").stop(true, true).css({width : 0});
				}
			});
							   
			var rotate = function(rotation) { 
				window.clearTimeout(Timeout);
				if(States.Paused)
					return;
				
				if(!States.Stopped)
				{
					setStates({Rotation : true});
			
					if(States.Started)
					{	
						setRotationSettings(rotation); 
						if($.isFunction(settings.onRotate)) settings.onRotate.call(obj);
						setToolbar();

						//onImagesLoaded();
						$slideshow.bind(Index + "onImagesLoaded", onImagesLoaded);		
						loadImages(Index);	

						//$.XQ.Slide.Transitions.doTransition(obj, settings.transition); 
					}
					else
					{ 
						obj.finish();
						setStates({Started : true});
					} 
				}
			};
			
			var onImagesLoaded = function() { 	
				$slideshow.unbind(Index + "onImagesLoaded", onImagesLoaded);	
				$.XQ.Slide.Transitions.doTransition(obj, settings.transition); 
			};
			
			var setIndex = function(index, random)
			{
				var final_index, random_index = 0;
		
				if(random)
				{  
					if(randoms.length == $panes.length)
					{ 
						randoms = []; 
						if(!settings.carousel)
						{
							obj.stop();
							final_index = settings.startIndex;
						}
					}
		
					while(final_index == undefined)
					{
						random_index = Math.floor(Math.random() * $panes.length);
						if(settings.carousel)
							random_index = getRotationIndex(random_index);
							
						if(random_index == Index & randoms.length + 1 < $panes.length) {
							continue;
						}
		
						for(var i = 0; i < randoms.length; i++)
						{
							if(random_index == randoms[i])
							{
								break; 
							}
						}
						
						if(random_index == randoms[i]) {
							continue;
						}
						
						final_index = random_index;
					} 
				}
				else
				{
					final_index = getRotationIndex(index);    
				}
				
				randoms.push(final_index);
		
				setCurrentIndex(Index);
					
				Index = final_index;  
				setNavigationStyles();
			};	
				
			var setCurrentIndex = function(index)
			{
				CurrentIndex = index;
			};
			
			var setStates = function(states)
			{		
				$.extend(States, states);
				setToolbar();
			};
			
			var getRotationIndex = function(index)
			{
				if(settings.carousel)
				{
					if(index > $panes.length - 1)
					{
						index = 0;
					}
					else if(index < 0) 
					{
						index = $panes.length - 1;
					}
				}
				else
				{
					if(index > $panes.length - 1)
					{
						obj.stop();
						index = settings.startIndex;
					}
					else if(index < 0) 
					{
						index = 0;
					}
				}
				
				return index;
			};
			
			var setRotationSettings = function(rotation)
			{
				var default_rotation = {
						index : Index,
						random : settings.random
					},
					i_random = false;
				
				if(typeof rotation != "undefined" && typeof rotation.random != "undefined")
				{
					i_random = rotation.random;
					rotation.random = i_random;
				}
		
				$.extend(default_rotation, rotation);
				rotation = default_rotation;
			   
				rotation.index = getRotationIndex(rotation.index);
					
				setIndex(rotation.index, rotation.random);
			 
				return rotation;
			};
			
			var setPanes = function(index)
			{
				setIndex(settings.startIndex);
				setCurrentIndex(settings.startIndex);
		
				obj.setPaneStyles(settings.startIndex);
			};
			
			var setToolbar = function(index)
			{
				$("li", $toolbar).show();
				var $pause = $(".pause", $toolbar),
					$play = $(".play", $toolbar),
					$stop = $(".stop", $toolbar);
					
				$stop.find("a").removeClass("disabled");
							
				if(States.Started & !States.RotationStopped)
				{
					$play.hide();
					$pause.show();
				}
				
				if(States.Paused | States.RotationStopped)
				{
					$pause.hide();
					$play.show();
				}
		
				if(States.Stopped)
				{
					$pause.hide();
					$play.show();
					$stop.find("a").addClass("disabled");
				}
			};
		   
			var initNavigation = function()
			{
				var $tabs = obj.getTabs().show(),
					$previous = $(".previous", $slideshow),
					$next = $(".next", $slideshow);
		
				$previous.click(function() {   
						if(!$(this).parents(".disabled").length & !$(this).hasClass("disabled"))
							obj.previous(true);
							
						return false;
					});
		
				$next.click(function() {    
						if(!$(this).parents(".disabled").length && !$(this).hasClass("disabled"))
							obj.next(true);

						return false;
					});
		
				$tabs.each(function(index) {
					$(this)
						.click(function() { 
							if(!$(this).parents(".disabled").length && !$(this).hasClass("disabled"))
								obj.show(index, true);
						
							return false;
						});
				});
		
				setNavigationStyles();
			};
			
			var initKeyboardNavigation = function() 
			{
				if(!obj.getSettings().KeyboardNavigation || $panes.length <= 1)
					return;
				
				$(document).bind("mousemove", function(e) {
					var offset = $slideshow.offset(),
						padding = 150;
		
					obj.hovered = e.pageX >= offset.left - padding & e.pageX <= offset.left + $slideshow.width() + padding
						& e.pageY >= offset.top - padding & e.pageY <= offset.top + $slideshow.height() + padding;
				});
				
				$(document).bind("keydown", function(e) { 
					if(!obj.hovered)
						return;
						
					if (e.which == 37 | e.which == 38) {
						e.preventDefault();
						obj.previous(true);
					} else if (e.which == 39 | e.which == 40) {
						e.preventDefault();
						obj.next(true);
					}
				});
			};
			
			var setNavigationStyles = function()
			{
				var $tabs = obj.getTabs().show(),
					$previous = $(".previous", $slideshow),
					$next = $(".next", $slideshow),
					index = Index,
					length = $panes.length;
				
				if(!settings.carousel & !settings.random)
				{
					if(index == 0)

					{
						$previous.addClass("disabled");
						$previous.find("a").addClass("disabled");
					}
					else
					{
						$previous.removeClass("disabled");
						$previous.find("a").removeClass("disabled");
					}
					
					if(index == length - 1)
					{
						$next.addClass("disabled");
						$next.find("a").addClass("disabled");
					}
					else
					{
						$next.removeClass("disabled");
						$next.find("a").removeClass("disabled");
					}
				}
			};
			
			var checkImagesToLoad = function(index) {
				var $loader = $slideshow.find(".loader");
				
				images[index].$images.each(function() {
					var $img = $(this),
						img = new Image();
						
					img.src = $img.attr("data-src");
					
					if(img.complete || ($.browser.msie & $.browser.version.indexOf("6.") > -1 & img.height > 0))
					{
						images[index].to_load--;
						
						$img.attr("src", img.src); 
						$img.removeClass("loading").addClass("loaded");

						images[index].$images = images[index].$images.not($img);
						
						if(images[index].to_load == 0)
						{  	
							clearInterval(images[index].interval);	
					
							if(Index == index)
							{
								$loader.fadeOut(250);
								$slideshow.trigger(index + "onImagesLoaded");
							}
						}
					}
				});
				
				return images[index];
			};
			
			var loadImages = function(index) { 			
				if(!settings.preloading)
				{
					$slideshow.trigger(index + "onImagesLoaded");
					return;	
				}
				
				if(!init)
				{
					//$container.after('<div class="loader"></div>');
				}
	
				var $loader = $slideshow.find(".loader").hide();

				/*if(!$.XQ.IsUndefined(images[index]))
				{
					if(Index == index)
						$slideshow.trigger(index + "onImagesLoaded");	
					
					return images[index];
				}*/
				
				var $panes = obj.getPanes(),
					indexes = [index, getRotationIndex(index + 1), getRotationIndex(index - 1)];
				
				for(var i = 0; i < indexes.length; i++) {
					(function(i){
						var $pane = $panes.eq(indexes[i]),
							$images = $pane.filter("img").add($pane.find("img"));
	
						if($.XQ.IsUndefined(images[indexes[i]])) { 
							images[indexes[i]] = {
								$images : $images,
								loading : false,
								to_load : $images.length,
								interval : ""
							}; 
						}
			
						if(images[indexes[i]].to_load)
						{
							$slideshow.stop(true, true);
							checkImagesToLoad(indexes[i]);									
						
							if(images[indexes[i]].to_load)
							{
								if(Index == indexes[i])
									$loader.show();
									
								images[indexes[i]].loading = true;

								images[indexes[i]].interval = setInterval(function() {   
									checkImagesToLoad(indexes[i]); 
								}, 1);
							}
						}
						else if(Index == indexes[i]) {   
							$slideshow.trigger(indexes[i] + "onImagesLoaded");		
						}
					})(i);
				}
									 
				return images[index];
			};
			
			var onScrollVisibleArea = function() {
				if((obj.slideshow_height + $slideshow.offset().top) < $(document).scrollTop())
				{
					if(!States.Paused)
						obj.pause();	
				}
				else if(!States.Stopped & States.Paused & !States.Rotation & !States.RotationStopped)
					obj.play();
			};
			
			(function() {
				obj.setSettings(options);
		   
				setPanes();
				setToolbar();
				if($.browser.webkit && (navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/Android/i)))
					$panes.each(function() { $(this)[0].style.webkitTransform = "translate3d(0, 0, 0)"; });
				
				obj.slideshow_height = $slideshow.height();
			
				initKeyboardNavigation();
				initNavigation();
				
				if(true)
				{
					$slideshow.bind(settings.startIndex + "onImagesLoaded", function() { 
						$slideshow.unbind(settings.startIndex + "onImagesLoaded");
						if($.isFunction(settings.onInit)) settings.onInit.call(obj);
						
						if($panes.length > 1)
						{
							if(settings.autoplay)
								obj.play();
							else
								setStates({Started : true});
						
							onScrollVisibleArea();
							$(window).bind("scroll", onScrollVisibleArea);
						}
						
						init = true;
					});		
					loadImages(settings.startIndex);
				}
				else
				{
					if($.isFunction(settings.onInit)) settings.onInit.call(obj);
					
					if(settings.autoplay)
						obj.play();
					else
						setStates({Started : true});
				
					onScrollVisibleArea();
					$(window).bind("scroll", onScrollVisibleArea);
				}
			})();
		};
		
		return this.each(function()
       	{
        	var $this = $(this);

			if($this.data('SlideShow')) 
				return;
				
			SlideShow = new SlideShow($(this), options);
				
			$this.data('SlideShow', SlideShow);		
       });	
	};
})(jQuery);;(function($){$.fn.jTruncate=function(h){var i={length:300,minTrail:20,moreText:"more",lessText:"less",ellipsisText:"...",moreAni:"",lessAni:""};var h=$.extend(i,h);return this.each(function(){obj=$(this);var a=obj.html();if(a.length>h.length+h.minTrail){var b=a.indexOf(' ',h.length);if(b!=-1){var b=a.indexOf(' ',h.length);var c=a.substring(0,b);var d=a.substring(b,a.length-1);obj.html(c+'<span class="truncate_ellipsis">'+h.ellipsisText+'</span>'+'<span class="truncate_more">'+d+'</span>');obj.find('.truncate_more').css("display","none");obj.append('<div class="clearboth">'+'<a href="#" class="truncate_more_link">'+h.moreText+'</a>'+'</div>');var e=$('.truncate_more_link',obj);var f=$('.truncate_more',obj);var g=$('.truncate_ellipsis',obj);e.click(function(){if(e.text()==h.moreText){f.show(h.moreAni);e.text(h.lessText);g.css("display","none")}else{f.hide(h.lessAni);e.text(h.moreText);g.css("display","inline")}return false})}}})}})(jQuery);;/*!
 * jCarousel - Riding carousels with jQuery
 *   http://sorgalla.com/jcarousel/
 *
 * Copyright (c) 2006 Jan Sorgalla (http://sorgalla.com)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Built on top of the jQuery library
 *   http://jquery.com
 *
 * Inspired by the "Carousel Component" by Bill Scott
 *   http://billwscott.com/carousel/
 */

(function(g){var q={vertical:!1,rtl:!1,start:1,offset:1,size:null,scroll:3,visible:null,animation:"normal",easing:"swing",auto:0,wrap:null,initCallback:null,setupCallback:null,reloadCallback:null,itemLoadCallback:null,itemFirstInCallback:null,itemFirstOutCallback:null,itemLastInCallback:null,itemLastOutCallback:null,itemVisibleInCallback:null,itemVisibleOutCallback:null,animationStepCallback:null,buttonNextHTML:"<div></div>",buttonPrevHTML:"<div></div>",buttonNextEvent:"click",buttonPrevEvent:"click", buttonNextCallback:null,buttonPrevCallback:null,itemFallbackDimension:null},m=!1;g(window).bind("load.jcarousel",function(){m=!0});g.jcarousel=function(a,c){this.options=g.extend({},q,c||{});this.autoStopped=this.locked=!1;this.buttonPrevState=this.buttonNextState=this.buttonPrev=this.buttonNext=this.list=this.clip=this.container=null;if(!c||c.rtl===void 0)this.options.rtl=(g(a).attr("dir")||g("html").attr("dir")||"").toLowerCase()=="rtl";this.wh=!this.options.vertical?"width":"height";this.lt=!this.options.vertical? this.options.rtl?"right":"left":"top";for(var b="",d=a.className.split(" "),f=0;f<d.length;f++)if(d[f].indexOf("jcarousel-skin")!=-1){g(a).removeClass(d[f]);b=d[f];break}a.nodeName.toUpperCase()=="UL"||a.nodeName.toUpperCase()=="OL"?(this.list=g(a),this.clip=this.list.parents(".jcarousel-clip"),this.container=this.list.parents(".jcarousel-container")):(this.container=g(a),this.list=this.container.find("ul,ol").eq(0),this.clip=this.container.find(".jcarousel-clip"));if(this.clip.size()===0)this.clip= this.list.wrap("<div></div>").parent();if(this.container.size()===0)this.container=this.clip.wrap("<div></div>").parent();b!==""&&this.container.parent()[0].className.indexOf("jcarousel-skin")==-1&&this.container.wrap('<div class=" '+b+'"></div>');this.buttonPrev=g(".jcarousel-prev",this.container);if(this.buttonPrev.size()===0&&this.options.buttonPrevHTML!==null)this.buttonPrev=g(this.options.buttonPrevHTML).appendTo(this.container);this.buttonPrev.addClass(this.className("jcarousel-prev"));this.buttonNext= g(".jcarousel-next",this.container);if(this.buttonNext.size()===0&&this.options.buttonNextHTML!==null)this.buttonNext=g(this.options.buttonNextHTML).appendTo(this.container);this.buttonNext.addClass(this.className("jcarousel-next"));this.clip.addClass(this.className("jcarousel-clip")).css({position:"relative"});this.list.addClass(this.className("jcarousel-list")).css({overflow:"hidden",position:"relative",top:0,margin:0,padding:0}).css(this.options.rtl?"right":"left",0);this.container.addClass(this.className("jcarousel-container")).css({position:"relative"}); !this.options.vertical&&this.options.rtl&&this.container.addClass("jcarousel-direction-rtl").attr("dir","rtl");var j=this.options.visible!==null?Math.ceil(this.clipping()/this.options.visible):null,b=this.list.children("li"),e=this;if(b.size()>0){var h=0,i=this.options.offset;b.each(function(){e.format(this,i++);h+=e.dimension(this,j)});this.list.css(this.wh,h+100+"px");if(!c||c.size===void 0)this.options.size=b.size()}this.container.css("display","block");this.buttonNext.css("display","block");this.buttonPrev.css("display", "block");this.funcNext=function(){e.next()};this.funcPrev=function(){e.prev()};this.funcResize=function(){e.resizeTimer&&clearTimeout(e.resizeTimer);e.resizeTimer=setTimeout(function(){e.reload()},100)};this.options.initCallback!==null&&this.options.initCallback(this,"init");!m&&g.browser.safari?(this.buttons(!1,!1),g(window).bind("load.jcarousel",function(){e.setup()})):this.setup()};var f=g.jcarousel;f.fn=f.prototype={jcarousel:"0.2.8"};f.fn.extend=f.extend=g.extend;f.fn.extend({setup:function(){this.prevLast= this.prevFirst=this.last=this.first=null;this.animating=!1;this.tail=this.resizeTimer=this.timer=null;this.inTail=!1;if(!this.locked){this.list.css(this.lt,this.pos(this.options.offset)+"px");var a=this.pos(this.options.start,!0);this.prevFirst=this.prevLast=null;this.animate(a,!1);g(window).unbind("resize.jcarousel",this.funcResize).bind("resize.jcarousel",this.funcResize);this.options.setupCallback!==null&&this.options.setupCallback(this)}},reset:function(){this.list.empty();this.list.css(this.lt, "0px");this.list.css(this.wh,"10px");this.options.initCallback!==null&&this.options.initCallback(this,"reset");this.setup()},reload:function(){this.tail!==null&&this.inTail&&this.list.css(this.lt,f.intval(this.list.css(this.lt))+this.tail);this.tail=null;this.inTail=!1;this.options.reloadCallback!==null&&this.options.reloadCallback(this);if(this.options.visible!==null){var a=this,c=Math.ceil(this.clipping()/this.options.visible),b=0,d=0;this.list.children("li").each(function(f){b+=a.dimension(this, c);f+1<a.first&&(d=b)});this.list.css(this.wh,b+"px");this.list.css(this.lt,-d+"px")}this.scroll(this.first,!1)},lock:function(){this.locked=!0;this.buttons()},unlock:function(){this.locked=!1;this.buttons()},size:function(a){if(a!==void 0)this.options.size=a,this.locked||this.buttons();return this.options.size},has:function(a,c){if(c===void 0||!c)c=a;if(this.options.size!==null&&c>this.options.size)c=this.options.size;for(var b=a;b<=c;b++){var d=this.get(b);if(!d.length||d.hasClass("jcarousel-item-placeholder"))return!1}return!0}, get:function(a){return g(">.jcarousel-item-"+a,this.list)},add:function(a,c){var b=this.get(a),d=0,p=g(c);if(b.length===0)for(var j,e=f.intval(a),b=this.create(a);;){if(j=this.get(--e),e<=0||j.length){e<=0?this.list.prepend(b):j.after(b);break}}else d=this.dimension(b);p.get(0).nodeName.toUpperCase()=="LI"?(b.replaceWith(p),b=p):b.empty().append(c);this.format(b.removeClass(this.className("jcarousel-item-placeholder")),a);p=this.options.visible!==null?Math.ceil(this.clipping()/this.options.visible): null;d=this.dimension(b,p)-d;a>0&&a<this.first&&this.list.css(this.lt,f.intval(this.list.css(this.lt))-d+"px");this.list.css(this.wh,f.intval(this.list.css(this.wh))+d+"px");return b},remove:function(a){var c=this.get(a);if(c.length&&!(a>=this.first&&a<=this.last)){var b=this.dimension(c);a<this.first&&this.list.css(this.lt,f.intval(this.list.css(this.lt))+b+"px");c.remove();this.list.css(this.wh,f.intval(this.list.css(this.wh))-b+"px")}},next:function(){this.tail!==null&&!this.inTail?this.scrollTail(!1): this.scroll((this.options.wrap=="both"||this.options.wrap=="last")&&this.options.size!==null&&this.last==this.options.size?1:this.first+this.options.scroll)},prev:function(){this.tail!==null&&this.inTail?this.scrollTail(!0):this.scroll((this.options.wrap=="both"||this.options.wrap=="first")&&this.options.size!==null&&this.first==1?this.options.size:this.first-this.options.scroll)},scrollTail:function(a){if(!this.locked&&!this.animating&&this.tail){this.pauseAuto();var c=f.intval(this.list.css(this.lt)), c=!a?c-this.tail:c+this.tail;this.inTail=!a;this.prevFirst=this.first;this.prevLast=this.last;this.animate(c)}},scroll:function(a,c){!this.locked&&!this.animating&&(this.pauseAuto(),this.animate(this.pos(a),c))},pos:function(a,c){var b=f.intval(this.list.css(this.lt));if(this.locked||this.animating)return b;this.options.wrap!="circular"&&(a=a<1?1:this.options.size&&a>this.options.size?this.options.size:a);for(var d=this.first>a,g=this.options.wrap!="circular"&&this.first<=1?1:this.first,j=d?this.get(g): this.get(this.last),e=d?g:g-1,h=null,i=0,k=!1,l=0;d?--e>=a:++e<a;){h=this.get(e);k=!h.length;if(h.length===0&&(h=this.create(e).addClass(this.className("jcarousel-item-placeholder")),j[d?"before":"after"](h),this.first!==null&&this.options.wrap=="circular"&&this.options.size!==null&&(e<=0||e>this.options.size)))j=this.get(this.index(e)),j.length&&(h=this.add(e,j.clone(!0)));j=h;l=this.dimension(h);k&&(i+=l);if(this.first!==null&&(this.options.wrap=="circular"||e>=1&&(this.options.size===null||e<= this.options.size)))b=d?b+l:b-l}for(var g=this.clipping(),m=[],o=0,n=0,j=this.get(a-1),e=a;++o;){h=this.get(e);k=!h.length;if(h.length===0){h=this.create(e).addClass(this.className("jcarousel-item-placeholder"));if(j.length===0)this.list.prepend(h);else j[d?"before":"after"](h);if(this.first!==null&&this.options.wrap=="circular"&&this.options.size!==null&&(e<=0||e>this.options.size))j=this.get(this.index(e)),j.length&&(h=this.add(e,j.clone(!0)))}j=h;l=this.dimension(h);if(l===0)throw Error("jCarousel: No width/height set for items. This will cause an infinite loop. Aborting..."); this.options.wrap!="circular"&&this.options.size!==null&&e>this.options.size?m.push(h):k&&(i+=l);n+=l;if(n>=g)break;e++}for(h=0;h<m.length;h++)m[h].remove();i>0&&(this.list.css(this.wh,this.dimension(this.list)+i+"px"),d&&(b-=i,this.list.css(this.lt,f.intval(this.list.css(this.lt))-i+"px")));i=a+o-1;if(this.options.wrap!="circular"&&this.options.size&&i>this.options.size)i=this.options.size;if(e>i){o=0;e=i;for(n=0;++o;){h=this.get(e--);if(!h.length)break;n+=this.dimension(h);if(n>=g)break}}e=i-o+ 1;this.options.wrap!="circular"&&e<1&&(e=1);if(this.inTail&&d)b+=this.tail,this.inTail=!1;this.tail=null;if(this.options.wrap!="circular"&&i==this.options.size&&i-o+1>=1&&(d=f.intval(this.get(i).css(!this.options.vertical?"marginRight":"marginBottom")),n-d>g))this.tail=n-g-d;if(c&&a===this.options.size&&this.tail)b-=this.tail,this.inTail=!0;for(;a-- >e;)b+=this.dimension(this.get(a));this.prevFirst=this.first;this.prevLast=this.last;this.first=e;this.last=i;return b},animate:function(a,c){if(!this.locked&& !this.animating){this.animating=!0;var b=this,d=function(){b.animating=!1;a===0&&b.list.css(b.lt,0);!b.autoStopped&&(b.options.wrap=="circular"||b.options.wrap=="both"||b.options.wrap=="last"||b.options.size===null||b.last<b.options.size||b.last==b.options.size&&b.tail!==null&&!b.inTail)&&b.startAuto();b.buttons();b.notify("onAfterAnimation");if(b.options.wrap=="circular"&&b.options.size!==null)for(var c=b.prevFirst;c<=b.prevLast;c++)c!==null&&!(c>=b.first&&c<=b.last)&&(c<1||c>b.options.size)&&b.remove(c)}; this.notify("onBeforeAnimation");if(!this.options.animation||c===!1)this.list.css(this.lt,a+"px"),d();else{var f=!this.options.vertical?this.options.rtl?{right:a}:{left:a}:{top:a},d={duration:this.options.animation,easing:this.options.easing,complete:d};if(g.isFunction(this.options.animationStepCallback))d.step=this.options.animationStepCallback;this.list.animate(f,d)}}},startAuto:function(a){if(a!==void 0)this.options.auto=a;if(this.options.auto===0)return this.stopAuto();if(this.timer===null){this.autoStopped= !1;var c=this;this.timer=window.setTimeout(function(){c.next()},this.options.auto*1E3)}},stopAuto:function(){this.pauseAuto();this.autoStopped=!0},pauseAuto:function(){if(this.timer!==null)window.clearTimeout(this.timer),this.timer=null},buttons:function(a,c){if(a==null&&(a=!this.locked&&this.options.size!==0&&(this.options.wrap&&this.options.wrap!="first"||this.options.size===null||this.last<this.options.size),!this.locked&&(!this.options.wrap||this.options.wrap=="first")&&this.options.size!==null&& this.last>=this.options.size))a=this.tail!==null&&!this.inTail;if(c==null&&(c=!this.locked&&this.options.size!==0&&(this.options.wrap&&this.options.wrap!="last"||this.first>1),!this.locked&&(!this.options.wrap||this.options.wrap=="last")&&this.options.size!==null&&this.first==1))c=this.tail!==null&&this.inTail;var b=this;this.buttonNext.size()>0?(this.buttonNext.unbind(this.options.buttonNextEvent+".jcarousel",this.funcNext),a&&this.buttonNext.bind(this.options.buttonNextEvent+".jcarousel",this.funcNext), this.buttonNext[a?"removeClass":"addClass"](this.className("jcarousel-next-disabled")).attr("disabled",a?!1:!0),this.options.buttonNextCallback!==null&&this.buttonNext.data("jcarouselstate")!=a&&this.buttonNext.each(function(){b.options.buttonNextCallback(b,this,a)}).data("jcarouselstate",a)):this.options.buttonNextCallback!==null&&this.buttonNextState!=a&&this.options.buttonNextCallback(b,null,a);this.buttonPrev.size()>0?(this.buttonPrev.unbind(this.options.buttonPrevEvent+".jcarousel",this.funcPrev), c&&this.buttonPrev.bind(this.options.buttonPrevEvent+".jcarousel",this.funcPrev),this.buttonPrev[c?"removeClass":"addClass"](this.className("jcarousel-prev-disabled")).attr("disabled",c?!1:!0),this.options.buttonPrevCallback!==null&&this.buttonPrev.data("jcarouselstate")!=c&&this.buttonPrev.each(function(){b.options.buttonPrevCallback(b,this,c)}).data("jcarouselstate",c)):this.options.buttonPrevCallback!==null&&this.buttonPrevState!=c&&this.options.buttonPrevCallback(b,null,c);this.buttonNextState= a;this.buttonPrevState=c},notify:function(a){var c=this.prevFirst===null?"init":this.prevFirst<this.first?"next":"prev";this.callback("itemLoadCallback",a,c);this.prevFirst!==this.first&&(this.callback("itemFirstInCallback",a,c,this.first),this.callback("itemFirstOutCallback",a,c,this.prevFirst));this.prevLast!==this.last&&(this.callback("itemLastInCallback",a,c,this.last),this.callback("itemLastOutCallback",a,c,this.prevLast));this.callback("itemVisibleInCallback",a,c,this.first,this.last,this.prevFirst, this.prevLast);this.callback("itemVisibleOutCallback",a,c,this.prevFirst,this.prevLast,this.first,this.last)},callback:function(a,c,b,d,f,j,e){if(!(this.options[a]==null||typeof this.options[a]!="object"&&c!="onAfterAnimation")){var h=typeof this.options[a]=="object"?this.options[a][c]:this.options[a];if(g.isFunction(h)){var i=this;if(d===void 0)h(i,b,c);else if(f===void 0)this.get(d).each(function(){h(i,this,d,b,c)});else for(var a=function(a){i.get(a).each(function(){h(i,this,a,b,c)})},k=d;k<=f;k++)k!== null&&!(k>=j&&k<=e)&&a(k)}}},create:function(a){return this.format("<li></li>",a)},format:function(a,c){for(var a=g(a),b=a.get(0).className.split(" "),d=0;d<b.length;d++)b[d].indexOf("jcarousel-")!=-1&&a.removeClass(b[d]);a.addClass(this.className("jcarousel-item")).addClass(this.className("jcarousel-item-"+c)).css({"float":this.options.rtl?"right":"left","list-style":"none"}).attr("jcarouselindex",c);return a},className:function(a){return a+" "+a+(!this.options.vertical?"-horizontal":"-vertical")}, dimension:function(a,c){var b=g(a);if(c==null)return!this.options.vertical?b.outerWidth(!0)||f.intval(this.options.itemFallbackDimension):b.outerHeight(!0)||f.intval(this.options.itemFallbackDimension);else{var d=!this.options.vertical?c-f.intval(b.css("marginLeft"))-f.intval(b.css("marginRight")):c-f.intval(b.css("marginTop"))-f.intval(b.css("marginBottom"));g(b).css(this.wh,d+"px");return this.dimension(b)}},clipping:function(){return!this.options.vertical?this.clip[0].offsetWidth-f.intval(this.clip.css("borderLeftWidth"))- f.intval(this.clip.css("borderRightWidth")):this.clip[0].offsetHeight-f.intval(this.clip.css("borderTopWidth"))-f.intval(this.clip.css("borderBottomWidth"))},index:function(a,c){if(c==null)c=this.options.size;return Math.round(((a-1)/c-Math.floor((a-1)/c))*c)+1}});f.extend({defaults:function(a){return g.extend(q,a||{})},intval:function(a){a=parseInt(a,10);return isNaN(a)?0:a},windowLoaded:function(){m=!0}});g.fn.jcarousel=function(a){if(typeof a=="string"){var c=g(this).data("jcarousel"),b=Array.prototype.slice.call(arguments, 1);return c[a].apply(c,b)}else return this.each(function(){var b=g(this).data("jcarousel");b?(a&&g.extend(b.options,a),b.reload()):g(this).data("jcarousel",new f(this,a))})}})(jQuery);
;/*!
 * jQuery Countdown plugin v1.0
 * http://www.littlewebthings.com/projects/countdown/
 *
 * Copyright 2010, Vassilis Dourdounis
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
(function($){

	$.fn.countDown = function (options) {

		config = {};

		$.extend(config, options);

		diffSecs = this.setCountDown(config);
	
		if (config.onComplete)
		{
			$.data($(this)[0], 'callback', config.onComplete);
		}
		if (config.omitWeeks)
		{
			$.data($(this)[0], 'omitWeeks', config.omitWeeks);
		}

		$('#' + $(this).attr('id') + ' .digit').html('<div class="top"></div><div class="bottom"></div>');
		$(this).doCountDown($(this).attr('id'), diffSecs, 500);

		return this;

	};

	$.fn.stopCountDown = function () {
		clearTimeout($.data(this[0], 'timer'));
	};

	$.fn.startCountDown = function () {
		this.doCountDown($(this).attr('id'),$.data(this[0], 'diffSecs'), 500);
	};

	$.fn.setCountDown = function (options) {
		var targetTime = new Date();

		if (options.targetDate)
		{
			targetTime = new Date(options.targetDate.month + '/' + options.targetDate.day + '/' + options.targetDate.year + ' ' + options.targetDate.hour + ':' + options.targetDate.min + ':' + options.targetDate.sec + (options.targetDate.utc ? ' UTC' : ''));
		}
		else if (options.targetOffset)
		{
			targetTime.setFullYear(options.targetOffset.year + targetTime.getFullYear());
			targetTime.setMonth(options.targetOffset.month + targetTime.getMonth());
			targetTime.setDate(options.targetOffset.day + targetTime.getDate());
			targetTime.setHours(options.targetOffset.hour + targetTime.getHours());
			targetTime.setMinutes(options.targetOffset.min + targetTime.getMinutes());
			targetTime.setSeconds(options.targetOffset.sec + targetTime.getSeconds());
		}

		var nowTime = new Date();

		diffSecs = Math.floor((targetTime.valueOf()-nowTime.valueOf())/1000);

		$.data(this[0], 'diffSecs', diffSecs);

		return diffSecs;
	};

	$.fn.doCountDown = function (id, diffSecs, duration) {
		$this = $('#' + id);
		if (diffSecs <= 0)
		{
			diffSecs = 0;
			if ($.data($this[0], 'timer'))
			{
				clearTimeout($.data($this[0], 'timer'));
			}
		}

		secs = diffSecs % 60;
		mins = Math.floor(diffSecs/60)%60;
		hours = Math.floor(diffSecs/60/60)%24;
		if ($.data($this[0], 'omitWeeks') == true)
		{
			days = Math.floor(diffSecs/60/60/24);
			weeks = Math.floor(diffSecs/60/60/24/7);
		}
		else 
		{
			days = Math.floor(diffSecs/60/60/24)%7;
			weeks = Math.floor(diffSecs/60/60/24/7);
		}

		$this.dashChangeTo(id, 'seconds_dash', secs, duration ? duration : 800);
		$this.dashChangeTo(id, 'minutes_dash', mins, duration ? duration : 1200);
		$this.dashChangeTo(id, 'hours_dash', hours, duration ? duration : 1200);
		$this.dashChangeTo(id, 'days_dash', days, duration ? duration : 1200);
		$this.dashChangeTo(id, 'weeks_dash', weeks, duration ? duration : 1200);

		$.data($this[0], 'diffSecs', diffSecs);
		if (diffSecs > 0)
		{
			e = $this;
			t = setTimeout(function() { e.doCountDown(id, diffSecs-1) } , 1000);
			$.data(e[0], 'timer', t);
		} 
		else if (cb = $.data($this[0], 'callback')) 
		{
			$.data($this[0], 'callback')();
		}

	};

	$.fn.dashChangeTo = function(id, dash, n, duration) {
		  $this = $('#' + id);
		 
		  for (var i=($this.find('.' + dash + ' .digit').length-1); i>=0; i--)
		  {
				var d = n%10;
				n = (n - d) / 10;
				$this.digitChangeTo('#' + $this.attr('id') + ' .' + dash + ' .digit:eq('+i+')', d, duration);
		  }
	};

	$.fn.digitChangeTo = function (digit, n, duration) {
		if (!duration)
		{
			duration = 800;
		}
		if ($(digit + ' div.top').html() != n + '')
		{

			$(digit + ' div.top').css({'display': 'none'});
			$(digit + ' div.top').html((n ? n : '0')).show();

			// $(digit + ' div.bottom').animate({'height': ''}, duration, function() {
			// 				$(digit + ' div.bottom').html($(digit + ' div.top').html());
			// 				$(digit + ' div.bottom').css({'display': 'block', 'height': ''});
			// 				$(digit + ' div.top').hide();
			// 
			// 			
			// 			});
		}
	};

})(jQuery);


;/*
 *
 * jqTransform
 * by mathieu vilaplana mvilaplana@dfc-e.com
 * Designer ghyslain armand garmand@dfc-e.com
 *
 *
 * Version 1.0 25.09.08
 * Version 1.1 06.08.09
 * Add event click on Checkbox and Radio
 * Auto calculate the size of a select element
 * Can now, disabled the elements
 * Correct bug in ff if click on select (overflow=hidden)
 * No need any more preloading !!
 * 
 ******************************************** */
 
(function($){
	var defaultOptions = {preloadImg:true};
	var jqTransformImgPreloaded = false;

	var jqTransformPreloadHoverFocusImg = function(strImgUrl) {
		//guillemets to remove for ie
		strImgUrl = strImgUrl.replace(/^url\((.*)\)/,'$1').replace(/^\"(.*)\"$/,'$1');
		var imgHover = new Image();
		imgHover.src = strImgUrl.replace(/\.([a-zA-Z]*)$/,'-hover.$1');
		var imgFocus = new Image();
		imgFocus.src = strImgUrl.replace(/\.([a-zA-Z]*)$/,'-focus.$1');				
	};

	
	/***************************
	  Labels
	***************************/
	var jqTransformGetLabel = function(objfield){
		var selfForm = $(objfield.get(0).form);
		var oLabel = objfield.next();
		if(!oLabel.is('label')) {
			oLabel = objfield.prev();
			if(oLabel.is('label')){
				var inputname = objfield.attr('id');
				if(inputname){
					oLabel = selfForm.find('label[for="'+inputname+'"]');
				} 
			}
		}
		if(oLabel.is('label')){return oLabel.css('cursor','pointer');}
		return false;
	};
	
	/* Hide all open selects */
	var jqTransformHideSelect = function(oTarget){
		var ulVisible = $('.jqTransformSelectWrapper ul:visible');
		ulVisible.each(function(){
			var oSelect = $(this).parents(".jqTransformSelectWrapper:first").find("select").get(0);
			//do not hide if click on the label object associated to the select
			if( !(oTarget && oSelect.oLabel && oSelect.oLabel.get(0) == oTarget.get(0)) ){$(this).hide();$(this).parent().removeClass('jqTransformSelectWrapperOpen');}
		});
	};
	/* Check for an external click */
	var jqTransformCheckExternalClick = function(event) {
		if ($(event.target).parents('.jqTransformSelectWrapper').length === 0) { jqTransformHideSelect($(event.target));  }
	};

	/* Apply document listener */
	var jqTransformAddDocumentListener = function (){
		$(document).mousedown(jqTransformCheckExternalClick);
	};	
			
	/* Add a new handler for the reset action */
	var jqTransformReset = function(f){
		var sel;
		$('.jqTransformSelectWrapper select', f).each(function(){sel = (this.selectedIndex<0) ? 0 : this.selectedIndex; $('ul', $(this).parent()).each(function(){$('a:eq('+ sel +')', this).click();});});
		$('a.jqTransformCheckbox, a.jqTransformRadio', f).removeClass('jqTransformChecked');
		$('input:checkbox, input:radio', f).each(function(){if(this.checked){$('a', $(this).parent()).addClass('jqTransformChecked');}});
	};

	/***************************
	  Buttons
	 ***************************/
	$.fn.jqTransInputButton = function(){
		return this.each(function(){
			var newBtn = $('<button id="'+ this.id +'" name="'+ this.name +'" type="'+ this.type +'" class="'+ this.className +' jqTransformButton"><span><span>'+ $(this).attr('value') +'</span></span>')
				.hover(function(){newBtn.addClass('jqTransformButton_hover');},function(){newBtn.removeClass('jqTransformButton_hover')})
				.mousedown(function(){newBtn.addClass('jqTransformButton_click')})
				.mouseup(function(){newBtn.removeClass('jqTransformButton_click')})
			;
			$(this).replaceWith(newBtn);
		});
	};
	
	/***************************
	  Text Fields 
	 ***************************/
	$.fn.jqTransInputText = function(){
		return this.each(function(){
			var $input = $(this);
	
			if($input.hasClass('jqtranformdone') || !$input.is('input')) {return;}
			$input.addClass('jqtranformdone');
	
			var oLabel = jqTransformGetLabel($(this));
			oLabel && oLabel.bind('click',function(){$input.focus();});
	
			var inputSize=$input.width();
			if($input.attr('size')){
				inputSize = $input.attr('size')*10;
				$input.css('width',inputSize);
			}
			
			$input.addClass("jqTransformInput").wrap('<div class="jqTransformInputWrapper"><div class="jqTransformInputInner"><div></div></div></div>');
			var $wrapper = $input.parent().parent().parent();
			$wrapper.css("width", inputSize+10);
			$input
				.focus(function(){$wrapper.addClass("jqTransformInputWrapper_focus");})
				.blur(function(){$wrapper.removeClass("jqTransformInputWrapper_focus");})
				.hover(function(){$wrapper.addClass("jqTransformInputWrapper_hover");},function(){$wrapper.removeClass("jqTransformInputWrapper_hover");})
			;
	
			/* If this is safari we need to add an extra class */
			$.browser.safari && $wrapper.addClass('jqTransformSafari');
			$.browser.safari && $input.css('width',$wrapper.width()+16);
			this.wrapper = $wrapper;
			
		});
	};
	
	/***************************
	  Check Boxes 
	 ***************************/	
	$.fn.jqTransCheckBox = function(){
		return this.each(function(){
			if($(this).hasClass('jqTransformHidden')) {return;}

			var $input = $(this);
			var inputSelf = this;

			//set the click on the label
			var oLabel=jqTransformGetLabel($input);
			oLabel && oLabel.click(function(){aLink.trigger('click');});
			
			var aLink = $('<a href="#" class="jqTransformCheckbox"></a>');
			//wrap and add the link
			$input.addClass('jqTransformHidden').wrap('<span class="jqTransformCheckboxWrapper"></span>').parent().prepend(aLink);
			//on change, change the class of the link
			$input.change(function(){
				this.checked && aLink.addClass('jqTransformChecked') || aLink.removeClass('jqTransformChecked');
				return true;
			});
			// Click Handler, trigger the click and change event on the input
			aLink.click(function(){
				//do nothing if the original input is disabled
				if($input.attr('disabled')){return false;}
				//trigger the envents on the input object
				$input.trigger('click').trigger("change");	
				return false;
			});

			// set the default state
			this.checked && aLink.addClass('jqTransformChecked');		
		});
	};
	/***************************
	  Radio Buttons 
	 ***************************/	
	$.fn.jqTransRadio = function(){
		return this.each(function(){
			if($(this).hasClass('jqTransformHidden')) {return;}

			var $input = $(this);
			var inputSelf = this;
				
			oLabel = jqTransformGetLabel($input);
			oLabel && oLabel.click(function(){aLink.trigger('click');});
	
			var aLink = $('<a href="#" class="jqTransformRadio" rel="'+ this.name +'"></a>');
			$input.addClass('jqTransformHidden').wrap('<span class="jqTransformRadioWrapper"></span>').parent().prepend(aLink);
			
			$input.change(function(){
				inputSelf.checked && aLink.addClass('jqTransformChecked') || aLink.removeClass('jqTransformChecked');
				return true;
			});
			// Click Handler
			aLink.click(function(){
				if($input.attr('disabled')){return false;}
				$input.trigger('click').trigger('change');
	
				// uncheck all others of same name input radio elements
				$('input[name="'+$input.attr('name')+'"]',inputSelf.form).not($input).each(function(){
					$(this).attr('type')=='radio' && $(this).trigger('change');
				});
	
				return false;					
			});
			// set the default state
			inputSelf.checked && aLink.addClass('jqTransformChecked');
		});
	};
	
	/***************************
	  TextArea 
	 ***************************/	
	$.fn.jqTransTextarea = function(){
		return this.each(function(){
			var textarea = $(this);
	
			if(textarea.hasClass('jqtransformdone')) {return;}
			textarea.addClass('jqtransformdone');
	
			oLabel = jqTransformGetLabel(textarea);
			oLabel && oLabel.click(function(){textarea.focus();});
			
			var strTable = '<table cellspacing="0" cellpadding="0" border="0" class="jqTransformTextarea">';
			strTable +='<tr><td id="jqTransformTextarea-tl"></td><td id="jqTransformTextarea-tm"></td><td id="jqTransformTextarea-tr"></td></tr>';
			strTable +='<tr><td id="jqTransformTextarea-ml">&nbsp;</td><td id="jqTransformTextarea-mm"><div></div></td><td id="jqTransformTextarea-mr">&nbsp;</td></tr>';	
			strTable +='<tr><td id="jqTransformTextarea-bl"></td><td id="jqTransformTextarea-bm"></td><td id="jqTransformTextarea-br"></td></tr>';
			strTable +='</table>';					
			var oTable = $(strTable)
					.insertAfter(textarea)
					.hover(function(){
						!oTable.hasClass('jqTransformTextarea-focus') && oTable.addClass('jqTransformTextarea-hover');
					},function(){
						oTable.removeClass('jqTransformTextarea-hover');					
					})
				;
				
			textarea
				.focus(function(){oTable.removeClass('jqTransformTextarea-hover').addClass('jqTransformTextarea-focus');})
				.blur(function(){oTable.removeClass('jqTransformTextarea-focus');})
				.appendTo($('#jqTransformTextarea-mm div',oTable))
			;
			this.oTable = oTable;
			if($.browser.safari){
				$('#jqTransformTextarea-mm',oTable)
					.addClass('jqTransformSafariTextarea')
					.find('div')
						.css('height',textarea.height())
						.css('width',textarea.width())
				;
			}
		});
	};
	
	/***************************
	  Select 
	 ***************************/	
	$.fn.jqTransSelect = function(){
		return this.each(function(index){
			var $select = $(this);

			if($select.hasClass('jqTransformHidden')) {return;}
			if($select.attr('multiple')) {return;}

			var oLabel  =  jqTransformGetLabel($select);
			/* First thing we do is Wrap it */
			var $wrapper = $select
				.addClass('jqTransformHidden')
				.wrap('<div class="jqTransformSelectWrapper"></div>')
				.parent()
				.css({zIndex: 10-index})
			;
			
			/* Now add the html for the select */
			$wrapper.prepend('<div><span></span><a href="#" class="jqTransformSelectOpen"></a></div><ul></ul>');
			var $ul = $('ul', $wrapper).css('width',$select.width()).hide();
			/* Now we add the options */
			$('option', this).each(function(i){
				var oLi = $('<li><a href="#" index="'+ i +'">'+ $(this).html() +'</a></li>');
				$ul.append(oLi);
			});
			
			/* Add click handler to the a */
			$ul.find('a').click(function(){
					$('a.selected', $wrapper).removeClass('selected');
					$(this).addClass('selected');
					$wrapper.removeClass('jqTransformSelectWrapperOpen');
					
					/* Fire the onchange event */
					if ($select[0].selectedIndex != $(this).attr('index') && $select[0].onchange) { $select[0].selectedIndex = $(this).attr('index'); $select[0].onchange(); }
					$select[0].selectedIndex = $(this).attr('index');
					$('span:eq(0)', $wrapper).html($(this).html());
					$ul.hide();
					return false;
			});
			/* Set the default */
			$('a:eq('+ this.selectedIndex +')', $ul).click();
			$('span:first', $wrapper).click(function(){$("a.jqTransformSelectOpen",$wrapper).trigger('click');});
			oLabel && oLabel.click(function(){$("a.jqTransformSelectOpen",$wrapper).trigger('click');});
			this.oLabel = oLabel;
			
			/* Apply the click handler to the Open */
			var oLinkOpen = $('a.jqTransformSelectOpen', $wrapper)
				.click(function(){
					//Check if box is already open to still allow toggle, but close all other selects
					if( $ul.css('display') == 'none' ) {jqTransformHideSelect(); } 
					if($select.attr('disabled')){return false;}
					
					$wrapper.toggleClass('jqTransformSelectWrapperOpen');
					$ul.slideToggle('fast', function(){					
						
						var offSet = ($('a.selected', $ul).offset().top - $ul.offset().top);
						$ul.animate({scrollTop: offSet});
						
					});
					return false;
				})
			;

			// Set the new width
			var iSelectWidth = $select.outerWidth();
			var oSpan = $('span:first',$wrapper);
			var newWidth = (iSelectWidth > oSpan.innerWidth())?iSelectWidth+oLinkOpen.outerWidth():$wrapper.width();
			$wrapper.css('width',newWidth);
			$ul.css('width',newWidth);
			oSpan.css({width:iSelectWidth});
		
			// Calculate the height if necessary, less elements that the default height
			//show the ul to calculate the block, if ul is not displayed li height value is 0
			$ul.css({display:'block',visibility:'hidden'});
			var iSelectHeight = ($('li',$ul).length)*($('li:first',$ul).height());//+1 else bug ff
			(iSelectHeight < $ul.height()) && $ul.css({height:iSelectHeight,'overflow':'hidden'});//hidden else bug with ff
			$ul.css({display:'none',visibility:'visible'});
			
		});
	};
	$.fn.jqTransform = function(options){
		var opt = $.extend({},defaultOptions,options);
		
		/* each form */
		 return this.each(function(){
			var selfForm = $(this);
			if(selfForm.hasClass('jqtransformdone')) {return;}
			selfForm.addClass('jqtransformdone');
			
			$('input:submit, input:reset, input[type="button"]', this).jqTransInputButton();			
			$('input:text, input:password', this).jqTransInputText();			
			$('input:checkbox', this).jqTransCheckBox();
			$('input:radio', this).jqTransRadio();
			$('textarea', this).jqTransTextarea();
			
			if( $('select', this).jqTransSelect().length > 0 ){jqTransformAddDocumentListener();}
			selfForm.bind('reset',function(){var action = function(){jqTransformReset(this);}; window.setTimeout(action, 10);});
			
			//preloading dont needed anymore since normal, focus and hover image are the same one
			/*if(opt.preloadImg && !jqTransformImgPreloaded){
				jqTransformImgPreloaded = true;
				var oInputText = $('input:text:first', selfForm);
				if(oInputText.length > 0){
					//pour ie on eleve les ""
					var strWrapperImgUrl = oInputText.get(0).wrapper.css('background-image');
					jqTransformPreloadHoverFocusImg(strWrapperImgUrl);					
					var strInnerImgUrl = $('div.jqTransformInputInner',$(oInputText.get(0).wrapper)).css('background-image');
					jqTransformPreloadHoverFocusImg(strInnerImgUrl);
				}
				
				var oTextarea = $('textarea',selfForm);
				if(oTextarea.length > 0){
					var oTable = oTextarea.get(0).oTable;
					$('td',oTable).each(function(){
						var strImgBack = $(this).css('background-image');
						jqTransformPreloadHoverFocusImg(strImgBack);
					});
				}
			}*/
			
			
		}); /* End Form each */
				
	};/* End the Plugin */

})(jQuery);
				   ;/**
 * jQuery Masonry v2.0.111015
 * A dynamic layout plugin for jQuery
 * The flip-side of CSS Floats
 * http://masonry.desandro.com
 *
 * Licensed under the MIT license.
 * Copyright 2011 David DeSandro
 */
(function(a,b,c){var d=b.event,e;d.special.smartresize={setup:function(){b(this).bind("resize",d.special.smartresize.handler)},teardown:function(){b(this).unbind("resize",d.special.smartresize.handler)},handler:function(a,b){var c=this,d=arguments;a.type="smartresize",e&&clearTimeout(e),e=setTimeout(function(){jQuery.event.handle.apply(c,d)},b==="execAsap"?0:100)}},b.fn.smartresize=function(a){return a?this.bind("smartresize",a):this.trigger("smartresize",["execAsap"])},b.Mason=function(a,c){this.element=b(c),this._create(a),this._init()};var f=["position","height"];b.Mason.settings={isResizable:!0,isAnimated:!1,animationOptions:{queue:!1,duration:500},gutterWidth:0,isRTL:!1,isFitWidth:!1},b.Mason.prototype={_filterFindBricks:function(a){var b=this.options.itemSelector;return b?a.filter(b).add(a.find(b)):a},_getBricks:function(a){var b=this._filterFindBricks(a).css({position:"absolute"}).addClass("masonry-brick");return b},_create:function(c){this.options=b.extend(!0,{},b.Mason.settings,c),this.styleQueue=[],this.reloadItems();var d=this.element[0].style;this.originalStyle={};for(var e=0,g=f.length;e<g;e++){var h=f[e];this.originalStyle[h]=d[h]||""}this.element.css({position:"relative"}),this.horizontalDirection=this.options.isRTL?"right":"left",this.offset={};var i=b(document.createElement("div"));this.element.prepend(i),this.offset.y=Math.round(i.position().top),this.options.isRTL?(i.css({"float":"right",display:"inline-block"}),this.offset.x=Math.round(this.element.outerWidth()-i.position().left)):this.offset.x=Math.round(i.position().left),i.remove();var j=this;setTimeout(function(){j.element.addClass("masonry")},0),this.options.isResizable&&b(a).bind("smartresize.masonry",function(){j.resize()})},_init:function(a){this._getColumns(),this._reLayout(a)},option:function(a,c){b.isPlainObject(a)&&(this.options=b.extend(!0,this.options,a))},layout:function(a,c){var d,e,f,g,h,i;for(var j=0,k=a.length;j<k;j++){d=b(a[j]),e=Math.ceil(d.outerWidth(!0)/this.columnWidth),e=Math.min(e,this.cols);if(e===1)this._placeBrick(d,this.colYs);else{f=this.cols+1-e,g=[];for(i=0;i<f;i++)h=this.colYs.slice(i,i+e),g[i]=Math.max.apply(Math,h);this._placeBrick(d,g)}}var l={};l.height=Math.max.apply(Math,this.colYs)-this.offset.y;if(this.options.isFitWidth){var m=0,j=this.cols;while(--j){if(this.colYs[j]!==this.offset.y)break;m++}l.width=(this.cols-m)*this.columnWidth-this.options.gutterWidth}this.styleQueue.push({$el:this.element,style:l});var n=this.isLaidOut?this.options.isAnimated?"animate":"css":"css",o=this.options.animationOptions,p;for(j=0,k=this.styleQueue.length;j<k;j++)p=this.styleQueue[j],p.$el[n](p.style,o);this.styleQueue=[],c&&c.call(a),this.isLaidOut=!0},_getColumns:function(){var a=this.options.isFitWidth?this.element.parent():this.element,b=a.width();this.columnWidth=this.options.columnWidth||this.$bricks.outerWidth(!0)||b,this.columnWidth+=this.options.gutterWidth,this.cols=Math.floor((b+this.options.gutterWidth)/this.columnWidth),this.cols=Math.max(this.cols,1)},_placeBrick:function(a,b){var c=Math.min.apply(Math,b),d=0;for(var e=0,f=b.length;e<f;e++)if(b[e]===c){d=e;break}var g={top:c};g[this.horizontalDirection]=this.columnWidth*d+this.offset.x,this.styleQueue.push({$el:a,style:g});var h=c+a.outerHeight(!0),i=this.cols+1-f;for(e=0;e<i;e++)this.colYs[d+e]=h},resize:function(){var a=this.cols;this._getColumns(),this.cols!==a&&this._reLayout()},_reLayout:function(a){var b=this.cols;this.colYs=[];while(b--)this.colYs.push(this.offset.y);this.layout(this.$bricks,a)},reloadItems:function(){this.$bricks=this._getBricks(this.element.children())},reload:function(a){this.reloadItems(),this._init(a)},appended:function(a,b,c){if(b){this._filterFindBricks(a).css({top:this.element.height()});var d=this;setTimeout(function(){d._appended(a,c)},1)}else this._appended(a,c)},_appended:function(a,b){var c=this._getBricks(a);this.$bricks=this.$bricks.add(c),this.layout(c,b)},remove:function(a){this.$bricks=this.$bricks.not(a),a.remove()},destroy:function(){this.$bricks.removeClass("masonry-brick").each(function(){this.style.position="",this.style.top="",this.style.left=""});var c=this.element[0].style;for(var d=0,e=f.length;d<e;d++){var g=f[d];c[g]=this.originalStyle[g]}this.element.unbind(".masonry").removeClass("masonry").removeData("masonry"),b(a).unbind(".masonry")}},b.fn.imagesLoaded=function(a){function h(){--e<=0&&this.src!==f&&(setTimeout(g),d.unbind("load error",h))}function g(){a.call(b,d)}var b=this,d=b.find("img").add(b.filter("img")),e=d.length,f="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";e||g(),d.bind("load error",h).each(function(){if(this.complete||this.complete===c){var a=this.src;this.src=f,this.src=a}});return b};var g=function(a){this.console&&console.error(a)};b.fn.masonry=function(a){if(typeof a=="string"){var c=Array.prototype.slice.call(arguments,1);this.each(function(){var d=b.data(this,"masonry");if(!d)g("cannot call methods on masonry prior to initialization; attempted to call method '"+a+"'");else{if(!b.isFunction(d[a])||a.charAt(0)==="_"){g("no such method '"+a+"' for masonry instance");return}d[a].apply(d,c)}})}else this.each(function(){var c=b.data(this,"masonry");c?(c.option(a||{}),c._init()):b.data(this,"masonry",new b.Mason(a,this))});return this}})(window,jQuery);
;(function( $ ){
	$.fn.explainWith = function(tipsURL) {
  		var $toBeExplained = this;
		$.getJSON(tipsURL, function(data) {
			/*
			$.each(data, function(key, tip) {
				var $dot = $("<div class='dot-holder' title='"+tip.text+"'><div class='dot'></div></div>");
				if($.browser.webkit || $.browser.mozilla || ($.browser.msie && $.browser.version>9)){
					$dot.append("<div class='ring'></div>");
				}
				$dot.css({"left":tip.x, "top":tip.y}).prependTo($toBeExplained);

				var position = $dot.position();
				var radius = $dot.width()/2;
				$dot.css({"left":position.left-radius, "top":position.top-radius});
			});
	
			var params = {offset:[-5,0], layout:"<div><div class='arrow'></div></div>"};
			if(!$.browser.msie){
				params.effect = 'slide';
			}
	
			$(".dot-holder", $toBeExplained).tooltip(params).dynamic({ bottom: { direction: 'down', bounce: true } });	
			*/	
			explainer.explain($, $toBeExplained, data);	
		});
	};
})( jQuery );

(function( $ ){
	$.fn.explainWithJson = function(jsonData) {
  		var $toBeExplained = this;
		explainer.explain($, $toBeExplained, jsonData);	
	};
})( jQuery );

var explainer = {
	explain: function($, toBeExplained, data) {
		$.each(data, function(key, tip) {
			var tip = tip.text.replace("'", "\'");
			
			var $dot = $("<div class='dot-holder' title='"+tip+"'><div class='dot'></div></div>");
			if($.browser.webkit || $.browser.mozilla || ($.browser.msie && $.browser.version>9)){
				$dot.append("<div class='ring'></div>");
			}
			$dot.css({"left":tip.x, "top":tip.y}).prependTo(toBeExplained);

			var position = $dot.position();
			var radius = $dot.width()/2;
			$dot.css({"left":position.left-radius, "top":position.top-radius});
		});

		var params = {offset:[-5,0], layout:"<div><div class='arrow'></div></div>"};
		if(!$.browser.msie){
			params.effect = 'slide';
		}
		params.events = {
			def:     "mouseover click, mouseout",
		}

		window.tooltipAPI = $(".dot-holder", toBeExplained).tooltip(params).dynamic({ bottom: { direction: 'down', bounce: true } });	
	}
}
;/**
 * jQuery Validation Plugin 1.8.1
 *
 * 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){a.type==="radio"?this.findByName(a.name).addClass(b).removeClass(d):c(a).addClass(b).removeClass(d)},unhighlight:function(a,b,d){a.type==="radio"?this.findByName(a.name).removeClass(b).addClass(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(this.currentForm).find("input, select, textarea").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);
;/**
 * jquery.timer.js
 *
 * Copyright (c) 2011 Jason Chavannes <jason.chavannes@gmail.com>
 *
 * http://jchavannes.com/jquery-timer
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use, copy,
 * modify, merge, publish, distribute, sublicense, and/or sell copies
 * of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

;(function($) {
	$.timer = function(func, time, autostart) {	
	 	this.set = function(func, time, autostart) {
	 		this.init = true;
	 	 	if(typeof func == 'object') {
		 	 	var paramList = ['autostart', 'time'];
	 	 	 	for(var arg in paramList) {if(func[paramList[arg]] != undefined) {eval(paramList[arg] + " = func[paramList[arg]]");}};
 	 			func = func.action;
	 	 	}
	 	 	if(typeof func == 'function') {this.action = func;}
		 	if(!isNaN(time)) {this.intervalTime = time;}
		 	if(autostart && !this.active) {
			 	this.active = true;
			 	this.setTimer();
		 	}
		 	return this;
	 	};
	 	this.once = function(time) {
			var timer = this;
	 	 	if(isNaN(time)) {time = 0;}
			window.setTimeout(function() {timer.action();}, time);
	 		return this;
	 	};
		this.play = function(reset) {
			if(!this.active) {
				if(reset) {this.setTimer();}
				else {this.setTimer(this.remaining);}
				this.active = true;
			}
			return this;
		};
		this.pause = function() {
			if(this.active) {
				this.active = false;
				this.remaining -= new Date() - this.last;
				this.clearTimer();
			}
			return this;
		};
		this.stop = function() {
			this.active = false;
			this.remaining = this.intervalTime;
			this.clearTimer();
			return this;
		};
		this.toggle = function(reset) {
			if(this.active) {this.pause();}
			else if(reset) {this.play(true);}
			else {this.play();}
			return this;
		};
		this.reset = function() {
			this.active = false;
			this.play(true);
			return this;
		};
		this.clearTimer = function() {
			window.clearTimeout(this.timeoutObject);
		};
	 	this.setTimer = function(time) {
			var timer = this;
	 	 	if(typeof this.action != 'function') {return;}
	 	 	if(isNaN(time)) {time = this.intervalTime;}
		 	this.remaining = time;
	 	 	this.last = new Date();
			this.clearTimer();
			this.timeoutObject = window.setTimeout(function() {timer.go();}, time);
		};
	 	this.go = function() {
	 		if(this.active) {
	 			this.action();
	 			this.setTimer();
	 		}
	 	};
	 	
	 	if(this.init) {
	 		return new $.timer(func, time, autostart);
	 	} else {
			this.set(func, time, autostart);
	 		return this;
	 	}
	};
})(jQuery);;/**
 * jQuery Cookie plugin - https://github.com/carhartl/jquery-cookie
 *
 * Copyright (c) 2010 Klaus Hartl, @carhartl
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */
(function($) {
    $.cookie = function(key, value, options) {

        // key and at least value given, set cookie...
        if (arguments.length > 1 && (!/Object/.test(Object.prototype.toString.call(value)) || value === null || value === undefined)) {
            options = $.extend({}, options);

            if (value === null || value === undefined) {
                options.expires = -1;
            }

            if (typeof options.expires === 'number') {
                var days = options.expires, t = options.expires = new Date();
                t.setDate(t.getDate() + days);
            }

            value = String(value);

            return (document.cookie = [
                encodeURIComponent(key), '=', options.raw ? value : encodeURIComponent(value),
                options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
                options.path    ? '; path=' + options.path : '',
                options.domain  ? '; domain=' + options.domain : '',
                options.secure  ? '; secure' : ''
            ].join(''));
        }

        // key and possibly options given, get cookie...
        options = value || {};
        var decode = options.raw ? function(s) { return s; } : decodeURIComponent;

        var pairs = document.cookie.split('; ');
        for (var i = 0, pair; pair = pairs[i] && pairs[i].split('='); i++) {
            if (decode(pair[0]) === key) return decode(pair[1] || ''); // IE saves cookies with empty string as "c; ", e.g. without "=" as opposed to EOMB, thus pair[1] may be undefined
        }
        return null;
    };
})(jQuery);
;jQuery(document).ready(function() {
  

	jQuery(function() {
	    //find all form with class jqtransform and apply the plugin
	    jQuery(".jqtransform").jqTransform();
	});
	
	jQuery (function() {
		var darker = jQuery(".darker");
		if (darker){
			darker.children('.jqTransformSelectWrapper').addClass('darkWrapper');
			darker.find('ul').addClass('darkWrapper');
		}
		
	});
});
document.onclick = jQuery('#dd-options').hide();
;var Mainmenu = {
	
	pwCheckTimer: null,
	pwTimerEnabled: false,
	
	//---------------------------------------------------------------------------------------------------------------
	init: function() {
		
		var mainNav = jQuery('#main_menu_left');
		
		if(!mainNav.length)
			return;
		
		$("login_email").observe("focus", this.observePasswordField);
		$("login_email").observe("blur", this.unobservePasswordField);
		
		$("login_userpassword").observe("focus", this.killDummy);
		$("login_userpassword").observe("blur", this.undeadDummy);
		$("pwDummy").observe("click", this.killOverlay);

		
		if(jQuery.browser.msie && jQuery.browser.version < 8)
		{
			jQuery(".has-dd").removeClass("has-dd");
			jQuery(".main-nav-dd").remove();
			jQuery(".main_menu_notification").remove();
			return;
		}	
	
		mainNav.children('.has-dd').hover(function(ev) {
			var $this = jQuery(this);
			
			$dd = $this.find('.main-nav-dd');
			var pos_left = $this.position().left + 2;
			if($dd.attr("title") == "products")
				pos_left -= 60;
			
			$dd.css("left",pos_left);
	
			// show the dropdown
			$this.addClass('dd-active');
		}, function(ev) {
			// hide the dropdown
			jQuery(this).removeClass('dd-active');
		});

	},
	
	//---------------------------------------------------------------------------------------------------------------
	hideLogin: function(){
		if($("login-dd").style.display != "none")
		{
			this.showLogin();
		}	
	},
	
	//---------------------------------------------------------------------------------------------------------------
	showLogin: function(){
		
		if(jQuery.browser.msie && jQuery.browser.version < 8)
			return true;
		
		$("login-dd").toggle();
		$("login_button_main").toggleClassName("pressed");
		$("login-status").innerHTML = "";
		$("login_button").show();
		$("login_loading").hide();
	
		if($("login-dd").style.display == "none")
		 {
			Event.stopObserving(document.body, "click", this.handleOutsideClick);
		 }
		 else
		 {
			setTimeout(prepareEvent = function() { Event.observe(document.body, "click", Mainmenu.handleOutsideClick); }, 50);
		 }
		 
		return false;
	},
	
	//---------------------------------------------------------------------------------------------------------------
	handleOutsideClick: function(event){
	 var elt = $(Event.element(event)).up('.login-dd');
	 if(elt == null || elt == "undefined"){
		 Event.stopObserving(document.body, "click", this.handleOutsideClick);
		$("login-dd").hide();
		$("login_button_main").removeClassName("pressed");
	 }
	},
	
	//---------------------------------------------------------------------------------------------------------------
	loginAjaxEnter: function(e) {
		if(window.event) // IE
			keynum = e.keyCode
		else if(e.which) // Netscape/Firefox/Opera
			keynum = e.which
	
		if(keynum == 13) {
			this.loginAjax();
		}
	},
	
	//---------------------------------------------------------------------------------------------------------------
	loginAjax: function()
	{
		//progress
		$("login_button").hide();
		$("login_loading").setStyle({width: $("login_button").getWidth() + "px"});
		$("login_loading").show();
		
		var params = new Object();
		params.email = $("login_email").value;
		params.password = $("login_userpassword").value;
		params.set_cookie = $("set_login_cookie").checked;
		//console.log(params.set_cookie);
	
		new Ajax.Request("custom/modules/user/user_ajax.cfc?method=login", {
			method: 'post',
			parameters : params,
			onSuccess: function(transport) {
				var obj = transport.responseText.evalJSON();
	
				if(obj.SUCCESS == true){
					//window.location.reload();
					document.forms.ajax_login.submit();
				}
				else
				{
					$("login-status").innerHTML = obj.MSG;
					$("login_button").show();
					$("login_loading").hide();
				}
	
			}
		});
	},
	
	//---------------------------------------------------------------------------------------------------------------
	killDummy: function(){
		$('pwDummy').hide();
	},
	
	//---------------------------------------------------------------------------------------------------------------
	killOverlay: function(){
		$('pwDummy').hide();
		$("login_userpassword").focus();
	},
	
	//---------------------------------------------------------------------------------------------------------------
	undeadDummy: function(){
		if($('login_userpassword').value == ''){
			$('pwDummy').show();
		}
	},
	
	//---------------------------------------------------------------------------------------------------------------
	checkPasswordField: function() {
		if($("login_userpassword") != null && $("login_userpassword").value.length)
		{
			Mainmenu.killDummy();
			Mainmenu.unobservePasswordField();
		}
		else
		{
			if(Mainmenu.pwTimerEnabled)
				Mainmenu.observePasswordField();
		}
	},
	
	//---------------------------------------------------------------------------------------------------------------
	observePasswordField: function() {
		Mainmenu.pwTimerEnabled = true;
		Mainmenu.pwCheckTimer = setTimeout(Mainmenu.checkPasswordField, 200);
	},
	
	//---------------------------------------------------------------------------------------------------------------
	unobservePasswordField: function() {
		Mainmenu.pwTimerEnabled = false;
		clearTimeout(Mainmenu.pwCheckTimer);
	}
}

jQuery(function() {
	Mainmenu.init();
});

jQuery(window).load(function() {
	Mainmenu.checkPasswordField();	
});

;var Recommendations = {
	
	//---------------------------------------------------------------------------------------------------------------
	renderRecommendedCorrelatedProducts: function(product_id, num_items, title, direction, carousel_id, container)
	{
		var params = new Object();
		params.product_id = product_id;
		params.num_items = num_items;
		params.title = title;
		params.direction = direction;
		params.carousel_id = carousel_id;
	
		new Ajax.Request("custom/modules/product/product_ajax.cfc?method=renderRecommendedCorrelatedProducts", {
			method: 'post',
			parameters : params,
			onSuccess: function(transport) {
				var obj = transport.responseText.evalJSON();
				
				$(container).innerHTML = obj;
				
				jQuery(document).ready(function() {
					jQuery("#similar-products-carousel-" + carousel_id).jcarousel({
	
					});
				});
			}
		});
	},
	
	//---------------------------------------------------------------------------------------------------------------
	renderRecommendedProducts: function(product_id, num_items, title, direction, carousel_id, container)
	{
		var params = new Object();
		params.product_id = product_id;
		params.num_items = num_items;
		params.title = title;
		params.direction = direction;
		params.carousel_id = carousel_id;
	
		new Ajax.Request("custom/modules/product/product_ajax.cfc?method=renderRecommendedProducts", {
			method: 'post',
			parameters : params,
			onSuccess: function(transport) {
				var obj = transport.responseText.evalJSON();
				
				$(container).innerHTML = obj;
				
				jQuery(document).ready(function() {
					jQuery("#similar-products-carousel-" + carousel_id).jcarousel({
	
					});
				});
			}
		});
	},
	
	//---------------------------------------------------------------------------------------------------------------
	renderRecommendedCartProducts: function(num_items, title, direction, carousel_id, container)
	{
		var params = new Object();
		params.num_items = num_items;
		params.title = title;
		params.direction = direction;
		params.carousel_id = carousel_id;
	
		new Ajax.Request("custom/modules/product/product_ajax.cfc?method=renderRecommendedCartProducts", {
			method: 'post',
			parameters : params,
			onSuccess: function(transport) {
				var obj = transport.responseText.evalJSON();
				
				$(container).innerHTML = obj;
				
				jQuery(document).ready(function() {
					jQuery("#similar-products-carousel-" + carousel_id).jcarousel({
	
					});
				});
			}
		});
	},
	
	//---------------------------------------------------------------------------------------------------------------
	renderRecommendedFavouritesProducts: function(num_items, title, direction, carousel_id, container)
	{
		var params = new Object();
		params.num_items = num_items;
		params.title = title;
		params.direction = direction;
		params.carousel_id = carousel_id;
	
		new Ajax.Request("custom/modules/product/product_ajax.cfc?method=renderRecommendedFavouritesProducts", {
			method: 'post',
			parameters : params,
			onSuccess: function(transport) {
				var obj = transport.responseText.evalJSON();
				
				$(container).innerHTML = obj;
				
				jQuery(document).ready(function() {
					jQuery("#similar-products-carousel-" + carousel_id).jcarousel({
	
					});
				});
			}
		});
	}
}

;var Favourites = {
	
	saved_ids: "",
	
	//---------------------------------------------------------------------------------------------------------------
	addFavourite: function(id, element_id)
	{
		if(isNaN(id))
			return;
			
		var params = new Object();
		params.product_id = id == 0 ? "0" : id;
		
		new Ajax.Request("custom/modules/favourites/favourites.cfc?method=addFavourite", {
			method: 'post',
			parameters : params,
			onSuccess: function(transport) {
				var obj = transport.responseText.evalJSON();
				
				var cart_data_span = $("favouritelist_data");
				var cart_label_span = $("favouritelist_label");
				if(obj.NUM_FAVOURITES > 0)
				{
					cart_data_span.innerHTML = "(" + obj.NUM_FAVOURITES + ")";
					cart_label_span.style.fontWeight = "bold";
				}
				else
				{
					cart_data_span.innerHTML = "";	
					cart_label_span.style.fontWeight = "normal";
				}
			
				if($("add_favourite_" + obj.PRODUCT_ID) != null)
				{
					$("add_favourite_" + obj.PRODUCT_ID).className = "favourite-noticed";	
					$("add_favourite_" + obj.PRODUCT_ID).innerHTML = $("add_favourite_" + obj.PRODUCT_ID).getElementsByTagName("a").item(0).innerHTML;
				}
				if($("addfavourite_" + obj.PRODUCT_ID) != null)
				{
					$("addfavourite_" + obj.PRODUCT_ID).className = "favourite-noticed";	
					$("addfavourite_" + obj.PRODUCT_ID).innerHTML = $("addfavourite_" + obj.PRODUCT_ID).getElementsByTagName("a").item(0).innerHTML;
				}
			}
		});
	},
	
	//---------------------------------------------------------------------------------------------------------------
	prepareLinks: function(ids)
	{		
		if(ids == "undefiend" || ids == null || String(ids).length == 0)
			ids = this.saved_ids;
						
		this.saved_ids = ids;
		
		var id_array = String(ids).split(",");
		var active_id = 0;
		var el = null;
		for(var i = 0; i < id_array.length; i++)
		{
			active_id = id_array[i];
			el = $("addfavourite_" + active_id);
			if(el != "undefined" && el != null)
			{
				el.innerHTML = lbl_favourite;
				el.addClassName("favourite-noticed");
			}
		}
	}
};var Video = {
	//---------------------------------------------------------------------------------------------------------------
	active_tab_id: 2,
	history_tab_id: 2,
	active_video_id: 0,
	watchTimer: null,
	watchTimerTotal: null,
	watchUuid: "",
	
	//---------------------------------------------------------------------------------------------------------------
	showTab: function(id, site_anchor)
	{
		if(isNaN(id))
			return;
			
		var active_tab = $("tab_" + this.active_tab_id);
		active_tab.className = "";
		var active_tabs = $("tabcontent_" + this.active_tab_id);
		active_tabs.style.display = "none";
		
		var tab = $("tab_" + id);
		tab.className = "tab-selected";
		var tabs = $("tabcontent_" + id);
		tabs.style.display = "block";
		this.active_tab_id = id;
		
		SWFAddress.setValue(tab.title + "?t=" + id);
						
		if(String(site_anchor).length > 0)
			if($(site_anchor) != null)
				$(site_anchor).scrollIntoView(true);
		
		return false;
	},
		
	//---------------------------------------------------------------------------------------------------------------
	handleTabHistory: function(event) 
	{	
		var tab_id = 0;
		var site_anchor = "";
	
		for(var i = 0; i < event.parameterNames.length; i++)
		{		
			if(event.parameterNames[i] == "t")
			{
				if(event.parameters["t"] != null && event.parameters["t"] != Video.active_tab_id)
				{
					tab_id = event.parameters["t"];
				}
			}	
			if(event.parameterNames[i] == "a")
				if(event.parameters["a"] != null)
					site_anchor = event.parameters["a"];
		}
		if(tab_id > 0)
		{
			Video.showTab(tab_id, site_anchor);
			return;
		}
		
		if(event.path == "/" && Video.active_tab_id != Video.history_tab_id)
		{
			Video.showTab(this.history_tab_id);
		}
	},
	
	//---------------------------------------------------------------------------------------------------------------
	initVideoDetails: function(video_id, video_length) 
	{	
		var html5player = document.getElementById("html5_player");
		if(html5player != "undefined" && html5player != null && ((navigator.userAgent.indexOf('iPhone') != -1) || (navigator.userAgent.indexOf('iPad') != -1)))
		{
			html5player.onclick = function() {
				if (html5player.paused) {
					html5player.play();
				} else {
					html5player.pause();
				}
			};	
		}
		if(html5player != "undefined" && html5player != null)
		{
			this.watchUuid = uuid.v1();
			this.watchTimer = jQuery.timer(function(){
				//watched, unique_id, video_id, frontend_user_id, frontend_user_group_ids, abo_group_id, platform
				VideoUsage.markVideoWatched(1, Video.watchUuid, video_id, 0, "", 0, 2);
				Video.watchTimer.stop();
			});
			this.watchTimer.set({time: 10000, autostart: false});
			
			this.watchTimerTotal = jQuery.timer(function(){
				//watched, unique_id, video_id, frontend_user_id, frontend_user_group_ids, abo_group_id, platform
				VideoUsage.markVideoWatched(2, Video.watchUuid, video_id, 0, "", 0, 2);
				Video.watchTimerTotal.stop();
			});
			this.watchTimerTotal.set({time: video_length * 1000 * 0.6 - 10000, autostart: false});
			
			
			jQuery(html5player).bind("play", this.onHTML5VideoPlay);
		}
				
		if (isMobileBrowser(navigator.userAgent||navigator.vendor||window.opera) || (navigator.userAgent.indexOf('iPhone') != -1) || (navigator.userAgent.indexOf('iPad') != -1)
			|| (navigator.userAgent.indexOf('Android') != -1) || (navigator.userAgent.indexOf('Tablet') != -1) || (navigator.userAgent.indexOf('Playbook') != -1)
			|| (navigator.userAgent.indexOf('TouchPad') != -1)) {
			if(ipad_available)
				this.showMediumVideoPlayer(true);
			else
				showFlashPlayer();
		}
		else
			showFlashPlayer();
	},
	
	//---------------------------------------------------------------------------------------------------------------
	loadProductTOC: function(product_id)
	{
		if(isNaN(product_id))
			return;
		
		var product_toc = $("product_toc_" + product_id);
		if(product_toc.className.length == 0)
			return;
			
		var params = new Object();
		params.product_id = product_id;
		
		new Ajax.Request("custom/modules/product/product_ajax.cfc?method=renderProductDetailTOC", {
			method: 'post',
			parameters : params,
			onSuccess: function(transport) {
				var obj = transport.responseText.evalJSON();
				
				var product_toc = $("product_toc_" + obj.ID);
				product_toc.className = "";
			
				if(obj.UPDATE == true)
					product_toc.innerHTML = obj.HTML;
			}
		});
	},
		
	//---------------------------------------------------------------------------------------------------------------
	updateVideoControls: function(title, prevId, nextId, currentId, description)
	{
		this.active_video_id = currentId;
		
		$("video-title").innerHTML = title;
		$("video-description").innerHTML = description;
		$("video-prev-button").removeClassName("disabled");
		$("video-next-button").removeClassName("disabled");	
		
		if(prevId == "0")
			$("video-prev-button").addClassName("disabled");
		if(nextId == "0")
			$("video-next-button").addClassName("disabled");
			
		$("video-prev-button").writeAttribute("href", "videos-" + prevId + ".htm?autoPlay=1");
		$("video-next-button").writeAttribute("href", "videos-" + nextId + ".htm?autoPlay=1");
		
		if(prevId != "0")
			$("video-row-" + prevId).removeClassName("active");	
		if(nextId != "0")
			$("video-row-" + nextId).removeClassName("active");	
		if(currentId != "0")
			$("video-row-" + currentId).addClassName("active");	
			
		//update url
		SWFAddress.setValue("?video_id=" + currentId);
	},
	
	//---------------------------------------------------------------------------------------------------------------
	switchPlayerSize: function()
	{
		var size = 0;
		if($("player_container").hasClassName("video-detail-big-player") || $("player_container").hasClassName("video-detail-medium-player"))
		{
			this.showSmallVideoPlayer();	
			size = 0;
		}
		else
		{
			this.showBigVideoPlayer();
			size = 1;
		}
		
		//document.getElementById("content_main").focus();
		
		var params = new Object();
		params.size = size;
		
		new Ajax.Request("custom/modules/video/video_ajax.cfc?method=saveVideoSize", {
			method: 'post',
			parameters : params,
			onSuccess: function(transport) {
			}
		});
	},
	
	//---------------------------------------------------------------------------------------------------------------
	showBigVideoPlayer: function()
	{
		//check viewport size
		if(jQuery(window).width() < 1100)
		{
			this.showMediumVideoPlayer(false);
			return;	
		}
		
		jQuery("#player_container").addClass("video-detail-big-player");
		jQuery("#video_infos").addClass("video-infos-big");	
		
		jQuery(".product-teaser .truncate_ellipsis").remove();
		jQuery(".product-teaser").append(jQuery(".product-teaser .truncate_more").html());
		jQuery(".product-teaser .truncate_more").remove();
		jQuery(".product-teaser .clearboth").remove();
	},
	
	//---------------------------------------------------------------------------------------------------------------
	showSmallVideoPlayer: function()
	{
		jQuery("#player_container").removeClass("video-detail-big-player");
		jQuery("#player_container").removeClass("video-detail-medium-player");
		jQuery("#video_infos").removeClass("video-infos-big");
				
		jQuery(".product-teaser").jTruncate({
			length:300,
			minTrail:80,
			moreText:"[ + ]",
			lessText:"[ - ]"
		});
	},
	
	//---------------------------------------------------------------------------------------------------------------
	showMediumVideoPlayer: function(show_html5)
	{
		jQuery("#player_container").addClass("video-detail-medium-player");
		jQuery("#video_infos").addClass("video-infos-big");	
		jQuery("#video_infos").addClass("video-infos-medium");	
		
		jQuery(".product-teaser .truncate_ellipsis").remove();
		jQuery(".product-teaser").append(jQuery(".product-teaser .truncate_more").html());
		jQuery(".product-teaser .truncate_more").remove();
		jQuery(".product-teaser .clearboth").remove();
				
		if(show_html5 != "undefined" && show_html5 != null && show_html5 == true)
		{
			jQuery("#player_container").addClass("video-detail-html5-player");	
			$("html5_player").show();
			
			this.addSecureToken("html5_player");
		}	
	},
	
	//---------------------------------------------------------------------------------------------------------------
	addSecureToken: function(id) {
		new Ajax.Request("custom/modules/cdn/cdn.cfc?method=getSecureTokenJSON", {
			method: 'get',
			onSuccess: function(transport) {
				var token = transport.responseText.evalJSON();
				var src = jQuery("#" + id).attr("src");
				jQuery("#" + id).attr("src", src + "?" + token);	
			}
		});
	},
	
	//---------------------------------------------------------------------------------------------------------------
	showEmbed: function()
	{
		if(isNaN(this.active_video_id) || this.active_video_id == 0)
			return;
		
		var embed_div = $("embed-video");
		
		if(embed_div.visible())
		{
			embed_div.hide();
			return;
		}
		
		embed_div.innerHTML = '<div class="ajax-loading">&nbsp;</div>';
		embed_div.show();
			
		var params = new Object();
		params.video_id = this.active_video_id;
		
		new Ajax.Request("custom/modules/video/video_ajax.cfc?method=renderEmbedVideo", {
			method: 'post',
			parameters : params,
			onSuccess: function(transport) {
				embed_div.innerHTML = transport.responseText.evalJSON();
				
				jQuery(".option").click(function(evt) {
					jQuery(".option").removeClass("active");
					jQuery(this).addClass("active");
					
					var area = jQuery("#embed-area");
					var text = area.text();				
					var size = jQuery(this).text().split("x");
					var width = size[0];
					var height = size[1];
					
					text = text.replace(/width="[0-9]*"/g, 'width="' + width + '"');
					text = text.replace(/height="[0-9]*"/g, 'height="' + height + '"');
					area.text(text);
				});
				
				jQuery("#embed-area").click(function(evt) {
					var text_area = document.getElementById("embed-area");
					text_area.focus();
					text_area.select();
				});
			}
		});
	},
	
	//---------------------------------------------------------------------------------------------------------------
	showHTML5VideoPlayer: function(player_id, adjust_height)
	{		
		if(jQuery("#html5_" + player_id).length)
		{
			jQuery("#html5_" + player_id).show();
			if(adjust_height)
				jQuery("#parent_" + player_id).css("height", Number(Number(jQuery("#parent_" + player_id).css("height").replace("px", "")) - 27) + "px");
				
			this.addSecureToken("html5_" + player_id);
		}
	},
	
	//---------------------------------------------------------------------------------------------------------------
	closeEmbed: function()
	{
		$("embed-video").hide();
		
		return false;
	},
	
	//---------------------------------------------------------------------------------------------------------------
	nextVideo: function()
	{
		if($("html5_player") != "undefined" && $("html5_player") != null && $("html5_player").visible())
			return true;
		
		if(jQuery("#video-next-button").hasClass("disabled"))
			return false;
			
		document.getElementById("videoplayer").nextVideo();
		
		return false;
	},
	
	//---------------------------------------------------------------------------------------------------------------
	prevVideo: function()
	{
		if($("html5_player") != "undefined" && $("html5_player") != null && $("html5_player").visible())
			return true;
			
		if(jQuery("#video-prev-button").hasClass("disabled"))
			return false;
			
		document.getElementById("videoplayer").prevVideo();
		
		return false;
	},
	
	//---------------------------------------------------------------------------------------------------------------
	openVideoUrl: function(id, evt)
	{
		if(isNaN(id) || id == 0)
			return;
			
		window.location = "videos-" + id + ".htm";
	},
	
	//---------------------------------------------------------------------------------------------------------------
	onHTML5VideoPlay: function()
	{
		Video.watchTimer.play();
		Video.watchTimerTotal.play();
	},
	
	//---------------------------------------------------------------------------------------------------------------
	playVideoId: function(id)
	{
		if(isNaN(id) || id == 0)
			return;
			
		if($("videoplayer") == "undefined")
			return true;
			
		if(typeof document.getElementById("videoplayer").playVideoById == "undefined")
			return true;
			
		jQuery(".toc_list").find("li").removeClass("active");
		jQuery(".video-carousel").find("li").removeClass("active");
		if(jQuery("#carousel_video_" + id).length)
			jQuery("#carousel_video_" + id).addClass("active");
		goToTop();
			
		return !document.getElementById("videoplayer").playVideoById(id);
	},
	
	//---------------------------------------------------------------------------------------------------------------
	updateViewCounter: function()
	{	
		var params = new Object();
		params.video_id = this.active_video_id;
		
		new Ajax.Request("custom/modules/video/video_ajax.cfc?method=updateVideoViewCounter", {
			method: 'post',
			parameters : params,
			onSuccess: function(transport) {

			}
		});
	}
}

;var User = {
	//---------------------------------------------------------------------------------------------------------------
	active_tab_id: 1,
	country_overlay:null,
	
	//---------------------------------------------------------------------------------------------------------------
	showUserTab: function(id)
	{
		var active_tab = $("tab_" + this.active_tab_id);
		active_tab.className = "";
		var active_user_content = $("user_content_" + this.active_tab_id);
		active_user_content.style.display = "none";
		
		var tab = $("tab_" + id);
		tab.className = "tab-selected";
		var user_content = $("user_content_" + id);
		user_content.style.display = "block";
		this.active_tab_id = id;
				
		SWFAddress.setValue(tab.title + "?t=" + id);
			
		return false;
	},
	
	//---------------------------------------------------------------------------------------------------------------
	handleUserHistory: function(event) 
	{	
		for(var i = 0; i < event.parameterNames.length; i++)
		{
			if(event.parameterNames[i] == "t")
			{
				if(event.parameters["t"] != null && event.parameters["t"] != User.active_tab_id)
				{
					User.showUserTab(event.parameters["t"]);
				}
			}
		}
	},
	
	//---------------------------------------------------------------------------------------------------------------
	loadInvoiceDetail: function(dropdown) 
	{
		var params = new Object();
		params.order_id = dropdown.value;
		new Ajax.Request("custom/modules/user/user_ajax.cfc?method=renderUserInvoiceDetail", {
			method: 'post',
			parameters : params,
			onSuccess: function(transport) {
				var obj = transport.responseText.evalJSON();
				
				var invoice_detail = $("invoice_detail");
				if(obj.LOGGED_IN)
					invoice_detail.innerHTML = obj.HTML;
				else
					window.location = "user-login.htm";
			}
		});
	},
	
	filterAboUser: false,
	filterStr: "",
	filterTimeout: null,
	myv2b_page_offset: 24,
	myv2b_current_page_offset: 0,
	
	//---------------------------------------------------------------------------------------------------------------
	filterMyTrainings: function() 
	{
		this.filterStr = $("quick_search").value;
							
		if(String(this.filterStr).length < 2)
		{
			$("cancel-filter").hide();
			return;
		}
					
		$("cancel-filter").show();
		
		$("quick_search_list").innerHTML = "<div class='ajax-loading'>&nbsp;</div>";
		
		clearTimeout(this.filterTimeout);
		this.filterTimeout = setTimeout(this.doFiltering, 350);
	},
	
	//---------------------------------------------------------------------------------------------------------------
	toggleHelptext: function(toggle)
	{
		var params = new Object();
		params.toggle = toggle;
		
		new Ajax.Request("custom/modules/user/user_ajax.cfc?method=setHelptextVisibility", {
			method: 'post',
			parameters : params,
			onSuccess: function(transport) {
				if(toggle == "show"){
					$("user_helptext_box").style.display = "block";
					$("user_helptext_icon_close").style.display = "block"
					$("user_helptext_icon_open").style.display = "none"	
				}
				else{
					$("user_helptext_box").style.display = "none";
					$("user_helptext_icon_close").style.display = "none"
					$("user_helptext_icon_open").style.display = "block"
				}
			}
		});
	},
	
	//---------------------------------------------------------------------------------------------------------------
	doFiltering: function()
	{
		$("load_more_ajax").hide();
		
		User.myv2b_current_page_offset = 0;
		
		var params = new Object();
		params.filterStr = User.filterStr;
		params.abo_user = User.filterAboUser;
		
		new Ajax.Request("custom/modules/myvideo2brain/myvideo2brain_ajax.cfc?method=filterMyTrainings", {
			method: 'post',
			parameters : params,
			onSuccess: function(transport) {
				var obj = transport.responseText.evalJSON();
				User.handleFilterResult(obj);	
				User.prepareDownloadsOverlay();	
			}
		});
	},
	
	//---------------------------------------------------------------------------------------------------------------
	resetTrainingsFilter: function() 
	{		
		$("cancel-filter").hide();
		$("quick_search").value = "";
		$("quick_search").focus();
		
		this.filterStr = "";
		
		$("quick_search_list").innerHTML = "<div class='ajax-loading'>&nbsp;</div>";
		
		this.doFiltering();
	},
	
	//---------------------------------------------------------------------------------------------------------------
	showMore: function()
	{
		this.myv2b_current_page_offset += this.myv2b_page_offset;
		
		$("load_more_ajax").show();
		
		var params = new Object();
		params.filterStr = this.filterStr;
		params.abo_user = this.filterAboUser;
		params.offset = this.myv2b_current_page_offset;
		
		new Ajax.Request("custom/modules/myvideo2brain/myvideo2brain_ajax.cfc?method=filterMyTrainings", {
			method: 'post',
			parameters : params,
			onSuccess: function(transport) {
				var obj = transport.responseText.evalJSON();
				User.handleFilterResult(obj);	
				User.prepareDownloadsOverlay();
			}
		});
	},
	
	//---------------------------------------------------------------------------------------------------------------
	handleFilterResult: function(obj)
	{
		$("load_more_ajax").hide();
		if(this.myv2b_current_page_offset > 0)
			$("quick_search_list").innerHTML += obj.content;
		else
			$("quick_search_list").innerHTML = obj.content;
			
		$("info_count").innerHTML = (this.myv2b_current_page_offset + this.myv2b_page_offset) + "/" + obj.TOTAL;	
		
		if(obj.RECORDS_LEFT)
			$("show_more").show();	
		else
		{
			$("show_more").hide();	
			$("info_count").innerHTML = obj.TOTAL + "/" + obj.TOTAL;
		}		
	},
	
	//---------------------------------------------------------------------------------------------------------------
	prepareDownloadsOverlay: function()
	{		
		$$("a.overlay-downloads").each(function(element) { 		
			new FancyZoom(element, {width: 535, height: 300, finish_function:Product.showProductDownloads, finish_function_arguments: String(element.parentNode.id).substr(String(element.parentNode.id).lastIndexOf("-") + 1)});
		});
	}
	
	,
	
	//---------------------------------------------------------------------------------------------------------------
	saveCountryChoice: function(lang)
	{		
		this.country_overlay.hide();
		
		jQuery.cookie('v2bsite', lang, { expires: 365, path: '/' });
	}
}


;var ProductPreview = {
	
	validateEmail: function(email) 
	{ 
	    var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
	    return re.test(email);
	},
	//---------------------------------------------------------------------------------------------------------------
	toggleItem: function(id)
	{
		$('item_' + id).toggle();	
		$('item_link_' + id).toggleClassName('toggle-minus');	
	},
	
	//---------------------------------------------------------------------------------------------------------------
	letMeKnow: function(product_id)
	{
		$("let-me-know-" + product_id).toggle();
		$("enter-info-" + product_id).toggle();
		$("signup-notice-" + product_id).hide();
	},
	//---------------------------------------------------------------------------------------------------------------
	 unhighlight: function(element, product_id) 
	{
		jQuery(element).removeClass("invalid");
		jQuery(element).removeClass("error-field"); 
		$("general_error_message_" + product_id).hide();
	}
    ,
	//---------------------------------------------------------------------------------------------------------------
	errorPlacement: function(element) { 
		jQuery(element).addClass("error-field"); 
	},
	//---------------------------------------------------------------------------------------------------------------
	signupProduct: function(product_id)
	{
		var email = $("signup-email-" + product_id);
		if (this.validateEmail(email.value)) {
			
			this.saveEmailForReleaseMessage(email.value, product_id);
		}else{
			this.errorPlacement(email);
			$("general_error_message_" + product_id).show();
			
		}
	},
	//---------------------------------------------------------------------------------------------------------------
	saveEmailForReleaseMessage: function(email, product_id)
	{
		var params = {};
		params.email = encodeURIComponent(email);
		params.product_id = product_id;
		var url = 'custom/modules/product/product_ajax.cfc?method=subscribeToProductLaunchNotification';
	
		new Ajax.Request(url, {
			method: 'get',
			parameters: params,
			onSuccess: function(transport) {
				var json = transport.responseText.evalJSON();
				if(!json.ERROR){
					$("let-me-know-" + product_id).hide();
					$("enter-info-" + product_id).hide();
				}
				$("signup-notice-" + product_id).update(json.MSG).show();	
			}
		});
	}		
}

;var Videos = {

	//---------------------------------------------------------------------------------------------------------------
	active_tab_id: 1,
	up_to_date_tabs: new Array(),
	history_tab_id: 1,
	
	//---------------------------------------------------------------------------------------------------------------
	ti: new Array(), // info array for all tabs
	page_offset: 8,
	page_limit: 8,
	
	//---------------------------------------------------------------------------------------------------------------
	active_category_id: 0,
	active_external_product_id: 0,
	
	//---------------------------------------------------------------------------------------------------------------
	active_filter: new Object(),
	
	//---------------------------------------------------------------------------------------------------------------
	showVideosTab: function(id)
	{
		if(isNaN(id))
			return;
		
		var active_tab = $("tab_" + this.active_tab_id);
		active_tab.className = "";
		var active_products = $("videos_" + this.active_tab_id);
		active_products.style.display = "none";
		
		var tab = $("tab_" + id);
		tab.className = "tab-selected";
		var products = $("videos_" + id);
		products.style.display = "block";
		this.active_tab_id = id;
		
		var update_tab = true;
		for(var i = 0; i < this.up_to_date_tabs.length; i++)
		{
			if(this.up_to_date_tabs[i] == id)
			{
				update_tab = false;
				break;
			}
		}
		
		if(update_tab)
			this.getVideosByFilterAndCategory(id, this.active_filter);
			
		SWFAddress.setValue(tab.title + "?c=" + id);
		
		return false;
	},
	
	//---------------------------------------------------------------------------------------------------------------
	handleVideosHistory: function(event) 
	{	
		for(var i = 0; i < event.parameterNames.length; i++)
		{
			if(event.parameterNames[i] == "c")
			{
				if(event.parameters["c"] != null && event.parameters["c"] != Videos.active_tab_id)
				{
					Videos.showVideosTab(event.parameters["c"]);
					return;
				}
			}
		}
		
		if(event.path == "/" && Videos.active_tab_id != Videos.history_tab_id)
		{
			Videos.showVideosTab(Videos.history_tab_id);
		}
	},
	
	//---------------------------------------------------------------------------------------------------------------
	showMoreVideos: function(id)
	{
		if(isNaN(id))
			return;
			
		if(typeof(this.ti[id]) == "undefined")
		{
			this.ti[id] = new Object();
			this.ti[id].tab_id = id;
			this.ti[id].page_offset = this.page_offset;
			this.ti[id].page_limit = this.page_limit;
			this.ti[id].page = 1;
		}
		else
		{
			this.ti[id].page_offset += this.ti[id].page_limit;
			this.ti[id].page++;
		}
	
		this.getMoreVideosByFilterAndCategory(this.active_tab_id, this.active_filter, this.ti[this.active_tab_id].page_offset, this.ti[this.active_tab_id].page_limit);
	},
		
	//---------------------------------------------------------------------------------------------------------------
	videoFilterChanged: function()
	{
		this.up_to_date_tabs = new Array();
		this.getVideosByFilterAndCategory(this.active_tab_id, this.active_filter);
	},
	
	//---------------------------------------------------------------------------------------------------------------
	getVideosByFilterAndCategory: function(category_id, filter)
	{
		var videos_category = $("videos_category_" + category_id);
		videos_category.className = "ajax-category-loading";
		
		var params = new Object();
		params.category_id = category_id == 0 ? "0" : category_id;
		params.product_category_id = this.active_category_id;
		params.external_product_id = this.active_external_product_id;
			
		new Ajax.Request("custom/modules/video/video_ajax.cfc?method=getVideosByFilterAndCategory", {
			method: 'post',
			parameters : params,
			onSuccess: function(transport) {
				var obj = transport.responseText.evalJSON();
				
				Videos.up_to_date_tabs.push(obj.id);
		
				var videos_category = $("videos_category_" + obj.id);
				videos_category.className = "";
				
				if(obj.records_left == "NO")
					$("show_more_" + obj.id).style.display = "none";
				else
					$("show_more_" + obj.id).style.display = "block";
			
				if(obj.update == true)
				{
					videos_category.innerHTML = obj.html;
					$("info_count_" + obj.id).innerHTML = obj.info_count_text;	
				}
				
				if(typeof(Videos.ti[obj.id]) != "undefined")
				{
					Videos.ti[obj.id].page_offset = 0;
					Videos.ti[obj.id].page_limit = Videos.page_limit;
					Videos.ti[obj.id].page = 1;
				}
				
				if(obj.row_count == 0 && obj.id == 1)
					Videos.showVideosTab(0);
			}
		});
	},
	
	//---------------------------------------------------------------------------------------------------------------
	getMoreVideosByFilterAndCategory: function(category_id, filter, offset, limit)
	{
		var video_category = $("video_category" + category_id);
		$("load_more_ajax_" + category_id).style.display = "block";
		
		var params = new Object();
		params.category_id = category_id == 0 ? "0" : category_id;
		if(offset >= 0)
			params.offset = offset == 0 ? "0" : offset;
		else
			params.offset = "0";
		if(limit >= 0)
			params.limit = limit == 0 ? "0" : limit;
		else
			params.limit = page_limit;
	
		params.product_category_id = this.active_category_id;
		params.external_product_id = this.active_external_product_id;
		
		new Ajax.Request("custom/modules/video/video_ajax.cfc?method=getVideosByFilterAndCategory", {
			method: 'post',
			parameters : params,
			onSuccess: function(transport) {
				var obj = transport.responseText.evalJSON();
				
				Videos.up_to_date_tabs.push(obj.id);
		
				var video_category = $("videos_category_" + obj.id);
			
				$("load_more_ajax_" + obj.id).style.display = "none";
					
				if(obj.records_left == "NO")
					$("show_more_" + obj.id).style.display = "none";
				else
					$("show_more_" + obj.id).style.display = "block";
					
			
				if(obj.update == true)
				{
					video_category.innerHTML += obj.html;
					$("info_count_" + obj.id).innerHTML = obj.info_count_text;
				}
			}
		});
	}
}
;var VideoTools = {

	searchbox_pos: 0,
	toc_height: 0,
	is_scrolled: 0,
	product_id: 0,

	//---------------------------------------------------------------------------------------------------------------
	init: function()
	{
		Event.observe(window, "scroll", this.teaserSearchOnScroll);
	}, 
	
	//---------------------------------------------------------------------------------------------------------------
	getY: function(oElement)
	{
		var iReturnValue = 0;
		while( oElement != null ) {
			iReturnValue += oElement.offsetTop;
			oElement = oElement.offsetParent;
		}
		return iReturnValue;
	}, 
	
	//---------------------------------------------------------------------------------------------------------------
	hideVideoTeaserInfo: function()
	{
		$("teaser").hide();
	},
	
	//---------------------------------------------------------------------------------------------------------------
	copyVideoTeaserInfo: function(caller, evt, id)	{	
		// iphone and ipad skipping
			if ((navigator.userAgent.indexOf('iPhone') != -1) || (navigator.userAgent.indexOf('iPod') != -1) || (navigator.userAgent.indexOf('iPad') != -1)) {
				return true;
			} // ]]>
			
		if (document.getElementById('video_teaser_left_'+id)){
			
			$('video_teaser_right').innerHTML = $('video_teaser_left_'+id).innerHTML
					
			this.calculateTOCHeight();
		
			/* toc_height is the vertical size of the toc
				searchbox_pos is the position  of the searchbox relative to he page
			*/
		
			var teaser = $("teaser");
			var teaser_search = $("teaser_search");
			var offset_y = $(caller).viewportOffset().top; // the offset relative to the window
			var offset_parent = $(caller).offsetTop; //  the offset relative to the containing object
			var offset_y_absolut = this.getY($(caller)); // the offset relative to the page
			var searchboxVerticalSize= 115;
			var teaserTopPosition = 115;
			var marginOnBottomOfToc = 130;
			
			if (offset_parent < searchboxVerticalSize && this.is_scrolled==0){ //  if there is no trailer, the div stand over the search box
				
				teaser.className = $("teaser").className.replace("teaser-fixed","teaser-absolute");
				teaser.style.top = teaserTopPosition+"px";
			
			}else {
				if (offset_y > searchboxVerticalSize){  // if the place where the mouse over stands is lower  that where the search box ends (enough space on top)
			
					if(this.toc_height != 0 && offset_y_absolut > (this.toc_height + this.searchbox_pos - marginOnBottomOfToc)){  // if the mouseover is on the lowest part of the table (counting from the bottom with the variable marginOnBottomOfToc)
												
						if(teaser_search.hasClassName("teaser-search-relative")) //if not scrolled (probably small TOC coming from a search results)
						{
							teaser.className = teaser.className.replace("teaser-fixed","teaser-absolute");
							teaser.style.top = teaserTopPosition+"px";
						}
						else // if scrolled
						{
							if(teaser_search.style.display == "none")//  if the space is so small that the search box is not displayed
							{
								teaser.className = teaser.className.replace("teaser-absolute","teaser-fixed");
								teaser.style.top = 20+"px";
							}
							else
							{
								teaser.className = teaser.className.replace("teaser-absolute","teaser-fixed");
								//teaser.style.top = teaserTopPosition+"px";
								teaser.style.bottom = "0px";
							}
						}
						
						
					}else{ // on the middle of the table, place the seaser side by side with the TOC
						
						teaser.className = teaser.className.replace("teaser-absolute","teaser-fixed");
						teaser.style.top = (offset_y - 5)+"px";
					}
					
				
				}else{
					teaser.className = teaser.className.replace("teaser-absolute","teaser-fixed");
					teaser.style.top = teaserTopPosition+"px";
				}
					
				
			}
				
			teaser.style.display="block";
		}
	},
	
	//---------------------------------------------------------------------------------------------------------------
	teaserSearchOnScroll: function(evt){
		
		// iphone and ipad skipping
		if ((navigator.userAgent.indexOf('iPhone') != -1) || (navigator.userAgent.indexOf('iPod') != -1) || (navigator.userAgent.indexOf('iPad') != -1)) {
			return true;
		}
		
		var value = 0;
		var min_height = 200;
		
		VideoTools.searchbox_pos = VideoTools.getY($('product_content_right'));
		
		if(document.documentElement.scrollTop != "undefined" && document.documentElement.scrollTop != 0)
				value = document.documentElement.scrollTop;
		else{
			if(document.body.scrollTop != "undefined" && document.body.scrollTop != 0)
				value = document.body.scrollTop;
		}
				
		VideoTools.calculateTOCHeight();
				
		if(value > VideoTools.searchbox_pos) {
			VideoTools.is_scrolled=1;
			$("teaser_search").className = $("teaser_search").className.replace("teaser-search-relative", "teaser-search-fixed");
			if(value > ((this.toc_height + this.searchbox_pos) - min_height)){
				$("teaser_search").hide();
			}else{
				$("teaser_search").show();
			}
			
		}
		else {
			$("teaser_search").className = $("teaser_search").className.replace("teaser-search-fixed", "teaser-search-relative");
			VideoTools.is_scrolled=0;
			$("teaser_search").show();
		}
	},
	
	//---------------------------------------------------------------------------------------------------------------
	calculateTOCHeight: function()
	{
		
		if($("product_toc") == null)
			return;	

		if(document.getElementById('product_toc').style.display!= "none") {
			if(document.getElementById('product_toc')!= null){
				this.toc_height = document.getElementById('product_toc').offsetHeight;
			}
		}
		else {
			if(document.getElementById('product_toc_results')!= null){
				this.toc_height = document.getElementById('product_toc_results').getHeight();
			}
				
		}
	},
		
	//---------------------------------------------------------------------------------------------------------------
	timer: null,
	
	searchboxListener: function() 
	{	
		var toc = $('product_toc');
		var product_results = $('product_search_results');
		var product_results_load = $('product_search_results_load');
		var product_results_data = $("product_search_results_data");
		var elm=document.getElementById('header_search_video_entry');
		
		if (elm.value.length != 0){
		
			toc.hide();
			product_results.show();
			product_results_data.hide();
			product_results_load.show();
			$("cancel_search_btn").show();

		   clearTimeout(this.timer);
		   this.timer=setTimeout(function(){VideoTools.searchVideosTOC(elm.value)}, 1000);
		   
		}else{
			clearTimeout(this.timer);
			toc.show();
			product_results.hide();
			$("cancel_search_btn").hide();
		}
	},
		
	//---------------------------------------------------------------------------------------------------------------	
	searchVideosTOC: function(searchString)
	{		
		var params = new Object();
		params.product_id = this.product_id;
		params.search_string = searchString;
	
		new Ajax.Request("custom/modules/video/video_ajax.cfc?method=searchTOC", {
			method: 'post',
			parameters : params,
			onSuccess: function(transport) {
					
				var obj = transport.responseText.evalJSON();
				var product_results_data = $("product_search_results_data");
				
				product_results_data.show();
				product_results_data.innerHTML = obj;
				
				$("product_search_results_load").hide();	
			}
		});		
	},
	
	//---------------------------------------------------------------------------------------------------------------	
	clearSearchBox: function(){
		var elm=document.getElementById('header_search_video_entry');
		elm.value="";
		this.searchboxListener();	
	}
}


;var Product = {
	active_product_id: 0,
	active_view_mode: 0,
	active_sort_mode: 0,
	active_category_id: 0,
	active_external_product_id: 0,
	
	active_tab_id: 2,
	history_tab_id: 2,
	active_filter: new Object(),
	
	//---------------------------------------------------------------------------------------------------------------
	page_offset: 12,
	page_limit: 12,
	current_page_offset: 0,
	
	//---------------------------------------------------------------------------------------------------------------
	filter_status: new Object(),
	tabs: new Array(),
	
	//---------------------------------------------------------------------------------------------------------------
	showProductsTab: function(id)
	{
		if(isNaN(id))
			return;
		
		var active_tab = $("tab_" + this.active_tab_id);
		active_tab.className = "";
		var active_products = $("products_" + this.active_tab_id);
		active_products.style.display = "none";
		
		var tab = $("tab_" + id);
		tab.className = "tab-selected";
		var products = $("products_" + id);
		products.style.display = "block";
		this.active_tab_id = id;
				/**/
		SWFAddress.setValue(tab.title + "?c=" + id);
		return false;
	},
	
	//---------------------------------------------------------------------------------------------------------------
	handleProductsHistory: function(event) 
	{	
		for(var i = 0; i < event.parameterNames.length; i++)
		{
			if(event.parameterNames[i] == "c")
			{
				if(event.parameters["c"] != null && event.parameters["c"] != Product.active_tab_id)
				{
					Product.showProductsTab(event.parameters["c"]);
					return;
				}
			}
			
			if(event.parameterNames[i] == "o")
			{
				if(event.parameters["o"] != null && event.parameters["o"] != Product.current_page_offset)
				{
					Product.current_page_offset = parseInt(event.parameters["o"]);
					Product.getMoreProductsByFilter(Product.active_filter, Product.page_limit, Product.current_page_offset);	
					return;
				}
			}
		}
		
		if(event.path == "/" && Product.active_tab_id != Product.history_tab_id)
		{
			Product.showProductsTab(Product.history_tab_id);
		}
	},
	
	//---------------------------------------------------------------------------------------------------------------
	showDetailTab: function(id, site_anchor, play_video)
	{
		if(isNaN(id))
			return;
			
		var active_tab = $("tab_" + this.active_tab_id);
		active_tab.className = "";
		var active_products = $("product_" + this.active_tab_id);
		var product_downloads_hidden = $("product-downloads-hidden");
		var teaser_container = $("teaser_container");
		
		if (id==2){
			product_downloads_hidden.hide();
			teaser_container.show();
		}else{
			product_downloads_hidden.show();
			teaser_container.hide();
		}
	
		active_products.hide();
		
		var tab = $("tab_" + id);
		tab.className = "tab-selected";
		var products = $("product_" + id);
		products.show();
		this.active_tab_id = id;
		
		SWFAddress.setValue(tab.title + "?t=" + id);
		
		if(typeof(play_video) != 'undefined' && play_video == true && typeof(contentVideo_trailer) != 'undefined' && typeof(contentVideo_trailer.embedVideo) != 'undefined'){
			contentVideo_trailer.embedVideo(true);
		} else {
			if(typeof(contentVideo_trailer) != 'undefined' && typeof(contentVideo_trailer.embedVideo) != 'undefined'){
				contentVideo_trailer.embedVideo();
			}
		}
		
		if(id == 2)
			this.loadProductTOC(this.active_product_id);
		if(id == 6)
			this.loadServiceDownloads(this.active_product_id);
			
		if(String(site_anchor).length > 0)
			if($(site_anchor) != null)
				$(site_anchor).scrollIntoView(true);
		
		return false;
	},

	videoAutoPlay: false,
	
	//---------------------------------------------------------------------------------------------------------------
	handleProductDetailHistory: function(event) 
	{	
		var tab_id = 0;
		var site_anchor = "";
		var play_video = false;
	
		for(var i = 0; i < event.parameterNames.length; i++)
		{		
			if(event.parameterNames[i] == "t")
			{
				if(event.parameters["t"] != null && event.parameters["t"] != Product.active_tab_id)
				{
					tab_id = event.parameters["t"];
				}
			}	
			if(event.parameterNames[i] == "a")
				if(event.parameters["a"] != null)
					site_anchor = event.parameters["a"];
		}
		if(tab_id > 0)
		{
			Product.showDetailTab(tab_id, site_anchor);
			return;
		}
		
		if(event.path == "/" && Product.active_tab_id != Product.history_tab_id)
		{
			Product.showDetailTab(Product.history_tab_id);
		}
	},
	
	//---------------------------------------------------------------------------------------------------------------
	initProductDetails: function(product_id, toc_visible) 
	{			
		if(isNaN(product_id))
			return;
		
		if(this.active_tab_id == 2)
			this.loadProductTOC(product_id);
			
		this.active_product_id = product_id;
	},
	
	//---------------------------------------------------------------------------------------------------------------
	loadProductTOC: function(product_id)
	{
		if(isNaN(product_id))
			return;
		
		var product_toc = $("product_toc_" + product_id);
		if(product_toc.className.length == 0)
			return;
			
		var params = new Object();
		params.product_id = product_id;
		new Ajax.Request("custom/modules/product/product_ajax.cfc?method=renderProductDetailTOC", {
			method: 'post',
			parameters : params,
			onSuccess: function(transport) {
				var obj = transport.responseText.evalJSON();
				
				var product_toc = $("product_toc_" + obj.ID);
				product_toc.className = "";
			
				if(obj.UPDATE == true)
					product_toc.innerHTML = obj.HTML;
			}
		});
	},
	
	//---------------------------------------------------------------------------------------------------------------
	loadServiceDownloads: function(product_id)
	{
		if(isNaN(product_id))
			return;
		
		var service_downloads = $("product_service_downloads");
		if(service_downloads.className.length == 0)
			return;
			
		var params = new Object();
		params.product_id = product_id;
		new Ajax.Request("custom/modules/product/product_ajax.cfc?method=renderProductServiceDownloads", {
			method: 'post',
			parameters : params,
			onSuccess: function(transport) {
				var obj = transport.responseText.evalJSON();
				
				service_downloads.className = "";
			
				if(obj.UPDATE == true)
					service_downloads.innerHTML = obj.HTML;
			}
		});
	},
		
	//---------------------------------------------------------------------------------------------------------------
	productFilterChanged: function()
	{	
		this.getProductsByFilter(this.active_filter);
	},
	
	//---------------------------------------------------------------------------------------------------------------
	changeSortMode: function(mode)
	{	
		if(isNaN(mode))
			return;
			
		if(this.active_sort_mode == mode)
			return;
					
		this.active_sort_mode = mode;
		this.getProductsByFilter(this.active_filter);
	},
	
	//---------------------------------------------------------------------------------------------------------------
	changeViewMode: function(mode)
	{	
		if(isNaN(mode))
			return;
			
		if(this.active_view_mode == mode)
			return;
			
		if(mode)
		{
			$("btn_list").className = "btn-list-active";
			$("btn_raster").className = "btn-raster-inactive";
		}
		else
		{
			$("btn_list").className = "btn-list-inactive";
			$("btn_raster").className = "btn-raster-active";
		}
			
		this.active_view_mode = mode;
		this.getProductsByFilter(this.active_filter);
		
		return false;
	},
	
	//---------------------------------------------------------------------------------------------------------------
	changeExternalProductFilter: function(external_product_id)
	{
		if(external_product_id == this.active_external_product_id)
			return;
			
		this.active_external_product_id = external_product_id;
		Videos.active_external_product_id = external_product_id;
		
		for(var i = 0; i < this.tabs.length; i++)
		{
			this.filter_status[this.tabs[i]] = false;	
		}
		
		this.categoryFilterChanged();
	},
	
	//---------------------------------------------------------------------------------------------------------------
	categoryFilterChanged: function()
	{	
		if(this.active_tab_id == 1)
			this.productFilterChanged();
		else if(this.active_tab_id == 2)
			Videos.videoFilterChanged();
			
		this.filter_status[this.active_tab_id] = true;	
	},
	
	//---------------------------------------------------------------------------------------------------------------
	getProductsByFilter: function(filter)
	{
		$("products_content").className = "ajax-category-loading";
				
		var params = new Object();
		params.view_mode = this.active_view_mode == 0 ? "0" : this.active_view_mode;
		params.sort_mode = this.active_sort_mode == 0 ? "0" : this.active_sort_mode;
		params.product_category_id = this.active_category_id;
		params.external_product_id = this.active_external_product_id;
		
		new Ajax.Request("custom/modules/product/product_ajax.cfc?method=getProductsByFilter", {
			method: 'post',
			parameters : params,
			onSuccess: function(transport) {
				var obj = transport.responseText.evalJSON();
				
				$("products_content").className = "";
			
				if(obj.records_left == "NO")
					$("show_more").style.display = "none";
				else
					$("show_more").style.display = "block";
			
				if(obj.update == true)
				{
					$("products_content").innerHTML = obj.html;
					$("info_count").innerHTML = obj.info_count_text;
				}
				
				Product.current_page_offset = 0;
				Favourites.prepareLinks();
				
				InfoWindow.hideInfoWindow();
				Product.prepareOverlay();
			}
		});
	},

	//---------------------------------------------------------------------------------------------------------------
	showMoreProducts: function()
	{	
		this.current_page_offset += this.page_limit;
		this.getMoreProductsByFilter(this.active_filter);	
	},
	
	//---------------------------------------------------------------------------------------------------------------
	getMoreProductsByFilter: function(filter, override_offset, override_limit)
	{
		$("load_more_ajax").style.display = "block";
		
		var params = new Object();
		params.view_mode = this.active_view_mode == 0 ? "0" : this.active_view_mode;
		params.sort_mode = this.active_sort_mode == 0 ? "0" : this.active_sort_mode;
		params.offset = this.current_page_offset == 0 ? "0" : this.current_page_offset;
		params.limit = this.page_limit;
		params.product_category_id = this.active_category_id;
		params.external_product_id = this.active_external_product_id;
		
		if(!isNaN(override_offset))
			params.offset = override_offset;
		if(!isNaN(override_limit))
			params.limit = override_limit;
		
		new Ajax.Request("custom/modules/product/product_ajax.cfc?method=getProductsByFilter", {
			method: 'post',
			parameters : params,
			onSuccess: function(transport) {
				var obj = transport.responseText.evalJSON();
	
				$("load_more_ajax").style.display = "none";
			
				if(obj.records_left == "NO")
					$("show_more").style.display = "none";
				else
					$("show_more").style.display = "block";
					
			
				if(obj.update == true)
				{
					$("products_content").innerHTML += obj.html;
					$("info_count").innerHTML = obj.info_count_text;
				}
				
				Favourites.prepareLinks();
				InfoWindow.hideInfoWindow();		
				Product.prepareOverlay();
				
				SWFAddress.setValue("?o=" + Product.current_page_offset);
			}
		});
	},

	//---------------------------------------------------------------------------------------------------------------
	searchProductByISBN: function(isbn)
	{
		if(!String(isbn).length)
			return;
			
		$("search-product-result").style.display = "block";	
		$("search-product-result-list").innerHTML = "<div class='ajax-loading-no-padding'></div";	
			
		var params = new Object();
		params.isbn = isbn;
		
		new Ajax.Request("custom/modules/product/product_ajax.cfc?method=getProductsByISBN", {
			method: 'post',
			parameters : params,
			onSuccess: function(transport) {
				var obj = transport.responseText.evalJSON();
				
				if(obj.LOGGED_IN)
					$("search-product-result-list").innerHTML = obj.HTML;
				else
					window.location = "user-login.htm";
			}
		});
	},
	
	//---------------------------------------------------------------------------------------------------------------
	registerISBNProduct: function(product_id)
	{
		if(isNaN(product_id))
			return;
			
		$("product-register-isbn-" + product_id).innerHTML = "<div class='ajax-loading-button'></div";	
			
		var params = new Object();
		params.product_id = product_id;
		
		new Ajax.Request("custom/modules/product/product_ajax.cfc?method=registerISBNProduct", {
			method: 'post',
			parameters : params,
			onSuccess: function(transport) {
				var obj = transport.responseText.evalJSON();
				
				if(obj.LOGGED_IN)
				{
					$("product-register-isbn-" + obj.product_id).innerHTML = obj.HTML;
					$("register-product-progress-area").show();
					$("register-product-progress-list").innerHTML = obj.PROGRESSHTML;
				}
				else
					window.location = "user-login.htm";
			}
		});
	},
	
	//---------------------------------------------------------------------------------------------------------------
	categoryCheckForUpdate: function(id)
	{
		if(!this.filter_status[id])
		{
			this.categoryFilterChanged();
		}
	},
	
	//---------------------------------------------------------------------------------------------------------------
	prepareOverlay: function()
	{		
		$$("a.overlay-buy-html-2").each(function(element) { 		
			new FancyZoom(element, {width: 526, height: 550, finish_function:Product.showBuyingOptions, finish_function_arguments: String(element.parentNode.id).substr(String(element.parentNode.id).lastIndexOf("-") + 1)});
		});
		$$("a.overlay-buy-html-3").each(function(element) { 		
			new FancyZoom(element, {width: 790, height: 550, finish_function:Product.showBuyingOptions, finish_function_arguments: String(element.parentNode.id).substr(String(element.parentNode.id).lastIndexOf("-") + 1)});
		});
	},
		
	//---------------------------------------------------------------------------------------------------------------
	showBuyingOptions: function(product_id)
	{
		 Product.getBuyingOptions(product_id);	
	},
	
	//---------------------------------------------------------------------------------------------------------------	
	getBuyingOptions: function(product_id)
	{					
		
		var params = new Object();
		params.product_id = product_id;
								
		new Ajax.Request("custom/modules/product/product_ajax.cfc?method=renderProductBuyingOptions", {
			parameters: params,
			onSuccess: function(transport) {
				var json = transport.responseText.evalJSON();
				jQuery("#zoom_content > .buying-options-overlay").html(json.window_content);
			}
			
		});
	},
	
	//---------------------------------------------------------------------------------------------------------------	
	getProductDownloads: function(product_ids, show_lightbox, show_toc)
	{					
		var params = new Object();
		params.product_ids = product_ids;
		params.toc_visible = show_toc;
								
		new Ajax.Request("custom/modules/product/product_ajax.cfc?method=renderProductDetailDownloads", {
			parameters: params,
			onSuccess: function(transport) {	
				var json = transport.responseText.evalJSON();

				if(show_lightbox)
				{
					jQuery(".product-downloads").html(json.html);

					var box = new FancyZoom("downloads-available", {width: 535, height: 100});						
					box.showAuto($("downloads-available"), 0);	
				}
				else
				{
					jQuery("#zoom_content > .product-downloads").html(json.html);
				}
			}
		});
	},
	
	//---------------------------------------------------------------------------------------------------------------	
	showProductDownloads:function(product_id)
	{
		Product.getProductDownloads(product_id, false, false); 
	}	
}

















;var InfoWindow = {

	//---------------------------------------------------------------------------------------------------------------
	product_type_timer: null,
	product_info_timer: "",
	product_info_height: 0,
	product_info_width: 0,
	adjustment: "left",
	caller: null,
	
	//---------------------------------------------------------------------------------------------------------------
	showTypeWindow: function(evt, type, caller)
	{
		this.product_type_type = type;
		this.product_type_timer = setTimeout(prepareTypeWindow = function() {InfoWindow.displayTypeWindow(type, caller); }, 300);
	},
	
	//---------------------------------------------------------------------------------------------------------------
	displayTypeWindow: function(type, caller)
	{
		var arrow_left = "product-window-arrow-left";
		var arrow_right = "product-window-arrow-right";
		var info_window = $("product-type-window");		
		var adjustment = "top";
		
		$("info-window-title").innerHTML = product_types[type];
		
		info_window.style.display = "block";
		var product_type_height =  info_window.offsetHeight;
		var product_type_width =  info_window.offsetWidth;
		info_window.style.display = "none";
	
		var offset_x = $(caller).viewportOffset().left + $(caller).offsetWidth + 2;
		var offset_y = $(caller).viewportOffset().top;
	
		if(window.opera != "undefined" & navigator.userAgent.indexOf("Opera") > -1)
		{
			offset_y -= document.documentElement.scrollTop;
		}
		
		if(adjustment == "top")
		{
			offset_y = offset_y + (caller.offsetHeight / 2) - 62;
		}
		else
		{
			offset_y = offset_y - product_type_height + ($(caller).offsetHeight / 2) + 62;
		}
	
		var info_window_arrow = $("product-type-window-arrow");
		if(info_window_arrow != null)
		{
			if(offset_x + product_type_width > getWindowWidth())
			{
				offset_x = $(caller).viewportOffset().left - product_type_width;
				info_window_arrow.className = arrow_right + " " + arrow_right + "-" + adjustment;
			}
			else
			{
				info_window_arrow.className = arrow_left + " " + arrow_left + "-" + adjustment;
			}
		}
		
		if(info_window != null)
		{
			info_window.style.left = offset_x + "px";
			info_window.style.top = offset_y + "px";
			
			info_window.style.display = "block";
			
			info_window.style.visibility = "visible";
		}
	},
	
	//---------------------------------------------------------------------------------------------------------------
	hideTypeWindow: function()
	{
		clearTimeout(this.product_type_timer);
		var info_window = $("product-type-window");
		if(info_window != null)
			info_window.hide();
	},
		
	//---------------------------------------------------------------------------------------------------------------
	showInfoWindow: function(evt, id, adjustment, type, caller)
	{
		this.adjustment = adjustment;
		this.caller = caller;
		this.product_info_timer = setTimeout(prepareProductInfoWindow = function() { InfoWindow.getInfoWindowContent(id, type); }, 700);
	},
	
	//---------------------------------------------------------------------------------------------------------------
	hideInfoWindow: function()
	{		
		clearTimeout(this.product_info_timer);
		var info_window = $("info-window");
		if(info_window != null)
			info_window.hide();
	
		InfoWindow.hideTypeWindow();
	},
	
	//---------------------------------------------------------------------------------------------------------------
	getInfoWindowContent: function(id, type)
	{
		if(type == "product")
			this.getProductInfoWindowContent(id);
		else if(type == "video")
			this.getVideoInfoWindowContent(id);
	},
	
	//---------------------------------------------------------------------------------------------------------------
	getProductInfoWindowContent: function(id)
	{
		if($(id) != null)
		{
			this.calculateInfoWindowDimensions();
			this.displayInfoWindow(this.caller, this.adjustment);
			return;
		}
		var params = new Object();
		var idsplit = id.split("_");
		params.product_id = idsplit[idsplit.length - 1];
		
		new Ajax.Request("custom/modules/product/product_ajax.cfc?method=renderProductInfoWindow", {
			method: 'post',
			parameters : params,
			onSuccess: function(transport) {
				var obj = transport.responseText.evalJSON();
				
				$("info_window").innerHTML = obj.window_content;
				
				InfoWindow.calculateInfoWindowDimensions();
				InfoWindow.displayInfoWindow(InfoWindow.caller, InfoWindow.adjustment);
			}
		});
	},
	
	//---------------------------------------------------------------------------------------------------------------
	getVideoInfoWindowContent: function(id)
	{
		if($(id) != null)
		{
			this.calculateInfoWindowDimensions();
			this.displayInfoWindow(this.caller, this.adjustment);
			return;
		}
		var params = new Object();
		
		var idsplit = id.split("_");
		params.video_id = idsplit[idsplit.length - 1];
		params.category_id = idsplit[idsplit.length - 2];
		
		new Ajax.Request("custom/modules/video/video_ajax.cfc?method=renderVideoInfoWindow", {
			method: 'post',
			parameters : params,
			onSuccess: function(transport) {
				var obj = transport.responseText.evalJSON();
				
				$("info_window").innerHTML = obj.window_content;
				
				InfoWindow.calculateInfoWindowDimensions();
				InfoWindow.displayInfoWindow(InfoWindow.caller, InfoWindow.adjustment);
			}
		});
	},
	
	//---------------------------------------------------------------------------------------------------------------
	calculateInfoWindowDimensions: function()
	{
		var info_window = $("info-window");	
		info_window.style.display = "block";
		this.product_info_height =  info_window.offsetHeight;
		this.product_info_width =  info_window.offsetWidth;
		info_window.style.display = "none";
	},
	
	//---------------------------------------------------------------------------------------------------------------
	displayInfoWindow: function(caller, adjustment)
	{
		var arrow_left = "product-window-arrow-left";
		var arrow_right = "product-window-arrow-right";
		var info_window = $("info-window");		
	
		var offset_x = $(caller).viewportOffset().left + $(caller).offsetWidth + 2;
		var offset_y = $(caller).viewportOffset().top;
	
		if(window.opera != "undefined" & navigator.userAgent.indexOf("Opera") > -1)
		{
			offset_y -= document.documentElement.scrollTop;
		}
			
		if(adjustment == "top")
		{
			offset_y = offset_y + (caller.offsetHeight / 2) - 62;
		}
		else
		{
			offset_y = offset_y - this.product_info_height + ($(caller).offsetHeight / 2) + 62;
		}
	
		var info_window_arrow = $("info-window-arrow");
		if(info_window_arrow != null)
		{
			if(offset_x + this.product_info_width > getWindowWidth())
			{
				offset_x = $(caller).viewportOffset().left - this.product_info_width;
	
				info_window_arrow.className = arrow_right + " " + arrow_right + "-" + adjustment;
			}
			else
			{
				info_window_arrow.className = arrow_left + " " + arrow_left + "-" + adjustment;
			}
		}
		
		if(info_window != null)
		{
			info_window.style.left = offset_x + "px";
			info_window.style.top = offset_y + "px";
			
			info_window.style.display = "block";
			
			info_window.style.visibility = "visible";
		}
	},
	
	//---------------------------------------------------------------------------------------------------------------
	adjustInfoWindow: function(evt, id, adjustment)
	{	
		var value = 0;
		var top = 0;
		var arrow_left = "product-window-arrow-left";
		
		if(document.documentElement.scrollTop != "undefined" && document.documentElement.scrollTop != 0)
		{
			value = document.documentElement.scrollTop;
		}
		else
		{
			if(document.body.scrollTop != "undefined" && document.body.scrollTop != 0)
				value = document.body.scrollTop;
		}	
	
		var info_window = $(id);	
		var info_window_arrow = $(id + "_arrow");
		
		var offset_x = Event.pointerX(evt) + 15;
		var offset_y = Event.pointerY(evt) - value + 39;
		
		offset_y -= this.product_info_height;
		 
		if(adjustment == "top")
		{
			top	= this.product_info_height - 25;
			offset_y -= 39 * 2 + 22;
		}
	
		info_window_arrow.className = arrow_left + " " + arrow_left + "-" + adjustment;
		
		info_window.style.left = offset_x + "px";
		info_window.style.top = offset_y + 25 + top + "px";
	}
}

Event.observe(window, "scroll", InfoWindow.hideInfoWindow);
;var SearchSite =  {
	
	active_tab_category: "",
	search_entry: "",
	active_categories: new Object(),
	category_offset: new Object(),	
	
	//---------------------------------------------------------------------------------------------------------------
	init: function()
	{
		this.active_categories["products"] = 0;
		this.active_categories["videos"] = 0;
		this.active_categories["trainer"] = 0;
		this.active_categories["cms"] = 0;

		this.category_offset["products"] = 0;
		this.category_offset["videos"] = 0;
		this.category_offset["trainer"] = 0;
		this.category_offset["cms"] = 0;
	},
	
	//---------------------------------------------------------------------------------------------------------------
	searchSite: function(category, add)
	{
		var active_tab = $("tab_" + this.active_tab_category);
		active_tab.className = "";
		var active_content = $("search-results-" + this.active_tab_category);
		active_content.style.display = "none";
		
		var tab = $("tab_" + category);
		tab.className = "tab-selected";
		var new_content = $("search-results-" + category);
		new_content.style.display = "block";
		this.active_tab_category = category;
		
		if(this.active_categories[category] == 0)
		{
			this.loadRecords(category, add);
		}
	},
	
	//---------------------------------------------------------------------------------------------------------------
	loadRecords: function(category, add)
	{
		var params = new Object();
		params.search_entry = this.search_entry;
		params.category = category;
		params.offset = this.category_offset[category];
		
		if(add)
		{
			$("load-more-" + category).show();
		}
		
		new Ajax.Request("custom/modules/search/search_ajax.cfc?method=getSearchResults", {
			method: 'post',
			parameters : params,
			onSuccess: function(transport) {
				var json = transport.responseText.evalJSON();
				var current_category = json.CATEGORY;
								
				SearchSite.active_categories[current_category] = 1;
				SearchSite.category_offset[current_category] = json.OFFSET;
								
				var new_content = $("search-results-content-" + current_category);
				if(add)
				{
					new_content.innerHTML += json.CONTENT;
				}
				else
				{
					new_content.innerHTML = json.CONTENT;
				}
								
				$("load-more-" + current_category).hide();
				$("info-count-" + current_category).innerHTML = json.CURRENT_COUNT + " / " + json.TOTAL;		
				
				if(!json.RECORDS_LEFT)
				{
					$("show-more-" + category).hide();
				}
			}
		});
	},
	
	//---------------------------------------------------------------------------------------------------------------
	logSearch: function()
	{
		var params = new Object();
		params.search_entry = this.search_entry;
				
		new Ajax.Request("custom/modules/search/search_ajax.cfc?method=logSearch", {
			method: 'post',
			parameters : params,
			onSuccess: function(transport) {

			}
		});
	}	
}

SearchSite.init();;var Tellafriend = {

	showTellAFriend: function(arguments)
	{
		if(arguments[0] > 0)
		{
			var request_url = "tell-a-friend-" + arguments[0] + ".htm";
		}
		else
		{
			var request_url = "tell-a-friend-video-" + arguments[1] + ".htm";
		}
		
		new Ajax.Request(request_url, {
			method: 'get',
			onSuccess: function(transport) {
				$("tell-a-friend-overlay").update(transport.responseText);
				$("zoom_content").innerHTML = transport.responseText;
			}
		});
	},
				
	sendTellAFriendForm: function()
	{
		var form_data = new Object();
		var params = new Object();
		$$("##zoom_content input[type=text], ##zoom_content input[type=hidden], ##zoom_content textarea").each(function(element) {
			form_data[element.name] = element.value;									 
		});
		
		params.form_data = Object.toJSON(form_data);
	
		new Ajax.Request("custom/modules/tellafriend/tellafriend_ajax.cfc?method=validateTellAFriendForm", {
			method: 'post',
			parameters : params,
			onSuccess: function(transport) {
				var json = transport.responseText.evalJSON();
				if(json.ERROR)
				{ 
					$("tell-a-friend-overlay").update("");
					$("tell-a-friend-error").update(json.MSG).show();	
					$("ajax_loading_tellafriend").hide();
					$("submit_btn_tellafriend").show();
				}
				else
					FancyZoomBox.hide();
			}
		});
	}
};var VideoUsage = {
	
	markVideoWatched: function(watched, unique_id, video_id, frontend_user_id, frontend_user_group_ids, abo_group_id, platform)
	{
		if(isNaN(video_id))
			return;
		
		var params = new Object();
		params.watched = watched;
		params.unique_id = unique_id;
		params.video_id = video_id;
		params.frontend_user_id = frontend_user_id;
		params.frontend_user_group_ids = frontend_user_group_ids;
		params.abo_group_id = abo_group_id;
		params.platform = platform;
		
		new Ajax.Request("custom/modules/video/video_ajax.cfc?method=markVideoWatched", {
			method: 'post',
			parameters : params,
			onSuccess: function(transport) {
				var obj = transport.responseText.evalJSON();
			}
		});
	}
}

