
/* jquery.positionBy */
(function($){var A=function(a,b,c,d){this.x1=a;this.x2=c;this.y1=b;this.y2=d;};A.prototype.contains=function(a){return(this.x1<=a.x1&&a.x2<=this.x2)&&(this.y1<=a.y1&&a.y2<=this.y2);};A.prototype.transform=function(x,y){return new A(this.x1+x,this.y1+y,this.x2+x,this.y2+y);};$.fn.positionBy=function(q){var r=new Date();if(this.length==0){return this;}var q=$.extend({target:null,targetPos:null,elementPos:null,x:null,y:null,positions:null,addClass:false,force:false,container:window},q);if(q.x!=null){var s=q.x;var t=q.y;var u=0;var v=0;}else{var w=$($(q.target)[0]);var u=w.outerWidth();var v=w.outerHeight();var x=w.offset();var s=x.left;var t=x.top;}var y=s+u;var z=t+v;return this.each(function(){var c=$(this);if(!c.is(':visible')){c.css({left:-3000,top:-3000}).show();}var d=c.outerWidth();var e=c.outerHeight();var f=[];var g=[];f[0]=new A(y,t,y+d,t+e);g[0]=[1,7,4];f[1]=new A(y,z-e,y+d,z);g[1]=[0,6,4];f[2]=new A(y,z,y+d,z+e);g[2]=[1,3,10];f[3]=new A(y-d,z,y,z+e);g[3]=[1,6,10];f[4]=new A(s,z,s+d,z+e);g[4]=[1,6,9];f[5]=new A(s-d,z,s,z+e);g[5]=[6,4,9];f[6]=new A(s-d,z-e,s,z);g[6]=[7,1,4];f[7]=new A(s-d,t,s,t+e);g[7]=[6,0,4];f[8]=new A(s-d,t-e,s,t);g[8]=[7,9,4];f[9]=new A(s,t-e,s+d,t);g[9]=[0,7,4];f[10]=new A(y-d,t-e,y,t);g[10]=[0,7,3];f[11]=new A(y,t-e,y+d,t);g[11]=[0,10,3];f[12]=new A(y-d,t,y,t+e);g[12]=[13,7,10];f[13]=new A(y-d,z-e,y,z);g[13]=[12,6,3];f[14]=new A(s,z-e,s+d,z);g[14]=[15,1,4];f[15]=new A(s,t,s+d,t+e);g[15]=[14,0,9];if(q.positions!==null){var h=q.positions[0];}else if(q.targetPos!=null&&q.elementPos!=null){var h=[];h[0]=[];h[0][0]=15;h[0][1]=7;h[0][2]=8;h[0][3]=9;h[1]=[];h[1][0]=0;h[1][1]=12;h[1][2]=10;h[1][3]=11;h[2]=[];h[2][0]=2;h[2][1]=3;h[2][2]=13;h[2][3]=1;h[3]=[];h[3][0]=4;h[3][1]=5;h[3][2]=6;h[3][3]=14;var h=h[q.targetPos][q.elementPos];}var i=f[h];var j=h;if(!q.force){$window=$(window);var k=$window.scrollLeft();var l=$window.scrollTop();var m=new A(k,l,k+$window.width(),l+$window.height());var n;if(q.positions){n=q.positions;}else{n=[h];}var o=[];while(n.length>0){var p=n.shift();if(o[p]){continue;}o[p]=true;if(!m.contains(f[p])){if(q.positions===null){n=jQuery.merge(n,g[p]);}}else{i=f[p];break;}}}c.parents().each(function(){var a=$(this);if(a.css('position')!='static'){var b=a.offset();i=i.transform(-b.left,-b.top);return false;}});c.css({left:i.x1,top:i.y1});if(q.addClass){c.removeClass('positionBy0 positionBy1 positionBy2 positionBy3 positionBy4 positionBy5 '+'positionBy6 positionBy7 positionBy8 positionBy9 positionBy10 positionBy11 '+'positionBy12 positionBy13 positionBy14 positionBy15').addClass('positionBy'+p);}});};})(jQuery);

/* jquery.bgiframe */
(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie && parseFloat($.browser.version) < 7){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?'filter:Alpha(Opacity=\'0\');':'')+'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+'"/>';return this.each(function(){if($('> iframe.bgiframe',this).length==0)this.insertBefore(document.createElement(html),this.firstChild);});}return this;};})(jQuery);

