// JavaScript Document

/*
	Javascript Document
	@Page:		UA/HOME
	Author:		Cre8tiveWeb.ca
	Website:	http://www.cre8tiveweb.ca/
	Copyright:	UpliftedAwareness.com
*/

/* - - - Start > ExtraJS <> 3rd Party Jquery Plugins - - - */

	// ColorBox v1.3.15 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
	// Copyright (c) 2010 Jack Moore - jack@colorpowered.com
	// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
	(function(b,ib){var t="none",M="LoadedContent",c=false,v="resize.",o="y",q="auto",e=true,L="nofollow",m="x";function f(a,c){a=a?' id="'+i+a+'"':"";c=c?' style="'+c+'"':"";return b("<div"+a+c+"/>")}function p(a,b){b=b===m?n.width():n.height();return typeof a==="string"?Math.round(/%/.test(a)?b/100*parseInt(a,10):parseInt(a,10)):a}function U(b){return a.photo||/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(b)}function cb(a){for(var c in a)if(b.isFunction(a[c])&&c.substring(0,2)!=="on")a[c]=a[c].call(l);a.rel=a.rel||l.rel||L;a.href=a.href||b(l).attr("href");a.title=a.title||l.title;return a}function w(c,a){a&&a.call(l);b.event.trigger(c)}function jb(){var b,e=i+"Slideshow_",c="click."+i,f,k;if(a.slideshow&&h[1]){f=function(){F.text(a.slideshowStop).unbind(c).bind(V,function(){if(g<h.length-1||a.loop)b=setTimeout(d.next,a.slideshowSpeed)}).bind(W,function(){clearTimeout(b)}).one(c+" "+N,k);j.removeClass(e+"off").addClass(e+"on");b=setTimeout(d.next,a.slideshowSpeed)};k=function(){clearTimeout(b);F.text(a.slideshowStart).unbind([V,W,N,c].join(" ")).one(c,f);j.removeClass(e+"on").addClass(e+"off")};a.slideshowAuto?f():k()}}function db(c){if(!O){l=c;a=cb(b.extend({},b.data(l,r)));h=b(l);g=0;if(a.rel!==L){h=b("."+G).filter(function(){return (b.data(this,r).rel||this.rel)===a.rel});g=h.index(l);if(g===-1){h=h.add(l);g=h.length-1}}if(!u){u=D=e;j.show();if(a.returnFocus)try{l.blur();b(l).one(eb,function(){try{this.focus()}catch(a){}})}catch(f){}x.css({opacity:+a.opacity,cursor:a.overlayClose?"pointer":q}).show();a.w=p(a.initialWidth,m);a.h=p(a.initialHeight,o);d.position(0);X&&n.bind(v+P+" scroll."+P,function(){x.css({width:n.width(),height:n.height(),top:n.scrollTop(),left:n.scrollLeft()})}).trigger("scroll."+P);w(fb,a.onOpen);Y.add(H).add(I).add(F).add(Z).hide();ab.html(a.close).show()}d.load(e)}}var gb={transition:"elastic",speed:300,width:c,initialWidth:"600",innerWidth:c,maxWidth:c,height:c,initialHeight:"450",innerHeight:c,maxHeight:c,scalePhotos:e,scrolling:e,inline:c,html:c,iframe:c,photo:c,href:c,title:c,rel:c,opacity:.9,preloading:e,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:c,returnFocus:e,loop:e,slideshow:c,slideshowAuto:e,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:c,onLoad:c,onComplete:c,onCleanup:c,onClosed:c,overlayClose:e,escKey:e,arrowKey:e},r="colorbox",i="cbox",fb=i+"_open",W=i+"_load",V=i+"_complete",N=i+"_cleanup",eb=i+"_closed",Q=i+"_purge",hb=i+"_loaded",E=b.browser.msie&&!b.support.opacity,X=E&&b.browser.version<7,P=i+"_IE6",x,j,A,s,bb,T,R,S,h,n,k,J,K,Z,Y,F,I,H,ab,B,C,y,z,l,g,a,u,D,O=c,d,G=i+"Element";d=b.fn[r]=b[r]=function(c,f){var a=this,d;if(!a[0]&&a.selector)return a;c=c||{};if(f)c.onComplete=f;if(!a[0]||a.selector===undefined){a=b("<a/>");c.open=e}a.each(function(){b.data(this,r,b.extend({},b.data(this,r)||gb,c));b(this).addClass(G)});d=c.open;if(b.isFunction(d))d=d.call(a);d&&db(a[0]);return a};d.init=function(){var l="hover",m="clear:left";n=b(ib);j=f().attr({id:r,"class":E?i+"IE":""});x=f("Overlay",X?"position:absolute":"").hide();A=f("Wrapper");s=f("Content").append(k=f(M,"width:0; height:0; overflow:hidden"),K=f("LoadingOverlay").add(f("LoadingGraphic")),Z=f("Title"),Y=f("Current"),I=f("Next"),H=f("Previous"),F=f("Slideshow").bind(fb,jb),ab=f("Close"));A.append(f().append(f("TopLeft"),bb=f("TopCenter"),f("TopRight")),f(c,m).append(T=f("MiddleLeft"),s,R=f("MiddleRight")),f(c,m).append(f("BottomLeft"),S=f("BottomCenter"),f("BottomRight"))).children().children().css({"float":"left"});J=f(c,"position:absolute; width:9999px; visibility:hidden; display:none");b("body").prepend(x,j.append(A,J));s.children().hover(function(){b(this).addClass(l)},function(){b(this).removeClass(l)}).addClass(l);B=bb.height()+S.height()+s.outerHeight(e)-s.height();C=T.width()+R.width()+s.outerWidth(e)-s.width();y=k.outerHeight(e);z=k.outerWidth(e);j.css({"padding-bottom":B,"padding-right":C}).hide();I.click(d.next);H.click(d.prev);ab.click(d.close);s.children().removeClass(l);b("."+G).live("click",function(a){if(!(a.button!==0&&typeof a.button!=="undefined"||a.ctrlKey||a.shiftKey||a.altKey)){a.preventDefault();db(this)}});x.click(function(){a.overlayClose&&d.close()});b(document).bind("keydown",function(b){if(u&&a.escKey&&b.keyCode===27){b.preventDefault();d.close()}if(u&&a.arrowKey&&!D&&h[1])if(b.keyCode===37&&(g||a.loop)){b.preventDefault();H.click()}else if(b.keyCode===39&&(g<h.length-1||a.loop)){b.preventDefault();I.click()}})};d.remove=function(){j.add(x).remove();b("."+G).die("click").removeData(r).removeClass(G)};d.position=function(f,d){function b(a){bb[0].style.width=S[0].style.width=s[0].style.width=a.style.width;K[0].style.height=K[1].style.height=s[0].style.height=T[0].style.height=R[0].style.height=a.style.height}var e,h=Math.max(document.documentElement.clientHeight-a.h-y-B,0)/2+n.scrollTop(),g=Math.max(n.width()-a.w-z-C,0)/2+n.scrollLeft();e=j.width()===a.w+z&&j.height()===a.h+y?0:f;A[0].style.width=A[0].style.height="9999px";j.dequeue().animate({width:a.w+z,height:a.h+y,top:h,left:g},{duration:e,complete:function(){b(this);D=c;A[0].style.width=a.w+z+C+"px";A[0].style.height=a.h+y+B+"px";d&&d()},step:function(){b(this)}})};d.resize=function(b){if(u){b=b||{};if(b.width)a.w=p(b.width,m)-z-C;if(b.innerWidth)a.w=p(b.innerWidth,m);k.css({width:a.w});if(b.height)a.h=p(b.height,o)-y-B;if(b.innerHeight)a.h=p(b.innerHeight,o);if(!b.innerHeight&&!b.height){b=k.wrapInner("<div style='overflow:auto'></div>").children();a.h=b.height();b.replaceWith(b.children())}k.css({height:a.h});d.position(a.transition===t?0:a.speed)}};d.prep=function(m){var c="hidden";function l(s){var p,f,m,c,l=h.length,q=a.loop;d.position(s,function(){function s(){E&&j[0].style.removeAttribute("filter")}if(u){E&&o&&k.fadeIn(100);k.show();w(hb);Z.show().html(a.title);if(l>1){typeof a.current==="string"&&Y.html(a.current.replace(/\{current\}/,g+1).replace(/\{total\}/,l)).show();I[q||g<l-1?"show":"hide"]().html(a.next);H[q||g?"show":"hide"]().html(a.previous);p=g?h[g-1]:h[l-1];m=g<l-1?h[g+1]:h[0];a.slideshow&&F.show();if(a.preloading){c=b.data(m,r).href||m.href;f=b.data(p,r).href||p.href;c=b.isFunction(c)?c.call(m):c;f=b.isFunction(f)?f.call(p):f;if(U(c))b("<img/>")[0].src=c;if(U(f))b("<img/>")[0].src=f}}K.hide();a.transition==="fade"?j.fadeTo(e,1,function(){s()}):s();n.bind(v+i,function(){d.position(0)});w(V,a.onComplete)}})}if(u){var o,e=a.transition===t?0:a.speed;n.unbind(v+i);k.remove();k=f(M).html(m);k.hide().appendTo(J.show()).css({width:function(){a.w=a.w||k.width();a.w=a.mw&&a.mw<a.w?a.mw:a.w;return a.w}(),overflow:a.scrolling?q:c}).css({height:function(){a.h=a.h||k.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}()}).prependTo(s);J.hide();b("#"+i+"Photo").css({cssFloat:t,marginLeft:q,marginRight:q});X&&b("select").not(j.find("select")).filter(function(){return this.style.visibility!==c}).css({visibility:c}).one(N,function(){this.style.visibility="inherit"});a.transition==="fade"?j.fadeTo(e,0,function(){l(0)}):l(e)}};d.load=function(u){var n,c,s,q=d.prep;D=e;l=h[g];u||(a=cb(b.extend({},b.data(l,r))));w(Q);w(W,a.onLoad);a.h=a.height?p(a.height,o)-y-B:a.innerHeight&&p(a.innerHeight,o);a.w=a.width?p(a.width,m)-z-C:a.innerWidth&&p(a.innerWidth,m);a.mw=a.w;a.mh=a.h;if(a.maxWidth){a.mw=p(a.maxWidth,m)-z-C;a.mw=a.w&&a.w<a.mw?a.w:a.mw}if(a.maxHeight){a.mh=p(a.maxHeight,o)-y-B;a.mh=a.h&&a.h<a.mh?a.h:a.mh}n=a.href;K.show();if(a.inline){f().hide().insertBefore(b(n)[0]).one(Q,function(){b(this).replaceWith(k.children())});q(b(n))}else if(a.iframe){j.one(hb,function(){var c=b("<iframe frameborder='0' style='width:100%; height:100%; border:0; display:block'/>")[0];c.name=i+ +new Date;c.src=a.href;if(!a.scrolling)c.scrolling="no";if(E)c.allowtransparency="true";b(c).appendTo(k).one(Q,function(){c.src="//about:blank"})});q(" ")}else if(a.html)q(a.html);else if(U(n)){c=new Image;c.onload=function(){var e;c.onload=null;c.id=i+"Photo";b(c).css({border:t,display:"block",cssFloat:"left"});if(a.scalePhotos){s=function(){c.height-=c.height*e;c.width-=c.width*e};if(a.mw&&c.width>a.mw){e=(c.width-a.mw)/c.width;s()}if(a.mh&&c.height>a.mh){e=(c.height-a.mh)/c.height;s()}}if(a.h)c.style.marginTop=Math.max(a.h-c.height,0)/2+"px";h[1]&&(g<h.length-1||a.loop)&&b(c).css({cursor:"pointer"}).click(d.next);if(E)c.style.msInterpolationMode="bicubic";setTimeout(function(){q(c)},1)};setTimeout(function(){c.src=n},1)}else n&&J.load(n,function(d,c,a){q(c==="error"?"Request unsuccessful: "+a.statusText:b(this).children())})};d.next=function(){if(!D){g=g<h.length-1?g+1:0;d.load()}};d.prev=function(){if(!D){g=g?g-1:h.length-1;d.load()}};d.close=function(){if(u&&!O){O=e;u=c;w(N,a.onCleanup);n.unbind("."+i+" ."+P);x.fadeTo("fast",0);j.stop().fadeTo("fast",0,function(){w(Q);k.remove();j.add(x).css({opacity:1,cursor:q}).hide();setTimeout(function(){O=c;w(eb,a.onClosed)},1)})}};d.element=function(){return b(l)};d.settings=gb;b(d.init)})(jQuery,this);

	/**
	 * jQuery.ScrollTo - Easy element scrolling using jQuery.
	 * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
	 * Dual licensed under MIT and GPL.
	 * Date: 5/25/2009
	 * @author Ariel Flesler
	 * @version 1.4.2
	 *
	 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
	 */
	;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);

	/*
	 * jQuery Tools 1.2.5 - The missing UI library for the Web
	 * [tooltip, tooltip.slide, tooltip.dynamic]
	 * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
	 * http://flowplayer.org/tools/
	 * File generated: Mon Feb 07 12:49:04 GMT 2011
	 */
	(function(f){function p(a,b,c){var h=c.relative?a.position().top:a.offset().top,d=c.relative?a.position().left:a.offset().left,i=c.position[0];h-=b.outerHeight()-c.offset[0];d+=a.outerWidth()+c.offset[1];if(/iPad/i.test(navigator.userAgent))h-=f(window).scrollTop();var j=b.outerHeight()+a.outerHeight();if(i=="center")h+=j/2;if(i=="bottom")h+=j;i=c.position[1];a=b.outerWidth()+a.outerWidth();if(i=="center")d-=a/2;if(i=="left")d-=a;return{top:h,left:d}}function u(a,b){var c=this,h=a.add(c),d,i=0,j=
	0,m=a.attr("title"),q=a.attr("data-tooltip"),r=o[b.effect],l,s=a.is(":input"),v=s&&a.is(":checkbox, :radio, select, :button, :submit"),t=a.attr("type"),k=b.events[t]||b.events[s?v?"widget":"input":"def"];if(!r)throw'Nonexistent effect "'+b.effect+'"';k=k.split(/,\s*/);if(k.length!=2)throw"Tooltip: bad events configuration for "+t;a.bind(k[0],function(e){clearTimeout(i);if(b.predelay)j=setTimeout(function(){c.show(e)},b.predelay);else c.show(e)}).bind(k[1],function(e){clearTimeout(j);if(b.delay)i=
	setTimeout(function(){c.hide(e)},b.delay);else c.hide(e)});if(m&&b.cancelDefault){a.removeAttr("title");a.data("title",m)}f.extend(c,{show:function(e){if(!d){if(q)d=f(q);else if(b.tip)d=f(b.tip).eq(0);else if(m)d=f(b.layout).addClass(b.tipClass).appendTo(document.body).hide().append(m);else{d=a.next();d.length||(d=a.parent().next())}if(!d.length)throw"Cannot find tooltip for "+a;}if(c.isShown())return c;d.stop(true,true);var g=p(a,d,b);b.tip&&d.html(a.data("title"));e=e||f.Event();e.type="onBeforeShow";
	h.trigger(e,[g]);if(e.isDefaultPrevented())return c;g=p(a,d,b);d.css({position:"absolute",top:g.top,left:g.left});l=true;r[0].call(c,function(){e.type="onShow";l="full";h.trigger(e)});g=b.events.tooltip.split(/,\s*/);if(!d.data("__set")){d.bind(g[0],function(){clearTimeout(i);clearTimeout(j)});g[1]&&!a.is("input:not(:checkbox, :radio), textarea")&&d.bind(g[1],function(n){n.relatedTarget!=a[0]&&a.trigger(k[1].split(" ")[0])});d.data("__set",true)}return c},hide:function(e){if(!d||!c.isShown())return c;
	e=e||f.Event();e.type="onBeforeHide";h.trigger(e);if(!e.isDefaultPrevented()){l=false;o[b.effect][1].call(c,function(){e.type="onHide";h.trigger(e)});return c}},isShown:function(e){return e?l=="full":l},getConf:function(){return b},getTip:function(){return d},getTrigger:function(){return a}});f.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(e,g){f.isFunction(b[g])&&f(c).bind(g,b[g]);c[g]=function(n){n&&f(c).bind(g,n);return c}})}f.tools=f.tools||{version:"1.2.5"};f.tools.tooltip=
	{conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,position:["top","center"],offset:[0,0],relative:false,cancelDefault:true,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"<div/>",tipClass:"tooltip"},addEffect:function(a,b,c){o[a]=[b,c]}};var o={toggle:[function(a){var b=this.getConf(),c=this.getTip();b=b.opacity;b<1&&c.css({opacity:b});c.show();a.call()},function(a){this.getTip().hide();
	a.call()}],fade:[function(a){var b=this.getConf();this.getTip().fadeTo(b.fadeInSpeed,b.opacity,a)},function(a){this.getTip().fadeOut(this.getConf().fadeOutSpeed,a)}]};f.fn.tooltip=function(a){var b=this.data("tooltip");if(b)return b;a=f.extend(true,{},f.tools.tooltip.conf,a);if(typeof a.position=="string")a.position=a.position.split(/,?\s/);this.each(function(){b=new u(f(this),a);f(this).data("tooltip",b)});return a.api?b:this}})(jQuery);
	(function(d){var i=d.tools.tooltip;d.extend(i.conf,{direction:"up",bounce:false,slideOffset:10,slideInSpeed:200,slideOutSpeed:200,slideFade:!d.browser.msie});var e={up:["-","top"],down:["+","top"],left:["-","left"],right:["+","left"]};i.addEffect("slide",function(g){var a=this.getConf(),f=this.getTip(),b=a.slideFade?{opacity:a.opacity}:{},c=e[a.direction]||e.up;b[c[1]]=c[0]+"="+a.slideOffset;a.slideFade&&f.css({opacity:0});f.show().animate(b,a.slideInSpeed,g)},function(g){var a=this.getConf(),f=a.slideOffset,
	b=a.slideFade?{opacity:0}:{},c=e[a.direction]||e.up,h=""+c[0];if(a.bounce)h=h=="+"?"-":"+";b[c[1]]=h+"="+f;this.getTip().animate(b,a.slideOutSpeed,function(){d(this).hide();g.call()})})})(jQuery);
	(function(g){function j(a){var c=g(window),d=c.width()+c.scrollLeft(),h=c.height()+c.scrollTop();return[a.offset().top<=c.scrollTop(),d<=a.offset().left+a.width(),h<=a.offset().top+a.height(),c.scrollLeft()>=a.offset().left]}function k(a){for(var c=a.length;c--;)if(a[c])return false;return true}var i=g.tools.tooltip;i.dynamic={conf:{classNames:"top right bottom left"}};g.fn.dynamic=function(a){if(typeof a=="number")a={speed:a};a=g.extend({},i.dynamic.conf,a);var c=a.classNames.split(/\s/),d;this.each(function(){var h=
	g(this).tooltip().onBeforeShow(function(e,f){e=this.getTip();var b=this.getConf();d||(d=[b.position[0],b.position[1],b.offset[0],b.offset[1],g.extend({},b)]);g.extend(b,d[4]);b.position=[d[0],d[1]];b.offset=[d[2],d[3]];e.css({visibility:"hidden",position:"absolute",top:f.top,left:f.left}).show();f=j(e);if(!k(f)){if(f[2]){g.extend(b,a.top);b.position[0]="top";e.addClass(c[0])}if(f[3]){g.extend(b,a.right);b.position[1]="right";e.addClass(c[1])}if(f[0]){g.extend(b,a.bottom);b.position[0]="bottom";e.addClass(c[2])}if(f[1]){g.extend(b,
	a.left);b.position[1]="left";e.addClass(c[3])}if(f[0]||f[2])b.offset[0]*=-1;if(f[1]||f[3])b.offset[1]*=-1}e.css({visibility:"visible"}).hide()});h.onBeforeShow(function(){var e=this.getConf();this.getTip();setTimeout(function(){e.position=[d[0],d[1]];e.offset=[d[2],d[3]]},0)});h.onHide(function(){var e=this.getTip();e.removeClass(a.classNames)});ret=h});return a.api?ret:this}})(jQuery);

	/**
	 * JQuery URL Parser
	 * Written by Mark Perkins, mark@allmarkedup.com
	 * License: http://unlicense.org/ (i.e. do what you want with it!)
	 * https://github.com/allmarkedup/jQuery-URL-Parser/blob/master/jquery.url.js
	 */
	eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('o.j=7(){4 9={};4 3={};4 5={j:H.K,v:G,8:["Z","B","19","17","X","P","u","k","O","h","N","Q","S","18"],q:{y:"t",l:/(?:^|&)([^&=]*)=?([^&]*)/g},l:{r:/^(?:([^:\\/?#]+):)?(?:\\/\\/((?:(([^:@]*):?([^:@]*))?@)?([^:\\/?#]*)(?::(\\d*))?))?((((?:[^?#\\/]*\\/)*)([^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,D:/^(?:(?![^:@]+:[^:@\\/]*@)([^:\\/?#.]+):)?(?:\\/\\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/}};4 E=7(){C=T(5.j);4 m=5.l[5.v?"r":"D"].V(C);4 b={};4 i=14;M(i--){b[5.8[i]]=m[i]||""}b[5.q.y]={};b[5.8[12]].W(5.q.l,7($0,$1,$2){a($1){b[5.q.y][$1]=$2}});6 b};4 8=7(8){a(o.z(3)){f()}a(8=="15"){a(3.k!==c&&3.k!==""){6 3.B+"://"+3.u+":"+3.k+"/"}Y{6 3.B+"://"+3.u+"/"}}6(3[8]==="")?c:3[8]};4 A=7(s){a(o.z(3)){f()}6(3.t[s]===c)?c:3.t[s]};4 f=7(){3=E();F()};4 F=7(){4 p=3.h;9=[];9=3.h.n==1?{}:(p.1a(p.n-1)=="/"?p.L(1,p.n-1):h=p.L(1)).11("/")};6{16:7(J){5.v=J=="r"?10:G;6 I},13:7(x){5.j=x===w?H.K:x;f();6 I},R:7(e){a(o.z(3)){f()}a(e===w){6 9.n}6(9[e]===""||9[e]===w)?c:9[e]},U:8,A:A}}();',62,73,'|||parsed|var|options|return|function|key|segments|if|uri|null||pos|setUp||path||url|port|parser||length|jQuery|||strict|item|queryKey|host|strictMode|undefined|newUri|name|isEmptyObject|param|protocol|str|loose|parseUri|getSegments|false|window|this|mode|location|substring|while|directory|relative|password|file|segment|query|decodeURI|attr|exec|replace|user|else|source|true|split||setUrl||base|setMode|userInfo|anchor|authority|charAt'.split('|'),0,{}))

