//<![CDATA[
<!--













/*
<div class="class1 class2 classX">
//works
$(".class2")
//works by restricting to only elements with that class, only.
$("[class=class2]") will do it. 
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

Purpose:
	
	These routines support Bizamajig UI capabilities.

	Copyright 2010 (c) BIZAMAJIG
	Version: 2.4.0.0

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START postJSON

********************************************************************************************************************************
********************************************************************************************************************************
*/
jQuery.extend({
    postJSON: function(url, data, callback)
    {
        $.post(url, data, callback, "json");
    }
});
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END postJSON

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START doTimeout

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
 * jQuery doTimeout: Like setTimeout, but better! - v1.0 - 3/3/2010
 * http://benalman.com/projects/jquery-dotimeout-plugin/
 * 
 * Copyright (c) 2010 "Cowboy" Ben Alman
 * Dual licensed under the MIT and GPL licenses.
 * http://benalman.com/about/license/
 */
(function($){var a={},c="doTimeout",d=Array.prototype.slice;$[c]=function(){return b.apply(window,[0].concat(d.call(arguments)))};$.fn[c]=function(){var f=d.call(arguments),e=b.apply(this,[c+f[0]].concat(f));return typeof f[0]==="number"||typeof f[1]==="number"?this:e};function b(l){var m=this,h,k={},g=l?$.fn:$,n=arguments,i=4,f=n[1],j=n[2],p=n[3];if(typeof f!=="string"){i--;f=l=0;j=n[1];p=n[2]}if(l){h=m.eq(0);h.data(l,k=h.data(l)||{})}else{if(f){k=a[f]||(a[f]={})}}k.id&&clearTimeout(k.id);delete k.id;function e(){if(l){h.removeData(l)}else{if(f){delete a[f]}}}function o(){k.id=setTimeout(function(){k.fn()},j)}if(p){k.fn=function(q){if(typeof p==="string"){p=g[p]}p.apply(m,d.call(n,i))===true&&!q?o():e()};o()}else{if(k.fn){j===undefined?e():k.fn(j===false);return true}else{e()}}}})(jQuery);
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END doTimeout

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START Dynamic Resource Loader

********************************************************************************************************************************
********************************************************************************************************************************
*/
(function(o){var K=o.$BIZAMAJIG_RESOURCE,y="UseLocalXHR",z="AlwaysPreserveOrder",u="AllowDuplicates",A="CacheBust",B="BasePath",C=/^[^?#]*\//.exec(location.href)[0],D=/^\w+\:\/\/\/?[^\/]+/.exec(C)[0],i=document.head||document.getElementsByTagName("head"),L=(o.opera&&Object.prototype.toString.call(o.opera)=="[object Opera]")||("MozAppearance"in document.documentElement.style),q=document.createElement("script"),E=typeof q.preload=="boolean",r=E||(q.readyState&&q.readyState=="uninitialized"),F=!r&&q.async===true,M=!r&&!F&&!L;function G(a){return Object.prototype.toString.call(a)=="[object Function]"}function H(a){return Object.prototype.toString.call(a)=="[object Array]"}function N(a,c){var b=/^\w+\:\/\//;if(/^\/\/\/?/.test(a)){a=location.protocol+a}else if(!b.test(a)&&a.charAt(0)!="/"){a=(c||"")+a}return b.test(a)?a:((a.charAt(0)=="/"?D:C)+a)}function s(a,c){for(var b in a){if(a.hasOwnProperty(b)){c[b]=a[b]}}return c}function O(a){var c=false;for(var b=0;b<a.scripts.length;b++){if(a.scripts[b].ready&&a.scripts[b].exec_trigger){c=true;a.scripts[b].exec_trigger();a.scripts[b].exec_trigger=null}}return c}function t(a,c,b,d){a.onload=a.onreadystatechange=function(){if((a.readyState&&a.readyState!="complete"&&a.readyState!="loaded")||c[b])return;a.onload=a.onreadystatechange=null;d()}}function I(a){a.ready=a.finished=true;for(var c=0;c<a.finished_listeners.length;c++){setTimeout(a.finished_listeners[c],0)}a.ready_listeners=[];a.finished_listeners=[]}function P(d,f,e,g,h){setTimeout(function(){var a,c=f.real_src,b;if("item"in i){if(!i[0]){setTimeout(arguments.callee,25);return}i=i[0]}a=document.createElement("script");if(f.type)a.type=f.type;if(f.charset)a.charset=f.charset;if(h){if(r){e.elem=a;if(E){a.preload=true;a.onpreload=g}else{a.onreadystatechange=function(){if(a.readyState=="loaded")g();a.onreadystatechange=null}}a.src=c}else if(h&&c.indexOf(D)==0&&d[y]){b=new XMLHttpRequest();b.onreadystatechange=function(){if(b.readyState==4){b.onreadystatechange=function(){};e.text=b.responseText+"\n//@ sourceURL="+c;g()}};b.open("GET",c);b.send()}else{a.type="text/cache-script";t(a,e,"ready",function(){i.removeChild(a);g()});a.src=c;i.insertBefore(a,i.firstChild)}}else if(F){a.async=false;t(a,e,"finished",g);a.src=c;i.insertBefore(a,i.firstChild)}else{t(a,e,"finished",g);a.src=c;i.insertBefore(a,i.firstChild)}},0)}function J(){var l={},Q=r||M,n=[],p={},m;l[y]=true;l[z]=false;l[u]=false;l[A]=false;l[B]="";function R(a,c,b){var d;function f(){if(d!=null){I(b);d=null}}if(p[c.src].finished)return;if(!a[u])p[c.src].finished=true;d=b.elem||document.createElement("script");if(c.type)d.type=c.type;if(c.charset)d.charset=c.charset;t(d,b,"finished",f);if(b.elem){b.elem=null}else if(b.text){d.onload=d.onreadystatechange=null;d.text=b.text}else{d.src=c.real_src}i.insertBefore(d,i.firstChild);if(b.text){f()}}function S(c,b,d,f){var e,g,h=function(){b.ready_cb(b,function(){R(c,b,e)})},j=function(){b.finished_cb(b,d)};b.src=N(b.src,c[B]);b.real_src=b.src+(c[A]?((/\?.*$/.test(b.src)?"&_":"?_")+~~(Math.random()*1E9)+"="):"");if(!p[b.src])p[b.src]={items:[],finished:false};g=p[b.src].items;if(c[u]||g.length==0){e=g[g.length]={ready:false,finished:false,ready_listeners:[h],finished_listeners:[j]};P(c,b,e,((f)?function(){e.ready=true;for(var a=0;a<e.ready_listeners.length;a++){setTimeout(e.ready_listeners[a],0)}e.ready_listeners=[]}:function(){I(e)}),f)}else{e=g[0];if(e.finished){setTimeout(j,0)}else{e.finished_listeners.push(j)}}}function v(){var e,g=s(l,{}),h=[],j=0,w=false,k;function T(a,c){a.ready=true;a.exec_trigger=c;x()}function U(a,c){a.ready=a.finished=true;a.exec_trigger=null;for(var b=0;b<c.scripts.length;b++){if(!c.scripts[b].finished)return}c.finished=true;x()}function x(){while(j<h.length){if(G(h[j])){try{h[j]()}catch(err){}}else if(!h[j].finished){if(O(h[j]))continue;break}j++}if(j==h.length){w=false;k=false}}function V(){if(!k||!k.scripts){h.push(k={scripts:[],finished:true})}}e={script:function(){for(var f=0;f<arguments.length;f++){(function(a,c){var b;if(!H(a)){c=[a]}for(var d=0;d<c.length;d++){V();a=c[d];if(G(a))a=a();if(!a)continue;if(H(a)){b=[].slice.call(a);b.push(d,1);c.splice.call(c,b);d--;continue}if(typeof a=="string")a={src:a};a=s(a,{ready:false,ready_cb:T,finished:false,finished_cb:U});k.finished=false;k.scripts.push(a);S(g,a,k,(Q&&w));w=true;if(g[z])e.wait()}})(arguments[f],arguments[f])}return e},wait:function(){if(arguments.length>0){for(var a=0;a<arguments.length;a++){h.push(arguments[a])}k=h[h.length-1]}else k=false;x();return e}};return{script:e.script,wait:e.wait,setOptions:function(a){s(a,g);return e}}}m={setGlobalDefaults:function(a){s(a,l);return m},setOptions:function(){return v().setOptions.apply(null,arguments)},script:function(){return v().script.apply(null,arguments)},wait:function(){return v().wait.apply(null,arguments)},queueScript:function(){n[n.length]={type:"script",args:[].slice.call(arguments)};return m},queueWait:function(){n[n.length]={type:"wait",args:[].slice.call(arguments)};return m},runQueue:function(){var a=m,c=n.length,b=c,d;for(;--b>=0;){d=n.shift();a=a[d.type].apply(null,d.args)}return a},noConflict:function(){o.$BIZAMAJIG_RESOURCE=K;return m},sandbox:function(){return J()}};return m}o.$BIZAMAJIG_RESOURCE=J();(function(a,c,b){if(document.readyState==null&&document[a]){document.readyState="loading";document[a](c,b=function(){document.removeEventListener(c,b,false);document.readyState="complete"},false)}})("addEventListener","DOMContentLoaded")})(this);
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END Dynamic Resource Loader

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START SWFObject

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*	SWFObject v2.2 <http://code.google.com/p/swfobject/> 
	is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/
//
//	BUG: Cannot access toString, when this js file is cross domain loaded (like from facebook.com).
//	BUG: This statement, if(O==top), references 'top' which IS the test for 'is this iframed cross domain content?'  Need to convert to try/catch structure.
//
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}}}}();
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END SWFObject

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START ALPHANUMERIC

********************************************************************************************************************************
********************************************************************************************************************************
*/
(function($){

	$.fn.alphanumeric = function(p) { 

		p = $.extend({
			ichars: "!@#$%^&*()+=[]\\\';,/{}|\":<>?~`.- ",
			nchars: "",
			allow: ""
		  }, p);	

		return this.each
			(
				function() 
				{

					if (p.nocaps) p.nchars += "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
					if (p.allcaps) p.nchars += "abcdefghijklmnopqrstuvwxyz";
					
					s = p.allow.split('');
					for ( i=0;i<s.length;i++) if (p.ichars.indexOf(s[i]) != -1) s[i] = "\\" + s[i];
					p.allow = s.join('|');
					
					var reg = new RegExp(p.allow,'gi');
					var ch = p.ichars + p.nchars;
					ch = ch.replace(reg,'');

					$(this).keypress
						(
							function (e)
								{
								
									if (!e.charCode) k = String.fromCharCode(e.which);
										else k = String.fromCharCode(e.charCode);
										
									if (ch.indexOf(k) != -1) e.preventDefault();
									if (e.ctrlKey&&k=='v') e.preventDefault();
									
								}
								
						);
						
					$(this).bind('contextmenu',function () {return false});
									
				}
			);

	};

	$.fn.numeric = function(p) {
	
		var az = "abcdefghijklmnopqrstuvwxyz";
		az += az.toUpperCase();

		p = $.extend({
			nchars: az
		  }, p);	
		  	
		return this.each (function()
			{
				$(this).alphanumeric(p);
			}
		);
			
	};
	
	$.fn.alpha = function(p) {

		var nm = "1234567890";

		p = $.extend({
			nchars: nm
		  }, p);	

		return this.each (function()
			{
				$(this).alphanumeric(p);
			}
		);
			
	};	

})(jQuery);
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END ALPHANUMERIC

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START TINYSCROLLBAR

********************************************************************************************************************************
********************************************************************************************************************************
*/
(function($){$.tiny=$.tiny||{};$.tiny.scrollbar={options:{axis:'y',wheel:40,scroll:true,size:'auto',sizethumb:'auto'}};$.fn.tinyscrollbar=function(options){var options=$.extend({},$.tiny.scrollbar.options,options);this.each(function(){$(this).data('tsb',new Scrollbar($(this),options));});return this;};$.fn.tinyscrollbar_update=function(sScroll){return $(this).data('tsb').update(sScroll);};function Scrollbar(root,options){var oSelf=this;var oWrapper=root;var oViewport={obj:$('.viewport',root)};var oContent={obj:$('.overview',root)};var oScrollbar={obj:$('.scrollbar',root)};var oTrack={obj:$('.track',oScrollbar.obj)};var oThumb={obj:$('.thumb',oScrollbar.obj)};var sAxis=options.axis=='x',sDirection=sAxis?'left':'top',sSize=sAxis?'Width':'Height';var iScroll,iPosition={start:0,now:0},iMouse={};function initialize(){oSelf.update();setEvents();return oSelf;}
this.update=function(sScroll){oViewport[options.axis]=oViewport.obj[0]['offset'+sSize];oContent[options.axis]=oContent.obj[0]['scroll'+sSize];oContent.ratio=oViewport[options.axis]/oContent[options.axis];oScrollbar.obj.toggleClass('disable',oContent.ratio>=1);oTrack[options.axis]=options.size=='auto'?oViewport[options.axis]:options.size;oThumb[options.axis]=Math.min(oTrack[options.axis],Math.max(0,(options.sizethumb=='auto'?(oTrack[options.axis]*oContent.ratio):options.sizethumb)));oScrollbar.ratio=options.sizethumb=='auto'?(oContent[options.axis]/oTrack[options.axis]):(oContent[options.axis]-oViewport[options.axis])/(oTrack[options.axis]-oThumb[options.axis]);iScroll=(sScroll=='relative'&&oContent.ratio<=1)?Math.min((oContent[options.axis]-oViewport[options.axis]),Math.max(0,iScroll)):0;iScroll=(sScroll=='bottom'&&oContent.ratio<=1)?(oContent[options.axis]-oViewport[options.axis]):isNaN(parseInt(sScroll))?iScroll:parseInt(sScroll);setSize();};function setSize(){oThumb.obj.css(sDirection,iScroll/oScrollbar.ratio);oContent.obj.css(sDirection,-iScroll);iMouse['start']=oThumb.obj.offset()[sDirection];var sCssSize=sSize.toLowerCase();oScrollbar.obj.css(sCssSize,oTrack[options.axis]);oTrack.obj.css(sCssSize,oTrack[options.axis]);oThumb.obj.css(sCssSize,oThumb[options.axis]);};function setEvents(){oThumb.obj.bind('mousedown',start);oThumb.obj[0].ontouchstart=function(oEvent){oEvent.preventDefault();oThumb.obj.unbind('mousedown');start(oEvent.touches[0]);return false;};oTrack.obj.bind('mouseup',drag);if(options.scroll&&this.addEventListener){oWrapper[0].addEventListener('DOMMouseScroll',wheel,false);oWrapper[0].addEventListener('mousewheel',wheel,false);}
else if(options.scroll){oWrapper[0].onmousewheel=wheel;}};function start(oEvent){iMouse.start=sAxis?oEvent.pageX:oEvent.pageY;var oThumbDir=parseInt(oThumb.obj.css(sDirection));iPosition.start=oThumbDir=='auto'?0:oThumbDir;$(document).bind('mousemove',drag);document.ontouchmove=function(oEvent){$(document).unbind('mousemove');drag(oEvent.touches[0]);};$(document).bind('mouseup',end);oThumb.obj.bind('mouseup',end);oThumb.obj[0].ontouchend=document.ontouchend=function(oEvent){$(document).unbind('mouseup');oThumb.obj.unbind('mouseup');end(oEvent.touches[0]);};return false;};function wheel(oEvent){if(!(oContent.ratio>=1)){oEvent=$.event.fix(oEvent||window.event);var iDelta=oEvent.wheelDelta?oEvent.wheelDelta/120:-oEvent.detail/3;iScroll-=iDelta*options.wheel;iScroll=Math.min((oContent[options.axis]-oViewport[options.axis]),Math.max(0,iScroll));oThumb.obj.css(sDirection,iScroll/oScrollbar.ratio);oContent.obj.css(sDirection,-iScroll);oEvent.preventDefault();};};function end(oEvent){$(document).unbind('mousemove',drag);$(document).unbind('mouseup',end);oThumb.obj.unbind('mouseup',end);document.ontouchmove=oThumb.obj[0].ontouchend=document.ontouchend=null;return false;};function drag(oEvent){if(!(oContent.ratio>=1)){iPosition.now=Math.min((oTrack[options.axis]-oThumb[options.axis]),Math.max(0,(iPosition.start+((sAxis?oEvent.pageX:oEvent.pageY)-iMouse.start))));iScroll=iPosition.now*oScrollbar.ratio;oContent.obj.css(sDirection,-iScroll);oThumb.obj.css(sDirection,iPosition.now);;}
return false;};return initialize();};})(jQuery);
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END TINYSCROLLBAR

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START PRETTYPHOTO

********************************************************************************************************************************
********************************************************************************************************************************
*/
/* ------------------------------------------------------------------------
	Class: prettyPhoto
	Use: Lightbox clone for jQuery
	Author: Stephane Caron (http://www.no-margin-for-errors.com)
	Version: 3.1.3
------------------------------------------------------------------------- */

(function($){$.prettyPhoto={version:'3.1.3'};$.fn.prettyPhoto=function(pp_settings){pp_settings=jQuery.extend({animation_speed:'fast',slideshow:5000,autoplay_slideshow:false,opacity:0.80,show_title:true,allow_resize:true,default_width:500,default_height:344,counter_separator_label:'/',theme:'pp_default',horizontal_padding:20,hideflash:false,wmode:'opaque',autoplay:true,modal:false,deeplinking:true,overlay_gallery:true,keyboard_shortcuts:true,changepicturecallback:function(){},callback:function(){},ie6_fallback:true,markup:'<div class="pp_pic_holder"> \
      <div class="ppt">&nbsp;</div> \
      <div class="pp_top"> \
       <div class="pp_left"></div> \
       <div class="pp_middle"></div> \
       <div class="pp_right"></div> \
      </div> \
      <div class="pp_content_container"> \
       <div class="pp_left"> \
       <div class="pp_right"> \
        <div class="pp_content"> \
         <div class="pp_loaderIcon"></div> \
         <div class="pp_fade"> \
          <a href="#" class="pp_expand" title="Expand the image">Expand</a> \
          <div class="pp_hoverContainer"> \
           <a class="pp_next" href="#">next</a> \
           <a class="pp_previous" href="#">previous</a> \
          </div> \
          <div id="pp_full_res"></div> \
          <div class="pp_details"> \
           <div class="pp_nav"> \
            <a href="#" class="pp_arrow_previous">Previous</a> \
            <p class="currentTextHolder">0/0</p> \
            <a href="#" class="pp_arrow_next">Next</a> \
           </div> \
           <p class="pp_description"></p> \
           <div class="pp_social">{pp_social}</div> \
           <a class="pp_close" href="#">Close</a> \
          </div> \
         </div> \
        </div> \
       </div> \
       </div> \
      </div> \
      <div class="pp_bottom"> \
       <div class="pp_left"></div> \
       <div class="pp_middle"></div> \
       <div class="pp_right"></div> \
      </div> \
     </div> \
     <div class="pp_overlay"></div>',gallery_markup:'<div class="pp_gallery"> \
        <a href="#" class="pp_arrow_previous">Previous</a> \
        <div> \
         <ul> \
          {gallery} \
         </ul> \
        </div> \
        <a href="#" class="pp_arrow_next">Next</a> \
       </div>',image_markup:'<img id="fullResImage" src="{path}" />',flash_markup:'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>',quicktime_markup:'<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>',iframe_markup:'<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',inline_markup:'<div class="pp_inline">{content}</div>',custom_markup:'',social_tools:'<div class="twitter"><a href="http://twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div class="facebook"><iframe src="http://www.facebook.com/plugins/like.php?locale=en_US&href={location_href}&amp;layout=button_count&amp;show_faces=true&amp;width=500&amp;action=like&amp;font&amp;colorscheme=light&amp;height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:23px;" allowTransparency="true"></iframe></div>'},pp_settings);var matchedObjects=this,percentBased=false,pp_dimensions,pp_open,pp_contentHeight,pp_contentWidth,pp_containerHeight,pp_containerWidth,windowHeight=$(window).height(),windowWidth=$(window).width(),pp_slideshow;doresize=true,scroll_pos=_get_scroll();$(window).unbind('resize.prettyphoto').bind('resize.prettyphoto',function(){_center_overlay();_resize_overlay();});if(pp_settings.keyboard_shortcuts){$(document).unbind('keydown.prettyphoto').bind('keydown.prettyphoto',function(e){if(typeof $pp_pic_holder!='undefined'){if($pp_pic_holder.is(':visible')){switch(e.keyCode){case 37:$.prettyPhoto.changePage('previous');e.preventDefault();break;case 39:$.prettyPhoto.changePage('next');e.preventDefault();break;case 27:if(!settings.modal)
$.prettyPhoto.close();e.preventDefault();break;};};};});};$.prettyPhoto.initialize=function(){settings=pp_settings;if(settings.theme=='pp_default')settings.horizontal_padding=16;if(settings.ie6_fallback&&$.browser.msie&&parseInt($.browser.version)==6)settings.theme="light_square";theRel=$(this).attr('rel');galleryRegExp=/\[(?:.*)\]/;isSet=(galleryRegExp.exec(theRel))?true:false;pp_images=(isSet)?jQuery.map(matchedObjects,function(n,i){if($(n).attr('rel').indexOf(theRel)!=-1)return $(n).attr('href');}):$.makeArray($(this).attr('href'));pp_titles=(isSet)?jQuery.map(matchedObjects,function(n,i){if($(n).attr('rel').indexOf(theRel)!=-1)return($(n).find('img').attr('alt'))?$(n).find('img').attr('alt'):"";}):$.makeArray($(this).find('img').attr('alt'));pp_descriptions=(isSet)?jQuery.map(matchedObjects,function(n,i){if($(n).attr('rel').indexOf(theRel)!=-1)return($(n).attr('title'))?$(n).attr('title'):"";}):$.makeArray($(this).attr('title'));if(pp_images.length>30)settings.overlay_gallery=false;set_position=jQuery.inArray($(this).attr('href'),pp_images);rel_index=(isSet)?set_position:$("a[rel^='"+theRel+"']").index($(this));_build_overlay(this);if(settings.allow_resize)
$(window).bind('scroll.prettyphoto',function(){_center_overlay();});$.prettyPhoto.open();return false;}
$.prettyPhoto.open=function(event){if(typeof settings=="undefined"){settings=pp_settings;if($.browser.msie&&$.browser.version==6)settings.theme="light_square";pp_images=$.makeArray(arguments[0]);pp_titles=(arguments[1])?$.makeArray(arguments[1]):$.makeArray("");pp_descriptions=(arguments[2])?$.makeArray(arguments[2]):$.makeArray("");isSet=(pp_images.length>1)?true:false;set_position=0;_build_overlay(event.target);}
if($.browser.msie&&$.browser.version==6)$('select').css('visibility','hidden');if(settings.hideflash)$('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','hidden');_checkPosition($(pp_images).size());$('.pp_loaderIcon').show();if(settings.deeplinking)
setHashtag();if(settings.social_tools){facebook_like_link=settings.social_tools.replace('{location_href}',encodeURIComponent(location.href));$pp_pic_holder.find('.pp_social').html(facebook_like_link);}
if($ppt.is(':hidden'))$ppt.css('opacity',0).show();$pp_overlay.show().fadeTo(settings.animation_speed,settings.opacity);$pp_pic_holder.find('.currentTextHolder').text((set_position+1)+settings.counter_separator_label+$(pp_images).size());if(pp_descriptions[set_position]!=""){$pp_pic_holder.find('.pp_description').show().html(unescape(pp_descriptions[set_position]));}else{$pp_pic_holder.find('.pp_description').hide();}
movie_width=(parseFloat(getParam('width',pp_images[set_position])))?getParam('width',pp_images[set_position]):settings.default_width.toString();movie_height=(parseFloat(getParam('height',pp_images[set_position])))?getParam('height',pp_images[set_position]):settings.default_height.toString();percentBased=false;if(movie_height.indexOf('%')!=-1){movie_height=parseFloat(($(window).height()*parseFloat(movie_height)/100)-150);percentBased=true;}
if(movie_width.indexOf('%')!=-1){movie_width=parseFloat(($(window).width()*parseFloat(movie_width)/100)-150);percentBased=true;}
$pp_pic_holder.fadeIn(function(){(settings.show_title&&pp_titles[set_position]!=""&&typeof pp_titles[set_position]!="undefined")?$ppt.html(unescape(pp_titles[set_position])):$ppt.html('&nbsp;');imgPreloader="";skipInjection=false;switch(_getFileType(pp_images[set_position])){case'image':imgPreloader=new Image();nextImage=new Image();if(isSet&&set_position<$(pp_images).size()-1)nextImage.src=pp_images[set_position+1];prevImage=new Image();if(isSet&&pp_images[set_position-1])prevImage.src=pp_images[set_position-1];$pp_pic_holder.find('#pp_full_res')[0].innerHTML=settings.image_markup.replace(/{path}/g,pp_images[set_position]);imgPreloader.onload=function(){pp_dimensions=_fitToViewport(imgPreloader.width,imgPreloader.height);_showContent();};imgPreloader.onerror=function(){alert('Image cannot be loaded. Make sure the path is correct and image exist.');$.prettyPhoto.close();};imgPreloader.src=pp_images[set_position];break;case'youtube':pp_dimensions=_fitToViewport(movie_width,movie_height);movie_id=getParam('v',pp_images[set_position]);if(movie_id==""){movie_id=pp_images[set_position].split('youtu.be/');movie_id=movie_id[1];if(movie_id.indexOf('?')>0)
movie_id=movie_id.substr(0,movie_id.indexOf('?'));if(movie_id.indexOf('&')>0)
movie_id=movie_id.substr(0,movie_id.indexOf('&'));}
movie='http://www.youtube.com/embed/'+movie_id;(getParam('rel',pp_images[set_position]))?movie+="?rel="+getParam('rel',pp_images[set_position]):movie+="?rel=1";if(settings.autoplay)movie+="&autoplay=1";toInject=settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);break;case'vimeo':pp_dimensions=_fitToViewport(movie_width,movie_height);movie_id=pp_images[set_position];var regExp=/http:\/\/(www\.)?vimeo.com\/(\d+)/;var match=movie_id.match(regExp);movie='http://player.vimeo.com/video/'+match[2]+'?title=0&amp;byline=0&amp;portrait=0';if(settings.autoplay)movie+="&autoplay=1;";vimeo_width=pp_dimensions['width']+'/embed/?moog_width='+pp_dimensions['width'];toInject=settings.iframe_markup.replace(/{width}/g,vimeo_width).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,movie);break;case'quicktime':pp_dimensions=_fitToViewport(movie_width,movie_height);pp_dimensions['height']+=15;pp_dimensions['contentHeight']+=15;pp_dimensions['containerHeight']+=15;toInject=settings.quicktime_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,pp_images[set_position]).replace(/{autoplay}/g,settings.autoplay);break;case'flash':pp_dimensions=_fitToViewport(movie_width,movie_height);flash_vars=pp_images[set_position];flash_vars=flash_vars.substring(pp_images[set_position].indexOf('flashvars')+10,pp_images[set_position].length);filename=pp_images[set_position];filename=filename.substring(0,filename.indexOf('?'));toInject=settings.flash_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+'?'+flash_vars);break;case'iframe':pp_dimensions=_fitToViewport(movie_width,movie_height);frame_url=pp_images[set_position];frame_url=frame_url.substr(0,frame_url.indexOf('iframe')-1);toInject=settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,frame_url);break;case'ajax':doresize=false;pp_dimensions=_fitToViewport(movie_width,movie_height);doresize=true;skipInjection=true;$.get(pp_images[set_position],function(responseHTML){toInject=settings.inline_markup.replace(/{content}/g,responseHTML);$pp_pic_holder.find('#pp_full_res')[0].innerHTML=toInject;_showContent();});break;case'custom':pp_dimensions=_fitToViewport(movie_width,movie_height);toInject=settings.custom_markup;break;case'inline':myClone=$(pp_images[set_position]).clone().append('<br clear="all" />').css({'width':settings.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline"></div></div>').appendTo($('body')).show();doresize=false;pp_dimensions=_fitToViewport($(myClone).width(),$(myClone).height());doresize=true;$(myClone).remove();toInject=settings.inline_markup.replace(/{content}/g,$(pp_images[set_position]).html());break;};if(!imgPreloader&&!skipInjection){$pp_pic_holder.find('#pp_full_res')[0].innerHTML=toInject;_showContent();};});return false;};$.prettyPhoto.changePage=function(direction){currentGalleryPage=0;if(direction=='previous'){set_position--;if(set_position<0)set_position=$(pp_images).size()-1;}else if(direction=='next'){set_position++;if(set_position>$(pp_images).size()-1)set_position=0;}else{set_position=direction;};rel_index=set_position;if(!doresize)doresize=true;$('.pp_contract').removeClass('pp_contract').addClass('pp_expand');_hideContent(function(){$.prettyPhoto.open();});};$.prettyPhoto.changeGalleryPage=function(direction){if(direction=='next'){currentGalleryPage++;if(currentGalleryPage>totalPage)currentGalleryPage=0;}else if(direction=='previous'){currentGalleryPage--;if(currentGalleryPage<0)currentGalleryPage=totalPage;}else{currentGalleryPage=direction;};slide_speed=(direction=='next'||direction=='previous')?settings.animation_speed:0;slide_to=currentGalleryPage*(itemsPerPage*itemWidth);$pp_gallery.find('ul').animate({left:-slide_to},slide_speed);};$.prettyPhoto.startSlideshow=function(){if(typeof pp_slideshow=='undefined'){$pp_pic_holder.find('.pp_play').unbind('click').removeClass('pp_play').addClass('pp_pause').click(function(){$.prettyPhoto.stopSlideshow();return false;});pp_slideshow=setInterval($.prettyPhoto.startSlideshow,settings.slideshow);}else{$.prettyPhoto.changePage('next');};}
$.prettyPhoto.stopSlideshow=function(){$pp_pic_holder.find('.pp_pause').unbind('click').removeClass('pp_pause').addClass('pp_play').click(function(){$.prettyPhoto.startSlideshow();return false;});clearInterval(pp_slideshow);pp_slideshow=undefined;}
$.prettyPhoto.close=function(){if($pp_overlay.is(":animated"))return;$.prettyPhoto.stopSlideshow();$pp_pic_holder.stop().find('object,embed').css('visibility','hidden');$('div.pp_pic_holder,div.ppt,.pp_fade').fadeOut(settings.animation_speed,function(){$(this).remove();});$pp_overlay.fadeOut(settings.animation_speed,function(){if($.browser.msie&&$.browser.version==6)$('select').css('visibility','visible');if(settings.hideflash)$('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','visible');$(this).remove();$(window).unbind('scroll.prettyphoto');clearHashtag();settings.callback();doresize=true;pp_open=false;delete settings;});};function _showContent(){$('.pp_loaderIcon').hide();projectedTop=scroll_pos['scrollTop']+((windowHeight/2)-(pp_dimensions['containerHeight']/2));if(projectedTop<0)projectedTop=0;$ppt.fadeTo(settings.animation_speed,1);$pp_pic_holder.find('.pp_content').animate({height:pp_dimensions['contentHeight'],width:pp_dimensions['contentWidth']},settings.animation_speed);$pp_pic_holder.animate({'top':projectedTop,'left':(windowWidth/2)-(pp_dimensions['containerWidth']/2),width:pp_dimensions['containerWidth']},settings.animation_speed,function(){$pp_pic_holder.find('.pp_hoverContainer,#fullResImage').height(pp_dimensions['height']).width(pp_dimensions['width']);$pp_pic_holder.find('.pp_fade').fadeIn(settings.animation_speed);if(isSet&&_getFileType(pp_images[set_position])=="image"){$pp_pic_holder.find('.pp_hoverContainer').show();}else{$pp_pic_holder.find('.pp_hoverContainer').hide();}
if(pp_dimensions['resized']){$('a.pp_expand,a.pp_contract').show();}else{$('a.pp_expand').hide();}
if(settings.autoplay_slideshow&&!pp_slideshow&&!pp_open)$.prettyPhoto.startSlideshow();settings.changepicturecallback();pp_open=true;});_insert_gallery();};function _hideContent(callback){$pp_pic_holder.find('#pp_full_res object,#pp_full_res embed').css('visibility','hidden');$pp_pic_holder.find('.pp_fade').fadeOut(settings.animation_speed,function(){$('.pp_loaderIcon').show();callback();});};function _checkPosition(setCount){(setCount>1)?$('.pp_nav').show():$('.pp_nav').hide();};function _fitToViewport(width,height){resized=false;_getDimensions(width,height);imageWidth=width,imageHeight=height;if(((pp_containerWidth>windowWidth)||(pp_containerHeight>windowHeight))&&doresize&&settings.allow_resize&&!percentBased){resized=true,fitting=false;while(!fitting){if((pp_containerWidth>windowWidth)){imageWidth=(windowWidth-200);imageHeight=(height/width)*imageWidth;}else if((pp_containerHeight>windowHeight)){imageHeight=(windowHeight-200);imageWidth=(width/height)*imageHeight;}else{fitting=true;};pp_containerHeight=imageHeight,pp_containerWidth=imageWidth;};_getDimensions(imageWidth,imageHeight);if((pp_containerWidth>windowWidth)||(pp_containerHeight>windowHeight)){_fitToViewport(pp_containerWidth,pp_containerHeight)};};return{width:Math.floor(imageWidth),height:Math.floor(imageHeight),containerHeight:Math.floor(pp_containerHeight),containerWidth:Math.floor(pp_containerWidth)+(settings.horizontal_padding*2),contentHeight:Math.floor(pp_contentHeight),contentWidth:Math.floor(pp_contentWidth),resized:resized};};function _getDimensions(width,height){width=parseFloat(width);height=parseFloat(height);$pp_details=$pp_pic_holder.find('.pp_details');$pp_details.width(width);detailsHeight=parseFloat($pp_details.css('marginTop'))+parseFloat($pp_details.css('marginBottom'));$pp_details=$pp_details.clone().addClass(settings.theme).width(width).appendTo($('body')).css({'position':'absolute','top':-10000});detailsHeight+=$pp_details.height();detailsHeight=(detailsHeight<=34)?36:detailsHeight;if($.browser.msie&&$.browser.version==7)detailsHeight+=8;$pp_details.remove();$pp_title=$pp_pic_holder.find('.ppt');$pp_title.width(width);titleHeight=parseFloat($pp_title.css('marginTop'))+parseFloat($pp_title.css('marginBottom'));$pp_title=$pp_title.clone().appendTo($('body')).css({'position':'absolute','top':-10000});titleHeight+=$pp_title.height();$pp_title.remove();pp_contentHeight=height+detailsHeight;pp_contentWidth=width;pp_containerHeight=pp_contentHeight+titleHeight+$pp_pic_holder.find('.pp_top').height()+$pp_pic_holder.find('.pp_bottom').height();pp_containerWidth=width;}
function _getFileType(itemSrc){if(itemSrc.match(/youtube\.com\/watch/i)||itemSrc.match(/youtu\.be/i)){return'youtube';}else if(itemSrc.match(/vimeo\.com/i)){return'vimeo';}else if(itemSrc.match(/\b.mov\b/i)){return'quicktime';}else if(itemSrc.match(/\b.swf\b/i)){return'flash';}else if(itemSrc.match(/\biframe=true\b/i)){return'iframe';}else if(itemSrc.match(/\bajax=true\b/i)){return'ajax';}else if(itemSrc.match(/\bcustom=true\b/i)){return'custom';}else if(itemSrc.substr(0,1)=='#'){return'inline';}else{return'image';};};function _center_overlay(){if(doresize&&typeof $pp_pic_holder!='undefined'){scroll_pos=_get_scroll();contentHeight=$pp_pic_holder.height(),contentwidth=$pp_pic_holder.width();projectedTop=(windowHeight/2)+scroll_pos['scrollTop']-(contentHeight/2);if(projectedTop<0)projectedTop=0;if(contentHeight>windowHeight)
return;$pp_pic_holder.css({'top':projectedTop,'left':(windowWidth/2)+scroll_pos['scrollLeft']-(contentwidth/2)});};};function _get_scroll(){if(self.pageYOffset){return{scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset};}else if(document.documentElement&&document.documentElement.scrollTop){return{scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft};}else if(document.body){return{scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft};};};function _resize_overlay(){windowHeight=$(window).height(),windowWidth=$(window).width();if(typeof $pp_overlay!="undefined")$pp_overlay.height($(document).height()).width(windowWidth);};function _insert_gallery(){if(isSet&&settings.overlay_gallery&&_getFileType(pp_images[set_position])=="image"&&(settings.ie6_fallback&&!($.browser.msie&&parseInt($.browser.version)==6))){itemWidth=52+5;navWidth=(settings.theme=="facebook"||settings.theme=="pp_default")?50:30;itemsPerPage=Math.floor((pp_dimensions['containerWidth']-100-navWidth)/itemWidth);itemsPerPage=(itemsPerPage<pp_images.length)?itemsPerPage:pp_images.length;totalPage=Math.ceil(pp_images.length/itemsPerPage)-1;if(totalPage==0){navWidth=0;$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').hide();}else{$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').show();};galleryWidth=itemsPerPage*itemWidth;fullGalleryWidth=pp_images.length*itemWidth;$pp_gallery.css('margin-left',-((galleryWidth/2)+(navWidth/2))).find('div:first').width(galleryWidth+5).find('ul').width(fullGalleryWidth).find('li.selected').removeClass('selected');goToPage=(Math.floor(set_position/itemsPerPage)<totalPage)?Math.floor(set_position/itemsPerPage):totalPage;$.prettyPhoto.changeGalleryPage(goToPage);$pp_gallery_li.filter(':eq('+set_position+')').addClass('selected');}else{$pp_pic_holder.find('.pp_content').unbind('mouseenter mouseleave');}}
function _build_overlay(caller){if(settings.social_tools)
facebook_like_link=settings.social_tools.replace('{location_href}',encodeURIComponent(location.href));settings.markup=settings.markup.replace('{pp_social}',(settings.social_tools)?facebook_like_link:'');$('body').append(settings.markup);$pp_pic_holder=$('.pp_pic_holder'),$ppt=$('.ppt'),$pp_overlay=$('div.pp_overlay');if(isSet&&settings.overlay_gallery){currentGalleryPage=0;toInject="";for(var i=0;i<pp_images.length;i++){if(!pp_images[i].match(/\b(jpg|jpeg|png|gif)\b/gi)){classname='default';img_src='';}else{classname='';img_src=pp_images[i];}
toInject+="<li class='"+classname+"'><a href='#'><img src='"+img_src+"' width='50' alt='' /></a></li>";};toInject=settings.gallery_markup.replace(/{gallery}/g,toInject);$pp_pic_holder.find('#pp_full_res').after(toInject);$pp_gallery=$('.pp_pic_holder .pp_gallery'),$pp_gallery_li=$pp_gallery.find('li');$pp_gallery.find('.pp_arrow_next').click(function(){$.prettyPhoto.changeGalleryPage('next');$.prettyPhoto.stopSlideshow();return false;});$pp_gallery.find('.pp_arrow_previous').click(function(){$.prettyPhoto.changeGalleryPage('previous');$.prettyPhoto.stopSlideshow();return false;});$pp_pic_holder.find('.pp_content').hover(function(){$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeIn();},function(){$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeOut();});itemWidth=52+5;$pp_gallery_li.each(function(i){$(this).find('a').click(function(){$.prettyPhoto.changePage(i);$.prettyPhoto.stopSlideshow();return false;});});};if(settings.slideshow){$pp_pic_holder.find('.pp_nav').prepend('<a href="#" class="pp_play">Play</a>')
$pp_pic_holder.find('.pp_nav .pp_play').click(function(){$.prettyPhoto.startSlideshow();return false;});}
$pp_pic_holder.attr('class','pp_pic_holder '+settings.theme);$pp_overlay.css({'opacity':0,'height':$(document).height(),'width':$(window).width()}).bind('click',function(){if(!settings.modal)$.prettyPhoto.close();});$('a.pp_close').bind('click',function(){$.prettyPhoto.close();return false;});$('a.pp_expand').bind('click',function(e){if($(this).hasClass('pp_expand')){$(this).removeClass('pp_expand').addClass('pp_contract');doresize=false;}else{$(this).removeClass('pp_contract').addClass('pp_expand');doresize=true;};_hideContent(function(){$.prettyPhoto.open();});return false;});$pp_pic_holder.find('.pp_previous, .pp_nav .pp_arrow_previous').bind('click',function(){$.prettyPhoto.changePage('previous');$.prettyPhoto.stopSlideshow();return false;});$pp_pic_holder.find('.pp_next, .pp_nav .pp_arrow_next').bind('click',function(){$.prettyPhoto.changePage('next');$.prettyPhoto.stopSlideshow();return false;});_center_overlay();};if(!pp_alreadyInitialized&&getHashtag()){pp_alreadyInitialized=true;hashIndex=getHashtag();hashRel=hashIndex;hashIndex=hashIndex.substring(hashIndex.indexOf('/')+1,hashIndex.length-1);hashRel=hashRel.substring(0,hashRel.indexOf('/'));setTimeout(function(){$("a[rel^='"+hashRel+"']:eq("+hashIndex+")").trigger('click');},50);}
return this.unbind('click.prettyphoto').bind('click.prettyphoto',$.prettyPhoto.initialize);};function getHashtag(){url=location.href;hashtag=(url.indexOf('#!')!=-1)?decodeURI(url.substring(url.indexOf('#!')+2,url.length)):false;return hashtag;};function setHashtag(){if(typeof theRel=='undefined')return;location.hash='!'+theRel+'/'+rel_index+'/';};function clearHashtag(){url=location.href;hashtag=(url.indexOf('#!prettyPhoto'))?true:false;if(hashtag)location.hash="!prettyPhoto";}
function getParam(name,url){name=name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");var regexS="[\\?&]"+name+"=([^&#]*)";var regex=new RegExp(regexS);var results=regex.exec(url);return(results==null)?"":results[1];}})(jQuery);var pp_alreadyInitialized=false;
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END PRETTYPHOTO

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START COLLAPSOR

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
* collapsor (1.1) // 2009.02.27 // <http://plugins.jquery.com/project/collapsor>
* 
* REQUIRES jQuery 1.2.3+ <http://jquery.com/>
* 
* Copyright (c) 2008 TrafficBroker <http://www.trafficbroker.co.uk>
* Licensed under GPL and MIT licenses
* 
* @author    Jesus Carrera <jesus.carrera@trafficbroker.co.uk>
*/
(function(a){a.fn.collapsor=function(c){c=a.extend({},a.fn.collapsor.defaults,c);var b=this;return this.each(function(){a(this).find("+ "+c.sublevelElement).hide();if(a(this).hasClass(c.openClass)){a(this).find("+ "+c.sublevelElement).show()}a(this).click(function(){if(a(this).next().is(c.sublevelElement)){a(this).blur().toggleClass(c.openClass);if(c.closeOthers==true){a(this).parent().parent().children().find("."+c.openClass).not(this).removeClass(c.openClass).next().animate({height:"toggle",opacity:"toggle"},c.speed,c.easing)}a(this).next().animate({height:"toggle",opacity:"toggle"},c.speed,c.easing);return false}})})};a.fn.collapsor.defaults={openClass:"open",sublevelElement:"ul",closeOthers:false,speed:500,easing:"swing"}})(jQuery);
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END COLLAPSOR

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START MASKED INPUT

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
	Masked Input plugin for jQuery
	Copyright (c) 2007-2011 Josh Bush (digitalbush.com)
	Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license) 
	Version: 1.3
*/
(function(a){var b=(a.browser.msie?"paste":"input")+".mask",c=window.orientation!=undefined;a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},dataName:"rawMaskFn"},a.fn.extend({caret:function(a,b){if(this.length!=0){if(typeof a=="number"){b=typeof b=="number"?b:a;return this.each(function(){if(this.setSelectionRange)this.setSelectionRange(a,b);else if(this.createTextRange){var c=this.createTextRange();c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select()}})}if(this[0].setSelectionRange)a=this[0].selectionStart,b=this[0].selectionEnd;else if(document.selection&&document.selection.createRange){var c=document.selection.createRange();a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length}return{begin:a,end:b}}},unmask:function(){return this.trigger("unmask")},mask:function(d,e){if(!d&&this.length>0){var f=a(this[0]);return f.data(a.mask.dataName)()}e=a.extend({placeholder:"_",completed:null},e);var g=a.mask.definitions,h=[],i=d.length,j=null,k=d.length;a.each(d.split(""),function(a,b){b=="?"?(k--,i=a):g[b]?(h.push(new RegExp(g[b])),j==null&&(j=h.length-1)):h.push(null)});return this.trigger("unmask").each(function(){function v(a){var b=f.val(),c=-1;for(var d=0,g=0;d<k;d++)if(h[d]){l[d]=e.placeholder;while(g++<b.length){var m=b.charAt(g-1);if(h[d].test(m)){l[d]=m,c=d;break}}if(g>b.length)break}else l[d]==b.charAt(g)&&d!=i&&(g++,c=d);if(!a&&c+1<i)f.val(""),t(0,k);else if(a||c+1>=i)u(),a||f.val(f.val().substring(0,c+1));return i?d:j}function u(){return f.val(l.join("")).val()}function t(a,b){for(var c=a;c<b&&c<k;c++)h[c]&&(l[c]=e.placeholder)}function s(a){var b=a.which,c=f.caret();if(a.ctrlKey||a.altKey||a.metaKey||b<32)return!0;if(b){c.end-c.begin!=0&&(t(c.begin,c.end),p(c.begin,c.end-1));var d=n(c.begin-1);if(d<k){var g=String.fromCharCode(b);if(h[d].test(g)){q(d),l[d]=g,u();var i=n(d);f.caret(i),e.completed&&i>=k&&e.completed.call(f)}}return!1}}function r(a){var b=a.which;if(b==8||b==46||c&&b==127){var d=f.caret(),e=d.begin,g=d.end;g-e==0&&(e=b!=46?o(e):g=n(e-1),g=b==46?n(g):g),t(e,g),p(e,g-1);return!1}if(b==27){f.val(m),f.caret(0,v());return!1}}function q(a){for(var b=a,c=e.placeholder;b<k;b++)if(h[b]){var d=n(b),f=l[b];l[b]=c;if(d<k&&h[d].test(f))c=f;else break}}function p(a,b){if(!(a<0)){for(var c=a,d=n(b);c<k;c++)if(h[c]){if(d<k&&h[c].test(l[d]))l[c]=l[d],l[d]=e.placeholder;else break;d=n(d)}u(),f.caret(Math.max(j,a))}}function o(a){while(--a>=0&&!h[a]);return a}function n(a){while(++a<=k&&!h[a]);return a}var f=a(this),l=a.map(d.split(""),function(a,b){if(a!="?")return g[a]?e.placeholder:a}),m=f.val();f.data(a.mask.dataName,function(){return a.map(l,function(a,b){return h[b]&&a!=e.placeholder?a:null}).join("")}),f.attr("readonly")||f.one("unmask",function(){f.unbind(".mask").removeData(a.mask.dataName)}).bind("focus.mask",function(){m=f.val();var b=v();u();var c=function(){b==d.length?f.caret(0,b):f.caret(b)};(a.browser.msie?c:function(){setTimeout(c,0)})()}).bind("blur.mask",function(){v(),f.val()!=m&&f.change()}).bind("keydown.mask",r).bind("keypress.mask",s).bind(b,function(){setTimeout(function(){f.caret(v(!0))},0)}),v()})}})})(jQuery)
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END MASKED INPUT

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START JSON_PARSE

********************************************************************************************************************************
********************************************************************************************************************************
*/

/*
********************************************************************************************************************************
	This routine contains an alternative JSON parse function that uses recursive
	descent instead of eval.

	http://www.json.org/
	https://github.com/douglascrockford/JSON-js
	http://jsfiddle.net/bizamajig/dw2nR/9/

********************************************************************************************************************************
*/
/*
    2011-03-06

    Public Domain.

    NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.

    This file creates a json_parse function.

        json_parse(text, reviver)
            This method parses a JSON text to produce an object or array.
            It can throw a SyntaxError exception.

            The optional reviver parameter is a function that can filter and
            transform the results. It receives each of the keys and values,
            and its return value is used instead of the original value.
            If it returns what it received, then the structure is not modified.
            If it returns undefined then the member is deleted.

            Example:

            // Parse the text. Values that look like ISO date strings will
            // be converted to Date objects.

            myData = json_parse(text, function (key, value) {
                var a;
                if (typeof value === 'string') {
                    a =
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
                    if (a) {
                        return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
                            +a[5], +a[6]));
                    }
                }
                return value;
            });

    This is a reference implementation. You are free to copy, modify, or
    redistribute.

    This code should be minified before deployment.
    See http://javascript.crockford.com/jsmin.html

    USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
    NOT CONTROL.
*/

/*members "", "\"", "\/", "\\", at, b, call, charAt, f, fromCharCode,
    hasOwnProperty, message, n, name, prototype, push, r, t, text
*/

var json_parse = (function () {
    "use strict";

// This is a function that can parse a JSON text, producing a JavaScript
// data structure. It is a simple, recursive descent parser. It does not use
// eval or regular expressions, so it can be used as a model for implementing
// a JSON parser in other languages.

// We are defining the function inside of another function to avoid creating
// global variables.

    var at,     // The index of the current character
        ch,     // The current character
        escapee = {
            '"':  '"',
            '\\': '\\',
            '/':  '/',
            b:    '\b',
            f:    '\f',
            n:    '\n',
            r:    '\r',
            t:    '\t'
        },
        text,

        error = function (m) {

// Call error when something is wrong.

            throw {
                name:    'SyntaxError',
                message: m,
                at:      at,
                text:    text
            };
        },

        next = function (c) {

// If a c parameter is provided, verify that it matches the current character.

            if (c && c !== ch) {
                error("Expected '" + c + "' instead of '" + ch + "'");
            }

// Get the next character. When there are no more characters,
// return the empty string.

            ch = text.charAt(at);
            at += 1;
            return ch;
        },

        number = function () {

// Parse a number value.

            var number,
                string = '';

            if (ch === '-') {
                string = '-';
                next('-');
            }
            while (ch >= '0' && ch <= '9') {
                string += ch;
                next();
            }
            if (ch === '.') {
                string += '.';
                while (next() && ch >= '0' && ch <= '9') {
                    string += ch;
                }
            }
            if (ch === 'e' || ch === 'E') {
                string += ch;
                next();
                if (ch === '-' || ch === '+') {
                    string += ch;
                    next();
                }
                while (ch >= '0' && ch <= '9') {
                    string += ch;
                    next();
                }
            }
            number = +string;
            if (!isFinite(number)) {
                error("Bad number");
            } else {
                return number;
            }
        },

        string = function () {

// Parse a string value.

            var hex,
                i,
                string = '',
                uffff;

// When parsing for string values, we must look for " and \ characters.

            if (ch === '"') {
                while (next()) {
                    if (ch === '"') {
                        next();
                        return string;
                    } else if (ch === '\\') {
                        next();
                        if (ch === 'u') {
                            uffff = 0;
                            for (i = 0; i < 4; i += 1) {
                                hex = parseInt(next(), 16);
                                if (!isFinite(hex)) {
                                    break;
                                }
                                uffff = uffff * 16 + hex;
                            }
                            string += String.fromCharCode(uffff);
                        } else if (typeof escapee[ch] === 'string') {
                            string += escapee[ch];
                        } else {
                            break;
                        }
                    } else {
                        string += ch;
                    }
                }
            }
            error("Bad string");
        },

        white = function () {

// Skip whitespace.

            while (ch && ch <= ' ') {
                next();
            }
        },

        word = function () {

// true, false, or null.

            switch (ch) {
            case 't':
                next('t');
                next('r');
                next('u');
                next('e');
                return true;
            case 'f':
                next('f');
                next('a');
                next('l');
                next('s');
                next('e');
                return false;
            case 'n':
                next('n');
                next('u');
                next('l');
                next('l');
                return null;
            }
            error("Unexpected '" + ch + "'");
        },

        value,  // Place holder for the value function.

        array = function () {

// Parse an array value.

            var array = [];

            if (ch === '[') {
                next('[');
                white();
                if (ch === ']') {
                    next(']');
                    return array;   // empty array
                }
                while (ch) {
                    array.push(value());
                    white();
                    if (ch === ']') {
                        next(']');
                        return array;
                    }
                    next(',');
                    white();
                }
            }
            error("Bad array");
        },

        object = function () {

// Parse an object value.

            var key,
                object = {};

            if (ch === '{') {
                next('{');
                white();
                if (ch === '}') {
                    next('}');
                    return object;   // empty object
                }
                while (ch) {
                    key = string();
                    white();
                    next(':');
                    if (Object.hasOwnProperty.call(object, key)) {
                        error('Duplicate key "' + key + '"');
                    }
                    object[key] = value();
                    white();
                    if (ch === '}') {
                        next('}');
                        return object;
                    }
                    next(',');
                    white();
                }
            }
            error("Bad object");
        };

    value = function () {

// Parse a JSON value. It could be an object, an array, a string, a number,
// or a word.

        white();
        switch (ch) {
        case '{':
            return object();
        case '[':
            return array();
        case '"':
            return string();
        case '-':
            return number();
        default:
            return ch >= '0' && ch <= '9' ? number() : word();
        }
    };

// Return the json_parse function. It will have access to all of the above
// functions and variables.

    return function (source, reviver) {
        var result;

        text = source;
        at = 0;
        ch = ' ';
        result = value();
        white();
        if (ch) {
            error("Syntax error");
        }

// If there is a reviver function, we recursively walk the new structure,
// passing each name/value pair to the reviver function for possible
// transformation, starting with a temporary root object that holds the result
// in an empty key. If there is not a reviver function, we simply return the
// result.

        return typeof reviver === 'function' ? (function walk(holder, key) {
            var k, v, value = holder[key];
            if (value && typeof value === 'object') {
                for (k in value) {
                    if (Object.prototype.hasOwnProperty.call(value, k)) {
                        v = walk(value, k);
                        if (v !== undefined) {
                            value[k] = v;
                        } else {
                            delete value[k];
                        }
                    }
                }
            }
            return reviver.call(holder, key, value);
        }({'': result}, '')) : result;
    };
}());
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END JSON_PARSE

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START JSCROLL

********************************************************************************************************************************
********************************************************************************************************************************
*/
(function($){$.fn.jScroll=function(e){var f=$.extend({},$.fn.jScroll.defaults,e);return this.each(function(){var a=$(this);var b=$(window);var c=new location(a);b.scroll(function(){a.stop().animate(c.getMargin(b),f.speed)})});function location(d){this.min=d.offset().top;this.originalMargin=parseInt(d.css("margin-top"),10)||0;this.getMargin=function(a){var b=d.parent().height()-d.outerHeight();var c=this.originalMargin;if(a.scrollTop()>=this.min)c=c+f.top+a.scrollTop()-this.min;if(c>b)c=b;return({"marginTop":c+'px'})}}};$.fn.jScroll.defaults={speed:"slow",top:10}})(jQuery);
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END JSCROLL

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START TEXTAREA

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
 * jQuery Textarea Characters Counter Plugin v 2.0
 * Examples and documentation at: http://roy-jin.appspot.com/jsp/textareaCounter.jsp
 * Copyright (c) 2010 Roy Jin
 * Version: 2.0 (11-JUN-2010)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * Requires: jQuery v1.4.2 or later
 */
(function($){  
	$.fn.textareaCount = function(options, fn) {   
		var defaults = {  
			maxCharacterSize: -1,  
			originalStyle: 'originalTextareaInfo',
			warningStyle: 'warningTextareaInfo',  
			warningNumber: 20,
			displayFormat: '#input characters | #words words'
		};  
		var options = $.extend(defaults, options);
		
		var container = $(this);
		
		$("<div class='charleft'>&nbsp;</div>").insertAfter(container);
		
		//create charleft css
		var charLeftCss = {
			'width' : container.width()
		};
		
		var charLeftInfo = getNextCharLeftInformation(container);
		charLeftInfo.addClass(options.originalStyle);
		charLeftInfo.css(charLeftCss);
		
		var numInput = 0;
		var maxCharacters = options.maxCharacterSize;
		var numLeft = 0;
		var numWords = 0;
				
		container.bind('keyup', function(event){limitTextAreaByCharacterCount();})
				 .bind('mouseover', function(event){setTimeout(function(){limitTextAreaByCharacterCount();}, 10);})
				 .bind('paste', function(event){setTimeout(function(){limitTextAreaByCharacterCount();}, 10);});
		
		
		function limitTextAreaByCharacterCount(){
			charLeftInfo.html(countByCharacters());
			//function call back
			if(typeof fn != 'undefined'){
				fn.call(this, getInfo());
			}
			return true;
		}
		
		function countByCharacters(){
			var content = container.val();
			var contentLength = content.length;
			
			//Start Cut
			if(options.maxCharacterSize > 0){
				//If copied content is already more than maxCharacterSize, chop it to maxCharacterSize.
				if(contentLength >= options.maxCharacterSize) {
					content = content.substring(0, options.maxCharacterSize); 				
				}
				
				var newlineCount = getNewlineCount(content);
				
				// newlineCount new line character. For windows, it occupies 2 characters
				var systemmaxCharacterSize = options.maxCharacterSize - newlineCount;
				if (!isWin()){
					 systemmaxCharacterSize = options.maxCharacterSize
				}
				if(contentLength > systemmaxCharacterSize){
					//avoid scroll bar moving
					var originalScrollTopPosition = this.scrollTop;
					container.val(content.substring(0, systemmaxCharacterSize));
					this.scrollTop = originalScrollTopPosition;
				}
				charLeftInfo.removeClass(options.warningStyle);
				if(systemmaxCharacterSize - contentLength <= options.warningNumber){
					charLeftInfo.addClass(options.warningStyle);
				}
				
				numInput = container.val().length + newlineCount;
				if(!isWin()){
					numInput = container.val().length;
				}
			
				numWords = countWord(getCleanedWordString(container.val()));
				
				numLeft = maxCharacters - numInput;
			} else {
				//normal count, no cut
				var newlineCount = getNewlineCount(content);
				numInput = container.val().length + newlineCount;
				if(!isWin()){
					numInput = container.val().length;
				}
				numWords = countWord(getCleanedWordString(container.val()));
			}
			
			return formatDisplayInfo();
		}
		
		function formatDisplayInfo(){
			var format = options.displayFormat;
			format = format.replace('#input', numInput);
			format = format.replace('#words', numWords);
			//When maxCharacters <= 0, #max, #left cannot be substituted.
			if(maxCharacters > 0){
				format = format.replace('#max', maxCharacters);
				format = format.replace('#left', numLeft);
			}
			return format;
		}
		
		function getInfo(){
			var info = {
				input: numInput,
				max: maxCharacters,
				left: numLeft,
				words: numWords
			};
			return info;
		}
		
		function getNextCharLeftInformation(container){
				return container.next('.charleft');
		}
		
		function isWin(){
			var strOS = navigator.appVersion;
			if (strOS.toLowerCase().indexOf('win') != -1){
				return true;
			}
			return false;
		}
		
		function getNewlineCount(content){
			var newlineCount = 0;
			for(var i=0; i<content.length;i++){
				if(content.charAt(i) == '\n'){
					newlineCount++;
				}
			}
			return newlineCount;
		}
		
		function getCleanedWordString(content){
			var fullStr = content + " ";
			var initial_whitespace_rExp = /^[^A-Za-z0-9]+/gi;
			var left_trimmedStr = fullStr.replace(initial_whitespace_rExp, "");
			var non_alphanumerics_rExp = rExp = /[^A-Za-z0-9]+/gi;
			var cleanedStr = left_trimmedStr.replace(non_alphanumerics_rExp, " ");
			var splitString = cleanedStr.split(" ");
			return splitString;
		}
		
		function countWord(cleanedWordString){
			var word_count = cleanedWordString.length-1;
			return word_count;
		}
	};  
})(jQuery); 
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END TEXTAREA

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START BIZAMAJIG FILTER EMAIL

********************************************************************************************************************************
********************************************************************************************************************************
*/
function bizamajig__filter__email( str ) {
	var filter = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
	return filter.test( str );
}
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END BIZAMAJIG FILTER EMAIL

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START JCAROUSEL

********************************************************************************************************************************
********************************************************************************************************************************
*/
function resettoggle_dispaly(id) {
var e = document.getElementById(id);
e.style.display = 'none';
}

function toggle_visibility(id,default_state) {
	var e = document.getElementById(id);
	if(e.style.visibility == 'hidden')
		e.style.visibility = 'visible';
	else
		e.style.visibility = default_state;
}

function toggle_display(id,default_state) {
//	document.getElementById('category_page2').style.display = 'none';
	var e = document.getElementById(id);
	if(e.style.display == 'block')
		e.style.display = 'none';
	else
		e.style.display = default_state;
}

// JQuery Slide navigation
function showPage(s) {
    // Get the selected slide element
    var selected = jQuery('#category_page' + s);

    // Get all the other slides
    var pages = jQuery('#store_category_page_container .page:visible').not('#category_page' + s);

    // Show the selected slide and hide the others
    pages.fadeOut('fast', function() {selected.fadeIn('fast');});

    // Activate the corresponding tab
    jQuery('#store_category_nav_container .active').removeClass('active');
    jQuery('#store_category_nav_container #tab-' + s).addClass('active');
    
    return false;
}
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END JCAROUSEL

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START SLIDELOCK

********************************************************************************************************************************
********************************************************************************************************************************
*/
// slideLock JQuery Plugin
/*

	slideLock adds a JQuery UI slider along with 'lock' and 
	'unlock' labels. Be sure to upload the default arrow icon 
	or change the path in the options. 
	
	The purpose of this plugin is to provide an alternative to
	traditional CAPTCHA. The user simply slides the lock open
	and the plugin sets a value for the server to check. 
		
	You still need to check on the server side the value of the 
	inserted hidden field with the name and id of 'inputID'.
	You can set these values in the options and must be integers.
	
	*** REQUIRES >= jQuery 1.5 	   ***
	*** REQUIRES jQuery UI >= 1.8  ***
	
	Version 3.0
		- TODO: improved accessibility
				clean up CSS
				rewrite for speed and clarity
	
	Version 2.1
		- Now resets slider controls correctly when an form is submitted
		  via AJAX. 
	
	Version: 2.0
		- Fixed a bug that causes the plugin to fail when the ID of
		  the inputs are changed -- thanks to Steve Kruse <steve@wnywebsites.com>
		  
		- Includes revised PHP code to allow for Javascript being disabled
	
*/
(function($) {
		  
	$.fn.slideLock = function(options) {
		
		// set defaults
		var defaults = {
		
			// style these options with css to fit your application
			labelText: "Slide to Unlock:",
			noteText: "Proves you're human",
			lockText: "Locked",
			unlockText: "Unlocked",
			inputID: "sliderInput",
			onCSS: "#333",
			offCSS: "#aaa",
			// TODO: these values need to be more secure
			// consider getting them from the server, etc.
			inputValue: 1,
			saltValue: 9,
			checkValue: 10,
			js_check: "js_check",
			submitID: "#submit",
			tabIndex: 0
									 
		};
		
		var opts = $.extend(defaults, options);
		
		// remove hidden form field to allow for server side validation
		$("#" + opts.js_check).remove();
		
		// insert ui function
		function insertLocker() {
			
			var uiHTML = '<p class="slider"><label for="slider" id="sliderLabel">' + opts.labelText + '<br/><span class="quiet">' + opts.noteText + '</span></label>';
			uiHTML += '<div id="slider" title="Slide to unlock this form" tabindex="' + opts.tabIndex + '"></div></p>';
			uiHTML += '<p class="quiet"><span id="locked">' + opts.lockText + '</span><img src="' + opts.iconURL + '" alt="Slide to the right" class="ui-icon ui-icon-arrowthick-2-e-w" /><span id="unlocked">' + opts.unlockText + '</span></p>';
			uiHTML += '<input type="hidden" name="' + opts.inputID + '" value="" id="' + opts.inputID + '" />';
			
			return uiHTML;
			
		}
				
		return this.each(function() {
			
			var obj = $(this);
			
			// insert ui elements before the form's submit button
			var submitButton = $(opts.submitID);	
			submitButton.before(insertLocker());
			
			// disable submit button
//
//			Bizamajig Customization:
//
//			$(submitButton).css('margin-top', '15px').attr('disabled', 'disabled');
			$(submitButton).css('margin-top', '15px').hide();
			
			// slider functionality
			$("#slider", obj).slider({
				
				animate: true,
				value: 0,
				min: 0,
				max: opts.inputValue,
				step: opts.inputValue,
				stop: function(event, ui) {
					
					// set value of usercheck
					$("#" + opts.inputID, obj).val(ui.value + opts.saltValue);
					
					// enable submit button
					if($("#" + opts.inputID, obj).val() == opts.checkValue) {
						
						// set value of aria-valuenow & aria-valuetext
						$(".ui-slider-handle").attr({
							'aria-valuenow': ui.value,
							'aria-valuetext': 'Form is unlocked'
						});
						
						// change color of labels
						$("#locked", obj).css({'color': opts.offCSS, 'font-weight': 'normal'});
						$("#unlocked", obj).css({'color': opts.onCSS, 'font-weight': 'bold'});
						
						// enable
//
//						Bizamajig Customization:
//
//						$(submitButton).attr('disabled', ''); 
						$(submitButton).show();
//						$(submitButton).parents('form:first').remove();
						$(submitButton).closest('form').remove(); 

					
					}else{
						
						// set value of aria-valuenow & aria-valuetext
						$(".ui-slider-handle").attr({
							'aria-valuenow': ui.value,
							'aria-valuetext': 'Form is locked'
						});
						
						// change color of labels
						$("#locked", obj).css({'color': opts.onCSS, 'font-weight': 'bold'});
						$("#unlocked", obj).css({'color': opts.offCSS, 'font-weight': 'normal'});
						
						// disable
						$(submitButton).attr('disabled', 'disabled');
					
					}
					
				}
				
			});
			
			// set WAI-ARIA attributes on the slider element
			$(".ui-slider").attr({ 
				'role': 'slider',
				'aria-labeledby': 'sliderLabel'
			});
			$(".ui-slider-handle").attr({
				'role': 'button',
				'aria-valuemin': 0,
				'aria-valuemax': 1,
				'aria-valuenow': 0,
				'aria-valuetext': 'Form is locked'
			});
			
			// reset slider control on submit or reset button click
			$("input:submit, input:reset").click(function() {
										   
				$("#slider").slider("option", "value", 0);						   
										   
			});
								  
		});
		
	};
		  
})(jQuery);
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END SLIDELOCK

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START BIZAMAJIG MEDIA PLAYER

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
 * JPlayer Plugin for jQuery JavaScript Library
 * http://www.jplayer.org
 *
 * Copyright (c) 2009 - 2011 Happyworm Ltd
 * Dual licensed under the MIT and GPL licenses.
 *  - http://www.opensource.org/licenses/mit-license.php
 *  - http://www.gnu.org/copyleft/gpl.html
 *
 * Author: Mark J Panaghiston
 * Version: 2.1.0
 * Date: 1st September 2011
 */

(function(b,f){b.fn.jPlayer=function(a){var c=typeof a==="string",d=Array.prototype.slice.call(arguments,1),e=this,a=!c&&d.length?b.extend.apply(null,[!0,a].concat(d)):a;if(c&&a.charAt(0)==="_")return e;c?this.each(function(){var c=b.data(this,"jPlayer"),h=c&&b.isFunction(c[a])?c[a].apply(c,d):c;if(h!==c&&h!==f)return e=h,!1}):this.each(function(){var c=b.data(this,"jPlayer");c?c.option(a||{}):b.data(this,"jPlayer",new b.jPlayer(a,this))});return e};b.jPlayer=function(a,c){if(arguments.length){this.element=
b(c);this.options=b.extend(!0,{},this.options,a);var d=this;this.element.bind("remove.jPlayer",function(){d.destroy()});this._init()}};b.jPlayer.emulateMethods="load play pause";b.jPlayer.emulateStatus="src readyState networkState currentTime duration paused ended playbackRate";b.jPlayer.emulateOptions="muted volume";b.jPlayer.reservedEvent="ready flashreset resize repeat error warning";b.jPlayer.event={ready:"jPlayer_ready",flashreset:"jPlayer_flashreset",resize:"jPlayer_resize",repeat:"jPlayer_repeat",
click:"jPlayer_click",error:"jPlayer_error",warning:"jPlayer_warning",loadstart:"jPlayer_loadstart",progress:"jPlayer_progress",suspend:"jPlayer_suspend",abort:"jPlayer_abort",emptied:"jPlayer_emptied",stalled:"jPlayer_stalled",play:"jPlayer_play",pause:"jPlayer_pause",loadedmetadata:"jPlayer_loadedmetadata",loadeddata:"jPlayer_loadeddata",waiting:"jPlayer_waiting",playing:"jPlayer_playing",canplay:"jPlayer_canplay",canplaythrough:"jPlayer_canplaythrough",seeking:"jPlayer_seeking",seeked:"jPlayer_seeked",
timeupdate:"jPlayer_timeupdate",ended:"jPlayer_ended",ratechange:"jPlayer_ratechange",durationchange:"jPlayer_durationchange",volumechange:"jPlayer_volumechange"};b.jPlayer.htmlEvent="loadstart,abort,emptied,stalled,loadedmetadata,loadeddata,canplay,canplaythrough,ratechange".split(",");b.jPlayer.pause=function(){b.each(b.jPlayer.prototype.instances,function(a,b){b.data("jPlayer").status.srcSet&&b.jPlayer("pause")})};b.jPlayer.timeFormat={showHour:!1,showMin:!0,showSec:!0,padHour:!1,padMin:!0,padSec:!0,
sepHour:":",sepMin:":",sepSec:""};b.jPlayer.convertTime=function(a){var c=new Date(a*1E3),d=c.getUTCHours(),a=c.getUTCMinutes(),c=c.getUTCSeconds(),d=b.jPlayer.timeFormat.padHour&&d<10?"0"+d:d,a=b.jPlayer.timeFormat.padMin&&a<10?"0"+a:a,c=b.jPlayer.timeFormat.padSec&&c<10?"0"+c:c;return(b.jPlayer.timeFormat.showHour?d+b.jPlayer.timeFormat.sepHour:"")+(b.jPlayer.timeFormat.showMin?a+b.jPlayer.timeFormat.sepMin:"")+(b.jPlayer.timeFormat.showSec?c+b.jPlayer.timeFormat.sepSec:"")};b.jPlayer.uaBrowser=
function(a){var a=a.toLowerCase(),b=/(opera)(?:.*version)?[ \/]([\w.]+)/,d=/(msie) ([\w.]+)/,e=/(mozilla)(?:.*? rv:([\w.]+))?/,a=/(webkit)[ \/]([\w.]+)/.exec(a)||b.exec(a)||d.exec(a)||a.indexOf("compatible")<0&&e.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}};b.jPlayer.uaPlatform=function(a){var b=a.toLowerCase(),d=/(android)/,e=/(mobile)/,a=/(ipad|iphone|ipod|android|blackberry|playbook|windows ce|webos)/.exec(b)||[],b=/(ipad|playbook)/.exec(b)||!e.exec(b)&&d.exec(b)||[];a[1]&&(a[1]=a[1].replace(/\s/g,
"_"));return{platform:a[1]||"",tablet:b[1]||""}};b.jPlayer.browser={};b.jPlayer.platform={};var i=b.jPlayer.uaBrowser(navigator.userAgent);if(i.browser)b.jPlayer.browser[i.browser]=!0,b.jPlayer.browser.version=i.version;i=b.jPlayer.uaPlatform(navigator.userAgent);if(i.platform)b.jPlayer.platform[i.platform]=!0,b.jPlayer.platform.mobile=!i.tablet,b.jPlayer.platform.tablet=!!i.tablet;b.jPlayer.prototype={count:0,version:{script:"2.1.0",needFlash:"2.1.0",flash:"unknown"},options:{swfPath:"js",solution:"html, flash",
supplied:"mp3",preload:"metadata",volume:0.8,muted:!1,wmode:"opaque",backgroundColor:/*Bizamajig Customization// "#000000"*/"#ffffff",cssSelectorAncestor:"#jp_container_1",cssSelector:{videoPlay:".jp-video-play",play:".jp-play",pause:".jp-pause",stop:".jp-stop",seekBar:".jp-seek-bar",playBar:".jp-play-bar",mute:".jp-mute",unmute:".jp-unmute",volumeBar:".jp-volume-bar",volumeBarValue:".jp-volume-bar-value",volumeMax:".jp-volume-max",currentTime:".jp-current-time",duration:".jp-duration",fullScreen:".jp-full-screen",restoreScreen:".jp-restore-screen",
repeat:".jp-repeat",repeatOff:".jp-repeat-off",gui:".jp-gui",noSolution:".jp-no-solution"},fullScreen:!1,autohide:{restored:!1,full:!0,fadeIn:200,fadeOut:600,hold:1E3},loop:!1,repeat:function(a){a.jPlayer.options.loop?b(this).unbind(".jPlayerRepeat").bind(b.jPlayer.event.ended+".jPlayer.jPlayerRepeat",function(){b(this).jPlayer("play")}):b(this).unbind(".jPlayerRepeat")},nativeVideoControls:{},noFullScreen:{msie:/msie [0-6]/,ipad:/ipad.*?os [0-4]/,iphone:/iphone/,ipod:/ipod/,android_pad:/android [0-3](?!.*?mobile)/,
android_phone:/android.*?mobile/,blackberry:/blackberry/,windows_ce:/windows ce/,webos:/webos/},noVolume:{ipad:/ipad/,iphone:/iphone/,ipod:/ipod/,android_pad:/android(?!.*?mobile)/,android_phone:/android.*?mobile/,blackberry:/blackberry/,windows_ce:/windows ce/,webos:/webos/,playbook:/playbook/},verticalVolume:!1,idPrefix:"jp",noConflict:"jQuery",emulateHtml:!1,errorAlerts:!1,warningAlerts:!1},optionsAudio:{size:{width:"0px",height:"0px",cssClass:""},sizeFull:{width:"0px",height:"0px",cssClass:""}},
optionsVideo:{size:{width:"480px",height:"270px",cssClass:"jp-video-270p"},sizeFull:{width:"100%",height:"100%",cssClass:"jp-video-full"}},instances:{},status:{src:"",media:{},paused:!0,format:{},formatType:"",waitForPlay:!0,waitForLoad:!0,srcSet:!1,video:!1,seekPercent:0,currentPercentRelative:0,currentPercentAbsolute:0,currentTime:0,duration:0,readyState:0,networkState:0,playbackRate:1,ended:0},internal:{ready:!1},solution:{html:!0,flash:!0},format:{mp3:{codec:'audio/mpeg; codecs="mp3"',flashCanPlay:!0,
media:"audio"},m4a:{codec:'audio/mp4; codecs="mp4a.40.2"',flashCanPlay:!0,media:"audio"},oga:{codec:'audio/ogg; codecs="vorbis"',flashCanPlay:!1,media:"audio"},wav:{codec:'audio/wav; codecs="1"',flashCanPlay:!1,media:"audio"},webma:{codec:'audio/webm; codecs="vorbis"',flashCanPlay:!1,media:"audio"},fla:{codec:"audio/x-flv",flashCanPlay:!0,media:"audio"},m4v:{codec:'video/mp4; codecs="avc1.42E01E, mp4a.40.2"',flashCanPlay:!0,media:"video"},ogv:{codec:'video/ogg; codecs="theora, vorbis"',flashCanPlay:!1,
media:"video"},webmv:{codec:'video/webm; codecs="vorbis, vp8"',flashCanPlay:!1,media:"video"},flv:{codec:"video/x-flv",flashCanPlay:!0,media:"video"}},_init:function(){var a=this;this.element.empty();this.status=b.extend({},this.status);this.internal=b.extend({},this.internal);this.internal.domNode=this.element.get(0);this.formats=[];this.solutions=[];this.require={};this.htmlElement={};this.html={};this.html.audio={};this.html.video={};this.flash={};this.css={};this.css.cs={};this.css.jq={};this.ancestorJq=
[];this.options.volume=this._limitValue(this.options.volume,0,1);b.each(this.options.supplied.toLowerCase().split(","),function(c,d){var e=d.replace(/^\s+|\s+$/g,"");if(a.format[e]){var f=!1;b.each(a.formats,function(a,b){if(e===b)return f=!0,!1});f||a.formats.push(e)}});b.each(this.options.solution.toLowerCase().split(","),function(c,d){var e=d.replace(/^\s+|\s+$/g,"");if(a.solution[e]){var f=!1;b.each(a.solutions,function(a,b){if(e===b)return f=!0,!1});f||a.solutions.push(e)}});this.internal.instance=
"jp_"+this.count;this.instances[this.internal.instance]=this.element;this.element.attr("id")||this.element.attr("id",this.options.idPrefix+"_jplayer_"+this.count);this.internal.self=b.extend({},{id:this.element.attr("id"),jq:this.element});this.internal.audio=b.extend({},{id:this.options.idPrefix+"_audio_"+this.count,jq:f});this.internal.video=b.extend({},{id:this.options.idPrefix+"_video_"+this.count,jq:f});this.internal.flash=b.extend({},{id:this.options.idPrefix+"_flash_"+this.count,jq:f,swf:this.options.swfPath+
(this.options.swfPath.toLowerCase().slice(-4)!==".swf"?(this.options.swfPath&&this.options.swfPath.slice(-1)!=="/"?"/":"")+"Jplayer.swf":"")});this.internal.poster=b.extend({},{id:this.options.idPrefix+"_poster_"+this.count,jq:f});b.each(b.jPlayer.event,function(b,c){a.options[b]!==f&&(a.element.bind(c+".jPlayer",a.options[b]),a.options[b]=f)});this.require.audio=!1;this.require.video=!1;b.each(this.formats,function(b,c){a.require[a.format[c].media]=!0});this.options=this.require.video?b.extend(!0,
{},this.optionsVideo,this.options):b.extend(!0,{},this.optionsAudio,this.options);this._setSize();this.status.nativeVideoControls=this._uaBlocklist(this.options.nativeVideoControls);this.status.noFullScreen=this._uaBlocklist(this.options.noFullScreen);this.status.noVolume=this._uaBlocklist(this.options.noVolume);this._restrictNativeVideoControls();this.htmlElement.poster=document.createElement("img");this.htmlElement.poster.id=this.internal.poster.id;this.htmlElement.poster.onload=function(){(!a.status.video||
a.status.waitForPlay)&&a.internal.poster.jq.show()};this.element.append(this.htmlElement.poster);this.internal.poster.jq=b("#"+this.internal.poster.id);this.internal.poster.jq.css({width:this.status.width,height:this.status.height});this.internal.poster.jq.hide();this.internal.poster.jq.bind("click.jPlayer",function(){a._trigger(b.jPlayer.event.click)});this.html.audio.available=!1;if(this.require.audio)this.htmlElement.audio=document.createElement("audio"),this.htmlElement.audio.id=this.internal.audio.id,
this.html.audio.available=!!this.htmlElement.audio.canPlayType&&this._testCanPlayType(this.htmlElement.audio);this.html.video.available=!1;if(this.require.video)this.htmlElement.video=document.createElement("video"),this.htmlElement.video.id=this.internal.video.id,this.html.video.available=!!this.htmlElement.video.canPlayType&&this._testCanPlayType(this.htmlElement.video);this.flash.available=this._checkForFlash(10);this.html.canPlay={};this.flash.canPlay={};b.each(this.formats,function(b,c){a.html.canPlay[c]=
a.html[a.format[c].media].available&&""!==a.htmlElement[a.format[c].media].canPlayType(a.format[c].codec);a.flash.canPlay[c]=a.format[c].flashCanPlay&&a.flash.available});this.html.desired=!1;this.flash.desired=!1;b.each(this.solutions,function(c,d){if(c===0)a[d].desired=!0;else{var e=!1,f=!1;b.each(a.formats,function(b,c){a[a.solutions[0]].canPlay[c]&&(a.format[c].media==="video"?f=!0:e=!0)});a[d].desired=a.require.audio&&!e||a.require.video&&!f}});this.html.support={};this.flash.support={};b.each(this.formats,
function(b,c){a.html.support[c]=a.html.canPlay[c]&&a.html.desired;a.flash.support[c]=a.flash.canPlay[c]&&a.flash.desired});this.html.used=!1;this.flash.used=!1;b.each(this.solutions,function(c,d){b.each(a.formats,function(b,c){if(a[d].support[c])return a[d].used=!0,!1})});this._resetActive();this._resetGate();this._cssSelectorAncestor(this.options.cssSelectorAncestor);!this.html.used&&!this.flash.used?(this._error({type:b.jPlayer.error.NO_SOLUTION,context:"{solution:'"+this.options.solution+"', supplied:'"+
this.options.supplied+"'}",message:b.jPlayer.errorMsg.NO_SOLUTION,hint:b.jPlayer.errorHint.NO_SOLUTION}),this.css.jq.noSolution.length&&this.css.jq.noSolution.show()):this.css.jq.noSolution.length&&this.css.jq.noSolution.hide();if(this.flash.used){var c,d="jQuery="+encodeURI(this.options.noConflict)+"&id="+encodeURI(this.internal.self.id)+"&vol="+this.options.volume+"&muted="+this.options.muted;if(b.browser.msie&&Number(b.browser.version)<=8){d=['<param name="movie" value="'+this.internal.flash.swf+
'" />','<param name="FlashVars" value="'+d+'" />','<param name="allowScriptAccess" value="always" />','<param name="bgcolor" value="'+this.options.backgroundColor+'" />','<param name="wmode" value="'+this.options.wmode+'" />'];c=document.createElement('<object id="'+this.internal.flash.id+'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="0" height="0"></object>');for(var e=0;e<d.length;e++)c.appendChild(document.createElement(d[e]))}else e=function(a,b,c){var d=document.createElement("param");
d.setAttribute("name",b);d.setAttribute("value",c);a.appendChild(d)},c=document.createElement("object"),c.setAttribute("id",this.internal.flash.id),c.setAttribute("data",this.internal.flash.swf),c.setAttribute("type","application/x-shockwave-flash"),c.setAttribute("width","1"),c.setAttribute("height","1"),e(c,"flashvars",d),e(c,"allowscriptaccess","always"),e(c,"bgcolor",this.options.backgroundColor),e(c,"wmode",this.options.wmode);this.element.append(c);this.internal.flash.jq=b(c)}if(this.html.used){if(this.html.audio.available)this._addHtmlEventListeners(this.htmlElement.audio,
this.html.audio),this.element.append(this.htmlElement.audio),this.internal.audio.jq=b("#"+this.internal.audio.id);if(this.html.video.available)this._addHtmlEventListeners(this.htmlElement.video,this.html.video),this.element.append(this.htmlElement.video),this.internal.video.jq=b("#"+this.internal.video.id),this.status.nativeVideoControls?this.internal.video.jq.css({width:this.status.width,height:this.status.height}):this.internal.video.jq.css({width:"0px",height:"0px"}),this.internal.video.jq.bind("click.jPlayer",
function(){a._trigger(b.jPlayer.event.click)})}this.options.emulateHtml&&this._emulateHtmlBridge();this.html.used&&!this.flash.used&&setTimeout(function(){a.internal.ready=!0;a.version.flash="n/a";a._trigger(b.jPlayer.event.repeat);a._trigger(b.jPlayer.event.ready)},100);this._updateNativeVideoControls();this._updateInterface();this._updateButtons(!1);this._updateAutohide();this._updateVolume(this.options.volume);this._updateMute(this.options.muted);this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide();
b.jPlayer.prototype.count++},destroy:function(){this.clearMedia();this._removeUiClass();this.css.jq.currentTime.length&&this.css.jq.currentTime.text("");this.css.jq.duration.length&&this.css.jq.duration.text("");b.each(this.css.jq,function(a,b){b.length&&b.unbind(".jPlayer")});this.internal.poster.jq.unbind(".jPlayer");this.internal.video.jq&&this.internal.video.jq.unbind(".jPlayer");this.options.emulateHtml&&this._destroyHtmlBridge();this.element.removeData("jPlayer");this.element.unbind(".jPlayer");
this.element.empty();delete this.instances[this.internal.instance]},enable:function(){},disable:function(){},_testCanPlayType:function(a){try{return a.canPlayType(this.format.mp3.codec),!0}catch(b){return!1}},_uaBlocklist:function(a){var c=navigator.userAgent.toLowerCase(),d=!1;b.each(a,function(a,b){if(b&&b.test(c))return d=!0,!1});return d},_restrictNativeVideoControls:function(){if(this.require.audio&&this.status.nativeVideoControls)this.status.nativeVideoControls=!1,this.status.noFullScreen=!0},
_updateNativeVideoControls:function(){if(this.html.video.available&&this.html.used)this.htmlElement.video.controls=this.status.nativeVideoControls,this._updateAutohide(),this.status.nativeVideoControls&&this.require.video?(this.internal.poster.jq.hide(),this.internal.video.jq.css({width:this.status.width,height:this.status.height})):this.status.waitForPlay&&this.status.video&&(this.internal.poster.jq.show(),this.internal.video.jq.css({width:"0px",height:"0px"}))},_addHtmlEventListeners:function(a,
c){var d=this;a.preload=this.options.preload;a.muted=this.options.muted;a.volume=this.options.volume;a.addEventListener("progress",function(){c.gate&&(d._getHtmlStatus(a),d._updateInterface(),d._trigger(b.jPlayer.event.progress))},!1);a.addEventListener("timeupdate",function(){c.gate&&(d._getHtmlStatus(a),d._updateInterface(),d._trigger(b.jPlayer.event.timeupdate))},!1);a.addEventListener("durationchange",function(){if(c.gate)d.status.duration=this.duration,d._getHtmlStatus(a),d._updateInterface(),
d._trigger(b.jPlayer.event.durationchange)},!1);a.addEventListener("play",function(){c.gate&&(d._updateButtons(!0),d._html_checkWaitForPlay(),d._trigger(b.jPlayer.event.play))},!1);a.addEventListener("playing",function(){c.gate&&(d._updateButtons(!0),d._seeked(),d._trigger(b.jPlayer.event.playing))},!1);a.addEventListener("pause",function(){c.gate&&(d._updateButtons(!1),d._trigger(b.jPlayer.event.pause))},!1);a.addEventListener("waiting",function(){c.gate&&(d._seeking(),d._trigger(b.jPlayer.event.waiting))},
!1);a.addEventListener("seeking",function(){c.gate&&(d._seeking(),d._trigger(b.jPlayer.event.seeking))},!1);a.addEventListener("seeked",function(){c.gate&&(d._seeked(),d._trigger(b.jPlayer.event.seeked))},!1);a.addEventListener("volumechange",function(){if(c.gate)d.options.volume=a.volume,d.options.muted=a.muted,d._updateMute(),d._updateVolume(),d._trigger(b.jPlayer.event.volumechange)},!1);a.addEventListener("suspend",function(){c.gate&&(d._seeked(),d._trigger(b.jPlayer.event.suspend))},!1);a.addEventListener("ended",
function(){if(c.gate){if(!b.jPlayer.browser.webkit)d.htmlElement.media.currentTime=0;d.htmlElement.media.pause();d._updateButtons(!1);d._getHtmlStatus(a,!0);d._updateInterface();d._trigger(b.jPlayer.event.ended)}},!1);a.addEventListener("error",function(){if(c.gate&&(d._updateButtons(!1),d._seeked(),d.status.srcSet))clearTimeout(d.internal.htmlDlyCmdId),d.status.waitForLoad=!0,d.status.waitForPlay=!0,d.status.video&&!d.status.nativeVideoControls&&d.internal.video.jq.css({width:"0px",height:"0px"}),
d._validString(d.status.media.poster)&&!d.status.nativeVideoControls&&d.internal.poster.jq.show(),d.css.jq.videoPlay.length&&d.css.jq.videoPlay.show(),d._error({type:b.jPlayer.error.URL,context:d.status.src,message:b.jPlayer.errorMsg.URL,hint:b.jPlayer.errorHint.URL})},!1);b.each(b.jPlayer.htmlEvent,function(e,g){a.addEventListener(this,function(){c.gate&&d._trigger(b.jPlayer.event[g])},!1)})},_getHtmlStatus:function(a,b){var d=0,e=0,g=0,f=0;if(a.duration)this.status.duration=a.duration;d=a.currentTime;
e=this.status.duration>0?100*d/this.status.duration:0;typeof a.seekable==="object"&&a.seekable.length>0?(g=this.status.duration>0?100*a.seekable.end(a.seekable.length-1)/this.status.duration:100,f=100*a.currentTime/a.seekable.end(a.seekable.length-1)):(g=100,f=e);b&&(e=f=d=0);this.status.seekPercent=g;this.status.currentPercentRelative=f;this.status.currentPercentAbsolute=e;this.status.currentTime=d;this.status.readyState=a.readyState;this.status.networkState=a.networkState;this.status.playbackRate=
a.playbackRate;this.status.ended=a.ended},_resetStatus:function(){this.status=b.extend({},this.status,b.jPlayer.prototype.status)},_trigger:function(a,c,d){a=b.Event(a);a.jPlayer={};a.jPlayer.version=b.extend({},this.version);a.jPlayer.options=b.extend(!0,{},this.options);a.jPlayer.status=b.extend(!0,{},this.status);a.jPlayer.html=b.extend(!0,{},this.html);a.jPlayer.flash=b.extend(!0,{},this.flash);if(c)a.jPlayer.error=b.extend({},c);if(d)a.jPlayer.warning=b.extend({},d);this.element.trigger(a)},
jPlayerFlashEvent:function(a,c){if(a===b.jPlayer.event.ready)if(this.internal.ready){if(this.flash.gate){if(this.status.srcSet){var d=this.status.currentTime,e=this.status.paused;this.setMedia(this.status.media);d>0&&(e?this.pause(d):this.play(d))}this._trigger(b.jPlayer.event.flashreset)}}else this.internal.ready=!0,this.internal.flash.jq.css({width:"0px",height:"0px"}),this.version.flash=c.version,this.version.needFlash!==this.version.flash&&this._error({type:b.jPlayer.error.VERSION,context:this.version.flash,
message:b.jPlayer.errorMsg.VERSION+this.version.flash,hint:b.jPlayer.errorHint.VERSION}),this._trigger(b.jPlayer.event.repeat),this._trigger(a);if(this.flash.gate)switch(a){case b.jPlayer.event.progress:this._getFlashStatus(c);this._updateInterface();this._trigger(a);break;case b.jPlayer.event.timeupdate:this._getFlashStatus(c);this._updateInterface();this._trigger(a);break;case b.jPlayer.event.play:this._seeked();this._updateButtons(!0);this._trigger(a);break;case b.jPlayer.event.pause:this._updateButtons(!1);
this._trigger(a);break;case b.jPlayer.event.ended:this._updateButtons(!1);this._trigger(a);break;case b.jPlayer.event.click:this._trigger(a);break;case b.jPlayer.event.error:this.status.waitForLoad=!0;this.status.waitForPlay=!0;this.status.video&&this.internal.flash.jq.css({width:"0px",height:"0px"});this._validString(this.status.media.poster)&&this.internal.poster.jq.show();this.css.jq.videoPlay.length&&this.status.video&&this.css.jq.videoPlay.show();this.status.video?this._flash_setVideo(this.status.media):
this._flash_setAudio(this.status.media);this._updateButtons(!1);this._error({type:b.jPlayer.error.URL,context:c.src,message:b.jPlayer.errorMsg.URL,hint:b.jPlayer.errorHint.URL});break;case b.jPlayer.event.seeking:this._seeking();this._trigger(a);break;case b.jPlayer.event.seeked:this._seeked();this._trigger(a);break;case b.jPlayer.event.ready:break;default:this._trigger(a)}return!1},_getFlashStatus:function(a){this.status.seekPercent=a.seekPercent;this.status.currentPercentRelative=a.currentPercentRelative;
this.status.currentPercentAbsolute=a.currentPercentAbsolute;this.status.currentTime=a.currentTime;this.status.duration=a.duration;this.status.readyState=4;this.status.networkState=0;this.status.playbackRate=1;this.status.ended=!1},_updateButtons:function(a){if(a!==f)this.status.paused=!a,this.css.jq.play.length&&this.css.jq.pause.length&&(a?(this.css.jq.play.hide(),this.css.jq.pause.show()):(this.css.jq.play.show(),this.css.jq.pause.hide()));this.css.jq.restoreScreen.length&&this.css.jq.fullScreen.length&&
(this.status.noFullScreen?(this.css.jq.fullScreen.hide(),this.css.jq.restoreScreen.hide()):this.options.fullScreen?(this.css.jq.fullScreen.hide(),this.css.jq.restoreScreen.show()):(this.css.jq.fullScreen.show(),this.css.jq.restoreScreen.hide()));this.css.jq.repeat.length&&this.css.jq.repeatOff.length&&(this.options.loop?(this.css.jq.repeat.hide(),this.css.jq.repeatOff.show()):(this.css.jq.repeat.show(),this.css.jq.repeatOff.hide()))},_updateInterface:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.width(this.status.seekPercent+
"%");this.css.jq.playBar.length&&this.css.jq.playBar.width(this.status.currentPercentRelative+"%");this.css.jq.currentTime.length&&this.css.jq.currentTime.text(b.jPlayer.convertTime(this.status.currentTime));this.css.jq.duration.length&&this.css.jq.duration.text(b.jPlayer.convertTime(this.status.duration))},_seeking:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.addClass("jp-seeking-bg")},_seeked:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.removeClass("jp-seeking-bg")},
_resetGate:function(){this.html.audio.gate=!1;this.html.video.gate=!1;this.flash.gate=!1},_resetActive:function(){this.html.active=!1;this.flash.active=!1},setMedia:function(a){var c=this,d=!1,e=this.status.media.poster!==a.poster;this._resetMedia();this._resetGate();this._resetActive();b.each(this.formats,function(e,f){var i=c.format[f].media==="video";b.each(c.solutions,function(b,e){if(c[e].support[f]&&c._validString(a[f])){var g=e==="html";i?(g?(c.html.video.gate=!0,c._html_setVideo(a),c.html.active=
!0):(c.flash.gate=!0,c._flash_setVideo(a),c.flash.active=!0),c.css.jq.videoPlay.length&&c.css.jq.videoPlay.show(),c.status.video=!0):(g?(c.html.audio.gate=!0,c._html_setAudio(a),c.html.active=!0):(c.flash.gate=!0,c._flash_setAudio(a),c.flash.active=!0),c.css.jq.videoPlay.length&&c.css.jq.videoPlay.hide(),c.status.video=!1);d=!0;return!1}});if(d)return!1});if(d){if((!this.status.nativeVideoControls||!this.html.video.gate)&&this._validString(a.poster))e?this.htmlElement.poster.src=a.poster:this.internal.poster.jq.show();
this.status.srcSet=!0;this.status.media=b.extend({},a);this._updateButtons(!1);this._updateInterface()}else this._error({type:b.jPlayer.error.NO_SUPPORT,context:"{supplied:'"+this.options.supplied+"'}",message:b.jPlayer.errorMsg.NO_SUPPORT,hint:b.jPlayer.errorHint.NO_SUPPORT})},_resetMedia:function(){this._resetStatus();this._updateButtons(!1);this._updateInterface();this._seeked();this.internal.poster.jq.hide();clearTimeout(this.internal.htmlDlyCmdId);this.html.active?this._html_resetMedia():this.flash.active&&
this._flash_resetMedia()},clearMedia:function(){this._resetMedia();this.html.active?this._html_clearMedia():this.flash.active&&this._flash_clearMedia();this._resetGate();this._resetActive()},load:function(){this.status.srcSet?this.html.active?this._html_load():this.flash.active&&this._flash_load():this._urlNotSetError("load")},play:function(a){a=typeof a==="number"?a:NaN;this.status.srcSet?this.html.active?this._html_play(a):this.flash.active&&this._flash_play(a):this._urlNotSetError("play")},videoPlay:function(){this.play()},
pause:function(a){a=typeof a==="number"?a:NaN;this.status.srcSet?this.html.active?this._html_pause(a):this.flash.active&&this._flash_pause(a):this._urlNotSetError("pause")},pauseOthers:function(){var a=this;b.each(this.instances,function(b,d){a.element!==d&&d.data("jPlayer").status.srcSet&&d.jPlayer("pause")})},stop:function(){this.status.srcSet?this.html.active?this._html_pause(0):this.flash.active&&this._flash_pause(0):this._urlNotSetError("stop")},playHead:function(a){a=this._limitValue(a,0,100);
this.status.srcSet?this.html.active?this._html_playHead(a):this.flash.active&&this._flash_playHead(a):this._urlNotSetError("playHead")},_muted:function(a){this.options.muted=a;this.html.used&&this._html_mute(a);this.flash.used&&this._flash_mute(a);!this.html.video.gate&&!this.html.audio.gate&&(this._updateMute(a),this._updateVolume(this.options.volume),this._trigger(b.jPlayer.event.volumechange))},mute:function(a){a=a===f?!0:!!a;this._muted(a)},unmute:function(a){a=a===f?!0:!!a;this._muted(!a)},_updateMute:function(a){if(a===
f)a=this.options.muted;this.css.jq.mute.length&&this.css.jq.unmute.length&&(this.status.noVolume?(this.css.jq.mute.hide(),this.css.jq.unmute.hide()):a?(this.css.jq.mute.hide(),this.css.jq.unmute.show()):(this.css.jq.mute.show(),this.css.jq.unmute.hide()))},volume:function(a){a=this._limitValue(a,0,1);this.options.volume=a;this.html.used&&this._html_volume(a);this.flash.used&&this._flash_volume(a);!this.html.video.gate&&!this.html.audio.gate&&(this._updateVolume(a),this._trigger(b.jPlayer.event.volumechange))},
volumeBar:function(a){if(this.css.jq.volumeBar.length){var b=this.css.jq.volumeBar.offset(),d=a.pageX-b.left,e=this.css.jq.volumeBar.width(),a=this.css.jq.volumeBar.height()-a.pageY+b.top,b=this.css.jq.volumeBar.height();this.options.verticalVolume?this.volume(a/b):this.volume(d/e)}this.options.muted&&this._muted(!1)},volumeBarValue:function(a){this.volumeBar(a)},_updateVolume:function(a){if(a===f)a=this.options.volume;a=this.options.muted?0:a;this.status.noVolume?(this.css.jq.volumeBar.length&&this.css.jq.volumeBar.hide(),
this.css.jq.volumeBarValue.length&&this.css.jq.volumeBarValue.hide(),this.css.jq.volumeMax.length&&this.css.jq.volumeMax.hide()):(this.css.jq.volumeBar.length&&this.css.jq.volumeBar.show(),this.css.jq.volumeBarValue.length&&(this.css.jq.volumeBarValue.show(),this.css.jq.volumeBarValue[this.options.verticalVolume?"height":"width"](a*100+"%")),this.css.jq.volumeMax.length&&this.css.jq.volumeMax.show())},volumeMax:function(){this.volume(1);this.options.muted&&this._muted(!1)},_cssSelectorAncestor:function(a){var c=
this;this.options.cssSelectorAncestor=a;this._removeUiClass();this.ancestorJq=a?b(a):[];a&&this.ancestorJq.length!==1&&this._warning({type:b.jPlayer.warning.CSS_SELECTOR_COUNT,context:a,message:b.jPlayer.warningMsg.CSS_SELECTOR_COUNT+this.ancestorJq.length+" found for cssSelectorAncestor.",hint:b.jPlayer.warningHint.CSS_SELECTOR_COUNT});this._addUiClass();b.each(this.options.cssSelector,function(a,b){c._cssSelector(a,b)})},_cssSelector:function(a,c){var d=this;typeof c==="string"?b.jPlayer.prototype.options.cssSelector[a]?
(this.css.jq[a]&&this.css.jq[a].length&&this.css.jq[a].unbind(".jPlayer"),this.options.cssSelector[a]=c,this.css.cs[a]=this.options.cssSelectorAncestor+" "+c,this.css.jq[a]=c?b(this.css.cs[a]):[],this.css.jq[a].length&&this.css.jq[a].bind("click.jPlayer",function(c){d[a](c);b(this).blur();return!1}),c&&this.css.jq[a].length!==1&&this._warning({type:b.jPlayer.warning.CSS_SELECTOR_COUNT,context:this.css.cs[a],message:b.jPlayer.warningMsg.CSS_SELECTOR_COUNT+this.css.jq[a].length+" found for "+a+" method.",
hint:b.jPlayer.warningHint.CSS_SELECTOR_COUNT})):this._warning({type:b.jPlayer.warning.CSS_SELECTOR_METHOD,context:a,message:b.jPlayer.warningMsg.CSS_SELECTOR_METHOD,hint:b.jPlayer.warningHint.CSS_SELECTOR_METHOD}):this._warning({type:b.jPlayer.warning.CSS_SELECTOR_STRING,context:c,message:b.jPlayer.warningMsg.CSS_SELECTOR_STRING,hint:b.jPlayer.warningHint.CSS_SELECTOR_STRING})},seekBar:function(a){if(this.css.jq.seekBar){var b=this.css.jq.seekBar.offset(),a=a.pageX-b.left,b=this.css.jq.seekBar.width();
this.playHead(100*a/b)}},playBar:function(a){this.seekBar(a)},repeat:function(){this._loop(!0)},repeatOff:function(){this._loop(!1)},_loop:function(a){if(this.options.loop!==a)this.options.loop=a,this._updateButtons(),this._trigger(b.jPlayer.event.repeat)},currentTime:function(){},duration:function(){},gui:function(){},noSolution:function(){},option:function(a,c){var d=a;if(arguments.length===0)return b.extend(!0,{},this.options);if(typeof a==="string"){var e=a.split(".");if(c===f){for(var d=b.extend(!0,
{},this.options),g=0;g<e.length;g++)if(d[e[g]]!==f)d=d[e[g]];else return this._warning({type:b.jPlayer.warning.OPTION_KEY,context:a,message:b.jPlayer.warningMsg.OPTION_KEY,hint:b.jPlayer.warningHint.OPTION_KEY}),f;return d}for(var g=d={},h=0;h<e.length;h++)h<e.length-1?(g[e[h]]={},g=g[e[h]]):g[e[h]]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(a,b){c._setOption(a,b)});return this},_setOption:function(a,c){var d=this;switch(a){case "volume":this.volume(c);
break;case "muted":this._muted(c);break;case "cssSelectorAncestor":this._cssSelectorAncestor(c);break;case "cssSelector":b.each(c,function(a,b){d._cssSelector(a,b)});break;case "fullScreen":this.options[a]!==c&&(this._removeUiClass(),this.options[a]=c,this._refreshSize());break;case "size":!this.options.fullScreen&&this.options[a].cssClass!==c.cssClass&&this._removeUiClass();this.options[a]=b.extend({},this.options[a],c);this._refreshSize();break;case "sizeFull":this.options.fullScreen&&this.options[a].cssClass!==
c.cssClass&&this._removeUiClass();this.options[a]=b.extend({},this.options[a],c);this._refreshSize();break;case "autohide":this.options[a]=b.extend({},this.options[a],c);this._updateAutohide();break;case "loop":this._loop(c);break;case "nativeVideoControls":this.options[a]=b.extend({},this.options[a],c);this.status.nativeVideoControls=this._uaBlocklist(this.options.nativeVideoControls);this._restrictNativeVideoControls();this._updateNativeVideoControls();break;case "noFullScreen":this.options[a]=
b.extend({},this.options[a],c);this.status.nativeVideoControls=this._uaBlocklist(this.options.nativeVideoControls);this.status.noFullScreen=this._uaBlocklist(this.options.noFullScreen);this._restrictNativeVideoControls();this._updateButtons();break;case "noVolume":this.options[a]=b.extend({},this.options[a],c);this.status.noVolume=this._uaBlocklist(this.options.noVolume);this._updateVolume();this._updateMute();break;case "emulateHtml":this.options[a]!==c&&((this.options[a]=c)?this._emulateHtmlBridge():
this._destroyHtmlBridge())}return this},_refreshSize:function(){this._setSize();this._addUiClass();this._updateSize();this._updateButtons();this._updateAutohide();this._trigger(b.jPlayer.event.resize)},_setSize:function(){this.options.fullScreen?(this.status.width=this.options.sizeFull.width,this.status.height=this.options.sizeFull.height,this.status.cssClass=this.options.sizeFull.cssClass):(this.status.width=this.options.size.width,this.status.height=this.options.size.height,this.status.cssClass=
this.options.size.cssClass);this.element.css({width:this.status.width,height:this.status.height})},_addUiClass:function(){this.ancestorJq.length&&this.ancestorJq.addClass(this.status.cssClass)},_removeUiClass:function(){this.ancestorJq.length&&this.ancestorJq.removeClass(this.status.cssClass)},_updateSize:function(){this.internal.poster.jq.css({width:this.status.width,height:this.status.height});!this.status.waitForPlay&&this.html.active&&this.status.video||this.html.video.available&&this.html.used&&
this.status.nativeVideoControls?this.internal.video.jq.css({width:this.status.width,height:this.status.height}):!this.status.waitForPlay&&this.flash.active&&this.status.video&&this.internal.flash.jq.css({width:this.status.width,height:this.status.height})},_updateAutohide:function(){var a=this,b=function(){a.css.jq.gui.fadeIn(a.options.autohide.fadeIn,function(){clearTimeout(a.internal.autohideId);a.internal.autohideId=setTimeout(function(){a.css.jq.gui.fadeOut(a.options.autohide.fadeOut)},a.options.autohide.hold)})};
this.css.jq.gui.length&&(this.css.jq.gui.stop(!0,!0),clearTimeout(this.internal.autohideId),this.element.unbind(".jPlayerAutohide"),this.css.jq.gui.unbind(".jPlayerAutohide"),this.status.nativeVideoControls?this.css.jq.gui.hide():this.options.fullScreen&&this.options.autohide.full||!this.options.fullScreen&&this.options.autohide.restored?(this.element.bind("mousemove.jPlayer.jPlayerAutohide",b),this.css.jq.gui.bind("mousemove.jPlayer.jPlayerAutohide",b),this.css.jq.gui.hide()):this.css.jq.gui.show())},
fullScreen:function(){this._setOption("fullScreen",!0)},restoreScreen:function(){this._setOption("fullScreen",!1)},_html_initMedia:function(){this.htmlElement.media.src=this.status.src;this.options.preload!=="none"&&this._html_load();this._trigger(b.jPlayer.event.timeupdate)},_html_setAudio:function(a){var c=this;b.each(this.formats,function(b,e){if(c.html.support[e]&&a[e])return c.status.src=a[e],c.status.format[e]=!0,c.status.formatType=e,!1});this.htmlElement.media=this.htmlElement.audio;this._html_initMedia()},
_html_setVideo:function(a){var c=this;b.each(this.formats,function(b,e){if(c.html.support[e]&&a[e])return c.status.src=a[e],c.status.format[e]=!0,c.status.formatType=e,!1});if(this.status.nativeVideoControls)this.htmlElement.video.poster=this._validString(a.poster)?a.poster:"";this.htmlElement.media=this.htmlElement.video;this._html_initMedia()},_html_resetMedia:function(){this.htmlElement.media&&(this.htmlElement.media.id===this.internal.video.id&&!this.status.nativeVideoControls&&this.internal.video.jq.css({width:"0px",
height:"0px"}),this.htmlElement.media.pause())},_html_clearMedia:function(){if(this.htmlElement.media)this.htmlElement.media.src="",this.htmlElement.media.load()},_html_load:function(){if(this.status.waitForLoad)this.status.waitForLoad=!1,this.htmlElement.media.load();clearTimeout(this.internal.htmlDlyCmdId)},_html_play:function(a){var b=this;this._html_load();this.htmlElement.media.play();if(!isNaN(a))try{this.htmlElement.media.currentTime=a}catch(d){this.internal.htmlDlyCmdId=setTimeout(function(){b.play(a)},
100);return}this._html_checkWaitForPlay()},_html_pause:function(a){var b=this;a>0?this._html_load():clearTimeout(this.internal.htmlDlyCmdId);this.htmlElement.media.pause();if(!isNaN(a))try{this.htmlElement.media.currentTime=a}catch(d){this.internal.htmlDlyCmdId=setTimeout(function(){b.pause(a)},100);return}a>0&&this._html_checkWaitForPlay()},_html_playHead:function(a){var b=this;this._html_load();try{if(typeof this.htmlElement.media.seekable==="object"&&this.htmlElement.media.seekable.length>0)this.htmlElement.media.currentTime=
a*this.htmlElement.media.seekable.end(this.htmlElement.media.seekable.length-1)/100;else if(this.htmlElement.media.duration>0&&!isNaN(this.htmlElement.media.duration))this.htmlElement.media.currentTime=a*this.htmlElement.media.duration/100;else throw"e";}catch(d){this.internal.htmlDlyCmdId=setTimeout(function(){b.playHead(a)},100);return}this.status.waitForLoad||this._html_checkWaitForPlay()},_html_checkWaitForPlay:function(){if(this.status.waitForPlay)this.status.waitForPlay=!1,this.css.jq.videoPlay.length&&
this.css.jq.videoPlay.hide(),this.status.video&&(this.internal.poster.jq.hide(),this.internal.video.jq.css({width:this.status.width,height:this.status.height}))},_html_volume:function(a){if(this.html.audio.available)this.htmlElement.audio.volume=a;if(this.html.video.available)this.htmlElement.video.volume=a},_html_mute:function(a){if(this.html.audio.available)this.htmlElement.audio.muted=a;if(this.html.video.available)this.htmlElement.video.muted=a},_flash_setAudio:function(a){var c=this;try{if(b.each(this.formats,
function(b,d){if(c.flash.support[d]&&a[d]){switch(d){case "m4a":case "fla":c._getMovie().fl_setAudio_m4a(a[d]);break;case "mp3":c._getMovie().fl_setAudio_mp3(a[d])}c.status.src=a[d];c.status.format[d]=!0;c.status.formatType=d;return!1}}),this.options.preload==="auto")this._flash_load(),this.status.waitForLoad=!1}catch(d){this._flashError(d)}},_flash_setVideo:function(a){var c=this;try{if(b.each(this.formats,function(b,d){if(c.flash.support[d]&&a[d]){switch(d){case "m4v":case "flv":c._getMovie().fl_setVideo_m4v(a[d])}c.status.src=
a[d];c.status.format[d]=!0;c.status.formatType=d;return!1}}),this.options.preload==="auto")this._flash_load(),this.status.waitForLoad=!1}catch(d){this._flashError(d)}},_flash_resetMedia:function(){this.internal.flash.jq.css({width:"0px",height:"0px"});this._flash_pause(NaN)},_flash_clearMedia:function(){try{this._getMovie().fl_clearMedia()}catch(a){this._flashError(a)}},_flash_load:function(){try{this._getMovie().fl_load()}catch(a){this._flashError(a)}this.status.waitForLoad=!1},_flash_play:function(a){try{this._getMovie().fl_play(a)}catch(b){this._flashError(b)}this.status.waitForLoad=
!1;this._flash_checkWaitForPlay()},_flash_pause:function(a){try{this._getMovie().fl_pause(a)}catch(b){this._flashError(b)}if(a>0)this.status.waitForLoad=!1,this._flash_checkWaitForPlay()},_flash_playHead:function(a){try{this._getMovie().fl_play_head(a)}catch(b){this._flashError(b)}this.status.waitForLoad||this._flash_checkWaitForPlay()},_flash_checkWaitForPlay:function(){if(this.status.waitForPlay)this.status.waitForPlay=!1,this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide(),this.status.video&&
(this.internal.poster.jq.hide(),this.internal.flash.jq.css({width:this.status.width,height:this.status.height}))},_flash_volume:function(a){try{this._getMovie().fl_volume(a)}catch(b){this._flashError(b)}},_flash_mute:function(a){try{this._getMovie().fl_mute(a)}catch(b){this._flashError(b)}},_getMovie:function(){return document[this.internal.flash.id]},_checkForFlash:function(a){var b=!1,d;if(window.ActiveXObject)try{new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+a),b=!0}catch(e){}else navigator.plugins&&
navigator.mimeTypes.length>0&&(d=navigator.plugins["Shockwave Flash"])&&navigator.plugins["Shockwave Flash"].description.replace(/.*\s(\d+\.\d+).*/,"$1")>=a&&(b=!0);return b},_validString:function(a){return a&&typeof a==="string"},_limitValue:function(a,b,d){return a<b?b:a>d?d:a},_urlNotSetError:function(a){this._error({type:b.jPlayer.error.URL_NOT_SET,context:a,message:b.jPlayer.errorMsg.URL_NOT_SET,hint:b.jPlayer.errorHint.URL_NOT_SET})},_flashError:function(a){var c;c=this.internal.ready?"FLASH_DISABLED":
"FLASH";this._error({type:b.jPlayer.error[c],context:this.internal.flash.swf,message:b.jPlayer.errorMsg[c]+a.message,hint:b.jPlayer.errorHint[c]});this.internal.flash.jq.css({width:"1px",height:"1px"})},_error:function(a){this._trigger(b.jPlayer.event.error,a);this.options.errorAlerts&&this._alert("Error!"+(a.message?"\n\n"+a.message:"")+(a.hint?"\n\n"+a.hint:"")+"\n\nContext: "+a.context)},_warning:function(a){this._trigger(b.jPlayer.event.warning,f,a);this.options.warningAlerts&&this._alert("Warning!"+
(a.message?"\n\n"+a.message:"")+(a.hint?"\n\n"+a.hint:"")+"\n\nContext: "+a.context)},_alert:function(a){alert("jPlayer "+this.version.script+" : id='"+this.internal.self.id+"' : "+a)},_emulateHtmlBridge:function(){var a=this;b.each(b.jPlayer.emulateMethods.split(/\s+/g),function(b,d){a.internal.domNode[d]=function(b){a[d](b)}});b.each(b.jPlayer.event,function(c,d){var e=!0;b.each(b.jPlayer.reservedEvent.split(/\s+/g),function(a,b){if(b===c)return e=!1});e&&a.element.bind(d+".jPlayer.jPlayerHtml",
function(){a._emulateHtmlUpdate();var b=document.createEvent("Event");b.initEvent(c,!1,!0);a.internal.domNode.dispatchEvent(b)})})},_emulateHtmlUpdate:function(){var a=this;b.each(b.jPlayer.emulateStatus.split(/\s+/g),function(b,d){a.internal.domNode[d]=a.status[d]});b.each(b.jPlayer.emulateOptions.split(/\s+/g),function(b,d){a.internal.domNode[d]=a.options[d]})},_destroyHtmlBridge:function(){var a=this;this.element.unbind(".jPlayerHtml");b.each((b.jPlayer.emulateMethods+" "+b.jPlayer.emulateStatus+
" "+b.jPlayer.emulateOptions).split(/\s+/g),function(b,d){delete a.internal.domNode[d]})}};b.jPlayer.error={FLASH:"e_flash",FLASH_DISABLED:"e_flash_disabled",NO_SOLUTION:"e_no_solution",NO_SUPPORT:"e_no_support",URL:"e_url",URL_NOT_SET:"e_url_not_set",VERSION:"e_version"};b.jPlayer.errorMsg={FLASH:"jPlayer's Flash fallback is not configured correctly, or a command was issued before the Bizamajig Media Player Ready event. Details: ",FLASH_DISABLED:"jPlayer's Flash fallback has been disabled by the browser due to the CSS rules you have used. Details: ",
NO_SOLUTION:"No solution can be found by Bizamajig Media Player in this browser. Neither HTML nor Flash can be used.",NO_SUPPORT:"It is not possible to play any media format provided in setMedia() on this browser using your current options.",URL:"Media URL could not be loaded.",URL_NOT_SET:"Attempt to issue media playback commands, while no media url is set.",VERSION:"jPlayer "+b.jPlayer.prototype.version.script+" needs Jplayer.swf version "+b.jPlayer.prototype.version.needFlash+" but found "};b.jPlayer.errorHint=
{FLASH:"Check your swfPath option and that Jplayer.swf is there.",FLASH_DISABLED:"Check that you have not display:none; the Bizamajig Media Player entity or any ancestor.",NO_SOLUTION:"Review the Bizamajig Media Player options: support and supplied.",NO_SUPPORT:"Video or audio formats defined in the supplied option are missing.",URL:"Check media URL is valid.",URL_NOT_SET:"Use setMedia() to set the media URL.",VERSION:"Update Bizamajig Media Player files."};b.jPlayer.warning={CSS_SELECTOR_COUNT:"e_css_selector_count",CSS_SELECTOR_METHOD:"e_css_selector_method",
CSS_SELECTOR_STRING:"e_css_selector_string",OPTION_KEY:"e_option_key"};b.jPlayer.warningMsg={CSS_SELECTOR_COUNT:"The number of css selectors found did not equal one: ",CSS_SELECTOR_METHOD:"The methodName given in Bizamajig Media Player('cssSelector') is not a valid Bizamajig Media Player method.",CSS_SELECTOR_STRING:"The methodCssSelector given in Bizamajig Media Player('cssSelector') is not a String or is empty.",OPTION_KEY:"The option requested in Bizamajig Media Player('option') is undefined."};b.jPlayer.warningHint={CSS_SELECTOR_COUNT:"Check your css selector and the ancestor.",
CSS_SELECTOR_METHOD:"Check your method name.",CSS_SELECTOR_STRING:"Check your css selector is a string.",OPTION_KEY:"Check your option name."}})(jQuery);
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END BIZAMAJIG MEDIA PLAYER

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START jQuery Cookie Plugin

********************************************************************************************************************************
********************************************************************************************************************************
*/
/**
* jQuery Cookie plugin
*
* Copyright (c) 2010 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
jQuery.cookie = function (key, value, options) {

    // key and at least value given, set cookie...
    if (arguments.length > 1 && String(value) !== "[object Object]") {
        options = jQuery.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 result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
    return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
};
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END jQuery Cookie Plugin

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START jQuery HoverIntent

********************************************************************************************************************************
********************************************************************************************************************************
*/
/**
* hoverIntent r6 // 2011.02.26 // jQuery 1.5.1+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne brian(at)cherne(dot)net
*/
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev])};var handleHover=function(e){var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t)}if(e.type=="mouseenter"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob)},cfg.timeout)}}};return this.bind('mouseenter',handleHover).bind('mouseleave',handleHover)}})(jQuery);
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END jQuery HoverIntent

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START Timeentry

********************************************************************************************************************************
********************************************************************************************************************************
*/
(function($){function TimeEntry(){this._disabledInputs=[];this.regional=[];this.regional['']={show24Hours:false,separator:':',ampmPrefix:'',ampmNames:['AM','PM'],spinnerTexts:['Now','Previous field','Next field','Increment','Decrement']};this._defaults={appendText:'',showSeconds:false,timeSteps:[1,1,1],initialField:0,useMouseWheel:true,defaultTime:null,minTime:null,maxTime:null,spinnerImage:'spinnerDefault.png',spinnerSize:[20,20,8],spinnerBigImage:'',spinnerBigSize:[40,40,16],spinnerIncDecOnly:false,spinnerRepeat:[500,250],beforeShow:null,beforeSetTime:null};$.extend(this._defaults,this.regional[''])}var m='timeEntry';$.extend(TimeEntry.prototype,{markerClassName:'hasTimeEntry',setDefaults:function(a){extendRemove(this._defaults,a||{});return this},_connectTimeEntry:function(b,c){var d=$(b);if(d.hasClass(this.markerClassName)){return}var e={};e.options=$.extend({},c);e._selectedHour=0;e._selectedMinute=0;e._selectedSecond=0;e._field=0;e.input=$(b);$.data(b,m,e);var f=this._get(e,'spinnerImage');var g=this._get(e,'spinnerText');var h=this._get(e,'spinnerSize');var i=this._get(e,'appendText');var j=(!f?null:$('<span class="timeEntry_control" style="display: inline-block; '+'background: url(\''+f+'\') 0 0 no-repeat; '+'width: '+h[0]+'px; height: '+h[1]+'px;'+($.browser.mozilla&&$.browser.version<'1.9'?' padding-left: '+h[0]+'px; padding-bottom: '+(h[1]-18)+'px;':'')+'"></span>'));d.wrap('<span class="timeEntry_wrap"></span>').after(i?'<span class="timeEntry_append">'+i+'</span>':'').after(j||'');d.addClass(this.markerClassName).bind('focus.timeEntry',this._doFocus).bind('blur.timeEntry',this._doBlur).bind('click.timeEntry',this._doClick).bind('keydown.timeEntry',this._doKeyDown).bind('keypress.timeEntry',this._doKeyPress);if($.browser.mozilla){d.bind('input.timeEntry',function(a){$.timeEntry._parseTime(e)})}if($.browser.msie){d.bind('paste.timeEntry',function(a){setTimeout(function(){$.timeEntry._parseTime(e)},1)})}if(this._get(e,'useMouseWheel')&&$.fn.mousewheel){d.mousewheel(this._doMouseWheel)}if(j){j.mousedown(this._handleSpinner).mouseup(this._endSpinner).mouseover(this._expandSpinner).mouseout(this._endSpinner).mousemove(this._describeSpinner)}},_enableTimeEntry:function(a){this._enableDisable(a,false)},_disableTimeEntry:function(a){this._enableDisable(a,true)},_enableDisable:function(b,c){var d=$.data(b,m);if(!d){return}b.disabled=c;if(b.nextSibling&&b.nextSibling.nodeName.toLowerCase()=='span'){$.timeEntry._changeSpinner(d,b.nextSibling,(c?5:-1))}$.timeEntry._disabledInputs=$.map($.timeEntry._disabledInputs,function(a){return(a==b?null:a)});if(c){$.timeEntry._disabledInputs.push(b)}},_isDisabledTimeEntry:function(a){return $.inArray(a,this._disabledInputs)>-1},_changeTimeEntry:function(a,b){var c=$.data(a,m);if(c){var d=this._extractTime(c);extendRemove(c.options,b||{});if(d){this._setTime(c,new Date(0,0,0,d[0],d[1],d[2]))}}$.data(a,m,c)},_destroyTimeEntry:function(b){$input=$(b);if(!$input.hasClass(this.markerClassName)){return}$input.removeClass(this.markerClassName).unbind('.timeEntry');if($.fn.mousewheel){$input.unmousewheel()}this._disabledInputs=$.map(this._disabledInputs,function(a){return(a==b?null:a)});$input.parent().replaceWith($input);$.removeData(b,m)},_setTimeTimeEntry:function(a,b){var c=$.data(a,m);if(c){this._setTime(c,b?(typeof b=='object'?new Date(b.getTime()):b):null)}},_getTimeTimeEntry:function(a){var b=$.data(a,m);var c=(b?this._extractTime(b):null);return(!c?null:new Date(0,0,0,c[0],c[1],c[2]))},_doFocus:function(a){var b=(a.nodeName&&a.nodeName.toLowerCase()=='input'?a:this);if($.timeEntry._lastInput==b||$.timeEntry._isDisabledTimeEntry(b)){$.timeEntry._focussed=false;return}var c=$.data(b,m);$.timeEntry._focussed=true;$.timeEntry._lastInput=b;$.timeEntry._blurredInput=null;var d=$.timeEntry._get(c,'beforeShow');extendRemove(c.options,(d?d.apply(b,[b]):{}));$.data(b,m,c);$.timeEntry._parseTime(c);setTimeout(function(){$.timeEntry._showField(c)},10)},_doBlur:function(a){$.timeEntry._blurredInput=$.timeEntry._lastInput;$.timeEntry._lastInput=null},_doClick:function(b){var c=b.target;var d=$.data(c,m);if(!$.timeEntry._focussed){var e=$.timeEntry._get(d,'separator').length+2;d._field=0;if(c.selectionStart!=null){for(var f=0;f<=Math.max(1,d._secondField,d._ampmField);f++){var g=(f!=d._ampmField?(f*e)+2:(d._ampmField*e)+$.timeEntry._get(d,'ampmPrefix').length+$.timeEntry._get(d,'ampmNames')[0].length);d._field=f;if(c.selectionStart<g){break}}}else if(c.createTextRange){var h=$(b.srcElement);var i=c.createTextRange();var j=function(a){return{thin:2,medium:4,thick:6}[a]||a};var k=b.clientX+document.documentElement.scrollLeft-(h.offset().left+parseInt(j(h.css('border-left-width')),10))-i.offsetLeft;for(var f=0;f<=Math.max(1,d._secondField,d._ampmField);f++){var g=(f!=d._ampmField?(f*e)+2:(d._ampmField*e)+$.timeEntry._get(d,'ampmPrefix').length+$.timeEntry._get(d,'ampmNames')[0].length);i.collapse();i.moveEnd('character',g);d._field=f;if(k<i.boundingWidth){break}}}}$.data(c,m,d);$.timeEntry._showField(d);$.timeEntry._focussed=false},_doKeyDown:function(a){if(a.keyCode>=48){return true}var b=$.data(a.target,m);switch(a.keyCode){case 9:return(a.shiftKey?$.timeEntry._changeField(b,-1,true):$.timeEntry._changeField(b,+1,true));case 35:if(a.ctrlKey){$.timeEntry._setValue(b,'')}else{b._field=Math.max(1,b._secondField,b._ampmField);$.timeEntry._adjustField(b,0)}break;case 36:if(a.ctrlKey){$.timeEntry._setTime(b)}else{b._field=0;$.timeEntry._adjustField(b,0)}break;case 37:$.timeEntry._changeField(b,-1,false);break;case 38:$.timeEntry._adjustField(b,+1);break;case 39:$.timeEntry._changeField(b,+1,false);break;case 40:$.timeEntry._adjustField(b,-1);break;case 46:$.timeEntry._setValue(b,'');break}return false},_doKeyPress:function(a){var b=String.fromCharCode(a.charCode==undefined?a.keyCode:a.charCode);if(b<' '){return true}var c=$.data(a.target,m);$.timeEntry._handleKeyPress(c,b);return false},_doMouseWheel:function(a,b){if($.timeEntry._isDisabledTimeEntry(a.target)){return}b=($.browser.opera?-b/Math.abs(b):($.browser.safari?b/Math.abs(b):b));var c=$.data(a.target,m);c.input.focus();if(!c.input.val()){$.timeEntry._parseTime(c)}$.timeEntry._adjustField(c,b);a.preventDefault()},_expandSpinner:function(b){var c=$.timeEntry._getSpinnerTarget(b);var d=$.data($.timeEntry._getInput(c),m);var e=$.timeEntry._get(d,'spinnerBigImage');if(e){d._expanded=true;var f=$(c).offset();var g=null;$(c).parents().each(function(){var a=$(this);if(a.css('position')=='relative'||a.css('position')=='absolute'){g=a.offset()}return!g});var h=$.timeEntry._get(d,'spinnerSize');var i=$.timeEntry._get(d,'spinnerBigSize');$('<div class="timeEntry_expand" style="position: absolute; left: '+(f.left-(i[0]-h[0])/2-(g?g.left:0))+'px; top: '+(f.top-(i[1]-h[1])/2-(g?g.top:0))+'px; width: '+i[0]+'px; height: '+i[1]+'px; background: transparent url('+e+') no-repeat 0px 0px; z-index: 10;"></div>').mousedown($.timeEntry._handleSpinner).mouseup($.timeEntry._endSpinner).mouseout($.timeEntry._endExpand).mousemove($.timeEntry._describeSpinner).insertAfter(c)}},_getInput:function(a){return $(a).siblings('.'+$.timeEntry.markerClassName)[0]},_describeSpinner:function(a){var b=$.timeEntry._getSpinnerTarget(a);var c=$.data($.timeEntry._getInput(b),m);b.title=$.timeEntry._get(c,'spinnerTexts')[$.timeEntry._getSpinnerRegion(c,a)]},_handleSpinner:function(a){var b=$.timeEntry._getSpinnerTarget(a);var c=$.timeEntry._getInput(b);if($.timeEntry._isDisabledTimeEntry(c)){return}if(c==$.timeEntry._blurredInput){$.timeEntry._lastInput=c;$.timeEntry._blurredInput=null}var d=$.data(c,m);$.timeEntry._doFocus(c);var e=$.timeEntry._getSpinnerRegion(d,a);$.timeEntry._changeSpinner(d,b,e);$.timeEntry._actionSpinner(d,e);$.timeEntry._timer=null;$.timeEntry._handlingSpinner=true;var f=$.timeEntry._get(d,'spinnerRepeat');if(e>=3&&f[0]){$.timeEntry._timer=setTimeout(function(){$.timeEntry._repeatSpinner(d,e)},f[0]);$(b).one('mouseout',$.timeEntry._releaseSpinner).one('mouseup',$.timeEntry._releaseSpinner)}},_actionSpinner:function(a,b){if(!a.input.val()){$.timeEntry._parseTime(a)}switch(b){case 0:this._setTime(a);break;case 1:this._changeField(a,-1,false);break;case 2:this._changeField(a,+1,false);break;case 3:this._adjustField(a,+1);break;case 4:this._adjustField(a,-1);break}},_repeatSpinner:function(a,b){if(!$.timeEntry._timer){return}$.timeEntry._lastInput=$.timeEntry._blurredInput;this._actionSpinner(a,b);this._timer=setTimeout(function(){$.timeEntry._repeatSpinner(a,b)},this._get(a,'spinnerRepeat')[1])},_releaseSpinner:function(a){clearTimeout($.timeEntry._timer);$.timeEntry._timer=null},_endExpand:function(a){$.timeEntry._timer=null;var b=$.timeEntry._getSpinnerTarget(a);var c=$.timeEntry._getInput(b);var d=$.data(c,m);$(b).remove();d._expanded=false},_endSpinner:function(a){$.timeEntry._timer=null;var b=$.timeEntry._getSpinnerTarget(a);var c=$.timeEntry._getInput(b);var d=$.data(c,m);if(!$.timeEntry._isDisabledTimeEntry(c)){$.timeEntry._changeSpinner(d,b,-1)}if($.timeEntry._handlingSpinner){$.timeEntry._lastInput=$.timeEntry._blurredInput}if($.timeEntry._lastInput&&$.timeEntry._handlingSpinner){$.timeEntry._showField(d)}$.timeEntry._handlingSpinner=false},_getSpinnerTarget:function(a){return a.target||a.srcElement},_getSpinnerRegion:function(a,b){var c=this._getSpinnerTarget(b);var d=($.browser.opera||$.browser.safari?$.timeEntry._findPos(c):$(c).offset());var e=($.browser.safari?$.timeEntry._findScroll(c):[document.documentElement.scrollLeft||document.body.scrollLeft,document.documentElement.scrollTop||document.body.scrollTop]);var f=this._get(a,'spinnerIncDecOnly');var g=(f?99:b.clientX+e[0]-d.left-($.browser.msie?2:0));var h=b.clientY+e[1]-d.top-($.browser.msie?2:0);var i=this._get(a,(a._expanded?'spinnerBigSize':'spinnerSize'));var j=(f?99:i[0]-1-g);var k=i[1]-1-h;if(i[2]>0&&Math.abs(g-j)<=i[2]&&Math.abs(h-k)<=i[2]){return 0}var l=Math.min(g,h,j,k);return(l==g?1:(l==j?2:(l==h?3:4)))},_changeSpinner:function(a,b,c){$(b).css('background-position','-'+((c+1)*this._get(a,(a._expanded?'spinnerBigSize':'spinnerSize'))[0])+'px 0px')},_findPos:function(a){var b=curTop=0;if(a.offsetParent){b=a.offsetLeft;curTop=a.offsetTop;while(a=a.offsetParent){var c=b;b+=a.offsetLeft;if(b<0){b=c}curTop+=a.offsetTop}}return{left:b,top:curTop}},_findScroll:function(a){var b=false;$(a).parents().each(function(){b|=$(this).css('position')=='fixed'});if(b){return[0,0]}var c=a.scrollLeft;var d=a.scrollTop;while(a=a.parentNode){c+=a.scrollLeft||0;d+=a.scrollTop||0}return[c,d]},_get:function(a,b){return(a.options[b]!=null?a.options[b]:$.timeEntry._defaults[b])},_parseTime:function(a){var b=this._extractTime(a);var c=this._get(a,'showSeconds');if(b){a._selectedHour=b[0];a._selectedMinute=b[1];a._selectedSecond=b[2]}else{var d=this._constrainTime(a);a._selectedHour=d[0];a._selectedMinute=d[1];a._selectedSecond=(c?d[2]:0)}a._secondField=(c?2:-1);a._ampmField=(this._get(a,'show24Hours')?-1:(c?3:2));a._lastChr='';a._field=Math.max(0,Math.min(Math.max(1,a._secondField,a._ampmField),this._get(a,'initialField')));if(a.input.val()!=''){this._showTime(a)}},_extractTime:function(a){var b=a.input.val();var c=this._get(a,'separator');var d=b.split(c);if(c==''&&b!=''){d[0]=b.substring(0,2);d[1]=b.substring(2,4);d[2]=b.substring(4,6)}var e=this._get(a,'ampmNames');var f=this._get(a,'show24Hours');if(d.length>=2){var g=!f&&(b.indexOf(e[0])>-1);var h=!f&&(b.indexOf(e[1])>-1);var i=parseInt(d[0],10);i=(isNaN(i)?0:i);i=((g||h)&&i==12?0:i)+(h?12:0);var j=parseInt(d[1],10);j=(isNaN(j)?0:j);var k=(d.length>=3?parseInt(d[2],10):0);k=(isNaN(k)||!this._get(a,'showSeconds')?0:k);return this._constrainTime(a,[i,j,k])}return null},_constrainTime:function(a,b){var c=(b!=null);if(!c){var d=this._determineTime(this._get(a,'defaultTime'))||new Date();b=[d.getHours(),d.getMinutes(),d.getSeconds()]}var e=false;var f=this._get(a,'timeSteps');for(var i=0;i<f.length;i++){if(e){b[i]=0}else if(f[i]>1){b[i]=Math.round(b[i]/f[i])*f[i];e=true}}return b},_showTime:function(a){var b=this._get(a,'show24Hours');var c=this._get(a,'separator');var d=(this._formatNumber(b?a._selectedHour:((a._selectedHour+11)%12)+1)+c+this._formatNumber(a._selectedMinute)+(this._get(a,'showSeconds')?c+this._formatNumber(a._selectedSecond):'')+(b?'':this._get(a,'ampmPrefix')+this._get(a,'ampmNames')[(a._selectedHour<12?0:1)]));this._setValue(a,d);this._showField(a)},_showField:function(a){var b=a.input[0];if(a.input.is(':hidden')||$.timeEntry._lastInput!=b){return}var c=this._get(a,'separator');var d=c.length+2;var e=(a._field!=a._ampmField?(a._field*d):(a._ampmField*d)-c.length+this._get(a,'ampmPrefix').length);var f=e+(a._field!=a._ampmField?2:this._get(a,'ampmNames')[0].length);if(b.setSelectionRange){b.setSelectionRange(e,f)}else if(b.createTextRange){var g=b.createTextRange();g.moveStart('character',e);g.moveEnd('character',f-a.input.val().length);g.select()}if(!b.disabled){b.focus()}},_formatNumber:function(a){return(a<10?'0':'')+a},_setValue:function(a,b){if(b!=a.input.val()){a.input.val(b).trigger('change')}},_changeField:function(a,b,c){var d=(a.input.val()==''||a._field==(b==-1?0:Math.max(1,a._secondField,a._ampmField)));if(!d){a._field+=b}this._showField(a);a._lastChr='';$.data(a.input[0],m,a);return(d&&c)},_adjustField:function(a,b){if(a.input.val()==''){b=0}var c=this._get(a,'timeSteps');this._setTime(a,new Date(0,0,0,a._selectedHour+(a._field==0?b*c[0]:0)+(a._field==a._ampmField?b*12:0),a._selectedMinute+(a._field==1?b*c[1]:0),a._selectedSecond+(a._field==a._secondField?b*c[2]:0)))},_setTime:function(a,b){b=this._determineTime(b);var c=this._constrainTime(a,b?[b.getHours(),b.getMinutes(),b.getSeconds()]:null);b=new Date(0,0,0,c[0],c[1],c[2]);var b=this._normaliseTime(b);var d=this._normaliseTime(this._determineTime(this._get(a,'minTime')));var e=this._normaliseTime(this._determineTime(this._get(a,'maxTime')));b=(d&&b<d?d:(e&&b>e?e:b));var f=this._get(a,'beforeSetTime');if(f){b=f.apply(a.input[0],[this._getTimeTimeEntry(a.input[0]),b,d,e])}a._selectedHour=b.getHours();a._selectedMinute=b.getMinutes();a._selectedSecond=b.getSeconds();this._showTime(a);$.data(a.input[0],m,a)},_determineTime:function(h){var i=function(a){var b=new Date();b.setTime(b.getTime()+a*1000);return b};var j=function(a){var b=new Date();var c=b.getHours();var d=b.getMinutes();var e=b.getSeconds();var f=/([+-]?[0-9]+)\s*(s|S|m|M|h|H)?/g;var g=f.exec(a);while(g){switch(g[2]||'s'){case's':case'S':e+=parseInt(g[1],10);break;case'm':case'M':d+=parseInt(g[1],10);break;case'h':case'H':c+=parseInt(g[1],10);break}g=f.exec(a)}b=new Date(0,0,10,c,d,e,0);if(/^!/.test(a)){if(b.getDate()>10){b=new Date(0,0,10,23,59,59)}else if(b.getDate()<10){b=new Date(0,0,10,0,0,0)}}return b};return(h?(typeof h=='string'?j(h):(typeof h=='number'?i(h):h)):null)},_normaliseTime:function(a){if(!a){return null}a.setFullYear(1900);a.setMonth(0);a.setDate(0);return a},_handleKeyPress:function(a,b){if(b==this._get(a,'separator')){this._changeField(a,+1,false)}else if(b>='0'&&b<='9'){var c=parseInt(b,10);var d=parseInt(a._lastChr+b,10);var e=this._get(a,'show24Hours');var f=(a._field!=0?a._selectedHour:(e?(d<24?d:c):(d>=1&&d<=12?d:(c>0?c:a._selectedHour))%12+(a._selectedHour>=12?12:0)));var g=(a._field!=1?a._selectedMinute:(d<60?d:c));var h=(a._field!=a._secondField?a._selectedSecond:(d<60?d:c));var i=this._constrainTime(a,[f,g,h]);this._setTime(a,new Date(0,0,0,i[0],i[1],i[2]));a._lastChr=b}else if(!this._get(a,'show24Hours')){var j=this._get(a,'ampmNames');if((b==j[0].substring(0,1).toLowerCase()&&a._selectedHour>=12)||(b==j[1].substring(0,1).toLowerCase()&&a._selectedHour<12)){var k=a._field;a._field=a._ampmField;this._adjustField(a,+1);a._field=k;this._showField(a)}}}});function extendRemove(a,b){$.extend(a,b);for(var c in b){if(b[c]==null){a[c]=null}}return a}$.fn.timeEntry=function(c){var d=Array.prototype.slice.call(arguments,1);if(typeof c=='string'&&(c=='isDisabled'||c=='getTime')){return $.timeEntry['_'+c+'TimeEntry'].apply($.timeEntry,[this[0]].concat(d))}return this.each(function(){var a=this.nodeName.toLowerCase();if(a=='input'){if(typeof c=='string'){$.timeEntry['_'+c+'TimeEntry'].apply($.timeEntry,[this].concat(d))}else{var b=($.fn.metadata?$(this).metadata():{});$.timeEntry._connectTimeEntry(this,$.extend(b,c))}}})};$.timeEntry=new TimeEntry()})(jQuery);
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END Timeentry

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START Superfish sftouchscreen Support

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
 * sf-Touchscreen v1.0b - Provides touchscreen compatibility for the jQuery Superfish plugin. - LAST UPDATE: MARCH 23rd, 2011
 *
 * Developer's notes:
 * Built as a part of the Superfish project for Drupal (http://drupal.org/project/superfish) 
 * Found any bug? have any cool ideas? contact me right away! http://drupal.org/user/619294/contact
 *
 * jQuery version: 1.3.x or higher.
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
*/

(function($){
  $.fn.sftouchscreen = function() {
    // Return original object to support chaining.
    return this.each( function() {
      // Select hyperlinks from parent menu items.
      $(this).find('li > ul').closest('li').children('a').each( function() {
	    var $item = $(this);
        // No .toggle() here as it's not possible to reset it.
        $item.click( function(event){
	      // Already clicked? proceed to the URI.
          if ($item.hasClass('sf-clicked')) {
            var $uri = $item.attr('href');
            window.location = $uri;
          }
          else {
            event.preventDefault();
            $item.addClass('sf-clicked');
          }
        }).closest('li').mouseleave( function(){
          // So, we reset everything.
          $item.removeClass('sf-clicked');
        });
	  });
    });
  };
})(jQuery);
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END Superfish sftouchscreen Support

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START Superfish Supersubs Menu Support

********************************************************************************************************************************
********************************************************************************************************************************
*/
;(function($){ // $ will refer to jQuery within this closure

	$.fn.supersubs = function(options){
		var opts = $.extend({}, $.fn.supersubs.defaults, options);
		// return original object to support chaining
		return this.each(function() {
			// cache selections
			var $$ = $(this);
			// support metadata
			var o = $.meta ? $.extend({}, opts, $$.data()) : opts;
			// get the font size of menu.
			// .css('fontSize') returns various results cross-browser, so measure an em dash instead
			var fontsize = $('<li id="menu-fontsize">&#8212;</li>').css({
				'padding' : 0,
				'position' : 'absolute',
				'top' : '-999em',
				'width' : 'auto'
			}).appendTo($$).width(); //clientWidth is faster, but was incorrect here
			// remove em dash
			$('#menu-fontsize').remove();
			// cache all ul elements
			$ULs = $$.find('ul');
			// loop through each ul in menu
			$ULs.each(function(i) {	
				// cache this ul
				var $ul = $ULs.eq(i);
				// get all (li) children of this ul
				var $LIs = $ul.children();
				// get all anchor grand-children
				var $As = $LIs.children('a');
				// force content to one line and save current float property
				var liFloat = $LIs.css('white-space','nowrap').css('float');
				// remove width restrictions and floats so elements remain vertically stacked
				var emWidth = $ul.add($LIs).add($As).css({
					'float' : 'none',
					'width'	: 'auto'
				})
				// this ul will now be shrink-wrapped to longest li due to position:absolute
				// so save its width as ems. Clientwidth is 2 times faster than .width() - thanks Dan Switzer
				.end().end()[0].clientWidth / fontsize;
				// add more width to ensure lines don't turn over at certain sizes in various browsers
				emWidth += o.extraWidth;
				// restrict to at least minWidth and at most maxWidth
				if (emWidth > o.maxWidth)		{ emWidth = o.maxWidth; }
				else if (emWidth < o.minWidth)	{ emWidth = o.minWidth; }
				emWidth += 'em';
				// set ul to width in ems
				$ul.css('width',emWidth);
				// restore li floats to avoid IE bugs
				// set li width to full width of this ul
				// revert white-space to normal
				$LIs.css({
					'float' : liFloat,
					'width' : '100%',
					'white-space' : 'normal'
				})
				// update offset position of descendant ul to reflect new width of parent
				.each(function(){
					var $childUl = $('>ul',this);
					var offsetDirection = $childUl.css('left')!==undefined ? 'left' : 'right';
					$childUl.css(offsetDirection,emWidth);
				});
			});
			
		});
	};
	// expose defaults
	$.fn.supersubs.defaults = {
		minWidth		: 9,		// requires em unit.
		maxWidth		: 25,		// requires em unit.
		extraWidth		: 0			// extra width can ensure lines don't sometimes turn over due to slight browser differences in how they round-off values
	};
	
})(jQuery); // plugin code ends
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END Superfish Supersubs Menu Support

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START Superfish Menu

********************************************************************************************************************************
********************************************************************************************************************************
*/
(function($){
	$.fn.superfish = function(op){

		var sf = $.fn.superfish,
			c = sf.c,
			$arrow = $(['<span class="',c.arrowClass,'"> &#187;</span>'].join('')),
			over = function(){
				var $$ = $(this), menu = getMenu($$);
				clearTimeout(menu.sfTimer);
				$$.showSuperfishUl().siblings().hideSuperfishUl();
			},
			out = function(){
				var $$ = $(this), menu = getMenu($$), o = sf.op;
				clearTimeout(menu.sfTimer);
				menu.sfTimer=setTimeout(function(){
					o.retainPath=($.inArray($$[0],o.$path)>-1);
					$$.hideSuperfishUl();
					if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}
				},o.delay);	
			},
			getMenu = function($menu){
				var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];
				sf.op = sf.o[menu.serial];
				return menu;
			},
			addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); };
			
		return this.each(function() {
			var s = this.serial = sf.o.length;
			var o = $.extend({},sf.defaults,op);
			o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){
				$(this).addClass([o.hoverClass,c.bcClass].join(' '))
					.filter('li:has(ul)').removeClass(o.pathClass);
			});
			sf.o[s] = sf.op = o;
// START Bizamajig Customization 
// Testing:
//            if ( (o.eventType === 'hoverIntent' && !$.fn.hoverIntent) || !(/^(?:hover|hoverIntent|toggle|click)$/).test(o.eventType) ) { 
//              o.eventType = 'hover'; 
//            } 
// END Bizamajig Customization 
			
/*
$('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 
'hoverIntent' : 'hover'](over,out).each(function() {...}); 

To: 

$('li:has(ul)',this).click(over).hover(function() 
{},out).each(function() { ... }); 

*/

//			$('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
	
			if ( ( bizamajig__config.browser === 'safari' ) || ( bizamajig__config.browser === 'chrome' ) || ( bizamajig__config.browser === 'ie6' ) || ( bizamajig__config.browser === 'ie' ) ) {
				$('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
						if (o.autoArrows) addArrow( $('>a:first-child',this) );
					})
					.not('.'+c.bcClass)
						.hideSuperfishUl();
			}
			else {
				if ( bizamajig__config.bizamajig_portal_owner_party_id === '22775' ) { // hardcode: bodegagratia.com
					$('li:has(ul)',this).click(over).hover(function() {
						if (o.autoArrows) addArrow( $('>a:first-child',this) );
					})
					.not('.'+c.bcClass)
						.hideSuperfishUl();
				}
				else {
					$('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
							if (o.autoArrows) addArrow( $('>a:first-child',this) );
						})
						.not('.'+c.bcClass)
							.hideSuperfishUl();
				}
			}

			
			var $a = $('a',this);
			$a.each(function(i){
				var $li = $a.eq(i).parents('li');
				$a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});
			});
			o.onInit.call(this);
			
		}).each(function() {
			var menuClasses = [c.menuClass];
			if (sf.op.dropShadows  && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
			$(this).addClass(menuClasses.join(' '));
		});
	};

	var sf = $.fn.superfish;
	sf.o = [];
	sf.op = {};
	sf.IE7fix = function(){
		var o = sf.op;
		if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined)
			this.toggleClass(sf.c.shadowClass+'-off');
		};
	sf.c = {
		bcClass     : 'sf-breadcrumb',
		menuClass   : 'sf-js-enabled',
		anchorClass : 'sf-with-ul',
		arrowClass  : 'sf-sub-indicator',
		shadowClass : 'sf-shadow'
	};
	sf.defaults = {
		hoverClass	: 'sfHover',
		pathClass	: 'overideThisToUse',
		pathLevels	: 1,
		delay		: 800,
		animation	: {opacity:'show'},
		speed		: 'normal',
		autoArrows	: true,
		dropShadows : true,
// START Bizamajig Customization 
//        eventType   : 'click', // one of 'toggle', 'hover', or 'hoverIntent' 
// END Bizamajig Customization 
		disableHI	: false,		// true disables hoverIntent detection
		onInit		: function(){}, // callback functions
		onBeforeShow: function(){},
		onShow		: function(){},
		onHide		: function(){}

	};
	$.fn.extend({
		hideSuperfishUl : function(){
			var o = sf.op,
				not = (o.retainPath===true) ? o.$path : '';
			o.retainPath = false;
			var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass)
					.find('>ul').hide().css('visibility','hidden');
			o.onHide.call($ul);
			return this;
		},
		showSuperfishUl : function(){
			var o = sf.op,
				sh = sf.c.shadowClass+'-off',
				$ul = this.addClass(o.hoverClass)
					.find('>ul:hidden').css('visibility','visible');
			sf.IE7fix.call($ul);
			o.onBeforeShow.call($ul);
			$ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); });
			return this;
		}
	});

})(jQuery);
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END Superfish Menu

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START Mega Menu Plugin v 1.3.4-8 (Requires HoverIntent & Cookie Plugins above)

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
 * DC Mega Menu - jQuery mega menu
 * Copyright (c) 2011 Design Chemical
 * http://www.designchemical.com/blog/
 *
 * Dual licensed under the MIT and GPL licenses:
 * 	http://www.opensource.org/licenses/mit-license.php
 * 	http://www.gnu.org/licenses/gpl.html
 *
 */
(function($){$.fn.dcMegaMenu=function(options){var defaults={classParent:'dc-mega',classContainer:'sub-container',classSubParent:'mega-hdr',classSubLink:'mega-hdr',classWidget:'dc-extra',rowItems:3,speed:'fast',effect:'fade',event:'hover',fullWidth:false,onLoad:function(){},beforeOpen:function(){},beforeClose:function(){}};var options=$.extend(defaults,options);var $dcMegaMenuObj=this;return $dcMegaMenuObj.each(function(options){var clSubParent=defaults.classSubParent;var clSubLink=defaults.classSubLink;var clParent=defaults.classParent;var clContainer=defaults.classContainer;var clWidget=defaults.classWidget;megaSetup();function megaOver(){var subNav=$('.sub',this);$(this).addClass('mega-hover');if(defaults.effect=='fade'){$(subNav).fadeIn(defaults.speed)}if(defaults.effect=='slide'){$(subNav).show(defaults.speed)}defaults.beforeOpen.call(this)}function megaAction(obj){var subNav=$('.sub',obj);$(obj).addClass('mega-hover');if(defaults.effect=='fade'){$(subNav).fadeIn(defaults.speed)}if(defaults.effect=='slide'){$(subNav).show(defaults.speed)}defaults.beforeOpen.call(this)}function megaOut(){var subNav=$('.sub',this);$(this).removeClass('mega-hover');$(subNav).hide();defaults.beforeClose.call(this)}function megaActionClose(obj){var subNav=$('.sub',obj);$(obj).removeClass('mega-hover');$(subNav).hide();defaults.beforeClose.call(this)}function megaReset(){$('li',$dcMegaMenuObj).removeClass('mega-hover');$('.sub',$dcMegaMenuObj).hide()}function megaSetup(){$arrow='<span class="dc-mega-icon"></span>';var clParentLi=clParent+'-li';var menuWidth=$dcMegaMenuObj.outerWidth();$('> li',$dcMegaMenuObj).each(function(){var $mainSub=$('> ul',this);var $primaryLink=$('> a',this);if($mainSub.length){$primaryLink.addClass(clParent).append($arrow);$mainSub.addClass('sub').wrap('<div class="'+clContainer+'" />');var pos=$(this).position();pl=pos.left;if($('ul',$mainSub).length){$(this).addClass(clParentLi);$('.'+clContainer,this).addClass('mega');$('> li',$mainSub).each(function(){if(!$(this).hasClass(clWidget)){$(this).addClass('mega-unit');if($('> ul',this).length){$(this).addClass(clSubParent);$('> a',this).addClass(clSubParent+'-a')}else{$(this).addClass(clSubLink);$('> a',this).addClass(clSubLink+'-a')}}});var hdrs=$('.mega-unit',this);rowSize=parseInt(defaults.rowItems);for(var i=0;i<hdrs.length;i+=rowSize){hdrs.slice(i,i+rowSize).wrapAll('<div class="row" />')}$mainSub.show();var pw=$(this).width();var pr=pl+pw;var mr=menuWidth-pr;var subw=$mainSub.outerWidth();var totw=$mainSub.parent('.'+clContainer).outerWidth();var cpad=totw-subw;if(defaults.fullWidth==true){var fw=menuWidth-cpad;$mainSub.parent('.'+clContainer).css({width:fw+'px'});$dcMegaMenuObj.addClass('full-width')}var iw=$('.mega-unit',$mainSub).outerWidth(true);var rowItems=$('.row:eq(0) .mega-unit',$mainSub).length;var inneriw=iw*rowItems;var totiw=inneriw+cpad;$('.row',this).each(function(){$('.mega-unit:last',this).addClass('last');var maxValue=undefined;$('.mega-unit > a',this).each(function(){var val=parseInt($(this).height());if(maxValue===undefined||maxValue<val){maxValue=val}});$('.mega-unit > a',this).css('height',maxValue+'px');$(this).css('width',inneriw+'px')});var ml=mr<ml?ml+ml-mr:(totiw-pw)/2;var subLeft=pl-ml;var params={left:pl+'px',marginLeft:-ml+'px'};if(subLeft<0||defaults.fullWidth==true){params={left:0}}else if(mr<ml){params={right:0}}$('.'+clContainer,this).css(params);$('.row',$mainSub).each(function(){var rh=$(this).height();$('.mega-unit',this).css({height:rh+'px'});$(this).parent('.row').css({height:rh+'px'})});$mainSub.hide()}else{$('.'+clContainer,this).addClass('non-mega').css('left',pl+'px')}}});var menuHeight=$('> li > a',$dcMegaMenuObj).outerHeight(true);$('.'+clContainer,$dcMegaMenuObj).css({top:menuHeight+'px'}).css('z-index','1000');if(defaults.event=='hover'){var config={sensitivity:2,interval:100,over:megaOver,timeout:400,out:megaOut};$('li',$dcMegaMenuObj).hoverIntent(config)}if(defaults.event=='click'){$('body').mouseup(function(e){if(!$(e.target).parents('.mega-hover').length){megaReset()}});$('> li > a.'+clParent,$dcMegaMenuObj).click(function(e){var $parentLi=$(this).parent();if($parentLi.hasClass('mega-hover')){megaActionClose($parentLi)}else{megaAction($parentLi)}e.preventDefault()})}defaults.onLoad.call(this)}})}})(jQuery);
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END Mega Menu Plugin v 1.3.4-8 (Requires HoverIntent & Cookie Plugins above)

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START jQuery Vertical Accordion Menu Plugin v 2.6 (Requires HoverIntent & Cookie Plugins above)

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
 * DC Mega Menu - jQuery dcAccordion
 * Copyright (c) 2011 Design Chemical
 * http://www.designchemical.com/blog/
 *
 * Dual licensed under the MIT and GPL licenses:
 * 	http://www.opensource.org/licenses/mit-license.php
 * 	http://www.gnu.org/licenses/gpl.html
 *
 */
(function($){$.fn.dcAccordion=function(options){var defaults={classParent:'dcjq-parent',classActive:'active',classArrow:'dcjq-icon',classCount:'dcjq-count',classExpand:'dcjq-current-parent',eventType:'click',hoverDelay:300,menuClose:true,autoClose:true,autoExpand:false,speed:'slow',saveState:true,disableLink:true,showCount:false,cookie:'dcjq-accordion'};var options=$.extend(defaults,options);this.each(function(options){var obj=this;setUpAccordion();if(defaults.saveState==true){checkCookie(defaults.cookie,obj)}if(defaults.autoExpand==true){$('li.'+defaults.classExpand+' > a').addClass(defaults.classActive)}resetAccordion();if(defaults.eventType=='hover'){var config={sensitivity:2,interval:defaults.hoverDelay,over:linkOver,timeout:defaults.hoverDelay,out:linkOut};$('li a',obj).hoverIntent(config);var configMenu={sensitivity:2,interval:1000,over:menuOver,timeout:1000,out:menuOut};$(obj).hoverIntent(configMenu);if(defaults.disableLink==true){$('li a',obj).click(function(e){if($(this).siblings('ul').length>0){e.preventDefault()}})}}else{$('li a',obj).click(function(e){$activeLi=$(this).parent('li');$parentsLi=$activeLi.parents('li');$parentsUl=$activeLi.parents('ul');if(defaults.disableLink==true){if($(this).siblings('ul').length>0){e.preventDefault()}}if(defaults.autoClose==true){autoCloseAccordion($parentsLi,$parentsUl)}if($('> ul',$activeLi).is(':visible')){$('ul',$activeLi).slideUp(defaults.speed);$('a',$activeLi).removeClass(defaults.classActive)}else{$(this).siblings('ul').slideToggle(defaults.speed);$('> a',$activeLi).addClass(defaults.classActive)}if(defaults.saveState==true){createCookie(defaults.cookie,obj)}})}function setUpAccordion(){$arrow='<span class="'+defaults.classArrow+'"></span>';var classParentLi=defaults.classParent+'-li';$('> ul',obj).show();$('li',obj).each(function(){if($('> ul',this).length>0){$(this).addClass(classParentLi);$('> a',this).addClass(defaults.classParent).append($arrow)}});$('> ul',obj).hide();if(defaults.showCount==true){$('li.'+classParentLi,obj).each(function(){if(defaults.disableLink==true){var getCount=parseInt($('ul a:not(.'+defaults.classParent+')',this).length)}else{var getCount=parseInt($('ul a',this).length)}$('> a',this).append(' <span class="'+defaults.classCount+'">('+getCount+')</span>')})}}function linkOver(){$activeLi=$(this).parent('li');$parentsLi=$activeLi.parents('li');$parentsUl=$activeLi.parents('ul');if(defaults.autoClose==true){autoCloseAccordion($parentsLi,$parentsUl)}if($('> ul',$activeLi).is(':visible')){$('ul',$activeLi).slideUp(defaults.speed);$('a',$activeLi).removeClass(defaults.classActive)}else{$(this).siblings('ul').slideToggle(defaults.speed);$('> a',$activeLi).addClass(defaults.classActive)}if(defaults.saveState==true){createCookie(defaults.cookie,obj)}}function linkOut(){}function menuOver(){}function menuOut(){if(defaults.menuClose==true){$('ul',obj).slideUp(defaults.speed);$('a',obj).removeClass(defaults.classActive);createCookie(defaults.cookie,obj)}}function autoCloseAccordion($parentsLi,$parentsUl){$('ul',obj).not($parentsUl).slideUp(defaults.speed);$('a',obj).removeClass(defaults.classActive);$('> a',$parentsLi).addClass(defaults.classActive)}function resetAccordion(){$('ul',obj).hide();$allActiveLi=$('a.'+defaults.classActive,obj);$allActiveLi.siblings('ul').show()}});function checkCookie(cookieId,obj){var cookieVal=$.cookie(cookieId);if(cookieVal!=null){var activeArray=cookieVal.split(',');$.each(activeArray,function(index,value){var $cookieLi=$('li:eq('+value+')',obj);$('> a',$cookieLi).addClass(defaults.classActive);var $parentsLi=$cookieLi.parents('li');$('> a',$parentsLi).addClass(defaults.classActive)})}}function createCookie(cookieId,obj){var activeIndex=[];$('li a.'+defaults.classActive,obj).each(function(i){var $arrayItem=$(this).parent('li');var itemIndex=$('li',obj).index($arrayItem);activeIndex.push(itemIndex)});$.cookie(cookieId,activeIndex,{path:'/'})}}})(jQuery);
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END jQuery Vertical Accordion Menu Plugin v 2.6 (Requires HoverIntent & Cookie Plugins above)

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START CHOSEN SELECT BOX

********************************************************************************************************************************
********************************************************************************************************************************
*/
// Chosen, a Select Box Enhancer for jQuery and Protoype
// by Patrick Filler for Harvest, http://getharvest.com
// 
// Version 0.9.5
// Full source at https://github.com/harvesthq/chosen
// Copyright (c) 2011 Harvest http://getharvest.com 

// MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
// This file is generated by `cake build`, do not edit it by hand.
(function(){var a;a=function(){function a(){this.options_index=0,this.parsed=[]}return a.prototype.add_node=function(a){return a.nodeName==="OPTGROUP"?this.add_group(a):this.add_option(a)},a.prototype.add_group=function(a){var b,c,d,e,f,g;b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:a.label,children:0,disabled:a.disabled}),f=a.childNodes,g=[];for(d=0,e=f.length;d<e;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},a.prototype.add_option=function(a,b,c){if(a.nodeName==="OPTION")return a.text!==""?(b!=null&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},a}(),a.select_to_array=function(b){var c,d,e,f,g;d=new a,g=b.childNodes;for(e=0,f=g.length;e<f;e++)c=g[e],d.add_node(c);return d.parsed},this.SelectParser=a}).call(this),function(){var a,b,c=function(a,b){return function(){return a.apply(b,arguments)}};b=this,a=function(){function a(a,b){this.form_field=a,this.options=b!=null?b:{},this.set_default_values(),this.is_multiple=this.form_field.multiple,this.default_text_default=this.is_multiple?"Select Some Options":"Select an Option",this.setup(),this.set_up_html(),this.register_observers(),this.finish_setup()}return a.prototype.set_default_values=function(){return this.click_test_action=c(function(a){return this.test_active_click(a)},this),this.activate_action=c(function(a){return this.activate_field(a)},this),this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.result_single_selected=null,this.allow_single_deselect=this.options.allow_single_deselect!=null&&this.form_field.options[0]!=null&&this.form_field.options[0].text===""?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.choices=0,this.results_none_found=this.options.no_results_text||"No results match"},a.prototype.mouse_enter=function(){return this.mouse_on_container=!0},a.prototype.mouse_leave=function(){return this.mouse_on_container=!1},a.prototype.input_focus=function(a){if(!this.active_field)return setTimeout(c(function(){return this.container_mousedown()},this),50)},a.prototype.input_blur=function(a){if(!this.mouse_on_container)return this.active_field=!1,setTimeout(c(function(){return this.blur_test()},this),100)},a.prototype.result_add_option=function(a){var b,c;return a.disabled?"":(a.dom_id=this.container_id+"_o_"+a.array_index,b=a.selected&&this.is_multiple?[]:["active-result"],a.selected&&b.push("result-selected"),a.group_array_index!=null&&b.push("group-option"),a.classes!==""&&b.push(a.classes),c=a.style.cssText!==""?' style="'+a.style+'"':"",'<li id="'+a.dom_id+'" class="'+b.join(" ")+'"'+c+">"+a.html+"</li>")},a.prototype.results_update_field=function(){return this.result_clear_highlight(),this.result_single_selected=null,this.results_build()},a.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},a.prototype.results_search=function(a){return this.results_showing?this.winnow_results():this.results_show()},a.prototype.keyup_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale();switch(b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:a.preventDefault();if(this.results_showing)return this.result_select(a);break;case 27:if(this.results_showing)return this.results_hide();break;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},a.prototype.generate_field_id=function(){var a;return a=this.generate_random_id(),this.form_field.id=a,a},a.prototype.generate_random_char=function(){var a,b,c;return a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ",c=Math.floor(Math.random()*a.length),b=a.substring(c,c+1)},a}(),b.AbstractChosen=a}.call(this),function(){var a,b,c,d,e=Object.prototype.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a},g=function(a,b){return function(){return a.apply(b,arguments)}};d=this,a=jQuery,a.fn.extend({chosen:function(c){return!a.browser.msie||a.browser.version!=="6.0"&&a.browser.version!=="7.0"?a(this).each(function(d){if(!a(this).hasClass("chzn-done"))return new b(this,c)}):this}}),b=function(){function b(){b.__super__.constructor.apply(this,arguments)}return f(b,AbstractChosen),b.prototype.setup=function(){return this.form_field_jq=a(this.form_field),this.is_rtl=this.form_field_jq.hasClass("chzn-rtl")},b.prototype.finish_setup=function(){return this.form_field_jq.addClass("chzn-done")},b.prototype.set_up_html=function(){var b,d,e,f;return this.container_id=this.form_field.id.length?this.form_field.id.replace(/(:|\.)/g,"_"):this.generate_field_id(),this.container_id+="_chzn",this.f_width=this.form_field_jq.outerWidth(),this.default_text=this.form_field_jq.data("placeholder")?this.form_field_jq.data("placeholder"):this.default_text_default,b=a("<div />",{id:this.container_id,"class":"chzn-container"+(this.is_rtl?" chzn-rtl":""),style:"width: "+this.f_width+"px;"}),this.is_multiple?b.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'):b.html('<a href="javascript:void(0)" class="chzn-single"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'),this.form_field_jq.hide().after(b),this.container=a("#"+this.container_id),this.container.addClass("chzn-container-"+(this.is_multiple?"multi":"single")),this.dropdown=this.container.find("div.chzn-drop").first(),d=this.container.height(),e=this.f_width-c(this.dropdown),this.dropdown.css({width:e+"px",top:d+"px"}),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chzn-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chzn-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chzn-search").first(),this.selected_item=this.container.find(".chzn-single").first(),f=e-c(this.search_container)-c(this.search_field),this.search_field.css({width:f+"px"})),this.results_build(),this.set_tab_index(),this.form_field_jq.trigger("liszt:ready",{chosen:this})},b.prototype.register_observers=function(){this.container.mousedown(g(function(a){return this.container_mousedown(a)},this)),this.container.mouseup(g(function(a){return this.container_mouseup(a)},this)),this.container.mouseenter(g(function(a){return this.mouse_enter(a)},this)),this.container.mouseleave(g(function(a){return this.mouse_leave(a)},this)),this.search_results.mouseup(g(function(a){return this.search_results_mouseup(a)},this)),this.search_results.mouseover(g(function(a){return this.search_results_mouseover(a)},this)),this.search_results.mouseout(g(function(a){return this.search_results_mouseout(a)},this)),this.form_field_jq.bind("liszt:updated",g(function(a){return this.results_update_field(a)},this)),this.search_field.blur(g(function(a){return this.input_blur(a)},this)),this.search_field.keyup(g(function(a){return this.keyup_checker(a)},this)),this.search_field.keydown(g(function(a){return this.keydown_checker(a)},this));if(this.is_multiple)return this.search_choices.click(g(function(a){return this.choices_click(a)},this)),this.search_field.focus(g(function(a){return this.input_focus(a)},this))},b.prototype.search_field_disabled=function(){this.is_disabled=this.form_field_jq[0].disabled;if(this.is_disabled)return this.container.addClass("chzn-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus",this.activate_action),this.close_field();this.container.removeClass("chzn-disabled"),this.search_field[0].disabled=!1;if(!this.is_multiple)return this.selected_item.bind("focus",this.activate_action)},b.prototype.container_mousedown=function(b){var c;if(!this.is_disabled)return c=b!=null?a(b.target).hasClass("search-choice-close"):!1,b&&b.type==="mousedown"&&b.stopPropagation(),!this.pending_destroy_click&&!c?(this.active_field?!this.is_multiple&&b&&(a(b.target)[0]===this.selected_item[0]||a(b.target).parents("a.chzn-single").length)&&(b.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),a(document).click(this.click_test_action),this.results_show()),this.activate_field()):this.pending_destroy_click=!1},b.prototype.container_mouseup=function(a){if(a.target.nodeName==="ABBR")return this.results_reset(a)},b.prototype.blur_test=function(a){if(!this.active_field&&this.container.hasClass("chzn-container-active"))return this.close_field()},b.prototype.close_field=function(){return a(document).unbind("click",this.click_test_action),this.is_multiple||(this.selected_item.attr("tabindex",this.search_field.attr("tabindex")),this.search_field.attr("tabindex",-1)),this.active_field=!1,this.results_hide(),this.container.removeClass("chzn-container-active"),this.winnow_results_clear(),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},b.prototype.activate_field=function(){return!this.is_multiple&&!this.active_field&&(this.search_field.attr("tabindex",this.selected_item.attr("tabindex")),this.selected_item.attr("tabindex",-1)),this.container.addClass("chzn-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},b.prototype.test_active_click=function(b){return a(b.target).parents("#"+this.container_id).length?this.active_field=!0:this.close_field()},b.prototype.results_build=function(){var a,b,c,e,f;this.parsing=!0,this.results_data=d.SelectParser.select_to_array(this.form_field),this.is_multiple&&this.choices>0?(this.search_choices.find("li.search-choice").remove(),this.choices=0):this.is_multiple||(this.selected_item.find("span").text(this.default_text),this.form_field.options.length>this.disable_search_threshold?this.container.removeClass("chzn-container-single-nosearch"):this.container.addClass("chzn-container-single-nosearch")),a="",f=this.results_data;for(c=0,e=f.length;c<e;c++)b=f[c],b.group?a+=this.result_add_group(b):b.empty||(a+=this.result_add_option(b),b.selected&&this.is_multiple?this.choice_build(b):b.selected&&!this.is_multiple&&(this.selected_item.find("span").text(b.text),this.allow_single_deselect&&this.single_deselect_control_build()));return this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.search_results.html(a),this.parsing=!1},b.prototype.result_add_group=function(b){return b.disabled?"":(b.dom_id=this.container_id+"_g_"+b.array_index,'<li id="'+b.dom_id+'" class="group-result">'+a("<div />").text(b.label).html()+"</li>")},b.prototype.result_do_highlight=function(a){var b,c,d,e,f;if(a.length){this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClass("highlighted"),d=parseInt(this.search_results.css("maxHeight"),10),f=this.search_results.scrollTop(),e=d+f,c=this.result_highlight.position().top+this.search_results.scrollTop(),b=c+this.result_highlight.outerHeight();if(b>=e)return this.search_results.scrollTop(b-d>0?b-d:0);if(c<f)return this.search_results.scrollTop(c)}},b.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},b.prototype.results_show=function(){var a;return this.is_multiple||(this.selected_item.addClass("chzn-single-with-drop"),this.result_single_selected&&this.result_do_highlight(this.result_single_selected)),a=this.is_multiple?this.container.height():this.container.height()-1,this.dropdown.css({top:a+"px",left:0}),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results()},b.prototype.results_hide=function(){return this.is_multiple||this.selected_item.removeClass("chzn-single-with-drop"),this.result_clear_highlight(),this.dropdown.css({left:"-9000px"}),this.results_showing=!1},b.prototype.set_tab_index=function(a){var b;if(this.form_field_jq.attr("tabindex"))return b=this.form_field_jq.attr("tabindex"),this.form_field_jq.attr("tabindex",-1),this.is_multiple?this.search_field.attr("tabindex",b):(this.selected_item.attr("tabindex",b),this.search_field.attr("tabindex",-1))},b.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},b.prototype.search_results_mouseup=function(b){var c;c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first();if(c.length)return this.result_highlight=c,this.result_select(b)},b.prototype.search_results_mouseover=function(b){var c;c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first();if(c)return this.result_do_highlight(c)},b.prototype.search_results_mouseout=function(b){if(a(b.target).hasClass("active-result"))return this.result_clear_highlight()},b.prototype.choices_click=function(b){b.preventDefault();if(this.active_field&&!a(b.target).hasClass("search-choice")&&!this.results_showing)return this.results_show()},b.prototype.choice_build=function(b){var c,d;return c=this.container_id+"_c_"+b.array_index,this.choices+=1,this.search_container.before('<li class="search-choice" id="'+c+'"><span>'+b.html+'</span><a href="javascript:void(0)" class="search-choice-close" rel="'+b.array_index+'"></a></li>'),d=a("#"+c).find("a").first(),d.click(g(function(a){return this.choice_destroy_link_click(a)},this))},b.prototype.choice_destroy_link_click=function(b){return b.preventDefault(),this.is_disabled?b.stopPropagation:(this.pending_destroy_click=!0,this.choice_destroy(a(b.target)))},b.prototype.choice_destroy=function(a){return this.choices-=1,this.show_search_field_default(),this.is_multiple&&this.choices>0&&this.search_field.val().length<1&&this.results_hide(),this.result_deselect(a.attr("rel")),a.parents("li").first().remove()},b.prototype.results_reset=function(b){this.form_field.options[0].selected=!0,this.selected_item.find("span").text(this.default_text),this.show_search_field_default(),a(b.target).remove(),this.form_field_jq.trigger("change");if(this.active_field)return this.results_hide()},b.prototype.result_select=function(a){var b,c,d,e;if(this.result_highlight)return b=this.result_highlight,c=b.attr("id"),this.result_clear_highlight(),this.is_multiple?this.result_deactivate(b):(this.search_results.find(".result-selected").removeClass("result-selected"),this.result_single_selected=b),b.addClass("result-selected"),e=c.substr(c.lastIndexOf("_")+1),d=this.results_data[e],d.selected=!0,this.form_field.options[d.options_index].selected=!0,this.is_multiple?this.choice_build(d):(this.selected_item.find("span").first().text(d.text),this.allow_single_deselect&&this.single_deselect_control_build()),(!a.metaKey||!this.is_multiple)&&this.results_hide(),this.search_field.val(""),this.form_field_jq.trigger("change"),this.search_field_scale()},b.prototype.result_activate=function(a){return a.addClass("active-result")},b.prototype.result_deactivate=function(a){return a.removeClass("active-result")},b.prototype.result_deselect=function(b){var c,d;return d=this.results_data[b],d.selected=!1,this.form_field.options[d.options_index].selected=!1,c=a("#"+this.container_id+"_o_"+b),c.removeClass("result-selected").addClass("active-result").show(),this.result_clear_highlight(),this.winnow_results(),this.form_field_jq.trigger("change"),this.search_field_scale()},b.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect&&this.selected_item.find("abbr").length<1)return this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>')},b.prototype.winnow_results=function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;this.no_results_clear(),i=0,j=this.search_field.val()===this.default_text?"":a("<div/>").text(a.trim(this.search_field.val())).html(),f=new RegExp("^"+j.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),m=new RegExp(j.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),r=this.results_data;for(n=0,p=r.length;n<p;n++){c=r[n];if(!c.disabled&&!c.empty)if(c.group)a("#"+c.dom_id).css("display","none");else if(!this.is_multiple||!c.selected){b=!1,h=c.dom_id,g=a("#"+h);if(f.test(c.html))b=!0,i+=1;else if(c.html.indexOf(" ")>=0||c.html.indexOf("[")===0){e=c.html.replace(/\[|\]/g,"").split(" ");if(e.length)for(o=0,q=e.length;o<q;o++)d=e[o],f.test(d)&&(b=!0,i+=1)}b?(j.length?(k=c.html.search(m),l=c.html.substr(0,k+j.length)+"</em>"+c.html.substr(k+j.length),l=l.substr(0,k)+"<em>"+l.substr(k)):l=c.html,g.html(l),this.result_activate(g),c.group_array_index!=null&&a("#"+this.results_data[c.group_array_index].dom_id).css("display","list-item")):(this.result_highlight&&h===this.result_highlight.attr("id")&&this.result_clear_highlight(),this.result_deactivate(g))}}return i<1&&j.length?this.no_results(j):this.winnow_results_set_highlight()},b.prototype.winnow_results_clear=function(){var b,c,d,e,f;this.search_field.val(""),c=this.search_results.find("li"),f=[];for(d=0,e=c.length;d<e;d++)b=c[d],b=a(b),f.push(b.hasClass("group-result")?b.css("display","auto"):!this.is_multiple||!b.hasClass("result-selected")?this.result_activate(b):void 0);return f},b.prototype.winnow_results_set_highlight=function(){var a,b;if(!this.result_highlight){b=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),a=b.length?b.first():this.search_results.find(".active-result").first();if(a!=null)return this.result_do_highlight(a)}},b.prototype.no_results=function(b){var c;return c=a('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>'),c.find("span").first().html(b),this.search_results.append(c)},b.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},b.prototype.keydown_arrow=function(){var b,c;this.result_highlight?this.results_showing&&(c=this.result_highlight.nextAll("li.active-result").first(),c&&this.result_do_highlight(c)):(b=this.search_results.find("li.active-result").first(),b&&this.result_do_highlight(a(b)));if(!this.results_showing)return this.results_show()},b.prototype.keyup_arrow=function(){var a;if(!this.results_showing&&!this.is_multiple)return this.results_show();if(this.result_highlight)return a=this.result_highlight.prevAll("li.active-result"),a.length?this.result_do_highlight(a.first()):(this.choices>0&&this.results_hide(),this.result_clear_highlight())},b.prototype.keydown_backstroke=function(){return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(this.pending_backstroke=this.search_container.siblings("li.search-choice").last(),this.pending_backstroke.addClass("search-choice-focus"))},b.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},b.prototype.keydown_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale(),b!==8&&this.pending_backstroke&&this.clear_backstroke();switch(b){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:this.keydown_arrow()}},b.prototype.search_field_scale=function(){var b,c,d,e,f,g,h,i,j;if(this.is_multiple){d=0,h=0,f="position:absolute; left: -1000px; top: -1000px; display:none;",g=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(i=0,j=g.length;i<j;i++)e=g[i],f+=e+":"+this.search_field.css(e)+";";return c=a("<div />",{style:f}),c.text(this.search_field.val()),a("body").append(c),h=c.width()+25,c.remove(),h>this.f_width-10&&(h=this.f_width-10),this.search_field.css({width:h+"px"}),b=this.container.height(),this.dropdown.css({top:b+"px"})}},b.prototype.generate_random_id=function(){var b;b="sel"+this.generate_random_char()+this.generate_random_char()+this.generate_random_char();while(a("#"+b).length>0)b+=this.generate_random_char();return b},b}(),c=function(a){var b;return b=a.outerWidth()-a.width()},d.get_side_border_padding=c}.call(this)
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END CHOSEN SELECT BOX

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START MEDIA PLUGIN

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
 * jQuery Media Plugin for converting elements into rich media content.
 *
 * Examples and documentation at: http://malsup.com/jquery/media/
 * Copyright (c) 2007-2010 M. Alsup
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 * @author: M. Alsup
 * @version: 0.97 (20-MAY-2011)
 * @requires jQuery v1.1.2 or later
 * $Id: jquery.media.js 2460 2007-07-23 02:53:15Z malsup $
 *
 * Supported Media Players:
 *	- Flash
 *	- Quicktime
 *	- Real Player
 *	- Silverlight
 *	- Windows Media Player
 *	- iframe
 *
 * Supported Media Formats:
 *	 Any types supported by the above players, such as:
 *	 Video: asf, avi, flv, mov, mpg, mpeg, mp4, qt, smil, swf, wmv, 3g2, 3gp
 *	 Audio: aif, aac, au, gsm, mid, midi, mov, mp3, m4a, snd, rm, wav, wma
 *	 Other: bmp, html, pdf, psd, qif, qtif, qti, tif, tiff, xaml
 *
 * Thanks to Mark Hicken and Brent Pedersen for helping me debug this on the Mac!
 * Thanks to Dan Rossi for numerous bug reports and code bits!
 * Thanks to Skye Giordano for several great suggestions!
 * Thanks to Richard Connamacher for excellent improvements to the non-IE behavior!
 */
;(function($) {

var lameIE = $.browser.msie && $.browser.version < 9;

/**
 * Chainable method for converting elements into rich media.
 *
 * @param options
 * @param callback fn invoked for each matched element before conversion
 * @param callback fn invoked for each matched element after conversion
 */
$.fn.media = function(options, f1, f2) {
	if (options == 'undo') {
		return this.each(function() {
			var $this = $(this);
			var html = $this.data('media.origHTML');
			if (html)
				$this.replaceWith(html);
		});
	}
	
	return this.each(function() {
		if (typeof options == 'function') {
			f2 = f1;
			f1 = options;
			options = {};
		}
		var o = getSettings(this, options);
		// pre-conversion callback, passes original element and fully populated options
		if (typeof f1 == 'function') f1(this, o);

		var r = getTypesRegExp();
		var m = r.exec(o.src.toLowerCase()) || [''];

		o.type ? m[0] = o.type : m.shift();
		for (var i=0; i < m.length; i++) {
			fn = m[i].toLowerCase();
			if (isDigit(fn[0])) fn = 'fn' + fn; // fns can't begin with numbers
			if (!$.fn.media[fn])
				continue;  // unrecognized media type
			// normalize autoplay settings
			var player = $.fn.media[fn+'_player'];
			if (!o.params) o.params = {};
			if (player) {
				var num = player.autoplayAttr == 'autostart';
				o.params[player.autoplayAttr || 'autoplay'] = num ? (o.autoplay ? 1 : 0) : o.autoplay ? true : false;
			}
			var $div = $.fn.media[fn](this, o);

			$div.css('backgroundColor', o.bgColor).width(o.width);
			
			if (o.canUndo) {
				var $temp = $('<div></div>').append(this);
				$div.data('media.origHTML', $temp.html()); // store original markup
			}
			
			// post-conversion callback, passes original element, new div element and fully populated options
			if (typeof f2 == 'function') f2(this, $div[0], o, player.name);
			break;
		}
	});
};

/**
 * Non-chainable method for adding or changing file format / player mapping
 * @name mapFormat
 * @param String format File format extension (ie: mov, wav, mp3)
 * @param String player Player name to use for the format (one of: flash, quicktime, realplayer, winmedia, silverlight or iframe
 */
$.fn.media.mapFormat = function(format, player) {
	if (!format || !player || !$.fn.media.defaults.players[player]) return; // invalid
	format = format.toLowerCase();
	if (isDigit(format[0])) format = 'fn' + format;
	$.fn.media[format] = $.fn.media[player];
	$.fn.media[format+'_player'] = $.fn.media.defaults.players[player];
};

// global defautls; override as needed
$.fn.media.defaults = {
	standards:  true,       // use object tags only (no embeds for non-IE browsers)
	canUndo:    true,       // tells plugin to store the original markup so it can be reverted via: $(sel).mediaUndo()
	width:		400,
	height:		400,
	autoplay:	0,		   	// normalized cross-player setting
	bgColor:	'#ffffff', 	// background color
	params:		{ wmode: 'transparent'},	// added to object element as param elements; added to embed element as attrs
	attrs:		{},			// added to object and embed elements as attrs
	flvKeyName: 'file', 	// key used for object src param (thanks to Andrea Ercolino)
	flashvars:	{},			// added to flash content as flashvars param/attr
	flashVersion:	'7',	// required flash version
	expressInstaller: null,	// src for express installer

	// default flash video and mp3 player (@see: http://jeroenwijering.com/?item=Flash_Media_Player)
	flvPlayer:	 'mediaplayer.swf',
	mp3Player:	 'mediaplayer.swf',

	// @see http://msdn2.microsoft.com/en-us/library/bb412401.aspx
	silverlight: {
		inplaceInstallPrompt: 'true', // display in-place install prompt?
		isWindowless:		  'true', // windowless mode (false for wrapping markup)
		framerate:			  '24',	  // maximum framerate
		version:			  '0.9',  // Silverlight version
		onError:			  null,	  // onError callback
		onLoad:			      null,   // onLoad callback
		initParams:			  null,	  // object init params
		userContext:		  null	  // callback arg passed to the load callback
	}
};

// Media Players; think twice before overriding
$.fn.media.defaults.players = {
	flash: {
		name:		 'flash',
		title:		 'Flash',
		types:		 'flv,mp3,swf',
		mimetype:	 'application/x-shockwave-flash',
		pluginspage: 'http://www.adobe.com/go/getflashplayer',
		ieAttrs: {
			classid:  'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000',
			type:	  'application/x-oleobject',
			codebase: 'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + $.fn.media.defaults.flashVersion
		}
	},
	quicktime: {
		name:		 'quicktime',
		title:		 'QuickTime',
		mimetype:	 'video/quicktime',
		pluginspage: 'http://www.apple.com/quicktime/download/',
		types:		 'aif,aiff,aac,au,bmp,gsm,mov,mid,midi,mpg,mpeg,mp4,m4a,psd,qt,qtif,qif,qti,snd,tif,tiff,wav,3g2,3gp',
		ieAttrs: {
			classid:  'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
			codebase: 'http://www.apple.com/qtactivex/qtplugin.cab'
		}
	},
	realplayer: {
		name:		  'real',
		title:		  'RealPlayer',
		types:		  'ra,ram,rm,rpm,rv,smi,smil',
		mimetype:	  'audio/x-pn-realaudio-plugin',
		pluginspage:  'http://www.real.com/player/',
		autoplayAttr: 'autostart',
		ieAttrs: {
			classid: 'clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA'
		}
	},
	winmedia: {
		name:		  'winmedia',
		title:		  'Windows Media',
		types:		  'asx,asf,avi,wma,wmv',
		mimetype:	  $.browser.mozilla && isFirefoxWMPPluginInstalled() ? 'application/x-ms-wmp' : 'application/x-mplayer2',
		pluginspage:  'http://www.microsoft.com/Windows/MediaPlayer/',
		autoplayAttr: 'autostart',
		oUrl:		  'url',
		ieAttrs: {
			classid:  'clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6',
			type:	  'application/x-oleobject'
		}
	},
	// special cases
	img: {
		name:  'img',
		title: 'Image',
		types: 'gif,png,jpg'
	},
	iframe: {
		name:  'iframe',
		types: 'html,pdf'
	},
	silverlight: {
		name:  'silverlight',
		types: 'xaml'
	}
};

//
//	everything below here is private
//


// detection script for FF WMP plugin (http://www.therossman.org/experiments/wmp_play.html)
// (hat tip to Mark Ross for this script)
function isFirefoxWMPPluginInstalled() {
	var plugs = navigator.plugins;
	for (var i = 0; i < plugs.length; i++) {
		var plugin = plugs[i];
		if (plugin['filename'] == 'np-mswmp.dll')
			return true;
	}
	return false;
}

var counter = 1;

for (var player in $.fn.media.defaults.players) {
	var types = $.fn.media.defaults.players[player].types;
	$.each(types.split(','), function(i,o) {
		if (isDigit(o[0])) o = 'fn' + o;
		$.fn.media[o] = $.fn.media[player] = getGenerator(player);
		$.fn.media[o+'_player'] = $.fn.media.defaults.players[player];
	});
};

function getTypesRegExp() {
	var types = '';
	for (var player in $.fn.media.defaults.players) {
		if (types.length) types += ',';
		types += $.fn.media.defaults.players[player].types;
	};
	return new RegExp('\\.(' + types.replace(/,/ig,'|') + ')\\b');
};

function getGenerator(player) {
	return function(el, options) {
		return generate(el, options, player);
	};
};

function isDigit(c) {
	return '0123456789'.indexOf(c) > -1;
};

// flatten all possible options: global defaults, meta, option obj
function getSettings(el, options) {
	options = options || {};
	var $el = $(el);
	var cls = el.className || '';
	// support metadata plugin (v1.0 and v2.0)
	var meta = $.metadata ? $el.metadata() : $.meta ? $el.data() : {};
	meta = meta || {};
	var w = meta.width  || parseInt(((cls.match(/\bw:(\d+)/)||[])[1]||0)) || parseInt(((cls.match(/\bwidth:(\d+)/)||[])[1]||0));
	var h = meta.height || parseInt(((cls.match(/\bh:(\d+)/)||[])[1]||0)) || parseInt(((cls.match(/\bheight:(\d+)/)||[])[1]||0))

	if (w) meta.width	= w;
	if (h) meta.height = h;
	if (cls) meta.cls = cls;
	
	// crank html5 style data attributes
	var dataName = 'data-';
    for (var i=0; i < el.attributes.length; i++) {
        var a = el.attributes[i], n = $.trim(a.name);
        var index = n.indexOf(dataName);
        if (index === 0) {
        	n = n.substring(dataName.length);
        	meta[n] = a.value;
        }
    }

	var a = $.fn.media.defaults;
	var b = options;
	var c = meta;

	var p = { params: { bgColor: options.bgColor || $.fn.media.defaults.bgColor } };
	var opts = $.extend({}, a, b, c);
	$.each(['attrs','params','flashvars','silverlight'], function(i,o) {
		opts[o] = $.extend({}, p[o] || {}, a[o] || {}, b[o] || {}, c[o] || {});
	});

	if (typeof opts.caption == 'undefined') opts.caption = $el.text();

	// make sure we have a source!
	opts.src = opts.src || $el.attr('href') || $el.attr('src') || 'unknown';
	return opts;
};

//
//	Flash Player
//

// generate flash using SWFObject library if possible
$.fn.media.swf = function(el, opts) {
	if (!window.SWFObject && !window.swfobject) {
		// roll our own
		if (opts.flashvars) {
			var a = [];
			for (var f in opts.flashvars)
				a.push(f + '=' + opts.flashvars[f]);
			if (!opts.params) opts.params = {};
			opts.params.flashvars = a.join('&');
		}
		return generate(el, opts, 'flash');
	}

	var id = el.id ? (' id="'+el.id+'"') : '';
	var cls = opts.cls ? (' class="' + opts.cls + '"') : '';
	var $div = $('<div' + id + cls + '>');

	// swfobject v2+
	if (window.swfobject) {
		$(el).after($div).appendTo($div);
		if (!el.id) el.id = 'movie_player_' + counter++;

		// replace el with swfobject content
		swfobject.embedSWF(opts.src, el.id, opts.width, opts.height, opts.flashVersion,
			opts.expressInstaller, opts.flashvars, opts.params, opts.attrs);
	}
	// swfobject < v2
	else {
		$(el).after($div).remove();
		var so = new SWFObject(opts.src, 'movie_player_' + counter++, opts.width, opts.height, opts.flashVersion, opts.bgColor);
		if (opts.expressInstaller) so.useExpressInstall(opts.expressInstaller);

		for (var p in opts.params)
			if (p != 'bgColor') so.addParam(p, opts.params[p]);
		for (var f in opts.flashvars)
			so.addVariable(f, opts.flashvars[f]);
		so.write($div[0]);
	}

	if (opts.caption) $('<div>').appendTo($div).html(opts.caption);
	return $div;
};

// map flv and mp3 files to the swf player by default
$.fn.media.flv = $.fn.media.mp3 = function(el, opts) {
	var src = opts.src;
	var player = /\.mp3\b/i.test(src) ? opts.mp3Player : opts.flvPlayer;
	var key = opts.flvKeyName;
	src = encodeURIComponent(src);
	opts.src = player;
	opts.src = opts.src + '?'+key+'=' + (src);
	var srcObj = {};
	srcObj[key] = src;
	opts.flashvars = $.extend({}, srcObj, opts.flashvars );
	return $.fn.media.swf(el, opts);
};

//
//	Silverlight
//
$.fn.media.xaml = function(el, opts) {
	if (!window.Sys || !window.Sys.Silverlight) {
		if ($.fn.media.xaml.warning) return;
		$.fn.media.xaml.warning = 1;
		alert('You must include the Silverlight.js script.');
		return;
	}

	var props = {
		width: opts.width,
		height: opts.height,
		background: opts.bgColor,
		inplaceInstallPrompt: opts.silverlight.inplaceInstallPrompt,
		isWindowless: opts.silverlight.isWindowless,
		framerate: opts.silverlight.framerate,
		version: opts.silverlight.version
	};
	var events = {
		onError: opts.silverlight.onError,
		onLoad: opts.silverlight.onLoad
	};

	var id1 = el.id ? (' id="'+el.id+'"') : '';
	var id2 = opts.id || 'AG' + counter++;
	// convert element to div
	var cls = opts.cls ? (' class="' + opts.cls + '"') : '';
	var $div = $('<div' + id1 + cls + '>');
	$(el).after($div).remove();

	Sys.Silverlight.createObjectEx({
		source: opts.src,
		initParams: opts.silverlight.initParams,
		userContext: opts.silverlight.userContext,
		id: id2,
		parentElement: $div[0],
		properties: props,
		events: events
	});

	if (opts.caption) $('<div>').appendTo($div).html(opts.caption);
	return $div;
};

//
// generate object/embed markup
//
function generate(el, opts, player) {
	var $el = $(el);
	var o = $.fn.media.defaults.players[player];

	if (player == 'iframe') {
		o = $('<iframe' + ' width="' + opts.width + '" height="' + opts.height + '" >');
		o.attr('src', opts.src);
		o.css('backgroundColor', o.bgColor);
	}
	else if (player == 'img') {
		o = $('<img>');
		o.attr('src', opts.src);
		opts.width && o.attr('width', opts.width);
		opts.height && o.attr('height', opts.height);
		o.css('backgroundColor', o.bgColor);
	}
	else if (lameIE) {
		var a = ['<object width="' + opts.width + '" height="' + opts.height + '" '];
		for (var key in opts.attrs)
			a.push(key + '="'+opts.attrs[key]+'" ');
		for (var key in o.ieAttrs || {}) {
			var v = o.ieAttrs[key];
			if (key == 'codebase' && window.location.protocol == 'https:')
				v = v.replace('http','https');
			a.push(key + '="'+v+'" ');
		}
		a.push('></ob'+'ject'+'>');
		var p = ['<param name="' + (o.oUrl || 'src') +'" value="' + opts.src + '">'];
		for (var key in opts.params)
			p.push('<param name="'+ key +'" value="' + opts.params[key] + '">');
		var o = document.createElement(a.join(''));
		for (var i=0; i < p.length; i++)
			o.appendChild(document.createElement(p[i]));
	}
	else if (opts.standards) {
		// Rewritten to be standards compliant by Richard Connamacher
		var a = ['<object type="' + o.mimetype +'" width="' + opts.width + '" height="' + opts.height +'"'];
		if (opts.src) a.push(' data="' + opts.src + '" ');
		if ($.browser.msie) {
			for (var key in o.ieAttrs || {}) {
				var v = o.ieAttrs[key];
				if (key == 'codebase' && window.location.protocol == 'https:')
					v = v.replace('http','https');
				a.push(key + '="'+v+'" ');
			}
		}
		a.push('>');
		a.push('<param name="' + (o.oUrl || 'src') +'" value="' + opts.src + '">');
		for (var key in opts.params) {
			if (key == 'wmode' && player != 'flash') // FF3/Quicktime borks on wmode
				continue;
			a.push('<param name="'+ key +'" value="' + opts.params[key] + '">');
		}
		// Alternate HTML
		a.push('<div><p><strong>'+o.title+' Required</strong></p><p>'+o.title+' is required to view this media. <a href="'+o.pluginspage+'">Download Here</a>.</p></div>');
		a.push('</ob'+'ject'+'>');
	}
	 else {
	        var a = ['<embed width="' + opts.width + '" height="' + opts.height + '" style="display:block"'];
	        if (opts.src) a.push(' src="' + opts.src + '" ');
	        for (var key in opts.attrs)
	            a.push(key + '="'+opts.attrs[key]+'" ');
	        for (var key in o.eAttrs || {})
	            a.push(key + '="'+o.eAttrs[key]+'" ');
	        for (var key in opts.params) {
	            if (key == 'wmode' && player != 'flash') // FF3/Quicktime borks on wmode
	            	continue;
	            a.push(key + '="'+opts.params[key]+'" ');
	        }
	        a.push('></em'+'bed'+'>');
	    }	
	// convert element to div
	var id = el.id ? (' id="'+el.id+'"') : '';
	var cls = opts.cls ? (' class="' + opts.cls + '"') : '';
	var $div = $('<div' + id + cls + '>');
	$el.after($div).remove();
	(lameIE || player == 'iframe' || player == 'img') ? $div.append(o) : $div.html(a.join(''));
	if (opts.caption) $('<div>').appendTo($div).html(opts.caption);
	return $div;
};


})(jQuery);
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END MEDIA PLUGIN

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START CYCLE

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*!
 * jQuery Cycle Plugin (with Transition Definitions)
 * Examples and documentation at: http://jquery.malsup.com/cycle/
 * Copyright (c) 2007-2010 M. Alsup
 * Version: 2.9996 (07-OCT-2011)
 * Dual licensed under the MIT and GPL licenses.
 * http://jquery.malsup.com/license.html
 * Requires: jQuery v1.3.2 or later
 */
;(function($) {

var ver = '2.9996';

// if $.support is not defined (pre jQuery 1.3) add what I need
if ($.support == undefined) {
	$.support = {
		opacity: !($.browser.msie)
	};
}

function debug(s) {
	$.fn.cycle.debug && log(s);
}		
function log() {
	window.console && console.log && console.log('[cycle] ' + Array.prototype.join.call(arguments,' '));
}
$.expr[':'].paused = function(el) {
	return el.cyclePause;
}


// the options arg can be...
//   a number  - indicates an immediate transition should occur to the given slide index
//   a string  - 'pause', 'resume', 'toggle', 'next', 'prev', 'stop', 'destroy' or the name of a transition effect (ie, 'fade', 'zoom', etc)
//   an object - properties to control the slideshow
//
// the arg2 arg can be...
//   the name of an fx (only used in conjunction with a numeric value for 'options')
//   the value true (only used in first arg == 'resume') and indicates
//	 that the resume should occur immediately (not wait for next timeout)

$.fn.cycle = function(options, arg2) {
	var o = { s: this.selector, c: this.context };

	// in 1.3+ we can fix mistakes with the ready state
	if (this.length === 0 && options != 'stop') {
		if (!$.isReady && o.s) {
			log('DOM not ready, queuing slideshow');
			$(function() {
				$(o.s,o.c).cycle(options,arg2);
			});
			return this;
		}
		// is your DOM ready?  http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
		log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
		return this;
	}

	// iterate the matched nodeset
	return this.each(function() {
		var opts = handleArguments(this, options, arg2);
		if (opts === false)
			return;

		opts.updateActivePagerLink = opts.updateActivePagerLink || $.fn.cycle.updateActivePagerLink;
		
		// stop existing slideshow for this container (if there is one)
		if (this.cycleTimeout)
			clearTimeout(this.cycleTimeout);
		this.cycleTimeout = this.cyclePause = 0;

		var $cont = $(this);
		var $slides = opts.slideExpr ? $(opts.slideExpr, this) : $cont.children();
		var els = $slides.get();

		var opts2 = buildOptions($cont, $slides, els, opts, o);
		if (opts2 === false)
			return;

		if (els.length < 2) {
			log('terminating; too few slides: ' + els.length);
			return;
		}

		var startTime = opts2.continuous ? 10 : getTimeout(els[opts2.currSlide], els[opts2.nextSlide], opts2, !opts2.backwards);

		// if it's an auto slideshow, kick it off
		if (startTime) {
			startTime += (opts2.delay || 0);
			if (startTime < 10)
				startTime = 10;
			debug('first timeout: ' + startTime);
			this.cycleTimeout = setTimeout(function(){go(els,opts2,0,!opts.backwards)}, startTime);
		}
	});
};

function triggerPause(cont, byHover, onPager) {
	var opts = $(cont).data('cycle.opts');
	var paused = !!cont.cyclePause;
	if (paused && opts.paused)
		opts.paused(cont, opts, byHover, onPager);
	else if (!paused && opts.resumed)
		opts.resumed(cont, opts, byHover, onPager);
}

// process the args that were passed to the plugin fn
function handleArguments(cont, options, arg2) {
	if (cont.cycleStop == undefined)
		cont.cycleStop = 0;
	if (options === undefined || options === null)
		options = {};
	if (options.constructor == String) {
		switch(options) {
		case 'destroy':
		case 'stop':
			var opts = $(cont).data('cycle.opts');
			if (!opts)
				return false;
			cont.cycleStop++; // callbacks look for change
			if (cont.cycleTimeout)
				clearTimeout(cont.cycleTimeout);
			cont.cycleTimeout = 0;
			opts.elements && $(opts.elements).stop();
			$(cont).removeData('cycle.opts');
			if (options == 'destroy')
				destroy(opts);
			return false;
		case 'toggle':

			cont.cyclePause = (cont.cyclePause === 1) ? 0 : 1;
			checkInstantResume(cont.cyclePause, arg2, cont);
			triggerPause(cont);
			return false;
		case 'pause':
			cont.cyclePause = 1;
			triggerPause(cont);
			return false;
		case 'resume':
			cont.cyclePause = 0;
			checkInstantResume(false, arg2, cont);
			triggerPause(cont);
			return false;
		case 'prev':
		case 'next':
			var opts = $(cont).data('cycle.opts');
			if (!opts) {
				log('options not found, "prev/next" ignored');
				return false;
			}
			$.fn.cycle[options](opts);
			return false;
		default:
			options = { fx: options };
		};
		return options;
	}
	else if (options.constructor == Number) {
		// go to the requested slide
		var num = options;
		options = $(cont).data('cycle.opts');
		if (!options) {
			log('options not found, can not advance slide');
			return false;
		}
		if (num < 0 || num >= options.elements.length) {
			log('invalid slide index: ' + num);
			return false;
		}
		options.nextSlide = num;
		if (cont.cycleTimeout) {
			clearTimeout(cont.cycleTimeout);
			cont.cycleTimeout = 0;
		}
		if (typeof arg2 == 'string')
			options.oneTimeFx = arg2;
		go(options.elements, options, 1, num >= options.currSlide);
		return false;
	}
	return options;
	
	function checkInstantResume(isPaused, arg2, cont) {
		if (!isPaused && arg2 === true) { // resume now!
			var options = $(cont).data('cycle.opts');
			if (!options) {
				log('options not found, can not resume');
				return false;
			}
			if (cont.cycleTimeout) {
				clearTimeout(cont.cycleTimeout);
				cont.cycleTimeout = 0;
			}
			go(options.elements, options, 1, !options.backwards);
		}
	}
};

function removeFilter(el, opts) {
	if (!$.support.opacity && opts.cleartype && el.style.filter) {
		try { el.style.removeAttribute('filter'); }
		catch(smother) {} // handle old opera versions
	}
};

// unbind event handlers
function destroy(opts) {
	if (opts.next)
		$(opts.next).unbind(opts.prevNextEvent);
	if (opts.prev)
		$(opts.prev).unbind(opts.prevNextEvent);
	
	if (opts.pager || opts.pagerAnchorBuilder)
		$.each(opts.pagerAnchors || [], function() {
			this.unbind().remove();
		});
	opts.pagerAnchors = null;
	if (opts.destroy) // callback
		opts.destroy(opts);
};

// one-time initialization
function buildOptions($cont, $slides, els, options, o) {
	// support metadata plugin (v1.0 and v2.0)
	var opts = $.extend({}, $.fn.cycle.defaults, options || {}, $.metadata ? $cont.metadata() : $.meta ? $cont.data() : {});
	var meta = $.isFunction($cont.data) ? $cont.data(opts.metaAttr) : null;
	if (meta)
		opts = $.extend(opts, meta);
	if (opts.autostop)
		opts.countdown = opts.autostopCount || els.length;

	var cont = $cont[0];
	$cont.data('cycle.opts', opts);
	opts.$cont = $cont;
	opts.stopCount = cont.cycleStop;
	opts.elements = els;
	opts.before = opts.before ? [opts.before] : [];
	opts.after = opts.after ? [opts.after] : [];

	// push some after callbacks
	if (!$.support.opacity && opts.cleartype)
		opts.after.push(function() { removeFilter(this, opts); });
	if (opts.continuous)
		opts.after.push(function() { go(els,opts,0,!opts.backwards); });

	saveOriginalOpts(opts);

	// clearType corrections
	if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg)
		clearTypeFix($slides);

	// container requires non-static position so that slides can be position within
	if ($cont.css('position') == 'static')
		$cont.css('position', 'relative');
	if (opts.width)
		$cont.width(opts.width);
	if (opts.height && opts.height != 'auto')
		$cont.height(opts.height);

	if (opts.startingSlide)
		opts.startingSlide = parseInt(opts.startingSlide,10);
	else if (opts.backwards)
		opts.startingSlide = els.length - 1;

	// if random, mix up the slide array
	if (opts.random) {
		opts.randomMap = [];
		for (var i = 0; i < els.length; i++)
			opts.randomMap.push(i);
		opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;});
		opts.randomIndex = 1;
		opts.startingSlide = opts.randomMap[1];
	}
	else if (opts.startingSlide >= els.length)
		opts.startingSlide = 0; // catch bogus input
	opts.currSlide = opts.startingSlide || 0;
	var first = opts.startingSlide;

	// set position and zIndex on all the slides
	$slides.css({position: 'absolute', top:0, left:0}).hide().each(function(i) {
		var z;
		if (opts.backwards)
			z = first ? i <= first ? els.length + (i-first) : first-i : els.length-i;
		else
			z = first ? i >= first ? els.length - (i-first) : first-i : els.length-i;
		$(this).css('z-index', z)
	});

	// make sure first slide is visible
	$(els[first]).css('opacity',1).show(); // opacity bit needed to handle restart use case
	removeFilter(els[first], opts);

	// stretch slides
	if (opts.fit) {
		if (!opts.aspect) {
	        if (opts.width)
	            $slides.width(opts.width);
	        if (opts.height && opts.height != 'auto')
	            $slides.height(opts.height);
		} else {
			$slides.each(function(){
				var $slide = $(this);
				var ratio = (opts.aspect === true) ? $slide.width()/$slide.height() : opts.aspect;
				if( opts.width && $slide.width() != opts.width ) {
					$slide.width( opts.width );
					$slide.height( opts.width / ratio );
				}

				if( opts.height && $slide.height() < opts.height ) {
					$slide.height( opts.height );
					$slide.width( opts.height * ratio );
				}
			});
		}
	}

	if (opts.center && ((!opts.fit) || opts.aspect)) {
		$slides.each(function(){
			var $slide = $(this);
			$slide.css({
				"margin-left": opts.width ?
					((opts.width - $slide.width()) / 2) + "px" :
					0,
				"margin-top": opts.height ?
					((opts.height - $slide.height()) / 2) + "px" :
					0
			});
		});
	}

	if (opts.center && !opts.fit && !opts.slideResize) {
	  	$slides.each(function(){
	    	var $slide = $(this);
	    	$slide.css({
	      		"margin-left": opts.width ? ((opts.width - $slide.width()) / 2) + "px" : 0,
	      		"margin-top": opts.height ? ((opts.height - $slide.height()) / 2) + "px" : 0
	    	});
	  	});
	}
		
	// stretch container
	var reshape = opts.containerResize && !$cont.innerHeight();
	if (reshape) { // do this only if container has no size http://tinyurl.com/da2oa9
		var maxw = 0, maxh = 0;
		for(var j=0; j < els.length; j++) {
			var $e = $(els[j]), e = $e[0], w = $e.outerWidth(), h = $e.outerHeight();
			if (!w) w = e.offsetWidth || e.width || $e.attr('width');
			if (!h) h = e.offsetHeight || e.height || $e.attr('height');
			maxw = w > maxw ? w : maxw;
			maxh = h > maxh ? h : maxh;
		}
		if (maxw > 0 && maxh > 0)
			$cont.css({width:maxw+'px',height:maxh+'px'});
	}

	var pauseFlag = false;  // https://github.com/malsup/cycle/issues/44
	if (opts.pause)
		$cont.hover(
			function(){
				pauseFlag = true;
				this.cyclePause++;
				triggerPause(cont, true);
			},
			function(){
				pauseFlag && this.cyclePause--;
				triggerPause(cont, true);
			}
		);

	if (supportMultiTransitions(opts) === false)
		return false;

	// apparently a lot of people use image slideshows without height/width attributes on the images.
	// Cycle 2.50+ requires the sizing info for every slide; this block tries to deal with that.
	var requeue = false;
	options.requeueAttempts = options.requeueAttempts || 0;
	$slides.each(function() {
		// try to get height/width of each slide
		var $el = $(this);
		this.cycleH = (opts.fit && opts.height) ? opts.height : ($el.height() || this.offsetHeight || this.height || $el.attr('height') || 0);
		this.cycleW = (opts.fit && opts.width) ? opts.width : ($el.width() || this.offsetWidth || this.width || $el.attr('width') || 0);

		if ( $el.is('img') ) {
			// sigh..  sniffing, hacking, shrugging...  this crappy hack tries to account for what browsers do when
			// an image is being downloaded and the markup did not include sizing info (height/width attributes);
			// there seems to be some "default" sizes used in this situation
			var loadingIE	= ($.browser.msie  && this.cycleW == 28 && this.cycleH == 30 && !this.complete);
			var loadingFF	= ($.browser.mozilla && this.cycleW == 34 && this.cycleH == 19 && !this.complete);
			var loadingOp	= ($.browser.opera && ((this.cycleW == 42 && this.cycleH == 19) || (this.cycleW == 37 && this.cycleH == 17)) && !this.complete);
			var loadingOther = (this.cycleH == 0 && this.cycleW == 0 && !this.complete);
			// don't requeue for images that are still loading but have a valid size
			if (loadingIE || loadingFF || loadingOp || loadingOther) {
				if (o.s && opts.requeueOnImageNotLoaded && ++options.requeueAttempts < 100) { // track retry count so we don't loop forever
					log(options.requeueAttempts,' - img slide not loaded, requeuing slideshow: ', this.src, this.cycleW, this.cycleH);
					setTimeout(function() {$(o.s,o.c).cycle(options)}, opts.requeueTimeout);
					requeue = true;
					return false; // break each loop
				}
				else {
					log('could not determine size of image: '+this.src, this.cycleW, this.cycleH);
				}
			}
		}
		return true;
	});

	if (requeue)
		return false;

	opts.cssBefore = opts.cssBefore || {};
	opts.cssAfter = opts.cssAfter || {};
	opts.cssFirst = opts.cssFirst || {};
	opts.animIn = opts.animIn || {};
	opts.animOut = opts.animOut || {};

	$slides.not(':eq('+first+')').css(opts.cssBefore);
	$($slides[first]).css(opts.cssFirst);

	if (opts.timeout) {
		opts.timeout = parseInt(opts.timeout,10);
		// ensure that timeout and speed settings are sane
		if (opts.speed.constructor == String)
			opts.speed = $.fx.speeds[opts.speed] || parseInt(opts.speed,10);
		if (!opts.sync)
			opts.speed = opts.speed / 2;
		
		var buffer = opts.fx == 'none' ? 0 : opts.fx == 'shuffle' ? 500 : 250;
		while((opts.timeout - opts.speed) < buffer) // sanitize timeout
			opts.timeout += opts.speed;
	}
	if (opts.easing)
		opts.easeIn = opts.easeOut = opts.easing;
	if (!opts.speedIn)
		opts.speedIn = opts.speed;
	if (!opts.speedOut)
		opts.speedOut = opts.speed;

	opts.slideCount = els.length;
	opts.currSlide = opts.lastSlide = first;
	if (opts.random) {
		if (++opts.randomIndex == els.length)
			opts.randomIndex = 0;
		opts.nextSlide = opts.randomMap[opts.randomIndex];
	}
	else if (opts.backwards)
		opts.nextSlide = opts.startingSlide == 0 ? (els.length-1) : opts.startingSlide-1;
	else
		opts.nextSlide = opts.startingSlide >= (els.length-1) ? 0 : opts.startingSlide+1;

	// run transition init fn
	if (!opts.multiFx) {
		var init = $.fn.cycle.transitions[opts.fx];
		if ($.isFunction(init))
			init($cont, $slides, opts);
		else if (opts.fx != 'custom' && !opts.multiFx) {
			log('unknown transition: ' + opts.fx,'; slideshow terminating');
			return false;
		}
	}

	// fire artificial events
	var e0 = $slides[first];
	if (!opts.skipInitializationCallbacks) {
		if (opts.before.length)
			opts.before[0].apply(e0, [e0, e0, opts, true]);
		if (opts.after.length)
			opts.after[0].apply(e0, [e0, e0, opts, true]);
	}
	if (opts.next)
		$(opts.next).bind(opts.prevNextEvent,function(){return advance(opts,1)});
	if (opts.prev)
		$(opts.prev).bind(opts.prevNextEvent,function(){return advance(opts,0)});
	if (opts.pager || opts.pagerAnchorBuilder)
		buildPager(els,opts);

	exposeAddSlide(opts, els);

	return opts;
};

// save off original opts so we can restore after clearing state
function saveOriginalOpts(opts) {
	opts.original = { before: [], after: [] };
	opts.original.cssBefore = $.extend({}, opts.cssBefore);
	opts.original.cssAfter  = $.extend({}, opts.cssAfter);
	opts.original.animIn	= $.extend({}, opts.animIn);
	opts.original.animOut   = $.extend({}, opts.animOut);
	$.each(opts.before, function() { opts.original.before.push(this); });
	$.each(opts.after,  function() { opts.original.after.push(this); });
};

function supportMultiTransitions(opts) {
	var i, tx, txs = $.fn.cycle.transitions;
	// look for multiple effects
	if (opts.fx.indexOf(',') > 0) {
		opts.multiFx = true;
		opts.fxs = opts.fx.replace(/\s*/g,'').split(',');
		// discard any bogus effect names
		for (i=0; i < opts.fxs.length; i++) {
			var fx = opts.fxs[i];
			tx = txs[fx];
			if (!tx || !txs.hasOwnProperty(fx) || !$.isFunction(tx)) {
				log('discarding unknown transition: ',fx);
				opts.fxs.splice(i,1);
				i--;
			}
		}
		// if we have an empty list then we threw everything away!
		if (!opts.fxs.length) {
			log('No valid transitions named; slideshow terminating.');
			return false;
		}
	}
	else if (opts.fx == 'all') {  // auto-gen the list of transitions
		opts.multiFx = true;
		opts.fxs = [];
		for (p in txs) {
			tx = txs[p];
			if (txs.hasOwnProperty(p) && $.isFunction(tx))
				opts.fxs.push(p);
		}
	}
	if (opts.multiFx && opts.randomizeEffects) {
		// munge the fxs array to make effect selection random
		var r1 = Math.floor(Math.random() * 20) + 30;
		for (i = 0; i < r1; i++) {
			var r2 = Math.floor(Math.random() * opts.fxs.length);
			opts.fxs.push(opts.fxs.splice(r2,1)[0]);
		}
		debug('randomized fx sequence: ',opts.fxs);
	}
	return true;
};

// provide a mechanism for adding slides after the slideshow has started
function exposeAddSlide(opts, els) {
	opts.addSlide = function(newSlide, prepend) {
		var $s = $(newSlide), s = $s[0];
		if (!opts.autostopCount)
			opts.countdown++;
		els[prepend?'unshift':'push'](s);
		if (opts.els)
			opts.els[prepend?'unshift':'push'](s); // shuffle needs this
		opts.slideCount = els.length;

		$s.css('position','absolute');
		$s[prepend?'prependTo':'appendTo'](opts.$cont);

		if (prepend) {
			opts.currSlide++;
			opts.nextSlide++;
		}

		if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg)
			clearTypeFix($s);

		if (opts.fit && opts.width)
			$s.width(opts.width);
		if (opts.fit && opts.height && opts.height != 'auto')
			$s.height(opts.height);
		s.cycleH = (opts.fit && opts.height) ? opts.height : $s.height();
		s.cycleW = (opts.fit && opts.width) ? opts.width : $s.width();

		$s.css(opts.cssBefore);

		if (opts.pager || opts.pagerAnchorBuilder)
			$.fn.cycle.createPagerAnchor(els.length-1, s, $(opts.pager), els, opts);

		if ($.isFunction(opts.onAddSlide))
			opts.onAddSlide($s);
		else
			$s.hide(); // default behavior
	};
}

// reset internal state; we do this on every pass in order to support multiple effects
$.fn.cycle.resetState = function(opts, fx) {
	fx = fx || opts.fx;
	opts.before = []; opts.after = [];
	opts.cssBefore = $.extend({}, opts.original.cssBefore);
	opts.cssAfter  = $.extend({}, opts.original.cssAfter);
	opts.animIn	= $.extend({}, opts.original.animIn);
	opts.animOut   = $.extend({}, opts.original.animOut);
	opts.fxFn = null;
	$.each(opts.original.before, function() { opts.before.push(this); });
	$.each(opts.original.after,  function() { opts.after.push(this); });

	// re-init
	var init = $.fn.cycle.transitions[fx];
	if ($.isFunction(init))
		init(opts.$cont, $(opts.elements), opts);
};

// this is the main engine fn, it handles the timeouts, callbacks and slide index mgmt
function go(els, opts, manual, fwd) {
	// opts.busy is true if we're in the middle of an animation
	if (manual && opts.busy && opts.manualTrump) {
		// let manual transitions requests trump active ones
		debug('manualTrump in go(), stopping active transition');
		$(els).stop(true,true);
		opts.busy = 0;
	}
	// don't begin another timeout-based transition if there is one active
	if (opts.busy) {
		debug('transition active, ignoring new tx request');
		return;
	}

	var p = opts.$cont[0], curr = els[opts.currSlide], next = els[opts.nextSlide];

	// stop cycling if we have an outstanding stop request
	if (p.cycleStop != opts.stopCount || p.cycleTimeout === 0 && !manual)
		return;

	// check to see if we should stop cycling based on autostop options
	if (!manual && !p.cyclePause && !opts.bounce &&
		((opts.autostop && (--opts.countdown <= 0)) ||
		(opts.nowrap && !opts.random && opts.nextSlide < opts.currSlide))) {
		if (opts.end)
			opts.end(opts);
		return;
	}

	// if slideshow is paused, only transition on a manual trigger
	var changed = false;
	if ((manual || !p.cyclePause) && (opts.nextSlide != opts.currSlide)) {
		changed = true;
		var fx = opts.fx;
		// keep trying to get the slide size if we don't have it yet
		curr.cycleH = curr.cycleH || $(curr).height();
		curr.cycleW = curr.cycleW || $(curr).width();
		next.cycleH = next.cycleH || $(next).height();
		next.cycleW = next.cycleW || $(next).width();

		// support multiple transition types
		if (opts.multiFx) {
			if (fwd && (opts.lastFx == undefined || ++opts.lastFx >= opts.fxs.length))
				opts.lastFx = 0;
			else if (!fwd && (opts.lastFx == undefined || --opts.lastFx < 0))
				opts.lastFx = opts.fxs.length - 1;
			fx = opts.fxs[opts.lastFx];
		}

		// one-time fx overrides apply to:  $('div').cycle(3,'zoom');
		if (opts.oneTimeFx) {
			fx = opts.oneTimeFx;
			opts.oneTimeFx = null;
		}

		$.fn.cycle.resetState(opts, fx);

		// run the before callbacks
		if (opts.before.length)
			$.each(opts.before, function(i,o) {
				if (p.cycleStop != opts.stopCount) return;
				o.apply(next, [curr, next, opts, fwd]);
			});

		// stage the after callacks
		var after = function() {
			opts.busy = 0;
			$.each(opts.after, function(i,o) {
				if (p.cycleStop != opts.stopCount) return;
				o.apply(next, [curr, next, opts, fwd]);
			});
			if (!p.cycleStop) {
				// queue next transition
				queueNext();
			}
		};

		debug('tx firing('+fx+'); currSlide: ' + opts.currSlide + '; nextSlide: ' + opts.nextSlide);
		
		// get ready to perform the transition
		opts.busy = 1;
		if (opts.fxFn) // fx function provided?
			opts.fxFn(curr, next, opts, after, fwd, manual && opts.fastOnEvent);
		else if ($.isFunction($.fn.cycle[opts.fx])) // fx plugin ?
			$.fn.cycle[opts.fx](curr, next, opts, after, fwd, manual && opts.fastOnEvent);
		else
			$.fn.cycle.custom(curr, next, opts, after, fwd, manual && opts.fastOnEvent);
	}

	if (changed || opts.nextSlide == opts.currSlide) {
		// calculate the next slide
		opts.lastSlide = opts.currSlide;
		if (opts.random) {
			opts.currSlide = opts.nextSlide;
			if (++opts.randomIndex == els.length)
				opts.randomIndex = 0;
			opts.nextSlide = opts.randomMap[opts.randomIndex];
			if (opts.nextSlide == opts.currSlide)
				opts.nextSlide = (opts.currSlide == opts.slideCount - 1) ? 0 : opts.currSlide + 1;
		}
		else if (opts.backwards) {
			var roll = (opts.nextSlide - 1) < 0;
			if (roll && opts.bounce) {
				opts.backwards = !opts.backwards;
				opts.nextSlide = 1;
				opts.currSlide = 0;
			}
			else {
				opts.nextSlide = roll ? (els.length-1) : opts.nextSlide-1;
				opts.currSlide = roll ? 0 : opts.nextSlide+1;
			}
		}
		else { // sequence
			var roll = (opts.nextSlide + 1) == els.length;
			if (roll && opts.bounce) {
				opts.backwards = !opts.backwards;
				opts.nextSlide = els.length-2;
				opts.currSlide = els.length-1;
			}
			else {
				opts.nextSlide = roll ? 0 : opts.nextSlide+1;
				opts.currSlide = roll ? els.length-1 : opts.nextSlide-1;
			}
		}
	}
	if (changed && opts.pager)

		opts.updateActivePagerLink(opts.pager, opts.currSlide, opts.activePagerClass);
	
	function queueNext() {
		// stage the next transition
		var ms = 0, timeout = opts.timeout;
		if (opts.timeout && !opts.continuous) {
			ms = getTimeout(els[opts.currSlide], els[opts.nextSlide], opts, fwd);
         if (opts.fx == 'shuffle')
            ms -= opts.speedOut;
      }
		else if (opts.continuous && p.cyclePause) // continuous shows work off an after callback, not this timer logic
			ms = 10;
		if (ms > 0)
			p.cycleTimeout = setTimeout(function(){ go(els, opts, 0, !opts.backwards) }, ms);
	}
};

// invoked after transition
$.fn.cycle.updateActivePagerLink = function(pager, currSlide, clsName) {
   $(pager).each(function() {
       $(this).children().removeClass(clsName).eq(currSlide).addClass(clsName);
   });
};

// calculate timeout value for current transition
function getTimeout(curr, next, opts, fwd) {
	if (opts.timeoutFn) {
		// call user provided calc fn
		var t = opts.timeoutFn.call(curr,curr,next,opts,fwd);
		while (opts.fx != 'none' && (t - opts.speed) < 250) // sanitize timeout
			t += opts.speed;
		debug('calculated timeout: ' + t + '; speed: ' + opts.speed);
		if (t !== false)
			return t;
	}
	return opts.timeout;
};

// expose next/prev function, caller must pass in state
$.fn.cycle.next = function(opts) { advance(opts,1); };
$.fn.cycle.prev = function(opts) { advance(opts,0);};

// advance slide forward or back
function advance(opts, moveForward) {
	var val = moveForward ? 1 : -1;
	var els = opts.elements;
	var p = opts.$cont[0], timeout = p.cycleTimeout;
	if (timeout) {
		clearTimeout(timeout);
		p.cycleTimeout = 0;
	}
	if (opts.random && val < 0) {
		// move back to the previously display slide
		opts.randomIndex--;
		if (--opts.randomIndex == -2)
			opts.randomIndex = els.length-2;
		else if (opts.randomIndex == -1)
			opts.randomIndex = els.length-1;
		opts.nextSlide = opts.randomMap[opts.randomIndex];
	}
	else if (opts.random) {
		opts.nextSlide = opts.randomMap[opts.randomIndex];
	}
	else {
		opts.nextSlide = opts.currSlide + val;
		if (opts.nextSlide < 0) {
			if (opts.nowrap) return false;
			opts.nextSlide = els.length - 1;
		}
		else if (opts.nextSlide >= els.length) {
			if (opts.nowrap) return false;
			opts.nextSlide = 0;
		}
	}

	var cb = opts.onPrevNextEvent || opts.prevNextClick; // prevNextClick is deprecated
	if ($.isFunction(cb))
		cb(val > 0, opts.nextSlide, els[opts.nextSlide]);
	go(els, opts, 1, moveForward);
	return false;
};

function buildPager(els, opts) {
	var $p = $(opts.pager);
	$.each(els, function(i,o) {
		$.fn.cycle.createPagerAnchor(i,o,$p,els,opts);
	});
	opts.updateActivePagerLink(opts.pager, opts.startingSlide, opts.activePagerClass);
};

$.fn.cycle.createPagerAnchor = function(i, el, $p, els, opts) {
	var a;
	if ($.isFunction(opts.pagerAnchorBuilder)) {
		a = opts.pagerAnchorBuilder(i,el);
		debug('pagerAnchorBuilder('+i+', el) returned: ' + a);
	}
	else
		a = '<a href="#">'+(i+1)+'</a>';
		
	if (!a)
		return;
	var $a = $(a);
	// don't reparent if anchor is in the dom
	if ($a.parents('body').length === 0) {
		var arr = [];
		if ($p.length > 1) {
			$p.each(function() {
				var $clone = $a.clone(true);
				$(this).append($clone);
				arr.push($clone[0]);
			});
			$a = $(arr);
		}
		else {
			$a.appendTo($p);
		}
	}

	opts.pagerAnchors =  opts.pagerAnchors || [];
	opts.pagerAnchors.push($a);
	
	var pagerFn = function(e) {
		e.preventDefault();
		opts.nextSlide = i;
		var p = opts.$cont[0], timeout = p.cycleTimeout;
		if (timeout) {
			clearTimeout(timeout);
			p.cycleTimeout = 0;
		}
		var cb = opts.onPagerEvent || opts.pagerClick; // pagerClick is deprecated
		if ($.isFunction(cb))
			cb(opts.nextSlide, els[opts.nextSlide]);
		go(els,opts,1,opts.currSlide < i); // trigger the trans
//		return false; // <== allow bubble
	}
	
	if ( /mouseenter|mouseover/i.test(opts.pagerEvent) ) {
		$a.hover(pagerFn, function(){/* no-op */} );
	}
	else {
		$a.bind(opts.pagerEvent, pagerFn);
	}
	
	if ( ! /^click/.test(opts.pagerEvent) && !opts.allowPagerClickBubble)
		$a.bind('click.cycle', function(){return false;}); // suppress click
	
	var cont = opts.$cont[0];
	var pauseFlag = false; // https://github.com/malsup/cycle/issues/44
	if (opts.pauseOnPagerHover) {
		$a.hover(
			function() { 
				pauseFlag = true;
				cont.cyclePause++; 
				triggerPause(cont,true,true);
			}, function() { 
				pauseFlag && cont.cyclePause--; 
				triggerPause(cont,true,true);
			} 
		);
	}
};

// helper fn to calculate the number of slides between the current and the next
$.fn.cycle.hopsFromLast = function(opts, fwd) {
	var hops, l = opts.lastSlide, c = opts.currSlide;
	if (fwd)
		hops = c > l ? c - l : opts.slideCount - l;
	else
		hops = c < l ? l - c : l + opts.slideCount - c;
	return hops;
};

// fix clearType problems in ie6 by setting an explicit bg color
// (otherwise text slides look horrible during a fade transition)
function clearTypeFix($slides) {
	debug('applying clearType background-color hack');
	function hex(s) {
		s = parseInt(s,10).toString(16);
		return s.length < 2 ? '0'+s : s;
	};
	function getBg(e) {
		for ( ; e && e.nodeName.toLowerCase() != 'html'; e = e.parentNode) {
			var v = $.css(e,'background-color');
			if (v && v.indexOf('rgb') >= 0 ) {
				var rgb = v.match(/\d+/g);
				return '#'+ hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]);
			}
			if (v && v != 'transparent')
				return v;
		}
		return '#ffffff';
	};
	$slides.each(function() { $(this).css('background-color', getBg(this)); });
};

// reset common props before the next transition
$.fn.cycle.commonReset = function(curr,next,opts,w,h,rev) {
	$(opts.elements).not(curr).hide();
	if (typeof opts.cssBefore.opacity == 'undefined')
		opts.cssBefore.opacity = 1;
	opts.cssBefore.display = 'block';
	if (opts.slideResize && w !== false && next.cycleW > 0)
		opts.cssBefore.width = next.cycleW;
	if (opts.slideResize && h !== false && next.cycleH > 0)
		opts.cssBefore.height = next.cycleH;
	opts.cssAfter = opts.cssAfter || {};
	opts.cssAfter.display = 'none';
	$(curr).css('zIndex',opts.slideCount + (rev === true ? 1 : 0));
	$(next).css('zIndex',opts.slideCount + (rev === true ? 0 : 1));
};

// the actual fn for effecting a transition
$.fn.cycle.custom = function(curr, next, opts, cb, fwd, speedOverride) {
	var $l = $(curr), $n = $(next);
	var speedIn = opts.speedIn, speedOut = opts.speedOut, easeIn = opts.easeIn, easeOut = opts.easeOut;
	$n.css(opts.cssBefore);
	if (speedOverride) {
		if (typeof speedOverride == 'number')
			speedIn = speedOut = speedOverride;
		else
			speedIn = speedOut = 1;
		easeIn = easeOut = null;
	}
	var fn = function() {
		$n.animate(opts.animIn, speedIn, easeIn, function() {
			cb();
		});
	};
	$l.animate(opts.animOut, speedOut, easeOut, function() {
		$l.css(opts.cssAfter);
		if (!opts.sync) 
			fn();
	});
	if (opts.sync) fn();
};

// transition definitions - only fade is defined here, transition pack defines the rest
$.fn.cycle.transitions = {
	fade: function($cont, $slides, opts) {
		$slides.not(':eq('+opts.currSlide+')').css('opacity',0);
		opts.before.push(function(curr,next,opts) {
			$.fn.cycle.commonReset(curr,next,opts);
			opts.cssBefore.opacity = 0;
		});
		opts.animIn	   = { opacity: 1 };
		opts.animOut   = { opacity: 0 };
		opts.cssBefore = { top: 0, left: 0 };
	}
};

$.fn.cycle.ver = function() { return ver; };

// override these globally if you like (they are all optional)
$.fn.cycle.defaults = {
	activePagerClass: 'activeSlide', // class name used for the active pager link
	after:		   null,  // transition callback (scope set to element that was shown):  function(currSlideElement, nextSlideElement, options, forwardFlag)
	allowPagerClickBubble: false, // allows or prevents click event on pager anchors from bubbling
	animIn:		   null,  // properties that define how the slide animates in
	animOut:	   null,  // properties that define how the slide animates out
	aspect:		   false,  // preserve aspect ratio during fit resizing, cropping if necessary (must be used with fit option)
	autostop:	   0,	  // true to end slideshow after X transitions (where X == slide count)
	autostopCount: 0,	  // number of transitions (optionally used with autostop to define X)
	backwards:     false, // true to start slideshow at last slide and move backwards through the stack
	before:		   null,  // transition callback (scope set to element to be shown):	 function(currSlideElement, nextSlideElement, options, forwardFlag)
	center: 	   null,  // set to true to have cycle add top/left margin to each slide (use with width and height options)
	cleartype:	   !$.support.opacity,  // true if clearType corrections should be applied (for IE)
	cleartypeNoBg: false, // set to true to disable extra cleartype fixing (leave false to force background color setting on slides)
	containerResize: 1,	  // resize container to fit largest slide
	continuous:	   0,	  // true to start next transition immediately after current one completes
	cssAfter:	   null,  // properties that defined the state of the slide after transitioning out
	cssBefore:	   null,  // properties that define the initial state of the slide before transitioning in
	delay:		   0,	  // additional delay (in ms) for first transition (hint: can be negative)
	easeIn:		   null,  // easing for "in" transition
	easeOut:	   null,  // easing for "out" transition
	easing:		   null,  // easing method for both in and out transitions
	end:		   null,  // callback invoked when the slideshow terminates (use with autostop or nowrap options): function(options)
	fastOnEvent:   0,	  // force fast transitions when triggered manually (via pager or prev/next); value == time in ms
	fit:		   0,	  // force slides to fit container
	fx:			  'fade', // name of transition effect (or comma separated names, ex: 'fade,scrollUp,shuffle')
	fxFn:		   null,  // function used to control the transition: function(currSlideElement, nextSlideElement, options, afterCalback, forwardFlag)
	height:		  'auto', // container height (if the 'fit' option is true, the slides will be set to this height as well)
	manualTrump:   true,  // causes manual transition to stop an active transition instead of being ignored
	metaAttr:     'cycle',// data- attribute that holds the option data for the slideshow
	next:		   null,  // element, jQuery object, or jQuery selector string for the element to use as event trigger for next slide
	nowrap:		   0,	  // true to prevent slideshow from wrapping
	onPagerEvent:  null,  // callback fn for pager events: function(zeroBasedSlideIndex, slideElement)
	onPrevNextEvent: null,// callback fn for prev/next events: function(isNext, zeroBasedSlideIndex, slideElement)
	pager:		   null,  // element, jQuery object, or jQuery selector string for the element to use as pager container
	pagerAnchorBuilder: null, // callback fn for building anchor links:  function(index, DOMelement)
	pagerEvent:	  'click.cycle', // name of event which drives the pager navigation
	pause:		   0,	  // true to enable "pause on hover"
	pauseOnPagerHover: 0, // true to pause when hovering over pager link
	prev:		   null,  // element, jQuery object, or jQuery selector string for the element to use as event trigger for previous slide
	prevNextEvent:'click.cycle',// event which drives the manual transition to the previous or next slide
	random:		   0,	  // true for random, false for sequence (not applicable to shuffle fx)
	randomizeEffects: 1,  // valid when multiple effects are used; true to make the effect sequence random
	requeueOnImageNotLoaded: true, // requeue the slideshow if any image slides are not yet loaded
	requeueTimeout: 250,  // ms delay for requeue
	rev:		   0,	  // causes animations to transition in reverse (for effects that support it such as scrollHorz/scrollVert/shuffle)
	shuffle:	   null,  // coords for shuffle animation, ex: { top:15, left: 200 }
	skipInitializationCallbacks: false, // set to true to disable the first before/after callback that occurs prior to any transition
	slideExpr:	   null,  // expression for selecting slides (if something other than all children is required)
	slideResize:   1,     // force slide width/height to fixed size before every transition
	speed:		   1000,  // speed of the transition (any valid fx speed value)
	speedIn:	   null,  // speed of the 'in' transition
	speedOut:	   null,  // speed of the 'out' transition
	startingSlide: 0,	  // zero-based index of the first slide to be displayed
	sync:		   1,	  // true if in/out transitions should occur simultaneously
	timeout:	   4000,  // milliseconds between slide transitions (0 to disable auto advance)
	timeoutFn:     null,  // callback for determining per-slide timeout value:  function(currSlideElement, nextSlideElement, options, forwardFlag)
	updateActivePagerLink: null, // callback fn invoked to update the active pager link (adds/removes activePagerClass style)
	width:         null   // container width (if the 'fit' option is true, the slides will be set to this width as well)
};

})(jQuery);


/*!
 * jQuery Cycle Plugin Transition Definitions
 * This script is a plugin for the jQuery Cycle Plugin
 * Examples and documentation at: http://malsup.com/jquery/cycle/
 * Copyright (c) 2007-2010 M. Alsup
 * Version:	 2.73
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */
(function($) {

//
// These functions define slide initialization and properties for the named
// transitions. To save file size feel free to remove any of these that you
// don't need.
//
$.fn.cycle.transitions.none = function($cont, $slides, opts) {
	opts.fxFn = function(curr,next,opts,after){
		$(next).show();
		$(curr).hide();
		after();
	};
};

// not a cross-fade, fadeout only fades out the top slide
$.fn.cycle.transitions.fadeout = function($cont, $slides, opts) {
	$slides.not(':eq('+opts.currSlide+')').css({ display: 'block', 'opacity': 1 });
	opts.before.push(function(curr,next,opts,w,h,rev) {
		$(curr).css('zIndex',opts.slideCount + (!rev === true ? 1 : 0));
		$(next).css('zIndex',opts.slideCount + (!rev === true ? 0 : 1));
	});
	opts.animIn.opacity = 1;
	opts.animOut.opacity = 0;
	opts.cssBefore.opacity = 1;
	opts.cssBefore.display = 'block';
	opts.cssAfter.zIndex = 0;
};

// scrollUp/Down/Left/Right
$.fn.cycle.transitions.scrollUp = function($cont, $slides, opts) {
	$cont.css('overflow','hidden');
	opts.before.push($.fn.cycle.commonReset);
	var h = $cont.height();
	opts.cssBefore.top = h;
	opts.cssBefore.left = 0;
	opts.cssFirst.top = 0;
	opts.animIn.top = 0;
	opts.animOut.top = -h;
};
$.fn.cycle.transitions.scrollDown = function($cont, $slides, opts) {
	$cont.css('overflow','hidden');
	opts.before.push($.fn.cycle.commonReset);
	var h = $cont.height();
	opts.cssFirst.top = 0;
	opts.cssBefore.top = -h;
	opts.cssBefore.left = 0;
	opts.animIn.top = 0;
	opts.animOut.top = h;
};
$.fn.cycle.transitions.scrollLeft = function($cont, $slides, opts) {
	$cont.css('overflow','hidden');
	opts.before.push($.fn.cycle.commonReset);
	var w = $cont.width();
	opts.cssFirst.left = 0;
	opts.cssBefore.left = w;
	opts.cssBefore.top = 0;
	opts.animIn.left = 0;
	opts.animOut.left = 0-w;
};
$.fn.cycle.transitions.scrollRight = function($cont, $slides, opts) {
	$cont.css('overflow','hidden');
	opts.before.push($.fn.cycle.commonReset);
	var w = $cont.width();
	opts.cssFirst.left = 0;
	opts.cssBefore.left = -w;
	opts.cssBefore.top = 0;
	opts.animIn.left = 0;
	opts.animOut.left = w;
};
$.fn.cycle.transitions.scrollHorz = function($cont, $slides, opts) {
	$cont.css('overflow','hidden').width();
	opts.before.push(function(curr, next, opts, fwd) {
		if (opts.rev)
			fwd = !fwd;
		$.fn.cycle.commonReset(curr,next,opts);
		opts.cssBefore.left = fwd ? (next.cycleW-1) : (1-next.cycleW);
		opts.animOut.left = fwd ? -curr.cycleW : curr.cycleW;
	});
	opts.cssFirst.left = 0;
	opts.cssBefore.top = 0;
	opts.animIn.left = 0;
	opts.animOut.top = 0;
};
$.fn.cycle.transitions.scrollVert = function($cont, $slides, opts) {
	$cont.css('overflow','hidden');
	opts.before.push(function(curr, next, opts, fwd) {
		if (opts.rev)
			fwd = !fwd;
		$.fn.cycle.commonReset(curr,next,opts);
		opts.cssBefore.top = fwd ? (1-next.cycleH) : (next.cycleH-1);
		opts.animOut.top = fwd ? curr.cycleH : -curr.cycleH;
	});
	opts.cssFirst.top = 0;
	opts.cssBefore.left = 0;
	opts.animIn.top = 0;
	opts.animOut.left = 0;
};

// slideX/slideY
$.fn.cycle.transitions.slideX = function($cont, $slides, opts) {
	opts.before.push(function(curr, next, opts) {
		$(opts.elements).not(curr).hide();
		$.fn.cycle.commonReset(curr,next,opts,false,true);
		opts.animIn.width = next.cycleW;
	});
	opts.cssBefore.left = 0;
	opts.cssBefore.top = 0;
	opts.cssBefore.width = 0;
	opts.animIn.width = 'show';
	opts.animOut.width = 0;
};
$.fn.cycle.transitions.slideY = function($cont, $slides, opts) {
	opts.before.push(function(curr, next, opts) {
		$(opts.elements).not(curr).hide();
		$.fn.cycle.commonReset(curr,next,opts,true,false);
		opts.animIn.height = next.cycleH;
	});
	opts.cssBefore.left = 0;
	opts.cssBefore.top = 0;
	opts.cssBefore.height = 0;
	opts.animIn.height = 'show';
	opts.animOut.height = 0;
};

// shuffle
$.fn.cycle.transitions.shuffle = function($cont, $slides, opts) {
	var i, w = $cont.css('overflow', 'visible').width();
	$slides.css({left: 0, top: 0});
	opts.before.push(function(curr,next,opts) {
		$.fn.cycle.commonReset(curr,next,opts,true,true,true);
	});
	// only adjust speed once!
	if (!opts.speedAdjusted) {
		opts.speed = opts.speed / 2; // shuffle has 2 transitions
		opts.speedAdjusted = true;
	}
	opts.random = 0;
	opts.shuffle = opts.shuffle || {left:-w, top:15};
	opts.els = [];
	for (i=0; i < $slides.length; i++)
		opts.els.push($slides[i]);

	for (i=0; i < opts.currSlide; i++)
		opts.els.push(opts.els.shift());

	// custom transition fn (hat tip to Benjamin Sterling for this bit of sweetness!)
	opts.fxFn = function(curr, next, opts, cb, fwd) {
		if (opts.rev)
			fwd = !fwd;
		var $el = fwd ? $(curr) : $(next);
		$(next).css(opts.cssBefore);
		var count = opts.slideCount;
		$el.animate(opts.shuffle, opts.speedIn, opts.easeIn, function() {
			var hops = $.fn.cycle.hopsFromLast(opts, fwd);
			for (var k=0; k < hops; k++)
				fwd ? opts.els.push(opts.els.shift()) : opts.els.unshift(opts.els.pop());
			if (fwd) {
				for (var i=0, len=opts.els.length; i < len; i++)
					$(opts.els[i]).css('z-index', len-i+count);
			}
			else {
				var z = $(curr).css('z-index');
				$el.css('z-index', parseInt(z,10)+1+count);
			}
			$el.animate({left:0, top:0}, opts.speedOut, opts.easeOut, function() {
				$(fwd ? this : curr).hide();
				if (cb) cb();
			});
		});
	};
	$.extend(opts.cssBefore, { display: 'block', opacity: 1, top: 0, left: 0 });
};

// turnUp/Down/Left/Right
$.fn.cycle.transitions.turnUp = function($cont, $slides, opts) {
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts,true,false);
		opts.cssBefore.top = next.cycleH;
		opts.animIn.height = next.cycleH;
		opts.animOut.width = next.cycleW;
	});
	opts.cssFirst.top = 0;
	opts.cssBefore.left = 0;
	opts.cssBefore.height = 0;
	opts.animIn.top = 0;
	opts.animOut.height = 0;
};
$.fn.cycle.transitions.turnDown = function($cont, $slides, opts) {
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts,true,false);
		opts.animIn.height = next.cycleH;
		opts.animOut.top   = curr.cycleH;
	});
	opts.cssFirst.top = 0;
	opts.cssBefore.left = 0;
	opts.cssBefore.top = 0;
	opts.cssBefore.height = 0;
	opts.animOut.height = 0;
};
$.fn.cycle.transitions.turnLeft = function($cont, $slides, opts) {
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts,false,true);
		opts.cssBefore.left = next.cycleW;
		opts.animIn.width = next.cycleW;
	});
	opts.cssBefore.top = 0;
	opts.cssBefore.width = 0;
	opts.animIn.left = 0;
	opts.animOut.width = 0;
};
$.fn.cycle.transitions.turnRight = function($cont, $slides, opts) {
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts,false,true);
		opts.animIn.width = next.cycleW;
		opts.animOut.left = curr.cycleW;
	});
	$.extend(opts.cssBefore, { top: 0, left: 0, width: 0 });
	opts.animIn.left = 0;
	opts.animOut.width = 0;
};

// zoom
$.fn.cycle.transitions.zoom = function($cont, $slides, opts) {
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts,false,false,true);
		opts.cssBefore.top = next.cycleH/2;
		opts.cssBefore.left = next.cycleW/2;
		$.extend(opts.animIn, { top: 0, left: 0, width: next.cycleW, height: next.cycleH });
		$.extend(opts.animOut, { width: 0, height: 0, top: curr.cycleH/2, left: curr.cycleW/2 });
	});
	opts.cssFirst.top = 0;
	opts.cssFirst.left = 0;
	opts.cssBefore.width = 0;
	opts.cssBefore.height = 0;
};

// fadeZoom
$.fn.cycle.transitions.fadeZoom = function($cont, $slides, opts) {
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts,false,false);
		opts.cssBefore.left = next.cycleW/2;
		opts.cssBefore.top = next.cycleH/2;
		$.extend(opts.animIn, { top: 0, left: 0, width: next.cycleW, height: next.cycleH });
	});
	opts.cssBefore.width = 0;
	opts.cssBefore.height = 0;
	opts.animOut.opacity = 0;
};

// blindX
$.fn.cycle.transitions.blindX = function($cont, $slides, opts) {
	var w = $cont.css('overflow','hidden').width();
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts);
		opts.animIn.width = next.cycleW;
		opts.animOut.left   = curr.cycleW;
	});
	opts.cssBefore.left = w;
	opts.cssBefore.top = 0;
	opts.animIn.left = 0;
	opts.animOut.left = w;
};
// blindY
$.fn.cycle.transitions.blindY = function($cont, $slides, opts) {
	var h = $cont.css('overflow','hidden').height();
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts);
		opts.animIn.height = next.cycleH;
		opts.animOut.top   = curr.cycleH;
	});
	opts.cssBefore.top = h;
	opts.cssBefore.left = 0;
	opts.animIn.top = 0;
	opts.animOut.top = h;
};
// blindZ
$.fn.cycle.transitions.blindZ = function($cont, $slides, opts) {
	var h = $cont.css('overflow','hidden').height();
	var w = $cont.width();
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts);
		opts.animIn.height = next.cycleH;
		opts.animOut.top   = curr.cycleH;
	});
	opts.cssBefore.top = h;
	opts.cssBefore.left = w;
	opts.animIn.top = 0;
	opts.animIn.left = 0;
	opts.animOut.top = h;
	opts.animOut.left = w;
};

// growX - grow horizontally from centered 0 width
$.fn.cycle.transitions.growX = function($cont, $slides, opts) {
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts,false,true);
		opts.cssBefore.left = this.cycleW/2;
		opts.animIn.left = 0;
		opts.animIn.width = this.cycleW;
		opts.animOut.left = 0;
	});
	opts.cssBefore.top = 0;
	opts.cssBefore.width = 0;
};
// growY - grow vertically from centered 0 height
$.fn.cycle.transitions.growY = function($cont, $slides, opts) {
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts,true,false);
		opts.cssBefore.top = this.cycleH/2;
		opts.animIn.top = 0;
		opts.animIn.height = this.cycleH;
		opts.animOut.top = 0;
	});
	opts.cssBefore.height = 0;
	opts.cssBefore.left = 0;
};

// curtainX - squeeze in both edges horizontally
$.fn.cycle.transitions.curtainX = function($cont, $slides, opts) {
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts,false,true,true);
		opts.cssBefore.left = next.cycleW/2;
		opts.animIn.left = 0;
		opts.animIn.width = this.cycleW;
		opts.animOut.left = curr.cycleW/2;
		opts.animOut.width = 0;
	});
	opts.cssBefore.top = 0;
	opts.cssBefore.width = 0;
};
// curtainY - squeeze in both edges vertically
$.fn.cycle.transitions.curtainY = function($cont, $slides, opts) {
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts,true,false,true);
		opts.cssBefore.top = next.cycleH/2;
		opts.animIn.top = 0;
		opts.animIn.height = next.cycleH;
		opts.animOut.top = curr.cycleH/2;
		opts.animOut.height = 0;
	});
	opts.cssBefore.height = 0;
	opts.cssBefore.left = 0;
};

// cover - curr slide covered by next slide
$.fn.cycle.transitions.cover = function($cont, $slides, opts) {
	var d = opts.direction || 'left';
	var w = $cont.css('overflow','hidden').width();
	var h = $cont.height();
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts);
		if (d == 'right')
			opts.cssBefore.left = -w;
		else if (d == 'up')
			opts.cssBefore.top = h;
		else if (d == 'down')
			opts.cssBefore.top = -h;
		else
			opts.cssBefore.left = w;
	});
	opts.animIn.left = 0;
	opts.animIn.top = 0;
	opts.cssBefore.top = 0;
	opts.cssBefore.left = 0;
};

// uncover - curr slide moves off next slide
$.fn.cycle.transitions.uncover = function($cont, $slides, opts) {
	var d = opts.direction || 'left';
	var w = $cont.css('overflow','hidden').width();
	var h = $cont.height();
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts,true,true,true);
		if (d == 'right')
			opts.animOut.left = w;
		else if (d == 'up')
			opts.animOut.top = -h;
		else if (d == 'down')
			opts.animOut.top = h;
		else
			opts.animOut.left = -w;
	});
	opts.animIn.left = 0;
	opts.animIn.top = 0;
	opts.cssBefore.top = 0;
	opts.cssBefore.left = 0;
};

// toss - move top slide and fade away
$.fn.cycle.transitions.toss = function($cont, $slides, opts) {
	var w = $cont.css('overflow','visible').width();
	var h = $cont.height();
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts,true,true,true);
		// provide default toss settings if animOut not provided
		if (!opts.animOut.left && !opts.animOut.top)
			$.extend(opts.animOut, { left: w*2, top: -h/2, opacity: 0 });
		else
			opts.animOut.opacity = 0;
	});
	opts.cssBefore.left = 0;
	opts.cssBefore.top = 0;
	opts.animIn.left = 0;
};

// wipe - clip animation
$.fn.cycle.transitions.wipe = function($cont, $slides, opts) {
	var w = $cont.css('overflow','hidden').width();
	var h = $cont.height();
	opts.cssBefore = opts.cssBefore || {};
	var clip;
	if (opts.clip) {
		if (/l2r/.test(opts.clip))
			clip = 'rect(0px 0px '+h+'px 0px)';
		else if (/r2l/.test(opts.clip))
			clip = 'rect(0px '+w+'px '+h+'px '+w+'px)';
		else if (/t2b/.test(opts.clip))
			clip = 'rect(0px '+w+'px 0px 0px)';
		else if (/b2t/.test(opts.clip))
			clip = 'rect('+h+'px '+w+'px '+h+'px 0px)';
		else if (/zoom/.test(opts.clip)) {
			var top = parseInt(h/2,10);
			var left = parseInt(w/2,10);
			clip = 'rect('+top+'px '+left+'px '+top+'px '+left+'px)';
		}
	}

	opts.cssBefore.clip = opts.cssBefore.clip || clip || 'rect(0px 0px 0px 0px)';

	var d = opts.cssBefore.clip.match(/(\d+)/g);
	var t = parseInt(d[0],10), r = parseInt(d[1],10), b = parseInt(d[2],10), l = parseInt(d[3],10);

	opts.before.push(function(curr, next, opts) {
		if (curr == next) return;
		var $curr = $(curr), $next = $(next);
		$.fn.cycle.commonReset(curr,next,opts,true,true,false);
		opts.cssAfter.display = 'block';

		var step = 1, count = parseInt((opts.speedIn / 13),10) - 1;
		(function f() {
			var tt = t ? t - parseInt(step * (t/count),10) : 0;
			var ll = l ? l - parseInt(step * (l/count),10) : 0;
			var bb = b < h ? b + parseInt(step * ((h-b)/count || 1),10) : h;
			var rr = r < w ? r + parseInt(step * ((w-r)/count || 1),10) : w;
			$next.css({ clip: 'rect('+tt+'px '+rr+'px '+bb+'px '+ll+'px)' });
			(step++ <= count) ? setTimeout(f, 13) : $curr.css('display', 'none');
		})();
	});
	$.extend(opts.cssBefore, { display: 'block', opacity: 1, top: 0, left: 0 });
	opts.animIn	   = { left: 0 };
	opts.animOut   = { left: 0 };
};

})(jQuery);
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END CYCLE

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START BOOKMARK

********************************************************************************************************************************
********************************************************************************************************************************
*/
/* http://keith-wood.name/bookmark.html
   Sharing bookmarks for jQuery v1.4.0.
   Written by Keith Wood (kbwood{at}iinet.com.au) March 2008.
   Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and 
   MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses. 
   Please attribute the author if you use it. */
(function($){var q='bookmark';function Bookmark(){this._defaults={url:'',sourceTag:'',title:'',description:'',sites:[],iconsStyle:'bookmark_icons',icons:'bookmarks.png',iconSize:16,iconCols:16,target:'_blank',compact:true,hint:'Send to {s}',popup:false,popupText:'Bookmark this site...',addFavorite:false,favoriteText:'Favorite',favoriteIcon:0,addEmail:false,emailText:'E-mail',emailIcon:1,emailSubject:'Interesting page',emailBody:'I thought you might find this page interesting:\n{t} ({u})',manualBookmark:'Please close this dialog and\npress Ctrl-D to bookmark this page.',addShowAll:false,showAllText:'Show all ({n})',showAllIcon:2,showAllTitle:'All bookmarking sites',onSelect:null,addAnalytics:false,analyticsName:'/share/{r}/{s}'};this._sites={'aol':{display:'myAOL',icon:3,lang:'en',category:'bookmark',url:'http://favorites.my.aol.com/ffclient/AddBookmark?url={u}&amp;title={t}'},'bitly':{display:'bit.ly',icon:4,lang:'en',category:'tools',url:'http://bit.ly/?url={u}'},'blogger':{display:'Blogger',icon:5,lang:'en',category:'blog',url:'http://www.blogger.com/blog_this.pyra?t=&amp;u={u}&amp;n={t}'},'delicious':{display:'del.icio.us',icon:6,lang:'en',category:'bookmark',url:'http://del.icio.us/post?url={u}&amp;title={t}'},'digg':{display:'Digg',icon:7,lang:'en',category:'news',url:'http://digg.com/submit?phase=2&amp;url={u}&amp;title={t}'},'diigo':{display:'Diigo',icon:8,lang:'en',category:'social',url:'http://www.diigo.com/post?url={u}&amp;title={t}'},'dzone':{display:'DZone',icon:9,lang:'en',category:'bookmark',url:'http://www.dzone.com/links/add.html?url={u}&amp;title={t}'},'facebook':{display:'Facebook',icon:10,lang:'en',category:'social',url:'http://www.facebook.com/sharer.php?u={u}&amp;t={t}'},'fark':{display:'Fark',icon:11,lang:'en',category:'news',url:'http://cgi.fark.com/cgi/fark/submit.pl?new_url={u}&amp;new_comment={t}'},'google':{display:'Google',icon:12,lang:'en',category:'bookmark',url:'http://www.google.com/bookmarks/mark?op=edit&amp;bkmk={u}&amp;title={t}'},'googlereader':{display:'Google Reader',icon:13,lang:'en',category:'tools',url:'http://www.google.com/reader/link?url={u}&amp;title={t}&amp;srcTitle={u}'},'hotmail':{display:'Hotmail',icon:14,lang:'en',category:'mail',url:'http://www.hotmail.msn.com/secure/start?action=compose&amp;to=&amp;body={u}&amp;subject={t}'},'linkedin':{display:'LinkedIn',icon:15,lang:'en',category:'social',url:'http://www.linkedin.com/shareArticle?mini=true&amp;url={u}&amp;title={t}&amp;ro=false&amp;summary={d}&amp;source='},'mixx':{display:'Mixx',icon:16,lang:'en',category:'news',url:'http://www.mixx.com/submit/story?page_url={u}&amp;title={t}'},'multiply':{display:'Multiply',icon:17,lang:'en',category:'social',url:'http://multiply.com/gus/journal/compose/addthis?body=&amp;url={u}&amp;subject={t}'},'myspace':{display:'MySpace',icon:18,lang:'en',category:'social',url:'http://www.myspace.com/Modules/PostTo/Pages/?u={u}&amp;t={t}'},'netvibes':{display:'Netvibes',icon:19,lang:'en',category:'news',url:'http://www.netvibes.com/share?url={u}&amp;title={t}'},'newsvine':{display:'Newsvine',icon:20,lang:'en',category:'news',url:'http://www.newsvine.com/_wine/save?u={u}&amp;h={t}'},'reddit':{display:'reddit',icon:21,lang:'en',category:'news',url:'http://reddit.com/submit?url={u}&amp;title={t}'},'stumbleupon':{display:'StumbleUpon',icon:22,lang:'en',category:'bookmark',url:'http://www.stumbleupon.com/submit?url={u}&amp;title={t}'},'technorati':{display:'Technorati',icon:23,lang:'en',category:'news',url:'http://www.technorati.com/faves?add={u}'},'tipd':{display:'Tip\'d',icon:24,lang:'en',category:'news',url:'http://tipd.com/submit.php?url={u}'},'tumblr':{display:'tumblr',icon:25,lang:'en',category:'blog',url:'http://www.tumblr.com/share?v=3&amp;u={u}&amp;t={t}'},'twitter':{display:'twitter',icon:26,lang:'en',category:'blog',url:'http://twitter.com/home?status={t}%20{u}'},'windows':{display:'Windows Live',icon:27,lang:'en',category:'bookmark',url:'https://favorites.live.com/quickadd.aspx?marklet=1&amp;mkt=en-us&amp;url={u}&amp;title={t}'},'wishlist':{display:'Amazon WishList',icon:28,lang:'en',category:'shopping',url:'http://www.amazon.com/wishlist/add?u={u}&amp;t={t}'},'yahoo':{display:'Yahoo Bookmarks',icon:29,lang:'en',category:'bookmark',url:'http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;u={u}&amp;t={t}'},'yahoobuzz':{display:'Yahoo Buzz',icon:30,lang:'en',category:'bookmark',url:'http://buzz.yahoo.com/submit?submitUrl={u}&amp;submitHeadline={t}'}};this.commonSites=[];for(var a in this._sites){this.commonSites.push(a)}}$.extend(Bookmark.prototype,{markerClassName:'hasBookmark',setDefaults:function(a){extendRemove(this._defaults,a||{});return this},addSite:function(a,b,c,d,e,f){this._sites[a]={display:b,icon:c,lang:d,category:e,url:f};return this},getSites:function(){return this._sites},_attachBookmark:function(a,b){a=$(a);if(a.hasClass(this.markerClassName)){return}a.addClass(this.markerClassName);this._updateBookmark(a,b)},_changeBookmark:function(a,b,c){a=$(a);if(!a.hasClass(this.markerClassName)){return}if(typeof b=='string'){var d=b;b={};b[d]=c}this._updateBookmark(a,b)},_updateBookmark:function(g,h){var i=$.data(g[0],q)||$.extend({},this._defaults);h=extendRemove(i,h||{});$.data(g[0],q,h);var j=h.sites;if(j.length==0){$.each($.bookmark._sites,function(a){j.push(a)});j.sort()}else{$.each(j,function(c,d){var e=d.match(/lang:(.*)/);if(e){$.each($.bookmark._sites,function(a,b){if(b.lang==e[1]&&$.inArray(a,j)==-1){j.push(a)}})}var f=d.match(/category:(.*)/);if(f){$.each($.bookmark._sites,function(a,b){if(b.category==f[1]&&$.inArray(a,j)==-1){j.push(a)}})}})}g.empty();var k=g;if(h.popup){g.append('<a href="#" class="bookmark_popup_text">'+h.popupText+'</a>');k=$('<div class="bookmark_popup"></div>').appendTo(g)}var l=$.bookmark._getSiteDetails(h);var m=$('<ul class="bookmark_list'+(h.compact?' bookmark_compact':'')+'"></ul>').appendTo(k);if(h.addFavorite){$.bookmark._addOneSite(h,m,h.favoriteText,h.favoriteIcon,'#',function(){$.bookmark._addFavourite(l.url.replace(/'/g,'\\\''),l.title.replace(/'/g,'\\\''));return false})}if(h.addEmail){$.bookmark._addOneSite(h,m,h.emailText,h.emailIcon,'mailto:?subject='+encodeURIComponent(h.emailSubject)+'&amp;body='+encodeURIComponent(h.emailBody.replace(/\{u\}/,l.url).replace(/\{t\}/,l.title).replace(/\{d\}/,l.desc)))}$.bookmark._addSelectedSites(j,l,h,m);if(h.addShowAll){var o=0;for(var n in $.bookmark._sites){o++}var p=h.showAllText.replace(/\{n\}/,o);$.bookmark._addOneSite(h,m,p,h.showAllIcon,'#',function(){$.bookmark._showAll(this,h);return false},p)}if(h.popup){g.find('.bookmark_popup_text').click(function(){var a=$(this).parent();var b=a.offset();a.find('.bookmark_popup').css('left',b.left).css('top',b.top+a.outerHeight()).toggle();return false});$(document).click(function(a){g.find('.bookmark_popup').hide()})}},_addSelectedSites:function(d,e,f,g){$.each(d,function(a,b){var c=$.bookmark._sites[b];if(c){$.bookmark._addOneSite(f,g,c.display,c.icon,(f.onSelect?'#':c.url.replace(/\{u\}/,e.url2+(e.sourceTag?e.sourceTag+b:'')).replace(/\{t\}/,e.title2).replace(/\{d\}/,e.desc2)),function(){if(f.addAnalytics&&window.pageTracker){window.pageTracker._trackPageview(f.analyticsName.replace(/\{s\}/,b).replace(/\{n\}/,c.display).replace(/\{u\}/,e.url).replace(/\{r\}/,e.relUrl).replace(/\{t\}/,e.title))}$('#bookmark_all').remove();$(document).unbind('click.bookmark');if(f.onSelect){$.bookmark._selected($(this).closest('.'+$.bookmark.markerClassName)[0],b);return false}return true})}})},_addOneSite:function(a,b,c,d,e,f,g){var h=a.hint||'{s}';var i='<li><a href="'+e+'"'+(a.target?' target="'+a.target+'"':'')+'>';if(d!=null){var j=g||h.replace(/\{s\}/,c);if(typeof d=='number'){i+='<span title="'+j+'" '+(a.iconsStyle?'class="'+a.iconsStyle+'" ':'')+'style="'+(a.iconsStyle?'background-position: ':'background: transparent url('+a.icons+') no-repeat ')+'-'+((d%a.iconCols)*a.iconSize)+'px -'+(Math.floor(d/a.iconCols)*a.iconSize)+'px;'+($.browser.mozilla&&$.browser.version<'1.9'?' padding-left: '+a.iconSize+'px; padding-bottom: '+(Math.max(0,a.iconSize-16))+'px;':'')+'"></span>'}else{i+='<img src="'+d+'" alt="'+j+'" title="'+j+'"'+(($.browser.mozilla&&$.browser.version<'1.9')||($.browser.msie&&$.browser.version<'7.0')?' style="vertical-align: bottom;"':($.browser.msie?' style="vertical-align: middle;"':($.browser.opera||$.browser.safari?' style="vertical-align: baseline;"':'')))+'/>'}i+=(a.compact?'':'&#xa0;')}i+=(a.compact?'':c)+'</a></li>';i=$(i).appendTo(b);if(f){i.find('a').click(f)}},_destroyBookmark:function(a){a=$(a);if(!a.hasClass(this.markerClassName)){return}a.removeClass(this.markerClassName).empty();$.removeData(a[0],q)},_selected:function(a,b){var c=$.data(a,q);var d=$.bookmark._sites[b];var e=$.bookmark._getSiteDetails(c);c.onSelect.apply(a,[b,d.display,d.url.replace(/&amp;/g,'&').replace(/\{u\}/,e.url2+(e.sourceTag?e.sourceTag+b:'')).replace(/\{t\}/,e.title2).replace(/\{d\}/,e.desc2)])},_addFavourite:function(a,b){if($.browser.msie){window.external.addFavorite(a,b)}else{alert(this._defaults.manualBookmark)}},_showAll:function(b,c){var d=[];$.each($.bookmark._sites,function(a){d.push(a)});d.sort();var e=$.bookmark._getSiteDetails(c);var f=$('<ul class="bookmark_list"></ul>');var g=c.compact;c.compact=false;$.bookmark._addSelectedSites(d,e,c,f);c.compact=g;var h=$('<div id="bookmark_all"><p>'+c.showAllTitle+'</p></div>').append(f).appendTo('body');h.css({left:($(window).width()-h.width())/2,top:($(window).height()-h.height())/2}).show();$(document).bind('click.bookmark',function(a){if($(a.target).closest(b).length==0&&$(a.target).closest('#bookmark_all').length==0){$('#bookmark_all').remove();$(document).unbind('click.bookmark')}})},_getSiteDetails:function(a){var b=a.url||window.location.href;var c=a.title||document.title||$('h1:first').text();var d=a.description||$('meta[name="description"]').attr('content')||'';var e=(!a.sourceTag?'':encodeURIComponent((b.indexOf('?')>-1?'&':'?')+a.sourceTag+'='));return{url:b,title:c,desc:d,relUrl:b.replace(/^.*\/\/[^\/]*\//,''),sourceTag:e,url2:encodeURIComponent(b),title2:encodeURIComponent(c),desc2:encodeURIComponent(d)}}});function extendRemove(a,b){$.extend(a,b);for(var c in b){if(b[c]==null){a[c]=null}}return a}$.fn.bookmark=function(a){var b=Array.prototype.slice.call(arguments,1);return this.each(function(){if(typeof a=='string'){if(!$.bookmark['_'+a+'Bookmark']){throw'Unknown operation: '+a;}$.bookmark['_'+a+'Bookmark'].apply($.bookmark,[this].concat(b))}else{$.bookmark._attachBookmark(this,a||{})}})};$.bookmark=new Bookmark()})(jQuery);
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END BOOKMARK

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START jsShare

********************************************************************************************************************************
********************************************************************************************************************************
*/
(function($) {
    $.fn.extend({
        jsShare: function(options) {
            var settings = $.extend({
                minwidth: 40,
                maxwidth: 250,
                animate: true,
                speed: 1000,
                initialdisplay: 'compact',
                facebook: true,
                twitter: true,
                digg: true,
                reddit: false,
                stumbleupon: false,
                messenger: false,
                delicious: false,
                linkedin: true,
                googlebuzz: true,
                yoursitetitle: '',
                yoursiteurl: '',
                yoursitename: '',
                desc: ''
            }, options);
            return this.each(function() {
                var container = $(this);
                container.addClass('social-media-share');
                var inner = $('<div/>').addClass('inner');
                container.append(inner);
                var buttons = $('<ul/>');
                container.append(buttons);
                var tooltip = $('<div/>').addClass('social-media-share-tooltip');
                container.before(tooltip);
                var mediaSource = ["http://www.facebook.com/share.php?u={ADDRESS}",
//
//	Bizamajig Customization
//
//                                     "http://twitter.com/home?status={TITLE}{ADDRESS}",
                                     "http://twitter.com/home?status={TITLE}+{ADDRESS}",
                                     "http://delicious.com/save?url={ADDRESS}&amp;title={TITLE}",
                                     "http://www.stumbleupon.com/submit?url={ADDRESS}&amp;title={TITLE}",

                                     "http://digg.com/submit?url={ADDRESS}&amp;title={TITLE}",
                                     "http://reddit.com/submit?url={ADDRESS}",
                                     "http://www.google.com/reader/link?url={ADDRESS}&title={TITLE}&snippet={SDESCRIPTION}&srcURL={BLOGURL}&srcTitle={BLOGTITLE}",
                                     "http://www.linkedin.com/shareArticle?mini=true&url={ADDRESS}&title={TITLE}&summary={SDESCRIPTION}&source={BLOGNAME}",
                                     "http://profile.live.com/badge?url={ADDRESS}"];

                function getButton(index, button, title) {
//                    var link = mediaSource[index].replace('{ADDRESS}', encodeURIComponent(location.href))
//                                                .replace('{TITLE}', encodeURIComponent(document.title))
//                                                .replace('{SDESCRIPTION}', encodeURIComponent(settings.desc))
//                                                .replace('{BLOGURL}', encodeURIComponent(settings.yoursiteurl))
//                                                .replace('{BLOGTITLE}', encodeURIComponent(settings.yoursitetitle))
//                                                .replace('{BLOGNAME}', encodeURIComponent(settings.yoursitename));
//
//	Bizamajig Customization
//
//					if ( settings.yoursitetitle === '' ) {
//						settings.yoursitetitle = bizamajig__config.title;
//					}
                    var link = mediaSource[index].replace('{ADDRESS}', encodeURIComponent((settings.yoursiteurl==""?location.href:settings.yoursiteurl)))
                                                .replace('{TITLE}', encodeURIComponent(bizamajig__config.bizamajig_portal_owner_enterprise_name))
                                                .replace('{SDESCRIPTION}', encodeURIComponent(bizamajig__config.bizamajig_portal_owner_enterprise_name))
												.replace('{BLOGURL}', encodeURIComponent((settings.yoursiteurl==""?location.href:settings.yoursiteurl)))
                                                .replace('{BLOGTITLE}', encodeURIComponent(bizamajig__config.bizamajig_portal_owner_enterprise_name))
                                                .replace('{BLOGNAME}', encodeURIComponent(bizamajig__config.bizamajig_portal_owner_enterprise_name))

                    return $('<li/>').append($('<a/>')
                                                    .attr('href', link)
                                                    .attr('title', title)
                                                    .attr('target', '_blank')
                                                    .append($('<img/>')
//
//	Bizamajig Customization
//
//                                                    .attr('src', 'images/' + button + '.png')
                                                    .attr('src', '/images/' + button + '.png')
                                                    .attr('alt', '').css({ width: 16, height: 16, marginTop: 8 })).hover(function() {
                                                        var dummy = $('<div/>').html(title).css('display', 'none');
                                                        container.append(dummy);
                                                        var left = Math.round($(this).offset().left - dummy.width() / 2);
                                                        dummy.remove();
                                                        var b = $(this);
                                                        if (settings.animate)
                                                            b.find('img').stop(false, true).animate({ height: 24, width: 24, marginTop: 0 }, 300);
                                                        tooltip.html(b.attr('title'));
                                                        tooltip.css({ left: left,
                                                            top: function() { return container.offset().top - $(this).height(); }
                                                        }).stop(false, true).fadeIn("slow");

                                                    }, function() {
                                                        if (settings.animate)
                                                            $(this).find('img').stop(false, true).animate({ width: 16, height: 16, marginTop: 8 }, 300);
                                                        tooltip.stop(false, true).fadeOut("slow");

                                                    }));
                }

                $.each(mediaSource, function(index, media) {
                    switch (index) {
                        case 0:
                            if (settings.facebook) buttons.append(getButton(index, 'facebook', 'Share with Facebook')); break;
                        case 1:
                            if (settings.twitter) buttons.append(getButton(index, 'twitter', 'Share with Twitter')); break;
                        case 2:
                            if (settings.delicious) buttons.append(getButton(index, 'delicious', 'Share with Delicious')); break;
                        case 3:
                            if (settings.stumbleupon) buttons.append(getButton(index, 'stumbleupon', 'Share with Stumble Upon')); break;
                        case 4:
                            if (settings.digg) buttons.append(getButton(index, 'digg', 'Share with Digg')); break;
                        case 5:
                            if (settings.reddit) buttons.append(getButton(index, 'reddit', 'Share with Reddit')); break;
                        case 6:
                            if (settings.googlebuzz) buttons.append(getButton(index, 'buzz', 'Share with Gooble Buzz')); break;
                        case 7:
                            if (settings.linkedin) buttons.append(getButton(index, 'linkedin', 'Share with LinkedIn')); break;
                        case 8:
                            if (settings.messenger) buttons.append(getButton(index, 'messenger', 'Share with Live Messenger')); break;
                    }
                });
                if (settings.initialdisplay == 'expanded') {
                    container.css({ width: settings.maxwidth });
                    inner.toggle(function() { container.stop().animate({ width: settings.minwidth }, settings.speed); }, function() { container.stop().animate({ width: settings.maxwidth }, settings.speed); });
                }
                else {
                    container.css({ width: settings.minwidth });
                    inner.toggle(function() { container.stop().animate({ width: settings.maxwidth }, settings.speed); }, function() { container.stop().animate({ width: settings.minwidth }, settings.speed); });
                }
            });
        }
    });
})(jQuery);
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END jsShare

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START MASONRY

********************************************************************************************************************************
********************************************************************************************************************************
*/
/**
 * jQuery Masonry v2.0.110526
 * 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]||null}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("masonry"),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,this.options.isFitWidth&&(l.width=this.cols*this.columnWidth-this.options.gutterWidth),this.styleQueue.push({$el:this.element,style:l});var m=this.isLaidOut?this.options.isAnimated?"animate":"css":"css",n=this.options.animationOptions,o;for(j=0,k=this.styleQueue.length;j<k;j++)o=this.styleQueue[j],o.$el[m](o.style,n);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("masonry"),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=null,this.style.top=null,this.style.left=null});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){var b=this.find("img"),d=b.length,e="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",f=this,g=function(){--d<=0&&this.src!==e&&(a.call(f),b.unbind("load",g))};if(!d){a.call(this);return this}b.bind("load",g).each(function(){if(this.complete||this.complete===c){var a=this.src;this.src=e,this.src=a}});return this};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);
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END MASONRY

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START Form Field Hints

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
** Adapted from http://remysharp.com/2007/01/25/jquery-tutorial-text-box-hints/
*/
(function ($) {
	$.fn.hint = function (blurClass) {
		if (!blurClass) { 
			blurClass = 'blur';
		}
    
		return this.each(function () {
//			Get jQuery version of 'this'
			var $input = $(this),
    
// 			Capture the rest of the variable to allow for reuse
			title = $input.attr('title'),
			$form = $(this.form),
			$win = $(window);

			function remove() {
				if ($input.val() === title && $input.hasClass(blurClass)) {
					$input.val('').removeClass(blurClass);
				}
			}

// 			Only apply logic if the element has the attribute
			if (title) { 
// 				On blur, set value to title attr if text is blank
				$input.blur(function () {
					if (this.value === '') {
						$input.val(title).addClass(blurClass);
					}
				}).focus(remove).blur(); // now change all inputs to title
      
// 				Clear the pre-defined text when form is submitted
				$form.submit(remove);
				$win.unload(remove); // handles Firefox's autocomplete
			}
		});
	};
})(jQuery);
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END Form Field Hints

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START Spinner

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
 jQuery UI Spinner 1.20

 Copyright (c) 2009-2010 Brant Burnett
 Dual licensed under the MIT or GPL Version 2 licenses.
*/
(function(j){var s="ui-state-active",l=j.ui.keyCode,C=l.UP,D=l.DOWN,t=l.RIGHT,E=l.LEFT,u=l.PAGE_UP,v=l.PAGE_DOWN,J=l.HOME,K=l.END,L=j.browser.msie,M=j.browser.mozilla?"DOMMouseScroll":"mousewheel",N=[C,D,t,E,u,v,J,K,l.BACKSPACE,l.DELETE,l.TAB],O;j.widget("ui.spinner",{options:{min:null,max:null,allowNull:false,group:"",point:".",prefix:"",suffix:"",places:null,defaultStep:1,largeStep:10,mouseWheel:true,increment:"slow",className:null,showOn:"always",width:16,upIconClass:"ui-icon-triangle-1-n",downIconClass:"ui-icon-triangle-1-s",
format:function(a,b){var d=/(\d+)(\d{3})/,g=(isNaN(a)?0:Math.abs(a)).toFixed(b)+"";for(g=g.replace(".",this.point);d.test(g)&&this.group;g=g.replace(d,"$1"+this.group+"$2"));return(a<0?"-":"")+this.prefix+g+this.suffix},parse:function(a){if(this.group==".")a=a.replace(".","");if(this.point!=".")a=a.replace(this.point,".");return parseFloat(a.replace(/[^0-9\-\.]/g,""))}},_create:function(){var a=this.element,b=a.attr("type");if(!a.is("input")||b!="text"&&b!="number")console.error("Invalid target for ui.spinner");
else{this._procOptions(true);this._createButtons(a);a.is(":enabled")||this.disable()}},_createButtons:function(a){function b(e){return e=="auto"?0:parseInt(e)}function d(e){for(var h=0;h<N.length;h++)if(N[h]==e)return true;return false}function g(e,h){if(F)return false;var m=String.fromCharCode(h||e),o=c.options;if(m>="0"&&m<="9"||m=="-")return false;if(c.places>0&&m==o.point||m==o.group)return false;return true}function i(e){function h(){w=0;e()}if(w){if(e===P)return;clearTimeout(w)}P=e;w=setTimeout(h,
100)}function p(){if(!f.disabled){var e=c.element[0],h=this===x?1:-1;e.focus();e.select();j(this).addClass(s);G=true;c._startSpin(h)}return false}function q(){if(G){j(this).removeClass(s);c._stopSpin();G=false}return false}var c=this,f=c.options,r=f.className,y=f.width,n=f.showOn,H=j.support.boxModel,Q=a.outerHeight(),R=c.oMargin=b(a.css("margin-right")),I=c.wrapper=a.css({width:(c.oWidth=H?a.width():a.outerWidth())-y,marginRight:R+y,textAlign:"right"}).after('<span class="ui-spinner ui-widget"></span>').next(),
z=c.btnContainer=j('<div class="ui-spinner-buttons"><div class="ui-spinner-up ui-spinner-button ui-state-default ui-corner-tr"><span class="ui-icon '+f.upIconClass+'">&nbsp;</span></div><div class="ui-spinner-down ui-spinner-button ui-state-default ui-corner-br"><span class="ui-icon '+f.downIconClass+'">&nbsp;</span></div></div>'),x,S,k,w,P,A,B,F,G,T=a[0].dir=="rtl";r&&I.addClass(r);I.append(z.css({height:Q,left:-y-R,top:a.offset().top-I.offset().top+"px"}));k=c.buttons=z.find(".ui-spinner-button");
k.css({width:y-(H?k.outerWidth()-k.width():0),height:Q/2-(H?k.outerHeight()-k.height():0)});x=k[0];S=k[1];r=k.find(".ui-icon");r.css({marginLeft:(k.innerWidth()-r.width())/2,marginTop:(k.innerHeight()-r.height())/2});z.width(k.outerWidth());n!="always"&&z.css("opacity",0);if(n=="hover"||n=="both")k.add(a).bind("mouseenter.uispinner",function(){i(function(){A=true;if(!c.focused||n=="hover")c.showButtons()})}).bind("mouseleave.uispinner",function(){i(function(){A=false;if(!c.focused||n=="hover")c.hideButtons()})});
k.hover(function(){c.buttons.removeClass("ui-state-hover");f.disabled||j(this).addClass("ui-state-hover")},function(){j(this).removeClass("ui-state-hover")}).mousedown(p).mouseup(q).mouseout(q);L&&k.dblclick(function(){if(!f.disabled){c._change();c._doSpin((this===x?1:-1)*f.step)}return false}).bind("selectstart",function(){return false});a.bind("keydown.uispinner",function(e){var h,m,o=e.keyCode;if(e.ctrl||e.alt)return true;if(d(o))F=true;if(B)return false;switch(o){case C:case u:h=1;m=o==u;break;
case D:case v:h=-1;m=o==v;break;case t:case E:h=o==t^T?1:-1;break;case J:e=c.options.min;e!=null&&c._setValue(e);return false;case K:e=c.options.max;e!=null&&c._setValue(e);return false}if(h){if(!B&&!f.disabled){keyDir=h;j(h>0?x:S).addClass(s);B=true;c._startSpin(h,m)}return false}}).bind("keyup.uispinner",function(e){if(e.ctrl||e.alt)return true;if(d(l))F=false;switch(e.keyCode){case C:case t:case u:case D:case E:case v:k.removeClass(s);c._stopSpin();return B=false}}).bind("keypress.uispinner",function(e){if(g(e.keyCode,
e.charCode))return false}).bind("change.uispinner",function(){c._change()}).bind("focus.uispinner",function(){function e(){c.element.select()}L?e():setTimeout(e,0);c.focused=true;O=c;if(!A&&(n=="focus"||n=="both"))c.showButtons()}).bind("blur.uispinner",function(){c.focused=false;if(!A&&(n=="focus"||n=="both"))c.hideButtons()})},_procOptions:function(a){var b=this.element,d=this.options,g=d.min,i=d.max,p=d.step,q=d.places,c=-1,f;if(d.increment=="slow")d.increment=[{count:1,mult:1,delay:250},{count:3,
mult:1,delay:100},{count:0,mult:1,delay:50}];else if(d.increment=="fast")d.increment=[{count:1,mult:1,delay:250},{count:19,mult:1,delay:100},{count:80,mult:1,delay:20},{count:100,mult:10,delay:20},{count:0,mult:100,delay:20}];if(g==null&&(f=b.attr("min"))!=null)g=parseFloat(f);if(i==null&&(f=b.attr("max"))!=null)i=parseFloat(f);if(!p&&(f=b.attr("step"))!=null)if(f!="any"){p=parseFloat(f);d.largeStep*=p}d.step=p=p||d.defaultStep;if(q==null&&(f=p+"").indexOf(".")!=-1)q=f.length-f.indexOf(".")-1;this.places=
q;if(i!=null&&g!=null){if(g>i)g=i;c=Math.max(Math.max(c,d.format(i,q,b).length),d.format(g,q,b).length)}if(a)this.inputMaxLength=b[0].maxLength;f=this.inputMaxLength;if(f>0){c=c>0?Math.min(f,c):f;f=Math.pow(10,c)-1;if(i==null||i>f)i=f;f=-(f+1)/10+1;if(g==null||g<f)g=f}c>0&&b.attr("maxlength",c);d.min=g;d.max=i;this._change();b.unbind(M+".uispinner");d.mouseWheel&&b.bind(M+".uispinner",this._mouseWheel)},_mouseWheel:function(a){var b=j.data(this,"spinner");if(!b.options.disabled&&b.focused&&O===b){b._change();
b._doSpin(((a.wheelDelta||-a.detail)>0?1:-1)*b.options.step);return false}},_setTimer:function(a,b,d){function g(){i._spin(b,d)}var i=this;i._stopSpin();i.timer=setInterval(g,a)},_stopSpin:function(){if(this.timer){clearInterval(this.timer);this.timer=0}},_startSpin:function(a,b){var d=this.options.increment;this._change();this._doSpin(a*(b?this.options.largeStep:this.options.step));if(d&&d.length>0){this.incCounter=this.counter=0;this._setTimer(d[0].delay,a,b)}},_spin:function(a,b){var d=this.options.increment,
g=d[this.incCounter];this._doSpin(a*g.mult*(b?this.options.largeStep:this.options.step));this.counter++;if(this.counter>g.count&&this.incCounter<d.length-1){this.counter=0;g=d[++this.incCounter];this._setTimer(g.delay,a,b)}},_doSpin:function(a){var b=this.curvalue;if(b==null)b=(a>0?this.options.min:this.options.max)||0;this._setValue(b+a)},_parseValue:function(){var a=this.element.val();return a?this.options.parse(a,this.element):null},_validate:function(a){var b=this.options,d=b.min,g=b.max;if(a==
null&&!b.allowNull)a=this.curvalue!=null?this.curvalue:d||g||0;return g!=null&&a>g?g:d!=null&&a<d?d:a},_change:function(){var a=this._parseValue();if(!this.selfChange){if(isNaN(a))a=this.curvalue;this._setValue(a,true)}},_setOption:function(a,b){j.Widget.prototype._setOption.call(this,a,b);this._procOptions()},increment:function(){this._doSpin(this.options.step)},decrement:function(){this._doSpin(-this.options.step)},showButtons:function(a){var b=this.btnContainer.stop();a?b.css("opacity",1):b.fadeTo("fast",
1)},hideButtons:function(a){var b=this.btnContainer.stop();a?b.css("opacity",0):b.fadeTo("fast",0);this.buttons.removeClass("ui-state-hover")},_setValue:function(a,b){this.curvalue=a=this._validate(a);this.element.val(a!=null?this.options.format(a,this.places,this.element):"");if(!b){this.selfChange=true;this.element.change();this.selfChange=false}},value:function(a){if(arguments.length){this._setValue(a);return this.element}return this.curvalue},enable:function(){this.buttons.removeClass("ui-state-disabled");
this.element[0].disabled=false;j.Widget.prototype.enable.call(this)},disable:function(){this.buttons.addClass("ui-state-disabled").removeClass("ui-state-hover");this.element[0].disabled=true;j.Widget.prototype.disable.call(this)},destroy:function(){this.wrapper.remove();this.element.unbind(".uispinner").css({width:this.oWidth,marginRight:this.oMargin});j.Widget.prototype.destroy.call(this)}})})(jQuery);
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END Spinner

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END Third Party Plugins

********************************************************************************************************************************
********************************************************************************************************************************
*/




































































/*
********************************************************************************************************************************
********************************************************************************************************************************

	START BIZAMAJIG UI META
	
	GLOBAL DECLARATIONS
	
********************************************************************************************************************************
********************************************************************************************************************************
*/

//window.bizamajig__config = 
//{ 
//    bizamajig__forum_listview__async : false
//}; 

bizamajig__config = {};
bizamajig__config.bizamajig__debug = 'N';
bizamajig__config.bizamajig__forum_listview__async = false;
bizamajig__config.bizamajig__forum_listview__eof = false;
bizamajig__config.bizamajig__document_repository__async = false;
bizamajig__config.bizamajig__document_repository__eof = false;
bizamajig__config.bizamajig__party_directory__async = false;
bizamajig__config.bizamajig__party_directory__eof = false;
bizamajig__config.bizamajig__gallery_workspace__async = false;
bizamajig__config.bizamajig__gallery_workspace__eof = false;

























































/*
********************************************************************************************************************************
********************************************************************************************************************************

	START GLOBAL FUNCTIONS

********************************************************************************************************************************
********************************************************************************************************************************
*/
//
//	This function is based on a javascript closure.
//
//function displayMessage(message, f) {
//	f(message); // execute function "f" with variable "message"
//}

//function alerter(message) {
//	alert(message);
//}

//function writer(message) {
//	document.write(message);
//}

//function runDelegate() {
//	displayMessage("Hello World!", alerter); // alert message
//	displayMessage("Hello World!", writer); // write message to DOM
//}

//	OR call simply by passing an anonymous function AS the parameter, vs above closure,
//	but explicit closure is better

//bizamajig__javascript__push( '//www.bizamajig.com/include/jquery/js/jquery.uploadify.v2.1.4.js', function() {
//	return bizamajig__bind__gallery_workspace__upload();
//});

//
//	Example call, passing a callback as parameter:
//
//		var scriptArray=new Array();
//		scriptArray[0] = "[REPLACE THIS WITH THE PATH TO THE JS FILE]";
//		scriptArray[1] = "[REPLACE THIS WITH THE PATH TO THE JS FILE]";
//		bizamajig__javascript__push( '//www.bizamajig.com/include/jquery/js/jquery.uploadify.v2.1.4.js', function() {
//			return bizamajig__bind__gallery_workspace__upload();
//		});

//
//	Global Declarations
//
//	To avoid duplication of script loads, the array, bizamajig__javascript_stack, tracks the currently loaded javascript
//	script files including path.
//
var bizamajig__javascript_stack = new Array();

//
//	Extend Array to support a custom 'contains' method
//
//	Then use it like this:
//				if ( bizamajig__javascript_stack.contains( objValue ) < 0 ) {
//	VS indexOf approach, which is fine:
//				if ( bizamajig__javascript_stack.indexOf( objValue ) < 0 ) {
Array.prototype.contains = function(obj) {
	var i = this.length;
	while (i--) {
		if (this[i] === obj) {
			return true;
		}
	}
	return false;
} 
function bizamajig__javascript__push( one_or_many_scripts, fn ) {

	var callback_exec = 0;

//
//	We must work in sync mode here, to maintain intended load order by the caller.
//
	$.ajaxSetup({async: false});

//
//	Load multiple scripts contained by incoming parameter of type: array
//
	if ( $.isArray( one_or_many_scripts ) ) {
		$.each( one_or_many_scripts, function( intIndex, objValue ) {
//			if ( $.inArray( objValue, bizamajig__javascript_stack ) < 0) {
			if ( !( bizamajig__javascript_stack.contains( objValue ) ) ) {
				bizamajig__javascript_stack.push( objValue );
				$.getScript( objValue, function() {
//					if ( fn != 'null' ) {
//						fn();
//						callback_exec = 1;
//					}
				});
			}
		});
	}
//
//	Load a single script contained by incoming parameter of type: string
//
	else {
//		if ( $.inArray( one_or_many_scripts, bizamajig__javascript_stack ) < 0) {
		if ( !( bizamajig__javascript_stack.contains( one_or_many_scripts ) ) ) {
			bizamajig__javascript_stack.push( one_or_many_scripts ); // push here, if we push in anonymous function below, we get dups due to ajax approach of getScript()
			$.getScript( one_or_many_scripts, function() {
				if ( fn != 'null' ) {
					fn();
					callback_exec = 1;
				}
			});
		}
	}
	if ( fn != 'null' ) {
		if ( !callback_exec ) {
			fn();
			callback_exec = 1;
		}
	}

//
//	Return default to async mode.
//
	$.ajaxSetup({async: true});

}



/*
********************************************************************************************************************************

Purpose:
	
	Support hex to rgba conversions in CSS.

History:

	ver		date			notes																				name
	----------------------------------------------------------------------------------------------------------------------------
	1.1		06-27-2011		Created.																			jahlife

Testing:

********************************************************************************************************************************
*/
function bizamajig_hex_to_rgba( colour, rgbA ) {
	var r,g,b,a;
	if ( colour.charAt(0) == '#' ) {
		colour = colour.substr(1);
	}

	r = colour.charAt(0) + '' + colour.charAt(1);
	g = colour.charAt(2) + '' + colour.charAt(3);
	b = colour.charAt(4) + '' + colour.charAt(5);

	r = parseInt( r,16 );
	g = parseInt( g,16 );
	b = parseInt( b ,16);
	a = rgbA;

	return 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')';
}

/*
********************************************************************************************************************************

	Purpose:
	
	The goal here is to determine width and height of a background image.  We can't directly do that, so we will load
	a copy of the background image into the DOM, allowing the caller to read image width and height.
	
	A bit of a kludge, but works until we use bizamajig meta to set/get.
		
	Inspired by http://stackoverflow.com/questions/5106243/how-do-i-get-background-image-size-in-jquery

	ver			date			notes																		name
	----------------------------------------------------------------------------------------------------------------------------
	1.0			12-14-2011		Created.																	jahlife
	
********************************************************************************************************************************
*/
$.fn.getBgImage = function(callback) {
	var width = 0;
	var height = 0;
	var path = $(this).css('background-image').replace('url', '').replace('(', '').replace(')', '').replace('"', '').replace('"', '');
//	var tempImg = $('<img />');
	var tempImg = $('<img src="/resources/sitelevel/spacer.gif" />');
	tempImg.hide(); //hide image
	tempImg.bind('load', callback);
	$('body').append(tempImg); // add to DOM before </body>
	tempImg.attr('src', path);
//
//	Added <img src="none" /> for this routine, but cannot remove the
//	graphic, so http://domain.com/none exists as error preventions.
//	tempImg.remove(); //remove from DOM
	$('#tempImg').remove(); //remove from DOM
};


/*
********************************************************************************************************************************
********************************************************************************************************************************

	Purpose:

		Start targeting http/https content to handle SSL mode.

	Example Embed Tags:

		$('#doc_section__detail a[href^="http://"]').attr({ target: "_blank", title: "Opens in a new window" }).append(' [^]');

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************

	Purpose:
	
	This routine will dynamically load a css file, after the initial page/css is loaded.  We will create and re-use a
	single LINK tag to load all dynamic css load requests.

	On initial page load, the tenant css is provided by bizamajig-ia.asp.
	
	To recast css in ajax calls, we cannot simply call bizamajig-ia.asp again because the page is already loaded.
	
	So, we dynamically create a single <link> tag with ID=bizamajig-ui-recast-css in the <head>, then dynamically load
	subsequent css changes into this link tag.

	Important:
	This routine should only be used to support the following:
	1. Cross Domain Receiver for content sharing in external domains, like facebook, or other bizamajig's
	2. Content driven Layout Change Requests (LCR)

	Note:
	Roll your own example, for deriving the local method above (non-Require/CSS).

    var link_element = document.createElement('link');
    link_element.rel = "stylesheet";
    link_element.type = "text/css";
    link_element.href = input_url;
    document.getElementsByTagName("head")[0].appendChild(link);

	History:
	
	ver			date			notes																		name
	----------------------------------------------------------------------------------------------------------------------------
	1.0			12-14-2011		Update tag ID name to bizamajig-ui-recast-css.								jahlife
	
********************************************************************************************************************************
*/
var bizamajig__recast__css = function( input_bizamajig__request__cross_domain_ind, input_url ) {

	if ( input_url === '' ) { // potential bug: add better 'undefined' object check
		input_url = '//www.bizamajig.com/bizamajig-ia.asp';
	}

//
//	If local request object, use Require/CSS to recast css.
//
	if ( !input_bizamajig__request__cross_domain_ind ) {
//
//		Typically, css.js is included by this script already, but this call was looking for disk based js file.
//
//		So, this call is using a redundant physicaly copy of CSS.js, residing in site root folder, until further investigation.
//		We should not need the redundant copy, and should be able to call from within this script?!?
//
//		CSS.js is also requested using require.js by DMXZone.com AHE(ADVHtml Editor).
//
		require(['css!' + input_url]);
		return false;
	}

	
//
//	If NOT local request object, and we are cross domain framed, use our own method to recast css.
//
//	The Require/CSS method did not work in cross domain context, because of the CSS.js reference, I am guessing!
//
	if ( input_bizamajig__request__cross_domain_ind ) {
//
//		Does the <LINK> tag (with id:dynamic_css) exist?  If not, we need to create it.
//
		if ($('#bizamajig-ui-recast-css').length === 0) {
//
//		Add the <LINK> tag between the <head> tags.
//		After creating a new LINK tag, we can find it by searching like this:
//
//		"link[href*='dmxEditor.css']"
//
			$('head').append('<link>');
//
//		Select the <LINK> element you just added.
//
			css = $('head').children(':last');
//
//		Set the attributes of the elements to make it load the CSS file.
//
			css.attr({
				id: 	'bizamajig-ui-recast-css',
				rel:  	'stylesheet',
				type: 	'text/css',
				href: 	input_url
			});
//
//		If the <LINK> element already exists, we simply need to change the value of 'href'.
//
		} else {
			$('#bizamajig-ui-recast-css').attr( 'href', input_url );
		}
		return false;
	}
}
/*
********************************************************************************************************************************

	Purpose:
	
	Add more structure to the DOM.

	ver			date			notes																		name
	----------------------------------------------------------------------------------------------------------------------------
	1.0			7-14-2010		Created.																	jahlife
	
********************************************************************************************************************************
*/
var bizamajig__recast__scaffolding = function( target_container, source_url ) {

	$.ajax({
		type: 'POST',
		async: false,
		cache: false,
		url: source_url,
//		data: { process_desc: process_desc, lookup_type_desc: lookup_type_desc, doc_group_identifier: doc_group_identifier, search_option: search_type_desc },
		success: function( response ) {
			$( target_container ).html( response );
		},
		error: function(xhr, ajaxOptions, thrownError) {
			if (bizamajig__config.bizamajig__debug === 'Y') {
				alert('readyState: ' + xhr.readyState + '\nstatus: ' + xhr.status);
				alert('responseText: ' + xhr.responseText);
				alert(thrownError);
			}
  		}
	});
	return false;
}

/*
********************************************************************************************************************************

	Purpose:
	
	The main menu is tracking the need to change css layouts based on the content layout setting, doc_group.doc_group_input_comment_text.
	
	Right now, each doc_group carries a layout setting.  If this value is different from the default or current DOM setup,
	load a new css file to supply the target content layout.
	
	Our transition is moving from css-context-1 (string1) to css-context-2 (string2).

	This routine will inspect tenant settings represented by the input strings, and return comparison result.  More detail
	required here, by researching callers.

	ver			date			notes																		name
	----------------------------------------------------------------------------------------------------------------------------
	1.0			12-14-2011		Update tag name, bizamajig-ui-recast-css.									jahlife
	
********************************************************************************************************************************
*/
var bizamajig__recast__detect = function( testing_for, string1, string2 ) {
	var searching = 0;
//
//	We are tracking css change request, and the transition move from css-context-1 to css-context-2.
//
	if ( string1 === string2 ) {
		return false;
	}

//alert('looking for ' + testing_for + ' in ' + string2 );

//
//	If transition is from 'Fixed-Content' to ( 'Fixed-Sidebar-Left Fixed-Content', 'Fixed-Content Fixed-Sidebar-Right', or 'Fixed-Sidebar-Left Fixed-Content Fixed-Sidebar-Right' )
//
	if ( string1 === 'Fixed-Content' ) {
//		return string2.search('/' + testing_for + '/i'); // caller uses testing_for: 'Fixed-Sidebar-Left', 'Fixed-Sidebar-Right'
//alert(string2.search(testing_for));
		searching = string2.search(testing_for); // caller uses testing_for: 'Fixed-Sidebar-Left', 'Fixed-Sidebar-Right'
		if ( searching === 0 ) {
			return true;
		}
		return false;
	}

	if ( string1 === 'Fixed-Sidebar-Left Fixed-Content' ) {
		if ( ( testing_for === 'Fixed-Content Fixed-Sidebar-Right' ) || ( testing_for === 'Fixed-Sidebar-Left Fixed-Content Fixed-Sidebar-Right' ) ) {
			searching = string2.search(testing_for);
			if ( searching === 0 ) {
				return true;
			}
			return false;
		}
	}

	if ( string1 === 'Fixed-Content Fixed-Sidebar-Right' ) {
		if ( ( testing_for === 'Fixed-Sidebar-Left Fixed-Content' ) || ( testing_for === 'Fixed-Sidebar-Left Fixed-Content Fixed-Sidebar-Right' ) ) {
			searching = string2.search(testing_for);
			if ( searching === 0 ) {
				return true;
			}
			return false;
		}
	}

	return false;
}

/*
********************************************************************************************************************************

Purpose:
	
	Populate the target_container with content.  In this case, the content is a standardized application workspace layout.
	The content is retrieved by a POST to the source_url, also passing a search_option.
	
	Content is selected based on process_desc/lookup_type_desc/view_by_identifier/other inputs to the source_url.

	Example inputs are:
	
	process_desc			= Content Manager
	lookup_type_desc		= All Folders
	view_by_identifier_1	= %

	target_container		= #doc_section__detail
	source_url				= /include/_bizamajig-ui-form-header-cm.asp
	search_option			= whatever

NOTE:

	TO BE DEPRECATED: This function, bizamajig__workspace__layout, will be replaced by 
	the function, bizamajig__set__workspace__layout__update (see below).
	
	Each function has a different parm list.
	
	The function, bizamajig__set__workspace__layout__update, is reading the new object,
	request__context, more later.
	
	Each function generates the same result.

History:

	ver		date			notes																				name
	----------------------------------------------------------------------------------------------------------------------------
	1.1		06-27-2011		Updated to include search_option. 													billy

Testing:

********************************************************************************************************************************
*/
var bizamajig__workspace__layout = function( process_desc, lookup_type_desc, view_by_identifier_1, doc_group_identifier, target_container, source_url, search_option ) {

	var search_type_desc = 'Search'
	if ( !search_option ) {
		search_type_desc = '';
	}

	$.ajax({
		type: 'POST',
		async: false,
		cache: false,
		url: source_url,
		data: { process_desc: process_desc, lookup_type_desc: lookup_type_desc, doc_group_identifier: doc_group_identifier, search_option: search_type_desc },
		success: function( response ) {
			$( target_container ).html( response );//.fadeIn('slow');
		},
		error: function(xhr, ajaxOptions, thrownError) {
			if (bizamajig__config.bizamajig__debug === 'Y') {
				alert('readyState: ' + xhr.readyState + '\nstatus: ' + xhr.status);
				alert('responseText: ' + xhr.responseText);
				alert(thrownError);
			}
  		}
	});
} // end var bizamajig__workspace__layout = function( process_desc, lookup_type_desc, view_by_identifier_1, doc_group_identifier, target_container, source_url, search_option ) {
var bizamajig__set__workspace__layout__update = function( request__context, doc_group_identifier, update_method, target_container, source_url, search_option ) {

//
//	Process Inputs
//
	if ( ( typeof request__context.process_desc === 'undefined' ) || ( request__context.process_desc === '' ) ) {
		request__context.process_desc = '';
	}
	if ( ( typeof request__context.lookup_type_desc === 'undefined' ) || ( request__context.lookup_type_desc === '' ) ) {
		request__context.lookup_type_desc = '';
	}
	if ( ( typeof request__context.view_by_identifier === 'undefined' ) || ( request__context.view_by_identifier === '' ) ) {
		request__context.view_by_identifier = '';
	}
	if ( ( typeof request__context.auth_option === 'undefined' ) || ( request__context.auth_option === '' ) ) {
		request__context.auth_option = ''; // 'passive' for auto-authenticate by email with limited priveleges (consider unique session variable usage).
	}
	if ( ( typeof doc_group_identifier === 'undefined' ) || ( doc_group_identifier === '' ) ) {
		doc_group_identifier = '';
	}
	if ( ( typeof update_method === 'undefined' ) || ( update_method === '' ) ) {
		update_method = 'replace'; // 'prepend', 'append', 'replace'
	}
	if ( ( typeof source_url === 'undefined' ) || ( source_url === '' ) ) {
		source_url = '';
	}
	if ( typeof request__context.search_option === 'undefined' ) {
		request__context.search_option = '';
	}

	var search_type_desc = 'Search'
	if ( !search_option ) {
		search_type_desc = '';
	}

	$.ajax({
		type: 'POST',
		async: false,
		cache: false,
		url: source_url,
		data: {
			process_desc: 					request__context.process_desc,
			lookup_type_desc: 				request__context.lookup_type_desc,
			view_by_identifier:				request__context.view_by_identifier,
			auth_option:					request__context.auth_option,
			search_option: 					search_type_desc,

			doc_group_identifier: 			doc_group_identifier
		},
		success: function( response ) {
			if ( update_method === 'prepend' ) {
				$( target_container ).prepend( response );
			}
			if ( update_method === 'append' ) {
				$( target_container ).append( response );
			}
			if ( update_method === 'replace' ) {
				$( target_container ).html( response );
			}
		},
		error: function(xhr, ajaxOptions, thrownError) {
			if (bizamajig__config.bizamajig__debug === 'Y') {
				alert('readyState: ' + xhr.readyState + '\nstatus: ' + xhr.status);
				alert('responseText: ' + xhr.responseText);
				alert(thrownError);
			}
  		}
	});
} // end var bizamajig__set__workspace__layout__update = function( process_desc, lookup_type_desc, view_by_identifier_1, doc_group_identifier, target_container, source_url, search_option ) {
/*
********************************************************************************************************************************

	Purpose:
	
		Populate the global variables for the application API, relating to how the UI/ASP communications within itself.

	History:

		ver		date			notes																		name
		------------------------------------------------------------------------------------------------------------------------
		1.1		06-27-2011		Updated to include search_option. 											billy

	Testing:

********************************************************************************************************************************
*/
var bizamajig__set__workspace__context = function( process_desc, lookup_type_desc, view_by_identifier ) {
	bizamajig__config.process_desc 			= process_desc;
	bizamajig__config.lookup_type_desc 		= lookup_type_desc;
	bizamajig__config.view_by_identifier 	= view_by_identifier;
} // end var bizamajig__set__workspace__context = function( process_desc, lookup_type_desc, view_by_identifier ) {

/*
********************************************************************************************************************************

	Purpose:
	
		Bind a horizontal mega menu.

	History:

		ver		date			notes																		name
		------------------------------------------------------------------------------------------------------------------------
		1.1		06-27-2011		Creation.						 											jahlife

	Testing:

********************************************************************************************************************************
*/
var bizamajig__bind__menu__mega_panel = function( target_menu_items, margin_right ) {

//	$('#mega-menu-1').dcMegaMenu({
	$(target_menu_items).dcMegaMenu({
		event: 'hover', // 'click'
		rowItems: '3',
		speed: 'fast',
		effect: 'fade'
	});

//	Hack the accordion post-binding, with css changes.
//	$(target_menu_items).css('margin-right', margin_right).css('border', 'none');
} // end var bizamajig__bind__menu__vertical_accordion = function( target_menu_items, margin_right ) {

/*
********************************************************************************************************************************

	Purpose:
	
		Bind a vertical accordion menu, with some css changes to accomodate sidebar definitions.

	History:

		ver		date			notes																		name
		------------------------------------------------------------------------------------------------------------------------
		1.1		06-27-2011		Creation.						 											jahlife

	Testing:

********************************************************************************************************************************
*/
var bizamajig__bind__menu__vertical_accordion = function( target_menu_items, margin_right ) {

	$(target_menu_items).dcAccordion({
		eventType: 		'hover',
		classParent: 	'dcjq-parent',	// reference the css classes here for styling the menu
		classActive: 	'active',
		classArrow: 	'dcjq-icon',
		classCount: 	'dcjq-count',
		classExpand: 	'dcjq-current-parent',
		hoverDelay: 	400,
		menuClose:		true,
		autoClose: 		true,
	
		autoExpand: 	true,

		speed: 			'slow',
		saveState: 		true,
		disableLink: 	false,
		showCount: 		false,
		cookie: 		'dcjq-accordion'
	});
//	Hack the accordion post-binding, with css changes.
//	if ( target_panel === '.innertube_left' ) {
		$(target_menu_items).css('margin-right', margin_right).css('border', 'none');
//	}
} // end var bizamajig__bind__menu__vertical_accordion = function( target_menu_items, margin_right ) {

/*
********************************************************************************************************************************

	Purpose:
	
		This routine will read an unordered list, and bind click events to render content.
		
		Any menu plugin have already been created, and we setting up all user interactions here.
		
		We also support detection and execution of dynamic css and scaffolding requirements, adding or
		removingsidebars as needed.

	Inputs:

		target_menu_items = string like 'div.' + target_element + ' > ul.accordion-menu';
	
	History:

		ver		date			notes																		name
		------------------------------------------------------------------------------------------------------------------------
		1.1		06-27-2011		Creation.						 											jahlife

	Testing:

********************************************************************************************************************************
*/
var bizamajig__bind__actions__menu = function( target_menu_items, input_layout_change_request_enabled ) {

if ( bizamajig__config.bizamajig_portal_owner_party_id = '23027' ) {
//	alert(target_menu_items + ' a');
}

	var doc_section__detail							= '',
//
//		Tenant css can be dynamically loaded (recast) to render page in different layouts based on user interactions.
//
		bizamajig__request__cross_domain_ind		= false,
		bizamajig__ui__new__sidebar_left 			= false,
		bizamajig__ui__new__sidebar_right 			= false,
		bizamajig__scripts__tenant_css				= '//www.bizamajig.com/bizamajig-ia.asp',
		bizamajig__scripts__tenant_markup			= '/include/_bizamajig-ui-layout-column-style.asp',
		bizamajig__scripts__tenant_css__parameters	= '',
//
//	Menu items carry the following markup data.
//
		asyncio										= 'asyncio',
		doc_class_desc								= 'Web Sections',																// 'Web Sections', 'URL Documents'
		doc_group_built_in_ind						= '',
		permalink_url								= '',
		doc_group_identifier						= '',		
		doc_group_input_comment_text				= '',
		primary_doc_group_id 						= '',
		doc_id										= '',
		target_url 									= '/include/bizamajig-public-section-article-body-all-doc-section-detail.asp',
		target_container_01							= 'doc_section__detail';														// '#doc_section__detail'


//
//	Bind menu click events to render content selected by user.
//
//	Start by reading menu item markup, then render content using specified
//	method, asyncio (ajax) or syncio (link/player/lightbox/etc).
//
	$(target_menu_items + ' a').click(function( e ){

//
//		Manage selection trail.
//
		$(target_menu_items + ' a').removeClass('selected');
		$(this).addClass('selected');
		
//
//		Read markup data for this menu item.
//
//		Fetch and render content by executing target_url.
//
		asyncio								= $(this).attr('data-asyncio');
		doc_class_desc						= $(this).attr('data-doc_class_desc');
		doc_group_built_in_ind				= $(this).attr('data-doc_group_built_in_ind');
		permalink_url						= ''; // let's not trust permalinks for the menu system, could be implemented as meta data by tenant user toggle, to enhance SEO, later
		doc_group_identifier				= $(this).attr('data-doc_group_identifier');
		doc_group_input_comment_text		= $(this).attr('data-doc_group_input_comment_text');
		primary_doc_group_id 				= $(this).attr('data-primary_doc_group_id');
		doc_id								= $(this).attr('data-doc_id');
		target_url 							= $(this).attr('data-target_url');
		target_container_01					= $(this).attr('data-target_container_01');

		if ( ( typeof asyncio === 'undefined' ) || ( asyncio === '' ) ) {
			asyncio = 'asyncio';
		}
		if ( ( typeof doc_class_desc === 'undefined' ) || ( doc_class_desc === '' ) ) {
			doc_class_desc = 'Web Sections';
		}
		if ( ( typeof doc_group_built_in_ind === 'undefined' ) || ( doc_group_built_in_ind === '' ) ) {
			doc_group_built_in_ind = 'N';
		}
		if ( ( typeof permalink_url === 'undefined' ) || ( permalink_url === '' ) ) {
			permalink_url = '';
		}
		if ( ( typeof doc_group_identifier === 'undefined' ) || ( doc_group_identifier === '' ) ) {
			doc_group_identifier = '';
		}
		if ( ( typeof doc_group_input_comment_text === 'undefined' ) || ( doc_group_input_comment_text === '' ) ) {
			doc_group_input_comment_text = '';
		}
		if ( ( typeof primary_doc_group_id === 'undefined' ) || ( primary_doc_group_id === '' ) ) {
			primary_doc_group_id = '';
		}
		if ( ( typeof doc_id === 'undefined' ) || ( doc_id === '' ) ) {
			doc_id = '';
		}
		if ( ( typeof target_url === 'undefined' ) || ( target_url === '' ) ) {
			target_url = '';
		}
		if ( ( typeof target_container_01 === 'undefined' ) || ( target_container_01 === '' ) ) {
			target_container_01 = '#doc_section__detail';
		}

//
//		Define target_url to retreive selected content.
//
		target_url = target_url + '?primary_doc_group_id=' + primary_doc_group_id + '&doc_id=' + doc_id + ''; // just want strings

//
//		START Cross Domain Receiver Support
//
//		This is relative to ASYNCIO processing only.  Initial page loads are handled by the
//		ASP/SQL Server default page setup.
//
//		No dynamic loading is accomplished here.  Simply setup variable, recast, to enable
//		css/scaffolding when making content requests resulting in layout change requests.
//
//		When content is being displayed in a cross domain environment, we want to inform all
//		content loads to persist the current iframe requirements.  To track this, we initiate
//		a new pattern, of passing a new URL parameter, bizamajig__request__http_referer.
//		This new parameter will be used to manage how CSS/meta_data is requested during:
//
//		1) the initial page load process
//		2) an ajax call to load new content
//
		bizamajig__request__cross_domain_ind = false;
		if ( bizamajig__config.bizamajig__request__http_referer != '' ) {
			bizamajig__request__cross_domain_ind = ~bizamajig__config.bizamajig__request__http_referer.indexOf('facebook')
			if ( bizamajig__request__cross_domain_ind ) {
				target_url = target_url + '&bizamajig__request__http_referer=' + bizamajig__config.bizamajig__request__http_referer;
			}
			else {
				bizamajig__request__cross_domain_ind = ~bizamajig__config.bizamajig__request__http_referer_persist.indexOf('facebook')
				if ( bizamajig__request__cross_domain_ind ) {
					target_url = target_url + '&bizamajig__request__http_referer=' + bizamajig__config.bizamajig__request__http_referer_persist;
				}
			}
		}
//
//		END Cross Domain Receiver Support
//

//
//		START ASYNCIO Request Processing (ajax)
//
//		We detect user content selections, inspect the implied layout requirements, and
//		then process any layout transition change requests before we render the content.
//
//		NOTE: Syncio requests are handled below, without layout transition support.
//
		if ( asyncio === 'asyncio' ) {

//
//			If the caller requests LCR capability, let's go.
//			However, we will not handle LCR's if we are cross domain framed (like facebook),
//			because we are currently recasted/ing into Fixed-Content layout, sometimes with a
//			narrow content area, like 520px for facebook.com iframes, so we are deciding to
//			ignore any dynamic sidebar additions.
//
			if ( ( input_layout_change_request_enabled ) && ( !bizamajig__request__cross_domain_ind ) ) {
//				doc_section__detail = $('.doc_section__detail').html();
//
//				Manage re-casting requirements based on user selected content, or cross domain content situations.
//				This ASP/SQL stored procedure can request/provide a 'default' or 'override' layout on the initial page load.
//				We will process the first transition differently from remaining transitions.
//				An initial page load layout override is in effect when content is being displayed with a non-default,
//				SPECIFIED layout (like built-in page, hardcoded for "Fixed-Content" layout: entrance-public-showcase.asp).
//				Each time content is requested by the user, a layout transtion can be applied by one of two methods:
//				1. if layout is NOT SPECIFIED, we return to the default
//				2. if non-default layout is SPECIFIED, re-cast css and scaffolding for new layout
//
//				If no layout transition is specified, we will reset and/or use the default.
//
				if ( doc_group_input_comment_text === '' ) {
					doc_group_input_comment_text = bizamajig__config.metadata__layout__column_style_public__default;
				}
//
//				Detect layout transition change request?
//				To do this, we compare doc_group_input_comment_text to current layout referenced
//				by global variable, bizamajig__config.metadata__layout__column_style_public.
//				For example, do we need to add a left sidebar, and/or perhaps a right sidebar?
//
				if ( ( doc_group_input_comment_text != '' ) && ( doc_group_input_comment_text != bizamajig__config.metadata__layout__column_style_public ) ) {
					bizamajig__ui__new__sidebar_left = bizamajig__recast__detect( 'Fixed-Sidebar-Left', bizamajig__config.metadata__layout__column_style_public, doc_group_input_comment_text );
					bizamajig__ui__new__sidebar_right = bizamajig__recast__detect( 'Fixed-Sidebar-Right', bizamajig__config.metadata__layout__column_style_public, doc_group_input_comment_text );
					bizamajig__scripts__tenant_css__parameters = '?metadata__layout__column_style_public=' + doc_group_input_comment_text + ''; // just want strings
//
//					Update current layout to this requested layout.
//
					bizamajig__config.metadata__layout__column_style_public = doc_group_input_comment_text;
				}
//
//				Determine if we need to update layout with new css and sidebars, specified by the selected
//				content using doc_group.doc_group_input_comment_text.  At this point, only doc_group-level
//				Layout Change Request settings are supported by the CMS.
//
				if ( bizamajig__ui__new__sidebar_left || bizamajig__ui__new__sidebar_right ) {
					bizamajig__recast__css( bizamajig__request__cross_domain_ind, bizamajig__scripts__tenant_css + bizamajig__scripts__tenant_css__parameters );
//
//					Generate content and load target_container.
//
//					Example call:
//					bizamajig__recast__scaffolding( '#bizamajig-ui-doc-section-border', '/include/_bizamajig-ui-layout-column-style.asp?metadata__layout__column_style_public=Fixed-Sidebar-Left%20Fixed-Content' )
//
//					will GET:
//					/include/_bizamajig-ui-layout-column-style.asp?metadata__layout__column_style_public=Fixed-Sidebar-Left%20Fixed-Content
//
					bizamajig__recast__scaffolding( '#bizamajig-ui-doc-section-border', bizamajig__scripts__tenant_markup + bizamajig__scripts__tenant_css__parameters )
				}
				if ( bizamajig__ui__new__sidebar_left ) {
					bizamajig__recast__secondary_navigation( $(this), '', '', '%', false, '.innertube_left', '#bizamajig-ui-menu-secondary-navigation' );
				}
				if ( bizamajig__ui__new__sidebar_right ) {
					bizamajig__recast__secondary_navigation( $(this), '', '', '%', false, '.innertube_right', '#bizamajig-ui-menu-secondary-navigation' );
				}
			}

//
//			Render the page in content area.
//
			setDocSection( target_url, 'doc_section__detail', permalink_url, '', '' );
		}
//
//		END ASYNCIO Request Processing (ajax)
//

//
//		START SYNCIO Request Processing
//
//		Render this content by link/lightbox/player/etc.  Typically, just download PDF/DOC/HTML/etc.
//
		else {
			if ( typeof target_url != '' ) { // need to re-code this check?
/*
target_url = target_url + bizamajig__request__http_referer;
		if ( ( typeof bizamajig__config.bizamajig__request__http_referer === 'undefined' ) || ( bizamajig__config.bizamajig__request__http_referer === '' ) ) {
			return bizamajig__request__cross_domain_ind;
		}
*/
				if ( doc_class_desc === 'Web Sections' ) {
					document.location.href = target_url;
					return false;
				}
				if ( doc_class_desc === 'URL Documents' ) {
					window.open( target_url )
					return false;
				}
			}
		}
//
//		END SYNCIO Request Processing
//
		return false;
	});
} // end var bizamajig__bind__actions__menu = function( target_menu_items, input_layout_change_request_enabled ) {

/*
********************************************************************************************************************************

	Purpose:
	
		Load various content areas.

	Example:
	
		bizamajig__recast__secondary_navigation( $(this), '', '', '%', false, '.innertube_left', '#bizamajig-ui-menu-secondary-navigation' );


	History:

		ver		date			notes																		name
		------------------------------------------------------------------------------------------------------------------------
		1.1		11-01-2009		Creation. 																	billy

	Testing:

********************************************************************************************************************************
*/
var bizamajig__recast__secondary_navigation = function( input_object, process_desc, lookup_type_desc, view_by_identifier, ui_init_template, target_panel, target_element ) {

	var ui_url_request 						= '',
//
//		Read markup data for this menu item.
//
//		Decompose the input_object.
//
		asyncio								= input_object.attr('data-asyncio');
		doc_class_desc						= input_object.attr('data-doc_class_desc');
		doc_group_built_in_ind				= input_object.attr('data-doc_group_built_in_ind');
		permalink_url						= ''; // let's not trust permalinks for the menu system, could be implemented as meta data by tenant user toggle, to enhance SEO, later
		doc_group_identifier				= input_object.attr('data-doc_group_identifier');
		doc_group_input_comment_text		= input_object.attr('data-doc_group_input_comment_text');
		primary_doc_group_id 				= input_object.attr('data-primary_doc_group_id');
		doc_id								= input_object.attr('data-doc_id');
		target_url 							= input_object.attr('data-target_url');
		target_container_01					= input_object.attr('data-target_container_01');


//
//	Need to manage this from a default standpoint.
//
	if ( ( typeof doc_group_identifier === 'undefined' ) || ( doc_group_identifier === '' ) ) {
		doc_group_identifier = '';
	}

//alert('Reading ' + doc_group_identifier );

//
//	Setup Accordion For Secondary Navigation Menu
//
//	Non-built-in pages.
//
//	if ( doc_group_built_in_ind === 'N' ) {
	if ( 'N' === 'N' ) {
//		if ( target_panel === '.doc_section__panel.wide.section-first' ) {
		if ( target_element === '#bizamajig-ui-menu-secondary-navigation' ) {

			ui_url_request = '/include/_ap-menu-secondary-navigation.asp';

//
//			Not used here, later.
//
//			if ( ui_init_template ) {
//				bizamajig__workspace__layout( process_desc, lookup_type_desc, '%', doc_group_identifier, '#doc_section__detail', '/include/_bizamajig-ui-form-header-gallery-workspace.asp', false );
//				bizamajig__bind__autocomplete( process_desc, 'All Galleries', '%', doc_group_identifier, '#view_by_identifier_1__gallery_workspace', '/include/_ap_search__simple.asp', '' );
//			}

//
//			Setup accordion for secondary navigation
//

			$.ajax({
				type: 'POST',
				url: ui_url_request,
				data: { enterprise_id: bizamajig__config.bizamajig_portal_owner_party_id, primary_doc_group_id: primary_doc_group_id },
				success: function(response) {
					$(target_panel).html(response)
					.fadeIn(1500, function() {
//
//						$('ul li a', target_panel).unbind();
//						$('ul li a', target_panel).collapsor({
//							slide: true,
//							speed: 500,
//							easing: 'swing' // 'easeOutSine'
//						});

						target_menu_items = 'div' + target_panel + ' > ul.accordion-menu';
						bizamajig__bind__menu__vertical_accordion( target_menu_items, '10px' ); // similar to original call to bizamajig__bind__menu(), which is the parent recursive context of this call, due to recasting a sidebar with secondary navigation
						bizamajig__bind__actions__menu( target_menu_items, false ); // indirect recursive call

//
//						Setup doc items within doc_group accordion
//
//						bizamajig__set__workspace__action( true, process_desc, 'Edit Gallery', view_by_identifier, 'bizamajig-dataset', 'bizamajig-bind-new-bz-gallery-x', target_panel, '' );
//						bizamajig__set__workspace__action( true, process_desc, 'Edit Gallery Item', view_by_identifier, 'bizamajig-dataset', 'bizamajig-bind-new-bz-gallery-x-doc-update-web-section', target_panel, '' );
					});
				},
				error: function(xhr, ajaxOptions, thrownError) {
					if (bizamajig__config.bizamajig__debug === 'Y') {
						alert('readyState: ' + xhr.readyState + '\nstatus: ' + xhr.status);
						alert('responseText: ' + xhr.responseText);
						alert(thrownError);
					}
	   			}
			});
			return false;
		} // end if ( target_element === '#bizamajig-ui-menu-secondary-navigation' ) {
	} // end if ( doc_group_built_in_ind === 'N' ) {

//
//	Setup Accordion For Secondary Navigation Menu
//
//	Built-in pages.
//
	if ( doc_group_identifier === 'Public Store' ) {
//		if ( target_panel === '.doc_section__panel.wide.section-first' ) {
			if ( target_element === '#bizamajig-ui-menu-secondary-navigation' ) {

			ui_url_request = '/include/_ap-doc-group-category-list-product-catalog.asp';

//
//			Not used here, later.
//
//			if ( ui_init_template ) {
//				bizamajig__workspace__layout( process_desc, lookup_type_desc, '%', doc_group_identifier, '#doc_section__detail', '/include/_bizamajig-ui-form-header-gallery-workspace.asp', false );
//				bizamajig__bind__autocomplete( process_desc, 'All Galleries', '%', doc_group_identifier, '#view_by_identifier_1__gallery_workspace', '/include/_ap_search__simple.asp', '' );
//			}

//
//			Setup accordion for secondary navigation
//
			$.ajax({
				type: 'POST',
				url: ui_url_request,
				data: { primary_doc_group_id: primary_doc_group_id, process_desc: '', lookup_type_desc: '', view_by_identifier_1: '%', doc_group_identifier: 'Product Catalog', category_doc_group_id: '-1', subcategory_doc_group_id: '-1', doc_group_active_ind: 'Y', doc_active_ind: '%' },
				success: function(response) {
					$(target_panel).html(response)
					.fadeIn(1500, function() {
//
//						$('ul li a', target_panel).unbind();
//						$('ul li a', target_panel).collapsor({
//							slide: true,
//							speed: 500,
//							easing: 'swing' // 'easeOutSine'
//						});

						target_menu_items = 'div' + target_panel + ' > ul.accordion-menu';
						bizamajig__bind__menu__vertical_accordion( target_menu_items, '10px' ); // similar to original call to bizamajig__bind__menu(), which is the parent recursive context of this call, due to recasting a sidebar with secondary navigation
						bizamajig__bind__actions__menu( target_menu_items, false ); // indirect recursive call

//
//						Setup doc items within doc_group accordion
//
//						bizamajig__set__workspace__action( true, process_desc, 'Edit Gallery', view_by_identifier, 'bizamajig-dataset', 'bizamajig-bind-new-bz-gallery-x', target_panel, '' );
//						bizamajig__set__workspace__action( true, process_desc, 'Edit Gallery Item', view_by_identifier, 'bizamajig-dataset', 'bizamajig-bind-new-bz-gallery-x-doc-update-web-section', target_panel, '' );
					});
				},
				error: function(xhr, ajaxOptions, thrownError) {
					if (bizamajig__config.bizamajig__debug === 'Y') {
						alert('readyState: ' + xhr.readyState + '\nstatus: ' + xhr.status);
						alert('responseText: ' + xhr.responseText);
						alert(thrownError);
					}
	   			}
			});
			return false;
		} // end if ( target_element === '#bizamajig-ui-menu-secondary-navigation' ) {
	} // end if ( doc_group_identifier === 'Public Store' ) {

} // end var bizamajig__recast__secondary_navigation = function( process_desc, lookup_type_desc, view_by_identifier, ui_init_template, target_panel, target_element, doc_group_identifier, primary_doc_group_id, category_doc_group_id, subcategory_doc_group_id, doc_id ) {

/*
********************************************************************************************************************************

Purpose:
	
	Generate a menu, like the primary navigation menu.

History:

	ver		date			notes																				name
	----------------------------------------------------------------------------------------------------------------------------
	1.1		06-27-2011		Converted from sothink.com.															jahlife

Parameters:

	target_element = 'bizamajig-ui-menu'
	
Testing:

********************************************************************************************************************************
*/
var bizamajig__bind__menu = function( target_element ) {

//
//	IE7 Temporary Bug Fix:
//
//	Here we will reverse the stacking order of z-index, to workaround IE7 bug.
//	We really want to solve the IE7 bug causing submenus to be invisible.
//	At this point, we have to get invasive to solve this problem.  Let's also
//	look at CSS-based solution, later.
//
//	This workaround is not working all the way around.
//
//	if ( bizamajig__config.browser === 'ie' ) {
//		var bizamajig__z_index_fix = 200000;
//		$('div').each( function() {
//			$(this).css('zIndex', bizamajig__z_index_fix );
//			bizamajig__z_index_fix -= 10;
//		});
//	}
	
//
//	Setup a default menu selector, for a vertical accordion menu
//
//	An instance of the accordion menu can also be found here:
//	$('ul#bizamajig-ui-menu-primary-navigation.accordion-menu');
//
	var target_menu_items = 'div.' + target_element + ' > ul.accordion-menu' // target_element = 'bizamajig-ui-menu'

//
//	Bind primary navigation menu based on tenent-user configuration.
//
//	switch( bizamajig__config.metadata__primary_nav__identifier__public_site ) {
//		case ( 'Primary Horizontal Center Secondary Submenu' || 'Primary Horizontal Center Secondary Horizontal Shopping Cart' || 'Primary Horizontal Content Area Secondary Submenu' || 'Primary Horizontal Header Left Secondary Submenu' || 'Primary Horizontal Header Left Secondary Vertical Left' || 'Primary Horizontal Center Top Secondary Submenu' || 'Primary Horizontal Center Secondary Vertical Left' || 'BIZAMAJIG' || 'BEETRIBE' || 'ROOTMIX' || 'TOURVENT' || 'FAIRVIEWMIX'  || 'GROWERSPLACE' ) :
	if ( bizamajig__config.metadata__primary_nav__identifier__public_site === 'Primary Horizontal Center Secondary Submenu' || bizamajig__config.metadata__primary_nav__identifier__public_site === 'Primary Horizontal Center Secondary Horizontal Shopping Cart' || bizamajig__config.metadata__primary_nav__identifier__public_site === 'Primary Horizontal Content Area Secondary Submenu' || bizamajig__config.metadata__primary_nav__identifier__public_site === 'Primary Horizontal Header Left Secondary Submenu' || bizamajig__config.metadata__primary_nav__identifier__public_site === 'Primary Horizontal Header Left Secondary Vertical Left' || bizamajig__config.metadata__primary_nav__identifier__public_site === 'Primary Horizontal Center Top Secondary Submenu' || bizamajig__config.metadata__primary_nav__identifier__public_site === 'Primary Horizontal Center Secondary Vertical Left' || bizamajig__config.metadata__primary_nav__identifier__public_site === 'Primary Vertical Left Secondary Horizontal Center' || bizamajig__config.metadata__primary_nav__identifier__public_site === 'BIZAMAJIG' || bizamajig__config.metadata__primary_nav__identifier__public_site === 'BEETRIBE' || bizamajig__config.metadata__primary_nav__identifier__public_site === 'ROOTMIX' || bizamajig__config.metadata__primary_nav__identifier__public_site === 'TOURVENT' || bizamajig__config.metadata__primary_nav__identifier__public_site === 'FAIRVIEWMIX'  || bizamajig__config.metadata__primary_nav__identifier__public_site === 'GROWERSPLACE' ) {

//
//		First if condition handles IE7 bug.
//		Else condition handles normal/default menu processing.
//
//		if ( $.browser.msie && $.browser.version < 8 ) {
//		}
//		else {
//			target_menu_items = 'ul#bizamajig-ui-menu-primary-navigation'; // target_element = 'ul#bizamajig-ui-menu-primary-navigation'
		if ( ( bizamajig__config.metadata__primary_nav__style_identifier_1 === 'superfish' ) && ( bizamajig__config.bizamajig_portal_owner_party_id !== '23027' ) ) {

			if ( bizamajig__config.metadata__primary_nav__identifier__public_site === 'Primary Vertical Left Secondary Horizontal Center' ) { // vertical menu flyout submenu, see dininginnovationsavl.com
				target_menu_items = 'div.' + target_element + ' > ul.sf-menu.sf-vertical'; // target_element = 'bizamajig-ui-menu'
			}
			else {
				target_menu_items = 'div.' + target_element + ' > ul.sf-menu'; // target_element = 'bizamajig-ui-menu'
			}
			$(target_menu_items).supersubs({
	            minWidth:    	12,			// minimum width of sub-menus in em units 
	            maxWidth:    	55,			// maximum width of sub-menus in em units 
	            extraWidth:  	10			// extra width can ensure lines don't sometimes turn over 
	                              			// due to slight rounding differences and font-family 
			}).superfish({
				hoverClass:		'sfHover',
				delay:			600,		// This will fire up the hoverIntent, also delays on mouseout
				animation:		{opacity:'.98',height:'show'},
				speed:			'slow',
				autoArrows:		false,
				dropShadows:	false,
				disableHI:		true
			});
//			}).supposition();

//			target_menu_items = 'div.' + target_element + ' > ul.accordion-menu';
//			bizamajig__bind__menu__vertical_accordion( target_menu_items, '10px' );
		}
		if ( ( bizamajig__config.metadata__primary_nav__style_identifier_1 === 'mega-menu' ) || ( bizamajig__config.bizamajig_portal_owner_party_id === '23027' ) ) {
//
//			In our case, the sql stored proc was called to generate a nested list with this class.
//
//			target_menu_items = 'div.' + target_element + ' > ul.mega-menu';
//			target_menu_items = 'div.' + target_element + ' > ul#bizamajig-ui-menu-primary-navigation';
			target_menu_items = 'ul#bizamajig-ui-menu-primary-navigation';
			bizamajig__bind__menu__mega_panel( target_menu_items, '' );
		}
//		}



//		$(target_menu_items).sftouchscreen();

//parseInt($('#bizamajig-gallery-slideshow').attr("data-width"))
//		$('.bizamajig-ui-menu').css( 'height', parseInt( bizamajig__config.metadata__primary_nav__frame_height_amount ) );
//		$('#bizamajig-ui-menu-primary-navigation').css( 'margin-top', parseInt( bizamajig__config.metadata__primary_nav__frame_offset_top ) ).css( 'margin-left', parseInt( bizamajig__config.metadata__primary_nav__frame_image_1_width)  );
//		$('.bizamajig-ui-menu').css('height',58);
//		$('#bizamajig-ui-menu-primary-navigation').css('margin-top',8).css('margin-left',373);


//
//		Support for Expand up vs. Expand down menus.
//
//		For Expand up, we are negating the height.
//
		if ( bizamajig__config.metadata__primary_nav__submenu_orientation === 'Expand up' ) {
			var thisHeight = 0;
			var item_height = 0;
//
//			FF might need to be managed, offset top adjustments, later.
//
//			HARDCODED: Sqeeze space for transparent submenus, like bodegagratia.com
//
			$('ul#bizamajig-ui-menu-primary-navigation li ul li a').each(function() {
			        $(this).css('padding-top', 0).css('padding-bottom', 2);
			});
//
//			Submenu Direction: expand up.
//			By summing height of all children li a items.
//
			$('div.bizamajig-ui-menu ul li ul').each(function() {
			        thisHeight = $(this).height();
			        $(this).css('top', -thisHeight-15);
			});
//			$('div.bizamajig-ui-menu ul li ul').each(function() {
//		        $(this).find('li a').css( 'height', item_height )
//		        $(this).css( 'top', -item_height );
//		    });
		}

//
//		Let's recursively target all nested li's, then we will bind click events to included anchor 'a' tags.
//
// 		Same as last selector, for documentation only.
//		Works for .sf-menu or .sf-menu.sf-vertical.
//		Might be more specific, or relevent for multiple instances.
//		target_menu_items = 'ul#bizamajig-ui-menu-primary-navigation li';
//		target_menu_items = 'ul.sf-menu.sf-vertical li';
//

//		BUG: Vertical Menu: Join the top menu items/li's to their children ul, to remove gap.  Find a way
//		to embed this in the CSS, later.
//
		if ( bizamajig__config.metadata__primary_nav__identifier__public_site === 'Primary Vertical Left Secondary Horizontal Center' ) {
			$('ul.sf-menu.sf-vertical li ul').css('margin-left', '-32px'); // HARDCODE: vertical menu flyout submenu, see dininginnovationsavl.com
			target_menu_items = 'ul.sf-menu.sf-vertical li';
		}
		else {
			target_menu_items = 'ul.sf-menu li';
		}

		if ( ( bizamajig__config.metadata__primary_nav__style_identifier_1 === 'mega-menu' ) || ( bizamajig__config.bizamajig_portal_owner_party_id === '23027' ) ) {
//
//			In our case, the sql stored proc was called to generate a nested list with this class.
//
//			target_menu_items = 'div.' + target_element + ' > ul.mega-menu';
//			target_menu_items = 'div.' + target_element + ' > ul#bizamajig-ui-menu-primary-navigation';
//			target_menu_items = 'ul#bizamajig-ui-menu-primary-navigation';
//			target_menu_items = 'ul.sf-menu li';
			target_menu_items = 'ul#bizamajig-ui-menu-primary-navigation li'; // the next function will append ' a' to selector to target all children anchors
		}


//		break;
	}

//		case 'Primary Horizontal Center Secondary Horizontal Shopping Cart':
//		case 'Primary Horizontal Content Area Secondary Submenu':
//		case 'Primary Horizontal Header Left Secondary Submenu':
//		case 'Primary Horizontal Header Left Secondary Vertical Left':
//		case 'Primary Horizontal Center Top Secondary Submenu':
//		case 'Primary Horizontal Center Secondary Vertical Left':
//		case 'BIZAMAJIG':
//		case 'BEETRIBE':
//		case 'ROOTMIX':
//		case 'TOURVENT':
//		case 'FAIRVIEWMIX':
//		case 'GROWERSPLACE':

	if ( bizamajig__config.metadata__primary_nav__identifier__public_site === 'Primary Vertical Left Content Footer' ) { // see bizcrafting.com
		if ( bizamajig__config.metadata__primary_nav__style_identifier_1 === 'superfish' ) {
			target_menu_items = 'div.' + target_element + ' > ul.accordion-menu';
			bizamajig__bind__menu__vertical_accordion( target_menu_items, '10px' );
		}
		if ( bizamajig__config.metadata__primary_nav__style_identifier_1 === 'mega-menu' ) {
		}
	}

	if ( bizamajig__config.metadata__primary_nav__identifier__public_site === 'Primary Vertical Right Secondary Horizontal Center' ) {
		if ( bizamajig__config.metadata__primary_nav__style_identifier_1 === 'superfish' ) {
			target_menu_items = 'div.' + target_element + ' > ul.accordion-menu';
			bizamajig__bind__menu__vertical_accordion( target_menu_items, '0px' );
		}
		if ( bizamajig__config.metadata__primary_nav__style_identifier_1 === 'mega-menu' ) {
		}
	}
		

//
//	Clickable: Header Logo Home Page
//
//	Bind div containing menu system click event to redirect to home page.
//
//	Chrome could not process our custom home-page-left element, so we currently target the
//	entire menu container, bizamajig-ui-menu.
//
//	$('div.bizamajig-ui-menu, div.bizamajig-ui-menu span.__home-page-left').click( function( event ) {
	$('div.bizamajig-ui-menu').click( function( event ) {
		document.location.href = bizamajig__config.metadata__url__tenant__public_home__http + ''; // just want strings
		return false;
	});

//
//	Add menu actions to render content.  This can include recasting css/scaffolding for the new content.
//
	bizamajig__bind__actions__menu( target_menu_items, true );

} // end var bizamajig__bind__menu = function( target_element ) {

	





/*
********************************************************************************************************************************
********************************************************************************************************************************

	START Content - Socialize

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************

	Purpose:
	
	Setup share button capability.  We generate and use our own tag, bizamajig-dub-socializer, to manage the button.

	Example Inputs:
	
	scope__parent_container: 	.doc_section__contentarea
	target_container:			bizamajig-dub-socializer
	
	scope__parent_container, target_container, target_content_permalink_url_01, target_content_title_01, target_content_message_01 
	
********************************************************************************************************************************
*/
var bizamajig__bind__sociable = function( p ) {
	var target_element = '<div id="' + p.target_container + '"></div>',
		container_exists = false,
		location = null;

	if ( ( p.target_content_title_01 === '' ) || ( typeof p.target_content_title_01 === 'undefined' ) ) {
		p.target_content_title_01 = bizamajig__config.bizamajig_portal_owner_enterprise_name;
	}

//
//	Target first target element, primary element that might be socialized here.
//
//	Target the first heading(after), or paragraph(before).
//	Target next, any first img(after), table(before), or ul(before).
//

//
//	Apply "Missing H1 Headding" Fix
//
//	If we don't have an h1, convert h2 to h1 and so on.
//
	location = $(p.scope__parent_container + ' > h1:first');
/*
	if ( !location.length ) {
	    $(p.scope__parent_container + ' h2').each(function(i, element) {
	       $(element).replaceWith('<h1>' + $(element).html() + '</h1>');
	    });
	    $(p.scope__parent_container + ' h3').each(function(i, element) {
	       $(element).replaceWith('<h2>' + $(element).html() +'</h2>');
	    });
	    $(p.scope__parent_container + ' h4').each(function(i, element) {
	       $(element).replaceWith('<h3>' + $(element).html() + '</h3>');
	    });
	    $(p.scope__parent_container + ' h5').each(function(i, element) {
	       $(element).replaceWith('<h4>' + $(element).html() + '</h4>');
	    });
	    $(p.scope__parent_container + ' h6').each(function(i, element) {
	       $(element).replaceWith('<h5>' + $(element).html() + '</h5>');
	    });
	}
*/

/*
**
**	Example: Parse content of a table td, sort of using the hr tag as a delimitter.
**
$('table tr td').each(function() {
	var firtHrSeen = false;
	var indexOfSecondHr = -1;
	var allChildren = $(this).contents();
	allChildren.each(function(index) {
		if ($(this).is('hr')) {
			if (firtHrSeen) {
				indexOfSecondHr = index;
				return false; // break out of each()
			} else {
				firtHrSeen = true;
			}
		}
	});

	if (indexOfSecondHr != -1) {
		var newTd = ($('<tr><td></td></tr>').insertAfter(this.parentNode))[0].firstChild;
		allChildren.slice(indexOfSecondHr - 1).each(function(index) {
			newTd.appendChild(this);
		});
	} else {
		// not found. something went wrong
	}
}); 
*/

//
//	Process the first H1 (after):
//
//	a) first H1 with .next() = 'hr'
//
//	This will do the job, but we need to 'track' existence, container_exists.
//	$('.doc_section__contentarea > h1:first').filter(function() { return !$(this).next().is('hr') }).next().after('here'); 
	$(p.scope__parent_container + ' > h1:first').each(function() {
		if ( $(this).next().is('hr') ) {
			$(this).next().after(target_element);
			container_exists = true;
		}
	}); 

//	Or
//
//	b) first H1 without .next() = 'hr'
//
	if (!container_exists) {
		location = $(p.scope__parent_container + ' > h1:first');
		if ( location.length ) {
			location.after(target_element);
			container_exists = true;
		}
	}

//
//	Process the first H2 (after):
//
	if (!container_exists) {
		location = $(p.scope__parent_container + ' > h2:first');
		if ( location.length ) {
			location.after(target_element);
			container_exists = true;
		}
	}

//
//	Process the first P (before):
//
	if (!container_exists) {
		location = $(p.scope__parent_container + ' > p:first');
		if ( location.length ) {
			location.before(target_element);
			container_exists = true;
		}
	}

//
//	Process the first IMG (after):
//
	if (!container_exists) {
		location = $(p.scope__parent_container + ' > img:first');
		if ( location.length ) {
			location.after(target_element);
			container_exists = true;
		}
	}

//
//	Process the first TABLE (before):
//
	if (!container_exists) {
//		location = $(p.scope__parent_container + ' > table:first');
		location = $(p.scope__parent_container + ' table:first');
		if ( location.length ) {
			location.before(target_element);
			container_exists = true;
		}
	}

//
//	Process the first UL (before):
//
	if (!container_exists) {
//		location = $(p.scope__parent_container + ' > ul:first');
		location = $(p.scope__parent_container + ' ul:first');
		if ( location.length ) {
			location.before(target_element);
			container_exists = true;
		}
	}

//
//	Process the first OBJECT (after):
//	Should be treated as IMG
//
	if (!container_exists) {
		location = $(p.scope__parent_container + ' > object:first');
		if ( location.length ) {
			location.after(target_element);
			container_exists = true;
		}
	}

	$('#' + p.target_container).css('cursor', 'pointer');

//	$(p.scope__parent_container + ' > h2:first').after('<div id="' + target_container + '"></div><br />');
	if (container_exists) {
		$('#' + p.target_container).bookmark(
			{
			url:			p.target_content_permalink_url_01,
			title:			p.target_content_title_01,
			description:	p.target_content_message_01,
			sites: 			['twitter', 'facebook', 'linkedin'],
			iconSize:		16
			}
		);
	}

//
//	JSSHARE PLUGIN: PRODUCTION VERSION
//
//	$(target_container).jsShare({ initialdisplay: 'expanded', maxwidth: 230, yoursiteurl: target_content_permalink_url_01 }).css('margin-bottom', 30); // had to use .css to markup jsShare after binding

	return false;
} // end var bizamajig__bind__sociable = function( p.scope__parent_container, target_container, target_content_permalink_url_01, target_content_title_01, target_content_message_01 ) {
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END Content - Socialize

********************************************************************************************************************************
********************************************************************************************************************************
*/






/*
********************************************************************************************************************************
********************************************************************************************************************************

	START Keepalive

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************

	Purpose:
	
********************************************************************************************************************************
*/
	var bizamajig__keepalive = function() {
		var counter = 0,
			ts = 0;
			

// Start a polling loop with a counter. 
		$.doTimeout( 60000, function(){
			ts = Math.round(Math.random()*1000000); // Anti-caching random number
			$.ajax({
				type: 'GET',
				async: true,
				cache: false,
				url: '/include/_bizamajig-keepalive.asp',
				data: { ts: ts },
				success: function( response ) {
//					$('#polling_loop1 span').html( ++counter );
					$('#bizamajig-ui-meta').attr('data-keepalive', ++counter );
					$('#bizamajig-ui-meta').html( response );
				},
				error: function(xhr, ajaxOptions, thrownError) {
					if (bizamajig__config.bizamajig__debug === 'Y') {
						alert('readyState: ' + xhr.readyState + '\nstatus: ' + xhr.status);
						alert('responseText: ' + xhr.responseText);
						alert(thrownError);
					}
		  		}
			});
			return true; // end poll
		});

	} // end var bizamajig__keepalive = function() {
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END Keepalive

********************************************************************************************************************************
********************************************************************************************************************************
*/

/*
********************************************************************************************************************************
********************************************************************************************************************************

	START Named Function - Bizamajig Cross Domain Receiver

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************

	Purpose:
	
		Bizamajig Cross Domain Receiver.  Load Facebook API and setup resizing listener for facebook iframed bizamajig
		content to minimize/remove scroll bars.

		Script, bizamajig-ui-cross-domain-receiver-api, adds this markup in addition to FB.init processing:
			<div id="fb-root"></div>

	Note:
	
		This function is also mirroring the script, bizamajig-ui-cross-domain-receiver-api.asp.
	
		
********************************************************************************************************************************
*/
	var bizamajig__bind__cross_domain_receiver__listeners = function() {

		window.fbAsyncInit = function() {
			FB.init({
//				appId      : 'YOUR_APP_ID', // App ID
				appId      : bizamajig__config.metadata__api__public_membership_sign_up__facebook,

//				channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File
				channelUrl : bizamajig__config.metadata__site__fqdn_default + '/channel.html', // Channel File

				status     : true, // check login status
				cookie     : true, // enable cookies to allow the server to access the session
				xfbml      : true  // parse XFBML
			});

// 			Additional initialization code here
			FB.Canvas.setAutoResize();
		};

//		Required JS.
//		var bizamajig__scripts__facebook = new Array( 1 );
//		bizamajig__scripts__facebook[0] = "//connect.facebook.net/en_US/all.js";
//		$BIZAMAJIG_RESOURCE
//		.script( bizamajig__scripts__facebook )
//		.wait(function(){
//			bizamajig__scripts__facebook__do_something();
//		});

//		Load the Facebook SDK Asynchronously
		(function(d){
			var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
			js = d.createElement('script'); js.id = id; js.async = true;
			js.src = "//connect.facebook.net/en_US/all.js";
			d.getElementsByTagName('head')[0].appendChild(js);
		}(document));

	} // end var bizamajig__bind__cross_domain_receiver__listeners = function() {

/*
********************************************************************************************************************************

	Purpose:
	
		Implement re-cast css ability in cross domain receiver context.

		Re-casting requires that we adjust both css and scaffolding.
		
		This routine handles the css part by reading bizamajig-ui meta data generated by
		ASP Request.ServerVariables("HTTP_REFERER").

		If we are in a re-cast or cross domain rendering situation, make a POST/GET to bizamajig-ia.asp
		with the source_domain, like 'facebook.com'.  The new css will be retrieved from the tenant
		system, and loaded into the head of the DOM by the function, bizamajig__recast__css.
		
		For example, if a bizamajig page is being rendered at facebook.com within an iframe,
		we simply want to re-cast css by adjusting width to 520px.

		Add more sources, later, like bizamajig-to-bizamajig tenant sites or endpoint services.
		
********************************************************************************************************************************
*/
	var bizamajig__bind__cross_domain_receiver = function() {
//		return false;
//
//		Tenant css can be reloaded to render page in different layouts based on user interactions.
//
		var bizamajig__scripts__tenant_css				= '//www.bizamajig.com/bizamajig-ia.asp',
//			bizamajig__scripts__tenant_markup			= '/include/_bizamajig-ui-layout-column-style.asp',
			bizamajig__scripts__tenant_css__parameters	= '',
			source_domain								= '',
			recast 										= false;

		if ( ( typeof bizamajig__config.bizamajig__request__http_referer === 'undefined' ) || ( bizamajig__config.bizamajig__request__http_referer === '' ) ) {
			return recast;
		}

//
//		if ( top === self ) {
//			//not in a frame
//		}
//		else {
//			//in a frame
//		}
//

//
//		facebook.com (only for now)
//
//		recast = bizamajig__config.bizamajig__request__http_referer.search('facebook');
//		if ( !recast ) {
//			return recast;
//		}

//
//		Validation: it must be loaded as the top page, or if it is loaded in an iframe
// 		then it must be embedded in my own domain.
//		Info: IF top.location.href is not accessible THEN it is embedded in an iframe
//		and the domains are different.
//
		recast = false;
		try {
			var top_href		= top.location.href,
				top_hostname	= top.location.hostname.toString(),
				this_href		= location.href;

			if ( ( top_href === this_href ) || ( top === self ) ) {
				recast = false;
			}
			else {
//				if ( top_hostname !== "www.yourdomain.com" ) {
					recast = true;
//				}
			}
		}
		catch ( error ) {
//			error is a permission error that top.location.href is not accessible (which means parent domain <> iframe domain)
			recast = true;
		} 

		if ( recast ) {
			source_domain = 'facebook.com';
			bizamajig__scripts__tenant_css__parameters = '?bizamajig__request__http_referer=' + source_domain + '&bizamajig_site_layout_column_style=Fixed-Content'; // Hardcoded, until we change bizamajig meta stored proc to auto-resize proportionally, like sidebars.
			bizamajig__recast__css( recast, bizamajig__scripts__tenant_css + bizamajig__scripts__tenant_css__parameters );
			bizamajig__bind__cross_domain_receiver__listeners();
		}
	} // end var bizamajig__bind__cross_domain_receiver = function() {

/*
********************************************************************************************************************************
********************************************************************************************************************************

	END Named Function - Cross Domain Content Rendering

********************************************************************************************************************************
********************************************************************************************************************************
*/





/*
********************************************************************************************************************************
********************************************************************************************************************************

	START Content - FULLSCREEN Adjustments

********************************************************************************************************************************
********************************************************************************************************************************
*/
function bizamajig__bind__container_adjustments( target_container ) {
	if (bizamajig__config.bizamajig__debug === 'Y') {
		alert('ONCLICK: bizamajig__bind__container_adjustments');
	}

	if ( bizamajig__config.bizamajig_portal_owner_party_id != '22775' ) {
		return false;
	}
//
//	Find the web page background image, and set height of container to match image height.
//	So far, use for fullscreen designs.
//
	var div_with_background = $('.' + target_container); // "div[class='doc_section__container']" is included by web pages
	if ( ( target_container === 'doc_section__container' ) && ( div_with_background.length ) ) {
		var height = 0;
		$('.' + target_container).getBgImage( function() {
			height = $(this).height();
			if ( height != '0' ) {
				$('.' + target_container).css('height', height);
			}
		}); 
	}

//
//		Process form background images.
//
	if ( ( target_container === 'bizamajig-ui-wrap' ) && ( div_with_background.length ) ) {
		var height = 0;
		$('.' + target_container).getBgImage( function() {
			width = $(this).width();
			height = $(this).height();
			if ( ( width != '0' ) && ( height != '0' ) ) {
				$('.' + target_container).css('width', width).css('height', height).css('display', 'block').css('opacity', .8);
			}
		}); 
	}

} // end function bizamajig__bind__container_adjustments( target_container ) {
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END Content - FULLSCREEN Adjustments

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START Content - Track Clicks

********************************************************************************************************************************
********************************************************************************************************************************
*/
function bizamajig__page_tracker( bizamajig_portal_owner_party_id, source_doc_group_id, source_doc_id, source_context_usage_url, source_doc_group_title_1, source_doc_title_1, target_doc_group_id, target_doc_id, target_href, target_doc_group_title_1, target_doc_title_1 ) {

	if (bizamajig__config.bizamajig__debug === 'Y') {
		alert('ONCLICK: bizamajig__page_tracker');
	}

	$.ajax({
		type: 'GET', // until we switch to post, for now use setDocSection.
		url: 'bizamajig-global-context-usage-public-article-categories.asp',
		data: { primary_doc_group_id: source_doc_group_id, doc_id: source_doc_id, context_usage_url: source_context_usage_url }
	});

    return false;

} // end function bizamajig__page_tracker( bizamajig_portal_owner_party_id, source_doc_group_id, source_doc_id, source_context_usage_url, source_doc_group_title_1, source_doc_title_1, target_doc_group_id, target_doc_id, target_href, target_doc_group_title_1, target_doc_title_1 ) {

function bizamajig__bind__track_click( target_container ) {
	if (bizamajig__config.bizamajig__debug === 'Y') {
		alert('ONCLICK: bizamajig__bind__track_click');
	}

	var href = '';
	var title = '';

	$('#' + target_container + ' a').click(function() {
//	    $(this).attr('onclick', 'bizamajig__page_tracker(this.href); return false;');
		href = $(this).attr('href');
		title = $(this).attr('title');
		if ( ( typeof href != 'undefined' ) && ( href != '' ) && ( href != '#' ) && ( typeof bizamajig__config.primary_doc_group_id != 'undefined' ) && ( bizamajig__config.primary_doc_group_id != '' ) ) {
			bizamajig__page_tracker( bizamajig__config.bizamajig_portal_owner_party_id, bizamajig__config.primary_doc_group_id, bizamajig__config.doc_id, '', '', '', '', '', href, title, '', '' );
		}
	});

} // end function bizamajig__bind__track_click( target_container ) {
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END Content - Track Clicks

********************************************************************************************************************************
********************************************************************************************************************************
*/






/*
********************************************************************************************************************************

Purpose:
	
	Provide an automcomplete capability for the specifid input_element, by polling (GET) the source_url for results.
	
	Autocomplete appends a new parameter &term, automatically.

	Example inputs are:
	
	target_container	= #view_by_identifier_1__cm_workspace
	source_url			= /include/_ap_search__simple.asp

History:

	ver		date			notes																				name
	----------------------------------------------------------------------------------------------------------------------------
	1.1		06-27-2011		Updated to include search_option. 													billy

Testing:

********************************************************************************************************************************
*/
var bizamajig__color__levels = function( hex, lum ) {

//	Validate hex string   
//	hex = hex.replace( /#/g, "" ); // remove all instances of search string (using g global flag)
	hex = String(hex).replace( /#/g, "" ); // remove all instances of search string (using g global flag)
	hex = String(hex).replace(/[^0-9a-f]/gi, '');   
	if (hex.length < 6) {   
		hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2];   
	}   
	lum = lum || 0;   

//	Convert to decimal and change luminosity   
	var rgb = "#", c, i;   
	for (i = 0; i < 3; i++) {   
		c = parseInt(hex.substr(i*2,2), 16);   
		c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16);   
		rgb += ("00"+c).substr(c.length);   
	}
	return rgb;
}   





/*
********************************************************************************************************************************
********************************************************************************************************************************

	START BIZAMAJIG JAVASCRIPT PUSH

********************************************************************************************************************************
********************************************************************************************************************************
*/
	var bizamajig__bind__bizamajig_resources = function( scope ) { // this/scope is not currently in use, and remains for future reference

		if ( bizamajig__config.bizamajig_private_authentication_active_ind === 'Y' ) { // init Forum Listview, Document Repository, Party Directory
//
//			Fetch Ahead Javascript for Bizamajig Site Apps
//

			var bizamajig__scripts__site_apps = new Array( 3 );  // Or, var bizamajig__scripts__site_apps = [];
			bizamajig__scripts__site_apps[0] = "//www.bizamajig.com/include/jquery/js/jquery.uploadify.v2.1.4.js";
			bizamajig__scripts__site_apps[1] = "//www.bizamajig.com/include/bizamajig-ui-site-apps.js";
			bizamajig__scripts__site_apps[2] = "//www.bizamajig.com/include/bizamajig-ui-common-uploadify.js"; // dependency: bizamajig-ui-site-apps.js
			$BIZAMAJIG_RESOURCE
			.script( bizamajig__scripts__site_apps );
//			.wait(function(){ // Init routine here: we want to wait here so pages don't try to fire js that is not yet loaded.
//				return false; // But this might be throwing a GET "/" in IE9, causing authentication errors, test later.
//			});
		}
	}

	var bizamajig__provision__ui_colorpicker = function( scope ) { // this/scope is not currently in use, and remains for future reference

		var bizamajig__scripts__colorpicker = new Array( 1 );  // Or, var bizamajig__scripts__colorpicker = [];
		bizamajig__scripts__colorpicker[0] = "//www.bizamajig.com/include/jquery/js/farbtastic.js";
		$BIZAMAJIG_RESOURCE
		.script( bizamajig__scripts__colorpicker )
		.wait(function(){ // Init routine here: we want to wait here so pages don't try to fire js that is not yet loaded.
			bizamajig__bind__farbtastic__instance();
			return false;
		});
	}
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END BIZAMAJIG JAVASCRIPT PUSH

********************************************************************************************************************************
********************************************************************************************************************************
*/






/*
********************************************************************************************************************************
********************************************************************************************************************************

	START WORKSPACE LAYOUT CONTROLLER

********************************************************************************************************************************
********************************************************************************************************************************
*/
var bizamajig__set__workspace__selection_parameters = function( input_primary_doc_group_id, input_process_desc, input_lookup_type_desc, input_view_by_identifier, input_column_desc, input_column_value, input_compare_value_1, input_url_1, input_value_2, input_querystring ) {

	var a_href_01 = '',
		redirect = false;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	EVENTS
//
//		If the status is 'Reviewing', chg_rqst.action_type_id, load specified page.
//
//			ec-project-review-x.asp?primary_doc_group_id=&process_desc=Events&lookup_type_desc=&view_by_identifier=&project_id=
//
//		If the status is NOT 'Reviewing', chg_rqst.action_type_id, load specified page.
//
//			ec-project-x.asp?primary_doc_group_id=&process_desc=Events&lookup_type_desc=&view_by_identifier=&project_id=
//
//	Example Call:
//
//		bizamajig__set__workspace__selection_parameters( '', 'Events', '', '', 'action_type_id', rowset.action_type_id, 'Reviewing', 'ec-project-review-x.asp', 'ec-project-x.asp', '?primary_doc_group_id=&process_desc=Events&lookup_type_desc=&view_by_identifier=&project_id=' + rowset.project_id );
//
//
	if ( ( input_process_desc === 'Events' ) && ( input_column_desc === 'action_type_id' ) ) {
		if ( input_column_value === input_compare_value_1 ) {
			a_href_01 = input_url_1 + input_querystring;
		}
		else {
 			a_href_01 = input_url_2 + input_querystring; 
		}
		redirect = true;
	}

	if ( ( redirect ) && ( typeof a_href_01 != 'undefined' ) ) {
//		window.location = target_url;
		document.location.href = a_href_01;
		return false;
	}

}
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END WORKSPACE LAYOUT CONTROLLER

********************************************************************************************************************************
********************************************************************************************************************************
*/





/*
********************************************************************************************************************************
********************************************************************************************************************************

	START DATA GRID

********************************************************************************************************************************
********************************************************************************************************************************
*/
var bizamajig__bind__datagrid__instance = function( request__context, input_target_element ) { // like 'Events', etc.

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	Target Selector
//
//	Start using input parameter, input_target_element.
//
	var $target_element = $('#bizamajig-ui-datagrid');

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	Read Instance Data
//
	var primary_doc_group_id = $target_element.attr('data-primary_doc_group_id'),
		process_desc = $target_element.attr('data-process_desc'),
		lookup_type_desc = $target_element.attr('data-lookup_type_desc'),
		view_by_identifier = $target_element.attr('data-view_by_identifier');

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	Display requested datagrid
//
	switch( process_desc ) {
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	process_desc: Sales Orders
//
	case 'Sales Orders':
		switch( lookup_type_desc ) {
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//		lookup_type_desc: All Sales Orders
//
		case 'All Sales Orders':
			$target_element.flexigrid({
				title: "Sales Order List",
				url: 'include/_ap-search-simple-grid.asp',
				dataType: 'json',
				blockOpacity: 0.2,
				navbarOnTop: true,
				floatingSearch: true,
				showToggleBtn: true,
//				buttons : [
//					{name: 'Add', bclass: 'add', onpress : test},
//					{name: 'Delete', bclass: 'delete', onpress : test},
//					{separator: true}
//					],
				sortname: "created_date",
				sortorder: "DESC",
				usepager: true,
				useRp: true,
				rp: 1000,
				rpOptions: [1000],
//				rpOptions: [5, 10, 15, 20, 25, 30, 35, 40, 45, 50],
//				showTableToggleBtn: true,
//				width: 700,
//				height: 'auto',
//				height: 700,
				minwidth: 75,

				colModel: [{
				        display: "Order#",
				        name: "doc_tran_id",
				        width: 45,
				        sortable: true,
				        align: "left",
				        hide: false,
				        onclick: "MM_goToURL('parent','dg-soe-x-billing.asp?process_desc=Sales Orders&lookup_type_desc=All Sales Orders&view_by_identifier=&doc_tran_id={0}&enterprise_id={9}&location_id={10}&person_id={11}');"
					},
					{
				        display: "Customer",
				        name: "bill_to_person_preferred_name",
				        width: 90,
				        sortable: true,
				        align: "left",
				        hide: false,
				        onclick: "MM_goToURL('parent','dg-soe-x-billing.asp?process_desc=Sales Orders&lookup_type_desc=All Sales Orders&view_by_identifier=&doc_tran_id={0}&enterprise_id={9}&location_id={10}&person_id={11}');"
					},
					{
				        display: "Destination",
				        name: "ship_to_location_desc",
				        width: 90,
				        sortable: true,
				        align: "left",
				        hide: false,
				        onclick: "MM_goToURL('parent','dg-soe-x-billing.asp?process_desc=Sales Orders&lookup_type_desc=All Sales Orders&view_by_identifier=&doc_tran_id={0}&enterprise_id={9}&location_id={10}&person_id={11}');"
					},
					{
				        display: "Payment Status",
				        name: "doc_status_id",
				        width: 70,
				        sortable: true,
				        align: "left",
				        hide: false,
				        onclick: "MM_goToURL('parent','dg-soe-x-billing.asp?process_desc=Sales Orders&lookup_type_desc=All Sales Orders&view_by_identifier=&doc_tran_id={0}&enterprise_id={9}&location_id={10}&person_id={11}');"
					},
					{
				        display: "Amount",
				        name: "grand_total_amount",
				        width: 45,
				        sortable: true,
				        align: "right",
				        hide: false,
				        onclick: "MM_goToURL('parent','dg-soe-x-billing.asp?process_desc=Sales Orders&lookup_type_desc=All Sales Orders&view_by_identifier=&doc_tran_id={0}&enterprise_id={9}&location_id={10}&person_id={11}');"
					},
					{
				        display: "Entered",
				        name: "created_date__101",
				        width: 75,
				        sortable: true,
				        align: "left",
				        hide: false,
				        onclick: "MM_goToURL('parent','dg-soe-x-billing.asp?process_desc=Sales Orders&lookup_type_desc=All Sales Orders&view_by_identifier=&doc_tran_id={0}&enterprise_id={9}&location_id={10}&person_id={11}');"
					},
					{
				        display: "Stage",
				        name: "icon1_opportunity_status_desc",
				        width: 70,
				        sortable: true,
				        align: "left",
				        hide: false,
				        onclick: "MM_goToURL('parent','dg-soe-x-billing.asp?process_desc=Sales Orders&lookup_type_desc=All Sales Orders&view_by_identifier=&doc_tran_id={0}&enterprise_id={9}&location_id={10}&person_id={11}');"
					},
					{
				        display: "Changed on",
				        name: "status_change_date__101",
				        width: 75,
				        sortable: true,
				        align: "left",
				        hide: false,
				        onclick: "MM_goToURL('parent','dg-soe-x-billing.asp?process_desc=Sales Orders&lookup_type_desc=All Sales Orders&view_by_identifier=&doc_tran_id={0}&enterprise_id={9}&location_id={10}&person_id={11}');"
					},
					{
				        display: "Deliver by",
				        name: "doc_tran_target_delivery_receipt_date",
				        width: 75,
				        sortable: true,
				        align: "left",
				        hide: false,
				        onclick: "MM_goToURL('parent','dg-soe-x-billing.asp?process_desc=Sales Orders&lookup_type_desc=All Sales Orders&view_by_identifier=&doc_tran_id={0}&enterprise_id={9}&location_id={10}&person_id={11}');"
					},
					{
				        display: "bill to enterprise id",
				        name: "bill_to_enterprise_id",
				        width: 100,
				        sortable: true,
				        align: "left",
				        hide: true
					},
					{
				        display: "bill to location id",
				        name: "bill_to_location_id",
				        width: 100,
				        sortable: true,
				        align: "left",
				        hide: true
					},
					{
				        display: "bill to person id",
				        name: "bill_to_person_id",
				        width: 100,
				        sortable: true,
				        align: "left",
				        hide: true
				}],
				searchitems: [{
				        display: "Order#",
				        name: "doc_tran_id",
				        isdefault: true
					},
					{
				        display: "Customer",
				        name: "bill_to_person_preferred_name"
					},
					{
				        display: "Payment Status",
				        name: "doc_status_id"
					},
					{
				        display: "Amount",
				        name: "grand_total_amount"
					},
					{
				        display: "Stage",
				        name: "icon1_opportunity_status_desc"
				}]
			});
			return false;
		}; // switch( lookup_type_desc ) {

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	process_desc: Events
//
	case 'Events':
		switch( lookup_type_desc ) {
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//		lookup_type_desc: All Events
//
		case 'All Events':
			$target_element.jqGrid({
				url: 'include/_ap-search-simple-grid.asp?primary_doc_group_id=&process_desc=Events&lookup_type_desc=All Events&view_by_identifier=&project_id=-1&_ts=' + new Date().getTime(),
//				imgpath: '/Content/images/',
//				type: 			'POST',
				datatype: 		'json', 
				jsonReader: {
					root: "dataset.rows",
					repeatitems: false
				},

                onSelectRow: function(id){
//                  alert('Selected row ID ' + id);
					var selected_row = $target_element.jqGrid('getGridParam','selrow');
					var rowset = $target_element.jqGrid('getRowData',selected_row);
//					alert(id + ' / ' + rowset.action_type_id);
						bizamajig__set__workspace__selection_parameters( '', 'Events', '', '', 'action_type_id', rowset.action_type_id, 'Reviewing', 'ec-project-review-x.asp', 'ec-project-x.asp', '?primary_doc_group_id=&process_desc=Events&lookup_type_desc=&view_by_identifier=&project_id=' + rowset.project_id );
//					return false;
//                     if (id == null) {
//                         id = 0;
//                         if ($("#SubGrid").getRecords() > 0) {
//                             $("#SubGrid").setGridParam({ url: "subdata.aspx/GetDataTable?id=" + id, page: 1 }).trigger('reloadGrid');
//                         }
//                     } else {
//                         $("#SubGrid").setGridParam({ url: "subdata.aspx/GetDataTable?id=" + id, page: 1 }).trigger('reloadGrid');
//                     }
                 },

//				datastr: 		GetJSON(), 
//				datatype: 		'jsonstring',   

				autoencode:		true,
				autowidth:		true,
//				gridview: 		true, // If set to true we can not use treeGrid, subGrid, or afterInsertRow event.
				scrollOffset: 	0,

				width: '100%',
				height: '100%',
						
				rowNum: 		9999999, 
				multiselect:	false, 

//				postdata:		// associative array

				sortname: 		'project_id', 
				sortorder: 		'asc', 
//              subGrid: 		false, 
//              loadonce: 		false, 
                caption: 		'<div style="width:auto;height:20px;">Event Listing</div>',

				colNames: ['Event #', 'Name', 'Location', 'Start Date', 'End Date', 'Start Time', 'End Time', 'Status'],

//				colModel array describes the model of the column.
//				name is the name of the column,
//				index is the name passed to the server to sort data
//				note that we can pass here nubers too.
//				width is the width of the column
//				align is the align of the column (default is left)
//				sortable defines if this column can be sorted (default true)
				colModel: [
//				{
//					name:			'providerUserId',
//					index:			'providerUserId',
//					width:			100,
//					editable:		true,
//					editrules:		{
//						required:	true,
//						edithidden:	true
//					},
//					hidden:			true,
//					editoptions:	{ dataInit: function(element) { $(element).attr("readonly", "readonly"); } }
//				},
				{
					name: 			'project_id',
					index: 			'project_id',
					jsonmap:		'@attributes.project_id',
					width: 			50,
					align: 			'left',
			        sorttype: 		'int',
					hidden:			false,
					sortable: 		false
				},
				{
					name: 			'project_name',
					index: 			'project_name',
					jsonmap:		'@attributes.project_name',
					width: 			180,
					align: 			'left',
			        sorttype: 		'text',
					hidden:			false,
					sortable: 		false
				},
				{
					name: 			'location_desc',
					index: 			'location_desc',
					jsonmap:		'@attributes.location_desc',
					width: 			100,
					align: 			'left',
			        sorttype: 		'text',
					hidden:			false,
					sortable: 		false
				},
				{
					name: 			'begin_date',
					index: 			'begin_date',
					jsonmap:		'@attributes.begin_date',
					width: 			75,
					align: 			'right',
			        sorttype: 		'date',
					hidden:			false,
					sortable: 		false
				},
				{ 
					name: 			'target_decision_date',
					index: 			'target_decision_date',
					jsonmap:		'@attributes.target_decision_date',
					width: 			75,
					align: 			'right',
			        sorttype: 		'date',
					hidden:			false,
					sortable: 		false
				},
				{ 
					name: 			'event_start_date__time',
					index: 			'event_start_date__time',
					jsonmap:		'@attributes.event_start_date__time',
					width: 			75,
					align: 			'right',
			        sorttype: 		'text',
					hidden:			false,
					sortable: 		false
				},
				{ 
					name: 			'event_end_date__time',
					index: 			'event_end_date__time',
					jsonmap:		'@attributes.event_end_date__time',
					width: 			75,
					align: 			'right',
			        sorttype: 		'text',
					hidden:			false,
					sortable: 		false
				},
				{ 
					name: 			'action_type_id',
					index: 			'action_type_id',
					jsonmap:		'@attributes.action_type_id',
					width: 			75,
					align: 			'right',
			        sorttype: 		'text',
					hidden:			false,
					sortable: 		false
				}]
//                gridComplete: function () {  
//                    var ids = $("#PrimaryGrid").getDataIDs();  
//                    for (var i = 0; i < ids.length; i++) { 
//                        if($("#PrimaryGrid").getRowData(i).subg == "false"){ 
//                            $('tr#'+i, $("#PrimaryGrid")) 
//                            .children("td.sgcollapsed") 
//                            .html("") 
//                            .removeClass('ui-sgcollapsed sgcollapsed'); 
//                        } 
//                    } 
//                }, 
            });
			//.navGrid('#bizamajig-ui-datagrid-pager', { search: true, edit: false, add: false, del: false } );

//			.hideCol('StoreId').setGridWidth(700)


//
//			Manage loading process.
//
//			var grid_id = "list"; // jQuery("#list")[0].id;
//			var hideLoading = function () {
//			    jQuery("#lui_"+grid_id).hide();
//			    jQuery("#load_"+grid_id).hide();
//			}
//			$("#list").jqGrid({
//			    // all current options
//			    loadComplete: function() {
//			        hideLoading();
//			    },
//			    loadError: function() {
//			        hideLoading();
//			    }
//			});

			return false;

		}; // switch( lookup_type_desc ) {

/*
********************************************************************************************************************************
********************************************************************************************************************************
	process_desc: Sales Orders
********************************************************************************************************************************
********************************************************************************************************************************
*/
	case 'Sales Orders':
	default:
		return false;
	}; // switch( process_desc ) {

}
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END DATA GRID

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START UI COLORPICKER - FARBTASTIC

********************************************************************************************************************************
********************************************************************************************************************************
*/

var bizamajig__bind__ui__colorpicker = function(){

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	COLORPICKER DETECT & SETUP
//
//	BUG FIX: IE7
//
//	We have stubbed this function as a workaround for IE7 bug.  When no farbtastic elements present, IE7 bugs out.
//	If needed, we will dynamically load farbtastic.  FARBTASTIC plugin and BIZAMAJIG bindings are included by file,
//	include/jquery/js/farbtastic.js.
//

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//
//	EXAMPLES
//
//$('#colorpicker').farbtastic(function(color) {
//	$("#color, #Text1").css("color", color);
//	$("#color").val(color);
//});

//var picker = $.farbtastic('#bizamajig-ui-colorpicker');  //picker variable
//picker.setColor("#b6b6ff"); //set initial color
//picker.linkTo(onColorChange); //link to callback
//function onColorChange(color) {
//  dosomeStuff();
//}


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	Setup Colorpicker for APP FORMS - BRANDING
//
//	Locate first input colorpicker field, and add (after with float right, might need to alter) a placeholder div.
//	Then we embed the colorpicker, in this case, farbtastic.
//
//	IMPORTANT! no space using :first below
//	$('input.bizamajig-input-colorpicker:first').after('<div id="bizamajig-ui-colorpicker" style="float: right;"></div>');

//
//	Target selectors on app forms using bizamajig-input-colorpicker.
//
	var bizamajig_colorpicker = null;
	$bizamajig_colorpicker = $('input.bizamajig-input-colorpicker:first');

	if ( $bizamajig_colorpicker.length ) {
		bizamajig__provision__ui_colorpicker();
	}
	return false;
}

/*
********************************************************************************************************************************
********************************************************************************************************************************

	END UI COLORPICKER - FARBTASTIC

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START UI DATA UPDATE EVENT

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************

	Purpsoe:

		Setup Data Update Events for APP FORMS - BRANDING / CMS.

		Our forms element that the user can edit without submitting the entire form, column/field-level edits.  This
		routine will support the enabled CRUD actions for input elements against the database, and relect form changes
		such as deleting an image.

		To get started, we discover the elements of interest by class="bizamajig-ui-element-action", and add a placeholder
		container next to the element (e.g. an IMG tag) and then add an appropriate CREATE / UPDATE / DELETE action.
		
		If the user clicks the action button, we execute the script that will service all requests by updating
		the database as needed.  We are passing inputs like the relation or table name, doc_group, the action, delete,
		and a physical column_name like doc_url_image_1.

		After the database has been updated, we reflect the change, such as replacing an image.  At this point, we are
		primarily using this routine to add Delete Buttons for all images that can be deleted by forms.
	
	IMPORTANT!
	
		This routine ASSUMES that column_names are always UNIQUE.  This is required as we are dynamically adding
		placeholder containers, and they are marked by class_name-column_name.
		
	Passing Inputs To Database:

		@input_system_id			int					= -1,
		@input_application_id		int					= -1,
		@input_password_id			int					= -1,

		@input_doc_group_id			int					= -1,
		@input_doc_id				int					= -1,
		@input_person_id			int					= -1,

		@input_action				varchar( 255 )		= '_ delete'
		@input_relation				varchar( 255 )		= '_ doc_group',
		@input_key_1				varchar( 255 )		= '123',
		@input_key_2				varchar( 255 )		= '345',
		@input_key_3				varchar( 255 )		= '567',
		@input_column_name			varchar( 255 )		= '_ doc_group_url_image_1',
		@input_current_value		varchar( 1024 )		= '',
		@input_new_value			varchar( 1024 )		= '/resources/sitelevel/spacer.gif'

	Relation.DOC_GROUP Columns:

		doc_group_url_background_image
		doc_group_url_background_image_article
		doc_group_url_topic_image
		doc_group_url_topic_image_hover
		doc_group_url_image_1
		doc_group_url_image_2
		doc_group_url_image_3
		doc_group_url_image_4
		doc_group_url_image_5

	Relation.DOC_GROUP Columns:

		doc_url_background_image
		doc_url_topic_image
		doc_url_image_1
		doc_url_image_2
		doc_url_image_3
		doc_url_image_4
		doc_url_image_5
	
	Example Markup:
	
		Add something like this to input fields, note we are pre-sanitizing data-display value as needed for displaying media elements on the form.
		
		class="bizamajig-ui-element-action" data-action="delete" data-relation="doc_group" data-key-1="<%=(sel_doc_group.Fields.Item("doc_group_id").Value)%>" data-key-2="" data-key-3="" data-value="/resources/sitelevel/spacer.gif" data-display="<%= emit_output( (sel_doc_group.Fields.Item("doc_group_url_topic_image").Value) ) %>" data-element-type="img"
		
	Markup Input:

		<fieldset>
			<div class="field">
				<input type="file" name="doc_group_url_topic_image" id="doc_group_url_topic_image" class="bizamajig-ui-element-action" data-action="delete" data-relation="doc_group" data-key-1="<%=(sel_doc_group.Fields.Item("doc_group_id").Value)%>" data-key-2="" data-key-3="" data-value="/resources/sitelevel/spacer.gif" data-display="<%= emit_output( (sel_doc_group.Fields.Item("doc_group_url_topic_image").Value) ) %>" data-element-type="img" onchange="<%=pau.validateCode()%>;return document.MM_returnValue;" size="20" maxlength="255" />
			</div>
		</fieldset>
		
	Markup Output:

		<fieldset>
			<div class="field">
				<input type="file" name="doc_group_url_topic_image" id="doc_group_url_topic_image" class="bizamajig-ui-element-action" data-action="delete" data-relation="doc_group" data-key-1="<%=(sel_doc_group.Fields.Item("doc_group_id").Value)%>" data-key-2="" data-key-3="" data-value="/resources/sitelevel/spacer.gif" data-display="<%= emit_output( (sel_doc_group.Fields.Item("doc_group_url_topic_image").Value) ) %>" data-element-type="img" onchange="<%=pau.validateCode()%>;return document.MM_returnValue;" size="20" maxlength="255" />

//
//				Example of dynamically added placeholder container for displaying media + controls:
//
				<span class="bizamajig-ui-element-action" id="doc_group_url_topic_image-display">
					<img id="' + this_column_name + '-element" class="bizamajig-ui-element-action-display" data-element-type="img" data-action="delete" src="IMAGE.PNG" />
                	<img id="bizamajig-ui-crud-button-' + 'doc_group_url_topic_image' + '" class="bizamajig-ui-icon" src="/resources/bizamajig/icons/icon-dark-166-24.png" title="Delete this media" alt="" />
                    <a id="bizamajig-ui-crud-link-' + 'doc_group_url_topic_image' + '" href="#">
                    	Delete
					</a>
				</span>

			</div>
		</fieldset>
		

********************************************************************************************************************************
*/
var bizamajig__bind__ui__element_manager = function(){
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	DATA UPDATE EVENT DETECT & SETUP
//
//	Setup Data Update Events for APP FORMS - BRANDING / CMS

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	Add placeholder div and Delete Buttons for all images that can be deleted by forms.
//	Then we wire up the database update script that will service data update requests.
//
//	Target selector on app forms like <img id="column_name" class="bizamajig-ui-element-action" data-action="delete" data-relation="doc_group" data-key-1="123" data-key-2="345" data-key-3="567" data-element-type="img" src="IMAGE.PNG" />.
//
	var bizamajig_element_manager = null;
	bizamajig_element_manager = $('div.bizamajig-ui-element-action, input.bizamajig-ui-element-action');

	if ( bizamajig_element_manager.length ) {

		var	this_action				= '',
			this_relation			= '',
			this_key_1				= '',
			this_key_2				= '',
			this_key_3				= '',
			this_column_name		= '',
			this_display			= '',
			this_element_type		= '';

		bizamajig_element_manager.each(function() {
//
//			Process meta for this element.
//
			this_action				= $(this).attr('data-action');
			this_relation			= $(this).attr('data-relation');
			this_key_1				= $(this).attr('data-key-1');
			this_key_2				= $(this).attr('data-key-2');
			this_key_3				= $(this).attr('data-key-3');
			this_column_name		= $(this).attr('id');
			this_display			= $(this).attr('data-display');
			this_element_type		= $(this).attr('data-element-type');
//
//			Process input options.
//
			if ( ( typeof this_action === 'undefined' ) || ( this_action === '' ) ) {
				this_action = '';
			}
			if ( ( typeof this_relation === 'undefined' ) || ( this_relation === '' ) ) {
				this_relation = '';
			}
			if ( ( typeof this_key_1 === 'undefined' ) || ( this_key_1 === '' ) ) {
				this_key_1 = '';
			}
			if ( ( typeof this_key_2 === 'undefined' ) || ( this_key_2 === '' ) ) {
				this_key_2 = '';
			}
			if ( ( typeof this_key_3 === 'undefined' ) || ( this_key_3 === '' ) ) {
				this_key_3 = '';
			}
			if ( ( typeof this_column_name === 'undefined' ) || ( this_column_name === '' ) ) {
				this_column_name = '';
			}
			if ( ( typeof this_display === 'undefined' ) || ( this_display === '' ) ) {
				this_display = '';
			}
			if ( ( typeof this_element_type === 'undefined' ) || ( this_element_type === '' ) ) {
				this_element_type = '';
			}
//
// 			We want to check if existing element of interest is a non-value, like spacer.gif, and avoid processing.
//
			var rgxp1 = new RegExp('spacer', 'g');
	        if ( this_display.match(rgxp1) ) {
				return false;
	        }
//
//			PROCESS FILEUPLOAD IMAGE MANAGER
//
			if ( ( this_action === 'create|update|delete|crop' ) && ( this_element_type === 'img' ) ) {
//
//				Add placeholder container to display an element with a cruD control.
//
//				For now, we have removed this text link.
//				<a id="bizamajig-ui-crud-link-' + this_column_name + '" href="#">\
//					Delete\
//				</a>\
//
//				$(this).css('float', 'left').after('<br />\
				$(this).after('<br />\
				<span class="bizamajig-ui-element-action" id="' + this_column_name + '-display">\
					<div class="left">\
						<div id="preview_container" class="preview_container">\
							<input type="file" name="uploadify" id="uploadify" style="display:none;"/>\
							<a id="overlay" class="preview_overlay" style="display:none;"></a>\
							<img id="preview" src="' + this_display + '" />\
							<img id="' + this_column_name + '-element" class="bizamajig-ui-element-action-display" data-element-type="img" data-action="delete" src="' + this_display + '" />\
						</div>\
						<ul id="options" class="imgmenu">\
								<li id="rotate" class="rotate _change"></li>\
								<li id="bw" class="bw _change"></li>\
								<li id="negative" class="negative _change"></li>\
								<li id="sepia" class="sepia _change"></li>\
								<li id="bizamajig-ui-crud-button-' + this_column_name + ' class="recyclebin _change"></li>\
						</ul>\
						<div id="ajaxload" class="ajaxload" style="display:none;"></div>\
						<div class="queue">\
							<div id="fileQueue"></div>\
						</div>\
					</div>\
					<div class="right">\
						<div id="image_container">\
						</div>\
						<form id="cropattrform" action="crop.php" method="post" onsubmit="return checkCoords();" class="crop_control">\
							<input type="hidden" id="x" name="x" />\
							<input type="hidden" id="y" name="y" />\
							<input type="hidden" id="w" name="w" />\
							<input type="hidden" id="h" name="h" />\
							<input type="hidden" id="tempfile" name="tempfile" />\
							<input type="hidden" class="jq_step" id="step" name="step" value="process" />\
						</form>\
					</div>\
				</span>');
			}
//
//			PROCESS DELETE IMAGE
//
//			if ( ( $(this).hasClass('delete') ) && ( $(this).hasClass('img') ) ) {

			if ( ( this_action === 'delete' ) && ( this_element_type === 'img' ) ) {
//
//				Add placeholder container to display an element with a cruD control.
//
//				For now, we have removed this text link.
//				<a id="bizamajig-ui-crud-link-' + this_column_name + '" href="#">\
//					Delete\
//				</a>\
//
//				$(this).css('float', 'left').after('<br />\
				$(this).after('<br />\
				<span class="bizamajig-ui-element-action" id="' + this_column_name + '-display">\
					<img id="' + this_column_name + '-element" class="bizamajig-ui-element-action-display" data-element-type="img" data-action="delete" src="' + this_display + '" />\
                	<img id="bizamajig-ui-crud-button-' + this_column_name + '" class="bizamajig-ui-icon" src="/resources/bizamajig/icons/icon-dark-166-24.png" title="Delete this media" alt="" />\
				</span>');
//
//				Setup action button action that we just added above.
//
//				1. Add onclick event to execute database update on target selector that we dynamically added above.
//				2. Reflect changes on form.
//
//
//				1. Add onclick event to execute database update on target selector that we dynamically added above.
//
//				Example of target markup.
//
//				<span id="doc_url_image_1-display" class="bizamajig-ui-element-action">
//					<img src="/content/104196/bbp_web2.gif" data-action="delete" data-element-type="img" class="bizamajig-ui-element-action-display" id="doc_group_url_topic_image-element">
//					<img alt="" title="Delete this media" src="/resources/bizamajig/icons/icon-dark-166-24.png" class="bizamajig-ui-icon" id="bizamajig-ui-crud-button-doc_url_image_1">
//				</span>
//
				$('img#bizamajig-ui-crud-button-' + this_column_name, 'span.bizamajig-ui-element-action').click(function(){ // using scope variable here, 'span.bizamajig-ui-element-action'
					$.ajax({
						type: 'POST',
						url: '/include/_bizamajig-update-data-event.asp',
//						data: dataString,
						data: { action: this_action, relation: this_relation, key_1: this_key_1, key_2: this_key_2, key_3: this_key_3, column_name: this_column_name, current_value: '', new_value: '/resources/sitelevel/spacer.gif', _ts: new Date().getTime() },
						success: function() {
//
//							Relfect related changes on the form (e.g. deleted an image, and we want to remove it from view).
//
//							bizamajig__slidetoggle__forum_listview__post();
//							bizamajig__forum_listview__refresh__timeline('.bizamajig-post-list');
//							o = $('<img>');
//
//							Set image to spacer, could be a move evident "blank-image".
//
							$(this).attr('src', '/resources/sitelevel/spacer.gif');
//							$(this).attr('width', opts.width);
//							$(this).attr('height', opts.height);
//							$(this).css('backgroundColor', o.bgColor);
//
//							Remove delete button from the scene, we can be more elegant, later.
//
							$('#' + this_column_name + '-display').fadeOut('slow');
							$('#' + this_column_name + '-display').addClass('no-content').html('<img id="' + this_column_name + '-element" class="bizamajig-ui-element-action-display" data-element-type="img" data-action="delete" src="/resources/bizamajig/icons/icon-light-133-190.png" />').fadeIn('slow');
						}, // end success: function() {
						error: function(xhr, ajaxOptions, thrownError) {
							if (bizamajig__config.bizamajig__debug === 'Y') {
								alert('readyState: ' + xhr.readyState + '\nstatus: ' + xhr.status);
								alert('responseText: ' + xhr.responseText);
								alert(thrownError);
							}
		                } // end error: function(xhr, ajaxOptions, thrownError) {
					}); // end $.ajax({
				}); // end $(this).click(function(){
			} // end if ( ( this_display === 'img' ) && ( this_action === 'delete' ) ) {
		}); // end bizamajig_element_manager.each(function() {
	}
}

/*
********************************************************************************************************************************
********************************************************************************************************************************

	END UI DATA UPDATE EVENT

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START FORMS - FOCUS AND HINTS

********************************************************************************************************************************
********************************************************************************************************************************
*/
var bizamajig__bind__forms__focus_and_hints = function( scope ) {

	$('.auto-focus:first').focus();

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	UI COLORPICKER - FARBTASTIC
//
	bizamajig__bind__ui__colorpicker();
	
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	UI DATA UPDATE EVENT - Incremental, partial, subset, cell, or column-level updates to database from a form, without
//	submitting the form.
//
	bizamajig__bind__ui__element_manager();
	
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	CHZN DROPDOWN BOX
//
	$('select#select__lookup_location_id').chosen();

	$('select#membership_level_id.choosy').chosen(); // membership sign-up form: membership level
	$('select#state_code.choosy, select#bill_to_state_code.choosy, select#cc_desc.choosy, select#cc_expiration_month.choosy, select#cc_expiration_year.choosy').chosen(); // membership sign-up form: state

	$('#SiteSubParentForm select#service_id').chosen();
	$('#SiteSubParentForm select#__rmk_id').chosen();
	$('#SiteSubParentForm select#service_id').change(function(){
		$('#SiteSubParentForm select#__rmk_id').chosen();
	});

//
//	CHZN / IE BUG: Fix z-index problem for IE browsers.
//
//	Need to revisit the CHOSEN plugin, potentially choose an alternate solution.
//
	var zidx = 100;
	$('.chzn-container').each(function(){
	    $(this).css('z-index', zidx);
	    zidx-=1;
	});


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	TEXTAREA LIMITERS
//
	var input__long_title = {
		'maxCharacterSize': 255,
		'originalStyle': 'originalTextareaInfo',
		'warningStyle' : 'warningTextareaInfo',
		'warningNumber': 10,
		'displayFormat' : 'Characters left: #left'
//		'displayFormat' : '#input/#max | #words words'
		},
		input__short_title = {
		'maxCharacterSize': 75,
		'originalStyle': 'originalTextareaInfo',
		'warningStyle' : 'warningTextareaInfo',
		'warningNumber': 10,
		'displayFormat' : 'Characters left: #left'
//		'displayFormat' : '#input/#max | #words words'
		},
		input__desc = {
		'maxCharacterSize': 1024,
		'originalStyle': 'originalTextareaInfo',
		'warningStyle' : 'warningTextareaInfo',
		'warningNumber': 20,
		'displayFormat' : 'Characters left: #left'
//		'displayFormat' : '#input/#max | #words words'
	};
	$('#doc_group_title_1').textareaCount(input__short_title); // Limitation: 255 vs. 75 characters max
	$('#doc_group_title_5').textareaCount(input__short_title); // Limitation: 255 vs. 75 characters max
	$('#doc_title_1').textareaCount(input__short_title);
	$('#doc_title_5').textareaCount(input__short_title);
	$('#doc_group_desc').textareaCount(input__desc);
	$('#doc_desc').textareaCount(input__desc);

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	FORM HEADERS (h2 and h3) within scope
//
//	$('form h2', '#doc_section__detail').css('background-color', bizamajig__color__levels( bizamajig__config.metadata__content_area__block_form_1_background_color, -0.5)); 	// 50% darker color
//	$('form h2', '#doc_section__detail').css('color', bizamajig__color__levels( bizamajig__config.metadata__content_area__block_form_1_color, 0.2)); 						// 20% lighter color
//	$('form h2', '#doc_section__detail').css('color', bizamajig__config.metadata__content_area__block_form_1_background_color); // swap color
//	$('form h2, form h3', '#doc_section__detail').css('background-color', bizamajig__color__levels( bizamajig__config.metadata__content_area__block_form_1_background_color, -0.06));	// 6% darker color
//	$('form h2, form h3', '#doc_section__detail').css('color', bizamajig__color__levels( bizamajig__config.metadata__content_area__block_form_1_background_color, 0.15)); 			// 15% lighter color
//	$('form h2, form h3').css('background-color', bizamajig__color__levels( bizamajig__config.metadata__content_area__block_form_1_background_color, -0.06)).css('color', bizamajig__color__levels( bizamajig__config.metadata__content_area__block_form_1_background_color, 0.15)).css('opacity', 1); // 6% darker background-color, 15% lighter color, opacity 1

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	GRADIENTER - TO BE STAGED FOR TESTING
//
//
//	Gradienter not working, yet.
//
//	color_start = String(bizamajig__config.metadata__content_area__block_form_1_background_color).replace( /#/g, "" ) + '';
//	$('form#LoginForm fieldset div').gradienter({ color_start: color_start, color_end: 'fff', prop: 'background-color' });

/*

ColorLuminance("6699CC", 0.2);  // "#7ab8f5" - 20% lighter   
ColorLuminance("69C", -0.5);    // "#334d66" - 50% darker   
*/




////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	MINICOLORS
//
//	Generate colorpicker on multiple input fields, using miniColors.
//	$('.bizamajig-input-colorpicker').miniColors({
//		letterCase: 'uppercase',
//		change: function(hex, rgb) {
//			logData(hex, rgb);
//		}
//	});

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	JPICKER
//
//	Generate colorpicker on multiple input fields, using jPicker.
//
//	$.fn.jPicker.defaults.images.clientPath='include/jquery/css/jPicker/images/';
//	$('.bizamajig-input-colorpicker').jPicker( {

//		window: // used to define the position of the popup window only useful in binded mode
//		{
//			title: null, // any title for the jPicker window itself - displays "Drag Markers To Pick A Color" if left null
//			effects:
//			{
//				type: 'fade', // effect used to show/hide an expandable picker. Acceptable values "slide", "show", "fade"
//				speed:
//				{
//					show: 'slow', // duration of "show" effect. Acceptable values are "fast", 'slow', or time in ms
//					hide: 'fast' // duration of "hide" effect. Acceptable value are "fast", 'slow', or time in ms
//				}
//			},
//			position:
//			{
//				x: 'right', // acceptable values "left", "center", "right", "screenCenter", or relative px value
//				y: 'center' // acceptable values "top", "bottom", "center", or relative px value
//			},
////    		expandable: false, // default to large static picker - set to true to make an expandable picker (small icon with popup) - set
                       				// automatically when binded to input element
////			liveUpdate: true, // set false if you want the user to click "OK" before the binded input box updates values (always "true"
                      				// for expandable picker)
//    		alphaSupport: false, // set to true to enable alpha picking
//			alphaPrecision: 0, // set decimal precision for alpha percentage display - hex codes do not map directly to percentage
 //                     				 // integers - range 0-2
//			updateInputColor: true // set to false to prevent binded input colors from changing
//		}
//	});

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	HINTS
//
//
// 	Find all input elements with non-blank title attributes
//
	$('input[title!=""]').hint();

	if ( 1 === 0 ) {
//	Display the hint in fields which have empty values.
	$('input.auto-hint, textarea.auto-hint').focus(function(){
    	if ($(this).val() == $(this).attr('title')) {
			$(this).val('');
			$(this).removeClass('auto-hint');
    	}
	});

//	Then handle focus / blur events.
	$('input.auto-hint, textarea.auto-hint').blur(function(){
	    if ( ($(this).val() == '' ) && ( $(this).attr('title') != '' ) ) {
			$(this).val($(this).attr('title'));
			$(this).addClass('auto-hint');
	    }
	});
	$('input.auto-hint, textarea.auto-hint').each(function(){
	    if ($(this).attr('title') == '') {
			return;
		}
	    if ($(this).val() == '') {
			$(this).val($(this).attr('title'));
		}
	    else {
			$(this).removeClass('auto-hint');
		}
	});
	}
}
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END FORMS - FOCUS AND HINTS

********************************************************************************************************************************
********************************************************************************************************************************
*/

function log( message, container ) { // originally created to support autocomplete, like #bizamajig-ui-panel-results, later.
	$( '<div/>' ).text( message ).prependTo( '#' + container );
	$( '#' + container ).attr( 'scrollTop', 0 );
}
 
/*
********************************************************************************************************************************

Purpose:
	
History:

	ver		date			notes																				name
	----------------------------------------------------------------------------------------------------------------------------
	1.1		06-27-2011		Creation. 																			jahlife

Testing:

********************************************************************************************************************************
*/
//function bizamajig__bind__next_step( request__context ) { // like 'Cart-Order-Request', 'All Products', '%', 'auth-email', 'bizamajig-form-cart-order-request-auth-email', '#email__cart_order_request', '#email__cart_order_request__results', '#bizamajig-ui-grid-results'
var bizamajig__bind__next_step = function( request__context ) { // like 'Cart-Order-Request', 'All Products', '%', 'auth-email', 'bizamajig-form-cart-order-request-auth-email', '#email__cart_order_request', '#email__cart_order_request__results', '#bizamajig-ui-grid-results'

//
//	PUBLIC SITE Cart Order Request
//
//	Create order as administrator, then transfer ownership of the staged order
//	from administrator to the new customer upon checkout.  Optionally, a 
//	transaction can be processed by Paypal/Authorize.net.  Abandoned orders
//	will still carry administrator owner.
//
	if ( request__context.process_desc === 'Cart-Order-Request' ) {

		if ( request__context.target_element === '#email__cart_order_request' ) {

			var target_element_validated = false;
			var this_target_element = $(request__context.target_element);
			var this_target_element_value = this_target_element.val();
			var this_target_element_results = $(request__context.target_element_results);

//
//			Input Validation
//
//			We will hide the submit button until have sufficient input.
//
//			Use input field, and filter on keyup.
//
//			$(request__context.target_submit_button).click( function(e) {
			this_target_element.keyup( function( e ) {
				var code = e.which; // recommended to use e.which, it's normalized across browsers
				this_target_element_value = $(this).val();
				if ( code == 13 ) {
					e.preventDefault();
				}
//				if ( code == 32 || code == 13 || code == 188 || code == 186 ) {
//					$("#displaysomething").html($(this).val());
//				} // missing closing if brace

				if ( ( typeof this_target_element_value === 'undefined' ) || ( this_target_element_value === '' ) ) {
					this_target_element_value === ''
					target_element_validated = false;
					this_target_element_results.html('We will use your email address to process your order.').fadeIn(100);
					this_target_element.focus();
				}
				else {
					if (!bizamajig__filter__email(this_target_element_value)) {
						target_element_validated = false;
						this_target_element_results.html('Please enter a valid email address.').fadeIn(100);
						this_target_element.focus();
					}
					else {
						target_element_validated = true;
						this_target_element_results.fadeOut(100).html('Thank you!').fadeIn(100).delay(1000).html('').hide();
					}
				}
			}); 
			return false;
		} // end if ( request__context.target_element === '#email__cart_order_request' ) {
	} //end if ( request__context.process_desc === 'Cart-Order-Request' ) {
}
/*
********************************************************************************************************************************

Purpose:
	
	Provide an automcomplete capability for the specifid input_element, by polling (GET) the source_url for results.
	
	Autocomplete appends a new parameter &term, automatically.

IMPORTANT!

	This function, by the same name, can be different in each app workspace.
	
Example Inputs:
	
	target_container	= #view_by_identifier_1__cm_workspace
	source_url			= /include/_ap_search__simple.asp

History:

	ver		date			notes																				name
	----------------------------------------------------------------------------------------------------------------------------
	1.1		06-27-2011		Updated to include search_option. 													billy

Testing:

********************************************************************************************************************************
*/
function bizamajig__bind__autocomplete( process_desc, lookup_type_desc, view_by_identifier_1, doc_group_identifier, input_element, source_url, selected_url, results_element ) { // like 'Pages', 'All Pages', '/include/_ap_search__simple.asp', '#view_by_identifier_1__cm_workspace'

//
//	Example call: bizamajig__bind__autocomplete( 'Companies', 'All Companies', '%', '', '#view_by_identifier', '/include/_ap_search__simple.asp', 'bc-account-x.asp' );
//
	if ( ( process_desc === 'Accounts' ) || ( process_desc === 'Companies' ) ) {
//
//	These form elements not currently in use.
//	And any values are not passed along to source_url, below, later.
//
		var lookup_market_id				= $('input#lookup_market_id').val();
		var lookup_account_party_type_id	= $('input#lookup_account_party_type_id').val();

		source_url = source_url + '?process_desc=' + process_desc + '&lookup_type_desc=' + lookup_type_desc; // &term= will be added by .autocomplete

		if ( input_element === '#view_by_identifier__account' ) {
			$( input_element ).autocomplete({
				source: source_url,
				minLength: 2,
				select: function( event, ui ) {

//					var doc_group_id	= ui.item.doc_group_id;
//					var doc_id			= ui.item.doc_id;

					if ( ui.item ) {
						var primary_doc_group_id			= $('input#primary_doc_group_id').val();
						var process_desc					= $('input#process_desc').val();
						var lookup_type_desc 				= $('input#lookup_type_desc').val();
//						var selected_url					= 'bc-account-x.asp';

						var enterprise_id					= ui.item.id;
						var location_id						= ui.item.location_id;

//
//	Update resident form elements.
//	This is not required, just a pattern.
//
						$('#enterprise_id').val(enterprise_id);
						$('#location_id').val(location_id);

						selected_url = selected_url + '?primary_doc_group_id=' + '&process_desc=' + process_desc + '&lookup_type_desc=' + lookup_type_desc + '&enterprise_id=' + enterprise_id + '&location_id=' + location_id;

						document.location.href = selected_url;
//						e.preventDefault();
						return false;
					}
//					log( ui.item ?
//						"Creating opportunity for: " + ui.item.value + " aka " + ui.item.id :
//						"Creating opportunity for: " + ui.item.value :
//						"Nothing selected, input was " + this.value );
				} // end select: function( event, ui ) {
			})
			.focus(); // end $( input_element ).autocomplete({
		} // end if ( input_element === '#view_by_identifier__account' ) {
	}

//
//	Example call: bizamajig__bind__autocomplete( 'Contacts', 'All Contacts', '%', '', '#view_by_identifier', '/include/_ap_search__simple.asp', 'bc-client-account-x.asp' );
//
	if ( process_desc === 'Contacts' ) {
//
//	These form elements not currently in use.
//	And any values are not passed along to source_url, below, later.
//
		var lookup_market_id				= $('input#lookup_market_id').val();
		var lookup_account_party_type_id	= $('input#lookup_account_party_type_id').val();

		source_url = source_url + '?process_desc=' + process_desc + '&lookup_type_desc=' + lookup_type_desc; // &term= will be added by .autocomplete

		if ( input_element === '#view_by_identifier__contact' ) {
			$( input_element ).autocomplete({
				source: source_url,
				minLength: 2,
				select: function( event, ui ) {

//					var doc_group_id	= ui.item.doc_group_id;
//					var doc_id			= ui.item.doc_id;

					if ( ui.item ) {
						var primary_doc_group_id			= $('input#primary_doc_group_id').val();
						var process_desc					= $('input#process_desc').val();
						var lookup_type_desc 				= $('input#lookup_type_desc').val();
//						var selected_url					= 'bc-account-x.asp';

						var enterprise_id					= ui.item.enterprise_id;
						var location_id						= ui.item.location_id;
						var person_id						= ui.item.id;

//
//	Update resident form elements.
//	This is not required, just a pattern.
//
						$('#enterprise_id').val(enterprise_id);
						$('#location_id').val(location_id);
						$('#person_id').val(person_id);

						selected_url = selected_url + '?primary_doc_group_id=' + '&process_desc=' + process_desc + '&lookup_type_desc=' + lookup_type_desc + '&enterprise_id=' + enterprise_id + '&location_id=' + location_id + '&person_id=' + person_id;

						document.location.href = selected_url;
//						e.preventDefault();
						return false;
					}
//					log( ui.item ?
//						"Creating opportunity for: " + ui.item.value + " aka " + ui.item.id :
//						"Creating opportunity for: " + ui.item.value :
//						"Nothing selected, input was " + this.value );
				} // end select: function( event, ui ) {
			})
			.focus(); // end $( input_element ).autocomplete({
		} // end if ( input_element === '#view_by_identifier__contact' ) {
	}

//
//	Example call: bizamajig__bind__autocomplete( 'Events', 'All Events', '%', '', '#view_by_identifier', '/include/_ap_search__simple-public.asp', '', '#bizamajig-ui-grid-1' );
//
//	PUBLIC SITE
//
//	bizamajig__workspace__layout( process_desc, lookup_type_desc, '%', '', '#doc_section__detail', '/include/_bizamajig-ui-form-header-ec-public-search.asp', true );
	if ( ( process_desc === 'Events' ) && ( lookup_type_desc === 'All Events' ) ) {

		var lookup_location_id = $('select#select__lookup_location_id').val();
		var dynamic_source_url = source_url + '?process_desc=' + process_desc + '&lookup_type_desc=' + lookup_type_desc + '&lookup_location_id=' + lookup_location_id; // &term= will be added by .autocomplete

		$('select#select__lookup_location_id').change(function(){
			lookup_location_id = $('select#select__lookup_location_id').val();
			dynamic_source_url = source_url + '?process_desc=' + process_desc + '&lookup_type_desc=' + lookup_type_desc + '&lookup_location_id=' + lookup_location_id; // &term= will be added by .autocomplete
			bizamajig__bind__autocomplete( 'Events', 'All Events', '%', '', '#view_by_identifier_1__ec_workspace', '/include/_ap-search-simple-public.asp', '', '#bizamajig-ui-grid-results' );
		});
				
		if ( input_element === '#view_by_identifier_1__ec_workspace' ) {
			$( input_element ).autocomplete({
				source: dynamic_source_url,
				minLength: 0,
				open: function(event, ui) { // populate data results into results_element
//					$('#bizamajig-ui-grid-results').empty().show();
					$('ul.ui-autocomplete').removeAttr('style').hide().appendTo('#bizamajig-ui-grid-results').show();

					$('#bizamajig-ui-grid-1').hide();
				},
				select: function( event, ui ) {
//alert('Loading');
//					var doc_group_id	= ui.item.doc_group_id;
//					var doc_id			= ui.item.doc_id;

					if ( ui.item ) {
						var primary_doc_group_id			= $('input#primary_doc_group_id').val();
						var process_desc					= $('input#process_desc').val();
						var lookup_type_desc 				= $('input#lookup_type_desc').val();

						var project_id						= ui.item.id;

//						var primary_doc_group_id = $(this).attr('data-primary_doc_group_id');
//						var permalink_url = $(this).attr('data-permalink_url');
//						var process_desc = $(this).attr('data-process_desc');
//						var lookup_type_desc = $(this).attr('data-lookup_type_desc');
//						var project_id = $(this).attr('data-project_id');

						$.ajax({
							type: 'POST',
							url: '/include/_ap-project-detail-event-x.asp',
							data: { project_id: project_id},
							success: function(response) {

								$('#bizamajig-ui-grid-1').html(response).fadeIn(1500, function() {
//									if ( event_registration_indicator === 'Y' ) {
//										bizamajig__bind__forum_listview__post__reply('bizamajig-dataset-reply', 'bizamajig-bind-new-reply');
//									}
//									$('#bizamajig-ui-grid-results').hide();
									bizamajig__bind__autocomplete( 'Events', 'All Events', '%', '', '#view_by_identifier_1__ec_workspace', '/include/_ap-search-simple-public.asp', '', '#bizamajig-ui-grid-results' );

//	STUBBED.
//									$('bizamajig-dub-socializer').empty();
//									$('#bizamajig-ui-grid-1').append('<div id="bizamajig-dub-socializer"></div>');
//									bizamajig__bind__sociable('.doc_section__contentarea', 'bizamajig-dub-socializer', project_id, '', '');
								});
							},
							error: function(xhr, ajaxOptions, thrownError) {
								if (bizamajig__config.bizamajig__debug === 'Y') {
									alert('readyState: ' + xhr.readyState + '\nstatus: ' + xhr.status);
									alert('responseText: ' + xhr.responseText);
									alert(thrownError);
								}
			    			}
						});
						return false;
					}
//					log( ui.item ?
//						"Creating opportunity for: " + ui.item.value + " aka " + ui.item.id :
//						"Creating opportunity for: " + ui.item.value :
//						"Nothing selected, input was " + this.value );
				} // end select: function( event, ui ) {
			})
			.focus(); // end $( input_element ).autocomplete({
		} // end if ( input_element === '#view_by_identifier_1__ec_workspace' ) {
	}

//
//	Example call: bizamajig__bind__autocomplete( 'Target Lists', 'All Target Lists', '%', '', '#view_by_identifier', '/include/_ap_search__simple.asp', 'bz-target-list-x.asp' );
//
	if ( process_desc === 'Target Lists' ) {

		source_url = source_url + '?process_desc=' + process_desc + '&lookup_type_desc=' + lookup_type_desc; // &term= will be added by .autocomplete

		if ( input_element === '#view_by_identifier__target_list' ) {
			$( input_element ).autocomplete({
				source: source_url,
				minLength: 2,
				select: function( event, ui ) {

//					var doc_group_id	= ui.item.doc_group_id;
//					var doc_id			= ui.item.doc_id;

					if ( ui.item ) {
						var primary_doc_group_id			= $('input#primary_doc_group_id').val();
						var process_desc					= $('input#process_desc').val();
						var lookup_type_desc 				= $('input#lookup_type_desc').val();

						var target_list_id					= ui.item.id;

//
//	Update resident form elements.
//	This is not required, just a pattern.
//
						$('#target_list_id').val(target_list_id);

						selected_url = selected_url + '?primary_doc_group_id=' + '&process_desc=' + process_desc + '&lookup_type_desc=' + lookup_type_desc + '&target_list_id=' + target_list_id;

						document.location.href = selected_url;
//						e.preventDefault();
						return false;
					}
//					log( ui.item ?
//						"Creating opportunity for: " + ui.item.value + " aka " + ui.item.id :
//						"Creating opportunity for: " + ui.item.value :
//						"Nothing selected, input was " + this.value );
				} // end select: function( event, ui ) {
			})
			.focus(); // end $( input_element ).autocomplete({
		} // end if ( input_element === '#view_by_identifier__target_list' ) {
	}

//
//	Example call: bizamajig__bind__autocomplete( 'Membership Groups', 'All Membership Groups', '%', '', '#view_by_identifier', '/include/_ap_search__simple.asp', 'meta-membership-level-x.asp' );
//
	if ( process_desc === 'Membership Groups' ) {

		source_url = source_url + '?process_desc=' + process_desc + '&lookup_type_desc=' + lookup_type_desc; // &term= will be added by .autocomplete

		if ( input_element === '#view_by_identifier__membership_level' ) {
			$( input_element ).autocomplete({
				source: source_url,
				minLength: 2,
				select: function( event, ui ) {

//					var doc_group_id	= ui.item.doc_group_id;
//					var doc_id			= ui.item.doc_id;

					if ( ui.item ) {
						var primary_doc_group_id			= $('input#primary_doc_group_id').val();
						var process_desc					= $('input#process_desc').val();
						var lookup_type_desc 				= $('input#lookup_type_desc').val();

						var membership_level_id				= ui.item.id;

//
//	Update resident form elements.
//	This is not required, just a pattern.
//
						$('#membership_level_id').val(membership_level_id);

						selected_url = selected_url + '?primary_doc_group_id=' + '&process_desc=' + process_desc + '&lookup_type_desc=' + lookup_type_desc + '&membership_level_id=' + membership_level_id;

						document.location.href = selected_url;
//						e.preventDefault();
						return false;
					}
//					log( ui.item ?
//						"Creating opportunity for: " + ui.item.value + " aka " + ui.item.id :
//						"Creating opportunity for: " + ui.item.value :
//						"Nothing selected, input was " + this.value );
				} // end select: function( event, ui ) {
			})
			.focus(); // end $( input_element ).autocomplete({
		} // end if ( input_element === '#view_by_identifier__membership_level' ) {
	}

//
//	Example call: bizamajig__bind__autocomplete( 'Markets', 'All Markets', '%', '', '#view_by_identifier', '/include/_ap_search__simple.asp', 'meta-market-x.asp' );
//
	if ( process_desc === 'Markets' ) {

		source_url = source_url + '?process_desc=' + process_desc + '&lookup_type_desc=' + lookup_type_desc; // &term= will be added by .autocomplete

		if ( input_element === '#view_by_identifier__market' ) {
			$( input_element ).autocomplete({
				source: source_url,
				minLength: 2,
				select: function( event, ui ) {

//					var doc_group_id	= ui.item.doc_group_id;
//					var doc_id			= ui.item.doc_id;

					if ( ui.item ) {
						var primary_doc_group_id			= $('input#primary_doc_group_id').val();
						var process_desc					= $('input#process_desc').val();
						var lookup_type_desc 				= $('input#lookup_type_desc').val();

						var market_id						= ui.item.id;

//
//	Update resident form elements.
//	This is not required, just a pattern.
//
						$('#market_id').val(market_id);

						selected_url = selected_url + '?primary_doc_group_id=' + '&process_desc=' + process_desc + '&lookup_type_desc=' + lookup_type_desc + '&market_id=' + market_id;

						document.location.href = selected_url;
//						e.preventDefault();
						return false;
					}
//					log( ui.item ?
//						"Creating opportunity for: " + ui.item.value + " aka " + ui.item.id :
//						"Creating opportunity for: " + ui.item.value :
//						"Nothing selected, input was " + this.value );
				} // end select: function( event, ui ) {
			})
			.focus(); // end $( input_element ).autocomplete({
		} // end if ( input_element === '#view_by_identifier__market' ) {
	}

//
//	Example call: bizamajig__bind__autocomplete( 'Workflows', 'All Workflows', '%', '', '#view_by_identifier', '/include/_ap_search__simple.asp', 'meta-tpt-x.asp' );
//
	if ( process_desc === 'Workflows' ) {

		source_url = source_url + '?process_desc=' + process_desc + '&lookup_type_desc=' + lookup_type_desc; // &term= will be added by .autocomplete

		if ( input_element === '#view_by_identifier__tracking_path' ) {
			$( input_element ).autocomplete({
				source: source_url,
				minLength: 2,
				select: function( event, ui ) {

//					var doc_group_id	= ui.item.doc_group_id;
//					var doc_id			= ui.item.doc_id;

					if ( ui.item ) {
						var primary_doc_group_id			= $('input#primary_doc_group_id').val();
						var process_desc					= $('input#process_desc').val();
						var lookup_type_desc 				= $('input#lookup_type_desc').val();

						var tracking_path_id				= ui.item.id;

//
//	Update resident form elements.
//	This is not required, just a pattern.
//
						$('#tracking_path_id').val(tracking_path_id);

						selected_url = selected_url + '?primary_doc_group_id=' + '&process_desc=' + process_desc + '&lookup_type_desc=' + lookup_type_desc + '&tracking_path_id=' + tracking_path_id;

						document.location.href = selected_url;
//						e.preventDefault();
						return false;
					}
//					log( ui.item ?
//						"Creating opportunity for: " + ui.item.value + " aka " + ui.item.id :
//						"Creating opportunity for: " + ui.item.value :
//						"Nothing selected, input was " + this.value );
				} // end select: function( event, ui ) {
			})
			.focus(); // end $( input_element ).autocomplete({
		} // end if ( input_element === '#view_by_identifier__tracking_path' ) {
	}

//
//	Example call: bizamajig__bind__autocomplete( process_desc, 'All Pages', '%', doc_group_identifier, '#view_by_identifier_1__cm_workspace', '/include/_ap_search__simple.asp', '' );
//
	if ( process_desc === 'Pages' ) {
		source_url = source_url + '?process_desc=' + process_desc + '&lookup_type_desc=' + lookup_type_desc + '&doc_group_identifier=' + doc_group_identifier; // &term= will be added by .autocomplete
		if ( input_element === '#view_by_identifier_1__cm_workspace' ) {
			$( input_element ).autocomplete({
				source: source_url,
				minLength: 2,
				select: function( event, ui ) {

					var doc_group_id	= ui.item.doc_group_id;
					var doc_id			= ui.item.doc_id;
					var url			 	= ui.item.url;

					if ( ui.item ) {
//						$("select#rmk_id", '#bzmjg__dialog__forum_listview__messaging').load("/include/_standard_rmk__by_service_id.asp",{ service_id: $(this).val(), ajax: 'true' });

						var primary_doc_group_id	= $('input#primary_doc_group_id').val();

						url = url + '?primary_doc_group_id=' + '&process_desc=' + process_desc + '&lookup_type_desc=' + lookup_type_desc + '&doc_group_id=' + doc_group_id + '&doc_id=' + doc_id + '&doc_group_identifier=' + doc_group_identifier;

						document.location.href = url;
//						e.preventDefault();
						return false;
					}
//					log( ui.item ?
//						"Creating opportunity for: " + ui.item.value + " aka " + ui.item.id :
//						"Creating opportunity for: " + ui.item.value :
//						"Nothing selected, input was " + this.value );
				} // end select: function( event, ui ) {
			})
			.focus(); // end $( input_element ).autocomplete({
		} // end if ( input_element === '#view_by_identifier_1__cm_workspace' ) {
	}

}
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END GLOBAL FUNCTIONS

********************************************************************************************************************************
********************************************************************************************************************************
*/





/*
********************************************************************************************************************************
********************************************************************************************************************************

	START UI DISPLAY PROGRESS INFO

********************************************************************************************************************************
********************************************************************************************************************************
*/
	function bizamajig__loader__toggle( parentObject, childObject, toggle ) {
//
//	parentObject like '.class1.classB' or '#class1'
//
//	childObject like 'bizamajig-ui-progress', and we will append '#' or '.' here
//
		if ( ( toggle ) && ( bizamajig__config.showing_progress ) ) {
			return false;
		}
	
		if ( toggle ) {
//			$( parentObject ).empty();
			$( parentObject ).append( '<div id="' + childObject + '" style="margin: 30px;"></div>' );
			$( '#' + childObject ).html('<img src="//www.bizamajig.com/resources/bizamajig/art/bizamajig-ui-progress.gif" />');


//			$( '#' + childObject ).addClass('bizamajig-ui-progress')

//			$('#logo').css('background', 'url(//www.bizamajig.com/resources/bizamajig/art/bizamajig-ui-progress.gif) no-repeat') 

//			$().ajaxSend( function( r, s ) {
//				$( '#' + childObject ).show();
//			});
//			$().ajaxStop( function( r, s ) {
//				$( '#' + childObject ).fadeOut(); 
//			});
			bizamajig__config.showing_progress = true;


		}
		if ( !toggle ) {
			$( '#' + childObject ).remove();
			bizamajig__config.showing_progress = false;
		}
	}


//
//	Configure for all AJAX calls to display a common progress bar class using show/hide.
//
//	$.ajaxSetup({
//		beforeSend: function() {
//			$('#loader').show()
//			$( '.bizamajig-ui-progress' ).append( '<div id="bizamajig-ui-progress-show"></div>' );
//			$( '#' + childObject ).html( '<img src="//www.bizamajig.com/resources/bizamajig/art/bizamajig-ui-progress.gif" />' )
//		},
//		complete: function() {
//			$('#loader').hide()
//		}
//	});



//
//	Configure specific classes to show progress for AJAX calls using show/hide.
//
//	$("#ajax_loading_div")
//	.bind("ajaxSend", function(){
//		$(this).show();
//	})
//	.bind("ajaxComplete", function(){
//		$(this).hide();
//		$(this).fadeOut();
//	});



/*
********************************************************************************************************************************
********************************************************************************************************************************

	END UI DISPLAY PROGRESS INFO

********************************************************************************************************************************
********************************************************************************************************************************
*/





/*
********************************************************************************************************************************
********************************************************************************************************************************

	START PLUGIN - BIZAMAJIG DATE FORMAT

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
 * Date Format 1.2.3
 * (c) 2007-2009 Steven Levithan <stevenlevithan.com>
 * MIT license
 *
 * Includes enhancements by Scott Trenda <scott.trenda.net>
 * and Kris Kowal <cixar.com/~kris.kowal/>
 *
 * Accepts a date, a mask, or a date and a mask.
 * Returns a formatted version of the given date.
 * The date defaults to the current date/time.
 * The mask defaults to bizamajig_date_format.masks.default.
 */

var bizamajig_date_format = function () {
	var	token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
		timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
		timezoneClip = /[^-+\dA-Z]/g,
		pad = function (val, len) {
			val = String(val);
			len = len || 2;
			while (val.length < len) val = "0" + val;
			return val;
		};

	// Regexes and supporting functions are cached through closure
	return function (date, mask, utc) {
		var dF = bizamajig_date_format;

		// You can't provide utc if you skip other args (use the "UTC:" mask prefix)
		if (arguments.length == 1 && Object.prototype.toString.call(date) == "[object String]" && !/\d/.test(date)) {
			mask = date;
			date = undefined;
		}

		// Passing date through Date applies Date.parse, if necessary
		date = date ? new Date(date) : new Date;
		if (isNaN(date)) throw SyntaxError("invalid date");

		mask = String(dF.masks[mask] || mask || dF.masks["default"]);

		// Allow setting the utc argument via the mask
		if (mask.slice(0, 4) == "UTC:") {
			mask = mask.slice(4);
			utc = true;
		}

		var	_ = utc ? "getUTC" : "get",
			d = date[_ + "Date"](),
			D = date[_ + "Day"](),
			m = date[_ + "Month"](),
			y = date[_ + "FullYear"](),
			H = date[_ + "Hours"](),
			M = date[_ + "Minutes"](),
			s = date[_ + "Seconds"](),
			L = date[_ + "Milliseconds"](),
			o = utc ? 0 : date.getTimezoneOffset(),
			flags = {
				d:    d,
				dd:   pad(d),
				ddd:  dF.i18n.dayNames[D],
				dddd: dF.i18n.dayNames[D + 7],
				m:    m + 1,
				mm:   pad(m + 1),
				mmm:  dF.i18n.monthNames[m],
				mmmm: dF.i18n.monthNames[m + 12],
				yy:   String(y).slice(2),
				yyyy: y,
				h:    H % 12 || 12,
				hh:   pad(H % 12 || 12),
				H:    H,
				HH:   pad(H),
				M:    M,
				MM:   pad(M),
				s:    s,
				ss:   pad(s),
				l:    pad(L, 3),
				L:    pad(L > 99 ? Math.round(L / 10) : L),
				t:    H < 12 ? "a"  : "p",
				tt:   H < 12 ? "am" : "pm",
				T:    H < 12 ? "A"  : "P",
				TT:   H < 12 ? "AM" : "PM",
				Z:    utc ? "UTC" : (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""),
				o:    (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
				S:    ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10]

			};

		return mask.replace(token, function ($0) {
			return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);
		});
	};
}();

// Some common format strings
bizamajig_date_format.masks = {
//
//	Bizamajig Customization
//
//	"default":      "ddd mmm dd yyyy HH:MM:ss",
	"default":      "m/d/yy",
//	shortDate:      "m/d/yy",
	shortDate:      "mm/dd/yyyy",
	mediumDate:     "mmm d, yyyy",
	longDate:       "mmmm d, yyyy",
	fullDate:       "dddd, mmmm d, yyyy",
	shortTime:      "h:MM TT",
	mediumTime:     "h:MM:ss TT",
	longTime:       "h:MM:ss TT Z",
	isoDate:        "yyyy-mm-dd",
	isoTime:        "HH:MM:ss",
	isoDateTime:    "yyyy-mm-dd'T'HH:MM:ss",
	isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"
};

// Internationalization strings
bizamajig_date_format.i18n = {
	dayNames: [
		"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
		"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
	],
	monthNames: [
		"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
		"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
	]
};

// For convenience...
Date.prototype.format = function (mask, utc) {
	return bizamajig_date_format(this, mask, utc);
};
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END PLUGIN - BIZAMAJIG DATE FORMAT

********************************************************************************************************************************
********************************************************************************************************************************
*/





/*
********************************************************************************************************************************
********************************************************************************************************************************

	START PLUGIN - BIZAMAJIG FADE TOGGLE

********************************************************************************************************************************
********************************************************************************************************************************
*/

jQuery.fn.fadeToggle = function( speed, easing, callback ) {
   return this.animate( { opacity: 'toggle' }, speed, easing, callback );
};

/*
********************************************************************************************************************************
********************************************************************************************************************************

	END PLUGIN - BIZAMAJIG FADE TOGGLE

********************************************************************************************************************************
********************************************************************************************************************************
*/

/*
********************************************************************************************************************************
********************************************************************************************************************************

	START PLUGIN - BIZAMAJIG STACKED TOGGLE

********************************************************************************************************************************
********************************************************************************************************************************
*/
(function($){
    $.fn.extend({

		bizamajig_stacked_toggle: function( options ) {

			var defaults = {
				tag_content_header:	'div',
				tag_content_body:	'div',
				speed:				'fast',
				class_expand:		'bizamajig-stacked-toggle-expand',
				class_collapse:		'bizamajig-stacked-toggle-collapse'
			};

			options = $.extend( defaults, options ); 

			return this.each( function() {

				var opts = options;
				var content = $(this);
//				var content_header = $( 'div:eq(0)', content );
//				var content_body = $( 'div:eq(1)', content );

//
//				Read div.class method.
//
				var content_header = $( opts.tag_content_header, content ); // SCOPE
				var content_body = $( opts.tag_content_body, content ); // SCOPE

//
//				Read first two divs if targeted divs do not exist (above).
//				Note: This does not handle nested divs within first div, limited but OK.
//
//	WORKING:
//				var content_header = $( opts.tag_content_header + ':eq(0)', content ); // SCOPE
//				var content_body = $( opts.tag_content_body + ':eq(1)', content ); // SCOPE
//
//	NOT WORKING:
//
//				if ( ( typeof content_header === 'undefined' ) || ( content_header === '' ) || ( content_header === '[object Object]' ) ) {
//					var content_header = $( opts.tag_content_header + ':eq(0)', content ); // SCOPE
//					var content_body = $( opts.tag_content_body + ':eq(1)', content ); // SCOPE
//				}

				if (content.is( '.open' )) {
					content_header.addClass( opts.class_collapse );
//
//	RAS
//	BUG: This variable, content_header_a, is still undefined before it's referenced below.
//
					content_header_a.addClass( opts.class_collapse );

				} else {
					content_header.addClass( opts.class_expand );
					content_body.hide();
				}

				content_header.click(function() {  
//					content_body.slideToggle( opts.speed );

//$("button").click(function () {
//   $("p").fadeToggle()
//}); 
					content_body.fadeToggle( 800, 'swing' ); // speed, easing, callback


					if($(this).is( '.' + opts.class_collapse )) {
						$(this).removeClass( opts.class_collapse );
						$(this).addClass( opts.class_expand );
					} else {
						$(this).removeClass( opts.class_expand);
						$(this).addClass( opts.class_collapse );
					}
				});

			});  // return this.each(function() {
        }  
    });  
})(jQuery);

/*
********************************************************************************************************************************
********************************************************************************************************************************

	END PLUGIN - BIZAMAJIG STACKED TOGGLE

********************************************************************************************************************************
********************************************************************************************************************************
*/





/*
********************************************************************************************************************************
********************************************************************************************************************************

	START - BIZAMAJIG CSS SHAPE LEVELING

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	Purpose:

		Reset dimensions to ceiling width/height of top-level children.

	History:
	
		ver		date		notes													name
		---------------------------------------------------------------------------------------------
		1.0		01-12-2009	Creation.												jahlife

********************************************************************************************************************************
********************************************************************************************************************************
*/

$.fn.bizamajig__css__adjust = function( uom_desc ) {
	$(this).each(function() {
		var ceiling = 0;
		$(this).children().each(function() {
			if ($(this).height() > ceiling) {
            	ceiling = $(this).height();
			}
		});
		// css: height or min-height
		if ( $.browser.msie && $.browser.version == 6.0 ) {
        	$(this).children().css({'height': ceiling});
		}
		$(this).children().css({'min-height': ceiling}); 
	});
	return this;
};
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END - BIZAMAJIG CSS SHAPE LEVELING

********************************************************************************************************************************
********************************************************************************************************************************
*/




/*
********************************************************************************************************************************
********************************************************************************************************************************

	START PLUGIN - CATEGORY FILTER

********************************************************************************************************************************
********************************************************************************************************************************
*/

(function($) {
	$.fn.category_filter = function(settings) {
		settings = $.extend({
			useHash: true,
			animationSpeed: 1000,
			show: { width: 'show', opacity: 'show' },
			hide: { width: 'hide', opacity: 'hide' },
			useTags: true,
			tagSelector: '#bizamajig-content-gallery-list a',
			selectedTagClass: 'current',
			allTag: 'all'
		}, settings);
		
		return $(this).each(function(){
		
			/* FILTER: select a tag and filter */
			$(this).bind("filter", function( e, tagToShow ){
				if(settings.useTags){
					$(settings.tagSelector).removeClass(settings.selectedTagClass);
					$(settings.tagSelector + '[href=' + tagToShow + ']').addClass(settings.selectedTagClass);
				}
				$(this).trigger("filter-bizamajig-content-gallery-list", [ tagToShow.substr(1) ]);
			});
		
			/* filter-bizamajig-content-gallery-list: pass in a class to show, all others will be hidden */
			$(this).bind("filter-bizamajig-content-gallery-list", function( e, classToShow ){
				if(classToShow == settings.allTag){
					$(this).trigger("show");
				}else{
					$(this).trigger("show", [ '.' + classToShow ] );
					$(this).trigger("hide", [ ':not(.' + classToShow + ')' ] );
				}
				if(settings.useHash){
					location.hash = '#' + classToShow;
				}
			});
			
			/* SHOW: show a single class*/
			$(this).bind("show", function( e, selectorToShow ){
				$(this).children(selectorToShow).animate(settings.show, settings.animationSpeed);
			});
			
			/* SHOW: hide a single class*/
			$(this).bind("hide", function( e, selectorToHide ){
				$(this).children(selectorToHide).animate(settings.hide, settings.animationSpeed);	
			});
			
			/* ============ Check URL Hash ====================*/
			if(settings.useHash){
				if(location.hash != '')
					$(this).trigger("filter", [ location.hash ]);
				else
					$(this).trigger("filter", [ '#' + settings.allTag ]);
			}
			
			/* ============ Setup Tags ====================*/
			if(settings.useTags){
				$(settings.tagSelector).click(function(){
					$('#bizamajig-content-gallery-list').trigger("filter", [ $(this).attr('href') ]);
					
					$(settings.tagSelector).removeClass('current');
					$(this).addClass('current');
				});
			}
		});
	}
})(jQuery);

/*
********************************************************************************************************************************
********************************************************************************************************************************

	END PLUGIN - CATEGORY FILTER

********************************************************************************************************************************
********************************************************************************************************************************
*/





/*
********************************************************************************************************************************
********************************************************************************************************************************

	START WINDOW MANAGER

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************

Purpose:
	
	This handler will calculate/manage panel sizing.

History:

	ver		date			notes																				name
	----------------------------------------------------------------------------------------------------------------------------
	1.1		11-01-2009		Creation. 																			jahlife

Testing:

********************************************************************************************************************************
*/
	function bizamajig__trigger__resize()
	{
//		var h = $(window).height(); 
//		var w = $(window).width(); 
/////////////////////////////////////////////////////////////////
//////THIS IS GOLD FOR RIGHT-SIDEBAR-EXPANDING///////////////////
//		var outer_height = Math.round( $(window).height() - 230 );
//		var inner_height = Math.round( $(window).height() - ( 245 + $('#bizamajig-content-panel-detail-container-close').height() ) );
/////////////////////////////////////////////////////////////////
		var outer_height = Math.round( $(window).height() );
		var inner_height = Math.round( $(window).height() - ( $('#bizamajig-content-panel-detail-container-close').height() ) );
		$('#bizamajig-content-panel-detail-container').css('height', outer_height); 
		$('#bizamajig-content-panel-detail').css('height', inner_height); 
	}
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END WINDOW MANAGER

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START Named Function - Menu - Stacked Accordion

********************************************************************************************************************************
********************************************************************************************************************************
*/

	var bizamajig__bind__content__stacked_toggle = function( type ) { // this/scope is not currently in use, and remains for future reference

		if ( ( typeof type === 'undefined' ) || ( type === '' ) ) {
			type = 'small';
		}
		
		if ( type === 'small' ) {
			$('div.bizamajig-stacked-toggle').bizamajig_stacked_toggle({
					tag_content_header:	'div.header',							// do not define global css for .header
					tag_content_body: 	'div.body',								// do not define global css for .body
					speed: 				'slow',
					class_expand: 		'bizamajig-stacked-toggle-expand',
					class_collapse: 	'bizamajig-stacked-toggle-collapse'
			});  
		}
		if ( type === 'medium' ) {
			$('div.bizamajig-stacked-toggle').bizamajig_stacked_toggle({
					tag_content_header:	'div.header',							// do not define global css for .header
					tag_content_body: 	'div.body',								// do not define global css for .body
					speed: 				'slow',
					class_expand: 		'bizamajig-stacked-toggle-expand-medium',
					class_collapse: 	'bizamajig-stacked-toggle-collapse-medium'
			});  
		}
		

	}; // end var bizamajig__bind__content__stacked_toggle = function( scope ) {
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END Named Function - Menu - Stacked Accordion

********************************************************************************************************************************
********************************************************************************************************************************
*/

/*
********************************************************************************************************************************
********************************************************************************************************************************

	START Named Function - Masonry

********************************************************************************************************************************
********************************************************************************************************************************
*/
	var bizamajig__bind__masonry = function( input_container, input_blocks_item_selector ) {

//		input_container = '#doc_section__detail'; // or '.doc_section__detail'
return false;
		input_blocks_item_selector = 'blocks';

		$target_container = $('.masonry');

		$target_container.imagesLoaded(function(){
			masonry_options = {
/*
				singleMode:		true,
*/
//				columnWidth: 	$target_container.width() / 5,
				columnWidth: 	5,
				itemSelector:	'.' + input_blocks_item_selector,
				isAnimated: 	true
/*
				resizeable:		true,
				animate:		true,
				easing:			'swing',
				gutterWidth: 	5
*/
			};
			$target_container.masonry(masonry_options);
//	run masonry when window is resized
	 		$(window).resize(function() {
				$target_container.masonry(masonry_options);
			}).resize();
		});
	}; // end var bizamajig__bind__masonry = function( input_container ) {

/*
********************************************************************************************************************************
********************************************************************************************************************************

	END Named Function - Masonry

********************************************************************************************************************************
********************************************************************************************************************************
*/






/*
********************************************************************************************************************************
********************************************************************************************************************************

	START Bizamajig Handlers - Membership Directory

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************

Purpose:
	
	Display selected entry in Membership Directory.

History:

	ver		date			notes																				name
	----------------------------------------------------------------------------------------------------------------------------
	1.1		11-01-2009		Removed .linkify().find('a').attr('target','_blank')								jahlife

Testing:

http://fairviewbusiness.com/include/bizamajig-public-ap-search-simple-asyncio.asp?primary_doc_group_id=&process_desc=Membership%20Directory&lookup_type_desc=All%20Members&view_by_identifier_1=ola&lookup_location_id=-1&lookup_dept_id=-1

http://www.mountainbizworks.org/include/_ap-search-simple-contact-directory-member-selected.asp

********************************************************************************************************************************
*/
	function bizamajig__bind__membership_directory__post__show_detail( target_class, remove_this_refresh_class ) {

		$("div[class='" + target_class + "']").click(function(e) { // Example: target_class = 'bizamajig-dataset-post bizamajig-bind-new blocks', remove_this_refresh_class = 'bizamajig-bind-new'

			if (bizamajig__config.bizamajig__debug === 'Y') {
				alert('ONCLICK: bizamajig-dataset-listview/blocks bizamajig-bind-new blocks');
			}

			var permalink_url = $(this).attr('data-permalink_url');
			var target_url_01 = $(this).attr('data-target_url_01');
			var primary_doc_group_id = $(this).attr('data-primary_doc_group_id');
			var process_desc = $(this).attr('data-process_desc');
			var lookup_type_desc = $(this).attr('data-lookup_type_desc');
			var enterprise_id = $(this).attr('data-enterprise_id');
			var location_id = $(this).attr('data-location_id');
			var person_id = $(this).attr('data-person_id');
			var market_id = $(this).attr('data-market_id');

			$.ajax({
				type: 'POST',
//
//	Example: mountainbizworks.org/include/_ap-search-simple-contact-directory-member-selected.asp?primary_doc_group_id=&process_desc=Membership%20Directory&lookup_type_desc=All%20Members&market_id=-1&enterprise_id=122011&location_id=199882&person_id=122012&search_by_identifier_1=
//
				url: '/include/_ap-search-simple-contact-directory-member-selected.asp',
				data: { primary_doc_group_id: primary_doc_group_id, process_desc: 'Membership Directory', lookup_type_desc: 'All Members', view_by_identifier: '%', enterprise_id: enterprise_id, location_id: location_id, person_id: person_id, lookup_market_id: market_id },
				success: function(response) {

//					When injecting this content, we will remove any existing upper level (parent container)
//					and target an included, next div with class="doc_section__container".
//
					$('.doc_section__container').find('img').remove();
//
//					Page Content Injections
//
//					$('#doc_section__detail').html(response).fadeIn(1500, function() {
//					$('#doc_section__container').html(response).fadeIn(1500, function() {
					$('.doc_section__contentarea').html(response).fadeIn(1500, function() {
//	STUBBED.
//						$('#doc_section__detail').append('<div id="bizamajig-dub-socializer"></div>');
//						bizamajig__bind__sociable('.doc_section__contentarea', 'bizamajig-dub-socializer', permalink_url, '', '');
					});

//
//	START STUB
//	We have stubbed the lightbox/sliding panel approach for now:
//
					if ( '1' === '0' ) {

					var outer_height = Math.round( $(window).height() );
					var inner_height = Math.round( $(window).height() - ( 245 + 75 /* $('#bizamajig-content-panel-detail-container-close').height() */ ) );
					$('#bizamajig-content-panel-detail-container').stop().animate({opacity:1, width:bizamajig__config.metadata__container__layout__width__fixed_content, height:outer_height }, 250, function() {

//
//	Hide any behind-objects to keep the user experience clean.
//
						$('#bizamajig-ui-accordion-menu-vertical-site-toolbar').hide();

						$('#bizamajig-content-panel-detail').width('100%');
						$('#bizamajig-content-panel-detail').height(inner_height);

////////////////////////////
//	LINKIFY STUB
						$('.content').html(response).linkify().find('a').attr('target','_blank').fadeIn('slow');

//						if ( bizamajig__config.bizamajig_private_authentication_active_ind === 'Y' ) {
//							bizamajig__bind__membership_directory__post__reply('bizamajig-dataset-reply', 'bizamajig-bind-new-reply');
//						}

//
//	The above .animate has already set opacity to 1, and works fine in jQuery 1.4.2.
//	After jQuery 1.4.2, we are redundantly using fadeTo to set opacity to 1, to actually have the
//	panel be visible.  Might be a CSS issue, but this works in all browsers.
//	
						$(this).fadeTo('slow', 1);

					});

					$('#bizamajig-content-panel-detail-container-close').click(function() {
						$('#bizamajig-content-panel-detail-container').stop().animate({width:0, height:0, opacity:0}, 500);
						$('#bizamajig-content-panel-detail').width(0);
						$('#bizamajig-content-panel-detail').height(0);
						$('.content').empty();

//
//	Reset any objects that we have hidden above.
//
						$('#bizamajig-ui-accordion-menu-vertical-site-toolbar').show();
					});
//
//	END STUB
//
					}

				},
				error: function(xhr, ajaxOptions, thrownError) {
					if (bizamajig__config.bizamajig__debug === 'Y') {
						alert('readyState: ' + xhr.readyState + '\nstatus: ' + xhr.status);
						alert('responseText: ' + xhr.responseText);
						alert(thrownError);
					}
    			}
			});
		});
//		$("div[class='bizamajig-dataset-post bizamajig-bind-new blocks']")
		$("div[class='" + target_class + "']").removeClass('bizamajig-bind-new');

		return false;
	} // end function bizamajig__bind__membership_directory__post__show_detail( target_class, remove_this_refresh_class ) {

/*
********************************************************************************************************************************
********************************************************************************************************************************

	END Bizamajig Handlers - Membership Directory

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************
********************************************************************************************************************************

	START Bizamajig Handlers - Forum Listview

********************************************************************************************************************************
********************************************************************************************************************************
*/
/*
********************************************************************************************************************************

Purpose:
	
	Generate success message for posting a message.

History:

	ver		date			notes																				name
	----------------------------------------------------------------------------------------------------------------------------
	1.1		11-01-2009		Creation. 																			jahlife

Testing:

********************************************************************************************************************************
*/
	function bizamajig__slidetoggle__forum_listview__post()
	{
		$('.bizamajig-ui-status-success').slideDown(500).delay(1000).slideUp(500);                
	}

/*
********************************************************************************************************************************

Purpose:
	
	Manage infinite scroll for Forum Listview.

	This routine manages these globals:

		bizamajig__config.bizamajig__forum_listview__async
		bizamajig__config.bizamajig__forum_listview__eof
	
	After calling bizamajig__slidetoggle__forum_listview__post(), we call this function,
	bizamajig__forum_listview__refresh__timeline, to view all posts again.

History:

	ver		date			notes																				name
	----------------------------------------------------------------------------------------------------------------------------
	1.0		11-01-2009		Creation.					 														billy

Testing:

<div class="bizamajig-post-list"></div>

********************************************************************************************************************************
*/
	function bizamajig__forum_listview__refresh__timeline( target_container ) {
		if (bizamajig__config.bizamajig__debug === 'Y') {
			alert('CALL: bizamajig__forum_listview__refresh__timeline');
		}

		$.ajax({
			type: 'POST',
			url: '/include/_bizamajig-ap-search--simple--forum-listview-1.asp',
//			data: { primary_doc_group_id: $('#primary_doc_group_id').val(), process_desc: 'Articles', lookup_type_desc: 'All Articles', view_by_identifier_1: '%', category_doc_group_id: '-1', subcategory_doc_group_id: '-1', results_doc_id: '-1', lookup_location_id: '-1', lookup_dept_id: '-1' },
			data: { primary_doc_group_id: '', process_desc: 'Articles', lookup_type_desc: 'All Articles', view_by_identifier_1: '%', category_doc_group_id: '-1', subcategory_doc_group_id: '-1', results_doc_id: '-1', lookup_location_id: '-1', lookup_dept_id: '-1' },
			beforeSend: function() {
				bizamajig__loader__toggle( target_container, 'bizamajig-ui-progress', true );
			},
			complete: function() {
				bizamajig__loader__toggle( target_container, 'bizamajig-ui-progress', false );
			},
			success: function(response) {
//				$('#doc_section__detail').html(response)
				$(target_container).html(response)
//
//	linkify() will be applied by function, bizamajig__bind__forum_listview__post__show_detail, but
//	seems to be required here.
//
//				.linkify().find('a').attr('target','_blank')
				.fadeIn(1500, function() {
					bizamajig__config.bizamajig__forum_listview__eof = false;
					bizamajig__bind__forum_listview__post__show_detail('bizamajig-dataset', 'bizamajig-bind-new');
					if ( bizamajig__config.bizamajig_private_authentication_active_ind === 'Y' ) {
						bizamajig__bind__forum_listview__post__reply('bizamajig-dataset-reply', 'bizamajig-bind-new-reply');
					}
				});
			},
			error: function(xhr, ajaxOptions, thrownError) {
				if (bizamajig__config.bizamajig__debug === 'Y') {
					alert('readyState: ' + xhr.readyState + '\nstatus: ' + xhr.status);
					alert('responseText: ' + xhr.responseText);
					alert(thrownError);
				}
   			}
		});

	}

/*
********************************************************************************************************************************

Purpose:
	
	Display selected entry in Forum Listview.

History:

	ver		date			notes																				name
	----------------------------------------------------------------------------------------------------------------------------
	1.1		11-01-2009		Added .linkify().find('a').attr('target','_blank')									jahlife

Testing:

********************************************************************************************************************************
*/
	function bizamajig__bind__forum_listview__post__reply( target_class, remove_this_refresh_class ) {
		$("div[class='bizamajig-dataset-reply bizamajig-bind-new-reply']").click(function() {

			if (bizamajig__config.bizamajig__debug === 'Y') {
				alert('ONCLICK: .bizamajig-bind-new-reply');
			}

			var primary_doc_group_id = $(this).attr('primary_doc_group_id');
			var process_desc = $(this).attr('process_desc');
			var lookup_type_desc = $(this).attr('lookup_type_desc');
			var category_doc_group_id = $(this).attr('category_doc_group_id');
			var results_doc_id = $(this).attr('results_doc_id');
			var person_id = $(this).attr('person_id');
			var location_id = $(this).attr('location_id');

			if ( typeof primary_doc_group_id === 'undefined' ) {
				primary_doc_group_id = '-1';
			}

//
//			Define a dialog, and we will activate/open after we load our form below.
//
			$('#bizamajig-dialog-forum-listview-post-insert-reply').dialog({
				autoOpen:		false,
				title:			"Post a reply",
//				resize:			'auto',
//				autoResize:		true,
				width:			700,
				height:			'auto',
				position:		'center',
				modal:			true,
				resizable:		false,
				closeOnEscape:	false,
//				open: function() {
//					if ($(this).parent().height() > $(window).height()) {
//						$(this).height($(window).height()*0.7);
//					}
//					$(this).dialog({position: "center"});
//				},
				buttons: {
					'Ok': function() {
						if (bizamajig__config.bizamajig__debug === 'Y') {
							alert('OK: bizamajig-dialog-forum-listview-post-insert-reply');
						}
						$('.bizamajig-ui-error').hide();
						var doc_body_1 = $('textarea#doc_body_1').val();
						if (doc_body_1 === '') {
							$('label#error__doc_body_1').show();
							$('textarea#doc_body_1').focus();
							if (bizamajig__config.bizamajig__debug === 'Y') {
								alert('Error: doc_body_1');
							}
							return false;
						}
					
						var dataString = $('#bizamajig-form-forum-listview-post-reply-insert').serialize();

						$.ajax({
							type: 'POST',
							url: '/include/_bizamajig-form-forum-listview-post-reply-insert-submit.asp',
							data: dataString,
							success: function() {
								bizamajig__slidetoggle__forum_listview__post();
								bizamajig__forum_listview__refresh__timeline('.bizamajig-post-list');
							}, // end success: function() {
							error: function(xhr, ajaxOptions, thrownError) {
								if (bizamajig__config.bizamajig__debug === 'Y') {
									alert('readyState: ' + xhr.readyState + '\nstatus: ' + xhr.status);
									alert('responseText: ' + xhr.responseText);
									alert(thrownError);
								}
			                } // end error: function(xhr, ajaxOptions, thrownError) {
						}); // end $.ajax({

						$(this).dialog('close');
						return false;
				}
//				,
//				'Cancel': function() {
//					$(this).dialog("close"); 
//				}
				}
			});

//			$('#bizamajig-dialog-forum-listview-post-insert-reply').load('/include/_bizamajig-form-forum-listview-post-reply-insert.asp', { primary_doc_group_id: $('#primary_doc_group_id').val(), process_desc: 'Articles', lookup_type_desc: 'All Articles', view_by_identifier_1__forum_listview: '', category_doc_group_id: $(this).attr('category_doc_group_id'), results_doc_id: $(this).attr('results_doc_id'), person_id: $(this).attr('person_id'), location_id: $(this).attr('location_id'), lookup_location_id: '-1', lookup_dept_id: '-1' }, function(response, status, xhr) {
			$('#bizamajig-dialog-forum-listview-post-insert-reply').load('/include/_bizamajig-form-forum-listview-post-reply-insert.asp', { primary_doc_group_id: '', process_desc: 'Articles', lookup_type_desc: 'All Articles', view_by_identifier_1__forum_listview: '', category_doc_group_id: $(this).attr('category_doc_group_id'), results_doc_id: $(this).attr('results_doc_id'), person_id: $(this).attr('person_id'), location_id: $(this).attr('location_id'), lookup_location_id: '-1', lookup_dept_id: '-1' }, function(response, status, xhr) {
				$('.bizamajig-ui-error').hide();
//				$('input#hostName').focus();
//				bizamajig__bind__site_apps(this);
			}).fadeIn('slow');

		    $('#bizamajig-dialog-forum-listview-post-insert-reply').dialog('open');
			return false;
		});
//		$('.bizamajig-dataset-reply.bizamajig-bind-new-reply').removeClass('bizamajig-bind-new-reply');
		$("div[class='bizamajig-dataset-reply bizamajig-bind-new-reply']").removeClass('bizamajig-bind-new-reply');
		return false;
	} // end function bizamajig__bind__forum_listview__post__reply( target_class, remove_this_refresh_class ) {
	
/*
********************************************************************************************************************************

Purpose:
	
	Display selected entry in Forum Listview.

History:

	ver		date			notes																				name
	----------------------------------------------------------------------------------------------------------------------------
	1.1		11-01-2009		Added .linkify().find('a').attr('target','_blank')									jahlife

Testing:

********************************************************************************************************************************
*/
	function bizamajig__bind__forum_listview__post__show_detail( target_class, remove_this_refresh_class ) {
		$("div[class='bizamajig-dataset-post bizamajig-bind-new posts']").click(function(e) {

			if (bizamajig__config.bizamajig__debug === 'Y') {
				alert('ONCLICK: .bizamajig-dataset.bizamajig-bind-new');
			}

			var primary_doc_group_id = $(this).attr('data-primary_doc_group_id');
			var permalink_url = $(this).attr('data-permalink_url');
			var process_desc = $(this).attr('data-process_desc');
			var lookup_type_desc = $(this).attr('data-lookup_type_desc');
			var category_doc_group_id = $(this).attr('data-category_doc_group_id');
			var results_doc_id = $(this).attr('data-results_doc_id');
			var person_id = $(this).attr('data-person_id');
			var location_id = $(this).attr('data-location_id');

			$.ajax({
				type: 'POST',
				url: '/include/_bizamajig-forum-listview-post-x.asp',
				data: { primary_doc_group_id: primary_doc_group_id, process_desc: process_desc, lookup_type_desc: lookup_type_desc, category_doc_group_id: category_doc_group_id, results_doc_id: results_doc_id, person_id: person_id, location_id: location_id, permalink_url: permalink_url },
				success: function(response) {

//
//					When injecting this content, we will remove any existing upper level (parent container)
//					and target an included, next div with class="doc_section__container".
//
					$('.doc_section__container').find('img').remove();
//
//					Page Content Injections
//
//					$('#doc_section__detail').html(response).fadeIn(1500, function() {
//					$('.doc_section__container').html(response).fadeIn(1500, function() {
					$('.doc_section__contentarea').html(response).fadeIn(1500, function() {
//						if ( event_registration_indicator === 'Y' ) {
//							bizamajig__bind__forum_listview__post__reply('bizamajig-dataset-reply', 'bizamajig-bind-new-reply');
//						}
//						bizamajig__bind__autocomplete( 'Events', 'All Events', '%', '', '#view_by_identifier_1__ec_workspace', '/include/_ap-search-simple-public.asp', '', '#bizamajig-ui-grid-results' );

						if ( bizamajig__config.bizamajig_private_authentication_active_ind === 'Y' ) {
							bizamajig__bind__forum_listview__post__reply('bizamajig-dataset-reply', 'bizamajig-bind-new-reply');
						}

//						bizamajig__bind__sociable = function( scope__parent_container, target_container, target_content_permalink_url_01, target_content_title_01, target_content_message_01 )
						bizamajig__bind__sociable( { scope__parent_container: '.doc_section__contentarea', target_container: 'bizamajig-dub-socializer', target_content_permalink_url_01: permalink_url, target_content_title_01: '', target_content_message_01: '' });
					});


//
//	START STUB
//	We have stubbed the lightbox/sliding panel approach for now:
//
					if ( '1' === '0' ) {
//
//	Example: Get Content size after load 
//					$("#content").bind("resize", function(){  
//    	                $("#content").css({"height": $("#content").height() + 'px'});  
//                    }); 

/////////////////////////////////////////////////////////////////
//////THIS IS GOLD FOR RIGHT-SIDEBAR-EXPANDING///////////////////
//					var outer_height = Math.round( $(window).height() - 230 );
//					var inner_height = Math.round( $(window).height() - ( 245 + 30 /* $('#bizamajig-content-panel-detail-container-close').height() */ ) );
/////////////////////////////////////////////////////////////////
					var outer_height = Math.round( $(window).height() );
					var inner_height = Math.round( $(window).height() - ( 245 + 75 /* $('#bizamajig-content-panel-detail-container-close').height() */ ) );

/////////////////////////////////////////////////////////////////
//////THIS IS GOLD FOR RIGHT-SIDEBAR-EXPANDING///////////////////
//					$('#bizamajig-content-panel-detail-container').stop().animate({width: "440px", height: outer_height, opacity: "1"}, 250, function() {
/////////////////////////////////////////////////////////////////
					$('#bizamajig-content-panel-detail-container').stop().animate({opacity:1, width:bizamajig__config.metadata__container__layout__width__fixed_content, height:outer_height }, 250, function() {

//
//	Hide any behind-objects to keep the user experience clean.
//
						$('#bizamajig-ui-accordion-menu-vertical-site-toolbar').hide();
//						$('#bizamajig-ui-accordion-menu-vertical-site-toolbar').accordion("disable");
//						var disabled = $('#bizamajig-ui-accordion-menu-vertical-site-toolbar').accordion( "option", "disabled" );
//						alert(disabled);

/////////////////////////////////////////////////////////////////
//////THIS IS GOLD FOR RIGHT-SIDEBAR-EXPANDING///////////////////
//						$('#bizamajig-content-panel-detail').width(425);
/////////////////////////////////////////////////////////////////
						$('#bizamajig-content-panel-detail').width('100%');
						$('#bizamajig-content-panel-detail').height(inner_height);

						$('.content').html(response).linkify().find('a').attr('target','_blank').fadeIn('slow');
						if ( bizamajig__config.bizamajig_private_authentication_active_ind === 'Y' ) {
							bizamajig__bind__forum_listview__post__reply('bizamajig-dataset-reply', 'bizamajig-bind-new-reply');
						}

//
//	The above .animate has already set opacity to 1, and works fine in jQuery 1.4.2.
//	After jQuery 1.4.2, we are redundantly using fadeTo to set opacity to 1, to actually have the
//	panel be visible.  Might be a CSS issue, but this works in all browsers.
//	
						$(this).fadeTo('slow', 1);

					});

					$('#bizamajig-content-panel-detail-container-close').click(function() {
						$('#bizamajig-content-panel-detail-container').stop().animate({width:0, height:0, opacity:0}, 500);
						$('#bizamajig-content-panel-detail').width(0);
						$('#bizamajig-content-panel-detail').height(0);
						$('.content').empty();

//
//	Reset any objects that we have hidden above.
//
						$('#bizamajig-ui-accordion-menu-vertical-site-toolbar').show();
//						$('bizamajig-ui-accordion-menu-vertical-site-toolbar').accordion("enable");
//						disabled = $('#bizamajig-ui-accordion-menu-vertical-site-toolbar').accordion( "option", "disabled" );
//						alert(disabled);
					});
//
//	END STUB
//
					}

				},
				error: function(xhr, ajaxOptions, thrownError) {
					if (bizamajig__config.bizamajig__debug === 'Y') {
						alert('readyState: ' + xhr.readyState + '\nstatus: ' + xhr.status);
						alert('responseText: ' + xhr.responseText);
						alert(thrownError);
					}
    			}

			});
		});
//		$('.bizamajig-dataset.bizamajig-bind-new').removeClass('bizamajig-bind-new');
		$("div[class='bizamajig-dataset-post bizamajig-bind-new posts']").removeClass('bizamajig-bind-new');

		return false;
	} // end function bizamajig__bind__forum_listview__post__show_detail( target_class, remove_this_refresh_class ) {

/*
********************************************************************************************************************************

Purpose:
	
	Manage infinite scroll for Forum Listview.

	Note: This routine manages these globals:

		bizamajig__config.bizamajig__forum_listview__async
		bizamajig__config.bizamajig__forum_listview__eof
	
History:

	ver		date			notes																				name
	----------------------------------------------------------------------------------------------------------------------------
	1.0		11-01-2009		Creation.					 														billy

Testing:

********************************************************************************************************************************
*/
	function bizamajig__forum_listview__read_ahead() {
		if ( !bizamajig__config.bizamajig__forum_listview__async ) {
			if (bizamajig__config.bizamajig__debug === 'Y') {
				alert('ONCLICK: bizamajig__forum_listview__read_ahead');
			}
			var n_objects = $('#bizamajig__forum_listview > div').length;
			if ( n_objects > 0 ) {
				bizamajig__config.bizamajig__forum_listview__async = true;
				var start_doc_id = $('.bizamajig-dataset:last').attr("row_id");
				if ( ( typeof start_doc_id === 'undefined' ) || ( start_doc_id === '' ) ) {
					start_doc_id = '1';
				}

				var url = '/include/_bizamajig-ap-search--simple--forum-listview-read-ahead.asp';

				$.ajax({
					type: 'POST',
					url: url,
					data: { process_desc: 'Articles', lookup_type_desc: 'getLastPosts', view_by_identifier_1: '%', top_n: '20', start_doc_id: start_doc_id },
					beforeSend: function() {
						bizamajig__loader__toggle( '#doc_section__detail', 'bizamajig-ui-progress', true );
					},
					complete: function() {
						bizamajig__loader__toggle( '#doc_section__detail', 'bizamajig-ui-progress', false );
					},
					success: function(response) {

						if (response === '') {
							bizamajig__config.bizamajig__forum_listview__eof = true;
						}
						if (response != '') {
							$('.bizamajig-dataset:last').after(response)
//							.linkify().find('a').attr('target','_blank')
							.fadeIn(1500, function() {
								bizamajig__config.bizamajig__forum_listview__eof = false;
								bizamajig__bind__forum_listview__post__show_detail('bizamajig-dataset', 'bizamajig-bind-new');
								if ( bizamajig__config.bizamajig_private_authentication_active_ind === 'Y' ) {
									bizamajig__bind__forum_listview__post__reply('bizamajig-dataset-reply', 'bizamajig-bind-new-reply');
								}
							});
						}
						$('#bizamajig-loader-display').empty();
						bizamajig__config.bizamajig__forum_listview__async = false;

						return false; // stubbed
						
						$target_container = $('.masonry');

						$target_container.imagesLoaded(function(){
							masonry_options = {
								columnWidth: 	5,
								itemSelector:	'.' + bizamajig_blocks_item_selector,
								isAnimated: 	true
							};
							$target_container.masonry(masonry_options);
					 		$(window).resize(function() { // run masonry when window is resized.
								$target_container.masonry(masonry_options);
							}).resize();
						});
					},
					error: function(xhr, ajaxOptions, thrownError) {
						if (bizamajig__config.bizamajig__debug === 'Y') {
							alert('readyState: ' + xhr.readyState + '\nstatus: ' + xhr.status);
							alert('responseText: ' + xhr.responseText);
							alert(thrownError);
						}
		   			}
				});
			}
		}
		return false;
	}
	
/*
********************************************************************************************************************************
********************************************************************************************************************************

	END Bizamajig Handlers - Forum Listview

********************************************************************************************************************************
********************************************************************************************************************************
*/

/*
***************************************************************************