/* jQuery.fn.pngFi */
(function(A){jQuery.fn.pngFix=function(D){D=jQuery.extend({blankgif:"blank.gif"},D);var C=(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)==4&&navigator.appVersion.indexOf("MSIE 5.5")!=-1);var B=(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)==4&&navigator.appVersion.indexOf("MSIE 6.0")!=-1);if(jQuery.browser.msie&&(C||B)){jQuery(this).find("img[@src$=.png]").each(function(){jQuery(this).attr("width",jQuery(this).width());jQuery(this).attr("height",jQuery(this).height());var L="";var G="";var F=(jQuery(this).attr("id"))?'id="'+jQuery(this).attr("id")+'" ':"";var M=(jQuery(this).attr("class"))?'class="'+jQuery(this).attr("class")+'" ':"";var I=(jQuery(this).attr("title"))?'title="'+jQuery(this).attr("title")+'" ':"";var J=(jQuery(this).attr("alt"))?'alt="'+jQuery(this).attr("alt")+'" ':"";var H=(jQuery(this).attr("align"))?"float:"+jQuery(this).attr("align")+";":"";var E=(jQuery(this).parent().attr("href"))?"cursor:hand;":"";if(this.style.border){L+="border:"+this.style.border+";";this.style.border="";};if(this.style.padding){L+="padding:"+this.style.padding+";";this.style.padding="";}if(this.style.margin){L+="margin:"+this.style.margin+";";this.style.margin="";};var K=(this.style.cssText);G+="<span "+F+M+I+J;G+='style="position:relative;white-space:pre-line;display:inline-block;background:transparent;'+H+E;G+="width:"+jQuery(this).width()+"px;height:"+jQuery(this).height()+"px;";G+="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+jQuery(this).attr("src")+"', sizingMethod='scale');";G+=K+'"></span>';if(L!=""){G='<span style="position:relative;display:inline-block;'+L+E+"width:"+jQuery(this).width()+"px;height:"+jQuery(this).height()+'px;">'+G+"</span>";}jQuery(this).hide();jQuery(this).after(G);});jQuery(this).find("*").each(function(){var F=jQuery(this).css("background-image");if(F.indexOf(".png")!=-1){var E=F.split('url("')[1].split('")')[0];jQuery(this).css("background-image","none");jQuery(this).get(0).runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+E+"',sizingMethod='scale')";}});jQuery(this).find("input[@src$=.png]").each(function(){var E=jQuery(this).attr("src");jQuery(this).get(0).runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+E+"', sizingMethod='scale');";jQuery(this).attr("src",D.blankgif);});}return jQuery;};})(jQuery);

/* jdMenu */
(function(D){function C(E){var F=D.data(D(E).parents().andSelf().filter("ul.jd_menu")[0],"jdMenuSettings");D("> li",E).bind("mouseenter.jdmenu mouseleave.jdmenu",function(G){D(this).toggleClass("jdm_hover");var H=D("> ul",this);if(H.length==1){clearTimeout(this.$jdTimer);var J=(G.type=="mouseenter");var I=(J?B:A);this.$jdTimer=setTimeout(function(){I(H[0],F.onAnimate,F.isVertical);},J?F.showDelay:F.hideDelay);}}).bind("click.jdmenu",function(H){var I=D("> ul",this);if(I.length==1&&(F.disableLinks==true||D(this).hasClass("accessible"))){B(I,F.onAnimate,F.isVertical);return false;}if(H.target==this){var J=D("> a",H.target).not(".accessible");if(J.length>0){var G=J[0];if(!G.onclick){window.open(G.href,G.target||"_self");}else{D(G).trigger("click");}}}if(F.disableLinks||(!F.disableLinks&&!D(this).parent().hasClass("jd_menu"))){D(this).parent().jdMenuHide();H.stopPropagation();}}).find("> a").bind("focus.jdmenu blur.jdmenu",function(G){var H=D(this).parents("li:eq(0)");if(G.type=="focus"){H.addClass("jdm_hover");}else{H.removeClass("jdm_hover");}}).filter(".accessible").bind("click.jdmenu",function(G){G.preventDefault();});}function B(H,G,F){var H=D(H);if(H.is(":visible")){return; }H.bgiframe();var E=H.parent();H.trigger("jdMenuShow").positionBy({target:E[0],targetPos:(F===true||!E.parent().hasClass("jd_menu")?1:3),elementPos:0,hideAfterPosition:true});if(!H.hasClass("jdm_events")){H.addClass("jdm_events");C(H);}E.addClass("jdm_active").siblings("li").find("> ul:eq(0):visible").each(function(){A(this);});if(G===undefined){H.show();}else{G.apply(H[0],[true]);}}function A(F,E){var F=D(F);D(".bgiframe",F).remove();F.filter(":not(.jd_menu)").find("> li > ul:eq(0):visible").each(function(){A(this);}).end();if(E===undefined){F.hide();}else{E.apply(F[0],[false]);}F.trigger("jdMenuHide").parents("li:eq(0)").removeClass("jdm_active jdm_hover").end().find("> li").removeClass("jdm_active jdm_hover");}D.fn.jdMenu=function(E){var E=D.extend({showDelay:200,hideDelay:500,disableLinks:true},E);if(!D.isFunction(E.onAnimate)){E.onAnimate=undefined;}return this.filter("ul.jd_menu").each(function(){D.data(this,"jdMenuSettings",D.extend({isVertical:D(this).hasClass("jd_menu_vertical")},E));C(this);});};D.fn.jdMenuUnbind=function(){D("ul.jdm_events",this).unbind(".jdmenu").find("> a").unbind(".jdmenu");};D.fn.jdMenuHide=function(){return this.filter("ul").each(function(){A(this);});};D(window).bind("click.jdmenu",function(){D("ul.jd_menu ul:visible").jdMenuHide();});})(jQuery);

/* jquery.selectboxes */
(function(h){h.fn.addOption=function(){var j=function(a,f,c,g){var d=document.createElement("option");d.value=f,d.text=c;var b=a.options;var e=b.length;if(!a.cache){a.cache={};for(var i=0;i<e;i++){a.cache[b[i].value]=i}}if(typeof a.cache[f]=="undefined")a.cache[f]=e;a.options[a.cache[f]]=d;if(g){d.selected=true}};var k=arguments;if(k.length==0)return this;var l=true;var m=false;var n,o,p;if(typeof(k[0])=="object"){m=true;n=k[0]}if(k.length>=2){if(typeof(k[1])=="boolean")l=k[1];else if(typeof(k[2])=="boolean")l=k[2];if(!m){o=k[0];p=k[1]}}this.each(function(){if(this.nodeName.toLowerCase()!="select")return;if(m){for(var a in n){j(this,a,n[a],l)}}else{j(this,o,p,l)}});return this};h.fn.ajaxAddOption=function(c,g,d,b,e){if(typeof(c)!="string")return this;if(typeof(g)!="object")g={};if(typeof(d)!="boolean")d=true;this.each(function(){var f=this;h.getJSON(c,g,function(a){h(f).addOption(a,d);if(typeof b=="function"){if(typeof e=="object"){b.apply(f,e)}else{b.call(f)}}})});return this};h.fn.removeOption=function(){var d=arguments;if(d.length==0)return this;var b=typeof(d[0]);var e,i;if(b=="string"||b=="object"||b=="function"){e=d[0];if(e.constructor==Array){var j=e.length;for(var k=0;k<j;k++){this.removeOption(e[k],d[1])}return this}}else if(b=="number")i=d[0];else return this;this.each(function(){if(this.nodeName.toLowerCase()!="select")return;if(this.cache)this.cache=null;var a=false;var f=this.options;if(!!e){var c=f.length;for(var g=c-1;g>=0;g--){if(e.constructor==RegExp){if(f[g].value.match(e)){a=true}}else if(f[g].value==e){a=true}if(a&&d[1]===true)a=f[g].selected;if(a){f[g]=null}a=false}}else{if(d[1]===true){a=f[i].selected}else{a=true}if(a){this.remove(i)}}});return this};h.fn.sortOptions=function(e){var i=h(this).selectedValues();var j=typeof(e)=="undefined"?true:!!e;this.each(function(){if(this.nodeName.toLowerCase()!="select")return;var c=this.options;var g=c.length;var d=[];for(var b=0;b<g;b++){d[b]={v:c[b].value,t:c[b].text}}d.sort(function(a,f){o1t=a.t.toLowerCase(),o2t=f.t.toLowerCase();if(o1t==o2t)return 0;if(j){return o1t<o2t?-1:1}else{return o1t>o2t?-1:1}});for(var b=0;b<g;b++){c[b].text=d[b].t;c[b].value=d[b].v}}).selectOptions(i,true);return this};h.fn.selectOptions=function(g,d){var b=g;var e=typeof(g);if(e=="object"&&b.constructor==Array){var i=this;h.each(b,function(){i.selectOptions(this,d)})};var j=d||false;if(e!="string"&&e!="function"&&e!="object")return this;this.each(function(){if(this.nodeName.toLowerCase()!="select")return this;var a=this.options;var f=a.length;for(var c=0;c<f;c++){if(b.constructor==RegExp){if(a[c].value.match(b)){a[c].selected=true}else if(j){a[c].selected=false}}else{if(a[c].value==b){a[c].selected=true}else if(j){a[c].selected=false}}}});return this};h.fn.copyOptions=function(g,d){var b=d||"selected";if(h(g).size()==0)return this;this.each(function(){if(this.nodeName.toLowerCase()!="select")return this;var a=this.options;var f=a.length;for(var c=0;c<f;c++){if(b=="all"||(b=="selected"&&a[c].selected)){h(g).addOption(a[c].value,a[c].text)}}});return this};h.fn.containsOption=function(g,d){var b=false;var e=g;var i=typeof(e);var j=typeof(d);if(i!="string"&&i!="function"&&i!="object")return j=="function"?this:b;this.each(function(){if(this.nodeName.toLowerCase()!="select")return this;if(b&&j!="function")return false;var a=this.options;var f=a.length;for(var c=0;c<f;c++){if(e.constructor==RegExp){if(a[c].value.match(e)){b=true;if(j=="function")d.call(a[c],c)}}else{if(a[c].value==e){b=true;if(j=="function")d.call(a[c],c)}}}});return j=="function"?this:b};h.fn.selectedValues=function(){var a=[];this.selectedOptions().each(function(){a[a.length]=this.value});return a};h.fn.selectedTexts=function(){var a=[];this.selectedOptions().each(function(){a[a.length]=this.text});return a};h.fn.selectedOptions=function(){return this.find("option:selected")}})(jQuery);

/* jquery.checkboxes */
(function(d){d.fn.toggleCheckboxes=function(a,b){a=a||"*";b=b||false;var c=d([]);this.each(function(){var e=d("input[type=checkbox]",this).filter(a).each(function(){this.checked=!this.checked}).filter(":checked");c=e});if(!b){c=this}return c};d.fn.checkCheckboxes=function(a,b){a=a||"*";b=b||false;var c=d([]);this.each(function(){var e=d("input[type=checkbox]",this).filter(a).each(function(){this.checked=true}).filter(":checked");c=e});if(!b){c=this}return c};d.fn.unCheckCheckboxes=function(a,b){a=a||"*";b=b||false;var c=d([]);this.each(function(){var e=d("input[type=checkbox]",this).filter(a).each(function(){this.checked=false}).filter(":not(:checked)");c=e});if(!b){c=this}return c};d.radioCheckboxGroup=function(e,a){a=a||"*";var b="input[type=checkbox]";if(e){b+="[name="+e+"]"}var c=d(b).filter(a);c.click(function(){c.not(this).each(function(){this.checked=false}).end()})}})(jQuery);

//jquery.md5.js
(function(E){var Q=function(G,F){return(G<<F)|(G>>>(32-F));};var A=function(S,G){var U,F,I,T,H;I=(S&2147483648);T=(G&2147483648);U=(S&1073741824);F=(G&1073741824);H=(S&1073741823)+(G&1073741823);if(U&F){return(H^2147483648^I^T)}if(U|F){if(H&1073741824){return(H^3221225472^I^T)}else{return(H^1073741824^I^T)}}else{return(H^I^T)}};var R=function(F,H,G){return(F&H)|((~F)&G)};var P=function(F,H,G){return(F&G)|(H&(~G))};var N=function(F,H,G){return(F^H^G)};var M=function(F,H,G){return(H^(F|(~G)))};var K=function(H,G,U,T,F,I,S){H=A(H,A(A(R(G,U,T),F),S));return A(Q(H,I),G)};var C=function(H,G,U,T,F,I,S){H=A(H,A(A(P(G,U,T),F),S));return A(Q(H,I),G)};var L=function(H,G,U,T,F,I,S){H=A(H,A(A(N(G,U,T),F),S));return A(Q(H,I),G)};var D=function(H,G,U,T,F,I,S){H=A(H,A(A(M(G,U,T),F),S));return A(Q(H,I),G)};var J=function(I){var V;var H=I.length;var G=H+8;var U=(G-(G%64))/64;var T=(U+1)*16;var W=Array(T-1);var F=0;var S=0;while(S<H){V=(S-(S%4))/4;F=(S%4)*8;W[V]=(W[V]|(I.charCodeAt(S)<<F));S++}V=(S-(S%4))/4;F=(S%4)*8;W[V]=W[V]|(128<<F);W[T-2]=H<<3;W[T-1]=H>>>29;return W};var B=function(I){var H="",F="",S,G;for(G=0;G<=3;G++){S=(I>>>(G*8))&255;F="0"+S.toString(16);H=H+F.substr(F.length-2,2)}return H};var O=function(G){G=G.replace(/\x0d\x0a/g,"\x0a");var F="";for(var I=0;I<G.length;I++){var H=G.charCodeAt(I);if(H<128){F+=String.fromCharCode(H)}else{if((H>127)&&(H<2048)){F+=String.fromCharCode((H>>6)|192);F+=String.fromCharCode((H&63)|128)}else{F+=String.fromCharCode((H>>12)|224);F+=String.fromCharCode(((H>>6)&63)|128);F+=String.fromCharCode((H&63)|128)}}}return F};E.extend({md5:function(F){var V=Array();var j,l,G,U,i,u,t,r,o;var g=7,e=12,Y=17,W=22;var s=5,p=9,n=14,m=20;var T=4,S=11,I=16,H=23;var h=6,f=10,Z=15,X=21;F=O(F);V=J(F);u=1732584193;t=4023233417;r=2562383102;o=271733878;for(j=0;j<V.length;j+=16){l=u;G=t;U=r;i=o;u=K(u,t,r,o,V[j+0],g,3614090360);o=K(o,u,t,r,V[j+1],e,3905402710);r=K(r,o,u,t,V[j+2],Y,606105819);t=K(t,r,o,u,V[j+3],W,3250441966);u=K(u,t,r,o,V[j+4],g,4118548399);o=K(o,u,t,r,V[j+5],e,1200080426);r=K(r,o,u,t,V[j+6],Y,2821735955);t=K(t,r,o,u,V[j+7],W,4249261313);u=K(u,t,r,o,V[j+8],g,1770035416);o=K(o,u,t,r,V[j+9],e,2336552879);r=K(r,o,u,t,V[j+10],Y,4294925233);t=K(t,r,o,u,V[j+11],W,2304563134);u=K(u,t,r,o,V[j+12],g,1804603682);o=K(o,u,t,r,V[j+13],e,4254626195);r=K(r,o,u,t,V[j+14],Y,2792965006);t=K(t,r,o,u,V[j+15],W,1236535329);u=C(u,t,r,o,V[j+1],s,4129170786);o=C(o,u,t,r,V[j+6],p,3225465664);r=C(r,o,u,t,V[j+11],n,643717713);t=C(t,r,o,u,V[j+0],m,3921069994);u=C(u,t,r,o,V[j+5],s,3593408605);o=C(o,u,t,r,V[j+10],p,38016083);r=C(r,o,u,t,V[j+15],n,3634488961);t=C(t,r,o,u,V[j+4],m,3889429448);u=C(u,t,r,o,V[j+9],s,568446438);o=C(o,u,t,r,V[j+14],p,3275163606);r=C(r,o,u,t,V[j+3],n,4107603335);t=C(t,r,o,u,V[j+8],m,1163531501);u=C(u,t,r,o,V[j+13],s,2850285829);o=C(o,u,t,r,V[j+2],p,4243563512);r=C(r,o,u,t,V[j+7],n,1735328473);t=C(t,r,o,u,V[j+12],m,2368359562);u=L(u,t,r,o,V[j+5],T,4294588738);o=L(o,u,t,r,V[j+8],S,2272392833);r=L(r,o,u,t,V[j+11],I,1839030562);t=L(t,r,o,u,V[j+14],H,4259657740);u=L(u,t,r,o,V[j+1],T,2763975236);o=L(o,u,t,r,V[j+4],S,1272893353);r=L(r,o,u,t,V[j+7],I,4139469664);t=L(t,r,o,u,V[j+10],H,3200236656);u=L(u,t,r,o,V[j+13],T,681279174);o=L(o,u,t,r,V[j+0],S,3936430074);r=L(r,o,u,t,V[j+3],I,3572445317);t=L(t,r,o,u,V[j+6],H,76029189);u=L(u,t,r,o,V[j+9],T,3654602809);o=L(o,u,t,r,V[j+12],S,3873151461);r=L(r,o,u,t,V[j+15],I,530742520);t=L(t,r,o,u,V[j+2],H,3299628645);u=D(u,t,r,o,V[j+0],h,4096336452);o=D(o,u,t,r,V[j+7],f,1126891415);r=D(r,o,u,t,V[j+14],Z,2878612391);t=D(t,r,o,u,V[j+5],X,4237533241);u=D(u,t,r,o,V[j+12],h,1700485571);o=D(o,u,t,r,V[j+3],f,2399980690);r=D(r,o,u,t,V[j+10],Z,4293915773);t=D(t,r,o,u,V[j+1],X,2240044497);u=D(u,t,r,o,V[j+8],h,1873313359);o=D(o,u,t,r,V[j+15],f,4264355552);r=D(r,o,u,t,V[j+6],Z,2734768916);t=D(t,r,o,u,V[j+13],X,1309151649);u=D(u,t,r,o,V[j+4],h,4149444226);o=D(o,u,t,r,V[j+11],f,3174756917);r=D(r,o,u,t,V[j+2],Z,718787259);t=D(t,r,o,u,V[j+9],X,3951481745);u=A(u,l);t=A(t,G);r=A(r,U);o=A(o,i)}var q=B(u)+B(t)+B(r)+B(o);return q.toLowerCase()}})})(jQuery);

/** jQuery.cookie **/
jQuery.cookie=function(B,I,L){if(typeof I!="undefined"){L=L||{};if(I===null){I="";L.expires=-1;}var E="";if(L.expires&&(typeof L.expires=="number"||L.expires.toUTCString)){var F;if(typeof L.expires=="number"){F=new Date();F.setTime(F.getTime()+(L.expires*24*60*60*1000));}else{F=L.expires;}E="; expires="+F.toUTCString();}var K=L.path?"; path="+(L.path):"";var G=L.domain?"; domain="+(L.domain):"";var A=L.secure?"; secure":"";document.cookie=[B,"=",encodeURIComponent(I),E,K,G,A].join("");}else{var D=null;if(document.cookie&&document.cookie!=""){var J=document.cookie.split(";");for(var H=0;H<J.length;H++){var C=jQuery.trim(J[H]);if(C.substring(0,B.length+1)==(B+"=")){D=decodeURIComponent(C.substring(B.length+1));break;}}}return D;}};

/* JSON */
if(!this.JSON){JSON={};}(function(){function f(n){return n<10?'0'+n:n;}if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return this.getUTCFullYear()+'-'+f(this.getUTCMonth()+1)+'-'+f(this.getUTCDate())+'T'+f(this.getUTCHours())+':'+f(this.getUTCMinutes())+':'+f(this.getUTCSeconds())+'Z';};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapeable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapeable.lastIndex=0;return escapeable.test(string)?'"'+string.replace(escapeable,function(a){var c=meta[a];if(typeof c==='string'){return c;}return'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}if(typeof rep==='function'){value=rep.call(holder,key,value);}switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}gap+=indent;partial=[];if(typeof value.length==='number'&&!value.propertyIsEnumerable('length')){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}v=partial.length===0?'[]':gap?'[\n'+gap+partial.join(',\n'+gap)+'\n'+mind+']':'['+partial.join(',')+']';gap=mind;return v;}if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}return str('',{'':value});};}if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}return reviver.call(holder,key,value);}cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}throw new SyntaxError('JSON.parse');};}})();

/* ########################### */

var _IS_IPAD     = navigator.userAgent.match(/iPad/i)   != null;
var _IS_IPHONE   = navigator.userAgent.match(/iPhone/i) != null;
var _IS_IPOD     = navigator.userAgent.match(/iPod/i)   != null;
var _IS_APLTOUCH = (_IS_IPAD || _IS_IPHONE || _IS_IPOD) ? true : false;
var _IS_TOUCH    = (_IS_APLTOUCH) ? true : false;
var _DEBUG       = true;
/* ########################### */


// NEW APPLICATION OBJECT //
var _app = {

        /*
         * Extending Objects
         * These objects will be extended by additional included code
         */
        
        _ctx:{},

        
        /* Properties
         * 
         */
        
        qstrParams:{},
        
        /* 
         * Functions & Objects
         */
        
        init:function()
        {
            this.qstr_parse();
        },
        
        prepareQueryString: function(v)
        {
            if(typeof(v) == 'object'){
                var q = '';
                for ( var k in v ) {
                    if(v[k] !== ''){
                        q += k + '=' + v[k] + '&';
                    }
                }
        
                return q.substring(0,(q.length-1));
            }
            else{
                return false;
            }
        },
        
        qstr_parse: function (qs,rv) 
        {
            this.qstrParams = {};
        
            if (qs === null){
               qs=location.search.substring(1,location.search.length);
            }
        
            if((typeof qs === 'undefined') || (qs.length === 0)){
                return;
            }
        
            // Turn <plus> back to <space>
            // See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1
            qs = qs.replace(/\+/g, ' ');
            var args = qs.split('&'); // parse out name/value pairs separated via &
        
            // split out each name=value pair
            for (var i=0;i<args.length;i++) {
                var value;
                var pair = args[i].split('=');
                var name = unescape(pair[0]);
        
                if (pair.length == 2){
                   value = unescape(pair[1]);
                }
                else{
                   value = name;
                }
        
                this.qstrParams[name] = value;
            }
        
            if(rv){
                return this.qstrParams;
            }
        },

        qstr_get: function(key, default_)
        {
            // This silly looking line changes UNDEFINED to NULL
            if (default_ === null) {default_ = null;}
        
            var value = this.qstrParams[key];
            if (value === null){ value = default_; }
        
            return value;
        },
        
        flushEmptyKeys: function(v)
        {
            var o = {};
            for ( var k in v ) {
                if(v[k] !== ''){
                    o[k] = v[k];
                }
            }
        
            return o;
        }
};

_app._ctx = {

        /*
         * Extending Objects
         * These objects will be extended by additional included code
         */
        _hasConsole:false,
        _googleAnalytics:{},
        _ga:this._googleAnalytics,
        
        /*
         * Properties
         */
        
        /*
         * Functions & Objects
         */
        init: function(options)
        {
            //this.setRequest();
        },
        
        setRequest: function(){

        }
};

_app._ctx._googleAnalytics = { // mimic GA object schema so that we can do local qualification before invocation
    vo:{
        linkerUrl:null,
        opt_pageURL:''
    },
    
    pageTracker:{
        _link: function(href){
            if(typeof pageTracker == 'object'){ // then _gat is loaded and assigned
                toConsole('SUCCESS running pageTracker._link');
                pageTracker._link(href);
            }
            else{
                toConsole('FAILED to run pageTracker._link');
            }
        },
        
        _trackPageview: function(){
            pageTracker._trackPageview(this.opt_pageURL);
        }
    },
    
    prepare:function(settings)
    {
        for(var i in settings){
            if(settings.hasOwnProperty(i)){ 
                this.vo.i = settings[i];
            }
        }   
    },
    
    prepareLink:function(href){  
        toConsole('Preparing link');
        this.vo.linkerUrl = pageTracker._getLinkerUrl(href);
    }
    
};

function toConsole(msg){
    if(_app._ctx._hasConsole) {
        if(($.browser.mozilla) || ($.browser.webkit)){
            console.info(msg);
        }
    }
}

/* Collect Google Analytics Event Calls */
function doTrackEvent(trackerToken){
    var c = trackerToken.split('-');
    _gaq.push([c[0], c[1].replace(/_/g,' '), c[2], c[3]]);
}

function clearCookie (cookie)
{
    if($.cookie){
        $.cookie(cookie,null);
        toConsole('Cookie Removed: ' + cookie);
    }
}

function getdigits (s) {
    return s.replace (/[^\d]/g, "");
}

$(document).ready(function(){
    _app._ctx._hasConsole = _DEBUG;
    _app._ctx.init();
    
    if($('ul.jd_menu').length > 0){
        toConsole('Main Nav Loaded');
        if(_IS_TOUCH){
            $('ul.jd_menu').jdMenu({disableLinks:true});
        }
        else{
            $('ul.jd_menu').jdMenu({disableLinks:false});
        }
    }

});