/* - - - __End > ExtraJS <> 3rd Party Jquery Plugins - - - */

/* - - - __Start > Load Constants - - - */
	var surl = jQuery.url.attr("protocol") + '://' + document.domain + '/';
	var tpl_img = surl + 'template/classic/img/';
	var tpl_js = surl + 'template/classic/js/';
	var mod_path = surl + '_ua.backbone/mod/uaf/';		/* Front End Modules */
	var w = 'home';
	var st_loaded = false;
	
	function the_query( the_href ){
		var tmp = the_href;
		return tmp.replace( '#!?' , '' );
	}
	
	function string_splitter( the_string , s ){
		var tmp = the_string;
		return tmp.split( s );
	}
/* - - - __End > Load Constants - - - */

/* - - - __Start > IE BLOCKER & BROWSER COMPATIBLE FIXES - - - */
	var icoTO;
	$(window).resize(function(){
		$('.ico_cart_ctr').hide();
		clearTimeout( icoTO );
		icoTO = setTimeout( function(){ cart_renotify(); } , 1000 );
	});
	$(document).ready(function(){
		jQuery.fx.interval = 14;
		if($.browser.msie && parseFloat( $.browser.version ) < 9){
			$.colorbox({
				transition : 'none' ,
				html: '<div class="special_background" style="width: 400px; height: auto; padding: 20px; float: left; text-shadow: #FFF 1px 1px 0; cursor: default;">'+
					  '<p style="margin: 0 0 5px 0; padding: 0;"><strong style="font-size: 16px; color: #CC0000;">Dang... Internet Explorer Detected</strong></p>'+
					  '<span style="font-size: 12px;"><strong style="font-size: 14px;"><em>Internet Explorer is currently not fully supported.</em></strong></span><br /><br /><span style="font-size: 11px;">Download any of the <strong>Safer</strong>, <strong>Better</strong> &amp; <strong>Faster</strong> Web Broswers below:<br /><br /></span> &nbsp; &nbsp; - <a href="http://www.mozilla.com/en-US/firefox/" style="font-size: 11px;" class="blue_link favelist_launc" target="_blank">Mozilla Firefox</a> <br />  &nbsp; &nbsp; - <a href="http://www.google.com/chrome" style="font-size: 11px;" class="blue_link favelist_launc" target="_blank">Google Chrome</a> <br />  &nbsp; &nbsp; - <a href="http://www.opera.com/" style="font-size: 11px;" class="blue_link favelist_launc" target="_blank">Opera Browser</a><br /><br /><em style="font-size: 11px; color: #999">Press the "Close" button to proceed browsing <strong>OpenMindsEnt.</strong> website using Internet Explorer Browser.</em>'+
					  '</div>',
				scrolling : false
			});
		}
		if($.browser.mozilla){
			$('.search').css( 'padding' , '2px 5px 2px 7px' );
		}
	});
/* - - - __End > IE BLOCKER & BROWSER COMPATIBLE FIXES  - - - */


/* - - - __Start > Home JS - - - */

	var gid = '';
	$(document).ready(function(){
		window.name = 'external';
		$('.faveLISTLauncher').click(function(evt){
			evt.preventDefault();
			window.open($(this).attr('href'),'faveLIST Player','width=650,height=500');
		});
		$('.glink').mouseover(function(){
			$('.genre_sub').slideUp('fast');
			$('#'+$(this).attr('show_sub_id')).slideDown('fast');
		});
		$('.mlink').mouseenter(function(){
			$('.sub_menu').slideUp('fast');
			$($(this).attr('show_sub_id')).slideDown('fast');
		});
		$('.smbeats_menu').click(function( evt ){
			evt.preventDefault();

			var tmp = this.id;
			var bid = tmp.split('_');
	
			$('.smbeats_menu').removeClass('smbeats_menu_act');
			$(this).addClass('smbeats_menu_act');
	
			var the_href = $(this).attr( 'href' );
	
			create_beat_block();

			/* Insert the AJAX stuff here... */
			$.ajax({
				url: mod_path + 'ajax_set-beat-filters.php', data: the_query( the_href ),
				success: function(data){
					$('.beat_reloader_overlay').fadeOut( 'slow' );
					setTimeout( function(){ reload_beats( 'the_beats_main' , 'latest' , gid ); } , 300 );
					if($('#the_beats_main_featured').length){
						setTimeout( function(){ reload_beats( 'the_beats_main_featured' , 'featured' , gid ); } , 600 );
					}
				}
			});
		});
		$('#cart_link').tooltip({position: 'top center',effect : 'slide',tipClass: 'fbtip-auto'});
	});
	reloadable();
	function reloadable(){

	$(document).ready(function(){


		cart_renotify();

		/* - - - __Start > ADD TO CART : JS - - - */
		/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

			$('.playBeat').click(function(){
				$('.uapn').html( '' );
				$('.playBeat').css('display','block');
				var query = getVARS(this.href);
				if(query.length > 0){
					$("#"+this.id).fadeOut('slow',function(){
						var qid = query[0]; var qrs = query[1]; var qval = qrs.split(",");
						$('#'+this.id+'_main').flash({ width: 366, height: 41, wmode: 'transparent', swf: '/_ua.backbone/fla/uaplayer.swf', flashvars: { bid: $(this).attr('the_bid') , path: surl , ver: 0 } });
					});
				}
			});

			$('.beat_add2cart').click(function(evt){
				evt.preventDefault();
				var tmp = this.id;
				var bid = tmp.replace(/beat_add2cart_/,'');

				//if(bviews.VIEW == 'lview'){
					$('#win_modal').remove();
					var rev = '<div id="win_modal" class="reveal-modal" style="height: auto;"><div id="beat_transactions_'+bid+'" style="position:relative;"></div><a class="close-reveal-modal">&#215;</a></div>';
					$('body').append( rev );
					$('#win_modal').reveal({ dismissmodalclass : 'close-reveal-modal' });
					$.colorbox.close();
				//}


				$('.beat_transactions').fadeOut('fast');
				$('#beat_transactions_'+bid).children().remove();

				var the_href = $(this).attr( 'href' );
				$('#beat_transactions_'+bid).fadeIn( 'normal' , function(){
					$('#beat_transactions_'+bid).html('<div style="text-align: center; color: #333; cursor: default;"><img src="'+tpl_img+'cart-loader.gif" style="margin: 30px 0 0 0;"><br /><strong style="font-size: 14px;">Processing Request,</strong><br />please be patient.<br /><br /><a href="javascript:void(0);" class="red_link hide_beat_transactions" style="float: inherit; font-size: 10px;">[CANCEL]</a></div>');
					$('.hide_beat_transactions').click(function(){ $('.beat_transactions').fadeOut('fast' , function(){ $('.beat_transactions').children().remove(); }); });

					$.ajax({
						type: 'GET',
						url: mod_path + 'ajax_add-beat-to-cart.php', data: the_query( the_href ), cache: false,
						success: function( data ){
							$('#beat_transactions_'+bid).html( data );
							//if(bviews.VIEW == 'lview')
								$('.hide_beat_transactions').fadeOut();
						},
						error: function(){
							$('#beat_transactions_'+bid).html(
								'<div class="s_icons ico_min hide_beat_transactions" title="Hide Add to Cart"></div>'+
								'<div style="text-align: center; color: #333; cursor: default; margin-top: 50px; padding: 4%; width: 92%;">'+
								'<strong>Problem connecting to server.</strong><br />Please try again later.<br /><br /><a href="'+surl+'contact" class="red_link" style="font-size: 10px;">REPORT PROBLEM</a>'+
								'</div>' );
							$('.hide_beat_transactions').click(function(){ $('.beat_transactions').fadeOut('fast' , function(){ $('.beat_transactions').children().remove(); }); });
							//if(bviews.VIEW == 'lview')
								$('.hide_beat_transactions').fadeOut();
						}
					});

				});
			});

			$('.hide_beat_transactions').click(function(){ $('.beat_transactions').fadeOut('fast' , function(){ $('.beat_transactions').children().remove(); }); });
		/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
		/* - - - __End > ADD TO CART : JS - - - */

		/* - - - __Start > FREE DOWNLOAD : JS - - - */
		/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

			$('.beat_fDownload').click(function(evt){
				evt.preventDefault();
				var bid = $(this).attr('bid');
				/* Validate if this Beat can be Downloaded */
				$.ajax({
					type:		'GET',
					cache:		false,
					url:		mod_path + 'ajax_free-download.php',
					data:		the_query( $(this).attr('href') ),
					success:	function(data){
						var d = jQuery.parseJSON(data);
						if(!d.result){
							/* Display Problem Info */
							if(d.err == 'login')
								load_login('free_download');
							else if(d.err == 'not_subscribed')
								load_subscribe_page();
						}else{
							/* Proceed with download */
							window.location.href = '/free-download/'+bid;
						}
					}
				});
				
			});

		/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
		/* - - - __End > END FREE DOWNLOAD : JS - - - */

		$('.bsharer').click(function(evt){
			evt.preventDefault();
			$('.cancel_sharing').unbind( 'click' );

			/* Load Share Box */
			var idEX = string_splitter( $(this).attr('id') , '_' );
			var the_id = idEX[2];
			var beat_con = $('#beat_thumb_'+the_id);
			var pos = beat_con.position();

			$('#theshare_box_'+the_id).css ( 'top' , pos.top + 'px' );
			$('#theshare_box_'+the_id).css ( 'left' , pos.left + 6 + 'px' );
			$('#theshare_box_'+the_id).fadeIn( 'fast' );

			$('.cancel_sharing').click(function(evt){
				evt.preventDefault();
				$('.theshare_box').fadeOut( 'fast' );
			});

		});
		$('.bfaver').click(function(evt){
			evt.preventDefault();
			var idEX = string_splitter( $(this).attr('id') , '_' );
			var titEX = string_splitter( $(this).attr('href') , ',' );
			var the_id = idEX[3];

			$( '.ico_fave' ).html( '<img src="' + tpl_img + 'faving-loader.gif" width="10" height="10">' );
			/* SEND REQUEST TO RATE THE BEAT */
			$.ajax({
				type: 'GET',
				url: mod_path + 'ajax_fave-beat.php', data: 'bid='+the_id,
				success: function(data){
					if(data != 'login_first' && data != 'bad_request'){
						$.colorbox({
							html : '<div class="special_background" style="width: 300px; padding: 20px; float: left; text-shadow: #FFF 1px 1px 0; cursor: default;"><p style="margin: 0 0 5px 0; padding: 0;"><strong style="font-size: 16px; color: #CC0000;">SUCCESS!</strong></p><span style="font-size: 12px;"><strong style="font-size: 14px;"><em>'+titEX[1]+'</em></strong><br />was added to your Fave List</span><br /><br /><a href="/faveLIST" style="font-size: 11px;" class="blue_link favelist_launch faveLISTLauncher fr dsn">&raquo; Launch My Favorites \ Player</a></div>',
							scrolling : false ,
							onComplete : function(){
								var the_closer = setTimeout( function(){ $.colorbox.close(); } , 3000 );
							}
						});

						$(document).ready(function(){

							$('.faveLISTLauncher').unbind('click');
							$('.faveLISTLauncher').click(function(evt){
								evt.preventDefault();
								window.open($(this).attr('href'),'faveLIST Player','width=650,height=500');
							});

						});
					}else{
						load_login( 'faving' );
					}
					$( '.ico_fave' ).html( '' );
				}
			});
		});
		reload_stars();
		
		$('.beat_thumb_player_ui').click( function(){
			var bidN = $(this).attr('bid'); var cidN = $(this).attr('cid'); var w = $(this).width();
			$('.beat_thumb_player_ui').show();
			$(this).hide();
			$('.btplay_swf').html( '' );
			$('#btplay_'+cidN).flash({ width: w, height: 24, wmode: 'transparent', swf: '/template/player/player.swf', style: 'margin: 3px 5px 0 0;' , flashvars: { id: bidN , uid: uidN , sid: sidN } });
		});
		/* - - - __End > JS for BEAT BOXES - - - */

		$('.login').click(function(evt){
			evt.preventDefault();
			load_login( '' );
		});

		$('.cart').click(function(evt){
			evt.preventDefault();
			$.ajax({
				type: 'GET',
				url: $(this).attr('href')+'/ajax',
				success: function(data){
					$('#win_modal').remove();
					var m = data;
					$('body').append( m );
					$('#win_modal').reveal({ dismissmodalclass : 'close-reveal-modal' });
					$.colorbox.close();
				}
			});
		});

	});

}

/* - - - __Start > JS for BEAT BOXES - - - */

function create_beat_block(){
	$('.beat_reloader_overlay').remove();
	var t = '<li class="beat_reloader_overlay" style="cursor: default; display: none; position: absolute; width: '+($('.tbeats').width()+34)+'px; height: '+$('.tbeats').height()+'px; background: url('+"'"+tpl_img+"transparent-black.png')"+' repeat; border-radius: 3px; -moz-border-radius: 3px; z-index: 5001; margin-left: -34px;">'+
			'<div style="width: 100%; padding: 35% 0 0 0; float: left; text-align: center; font-size: 14px;"><img src="'+tpl_img+'ajax-loader.gif" width="31" height="31" style="position: relative; top: 10px;"> <em><strong>Loading filters, please wait...</strong></em></div>'+
			'</li>';

	$('.tbeats').append( t );
	$('.beat_reloader_overlay').fadeIn( 'fast' );
}

function reload_beats( the_box , t , gid ){
	/* Insert the AJAX stuff here... */
	$.ajax({
		type: 'GET',
		url: mod_path + 'ajax_reload-beats.php', data: 't='+t+'&w='+w+'&gid='+gid, cache: false,
		success: function(data){
			$('#'+the_box).children().remove();
			$('#'+the_box).html( data );

			/* __Start : Clean Up ShareThis */
			$('#stwrapper').remove(); $('#stSegmentFrame').remove(); $('head link:last-child').remove();
			delete stButtons; delete stLight; delete stWidget;
			st_loaded = false;
			/* __End : Clean Up ShareThis */

			if(t == 'featured') reloadable();
		}
	});
}
function reload_stars(){
	$('.stars').unbind('mouseenter'); $('.stars').unbind('mouseleave'); $('.stars').unbind('click');
	$('.stars').mouseenter(function(){
		var idEX = string_splitter( $(this).attr('id') , '_' );
		var the_id = idEX[1];

		/* Animate Stars */
		for(i=0;i<5;i++){
			if(i <= parseInt(idEX[2])){
				$('#bstar_'+the_id+'_'+i+'_'+idEX[3]+'_'+idEX[4]).addClass('_star-act');
			}else $('#bstar_'+the_id+'_'+i+'_'+idEX[3]+'_'+idEX[4]).removeClass('_star-act');
		}

	});
	$('.stars').mouseleave(function(){
		var idEX = string_splitter( $(this).attr('id') , '_' );
		var the_id = idEX[1];

		/* Animate Stars */
		for(i=0;i<5;i++){
			if(i < parseInt(idEX[3])){
				$('#bstar_'+the_id+'_'+i+'_'+idEX[3]+'_'+idEX[4]).addClass('_star-act');
			}else $('#bstar_'+the_id+'_'+i+'_'+idEX[3]+'_'+idEX[4]).removeClass('_star-act');
		}
	});
	$('.stars').click(function(){
		var idEX = string_splitter( $(this).attr('id') , '_' );
		var the_id = idEX[1];
		var the_star = this;
		$(this).html ( '<img src="' + tpl_img + 'rating-loader.gif" width="12" height="12">' );

		/* SEND REQUEST TO RATE THE BEAT */
		$.ajax({
			type: 'GET',
			url: mod_path + 'ajax_rate-beat.php', data: 'bid='+idEX[4]+'&r='+ ( parseInt(idEX[2]) + 1 ),
			success: function(data){
				if(data != 'login_first' && data != 'bad_request'){
					var result = string_splitter( data , ',' );

					/* Animate Stars */
					for(i=0;i<5;i++){
						if(i < parseInt(result[1])){
							$('#bstar_'+the_id+'_'+i+'_'+idEX[3]+'_'+idEX[4]).addClass('_star-act');
						}else $('#bstar_'+the_id+'_'+i+'_'+idEX[3]+'_'+idEX[4]).removeClass('_star-act');
						$('#bstar_'+the_id+'_'+i+'_'+idEX[3]+'_'+idEX[4]).attr( 'id' , 'bstar_'+the_id+'_'+i+'_'+result[1]+'_'+idEX[4] );
					}

					$(the_star).fadeOut( 'fast' , function(){ $(the_star).fadeIn( 'fast' ); $(the_star).html ( '' ); reload_stars(); } );
				}else{
					if(data == 'login_first'){
						for(i=0;i<5;i++){
							if(i < parseInt(idEX[3])){
								$('#bstar_'+the_id+'_'+i+'_'+idEX[3]+'_'+idEX[4]).addClass('_star-act');
							}else $('#bstar_'+the_id+'_'+i+'_'+idEX[3]+'_'+idEX[4]).removeClass('_star-act');
						}
						load_login( 'rating' );
					}
					$(the_star).html ( '' );
				}
			}
		});
	});
}


/* - - - __End > JS for BEAT BOXES - - - */

function cart_renotify(){
	/* Reload Cart Notification... */
	$.ajax({
		type: 'GET',
		url: mod_path + 'ajax_cart-notification.php', cache: false,
		success: function(data){
			if(data > 0){
				/* Create the Cart Items Count box */
				var tmp = '';
				if(data > 1)
					tmp = data + ' items';
				else
					tmp = data + ' item';
				$('#cart_link').html( tmp );
			}
		}
	});
}

function load_login( w ){
	$('#win_modal').remove();
	$('.reveal-modal-bg').remove();
	$.colorbox( { href: mod_path + 'ajax_login.php?w=' + w + '&t=' + window.location , scrolling : false , onComplete : function(){ $('#quick_user_login').focus(); } } );
}

function load_subscribe_page(){
	$('#win_modal').remove();
	$('.reveal-modal-bg').remove();
	$.colorbox( { href: mod_path + 'ajax_subscribe.php?t=' + window.location , scrolling : false , onComplete : function(){ $('#subscribe_email').focus(); } } );
}



function getVARS(vars){
	if(vars.indexOf("#") > -1){
		var query = vars.split("#");
		if(query.length > 1){
			var queryITEMS = query[1];
			var queries = queryITEMS.split(":");
			return queries;
		}
	}else return "";
}
