	// =============================
	//  start: jquery plugins 
	//		defined here to eliminate
	//		excessive http requests
	// =============================



	
		/* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+ <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)
		*/
		(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 p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){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.mouseover(handleHover).mouseout(handleHover);};})(jQuery);
			
	
		/* xLazyLoader 1.0 - Plugin for jQuery  * Depends:jquery.js * Copyright (c) 2008 Oleg Slobodskoi (jimdo.com)*/
		;(function($){$.xLazyLoader=function(method,options){if(typeof method=='object'){options=method;method='init';};new xLazyLoader()[method](options);};$.xLazyLoader.defaults={js:[],css:[],img:[],name:null,timeout:20000,success:function(){},error:function(){},complete:function(){},each:function(){}};var head=document.getElementsByTagName("head")[0];function xLazyLoader()
		{var self=this,s,loaded=[],errors=[],tTimeout,cssTimeout,toLoad,files=[];this.init=function(options)
		{if(!options)return;s=$.extend({},$.xLazyLoader.defaults,options);toLoad={js:s.js,css:s.css,img:s.img};$.each(toLoad,function(type,f){if(typeof f=='string')
		f=f.split(',');files=files.concat(f);});if(!files.length){dispatchCallbacks('error');return;};if(s.timeout){tTimeout=setTimeout(function(){var handled=loaded.concat(errors);$.each(files,function(i,file){$.inArray(file,handled)==-1&&errors.push(file);});dispatchCallbacks('error');},s.timeout);};$.each(toLoad,function(type,urls){if($.isArray(urls))
		$.each(urls,function(i,url){load(type,url);});else if(typeof urls=='string')
		load(type,urls);});};this.js=function(src,callback,name)
		{var $script=$('script[src*="'+src+'"]');if($script.length){$script.attr('pending')?$script.bind('scriptload',callback):callback();return;};var s=document.createElement('script');s.setAttribute("type","text/javascript");s.setAttribute("src",src);s.setAttribute('id',name);s.setAttribute('pending',1);s.onerror=addError;$(s).bind('scriptload',function(){$(this).removeAttr('pending');callback();setTimeout(function(){$(s).unbind('scriptload');},10);});var done=false;s.onload=s.onreadystatechange=function(){if(!done&&(!this.readyState||/loaded|complete/.test(this.readyState))){done=true;s.onload=s.onreadystatechange=null;$(s).trigger('scriptload');};};head.appendChild(s);};this.css=function(href,callback,name)
		{if($('link[href*="'+href+'"]').length){callback();return;};var link=$('<link rel="stylesheet" type="text/css" media="all" href="'+href+'" id="'+name+'"></link>')[0];if($.browser.msie){link.onreadystatechange=function(){/loaded|complete/.test(link.readyState)&&callback();};}else if($.browser.opera){link.onload=callback;}else{var hostname=location.hostname.replace('www.',''),hrefHostname=/http:/.test(href)?/^(\w+:)?\/\/([^\/?#]+)/.exec(href)[2]:hostname;hostname!=hrefHostname&&$.browser.mozilla?callback():(function(){try{link.sheet.cssRules;}catch(e){cssTimeout=setTimeout(arguments.callee,20);return;};callback();})();};head.appendChild(link);};this.img=function(src,callback)
		{var img=new Image();img.onload=callback;img.onerror=addError;img.src=src;};this.disable=function(name)
		{$('#lazy-loaded-'+name,head).attr('disabled','disabled');};this.enable=function(name)
		{$('#lazy-loaded-'+name,head).removeAttr('disabled');};this.destroy=function(name)
		{$('#lazy-loaded-'+name,head).remove();};function load(type,url){self[type](url,function(status){status=='error'?errors.push(url):loaded.push(url)&&s.each(url);checkProgress();},'lazy-loaded-'+(s.name?s.name:new Date().getTime()));};function dispatchCallbacks(status){s.complete(status,loaded,errors);s[status](status=='error'?errors:loaded);clearTimeout(tTimeout);clearTimeout(cssTimeout);};function checkProgress(){if(loaded.length==files.length)dispatchCallbacks('success')
		else if(loaded.length+errors.length==files.length)dispatchCallbacks('error');};function addError(){errors.push(this.src);checkProgress();};};})(jQuery);
	

		/* Cookie plugin Copyright (c) 2006 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(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}
		var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}
		expires='; expires='+date.toUTCString();}
		var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}
		return cookieValue;}};


		/*jQuery Cycle Plugin (with Transition Definitions) Examples and documentation at: http://jquery.malsup.com/cycle/ Copyright (c) 2007-2009 M. Alsup Version: 2.65 (07-APR-2009) 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.2.6 or later*/
		;(function($){var ver='2.65';if($.support==undefined){$.support={opacity:!($.browser.msie)};}
		function log(){if(window.console&&window.console.log)
		window.console.log('[cycle] '+Array.prototype.join.call(arguments,' '));};$.fn.cycle=function(options,arg2){var o={s:this.selector,c:this.context};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;}
		log('terminating; zero elements found by selector'+($.isReady?'':' (DOM not ready)'));return this;}
		return this.each(function(){options=handleArguments(this,options,arg2);if(options===false)
		return;if(this.cycleTimeout)
		clearTimeout(this.cycleTimeout);this.cycleTimeout=this.cyclePause=0;var $cont=$(this);var $slides=options.slideExpr?$(options.slideExpr,this):$cont.children();var els=$slides.get();if(els.length<2){log('terminating; too few slides: '+els.length);return;}
		var opts=buildOptions($cont,$slides,els,options,o);if(opts===false)
		return;if(opts.timeout||opts.continuous)
		this.cycleTimeout=setTimeout(function(){go(els,opts,0,!opts.rev)},opts.continuous?10:opts.timeout+(opts.delay||0));});};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'stop':cont.cycleStop++;if(cont.cycleTimeout)
		clearTimeout(cont.cycleTimeout);cont.cycleTimeout=0;$(cont).removeData('cycle.opts');return false;case'pause':cont.cyclePause=1;return false;case'resume':cont.cyclePause=0;if(arg2===true){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,1);}
		return false;default:options={fx:options};};}
		else if(options.constructor==Number){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 removeFilter(el,opts){if(!$.support.opacity&&opts.cleartype&&el.style.filter){try{el.style.removeAttribute('filter');}
		catch(smother){}}};function buildOptions($cont,$slides,els,options,o){var opts=$.extend({},$.fn.cycle.defaults,options||{},$.metadata?$cont.metadata():$.meta?$cont.data():{});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]:[];opts.after.unshift(function(){opts.busy=0;});if(!$.support.opacity&&opts.cleartype)
		opts.after.push(function(){removeFilter(this,opts);});if(opts.continuous)
		opts.after.push(function(){go(els,opts,0,!opts.rev);});saveOriginalOpts(opts);if(!$.support.opacity&&opts.cleartype&&!opts.cleartypeNoBg)
		clearTypeFix($slides);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);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=0;opts.startingSlide=opts.randomMap[0];}
		else if(opts.startingSlide>=els.length)
		opts.startingSlide=0;opts.currSlide=opts.startingSlide=opts.startingSlide||0;var first=opts.startingSlide;$slides.css({position:'absolute',top:0,left:0}).hide().each(function(i){var z=first?i>=first?els.length-(i-first):first-i:els.length-i;$(this).css('z-index',z)});$(els[first]).css('opacity',1).show();removeFilter(els[first],opts);if(opts.fit&&opts.width)
		$slides.width(opts.width);if(opts.fit&&opts.height&&opts.height!='auto')
		$slides.height(opts.height);var reshape=opts.containerResize&&!$cont.innerHeight();if(reshape){var maxw=0,maxh=0;for(var i=0;i<els.length;i++){var $e=$(els[i]),e=$e[0],w=$e.outerWidth(),h=$e.outerHeight();if(!w)w=e.offsetWidth;if(!h)h=e.offsetHeight;maxw=w>maxw?w:maxw;maxh=h>maxh?h:maxh;}
		if(maxw>0&&maxh>0)
		$cont.css({width:maxw+'px',height:maxh+'px'});}
		if(opts.pause)
		$cont.hover(function(){this.cyclePause++;},function(){this.cyclePause--;});if(supportMultiTransitions(opts)===false)
		return false;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;}}
		var requeue=false;options.requeueAttempts=options.requeueAttempts||0;$slides.each(function(){var $el=$(this);this.cycleH=(opts.fit&&opts.height)?opts.height:$el.height();this.cycleW=(opts.fit&&opts.width)?opts.width:$el.width();if($el.is('img')){var loadingIE=($.browser.msie&&this.cycleW==28&&this.cycleH==30&&!this.complete);var loadingOp=($.browser.opera&&this.cycleW==42&&this.cycleH==19&&!this.complete);var loadingOther=(this.cycleH==0&&this.cycleW==0&&!this.complete);if(loadingIE||loadingOp||loadingOther){if(o.s&&opts.requeueOnImageNotLoaded&&++options.requeueAttempts<100){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;}
		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.animIn=opts.animIn||{};opts.animOut=opts.animOut||{};$slides.not(':eq('+first+')').css(opts.cssBefore);if(opts.cssFirst)
		$($slides[first]).css(opts.cssFirst);if(opts.timeout){opts.timeout=parseInt(opts.timeout);if(opts.speed.constructor==String)
		opts.speed=$.fx.speeds[opts.speed]||parseInt(opts.speed);if(!opts.sync)
		opts.speed=opts.speed/2;while((opts.timeout-opts.speed)<250)
		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){opts.nextSlide=opts.currSlide;if(++opts.randomIndex==els.length)
		opts.randomIndex=0;opts.nextSlide=opts.randomMap[opts.randomIndex];}
		else
		opts.nextSlide=opts.startingSlide>=(els.length-1)?0:opts.startingSlide+1;var e0=$slides[first];if(opts.before.length)
		opts.before[0].apply(e0,[e0,e0,opts,true]);if(opts.after.length>1)
		opts.after[1].apply(e0,[e0,e0,opts,true]);if(opts.next)
		$(opts.next).click(function(){return advance(opts,opts.rev?-1:1)});if(opts.prev)
		$(opts.prev).click(function(){return advance(opts,opts.rev?1:-1)});if(opts.pager)
		buildPager(els,opts);exposeAddSlide(opts,els);return opts;};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 txs=$.fn.cycle.transitions;if(opts.fx.indexOf(',')>0){opts.multiFx=true;opts.fxs=opts.fx.replace(/\s*/g,'').split(',');for(var i=0;i<opts.fxs.length;i++){var fx=opts.fxs[i];var tx=txs[fx];if(!tx||!txs.hasOwnProperty(fx)||!$.isFunction(tx)){log('discarding unknown transition: ',fx);opts.fxs.splice(i,1);i--;}}
		if(!opts.fxs.length){log('No valid transitions named; slideshow terminating.');return false;}}
		else if(opts.fx=='all'){opts.multiFx=true;opts.fxs=[];for(p in txs){var tx=txs[p];if(txs.hasOwnProperty(p)&&$.isFunction(tx))
		opts.fxs.push(p);}}
		if(opts.multiFx&&opts.randomizeEffects){var r1=Math.floor(Math.random()*20)+30;for(var i=0;i<r1;i++){var r2=Math.floor(Math.random()*opts.fxs.length);opts.fxs.push(opts.fxs.splice(r2,1)[0]);}
		log('randomized fx sequence: ',opts.fxs);}
		return true;};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);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')
		$slides.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)
		$.fn.cycle.createPagerAnchor(els.length-1,s,$(opts.pager),els,opts);if($.isFunction(opts.onAddSlide))
		opts.onAddSlide($s);else
		$s.hide();};}
		$.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);});var init=$.fn.cycle.transitions[fx];if($.isFunction(init))
		init(opts.$cont,$(opts.elements),opts);};function go(els,opts,manual,fwd){if(manual&&opts.busy&&opts.manualTrump){$(els).stop(true,true);opts.busy=false;}
		if(opts.busy)
		return;var p=opts.$cont[0],curr=els[opts.currSlide],next=els[opts.nextSlide];if(p.cycleStop!=opts.stopCount||p.cycleTimeout===0&&!manual)
		return;if(!manual&&!p.cyclePause&&((opts.autostop&&(--opts.countdown<=0))||(opts.nowrap&&!opts.random&&opts.nextSlide<opts.currSlide))){if(opts.end)
		opts.end(opts);return;}
		if(manual||!p.cyclePause){var fx=opts.fx;curr.cycleH=curr.cycleH||$(curr).height();curr.cycleW=curr.cycleW||$(curr).width();next.cycleH=next.cycleH||$(next).height();next.cycleW=next.cycleW||$(next).width();if(opts.multiFx){if(opts.lastFx==undefined||++opts.lastFx>=opts.fxs.length)
		opts.lastFx=0;fx=opts.fxs[opts.lastFx];opts.currFx=fx;}
		if(opts.oneTimeFx){fx=opts.oneTimeFx;opts.oneTimeFx=null;}
		$.fn.cycle.resetState(opts,fx);if(opts.before.length)
		$.each(opts.before,function(i,o){if(p.cycleStop!=opts.stopCount)return;o.apply(next,[curr,next,opts,fwd]);});var after=function(){$.each(opts.after,function(i,o){if(p.cycleStop!=opts.stopCount)return;o.apply(next,[curr,next,opts,fwd]);});};if(opts.nextSlide!=opts.currSlide){opts.busy=1;if(opts.fxFn)
		opts.fxFn(curr,next,opts,after,fwd);else if($.isFunction($.fn.cycle[opts.fx]))
		$.fn.cycle[opts.fx](curr,next,opts,after);else
		$.fn.cycle.custom(curr,next,opts,after,manual&&opts.fastOnEvent);}
		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];}
		else{var roll=(opts.nextSlide+1)==els.length;opts.nextSlide=roll?0:opts.nextSlide+1;opts.currSlide=roll?els.length-1:opts.nextSlide-1;}
		if(opts.pager)
		$.fn.cycle.updateActivePagerLink(opts.pager,opts.currSlide,opts.lastSlide);}
		var ms=0;if(opts.timeout&&!opts.continuous)
		ms=getTimeout(curr,next,opts,fwd);else if(opts.continuous&&p.cyclePause)
		ms=10;if(ms>0)
		p.cycleTimeout=setTimeout(function(){go(els,opts,0,!opts.rev)},ms);};$.fn.cycle.updateActivePagerLink=function(pager,currSlide,lastSlide){$(pager).find('a').removeClass('slide'+currSlide).filter('a:eq('+currSlide+')').addClass('activeSlide'+currSlide);$(pager).find('a').removeClass('activeSlide'+lastSlide).filter('a:eq('+lastSlide+')').addClass('slide'+lastSlide);};function getTimeout(curr,next,opts,fwd){if(opts.timeoutFn){var t=opts.timeoutFn(curr,next,opts,fwd);if(t!==false)
		return t;}
		return opts.timeout;};$.fn.cycle.next=function(opts){advance(opts,opts.rev?-1:1);};$.fn.cycle.prev=function(opts){advance(opts,opts.rev?1:-1);};function advance(opts,val){var els=opts.elements;var p=opts.$cont[0],timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0;}
		if(opts.random&&val<0){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){if(++opts.randomIndex==els.length)
		opts.randomIndex=0;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;}}
		if($.isFunction(opts.prevNextClick))
		opts.prevNextClick(val>0,opts.nextSlide,els[opts.nextSlide]);go(els,opts,1,val>=0);return false;};function buildPager(els,opts){var $p=$(opts.pager);$.each(els,function(i,o){$.fn.cycle.createPagerAnchor(i,o,$p,els,opts);});$.fn.cycle.updateActivePagerLink(opts.pager,opts.startingSlide);};$.fn.cycle.createPagerAnchor=function(i,el,$p,els,opts){var a=($.isFunction(opts.pagerAnchorBuilder))?opts.pagerAnchorBuilder(i,el):'<a href="#" class="slide'+i+'">'+(i+1)+'</a>';if(!a)
		return;var $a=$(a);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);});$a=$(arr);}
		else{$a.appendTo($p);}}
		$a.bind(opts.pagerEvent,function(){opts.nextSlide=i;var p=opts.$cont[0],timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0;}
		if($.isFunction(opts.pagerClick))
		opts.pagerClick(opts.nextSlide,els[opts.nextSlide]);go(els,opts,1,opts.currSlide<i);return false;});if(opts.pauseOnPagerHover)
		$a.hover(function(){opts.$cont[0].cyclePause++;},function(){opts.$cont[0].cyclePause--;});};$.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;};function clearTypeFix($slides){function hex(s){s=parseInt(s).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.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));});};$.fn.cycle.commonReset=function(curr,next,opts,w,h,rev){$(opts.elements).not(curr).hide();opts.cssBefore.opacity=1;opts.cssBefore.display='block';if(w!==false&&next.cycleW>0)
		opts.cssBefore.width=next.cycleW;if(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));};$.fn.cycle.custom=function(curr,next,opts,cb,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,cb)};$l.animate(opts.animOut,speedOut,easeOut,function(){if(opts.cssAfter)$l.css(opts.cssAfter);if(!opts.sync)fn();});if(opts.sync)fn();};$.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;};$.fn.cycle.defaults={fx:'fade',timeout:4000,timeoutFn:null,continuous:0,speed:1000,speedIn:null,speedOut:null,next:null,prev:null,prevNextClick:null,pager:null,pagerClick:null,pagerEvent:'click',pagerAnchorBuilder:null,before:null,after:null,end:null,easing:null,easeIn:null,easeOut:null,shuffle:null,animIn:null,animOut:null,cssBefore:null,cssAfter:null,fxFn:null,height:'auto',startingSlide:0,sync:1,random:0,fit:0,containerResize:1,pause:0,pauseOnPagerHover:0,autostop:0,autostopCount:0,delay:0,slideExpr:null,cleartype:!$.support.opacity,nowrap:0,fastOnEvent:0,randomizeEffects:1,rev:0,manualTrump:true,requeueOnImageNotLoaded:true,requeueTimeout:250};})(jQuery);(function($){$.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,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,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,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,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){$.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){$.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};};$.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,top:0,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,top:0,height:0};opts.animIn={height:'show'};opts.animOut={height:0};};$.fn.cycle.transitions.shuffle=function($cont,$slides,opts){var 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);});opts.speed=opts.speed/2;opts.random=0;opts.shuffle=opts.shuffle||{left:-w,top:15};opts.els=[];for(var i=0;i<$slides.length;i++)
		opts.els.push($slides[i]);for(var i=0;i<opts.currSlide;i++)
		opts.els.push(opts.els.shift());opts.fxFn=function(curr,next,opts,cb,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)+1+count);}
		$el.animate({left:0,top:0},opts.speedOut,opts.easeOut,function(){$(fwd?this:curr).hide();if(cb)cb();});});};opts.cssBefore={display:'block',opacity:1,top:0,left:0};};$.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.cssFirst={top:0};opts.cssBefore={left:0,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,top:0,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,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;});opts.cssBefore={top:0,left:0,width:0};opts.animIn={left:0};opts.animOut={width:0};};$.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;opts.animIn={top:0,left:0,width:next.cycleW,height:next.cycleH};opts.animOut={width:0,height:0,top:curr.cycleH/2,left:curr.cycleW/2};});opts.cssFirst={top:0,left:0};opts.cssBefore={width:0,height:0};};$.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;opts.animIn={top:0,left:0,width:next.cycleW,height:next.cycleH};});opts.cssBefore={width:0,height:0};opts.animOut={opacity:0};};$.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,top:0};opts.animIn={left:0};opts.animOut={left:w};};$.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,left:0};opts.animIn={top:0};opts.animOut={top:h};};$.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,left:w};opts.animIn={top:0,left:0};opts.animOut={top:h,left:w};};$.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,width:this.cycleW};opts.animOut={left:0};});opts.cssBefore={width:0,top:0};};$.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,height:this.cycleH};opts.animOut={top:0};});opts.cssBefore={height:0,left:0};};$.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,width:this.cycleW};opts.animOut={left:curr.cycleW/2,width:0};});opts.cssBefore={top:0,width:0};};$.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,height:next.cycleH};opts.animOut={top:curr.cycleH/2,height:0};});opts.cssBefore={left:0,height:0};};$.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,top:0};opts.animOut={opacity:1};opts.cssBefore={top:0,left:0};};$.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,top:0};opts.animOut={opacity:1};opts.cssBefore={top:0,left:0};};$.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);if(!opts.animOut.left&&!opts.animOut.top)
		opts.animOut={left:w*2,top:-h/2,opacity:0};else
		opts.animOut.opacity=0;});opts.cssBefore={left:0,top:0};opts.animIn={left:0};};$.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 t=parseInt(h/2);var l=parseInt(w/2);clip='rect('+t+'px '+l+'px '+t+'px '+l+'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]),r=parseInt(d[1]),b=parseInt(d[2]),l=parseInt(d[3]);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))-1;(function f(){var tt=t?t-parseInt(step*(t/count)):0;var ll=l?l-parseInt(step*(l/count)):0;var bb=b<h?b+parseInt(step*((h-b)/count||1)):h;var rr=r<w?r+parseInt(step*((w-r)/count||1)):w;$next.css({clip:'rect('+tt+'px '+rr+'px '+bb+'px '+ll+'px)'});(step++<=count)?setTimeout(f,13):$curr.css('display','none');})();});opts.cssBefore={display:'block',opacity:1,top:0,left:0};opts.animIn={left:0};opts.animOut={left:0};};})(jQuery);
		
		
		/*jMyCarousel.pack.js*/
		eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(G($){$.22.2r=G(o){o=$.21({P:O,S:O,1G:K,1j:Q,1g:1S,1t:\'2l\',E:Q,U:K,1m:\'4\',W:0,20:1,1h:1Y,1f:Q,1e:\'1R\',1v:\'2q\',2m:O,2k:O},o||{});M 1p.2h(G(){8 c=Q,13=o.E?"N":"J",19=o.E?"H":"F";8 f=$(1p),L=$("L",f),1k=$("1C",L),14=1k.1i(),v=o.1m;8 g=0;8 h=(o.S===O&&o.P===O)?K:Q;8 i=(v.1x().1w("%")!=-1?\'%\':(v.1x().1w("I")!=-1)?\'I\':\'1T\');8 j=O;5(o.U){8 k=1k.1D();L.1u(k).2p(k.1D())}8 l=$("1C",L);f.3("2j","1m");l.3("1r","1q").3("1K",o.E?"1J":"J").1b().3("1r","1q");5(!o.E){l.3("2g","2d")}5(l.1b().2c(0).29.28()==\'a\'&&!o.E){l.1b().3(\'1K\',\'J\')}5(o.E&&1H.27.26){l.3(\'25-H\',\'1F\').1b().3(\'T-X\',\'-1F\')}L.3("T","0").3("12","0").3("17","1E").3("24-23-1l","1J").3("z-16","1");f.3("1r","1q").3("17","1E").3("z-16","2").3("J","15");8 m=o.E?H(l):F(l);8 n=o.E?1B(l):H(l);8 p=o.W;8 q=l.1i();8 r=m*q;8 t=14;8 u=t*m;8 w=q*m;8 x=o.1h==\'1Z\'?m:o.1h;o.P=h?$(\'<1A 1l="1z" 1y="\'+(o.E?\'1X\':\'1W\')+\'" />\'):$(o.P);o.S=h?$(\'<1A 1l="1z" 1y="\'+(o.E?\'1V\':\'1U\')+\'" />\'):$(o.S);8 y=o.P;8 z=o.S;5(h&&o.1j!==K){y.3({\'Z\':\'0.6\'});z.3({\'Z\':\'0.6\'});f.1u(y);f.1u(z);o.P=y;o.S=z}5(o.1f){x=m;5(o.W%m!==0){8 A=7(o.W/m);p=o.W=(A*m)}}5(o.U){o.W+=(m*14);p+=(m*14)}8 B,11,10;5(i==\'%\'){B=0;11=7(v);10="%"}R 5(i==\'I\'){B=7(v);11=7(v);10="I"}R{B=m*7(v);11=m*7(v);10="I"}L.3(19,r+"I").3(13,-(o.W));f.3(19,11+10);5(o.E&&10==\'%\'){8 C=((m*t)*(7(v)/1Q));f.3(19,C+\'I\')}5(B===0){B=f.F()}5(o.E){f.3("F",n+\'I\');L.3("F",n+\'I\');l.3(\'T-X\',(7(l.3(\'T-X\'))*2)+\'I\');l.1P(l.1i()-1).3(\'T-X\',l.3(\'T-N\'))}R{f.3(\'H\',n+\'I\');L.3(\'H\',n+\'I\')}5(i==\'%\'){v=B/l.F();5(v%1!==0){v+=1}v=7(v)}8 D=f.H();5(h){z.3({\'z-16\':1O,\'17\':\'1N\'});y.3({\'z-16\':1O,\'17\':\'1N\'});5(o.E){y.3({\'F\':y.F(),\'H\':y.H(),\'N\':\'15\',\'J\':7(n/2)-7(y.F()/2)+\'I\'});z.3({\'F\':y.F(),\'H\':y.H(),\'N\':(D-y.H())+\'I\',\'J\':7(n/2)-7(y.F()/2)+\'I\'})}R{y.3({\'J\':\'15\',\'N\':7(n/2)-7(y.H()/2)+\'I\'});z.3({\'18\':\'15\',\'N\':7(n/2)-7(y.H()/2)+\'I\'})}}5(o.P){$(o.P).1a(o.1e,G(){5(h){o.P.3(\'Z\',0.9)}c=K;j=\'Y\';M Y()});$(o.P).1a(o.1v,G(){5(h){o.P.3(\'Z\',0.6)}c=Q;j=O;M 1c()})}5(o.S){$(o.S).1a(o.1e,G(){5(h){o.S.3(\'Z\',0.9)}c=K;j=\'V\';M V()});$(o.S).1a(o.1v,G(){5(h){o.S.3(\'Z\',0.6)}c=Q;j=O;M 1c()})}5(o.1j===K){c=K;V()}5(o.1G&&f.1M){f.1M(G(e,d){5(!o.U&&(d>0?(p+B<r):(p>0))||o.U){g+=1;5(c===Q){5(d>0){V(x,K)}R{Y(x,K)}c=K}}})}G V(a,b){8 s=(a?a:x);5(c===K&&j==="Y"){M}5(!o.U){5(p+s+(o.E?D:B)>u){s=u-(p+(o.E?D:B))}}L.1L(13=="J"?{J:-(p+s)}:{N:-(p+s)},o.1g,o.1t,G(){p+=s;5(o.U){5(p+(o.E?D:B)+m>=w){L.3(o.E?\'N\':\'J\',-p+u);p-=u}}5(!b&&c){V()}R 5(b){5(--g>0){1p.V(x,K)}R{c=Q;j=O}}})}G Y(a,b){8 s=(a?a:x);5(c===K&&j==="V"){M}5(!o.U){5(p-s<0){s=p-0}}L.1L(13=="J"?{J:-(p-s)}:{N:-(p-s)},o.1g,o.1t,G(){p-=s;5(o.U){5(p<=m){L.3(o.E?\'N\':\'J\',-(p+u));p+=u}}5(!b&&c){Y()}R 5(b){5(--g>0){Y(x,K)}R{c=Q;j=O}}})}G 1c(){5(!o.1f){L.1c();p=0-7(L.3(13))}c=Q;j=O}G 2i(a,b){5(b==\'F\'){M a.1n(\'1o\').F()}R{M a.1n(\'1o\').H()}}G 1B(a){8 b=a.1n(\'1o\');5(o.E){M 7(a.3(\'T-J\'))+7(a.3(\'T-18\'))+7(b.F())+7(a.3(\'1d-J-F\'))+7(a.3(\'1d-18-F\'))+7(a.3(\'12-18\'))+7(a.3(\'12-J\'))}R{M 7(a.3(\'T-N\'))+7(a.3(\'T-X\'))+7(b.F())+7(a.3(\'1d-N-H\'))+7(a.3(\'1d-X-H\'))+7(a.3(\'12-N\'))+7(a.3(\'12-X\'))}}G 1s(a){$(\'#1s\').1I($(\'#1s\').1I()+a+"<2f/>")}})};G 3(a,b){M 7($.3(a[0],b))||0}G F(a){M a[0].2e+3(a,\'2n\')+3(a,\'2o\')}G H(a){M a[0].2b+3(a,\'2a\')+3(a,\'2s\')}})(1H);',62,153,'|||css||if||parseInt|var||||||||||||||||||||||||||||||||vertical|width|function|height|px|left|true|ul|return|top|null|btnPrev|false|else|btnNext|margin|circular|forward|start|bottom|backward|opacity|cssUnity|cssSize|padding|animCss|tl|0px|index|position|right|sizeCss|bind|children|stop|border|evtStart|eltByElt|speed|step|size|auto|tLi|type|visible|find|img|this|hidden|overflow|debug|easing|prepend|evtStop|indexOf|toString|class|button|input|elHeight|li|clone|relative|4px|mouseWheel|jQuery|html|none|float|animate|mousewheel|absolute|200|eq|100|mouseover|500|el|next|down|prev|up|50|default|scroll|extend|fn|style|list|line|msie|browser|toLowerCase|tagName|marginTop|offsetHeight|get|inline|offsetWidth|br|display|each|imgSize|visibility|afterEnd|linear|beforeStart|marginLeft|marginRight|append|mouseout|jMyCarousel|marginBottom'.split('|'),0,{}))


		/*nyroModal - jQuery Plugin http://nyromodal.nyrodev.com Copyright (c) 2008 Cedric Nirousset (nyrodev.com) Licensed under the MIT license $Date: 2009-07-17 (Fri, 17 Jul 2009) $version: 1.5.1 */
		jQuery(function($){var userAgent=navigator.userAgent.toLowerCase();var browserVersion=(userAgent.match(/.+(?:rv|webkit|khtml|opera|msie)[\/: ]([\d.]+)/)||[0,'0'])[1];var isIE6=(/msie/.test(userAgent)&&!/opera/.test(userAgent)&&parseInt(browserVersion)<7&&!window.XMLHttpRequest);var body=$('body');var currentSettings;var shouldResize=false;var gallery={};var fixFF=false;var contentElt;var contentEltLast;var modal={started:false,ready:false,dataReady:false,anim:false,animContent:false,loadingShown:false,transition:false,resizing:false,closing:false,error:false,blocker:null,blockerVars:null,full:null,bg:null,loading:null,tmp:null,content:null,wrapper:null,contentWrapper:null,scripts:new Array(),scriptsShown:new Array()};var resized={width:false,height:false,windowResizing:false};var initSettingsSize={width:null,height:null,windowResizing:true};var windowResizeTimeout;$.fn.nyroModal=function(settings){if(!this)
		return false;return this.each(function(){var me=$(this);if(this.nodeName.toLowerCase()=='form'){me.unbind('submit.nyroModal').bind('submit.nyroModal',function(e){if(me.data('nyroModalprocessing'))
		return true;if(this.enctype=='multipart/form-data'){processModal($.extend(settings,{from:this}));return true;}
		e.preventDefault();processModal($.extend(settings,{from:this}));return false;});}else{me.unbind('click.nyroModal').bind('click.nyroModal',function(e){e.preventDefault();processModal($.extend(settings,{from:this}));return false;});}});};$.fn.nyroModalManual=function(settings){if(!this.length)
		processModal(settings);return this.each(function(){processModal($.extend(settings,{from:this}));});};$.nyroModalManual=function(settings){processModal(settings);};$.nyroModalSettings=function(settings,deep1,deep2){setCurrentSettings(settings,deep1,deep2);if(!deep1&&modal.started){if(modal.bg&&settings.bgColor)
		currentSettings.updateBgColor(modal,currentSettings,function(){});if(modal.contentWrapper&&settings.title)
		setTitle();if(!modal.error&&(settings.windowResizing||(!modal.resizing&&(('width'in settings&&settings.width==currentSettings.width)||('height'in settings&&settings.height==currentSettings.height))))){modal.resizing=true;if(modal.contentWrapper)
		calculateSize(true);if(modal.contentWrapper&&modal.contentWrapper.is(':visible')&&!modal.animContent){if(fixFF)
		modal.content.css({position:''});currentSettings.resize(modal,currentSettings,function(){currentSettings.windowResizing=false;modal.resizing=false;if(fixFF)
		modal.content.css({position:'fixed'});if($.isFunction(currentSettings.endResize))
		currentSettings.endResize(modal,currentSettings);});}}}};$.nyroModalRemove=function(){removeModal();};$.nyroModalNext=function(){var link=getGalleryLink(1);if(link)
		return link.nyroModalManual(getCurrentSettingsNew());return false;};$.nyroModalPrev=function(){var link=getGalleryLink(-1);if(link)
		return link.nyroModalManual(getCurrentSettingsNew());return false;};$.fn.nyroModal.settings={debug:false,blocker:false,modal:false,type:'',forceType:null,from:'',hash:'',processHandler:null,selIndicator:'nyroModalSel',formIndicator:'nyroModal',content:null,bgColor:'#000000',ajax:{},swf:{wmode:'transparent'},width:null,height:null,minWidth:400,minHeight:275,resizable:true,autoSizable:true,padding:25,regexImg:'[^\.]\.(jpg|jpeg|png|tiff|gif|bmp)\s*$',addImageDivTitle:false,defaultImgAlt:'Image',setWidthImgTitle:true,ltr:true,gallery:null,galleryLinks:'<a href="#" class="nyroModalPrev">Prev</a><a href="#"  class="nyroModalNext">Next</a>',galleryCounts:galleryCounts,zIndexStart:200,css:{bg:{position:'absolute',overflow:'hidden',top:0,left:0,height:'100%',width:'100%'},wrapper:{position:'absolute',top:'45%',left:'50%'},wrapper2:{},content:{},loading:{position:'absolute',top:'45%',left:'50%',marginTop:'-50px',marginLeft:'-50px'}},wrap:{div:'<div class="wrapper"></div>',ajax:'<div class="wrapper"></div>',form:'<div class="wrapper"></div>',formData:'<div class="wrapper"></div>',image:'<div class="wrapperImg"></div>',swf:'<div class="wrapperSwf"></div>',iframe:'<div class="wrapperIframe"></div>',iframeForm:'<div class="wrapperIframe"></div>',manual:'<div class="wrapper"></div>'},closeButton:'<a href="#" class="nyroModalClose" id="closeBut" title="Close">x</a>',closeButton2:'<a href="#" class="nyroModalClose" id="closeBut2" title="Close">close</a>',title:null,titleFromIframe:true,openSelector:'.nyroModal',closeSelector:'.nyroModalClose',contentLoading:'<a href="#" class="nyroModalClose">Cancel</a>',errorClass:'error',contentError:'The requested content cannot be loaded.<br />Please try again later.<br /><a href="#" class="nyroModalClose">Close</a>',handleError:null,showBackground:showBackground,hideBackground:hideBackground,endFillContent:null,showContent:showContent,endShowContent:null,beforeHideContent:null,hideContent:hideContent,showTransition:showTransition,hideTransition:hideTransition,showLoading:showLoading,hideLoading:hideLoading,resize:resize,endResize:null,updateBgColor:updateBgColor,endRemove:null};function processModal(settings){if(modal.loadingShown||modal.transition||modal.anim)
		return;debug('processModal');modal.started=true;setDefaultCurrentSettings(settings);if(!modal.full)
		modal.blockerVars=modal.blocker=null;modal.error=false;modal.closing=false;modal.dataReady=false;modal.scripts=new Array();modal.scriptsShown=new Array();currentSettings.type=fileType();if(currentSettings.forceType){if(!currentSettings.content)
		currentSettings.from=true;currentSettings.type=currentSettings.forceType;currentSettings.forceType=null;}
		if($.isFunction(currentSettings.processHandler))
		currentSettings.processHandler(currentSettings);var from=currentSettings.from;var url=currentSettings.url;initSettingsSize.width=currentSettings.width;initSettingsSize.height=currentSettings.height;if(currentSettings.type=='swf'){setCurrentSettings({overflow:'hidden'},'css','content');currentSettings.content='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+currentSettings.width+'" height="'+currentSettings.height+'"><param name="movie" value="'+url+'"></param>';var tmp='';$.each(currentSettings.swf,function(name,val){currentSettings.content+='<param name="'+name+'" value="'+val+'"></param>';tmp+=' '+name+'="'+val+'"';});currentSettings.content+='<embed src="'+url+'" type="application/x-shockwave-flash" width="'+currentSettings.width+'" height="'+currentSettings.height+'"'+tmp+'></embed></object>';}
		if(from){var jFrom=$(from).blur();if(currentSettings.type=='form'){var data=$(from).serializeArray();data.push({name:currentSettings.formIndicator,value:1});if(currentSettings.selector)
		data.push({name:currentSettings.selIndicator,value:currentSettings.selector.substring(1)});$.ajax($.extend({},currentSettings.ajax,{url:url,data:data,type:jFrom.attr('method')?jFrom.attr('method'):'get',success:ajaxLoaded,error:loadingError}));debug('Form Ajax Load: '+jFrom.attr('action'));showModal();}else if(currentSettings.type=='formData'){initModal();jFrom.attr('target','nyroModalIframe');jFrom.attr('action',url);jFrom.prepend('<input type="hidden" name="'+currentSettings.formIndicator+'" value="1" />');if(currentSettings.selector)
		jFrom.prepend('<input type="hidden" name="'+currentSettings.selIndicator+'" value="'+currentSettings.selector.substring(1)+'" />');modal.tmp.html('<iframe frameborder="0" hspace="0" name="nyroModalIframe" src="javascript:false;"></iframe>');$('iframe',modal.tmp).css({width:currentSettings.width,height:currentSettings.height}).error(loadingError).load(formDataLoaded);debug('Form Data Load: '+jFrom.attr('action'));showModal();showContentOrLoading();}else if(currentSettings.type=='image'){debug('Image Load: '+url);var title=jFrom.attr('title')||currentSettings.defaultImgAlt;initModal();modal.tmp.html('<img id="nyroModalImg" />').find('img').attr('alt',title);modal.tmp.css({lineHeight:0});$('img',modal.tmp).error(loadingError).load(function(){debug('Image Loaded: '+this.src);$(this).unbind('load');var w=modal.tmp.width();var h=modal.tmp.height();modal.tmp.css({lineHeight:''});resized.width=w;resized.height=h;setCurrentSettings({width:w,height:h,imgWidth:w,imgHeight:h});initSettingsSize.width=w;initSettingsSize.height=h;setCurrentSettings({overflow:'hidden'},'css','content');modal.dataReady=true;if(modal.loadingShown||modal.transition)
		showContentOrLoading();}).attr('src',url);showModal();}else if(currentSettings.type=='iframeForm'){initModal();modal.tmp.html('<iframe frameborder="0" hspace="0" src="javascript:false;" name="nyroModalIframe" id="nyroModalIframe"></iframe>');debug('Iframe Form Load: '+url);$('iframe',modal.tmp).eq(0).css({width:'100%',height:$.support.boxModel?'99%':'100%'}).load(iframeLoaded);modal.dataReady=true;showModal();}else if(currentSettings.type=='iframe'){initModal();modal.tmp.html('<iframe frameborder="0" hspace="0" src="javascript:false;" name="nyroModalIframe" id="nyroModalIframe"></iframe>');debug('Iframe Load: '+url);$('iframe',modal.tmp).eq(0).css({width:'100%',height:$.support.boxModel?'99%':'100%'}).load(iframeLoaded);modal.dataReady=true;showModal();}else if(currentSettings.type){debug('Content: '+currentSettings.type);initModal();modal.tmp.html(currentSettings.content);var w=modal.tmp.width();var h=modal.tmp.height();var div=$(currentSettings.type);if(div.length){setCurrentSettings({type:'div'});w=div.width();h=div.height();if(contentElt)
		contentEltLast=contentElt;contentElt=div;modal.tmp.append(div.contents());}
		initSettingsSize.width=w;initSettingsSize.height=h;setCurrentSettings({width:w,height:h});if(modal.tmp.html())
		modal.dataReady=true;else
		loadingError();if(!modal.ready)
		showModal();else
		endHideContent();}else{debug('Ajax Load: '+url);setCurrentSettings({type:'ajax'});var data=currentSettings.ajax.data||{};if(currentSettings.selector){if(typeof data=="string"){data+='&'+currentSettings.selIndicator+'='+currentSettings.selector.substring(1);}else{data[currentSettings.selIndicator]=currentSettings.selector.substring(1);}}
		$.ajax($.extend(true,currentSettings.ajax,{url:url,success:ajaxLoaded,error:loadingError,data:data}));showModal();}}else if(currentSettings.content){debug('Content: '+currentSettings.type);setCurrentSettings({type:'manual'});initModal();modal.tmp.html($('<div/>').html(currentSettings.content).contents());if(modal.tmp.html())
		modal.dataReady=true;else
		loadingError();showModal();}else{}}
		function setDefaultCurrentSettings(settings){debug('setDefaultCurrentSettings');currentSettings=$.extend(true,{},$.fn.nyroModal.settings,settings);currentSettings.selector='';currentSettings.borderW=0;currentSettings.borderH=0;currentSettings.resizable=true;setMargin();}
		function setCurrentSettings(settings,deep1,deep2){if(modal.started){if(deep1&&deep2){$.extend(true,currentSettings[deep1][deep2],settings);}else if(deep1){$.extend(true,currentSettings[deep1],settings);}else{if(modal.animContent){if('width'in settings){if(!modal.resizing){settings.setWidth=settings.width;shouldResize=true;}
		delete settings['width'];}
		if('height'in settings){if(!modal.resizing){settings.setHeight=settings.height;shouldResize=true;}
		delete settings['height'];}}
		$.extend(true,currentSettings,settings);}}else{if(deep1&&deep2){$.extend(true,$.fn.nyroModal.settings[deep1][deep2],settings);}else if(deep1){$.extend(true,$.fn.nyroModal.settings[deep1],settings);}else{$.extend(true,$.fn.nyroModal.settings,settings);}}}
		function setMarginScroll(){if(isIE6&&!modal.blocker){if(document.documentElement){currentSettings.marginScrollLeft=document.documentElement.scrollLeft;currentSettings.marginScrollTop=document.documentElement.scrollTop;}else{currentSettings.marginScrollLeft=document.body.scrollLeft;currentSettings.marginScrollTop=document.body.scrollTop;}}else{currentSettings.marginScrollLeft=0;currentSettings.marginScrollTop=0;}}
		function setMargin(){setMarginScroll();currentSettings.marginLeft=-(currentSettings.width+currentSettings.borderW)/2;currentSettings.marginTop=-(currentSettings.height+currentSettings.borderH)/2;if(!modal.blocker){currentSettings.marginLeft+=currentSettings.marginScrollLeft;currentSettings.marginTop+=currentSettings.marginScrollTop;}}
		function setMarginLoading(){setMarginScroll();var outer=getOuter(modal.loading);currentSettings.marginTopLoading=-(modal.loading.height()+outer.h.border+outer.h.padding)/2;currentSettings.marginLeftLoading=-(modal.loading.width()+outer.w.border+outer.w.padding)/2;if(!modal.blocker){currentSettings.marginLefttLoading+=currentSettings.marginScrollLeft;currentSettings.marginTopLoading+=currentSettings.marginScrollTop;}}
		function setTitle(){var title=$('h1#nyroModalTitle',modal.contentWrapper);if(title.length)
		title.text(currentSettings.title);else
		modal.contentWrapper.prepend('<h1 id="nyroModalTitle">'+currentSettings.title+'</h1>');}
		function initModal(){debug('initModal');if(!modal.full){if(currentSettings.debug)
		setCurrentSettings({color:'white'},'css','bg');var full={zIndex:currentSettings.zIndexStart,position:'fixed',top:0,left:0,width:'100%',height:'100%'};var contain=body;var iframeHideIE='';if(currentSettings.blocker){modal.blocker=contain=$(currentSettings.blocker);var pos=modal.blocker.offset();var w=modal.blocker.outerWidth();var h=modal.blocker.outerHeight();if(isIE6){setCurrentSettings({height:'100%',width:'100%',top:0,left:0},'css','bg');}
		modal.blockerVars={top:pos.top,left:pos.left,width:w,height:h};var plusTop=(/msie/.test(userAgent)?0:getCurCSS(body.get(0),'borderTopWidth'));var plusLeft=(/msie/.test(userAgent)?0:getCurCSS(body.get(0),'borderLeftWidth'));full={position:'absolute',top:pos.top+plusTop,left:pos.left+plusLeft,width:w,height:h};}else if(isIE6){body.css({height:body.height()+'px',width:body.width()+'px',position:'static',overflow:'hidden'});$('html').css({overflow:'hidden'});setCurrentSettings({css:{bg:{position:'absolute',zIndex:currentSettings.zIndexStart+1,height:'110%',width:'110%',top:currentSettings.marginScrollTop+'px',left:currentSettings.marginScrollLeft+'px'},wrapper:{zIndex:currentSettings.zIndexStart+2},loading:{zIndex:currentSettings.zIndexStart+3}}});iframeHideIE=$('<iframe id="nyroModalIframeHideIe" src="javascript:false;"></iframe>').css($.extend({},currentSettings.css.bg,{opacity:0,zIndex:50,border:'none'}));}
		contain.append($('<div id="nyroModalFull"><div id="nyroModalBg"></div><div id="nyroModalWrapper"><div id="nyroModalContent"></div></div><div id="nyrModalTmp"></div><div id="nyroModalLoading"></div></div>').hide());modal.full=$('#nyroModalFull').css(full).show();modal.bg=$('#nyroModalBg').css($.extend({backgroundColor:currentSettings.bgColor},currentSettings.css.bg)).before(iframeHideIE);if(!currentSettings.modal)
		modal.bg.click(removeModal);modal.loading=$('#nyroModalLoading').css(currentSettings.css.loading).hide();modal.contentWrapper=$('#nyroModalWrapper').css(currentSettings.css.wrapper).hide();modal.content=$('#nyroModalContent');modal.tmp=$('#nyrModalTmp').hide();if($.isFunction($.fn.mousewheel)){modal.content.mousewheel(function(e,d){var elt=modal.content.get(0);if((d>0&&elt.scrollTop==0)||(d<0&&elt.scrollHeight-elt.scrollTop==elt.clientHeight)){e.preventDefault();e.stopPropagation();}});}
		$(document).bind('keydown.nyroModal',keyHandler);modal.content.css({width:'auto',height:'auto'});modal.contentWrapper.css({width:'auto',height:'auto'});if(!currentSettings.blocker){$(window).bind('resize.nyroModal',function(){window.clearTimeout(windowResizeTimeout);windowResizeTimeout=window.setTimeout(windowResizeHandler,200);});}}}
		function windowResizeHandler(){$.nyroModalSettings(initSettingsSize);}
		function showModal(){debug('showModal');if(!modal.ready){initModal();modal.anim=true;currentSettings.showBackground(modal,currentSettings,endBackground);}else{modal.anim=true;modal.transition=true;currentSettings.showTransition(modal,currentSettings,function(){endHideContent();modal.anim=false;showContentOrLoading();});}}
		function keyHandler(e){if(e.keyCode==27){if(!currentSettings.modal)
		removeModal();}else if(currentSettings.gallery&&modal.ready&&modal.dataReady&&!modal.anim&&!modal.transition){if(e.keyCode==39||e.keyCode==40){e.preventDefault();$.nyroModalNext();return false;}else if(e.keyCode==37||e.keyCode==38){e.preventDefault();$.nyroModalPrev();return false;}}}
		function fileType(){var from=currentSettings.from;var url;if(from&&from.nodeName){var jFrom=$(from);url=jFrom.attr(from.nodeName.toLowerCase()=='form'?'action':'href');if(!url)
		url=location.href.substring(window.location.host.length+7);currentSettings.url=url;if(jFrom.attr('rev')=='modal')
		currentSettings.modal=true;currentSettings.title=jFrom.attr('title');if(from&&from.rel&&from.rel.toLowerCase()!='nofollow'){var indexSpace=from.rel.indexOf(' ');currentSettings.gallery=indexSpace>0?from.rel.substr(0,indexSpace):from.rel;}
		var imgType=imageType(url,from);if(imgType)
		return imgType;if(isSwf(url))
		return'swf';var iframe=false;if(from.target&&from.target.toLowerCase()=='_blank'||(from.hostname&&from.hostname.replace(/:\d*$/,'')!=window.location.hostname.replace(/:\d*$/,''))){iframe=true;}
		if(from.nodeName.toLowerCase()=='form'){if(iframe)
		return'iframeForm';setCurrentSettings(extractUrlSel(url));if(jFrom.attr('enctype')=='multipart/form-data')
		return'formData';return'form';}
		if(iframe)
		return'iframe';}else{url=currentSettings.url;if(!currentSettings.content)
		currentSettings.from=true;if(!url)
		return null;if(isSwf(url))
		return'swf';var reg1=new RegExp("^http://","g");if(url.match(reg1))
		return'iframe';}
		var imgType=imageType(url,from);if(imgType)
		return imgType;var tmp=extractUrlSel(url);setCurrentSettings(tmp);if(!tmp.url)
		return tmp.selector;}
		function imageType(url,from){var image=new RegExp(currentSettings.regexImg,'i');if(image.test(url)){return'image';}}
		function isSwf(url){var swf=new RegExp('[^\.]\.(swf)\s*$','i');return swf.test(url);}
		function extractUrlSel(url){var ret={url:null,selector:null};if(url){var hash=getHash(url);var hashLoc=getHash(window.location.href);var curLoc=window.location.href.substring(0,window.location.href.length-hashLoc.length);var req=url.substring(0,url.length-hash.length);if(req==curLoc||req==$('base').attr('href')){ret.selector=hash;}else{ret.url=req;ret.selector=hash;}}
		return ret;}
		function loadingError(){debug('loadingError');modal.error=true;if(!modal.ready)
		return;if($.isFunction(currentSettings.handleError))
		currentSettings.handleError(modal,currentSettings);modal.loading.addClass(currentSettings.errorClass).html(currentSettings.contentError);$(currentSettings.closeSelector,modal.loading).unbind('click.nyroModal').bind('click.nyroModal',removeModal);setMarginLoading();modal.loading.css({marginTop:currentSettings.marginTopLoading+'px',marginLeft:currentSettings.marginLeftLoading+'px'});}
		function fillContent(){debug('fillContent');if(!modal.tmp.html())
		return;modal.content.html(modal.tmp.contents());modal.tmp.empty();wrapContent();if(currentSettings.type=='iframeForm'){$(currentSettings.from).attr('target','nyroModalIframe').data('nyroModalprocessing',1).submit().attr('target','_blank').removeData('nyroModalprocessing');}
		if(!currentSettings.modal)
		modal.wrapper.prepend(currentSettings.closeButton);modal.wrapper.prepend(currentSettings.closeButton2);if($.isFunction(currentSettings.endFillContent))
		currentSettings.endFillContent(modal,currentSettings);modal.content.append(modal.scripts);$(currentSettings.closeSelector,modal.contentWrapper).unbind('click.nyroModal').bind('click.nyroModal',removeModal);$(currentSettings.openSelector,modal.contentWrapper).nyroModal(getCurrentSettingsNew());}
		function getCurrentSettingsNew(){var currentSettingsNew=$.extend(true,{},currentSettings);if(resized.width)
		currentSettingsNew.width=null;else
		currentSettingsNew.width=initSettingsSize.width;if(resized.height)
		currentSettingsNew.height=null;else
		currentSettingsNew.height=initSettingsSize.height;currentSettingsNew.css.content.overflow='auto';return currentSettingsNew;}
		function wrapContent(){debug('wrapContent');var wrap=$(currentSettings.wrap[currentSettings.type]);modal.content.append(wrap.children().remove());modal.contentWrapper.wrapInner(wrap);if(currentSettings.gallery){modal.content.append(currentSettings.galleryLinks);gallery.links=$('[rel*="'+currentSettings.gallery+'"]');gallery.index=gallery.links.index(currentSettings.from);if(currentSettings.galleryCounts&&$.isFunction(currentSettings.galleryCounts))
		currentSettings.galleryCounts(gallery.index+1,gallery.links.length,modal,currentSettings);var currentSettingsNew=getCurrentSettingsNew();var linkPrev=getGalleryLink(-1);if(linkPrev){var prev=$('.nyroModalPrev',modal.contentWrapper).attr('href',linkPrev.attr('href')).click(function(e){e.preventDefault();$.nyroModalPrev();return false;});if(isIE6&&currentSettings.type=='swf'){prev.before($('<iframe id="nyroModalIframeHideIeGalleryPrev" src="javascript:false;"></iframe>').css({position:prev.css('position'),top:prev.css('top'),left:prev.css('left'),width:prev.width(),height:prev.height(),opacity:0,border:'none'}));}}else{$('.nyroModalPrev',modal.contentWrapper).remove();}
		var linkNext=getGalleryLink(1);if(linkNext){var next=$('.nyroModalNext',modal.contentWrapper).attr('href',linkNext.attr('href')).click(function(e){e.preventDefault();$.nyroModalNext();return false;});if(isIE6&&currentSettings.type=='swf'){next.before($('<iframe id="nyroModalIframeHideIeGalleryNext" src="javascript:false;"></iframe>').css($.extend({},{position:next.css('position'),top:next.css('top'),left:next.css('left'),width:next.width(),height:next.height(),opacity:0,border:'none'})));}}else{$('.nyroModalNext',modal.contentWrapper).remove();}}
		calculateSize();}
		function getGalleryLink(dir){if(currentSettings.gallery){if(!currentSettings.ltr)
		dir*=-1;var index=gallery.index+dir;if(index>=0&&index<gallery.links.length)
		return gallery.links.eq(index);}
		return false;}
		function calculateSize(resizing){debug('calculateSize');modal.wrapper=modal.contentWrapper.children('div:first');resized.width=false;resized.height=false;if(false&&!currentSettings.windowResizing){initSettingsSize.width=currentSettings.width;initSettingsSize.height=currentSettings.height;}
		if(currentSettings.autoSizable&&(!currentSettings.width||!currentSettings.height)){modal.contentWrapper.css({opacity:0,width:'auto',height:'auto'}).show();var tmp={width:'auto',height:'auto'};if(currentSettings.width){tmp.width=currentSettings.width;}else if(currentSettings.type=='iframe'){tmp.width=currentSettings.minWidth;}
		if(currentSettings.height){tmp.height=currentSettings.height;}else if(currentSettings.type=='iframe'){tmp.height=currentSettings.minHeight;}
		modal.content.css(tmp);if(!currentSettings.width){currentSettings.width=modal.content.outerWidth(true);resized.width=true;}
		if(!currentSettings.height){currentSettings.height=modal.content.outerHeight(true);resized.height=true;}
		modal.contentWrapper.css({opacity:1});if(!resizing)
		modal.contentWrapper.hide();}
		if(currentSettings.type!='image'&&currentSettings.type!='swf'){currentSettings.width=Math.max(currentSettings.width,currentSettings.minWidth);currentSettings.height=Math.max(currentSettings.height,currentSettings.minHeight);}
		var outerWrapper=getOuter(modal.contentWrapper);var outerWrapper2=getOuter(modal.wrapper);var outerContent=getOuter(modal.content);var tmp={content:{width:currentSettings.width,height:currentSettings.height},wrapper2:{width:currentSettings.width+outerContent.w.total,height:currentSettings.height+outerContent.h.total},wrapper:{width:currentSettings.width+outerContent.w.total+outerWrapper2.w.total,height:currentSettings.height+outerContent.h.total+outerWrapper2.h.total}};if(currentSettings.resizable){var maxHeight=modal.blockerVars?modal.blockerVars.height:$(window).height()
		-outerWrapper.h.border
		-(tmp.wrapper.height-currentSettings.height);var maxWidth=modal.blockerVars?modal.blockerVars.width:$(window).width()
		-outerWrapper.w.border
		-(tmp.wrapper.width-currentSettings.width);maxHeight-=currentSettings.padding*2;maxWidth-=currentSettings.padding*2;if(tmp.content.height>maxHeight||tmp.content.width>maxWidth){if(currentSettings.type=='image'||currentSettings.type=='swf'){var useW=currentSettings.imgWidth?currentSettings.imgWidth:currentSettings.width;var useH=currentSettings.imgHeight?currentSettings.imgHeight:currentSettings.height;var diffW=tmp.content.width-useW;var diffH=tmp.content.height-useH;if(diffH<0)diffH=0;if(diffW<0)diffW=0;var calcH=maxHeight-diffH;var calcW=maxWidth-diffW;var ratio=Math.min(calcH/useH,calcW/useW);calcW=Math.floor(useW*ratio);calcH=Math.floor(useH*ratio);tmp.content.height=calcH+diffH;tmp.content.width=calcW+diffW;}else{tmp.content.height=Math.min(tmp.content.height,maxHeight);tmp.content.width=Math.min(tmp.content.width,maxWidth);}
		tmp.wrapper2={width:tmp.content.width+outerContent.w.total,height:tmp.content.height+outerContent.h.total};tmp.wrapper={width:tmp.content.width+outerContent.w.total+outerWrapper2.w.total,height:tmp.content.height+outerContent.h.total+outerWrapper2.h.total};}}
		if(currentSettings.type=='swf'){$('object, embed',modal.content).attr('width',tmp.content.width).attr('height',tmp.content.height);}else if(currentSettings.type=='image'){$('img',modal.content).css({width:tmp.content.width,height:tmp.content.height});}
		modal.content.css($.extend({},tmp.content,currentSettings.css.content));modal.wrapper.css($.extend({},tmp.wrapper2,currentSettings.css.wrapper2));if(!resizing)
		modal.contentWrapper.css($.extend({},tmp.wrapper,currentSettings.css.wrapper));if(currentSettings.type=='image'&&currentSettings.addImageDivTitle){$('img',modal.content).removeAttr('alt');var divTitle=$('div',modal.content);if(currentSettings.title!=currentSettings.defaultImgAlt&&currentSettings.title){if(divTitle.length==0){divTitle=$('<div>'+currentSettings.title+'</div>');modal.content.append(divTitle);}
		if(currentSettings.setWidthImgTitle){var outerDivTitle=getOuter(divTitle);divTitle.css({width:(tmp.content.width+outerContent.w.padding-outerDivTitle.w.total)+'px'});}}else if(divTitle.length=0){divTitle.remove();}}
		if(currentSettings.title)
		setTitle();tmp.wrapper.borderW=outerWrapper.w.border;tmp.wrapper.borderH=outerWrapper.h.border;setCurrentSettings(tmp.wrapper);setMargin();}
		function removeModal(e){debug('removeModal');if(e)
		e.preventDefault();if(modal.full&&modal.ready){$(document).unbind('keydown.nyroModal');if(!currentSettings.blocker)
		$(window).unbind('resize.nyroModal');modal.ready=false;modal.anim=true;modal.closing=true;if(modal.loadingShown||modal.transition){currentSettings.hideLoading(modal,currentSettings,function(){modal.loading.hide();modal.loadingShown=false;modal.transition=false;currentSettings.hideBackground(modal,currentSettings,endRemove);});}else{if(fixFF)
		modal.content.css({position:''});modal.wrapper.css({overflow:'hidden'});modal.content.css({overflow:'hidden'});if($.isFunction(currentSettings.beforeHideContent)){currentSettings.beforeHideContent(modal,currentSettings,function(){currentSettings.hideContent(modal,currentSettings,function(){endHideContent();currentSettings.hideBackground(modal,currentSettings,endRemove);});});}else{currentSettings.hideContent(modal,currentSettings,function(){endHideContent();currentSettings.hideBackground(modal,currentSettings,endRemove);});}}}
		if(e)
		return false;}
		function showContentOrLoading(){debug('showContentOrLoading');if(modal.ready&&!modal.anim){if(modal.dataReady){if(modal.tmp.html()){modal.anim=true;if(modal.transition){fillContent();modal.animContent=true;currentSettings.hideTransition(modal,currentSettings,function(){modal.loading.hide();modal.transition=false;modal.loadingShown=false;endShowContent();});}else{currentSettings.hideLoading(modal,currentSettings,function(){modal.loading.hide();modal.loadingShown=false;fillContent();setMarginLoading();setMargin();modal.animContent=true;currentSettings.showContent(modal,currentSettings,endShowContent);});}}}else if(!modal.loadingShown&&!modal.transition){modal.anim=true;modal.loadingShown=true;if(modal.error)
		loadingError();else
		modal.loading.html(currentSettings.contentLoading);$(currentSettings.closeSelector,modal.loading).unbind('click.nyroModal').bind('click.nyroModal',removeModal);setMarginLoading();currentSettings.showLoading(modal,currentSettings,function(){modal.anim=false;showContentOrLoading();});}}}
		function ajaxLoaded(data){debug('AjaxLoaded: '+this.url);modal.tmp.html(currentSettings.selector?filterScripts($('<div>'+data+'</div>').find(currentSettings.selector).contents()):filterScripts(data));if(modal.tmp.html()){modal.dataReady=true;showContentOrLoading();}else
		loadingError();}
		function formDataLoaded(){debug('formDataLoaded');var jFrom=$(currentSettings.from);jFrom.attr('action',jFrom.attr('action')+currentSettings.selector);jFrom.attr('target','');$('input[name='+currentSettings.formIndicator+']',currentSettings.from).remove();var iframe=modal.tmp.children('iframe');var iframeContent=iframe.unbind('load').contents().find(currentSettings.selector||'body').not('script[src]');iframe.attr('src','about:blank');modal.tmp.html(iframeContent.html());if(modal.tmp.html()){modal.dataReady=true;showContentOrLoading();}else
		loadingError();}
		function iframeLoaded(){if((window.location.hostname&&currentSettings.url.indexOf(window.location.hostname)>-1)||currentSettings.url.indexOf('http://')){var iframe=$('iframe',modal.full).contents();var tmp={};if(currentSettings.titleFromIframe)
		tmp.title=iframe.find('title').text();if(!tmp.title){try{tmp.title=iframe.find('title').html();}catch(err){}}
		var body=iframe.find('body');if(!currentSettings.height&&body.height())
		tmp.height=body.height();if(!currentSettings.width&&body.width())
		tmp.width=body.width();$.extend(initSettingsSize,tmp);$.nyroModalSettings(tmp);}}
		function galleryCounts(nb,total,elts,settings){if(total>1)
		settings.title+=(settings.title?' - ':'')+nb+'/'+total;}
		function endHideContent(){debug('endHideContent');modal.anim=false;if(contentEltLast){contentEltLast.append(modal.content.contents());contentEltLast=null;}else if(contentElt){contentElt.append(modal.content.contents());contentElt=null;}
		modal.content.empty();gallery={};modal.contentWrapper.hide().children().remove().empty().attr('style','').hide();if(modal.closing||modal.transition)
		modal.contentWrapper.hide();modal.contentWrapper.css(currentSettings.css.wrapper).append(modal.content);showContentOrLoading();}
		function endRemove(){debug('endRemove');$(document).unbind('keydown',keyHandler);modal.anim=false;modal.full.remove();modal.full=null;if(isIE6){body.css({height:'',width:'',position:'',overflow:''});$('html').css({overflow:''});}
		if($.isFunction(currentSettings.endRemove))
		currentSettings.endRemove(modal,currentSettings);}
		function endBackground(){debug('endBackground');modal.ready=true;modal.anim=false;showContentOrLoading();}
		function endShowContent(){debug('endShowContent');modal.anim=false;modal.animContent=false;modal.contentWrapper.css({opacity:''});fixFF=/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)&&parseFloat(browserVersion)<1.9&&currentSettings.type!='image';if(fixFF)
		modal.content.css({position:'fixed'});modal.content.append(modal.scriptsShown);if(currentSettings.type=='iframe')
		modal.content.find('iframe').attr('src',currentSettings.url);if($.isFunction(currentSettings.endShowContent))
		currentSettings.endShowContent(modal,currentSettings);if(shouldResize){shouldResize=false;$.nyroModalSettings({width:currentSettings.setWidth,height:currentSettings.setHeight});delete currentSettings['setWidth'];delete currentSettings['setHeight'];}
		if(resized.width)
		setCurrentSettings({width:null});if(resized.height)
		setCurrentSettings({height:null});}
		function getHash(url){if(typeof url=='string'){var hashPos=url.indexOf('#');if(hashPos>-1)
		return url.substring(hashPos);}
		return'';}
		function filterScripts(data){if(typeof data=='string')
		data=data.replace(/<\/?(html|head|body)([^>]*)>/gi,'');var tmp=new Array();$.each($.clean({0:data},this.ownerDocument),function(){if($.nodeName(this,"script")){if(!this.src||$(this).attr('rel')=='forceLoad'){if($(this).attr('rev')=='shown')
		modal.scriptsShown.push(this);else
		modal.scripts.push(this);}}else
		tmp.push(this);});return tmp;}
		function getOuter(elm){elm=elm.get(0);var ret={h:{margin:getCurCSS(elm,'marginTop')+getCurCSS(elm,'marginBottom'),border:getCurCSS(elm,'borderTopWidth')+getCurCSS(elm,'borderBottomWidth'),padding:getCurCSS(elm,'paddingTop')+getCurCSS(elm,'paddingBottom')},w:{margin:getCurCSS(elm,'marginLeft')+getCurCSS(elm,'marginRight'),border:getCurCSS(elm,'borderLeftWidth')+getCurCSS(elm,'borderRightWidth'),padding:getCurCSS(elm,'paddingLeft')+getCurCSS(elm,'paddingRight')}};ret.h.outer=ret.h.margin+ret.h.border;ret.w.outer=ret.w.margin+ret.w.border;ret.h.inner=ret.h.padding+ret.h.border;ret.w.inner=ret.w.padding+ret.w.border;ret.h.total=ret.h.outer+ret.h.padding;ret.w.total=ret.w.outer+ret.w.padding;return ret;}
		function getCurCSS(elm,name){var ret=parseInt($.curCSS(elm,name,true));if(isNaN(ret))
		ret=0;return ret;}
		function debug(msg){if($.fn.nyroModal.settings.debug||currentSettings&&currentSettings.debug)
		nyroModalDebug(msg,modal,currentSettings||{});}
		function showBackground(elts,settings,callback){elts.bg.css({opacity:0.75,display:'block'}).fadeTo(5,0.75,callback);}
		function hideBackground(elts,settings,callback){elts.bg.fadeOut(300,callback);}
		function showLoading(elts,settings,callback){elts.loading.css({marginTop:settings.marginTopLoading+'px',marginLeft:settings.marginLeftLoading+'px',opacity:0}).show().animate({opacity:1},{complete:callback,duration:400});}
		function hideLoading(elts,settings,callback){callback();}
		function showContent(elts,settings,callback){elts.loading.css({marginTop:settings.marginTopLoading+'px',marginLeft:settings.marginLeftLoading+'px'}).show().animate({width:settings.width+'px',height:settings.height+'px',marginTop:settings.marginTop+'px',marginLeft:settings.marginLeft+'px'},{duration:350,complete:function(){elts.contentWrapper.css({width:settings.width+'px',height:settings.height+'px',marginTop:settings.marginTop+'px',marginLeft:settings.marginLeft+'px'}).show();elts.loading.fadeOut(200,callback);}});}
		function hideContent(elts,settings,callback){elts.contentWrapper.fadeOut('slow',function()
		{elts.contentWrapper.fadeOut('fast');$(this).css({height:'50px',width:'50px',marginTop:(-(25+settings.borderH)/2+settings.marginScrollTop)+'px',marginLeft:(-(25+settings.borderW)/2+settings.marginScrollLeft)+'px'});callback();});}
		function showTransition(elts,settings,callback){elts.loading.css({marginTop:elts.contentWrapper.css('marginTop'),marginLeft:elts.contentWrapper.css('marginLeft'),height:elts.contentWrapper.css('height'),width:elts.contentWrapper.css('width'),opacity:0}).show().fadeTo(400,1,function(){elts.contentWrapper.hide();callback();});}
		function hideTransition(elts,settings,callback){elts.contentWrapper.hide().css({width:settings.width+'px',height:settings.height+'px',marginLeft:settings.marginLeft+'px',marginTop:settings.marginTop+'px',opacity:1});elts.loading.animate({width:settings.width+'px',height:settings.height+'px',marginLeft:settings.marginLeft+'px',marginTop:settings.marginTop+'px'},{complete:function(){elts.contentWrapper.show();elts.loading.fadeOut(400,function(){elts.loading.hide();callback();});},duration:350});}
		function resize(elts,settings,callback){elts.contentWrapper.animate({width:settings.width+'px',height:settings.height+'px',marginLeft:settings.marginLeft+'px',marginTop:settings.marginTop+'px'},{complete:callback,duration:400});}
		function updateBgColor(elts,settings,callback){if(!$.fx.step.backgroundColor){elts.bg.css({backgroundColor:settings.bgColor});callback();}else
		elts.bg.animate({backgroundColor:settings.bgColor},{complete:callback,duration:400});}
		$($.fn.nyroModal.settings.openSelector).nyroModal();});function nyroModalDebug(msg,elts,settings){if(elts.full)
		elts.bg.prepend(msg+'<br />');}

	// =============================
	//  end: jquery plugins
	// =============================

	// =============================
	//  start: misc scripts
	// =============================
	
		/*	SWFObject v2.0 <http://code.google.com/p/swfobject/> Copyright (c) 2007 Geoff Stearns, Michael Williams, and Bobby van der Sluis This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>*/
		var swfobject=function(){var Z="undefined",P="object",B="Shockwave Flash",h="ShockwaveFlash.ShockwaveFlash",W="application/x-shockwave-flash",K="SWFObjectExprInst",G=window,g=document,N=navigator,f=[],H=[],Q=null,L=null,T=null,S=false,C=false;var a=function(){var l=typeof g.getElementById!=Z&&typeof g.getElementsByTagName!=Z&&typeof g.createElement!=Z&&typeof g.appendChild!=Z&&typeof g.replaceChild!=Z&&typeof g.removeChild!=Z&&typeof g.cloneNode!=Z,t=[0,0,0],n=null;if(typeof N.plugins!=Z&&typeof N.plugins[B]==P){n=N.plugins[B].description;if(n){n=n.replace(/^.*\s+(\S+\s+\S+$)/,"$1");t[0]=parseInt(n.replace(/^(.*)\..*$/,"$1"),10);t[1]=parseInt(n.replace(/^.*\.(.*)\s.*$/,"$1"),10);t[2]=/r/.test(n)?parseInt(n.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof G.ActiveXObject!=Z){var o=null,s=false;try{o=new ActiveXObject(h+".7")}catch(k){try{o=new ActiveXObject(h+".6");t=[6,0,21];o.AllowScriptAccess="always"}catch(k){if(t[0]==6){s=true}}if(!s){try{o=new ActiveXObject(h)}catch(k){}}}if(!s&&o){try{n=o.GetVariable("$version");if(n){n=n.split(" ")[1].split(",");t=[parseInt(n[0],10),parseInt(n[1],10),parseInt(n[2],10)]}}catch(k){}}}}var v=N.userAgent.toLowerCase(),j=N.platform.toLowerCase(),r=/webkit/.test(v)?parseFloat(v.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,i=false,q=j?/win/.test(j):/win/.test(v),m=j?/mac/.test(j):/mac/.test(v);/*@cc_on i=true;@if(@_win32)q=true;@elif(@_mac)m=true;@end@*/return{w3cdom:l,pv:t,webkit:r,ie:i,win:q,mac:m}}();var e=function(){if(!a.w3cdom){return }J(I);if(a.ie&&a.win){try{g.write("<script id=__ie_ondomload defer=true src=//:><\/script>");var i=c("__ie_ondomload");if(i){i.onreadystatechange=function(){if(this.readyState=="complete"){this.parentNode.removeChild(this);V()}}}}catch(j){}}if(a.webkit&&typeof g.readyState!=Z){Q=setInterval(function(){if(/loaded|complete/.test(g.readyState)){V()}},10)}if(typeof g.addEventListener!=Z){g.addEventListener("DOMContentLoaded",V,null)}M(V)}();function V(){if(S){return }if(a.ie&&a.win){var m=Y("span");try{var l=g.getElementsByTagName("body")[0].appendChild(m);l.parentNode.removeChild(l)}catch(n){return }}S=true;if(Q){clearInterval(Q);Q=null}var j=f.length;for(var k=0;k<j;k++){f[k]()}}function J(i){if(S){i()}else{f[f.length]=i}}function M(j){if(typeof G.addEventListener!=Z){G.addEventListener("load",j,false)}else{if(typeof g.addEventListener!=Z){g.addEventListener("load",j,false)}else{if(typeof G.attachEvent!=Z){G.attachEvent("onload",j)}else{if(typeof G.onload=="function"){var i=G.onload;G.onload=function(){i();j()}}else{G.onload=j}}}}}function I(){var l=H.length;for(var j=0;j<l;j++){var m=H[j].id;if(a.pv[0]>0){var k=c(m);if(k){H[j].width=k.getAttribute("width")?k.getAttribute("width"):"0";H[j].height=k.getAttribute("height")?k.getAttribute("height"):"0";if(O(H[j].swfVersion)){if(a.webkit&&a.webkit<312){U(k)}X(m,true)}else{if(H[j].expressInstall&&!C&&O("6.0.65")&&(a.win||a.mac)){D(H[j])}else{d(k)}}}}else{X(m,true)}}}function U(m){var k=m.getElementsByTagName(P)[0];if(k){var p=Y("embed"),r=k.attributes;if(r){var o=r.length;for(var n=0;n<o;n++){if(r[n].nodeName.toLowerCase()=="data"){p.setAttribute("src",r[n].nodeValue)}else{p.setAttribute(r[n].nodeName,r[n].nodeValue)}}}var q=k.childNodes;if(q){var s=q.length;for(var l=0;l<s;l++){if(q[l].nodeType==1&&q[l].nodeName.toLowerCase()=="param"){p.setAttribute(q[l].getAttribute("name"),q[l].getAttribute("value"))}}}m.parentNode.replaceChild(p,m)}}function F(i){if(a.ie&&a.win&&O("8.0.0")){G.attachEvent("onunload",function(){var k=c(i);if(k){for(var j in k){if(typeof k[j]=="function"){k[j]=function(){}}}k.parentNode.removeChild(k)}})}}function D(j){C=true;var o=c(j.id);if(o){if(j.altContentId){var l=c(j.altContentId);if(l){L=l;T=j.altContentId}}else{L=b(o)}if(!(/%$/.test(j.width))&&parseInt(j.width,10)<310){j.width="310"}if(!(/%$/.test(j.height))&&parseInt(j.height,10)<137){j.height="137"}g.title=g.title.slice(0,47)+" - Flash Player Installation";var n=a.ie&&a.win?"ActiveX":"PlugIn",k=g.title,m="MMredirectURL="+G.location+"&MMplayerType="+n+"&MMdoctitle="+k,p=j.id;if(a.ie&&a.win&&o.readyState!=4){var i=Y("div");p+="SWFObjectNew";i.setAttribute("id",p);o.parentNode.insertBefore(i,o);o.style.display="none";G.attachEvent("onload",function(){o.parentNode.removeChild(o)})}R({data:j.expressInstall,id:K,width:j.width,height:j.height},{flashvars:m},p)}}function d(j){if(a.ie&&a.win&&j.readyState!=4){var i=Y("div");j.parentNode.insertBefore(i,j);i.parentNode.replaceChild(b(j),i);j.style.display="none";G.attachEvent("onload",function(){j.parentNode.removeChild(j)})}else{j.parentNode.replaceChild(b(j),j)}}function b(n){var m=Y("div");if(a.win&&a.ie){m.innerHTML=n.innerHTML}else{var k=n.getElementsByTagName(P)[0];if(k){var o=k.childNodes;if(o){var j=o.length;for(var l=0;l<j;l++){if(!(o[l].nodeType==1&&o[l].nodeName.toLowerCase()=="param")&&!(o[l].nodeType==8)){m.appendChild(o[l].cloneNode(true))}}}}}return m}function R(AE,AC,q){var p,t=c(q);if(typeof AE.id==Z){AE.id=q}if(a.ie&&a.win){var AD="";for(var z in AE){if(AE[z]!=Object.prototype[z]){if(z=="data"){AC.movie=AE[z]}else{if(z.toLowerCase()=="styleclass"){AD+=' class="'+AE[z]+'"'}else{if(z!="classid"){AD+=" "+z+'="'+AE[z]+'"'}}}}}var AB="";for(var y in AC){if(AC[y]!=Object.prototype[y]){AB+='<param name="'+y+'" value="'+AC[y]+'" />'}}t.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AD+">"+AB+"</object>";F(AE.id);p=c(AE.id)}else{if(a.webkit&&a.webkit<312){var AA=Y("embed");AA.setAttribute("type",W);for(var x in AE){if(AE[x]!=Object.prototype[x]){if(x=="data"){AA.setAttribute("src",AE[x])}else{if(x.toLowerCase()=="styleclass"){AA.setAttribute("class",AE[x])}else{if(x!="classid"){AA.setAttribute(x,AE[x])}}}}}for(var w in AC){if(AC[w]!=Object.prototype[w]){if(w!="movie"){AA.setAttribute(w,AC[w])}}}t.parentNode.replaceChild(AA,t);p=AA}else{var s=Y(P);s.setAttribute("type",W);for(var v in AE){if(AE[v]!=Object.prototype[v]){if(v.toLowerCase()=="styleclass"){s.setAttribute("class",AE[v])}else{if(v!="classid"){s.setAttribute(v,AE[v])}}}}for(var u in AC){if(AC[u]!=Object.prototype[u]&&u!="movie"){E(s,u,AC[u])}}t.parentNode.replaceChild(s,t);p=s}}return p}function E(k,i,j){var l=Y("param");l.setAttribute("name",i);l.setAttribute("value",j);k.appendChild(l)}function c(i){return g.getElementById(i)}function Y(i){return g.createElement(i)}function O(k){var j=a.pv,i=k.split(".");i[0]=parseInt(i[0],10);i[1]=parseInt(i[1],10);i[2]=parseInt(i[2],10);return(j[0]>i[0]||(j[0]==i[0]&&j[1]>i[1])||(j[0]==i[0]&&j[1]==i[1]&&j[2]>=i[2]))?true:false}function A(m,j){if(a.ie&&a.mac){return }var l=g.getElementsByTagName("head")[0],k=Y("style");k.setAttribute("type","text/css");k.setAttribute("media","screen");if(!(a.ie&&a.win)&&typeof g.createTextNode!=Z){k.appendChild(g.createTextNode(m+" {"+j+"}"))}l.appendChild(k);if(a.ie&&a.win&&typeof g.styleSheets!=Z&&g.styleSheets.length>0){var i=g.styleSheets[g.styleSheets.length-1];if(typeof i.addRule==P){i.addRule(m,j)}}}function X(k,i){var j=i?"visible":"hidden";if(S){c(k).style.visibility=j}else{A("#"+k,"visibility:"+j)}}return{registerObject:function(l,i,k){if(!a.w3cdom||!l||!i){return }var j={};j.id=l;j.swfVersion=i;j.expressInstall=k?k:false;H[H.length]=j;X(l,false)},getObjectById:function(l){var i=null;if(a.w3cdom&&S){var j=c(l);if(j){var k=j.getElementsByTagName(P)[0];if(!k||(k&&typeof j.SetVariable!=Z)){i=j}else{if(typeof k.SetVariable!=Z){i=k}}}}return i},embedSWF:function(n,u,r,t,j,m,k,p,s){if(!a.w3cdom||!n||!u||!r||!t||!j){return }r+="";t+="";if(O(j)){X(u,false);var q=(typeof s==P)?s:{};q.data=n;q.width=r;q.height=t;var o=(typeof p==P)?p:{};if(typeof k==P){for(var l in k){if(k[l]!=Object.prototype[l]){if(typeof o.flashvars!=Z){o.flashvars+="&"+l+"="+k[l]}else{o.flashvars=l+"="+k[l]}}}}J(function(){R(q,o,u);if(q.id==u){X(u,true)}})}else{if(m&&!C&&O("6.0.65")&&(a.win||a.mac)){X(u,false);J(function(){var i={};i.id=i.altContentId=u;i.width=r;i.height=t;i.expressInstall=m;D(i)})}}},getFlashPlayerVersion:function(){return{major:a.pv[0],minor:a.pv[1],release:a.pv[2]}},hasFlashPlayerVersion:O,createSWF:function(k,j,i){if(a.w3cdom&&S){return R(k,j,i)}else{return undefined}},createCSS:function(j,i){if(a.w3cdom){A(j,i)}},addDomLoadEvent:J,addLoadEvent:M,getQueryParamValue:function(m){var l=g.location.search||g.location.hash;if(m==null){return l}if(l){var k=l.substring(1).split("&");for(var j=0;j<k.length;j++){if(k[j].substring(0,k[j].indexOf("="))==m){return k[j].substring((k[j].indexOf("=")+1))}}}return""},expressInstallCallback:function(){if(C&&L){var i=c(K);if(i){i.parentNode.replaceChild(L,i);if(T){X(T,true);if(a.ie&&a.win){L.style.display="block"}}L=null;T=null;C=false}}}}}();

	// =============================
	//  end: misc scripts
	// =============================


$(document).ready(function() {
	
	// =============================
	//  start: navigation tabs
	// =============================

		// initialize dropdown
		$('div.navigationTab').css({display: 'none', left: 0});
		
		//functions called by hoverIntent for dropdowns
		var thisNavTab,thisTabPosition,thisTabWidth;  //vars defined globally
		var origBlueThingMarginTop = $('#navigationContainer .blueThing').css('marginTop');
		var ulMousoverFlag = false;
		var firstExpandFlag = true;
		
		function dummyf1(){};
		function slideBlueThingIn()
		{
			//stop
			$('#navigationContainer .blueThing').stop(true, false);
			if(firstExpandFlag) //when hovering over nav for first time
			{
				firstExpandFlag = false;
				//move to correct tab
				$('#navigationContainer .blueThing').css({marginLeft: thisTabPosition, width: thisTabWidth});
				//move down and show
				$('#navigationContainer .blueThing').css({marginTop:0,display:'block'});
				//animate up
				$('#navigationContainer .blueThing').animate({marginTop:origBlueThingMarginTop}, 300);
			}
			//animate to correct tab
			$('#navigationContainer .blueThing').animate({marginLeft: thisTabPosition, width: thisTabWidth}, 200);
		}
		function slideBlueThingOut()
		{
			//animate down and hide
			$('#navigationContainer .blueThing').queue("fx", []); //delete queue
			$('#navigationContainer .blueThing').stop().css({marginTop:origBlueThingMarginTop,display:'none'});
		}
		function expandNavigation() {
			$('#dashboard').css('display','none');
			thisNavTab = $(this).children('div.navigationTab');
			thisTabPosition = this.offsetLeft;
			thisTabWidth = this.offsetWidth - 22;
			$('div.navigationTab',this).addClass('sfhover').css({visibility: 'visible', display: 'block'});
			slideBlueThingIn();
			$('div.navigationTab').not(thisNavTab).css({display: 'none'});
			$('#extraDiv1').addClass('overlay').fadeIn(700);
			//disable dash
		}
		function collapseNavigation() {
				//$('#content2').stop(true,false).css('opacity', '1');
				$('#dashboard').css('display','block');
				$('#extraDiv1').stop(true,true).removeClass('overlay').css({display: 'none'});
				$('div.navigationTab').stop(true,false).css({display: 'none','opacity':1});
				slideBlueThingOut();
		}
		// config1 is when in tabs are already open
		var config1 = {    
			 sensitivity: 20, // number = sensitivity threshold (must be 1 or higher)    
			 interval: 10, // number = milliseconds for onMouseOver polling interval    
			 over: expandNavigation, // function = onMouseOver callback (REQUIRED)    
			 timeout: 1, // number = milliseconds delay before onMouseOut    
			 out: dummyf1 // function = onMouseOut callback (REQUIRED)    
		};
		// config2 is when tabs are closed
		var config2 = {    
			 sensitivity: 4,
			 interval: 250,
			 over: expandNavigation,
			 timeout: 1,
			 out: dummyf1
		};
		$('li.macroCategory').hoverIntent(config2);
		
		// reduce flicker of 'overlay' flag to denote hovering on ul
		$('ul#navigation').hover(
			function()
			{	
				ulMousoverFlag=true;
				$('li.macroCategory').hoverIntent(config1);
				//load in first images for all tabs
				$.each($('div.navigationTab ul'), function(i,n){
					var firstImgSrc = $('img:first', n).parent().attr('rel');
					$('img:first', n).attr('src',firstImgSrc).css({display:'block'});
				});
				if(ie6flag)
				{
					$('select').css({display:'none'});
					$('#extraDiv1').prependTo('body'); //this solves the IE6 problem with height 100% and the overlay
				}
			},
			function()
			{ulMousoverFlag=false;firstExpandFlag=true;collapseNavigation();$('li.macroCategory').hoverIntent(config2);
				if(ie6flag)$('select').css({display:'block'});
			}
			);
		
		//inner tab interactivity with stage images
		$('div.navigationTab li').hover(
			function(){
				$('img',this).attr('src',$(this).attr('rel'));
				if (!$(this).is(":first-child")) {
					$(this).parent().children('li.firstChild').children('img').css({display:'none'})
				}
				else {}
				$('img', this).stop(false, true).css('display','block');
			},
			function(){
				$('img', this).stop(false, true).css('display','none');
			}
		);
		$('div.navigationTab ul').hover(
			function(){
			},
			function(){
				$('img:first', this).stop(false, true).fadeIn(50);
			}
		);
		
		
		// service messages - use jquery cycle
		var randomNum = Math.round(Math.random() * 10);
		if (jQuery.support.opacity) {
			var serviceMessageOptions = {fx: 'fade', speed:  3000, timeout: 12000, next: '#header2 div.dropShadow', cleartype: true, cleartypeNoBg: true, pause: 1,startingSlide: randomNum};
		} else {
			var serviceMessageOptions = {speed:  0, timeout: 12000, next: '#header2 div.dropShadow', cleartype: true, cleartypeNoBg: true, pause: 1,startingSlide: randomNum};
		}
		$('div#header2 div#serviceMessages div#header_serviceMessages')
			.cycle(serviceMessageOptions);	

	// =============================
	//  end: navigation tabs
	// =============================

	// =========================================
	//  start: hides object until it's been fully loaded. object must have css attribute visibility:hidden;.
	// =========================================
		var i = 0;
		var initiallyHiddenArray = ['#heroLaunch','#header_serviceMessages','#dashboard','#slider','#smallPhotos'];
		for(i=0;i<initiallyHiddenArray.length;i++)
		{
			try{$(initiallyHiddenArray[i]).css({visibility:'visible', display:'block'});
			}catch(e){}
		}
	// =========================================
	//  end: hides object until it's been fully loaded.
	// =========================================
	
	// =========================================
	//  start: coremetrics helper functions
	// =========================================
		try{
			//creates an event handler on elements with class of ".cm_element"
			//uses rel and rev attributes to hold "elementID" and "elementCategory" parameters
			//cmCreatePageElementTag( "elementID", "elementCategory");
			$('.cm_element').click(function(event){
				try{cmCreatePageElementTag($(this).attr('rel'),$(this).attr('rev'));}catch(e){}
				//try{console.info($(this).attr('rel') + ' - ' + $(this).attr('rev'));}catch(e){}
				//event.preventDefault();
			});
		}catch(e){};
	// =========================================
	//  end: coremetrics helper functions
	// =========================================
	
	//Refresh the products last viewed area
		refreshProductLastViewed ();
	
	//Set .submit13 event to submit a form when enter is pressed
	$('#dashSignIn input.submit13, #formType input.submit13')
		.keyup(function (e){if (e.keyCode == 13) $(this).closest('form').submit()});
	
}); //end .ready


	// =========================================
	//  start: quick view functions
	// =========================================
		// Opens the product quick view modal using the productId
		function quickViewProductId(productId) {
		
			productQuickView(productId, '');  /* partNumber is blank */
		
			return false;
		}
		
		// Opens the product quick view modal using the partNumber
		function quickViewPartNumber(partNumber) {
		
			productQuickView('', partNumber);  /* productId is blank */
		
			return false;
		}
		
		// Opens the product quick view modal
		function productQuickView(productId, partNumber) {
			var quickViewURL = "/webapp/wcs/stores/servlet/ProductQuickView";
		
			quickViewURL += '?storeId='   + js_storeId;
			quickViewURL += '&catalogId=' + js_catalogId;
			quickViewURL += '&langId='    + js_langId;
		
			if (productId.length != 0) {
			    quickViewURL += '&productId=' + productId;
			} else {
			    quickViewURL += '&partNumber=' + partNumber;
			}
			
			quickViewURL += '&x=' + Math.random();
			
			$.nyroModalManual({ 
				url: quickViewURL, 
				padding: 0
			});
			return false;
		}
	// =========================================
	//  end: quick view functions
	// =========================================
	
	// =========================================
	//  begin: prod last viewed functions
	// =========================================
	
	// Add product last viewed to cookie
	function addProductLastViewed (id, partnumber) {
		var PRODUCTS_LAST_VIEWED_COOKIE = "plv";
		var newProduct = id + ":" + partnumber + ":" + js_storeId;
		var plvCookie = $.cookie(PRODUCTS_LAST_VIEWED_COOKIE);
		var cookieOptions = { expires: 90 };
		if (plvCookie == null) {
			$.cookie(PRODUCTS_LAST_VIEWED_COOKIE, newProduct, cookieOptions);
		} else {
			var foundProduct = false;
			var foundProductDetail = '';
			var products = plvCookie.split(",");
			products.reverse();
			for (i=0;i<products.length;i++) {
				var productDetail = products[i].split(":");
				if (productDetail[1] == partnumber && productDetail[2] == js_storeId) {
					foundProduct = true;
					foundProductDetail = products[i];
				}
			}
			// handle new or existing product
			if (foundProduct) {
				products = $.grep(products, function(value) {
					return value != foundProductDetail;
				});
				products.push(newProduct);
			} else  {
				products.push(newProduct);
			}
			// build the new product list
			var productsList = '';
			var count = 0;
			for (i=products.length-1;i>=0;i--) {
				if (i < products.length-1) {
					productsList += ",";
				}
				productsList += products[i];
				count ++;
				if (count >= 5) { break; }
			}
			$.cookie(PRODUCTS_LAST_VIEWED_COOKIE, productsList, cookieOptions);
		}
	}
	
	// Refresh the products last viewed area in the dashboard
	function refreshProductLastViewed () {
		var PRODUCTS_LAST_VIEWED_COOKIE = "plv";
		var plvCookie = $.cookie(PRODUCTS_LAST_VIEWED_COOKIE);
		var productCount = 0;
		if (plvCookie != null) {
			var products = plvCookie.split(",");
			$("prodLastViewed tr[id^=lvProduct]").hide();
			for (i=0;i<products.length;i++) {
				var productDetail = products[i].split(":");
				if (productDetail[2] == js_storeId) {
					productCount = productCount + 1;
					var productsLastViewedQVElement = $("#lvProductQVLink" + productCount);
					var productsLastViewedPDElement = $("#lvProductPDLink" + productCount);
					var productsLastViewedSCElement = $("#lvProductSCLink" + productCount);
					productsLastViewedQVElement.unbind("click");
					productsLastViewedQVElement.bind("click", {id:productDetail[0]},function (e) {
						quickViewProductId(e.data.id);
					});
					productsLastViewedPDElement.attr("href", "Product4_" + js_storeId + "_" + js_catalogId + "_" + productDetail[0] + "_" + js_langId);
					productsLastViewedPDElement.html(productDetail[1]);
					productsLastViewedSCElement.unbind("click");
					productsLastViewedSCElement.bind("click", {partNumber:productDetail[1]},function (e) {
						return buyNow(e.data.partNumber);
					});
					$("#lvProduct" + productCount).show();
					
				}
			}
		}
		if (productCount == 0) {
			$("#lvNoItems").show();
		} else {
			$("#lvNoItems").hide();
		}
	}

	// =========================================
	//  end: prod last viewed functions
	// =========================================


	// =========================================
	//  start: buyNow function
	//		Inputs:  partNumber - the part number that is added to the cart via quick order
	//		Outputs: submits an alternate quick order form and returns false to the link that holds the event
	// =========================================
		function buyNow(partNumber)
		{
			document.getElementById('WC_QuickOrderForm_FormInput_qoPartNumber_1_In_NPBuyNow_1_1').value = partNumber;
			document.getElementById('NPBuyNow').submit();
			return false;
		}
	// =========================================
	//  end: buyNow function
	// =========================================
	
// start className.js
function strip(st){return st.replace(/^\s+/,'').replace(/\s+$/,'');}
function hasClassName(elementId,className){var element;if(!(element=document.getElementById(elementId)))return false;var elementClassName=element.className;return(elementClassName.length>0&&(elementClassName==className||new RegExp("(^|\\s)"+className+"(\\s|$)").test(elementClassName)));}
function addClassName(elementId,className){var element;if(!(element=document.getElementById(elementId)))return false;if(!hasClassName(elementId,className))
element.className+=(element.className?' ':'')+className;return element;}
function removeClassName(elementId,className){var element;if(!(element=document.getElementById(elementId)))return false;element.className=strip(element.className.replace(new RegExp("(^|\\s+)"+className+"(\\s+|$)"),' '));return element;}
function toggleClassName(elementId,className){var element;if(!(element=document.getElementById(elementId)))return false;return element[element.hasClassName(elementId,className)?'removeClassName':'addClassName'](className);}
// start ValidationHelper.js
var validationBorderCSSClasses=new Array('validation_border','extra_padding','no_left_margin');function resetValidation(classes)
{var i,n;removeErrorMessages();var valElms=new Array;var x=document.getElementsByTagName('table');for(i=0;i<x.length;i++)
{if(x[i].id.match('val_'))
{valElms.push(x[i].id);}}
var x=document.getElementsByTagName('td');for(i=0;i<x.length;i++)
{if(x[i].id.match('val_'))
{valElms.push(x[i].id);}}
var x=document.getElementsByTagName('div');for(i=0;i<x.length;i++)
{if(x[i].id.match('val_'))
{valElms.push(x[i].id);}}
if(typeof(classes)=='undefined')classes=validationBorderCSSClasses;for(i=0;i<valElms.length;i++)
{for(n=0;n<classes.length;n++)
{removeClassName(valElms[i],classes[n]);}}}
function massAddClassName(elementIds,classes)
{var ilength,i,n;;if(elementIds.constructor.toString().indexOf('Array')==-1)
{elementIds=new Array(elementIds);}
ilength=elementIds.length;if(typeof(classes)=='undefined')classes=validationBorderCSSClasses;for(i=0;i<ilength;i++)
{for(n=0;n<classes.length;n++)
{addClassName(elementIds[i],classes[n]);}}}
function textLimit(field,maxlen)
{if(field.value.toString().length>maxlen)field.value=field.value.substring(0,maxlen);}
function validateRequired(fieldValue)
{if(false)
{}}
// start ErrorMessages.js
function insertErrorMessage(msg,instance)
{var i;var emInstances=new Array;var x=document.getElementsByTagName('div');for(i=0;i<x.length;i++)
{if(x[i].className.match('error_messages')!=null)
{emInstances.push(x[i]);}}
if(typeof(instance)=='undefined')instance=0;else if(instance=='last')instance=emInstances.length-1;else instance=parseInt(instance);var em=emInstances[instance];var em_ul=em.getElementsByTagName('ul');if(typeof(msg)=='undefined')msg=defaultMsg;msg=msg.toString();msg=msg.replace(/^(\s)*/,'');msg=msg.replace(/(\s)*$/,'');if(escape(em_ul[0].innerHTML).search(escape(msg))==-1)
{em_ul[0].innerHTML+='<li>'+msg+'</li>';}}
function removeErrorMessages(instance)
{var emInstances=new Array;var x=document.getElementsByTagName('div');var i;for(i=0;i<x.length;i++)
{if(x[i].className.match('error_messages')!=null)
{emInstances.push(x[i]);}}
if(instance=='last')instance=emInstances.length-1;if(typeof(instance)!='undefined')
{var em_ul=emInstances[parseInt(instance)].getElementsByTagName('ul');em_ul[0].innerHTML='';}
else
{for(i=0;i<emInstances.length;i++)
{var em_ul=emInstances[i].getElementsByTagName('ul');em_ul[0].innerHTML='';}}}

// start ProductItemDisplaySetup.js
function ScreenStateObj(formPrefix) {
	// properties
	this.busy = false;
	this.formPrefix = formPrefix;
	// Methods
	this.Add2ShopCart = Add2ShopCart;
	this.NpAdd2ShopCart = NpAdd2ShopCart;
	this.NpAdd2ShopList = NpAdd2ShopList;
	this.shoppingListAddSuccess = shoppingListAddSuccess;
	this.shoppingListAddError = shoppingListAddError;
	this.validateProdForm = validateProdForm;
	this.addProductToCart = addProductToCart;
	this.updateDashCart = updateDashCart;
	this.updatePricing = updatePricing;
}

function Add2ShopCart(form, catEntryId, catEntryQuantity)
{
       if (!this.busy) {
              this.busy = true;
              form.action="OrderItemAdd";
              form.catEntryId.value = catEntryId;
              form.quantity.value = catEntryQuantity;
              form.errorViewName.value = "CatalogItemAddErrorView";
              form.URL.value='SetPendingOrder?item_quantity*=&URL=OrderCalculate?URL=OrderItemDisplay&updatePrices=1&calculationUsageId=-1&orderId=.';
              form.submit();
       }
}
function NpAdd2ShopCart(form, catEntryId, catEntryQuantity, customLengthQty, URLbase)
{
	if (this.validateProdForm() && !this.busy) 
	{
    	this.busy = true;
    	var originalUrl = URLbase;
        form.action="OrderItemAdd";
        form.catEntryId.value = catEntryId;
        form.quantity.value = catEntryQuantity;
        if(customLengthQty != 0) {
	        form.field1.value = customLengthQty;
        } else {
        	form.field1.value = "";
        }
        form.errorViewName.value = "CatalogItemAddErrorView";
        form.addType.value = "shopCart";
        form.URL.value='SetPendingOrder?item_quantity*=&URL=OrderCalculate?URL=' + originalUrl;
        form.submit();
	}
}
function NpAdd2ShopList(form, catEntryId, catEntryQuantity, customLengthQty, shopListId, userId, URLbase)
{
	if (this.validateProdForm() && !this.busy) 
	{
		this.busy = true;
		// Show loading image on AJAX calls
		$("#cartLoading").ajaxStart(function(){
		   $(this).show();
		});
		$("#cartLoading").ajaxStop(function(){
		   $(this).hide();
		}); 
		var originalUrl = URLbase;
		form.catEntryId.value = catEntryId;
		form.quantity.value = catEntryQuantity;
		if(customLengthQty != 0) {
		    form.field1.value = customLengthQty;
		} 
		else {
			form.field1.value = "";
		}
		form.addType.value = "shopList";
		var storeId = form.storeId.value;
		var catalogId = form.catalogId.value;
		var langId = form.langId.value;
		
		var dataString = "";    	
		if(shopListId.length == 0)
		{
			dataString='langId='+ langId +'&storeId=' + storeId + '&catalogId=' + catalogId + '&catEntryId_1=' + catEntryId + '&quantity_1=' + catEntryQuantity + '&field1_1=' + customLengthQty + '&orderDesc=ShoppingList' + userId + '&status=Y&URL=' + originalUrl;
			
        } else
        {
        	dataString='langId='+ langId +'&storeId=' + storeId + '&catalogId=' + catalogId + '&catEntryId_1=' + catEntryId + '&quantity_1=' + catEntryQuantity + '&field1_1=' + customLengthQty + '&requisitionListId=' + shopListId + '&status=Y&URL=' + originalUrl;
        }
	  // Make Ajax Call to Add Item to ShoppingList
       $.ajax({
		   type: "GET",
		   url: "CustomShoppingListItemAddCmd",
		   data: dataString,
		   dataType: "json",
		   success: this.shoppingListAddSuccess,
		   error: this.shoppingListAddError
       });
       // Unblock the block the browser from other requests.
	   this.busy=false;
 	} // End !busy and prodValidation()
}
function shoppingListAddSuccess(response,status)  {
	if(typeof response.error != "undefined") {
			$.nyroModalManual ({
			content: "<div style=\"width: 400px; padding: 50px;\"> Error adding item to shopping list. </br> Error:" + response.error + "</div>"
		});		   
	} else if(typeof response.requisitionListId == "undefined"  )  {
				$.nyroModalManual ({
			content: "<div style=\"width: 400px; padding: 50px;\"> Generic error adding item to shopping list</div>"
		});		   
	} 
	else {
		$.nyroModalManual ({
			content: "<div style=\"width: 400px; padding: 50px;\">"  + $("#shoppingListModalText").html() + " <div>"
			});
	}	
}
function shoppingListAddError(response,status){
	$.nyroModalManual ({
		content: "<div style=\"width: 400px; padding: 50px;\"> Error adding item to shopping list</div>"
	});		  
}
function Add2RFQ(form) {
	if (form.Type[0].checked) {
		form.action="RFQCreateDisplay?endresult=0";
	} else 	{
		form.action="AddToExistRFQListDisplay?isContract=Y";
	}
	form.submit();		
}
function validateProdForm()
{
	resetValidation();
	var hasErrors = false;
	// Verify it has skus
	hasItemsSelector = $('#' + this.formPrefix + 'OrderItemAddForm input[id=hasItems]');
	if(hasItemsSelector.size() > 0 && hasItemsSelector.val() === "true") { 
		if(this.skuSelector.hasSizes) {
			if(this.skuSelector.selectedSize === "") {
				// This assumes that the error_messages for the sku selector is positioned after all other error_messages div's
				// This could be a faulty assumption.
				insertErrorMessage("Please choose a size.","last");
				massAddClassName('val_' + this.formPrefix + 'skuSize');
				hasErrors = true;
			}
		}
		if(this.skuSelector.hasColors) {
			if(this.skuSelector.selectedColor === "") {
				var msg = 'Please choose a  color.';
				if(location.href.match(/langId=-11/) || location.href.match(/_-11/)) //match uk langId
 				{
 					msg = 'Please choose a colour.';
 				}
				insertErrorMessage(msg,"last");
				massAddClassName('val_' + this.formPrefix + 'skuColor');
				hasErrors = true;
			}
		}
		if(this.skuSelector.hasMufs) {
			if(this.skuSelector.selectedMuf === "" ) {
				insertErrorMessage("Please choose a Style.","last");
				massAddClassName('val_' + this.formPrefix  + 'skuMuf');
				hasErrors = true;
			}
		}
	}	
	// validate quantitiy

	var catEntryQtySelector = $('#' + this.formPrefix + 'OrderItemAddForm input[id=item_quantity]');
	if(catEntryQtySelector.size() > 0)
	{
		var catEntryVal = parseInt(catEntryQtySelector.val().replace(',', '').replace('.', ''),10);
		catEntryQtySelector.val(catEntryVal);
		if(isNaN(catEntryVal) || parseFloat(catEntryQtySelector.val()) < 1 || catEntryQtySelector.val() == '')
		{
			msg = 'Please enter a valid quantity.';
			insertErrorMessage(msg,"last");
			var valElm = 'val_' + this.formPrefix + 'quantity';
			var classes = new Array(validationBorderCSSClasses[0]);
			massAddClassName(valElm,classes);
			hasErrors=true;	
		} else {
			catEntryQtySelector.val(catEntryVal);
		}
	}
	// validate custom length
	var customLengthSelector = $('#' + this.formPrefix + 'OrderItemAddForm select[id=cust_length_qty]');
	// var custLengthQuantity = window.document.getElementById(formPrefix + 'cust_length_qty');
	if(customLengthSelector.size() > 0)
	{
		if(customLengthSelector.val() == "")
		{
			//alert('Please choose length.');
			msg = 'Please choose length.';
			insertErrorMessage(msg,"last");
			var valElm = 'val_' + this.formPrefix + 'length';
			var classes = new Array(validationBorderCSSClasses[0]);
			massAddClassName(valElm,classes);
			hasErrors=true;	
		}
	}
	return !hasErrors;
}
function addProductToCart() {
	if (this.validateProdForm() && !this.busy) {
    	this.busy = true;
    	// Show loading image on AJAX calls
		$("#cartLoading").ajaxStart(function(){
		   $(this).show();
		   
		});
		$("#cartLoading").ajaxStop(function(){
		   $(this).hide();
		}); 
        var requestMap = {};
		requestMap['storeId'] = $('#' + this.formPrefix + 'OrderItemAddForm input[id=storeId]').val();
		requestMap['catalogId'] = $('#' + this.formPrefix + 'OrderItemAddForm input[id=catalogId]').val();
		requestMap['langId'] = $('#' + this.formPrefix + 'OrderItemAddForm input[id=langId]').val();
		requestMap['catEntryId'] = $('#' + this.formPrefix + 'OrderItemAddForm input[id=itemCatentryId]').val();
		var customLength = $('#' + this.formPrefix + 'OrderItemAddForm select[id=cust_length_qty]').val();
		if (customLength == null || customLength == "undefined") {
			customLength = "";
		}
		requestMap['cust_length_qty'] = customLength;
		requestMap['orderId'] = ".";
		requestMap['quantity'] = $('#' + this.formPrefix + 'OrderItemAddForm input[id=item_quantity]').val();
		requestMap['requesttype'] = "ajax";
		// Call the ProductPricingControl service view
		$.ajax({
		   type: "POST",
		   url: "/webapp/wcs/stores/servlet/AjaxOrderChangeServiceItemAdd",
		   data: requestMap,
		   success: this.updateDashCart,
		   dataType: "json"
		 });
		 
		 this.busy = false;
	}
}

function updateDashCart(data, textStatus) {
   	if (data.orderItemId != null && data.orderItemId != 'undefined') {
   		window.location.hash = 'test';
   		$.nyroModalManual({
   			content: $("#productAddSuccess").html(),
   			endRemove: function() {window.location.reload();}
   		});
   	}
   	if (data.errorMessageKey != null && data.errorMessageKey != 'undefined') {
   		$.nyroModalManual({ content: '<div style="width: 400px; padding: 50px;">An error has occurred: ' + data.errorMessageKey + '</div>'});
   	}
}

function updatePricing() {
	// Show loading image on AJAX calls
	$("#cartLoading").ajaxStart(function(){
	   $(this).hide();
	});
	$("#cartLoading").ajaxStop(function(){
	   $(this).hide();
	}); 
	var requestMap = {};
	requestMap['storeId'] = $('#' + this.formPrefix + 'OrderItemAddForm input[id=storeId]').val();
	requestMap['catalogId'] = $('#' + this.formPrefix + 'OrderItemAddForm input[id=catalogId]').val();
	requestMap['langId'] = $('#' + this.formPrefix + 'OrderItemAddForm input[id=langId]').val();
	requestMap['productId'] = $('#' + this.formPrefix + 'OrderItemAddForm input[id=productId]').val();
	requestMap['formPrefix'] = this.formPrefix;
	requestMap['priceItemCatalogEntryID']  = $('#' + this.formPrefix + 'OrderItemAddForm input[id=itemCatentryId]').val();
	requestMap['customLength'] = $('#' + this.formPrefix + 'OrderItemAddForm input[id=custom_length]').val();
	// Call the ProductPricingControl service view
	var pricingDataField = $('#' + this.formPrefix + 'pricingData');
	$.ajax({
	   type: "POST",
	   url: "/webapp/wcs/stores/servlet/ProductPricingControl",
	   data: requestMap,
	   success: function(data){
	     pricingDataField.html(data);
	   }
	 });
}
// SkuSelector.js
// Object that will be instanstiated when the skuSelector is being used.
function skuSelectorObj(formPrefix) {
	this.formPrefix = formPrefix;
	// Declare and Initialize state variables.
	this.hasSizes = true;
	this.hasColors = true;
	this.hasMufs = true;
	this.topLevel = "size";
	this.allSizes = new Array();;
	this.allMufs = new Array();
	this.allColors = new Array();
	this.size = new Array();
	this.color = new Array();
	this.muf = new Array();
	this.sku = new Array();
	this.mufColorsMap = new Array();
	// Declare the methods
	this.getAllMufs = getAllMufs;
	this.selectSize = selectSize;
	this.selectColor = selectColor;
	this.selectMuf = selectMuf;
	this.setSelectedSize = setSelectedSize;
	this.getSelectedSize = getSelectedSize;
	this.setSelectedColor = setSelectedColor;
	this.getSelectedColor = getSelectedColor;
	this.setSelectedMuf = setSelectedMuf;
	this.getSelectedMuf = getSelectedMuf;
	this.getSizeIndex = getSizeIndex;
	this.getColorIndex = getColorIndex;
	this.getMufIndex = getMufIndex;
	this.getAvailableColorsBySize = getAvailableColorsBySize;
	this.getAvailableColors=getAvailableColors;
	this.getAvailableMufs = getAvailableMufs;
	this.getAvailableMufsBySize	 = getAvailableMufsBySize;
	this.getItemId = getItemId;
	this.isItemSelected = isItemSelected;
	this.refreshAvailableOptions = refreshAvailableOptions;
	this.loadOptions = loadOptions;
	// TODO: Want to move these out of this object.
	this.updatePricing = updatePricing;
	this.updateDashCart = updateDashCart;
	this.loadDropDown = loadDropDown;
	this.dimDropDownOptions = dimDropDownOptions;
	this.dimColorSwatch = dimColorSwatch;
	this.dimMufSwatch = dimMufSwatch;
}		
// This method loads the drop downs for size and muf.
// Also default the options to the first option if there is only one.
function loadOptions() {
	// Load the sku selector display options. Only do this if there are SKU's.
	if(typeof this.allSizes != "undefined") {
		// Load the size optionbox if there are sizes				
		if(this.hasSizes === true) {
			this.loadDropDown("Size",this.allSizesText);
		}
		// Load the muf optionbox if dropdowns are used for mufs and there are mufs for this product. 
		if(this.hasMufs === true && this.useMufSwatches !== true ) {
			this.loadDropDown("MUF",this.allMufs);
		}
		// Default size color or muf selection if there is only one option
		if(this.hasSizes && this.allSizes.length === 1) {
			this.selectSize("0");
		}
		if(this.hasColors && this.allColors.length === 1) {
			this.selectColor("0");
		}
		if(this.hasMufs && this.allMufs.length === 1) {
			this.selectMuf("0");
		}
	}
}
/* Given an array and an the name of the option box, this function will
 * load a drop down contents of the array.  The value of each option will be the index 
 * of the given array */
function loadDropDown(name,array) {
	var optionBoxSelector = $('#' + this.formPrefix + 'OrderItemAddForm select[id=' + name + ']');
	// if it doesn't exist then exit
	if(optionBoxSelector.size() < 0) {
		return;
	}
	for(i=0;i < array.length; i++) {
		var newOption = '<option value="'+i+'">'+array[i]+'</option>'; 
		optionBoxSelector.append(newOption);
	}
}
/* Disable(dim) all options that arent in the enabled list */
function dimDropDownOptions(name, optionsArray, enabledOptions) {
	if(name==this.topLevel) {
		return;
	}
	//Create An associative array "optionStatus" for all enabled options
	var optionStatus = new Array();
	for(i=0;i < optionsArray.length; i++) {
		optionStatus[optionsArray[i]] = false;
	}
	for(i=0;i < enabledOptions.length;i++) {
		optionStatus[enabledOptions[i]] = true;

	}
	var optionsSelector = $('#' + this.formPrefix + 'OrderItemAddForm select[id=' + name + '] option');
	optionsSelector.each(function () {
		if(this.value === "")
			return;
		if(optionStatus[this.text] != true) {
			this.disabled = true;
		}else {
			this.disabled = false;
		}
	});
}
function dimColorSwatch(enabledOptions) {
	if(this.topLevel=="Color")
		return;
	var sizeIndex = this.getSizeIndex();
	//Create An associative array "optionStatus" to identify what colors are enabled/disabled
	var optionStatus = new Array();
	for(i=0;i < this.allColors.length; i++) {
		optionStatus[this.allColors[i]] = false;
	}
	for(i=0;i < enabledOptions.length;i++) {
		optionStatus[enabledOptions[i]] = true;
	}
	var colorSwatchField = $("#" + this.formPrefix + "OrderItemAddForm a.colorSwatch");
	for(i=0;i < this.allColors.length; i++) {
		if(optionStatus[this.allColors[i]] == true ) {
			colorSwatchField.eq(i).removeClass("notAvailable");
		} else {
			colorSwatchField.eq(i).addClass("notAvailable");
		}
	}
}
function dimMufSwatch(enabledOptions) {
	if(this.topLevel==="MUF")
		return;
	//Create An associative array "optionStatus" to identify what colors are enabled/disabled
	var optionStatus = new Array();
	for(i=0;i < this.allMufs.length; i++) {
		optionStatus[this.allMufs[i]] = false;
	}
	for(i=0;i < enabledOptions.length;i++) {
		optionStatus[enabledOptions[i]] = true;

	}
	var mufSwatchField = $("#" + this.formPrefix + "OrderItemAddForm a.mufSwatch");
	for(i=0;i < this.allMufs.length; i++) {
		if(optionStatus[this.allMufs[i]] == true ) {
			mufSwatchField.eq(i).removeClass("notAvailable");	
		} else {
			mufSwatchField.eq(i).addClass("notAvailable");	
		}
	}
}
function getAllMufs() {
	return this.allMufs;
}
function isValueInList(searchValue, list) {
	for(i=0;i<list.length;i++) {
		if(list[i] == searchValue) {
			return true;
		}
	}
	return false;
}
function setSelectedSize(sizeIndex) {
	this.selectedSize=sizeIndex;
}
function getSelectedSize() {
	return this.allSizes[this.selectedSize];
}
/** Action that occurs by selecting the color swatch.
* It sets the selected options and then refreshs the state of all other option  */
function selectColor(colorIndex,callback) {
	this.setSelectedColor(colorIndex);
	this.refreshAvailableOptions();
	this.getItemId();
	var priceVariesBySkuField = $('#' + this.formPrefix + 'OrderItemAddForm input[id=priceVariesBySku]');
	if(priceVariesBySkuField.val() === "true") {
		this.updatePricing();
	}
	if(typeof callback != "undefined") {
		callback();
	}
}
function selectSize(size,callback) {
	this.setSelectedSize(size);
	this.refreshAvailableOptions();
	this.getItemId();
	var priceVariesBySkuField = $('#' + this.formPrefix + 'OrderItemAddForm input[id=priceVariesBySku]');
	if(priceVariesBySkuField.val()=== "true") {
		this.updatePricing();
	}
	if(typeof callback != "undefined") {
		callback();
	}
}
function selectMuf(muf,callback) {
	this.setSelectedMuf(muf);
	this.refreshAvailableOptions();
	this.getItemId();
	var priceVariesBySkuField = $('#' + this.formPrefix + 'OrderItemAddForm input[id=priceVariesBySku]');
	if(priceVariesBySkuField.val() === "true") {
		this.updatePricing();
	}
	if(typeof callback != "undefined") {
		callback();
	}
}
/* Sets the color state variable to the index of the allColors array and updates the image to display  
 * the user selected color */
function setSelectedColor(specifiedColor) {
	var colorSwatchField = $("#" + this.formPrefix + "OrderItemAddForm a.colorSwatch");
	var colorField = $("#" + this.formPrefix + "OrderItemAddForm span[id=colorName]");
	// If the color isn't specified then clear the selection
	if(specifiedColor === "" || specifiedColor === null || specifiedColor === undefined ) {
		for(var i in this.allColors) {
			colorSwatchField.eq(i).removeClass("selectedSwatch");	
		}
		this.selectedColor = "";
		colorField.text("Choose Color");
		return;
	}
	colorSwatchField.eq(this.selectedColor).removeClass("selectedSwatch");	
	// If color hasn't been specified clear the specified Color.
	if(!specifiedColor) {
		this.selectedColor = "";
	}
	this.selectedColor = specifiedColor;
	colorSwatchField.eq(specifiedColor).addClass("selectedSwatch");	
	colorField.text(this.getSelectedColor());
}
/* Returns the color text of the of the currently selected color. */
function getSelectedColor() {
		if(this.selectedColor === "") {
			return "";
		}
		return this.allColors[this.selectedColor];
}
// This could be an optionbox, color swatches or non existant need to deal with all of these options.
function setSelectedMuf(specifiedMuf) {
	
	if(!this.hasMufs) {
		return;
	}

	if(this.useMufSwatches) {
		var mufSwatchField = $("#" + this.formPrefix + "OrderItemAddForm a.mufSwatch");
		var mufField = $("#" + this.formPrefix + "OrderItemAddForm span[id=styleName]");
		// If the color isn't specified then clear the selection
		if(specifiedMuf === "" || specifiedMuf === null || specifiedMuf === undefined ) {
			for(var i in this.allMufs) {
				mufSwatchField.eq(i).removeClass("selectedSwatch");	
			}
			this.selectedMuf = "";
			mufField.text("Choose Style");
			return;
		}
		mufSwatchField.eq(this.selectedMuf).removeClass("selectedSwatch");	
		this.selectedMuf=specifiedMuf;
		mufSwatchField.eq(specifiedMuf).addClass("selectedSwatch");	
		mufField.text(this.getSelectedMuf());
	} else {
		var mufDropDownSelector = $("#" + this.formPrefix + "OrderItemAddForm select[id=MUF]");
		// If the color isn't specified then clear the selection
		if(specifiedMuf === null || specifiedMuf === undefined ) {
			specifiedMuf="";
		}
		mufDropDownSelector.val(specifiedMuf);
		this.selectedMuf=specifiedMuf;
	}
}
/* This will return the text value of the selected MUF, 
 * empty string if not selected
 * or "noOption" if there aren't any MUF's for this product. */
function getSelectedMuf() {
	if(this.selectedMuf === "" )
		return "";
	return this.allMufs[this.selectedMuf];
}
// Returns the index value of the size array which contains the same value of the selectedSize
function getSizeIndex() {
	if(this.selectedSize) {
 	 for(var i= 0 ; i < this.size.length; i++) {
		if(this.size[i] === this.allSizes[this.selectedSize]){
			return i;
 		}
 	  }
 	}
 	return -1;  // not found
}

function getColorIndex() {
	var sizeIndex = this.getSizeIndex();
	if(this.selectedColor && sizeIndex != -1) {
 	 for(var i= 0 ; i < this.color[sizeIndex].length; i++) {
		if(this.color[sizeIndex][i] == this.allColors[this.selectedColor]){
			return i;
 		}
 	  }
 	 }
 	return -1;  // not found
}
function getMufIndex() {
	var sizeIndex = this.getSizeIndex();
	var colorIndex = this.getColorIndex();
	if(this.selectedMuf && sizeIndex >= 0 && colorIndex >= 0) {
		for(var i=0;i < this.muf[sizeIndex][colorIndex].length; i++) {
			if(this.muf[sizeIndex][colorIndex][i] == this.allMufs[this.selectedMuf]) {
				return i;
			}
		}
	}
	return -1;
}
function getAvailableColorsBySize() {
	var availableColorsArray = new Array();
	var selectedSizeIndex = this.getSizeIndex();
	if(selectedSizeIndex != -1) {
		// Get Available colors at this size.
		for(x = 0 ; x < this.color[selectedSizeIndex].length;x++) {
			availableColorsArray.push(this.color[selectedSizeIndex][x]);
		}
	}
	return availableColorsArray;
}
/*	Get the Available colors given the optional size and muf.  Returns a list of all the names of available colors.
*   If the size and muf havent been selected or arent an option then all colors will be available. */
function getAvailableColors() {
	var colorHash = new Array();
	var availableColors = new Array();
	var selectedSizeText = this.getSelectedSize();
	var selectedMufText = this.getSelectedMuf();
	var selectedSizeIndex = this.getSizeIndex();
	if(selectedSizeText == "noOptions") {selectedSizeText = "";}
	if(selectedMufText == "noOptions") {selectedMufText = "";}
	// Initialize Hash Table
	for(var i = 0 ; i < this.allColors.length; i++) {
		colorHash[this.allColors[i]] = true;
	}
	// If either size or muf option is selected, eliminate all options and add them discretely.
	if(selectedSizeText || selectedMufText) {
		for(i = 0 ; i < this.allColors.length; i++) {
 			colorHash[this.allColors[i]] = false;
		}
	}
	// Eliminate any colors that dont exist for this MUF and or SIZE.
	// The pecking order is important.
	if(selectedMufText) {
		// Get the colors that are available for this muf
		for(var eachColor in colorHash) {
			var availableColorsForMuf = this.mufColorsMap[selectedMufText];
			if(isValueInList(eachColor,availableColorsForMuf) == true) {
				colorHash[eachColor] = true;
			}
		}
		// Determine what colors exists for this size and muf.
		if(selectedSizeText) {
			for(var i in colorHash) {
				var showColorItem = eval('colorHash.'+ i);
				var colorValue = i;
				// If color is currently available as an option
				if( showColorItem == true) {
					var availableColorbySize = this.getAvailableColorsBySize();
					// if the color is not available at this size then disable it.
					if(isValueInList(colorValue,availableColorbySize) != true) {
						colorHash[colorValue] = false;
					}
				}

			}
		}
	}
	else if(selectedSizeText) {
		for(i = 0 ; i < this.color[selectedSizeIndex].length;i++) {
			colorValue = this.color[selectedSizeIndex][i];
			colorHash[colorValue] = true;

		}
	}
	// Generate return list from hashtable of Colors that are available.
	for(i=0; i < this.allColors.length; i++) {
		if(colorHash[this.allColors[i]] == true) {
			availableColors.push(this.allColors[i]);
		}
	}
	return availableColors;
}
function getAvailableMufs() {
	var availableMufs = new Array();
	var selectedSizeText = this.getSelectedSize();
	var selectedColorText = this.getSelectedColor();
	if(selectedSizeText == "noOptions") {selectedSizeText = "";}
	if(selectedColorText == "noOptions") {selectedColorText = "";}
	if(selectedColorText && selectedSizeText) {
		availableMufs = this.getAvailableMufsBySize(selectedColorText);
	} else if (selectedColorText || selectedSizeText) {
		if(selectedColorText) {
			// this actually gets available mufs for all sizes for this color.
			availableMufs = this.getAvailableMufsBySize(selectedColorText);
		} else {
			availableMufs = this.getAvailableMufsBySize();
		}
	} else	{
			availableMufs = this.getAllMufs();
	}
	return availableMufs;
}
function getAvailableMufsBySize(specifiedColor) {
	var availableMufsArray = new Array();
	var selectedSizeIndex = this.getSizeIndex();
	// If size is selected get the available mufs for the specified size
	if(selectedSizeIndex != -1) {
		for(var colorIndex=0;colorIndex < this.color[selectedSizeIndex].length;colorIndex++) {
			if(specifiedColor && this.color[selectedSizeIndex][colorIndex] != specifiedColor) {
				continue;
			}
			for(var y=0;y<this.muf[selectedSizeIndex][colorIndex].length;y++) {
				availableMufsArray.push(this.muf[selectedSizeIndex][colorIndex][y]);
			}
		}
	}
	else { // otherwise get mufs for all the available sizes
		for(var sizeIndex=0; sizeIndex < this.size.length;sizeIndex++) {
			for(var colorIndex=0;colorIndex < this.color[sizeIndex].length;colorIndex++) {
				if(specifiedColor && this.color[sizeIndex][colorIndex] != specifiedColor) {
					continue;
				}
				for(var y=0;y<this.muf[sizeIndex][colorIndex].length;y++) {
					availableMufsArray.push(this.muf[sizeIndex][colorIndex][y]);
				}
			}
		}
	}
	return availableMufsArray;
}
function getItemId() {
	var hasItemsField = $('#' + this.formPrefix + 'OrderItemAddForm input[id=hasItems]');
	if (hasItemsField.size() > 0 && hasItemsField.val() === "true") {
		var selectedSizeIndex = this.getSizeIndex();
		var selectedColorIndex = this.getColorIndex();
		var selectedMufIndex =  this.getMufIndex();
		var selectedSku = "";
		var itemCatentryIdField = $('#' + this.formPrefix + 'OrderItemAddForm input[id=itemCatentryId]');
		if( itemCatentryIdField.size() > 0 && this.isItemSelected() === true) {
			var selectedSku = this.sku[selectedSizeIndex][selectedColorIndex][selectedMufIndex];
			itemCatentryIdField.val(selectedSku);
		} else {
			itemCatentryIdField.val("");
			selectedSku = "";
		}
		return selectedSku;
	} else {
		return "";
	}
}

function isItemSelected() {

	if( this.getSizeIndex() >= 0 &&  this.getColorIndex() >= 0 && this.getMufIndex() >= 0 ) {
		return true;
	}
	return false;
}

function refreshAvailableOptions() {

	// If the previously selected option is no longer available then default back to choose an option
	if(this.topLevel === "Size" && this.hasSizes === true) {
		// Gets any array of all available colors given the current options state
		var availableColors = this.getAvailableColors();
	
		// If the current selected color isn't available anymore, then reset the selected color. 
		if(this.hasColors && this.getSelectedColor() && isValueInList(this.getSelectedColor(),availableColors) != true) {
			this.setSelectedColor("");
		}
		this.dimColorSwatch(availableColors);
	}
	if(this.topLevel != "MUF" && this.hasMufs === true) {
		var availableMufs = this.getAvailableMufs();
		// If the previously selected option is no longer available then default back to choose an option
		if(this.getSelectedMuf() && isValueInList(this.getSelectedMuf(),availableMufs) != true) {
			this.setSelectedMuf("");
			// Recursively call this function to update the colors because there may be more options available now.
			this.refreshAvailableOptions();
			// TODO: I think I should return here.. Check this out.
		}
		if(this.useMufSwatches === true ) {
			this.dimMufSwatch(availableMufs);
		} else {
			this.dimDropDownOptions("MUF", this.allMufs, availableMufs);
		}
	}
}

/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.6.0
*/
if(typeof YAHOO=="undefined"||!YAHOO){var YAHOO={};}YAHOO.namespace=function(){var A=arguments,E=null,C,B,D;for(C=0;C<A.length;C=C+1){D=A[C].split(".");E=YAHOO;for(B=(D[0]=="YAHOO")?1:0;B<D.length;B=B+1){E[D[B]]=E[D[B]]||{};E=E[D[B]];}}return E;};YAHOO.log=function(D,A,C){var B=YAHOO.widget.Logger;if(B&&B.log){return B.log(D,A,C);}else{return false;}};YAHOO.register=function(A,E,D){var I=YAHOO.env.modules;if(!I[A]){I[A]={versions:[],builds:[]};}var B=I[A],H=D.version,G=D.build,F=YAHOO.env.listeners;B.name=A;B.version=H;B.build=G;B.versions.push(H);B.builds.push(G);B.mainClass=E;for(var C=0;C<F.length;C=C+1){F[C](B);}if(E){E.VERSION=H;E.BUILD=G;}else{YAHOO.log("mainClass is undefined for module "+A,"warn");}};YAHOO.env=YAHOO.env||{modules:[],listeners:[]};YAHOO.env.getVersion=function(A){return YAHOO.env.modules[A]||null;};YAHOO.env.ua=function(){var C={ie:0,opera:0,gecko:0,webkit:0,mobile:null,air:0};var B=navigator.userAgent,A;if((/KHTML/).test(B)){C.webkit=1;}A=B.match(/AppleWebKit\/([^\s]*)/);if(A&&A[1]){C.webkit=parseFloat(A[1]);if(/ Mobile\//.test(B)){C.mobile="Apple";}else{A=B.match(/NokiaN[^\/]*/);if(A){C.mobile=A[0];}}A=B.match(/AdobeAIR\/([^\s]*)/);if(A){C.air=A[0];}}if(!C.webkit){A=B.match(/Opera[\s\/]([^\s]*)/);if(A&&A[1]){C.opera=parseFloat(A[1]);A=B.match(/Opera Mini[^;]*/);if(A){C.mobile=A[0];}}else{A=B.match(/MSIE\s([^;]*)/);if(A&&A[1]){C.ie=parseFloat(A[1]);}else{A=B.match(/Gecko\/([^\s]*)/);if(A){C.gecko=1;A=B.match(/rv:([^\s\)]*)/);if(A&&A[1]){C.gecko=parseFloat(A[1]);}}}}}return C;}();(function(){YAHOO.namespace("util","widget","example");if("undefined"!==typeof YAHOO_config){var B=YAHOO_config.listener,A=YAHOO.env.listeners,D=true,C;if(B){for(C=0;C<A.length;C=C+1){if(A[C]==B){D=false;break;}}if(D){A.push(B);}}}})();YAHOO.lang=YAHOO.lang||{};(function(){var A=YAHOO.lang,C=["toString","valueOf"],B={isArray:function(D){if(D){return A.isNumber(D.length)&&A.isFunction(D.splice);}return false;},isBoolean:function(D){return typeof D==="boolean";},isFunction:function(D){return typeof D==="function";},isNull:function(D){return D===null;},isNumber:function(D){return typeof D==="number"&&isFinite(D);},isObject:function(D){return(D&&(typeof D==="object"||A.isFunction(D)))||false;},isString:function(D){return typeof D==="string";},isUndefined:function(D){return typeof D==="undefined";},_IEEnumFix:(YAHOO.env.ua.ie)?function(F,E){for(var D=0;D<C.length;D=D+1){var H=C[D],G=E[H];if(A.isFunction(G)&&G!=Object.prototype[H]){F[H]=G;}}}:function(){},extend:function(H,I,G){if(!I||!H){throw new Error("extend failed, please check that "+"all dependencies are included.");}var E=function(){};E.prototype=I.prototype;H.prototype=new E();H.prototype.constructor=H;H.superclass=I.prototype;if(I.prototype.constructor==Object.prototype.constructor){I.prototype.constructor=I;}if(G){for(var D in G){if(A.hasOwnProperty(G,D)){H.prototype[D]=G[D];}}A._IEEnumFix(H.prototype,G);}},augmentObject:function(H,G){if(!G||!H){throw new Error("Absorb failed, verify dependencies.");}var D=arguments,F,I,E=D[2];if(E&&E!==true){for(F=2;F<D.length;F=F+1){H[D[F]]=G[D[F]];}}else{for(I in G){if(E||!(I in H)){H[I]=G[I];}}A._IEEnumFix(H,G);}},augmentProto:function(G,F){if(!F||!G){throw new Error("Augment failed, verify dependencies.");}var D=[G.prototype,F.prototype];for(var E=2;E<arguments.length;E=E+1){D.push(arguments[E]);}A.augmentObject.apply(this,D);},dump:function(D,I){var F,H,K=[],L="{...}",E="f(){...}",J=", ",G=" => ";if(!A.isObject(D)){return D+"";}else{if(D instanceof Date||("nodeType" in D&&"tagName" in D)){return D;}else{if(A.isFunction(D)){return E;}}}I=(A.isNumber(I))?I:3;if(A.isArray(D)){K.push("[");for(F=0,H=D.length;F<H;F=F+1){if(A.isObject(D[F])){K.push((I>0)?A.dump(D[F],I-1):L);}else{K.push(D[F]);}K.push(J);}if(K.length>1){K.pop();}K.push("]");}else{K.push("{");for(F in D){if(A.hasOwnProperty(D,F)){K.push(F+G);if(A.isObject(D[F])){K.push((I>0)?A.dump(D[F],I-1):L);}else{K.push(D[F]);}K.push(J);}}if(K.length>1){K.pop();}K.push("}");}return K.join("");},substitute:function(S,E,L){var I,H,G,O,P,R,N=[],F,J="dump",M=" ",D="{",Q="}";for(;;){I=S.lastIndexOf(D);if(I<0){break;}H=S.indexOf(Q,I);if(I+1>=H){break;}F=S.substring(I+1,H);O=F;R=null;G=O.indexOf(M);if(G>-1){R=O.substring(G+1);O=O.substring(0,G);}P=E[O];if(L){P=L(O,P,R);}if(A.isObject(P)){if(A.isArray(P)){P=A.dump(P,parseInt(R,10));}else{R=R||"";var K=R.indexOf(J);if(K>-1){R=R.substring(4);}if(P.toString===Object.prototype.toString||K>-1){P=A.dump(P,parseInt(R,10));}else{P=P.toString();}}}else{if(!A.isString(P)&&!A.isNumber(P)){P="~-"+N.length+"-~";N[N.length]=F;}}S=S.substring(0,I)+P+S.substring(H+1);}for(I=N.length-1;I>=0;I=I-1){S=S.replace(new RegExp("~-"+I+"-~"),"{"+N[I]+"}","g");}return S;},trim:function(D){try{return D.replace(/^\s+|\s+$/g,"");}catch(E){return D;}},merge:function(){var G={},E=arguments;for(var F=0,D=E.length;F<D;F=F+1){A.augmentObject(G,E[F],true);}return G;},later:function(K,E,L,G,H){K=K||0;E=E||{};var F=L,J=G,I,D;if(A.isString(L)){F=E[L];}if(!F){throw new TypeError("method undefined");}if(!A.isArray(J)){J=[G];}I=function(){F.apply(E,J);};D=(H)?setInterval(I,K):setTimeout(I,K);return{interval:H,cancel:function(){if(this.interval){clearInterval(D);}else{clearTimeout(D);}}};},isValue:function(D){return(A.isObject(D)||A.isString(D)||A.isNumber(D)||A.isBoolean(D));}};A.hasOwnProperty=(Object.prototype.hasOwnProperty)?function(D,E){return D&&D.hasOwnProperty(E);}:function(D,E){return !A.isUndefined(D[E])&&D.constructor.prototype[E]!==D[E];};B.augmentObject(A,B,true);YAHOO.util.Lang=A;A.augment=A.augmentProto;YAHOO.augment=A.augmentProto;YAHOO.extend=A.extend;})();YAHOO.register("yahoo",YAHOO,{version:"2.6.0",build:"1321"});

/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.6.0
*/
YAHOO.lang.JSON=(function(){var l=YAHOO.lang,_UNICODE_EXCEPTIONS=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,_ESCAPES=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,_VALUES=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,_BRACKETS=/(?:^|:|,)(?:\s*\[)+/g,_INVALID=/^[\],:{}\s]*$/,_SPECIAL_CHARS=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,_CHARS={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};function _revive(data,reviver){var walk=function(o,key){var k,v,value=o[key];if(value&&typeof value==="object"){for(k in value){if(l.hasOwnProperty(value,k)){v=walk(value,k);if(v===undefined){delete value[k];}else{value[k]=v;}}}}return reviver.call(o,key,value);};return typeof reviver==="function"?walk({"":data},""):data;}function _char(c){if(!_CHARS[c]){_CHARS[c]="\\u"+("0000"+(+(c.charCodeAt(0))).toString(16)).slice(-4);}return _CHARS[c];}function _prepare(s){return s.replace(_UNICODE_EXCEPTIONS,_char);}function _isValid(str){return l.isString(str)&&_INVALID.test(str.replace(_ESCAPES,"@").replace(_VALUES,"]").replace(_BRACKETS,""));}function _string(s){return'"'+s.replace(_SPECIAL_CHARS,_char)+'"';}function _stringify(h,key,d,w,pstack){var o=typeof w==="function"?w.call(h,key,h[key]):h[key],i,len,j,k,v,isArray,a;if(o instanceof Date){o=l.JSON.dateToString(o);}else{if(o instanceof String||o instanceof Boolean||o instanceof Number){o=o.valueOf();}}switch(typeof o){case"string":return _string(o);case"number":return isFinite(o)?String(o):"null";case"boolean":return String(o);case"object":if(o===null){return"null";}for(i=pstack.length-1;i>=0;--i){if(pstack[i]===o){return"null";}}pstack[pstack.length]=o;a=[];isArray=l.isArray(o);if(d>0){if(isArray){for(i=o.length-1;i>=0;--i){a[i]=_stringify(o,i,d-1,w,pstack)||"null";}}else{j=0;if(l.isArray(w)){for(i=0,len=w.length;i<len;++i){k=w[i];v=_stringify(o,k,d-1,w,pstack);if(v){a[j++]=_string(k)+":"+v;}}}else{for(k in o){if(typeof k==="string"&&l.hasOwnProperty(o,k)){v=_stringify(o,k,d-1,w,pstack);if(v){a[j++]=_string(k)+":"+v;}}}}a.sort();}}pstack.pop();return isArray?"["+a.join(",")+"]":"{"+a.join(",")+"}";}return undefined;}return{isValid:function(s){return _isValid(_prepare(s));},parse:function(s,reviver){s=_prepare(s);if(_isValid(s)){return _revive(eval("("+s+")"),reviver);}throw new SyntaxError("parseJSON");},stringify:function(o,w,d){if(o!==undefined){if(l.isArray(w)){w=(function(a){var uniq=[],map={},v,i,j,len;for(i=0,j=0,len=a.length;i<len;++i){v=a[i];if(typeof v==="string"&&map[v]===undefined){uniq[(map[v]=j++)]=v;}}return uniq;})(w);}d=d>=0?d:1/0;return _stringify({"":o},"",d,w,[]);}return undefined;},dateToString:function(d){function _zeroPad(v){return v<10?"0"+v:v;}return d.getUTCFullYear()+"-"+_zeroPad(d.getUTCMonth()+1)+"-"+_zeroPad(d.getUTCDate())+"T"+_zeroPad(d.getUTCHours())+":"+_zeroPad(d.getUTCMinutes())+":"+_zeroPad(d.getUTCSeconds())+"Z";},stringToDate:function(str){if(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z$/.test(str)){var d=new Date();d.setUTCFullYear(RegExp.$1,(RegExp.$2|0)-1,RegExp.$3);d.setUTCHours(RegExp.$4,RegExp.$5,RegExp.$6);return d;}return str;}};})();YAHOO.register("json",YAHOO.lang.JSON,{version:"2.6.0",build:"1321"});


/* Source from Pluck pork.iframe.js
*/

document.iframeLoaders = {};

iframe = function() { this.initialize.apply(this, arguments); };
iframe.prototype = {
	initialize: function(form, options,count){
		if (!options) options = {};
		this.form = form;
		this.uniqueId = count;
		document.iframeLoaders[this.uniqueId] = this;
		var url = form.action + '?jsonRequest=' + escape(form.elements[0].value); // change form submit to string; similar to changing form method to get
		var firstSlash = url.indexOf("/", url.indexOf("//")+2);
		this.transport = this.getTransport((firstSlash > 0) ? url.substring(0, firstSlash) : "");
		this.onComplete = options.onComplete || null;
		this.update = this.$(options.update) || null;
		this.updateMultiple = options.multiple || false;
		if (((navigator.vendor && (navigator.vendor.indexOf('Apple')) > -1) || window.opera) // safari and opera only
     && (/\/Direct\/Process(\?|$)/.test(form.action)) && form.elements && (form.elements.length == 1)) { // only change calls that contain 1 element and whose actions end with /Direct/Process
			var doc = this.transport.contentWindow || this.transport.contentDocument; // retrieve the document of the iframe
			if (url.length < 80000) { // allow fallback to normal submission (80k is the max length for urls in safari)
				if (doc.document) // make sure we have the document and not the window
					doc = doc.document;
				
				try { // if this fails, fallback to normal submission
					doc.location.replace(url); // use location.replace to overwrite elements in history 
					return;
				} catch (e) { };
			}
		}
		form.target= 'frame_'+this.uniqueId;
		form.setAttribute("target", 'frame_'+this.uniqueId); // in case the other one fails.
		form.submit();
	},

	onStateChange: function() {
		this.transport = this.$('frame_'+this.uniqueId);
		try {	 var doc = this.transport.contentDocument.body.innerHTML; this.transport.contentDocument.close(); }	// For NS6
		catch (e){ 
			try{ var doc = this.transport.contentWindow.document.body.innerHTML; this.transport.contentWindow.document.close(); } // For IE5.5 and IE6
			 catch (e){
				 try { var doc = this.transport.document.body.innerHTML; this.transport.document.body.close(); } // for IE5
					catch (e) {
						try	{ var doc = window.frames['frame_'+this.uniqueId].document.body.innerText; } // for really nasty browsers
						catch (e) { //alert(e); 
						} // forget it.
				 }
			}
		}
		this.transport.responseText = doc;
		if (this.onComplete) setTimeout(this.bind(function(){this.onComplete(this.transport);}, this), 10);
		if (this.update) setTimeout(this.bind(function(){this.update.innerHTML = this.transport.responseText;}, this), 10);
		if (this.updateMultiple){ setTimeout(this.bind(function(){ // JSON support!
				try	{ var hasscript = false; eval("var inputObject = "+this.transport.responseText);	// we're expecting a JSON object, eval it to inputObject
					for (var i in inputObject) { if (i == 'script') { hasscript = true; } // check if we passed some javascript along too
						else {if ( elm = this.$(i)) { elm.innerHTML = inputObject[i]; } else { 
						//alert("element "+i+" not found!"); 
						} } // if it's not script, update the corresponding div
					} if (hasscript) eval(inputObject['script']); // some on-the-fly-javascript exchanging support too
				} catch (e) { //alert('There was an error processing: '+this.transport.responseText); 
				} // in case of an error					
			}, this), 10);
		}	
	},

	getTransport: function(baseUrl) {
		var divElm = document.createElement('DIV'), frame;
		divElm.setAttribute('style', 'width: 0; height: 0; margin: 0; padding: 0; visibility: hidden; overflow: hidden');
		if (navigator.userAgent.indexOf('MSIE') > 0 && navigator.userAgent.indexOf('Opera') == -1) {// switch to the crappy solution for IE
			divElm.style.width = 0;
			divElm.style.height = 0;
			divElm.style.margin = 0;
			divElm.style.padding = 0;
			divElm.style.visibility = 'hidden';
			divElm.style.overflow = 'hidden';
			divElm.innerHTML = '<iframe name=\"frame_'+this.uniqueId+'\" id=\"frame_'+this.uniqueId+'\" src=\"' + baseUrl + '/ver1.0/Content/blank.html\" onload=\"setTimeout(function(){document.iframeLoaders['+this.uniqueId+'].onStateChange()},20);"></iframe>';
		} else {
			frame = document.createElement("iframe");
			frame.setAttribute("name", "frame_"+this.uniqueId);
			frame.setAttribute("id", "frame_"+this.uniqueId);
			frame.addEventListener("load", this.bind(function(){ this.onStateChange(); }, this), false);
			divElm.appendChild(frame);
		}
    (RequestBatch.container || document.body).appendChild(divElm);
		return frame;
	},
  
  bind: function(functionObject, referenceObject) {
    return function() {
      return functionObject.apply(referenceObject, arguments);
    }
  },
  
  '$': function(id) {
    return document.getElementById(id);
  }
};


/* Source from Pluck requestbatch.js */
if (typeof(RequestBatch) === 'undefined') {
    RequestBatch = function() {
      this.initialize.apply(this, arguments);
    };
    // for unique id
    var counter = 0;

    // how many requests are still pending?
    var pendingRequests = 0;

    function DirectAccessErrorHandler(msg,ex){
    //alert(msg);
    }
    (function() {
    
        function buildJsonpUrl(serverUrl, jsonString, callbackName) {
            var separator = serverUrl.indexOf('?') == -1 ? "?" : "&";
            // use Jsonp endpoint instead of Process
            serverUrl = serverUrl.replace('/Process', '/Jsonp');
            return serverUrl + separator + "r=" + encodeURIComponent(jsonString) + '&cb=' + callbackName;
        }

        function useJsonp(serverUrl, jsonString, callbackName) {
            // use Jsonp endpoint instead of Process
            serverUrl = buildJsonpUrl(serverUrl, jsonString, callbackName);
            var isIE = /*@cc_on!@*/false;
            if ((isIE && serverUrl.length < 2083) || (!isIE && serverUrl.length < 4000)) {
                return serverUrl;
            }
            return false;
        }
        
        // Cookie and HTTP Param manipulations
        // generates a list of user keys
        function getCurrentUserFromCookie() {
            var ca = document.cookie.split(';');
            for (var i = 0; i < ca.length; i++) {
                var c = ca[i];
		            while (c.charAt(0) === " ") c = c.substring(1, c.length);
		            var eqIndex = c.indexOf("=");
		            if (eqIndex > 0) {
			              name = c.substring(0, eqIndex);
			              value = c.substring(eqIndex + 1);
			              if (name.toLowerCase() == 'hd') {
			                  value = unescape(value);
			                  value = value.split('|');
        		            	
			                  return value[0];
			              }
                }
            }
            return null;
        }
        
        function createSrcUrl(baseUrl, url, userId, gcid, currentTime) { 
            var regexstring = /\DDirect\/Process\?\w\S*/;
            myregexp = new RegExp(regexstring);
            baseUrl = baseUrl.indexOf('?') == -1 ? baseUrl.replace('/Direct/Process', '/Stats/Tracker.gif') : baseUrl.replace(myregexp, '/Stats/Tracker.gif');
            
            return srcUrl = baseUrl + "?plckUrl=" + encodeURIComponent(url) + "&plckUserId=" + userId + "&plckGcid=" + gcid + "&plckCurrentTime=" + currentTime;
        }

        // the core object to request batches
        RequestBatch.prototype = {
            initialize: function() {
                this.UniqueId = counter++;
                this.Requests = new Array()
            },
            
            gcid: "daapiCall",
            
            InsertTrackerNode: function(serverUrl, requestUrl, userIdTrckr, gcid, currentTime) {
				if (document.getElementById('slImgNodeTrckr') === null) {
					var trackImgNode = document.createElement('img');
					trackImgNode.setAttribute('id', "slImgNodeTrckr");
					trackImgNode.src = createSrcUrl(serverUrl, requestUrl, userIdTrckr, gcid, currentTime);
					if (trackImgNode.style.setAttribute) {
						trackImgNode.style.setAttribute('display', 'none');
					} else {
						trackImgNode.setAttribute('style', 'display:none');
					}
					document.getElementsByTagName('body')[0].appendChild (trackImgNode);
				}
            },
            
            InitializeTracking: function(serverUrl) {
				// create a request url for stats controller
                var requestUrl = location.href;
                var userId = getCurrentUserFromCookie();
                var d = new Date();
                var me = this;
                
                // We are using jQuery's object detection to determine if the browser is ready for us
				// to insert our stat tracker node.
				// Mozilla, Opera and webkit nightlies currently support this event
				if (document.addEventListener) {
					// Use the handy event callback
					document.addEventListener( "DOMContentLoaded", function(){
						document.removeEventListener( "DOMContentLoaded", arguments.callee, false );
						me.InsertTrackerNode(serverUrl, requestUrl, userId, me.gcid, d.getTime());
					}, false );
					
				// If IE event model is used
				} else if (document.attachEvent) {						
					// ensure firing before onload,
					// maybe late but safe also for iframes
					document.attachEvent("onreadystatechange", function(){
						if ( document.readyState === "complete" ) {
							document.detachEvent( "onreadystatechange", arguments.callee );
							me.InsertTrackerNode(serverUrl, requestUrl, userId, me.gcid, d.getTime());
						}
					});

					// If IE and not an iframe
					// continually check to see if the document is ready
					if ( document.documentElement.doScroll && window == window.top ) (function(){

						try {
							// If IE is used, use the trick by Diego Perini
							// http://javascript.nwbox.com/IEContentLoaded/
							document.documentElement.doScroll("left");
						} catch( error ) {
							setTimeout( arguments.callee, 0 );
							return;
						}

						// and execute any waiting functions
						me.InsertTrackerNode(serverUrl, requestUrl, userId, me.gcid, d.getTime());
					})();
				}
            },

            HasTemplate: function() {
                return typeof (this["Template"]) != "undefined";
            },

            AddToRequest: function(requestThis) {
                this.Requests[this.Requests.length] = requestThis;
            },
            
            BeginRequest: function(serverUrl, callback) {
                pendingRequests++;

                if (!RequestBatch.callbacks) {
                    RequestBatch.callbacks = {};
                }

                // the cc_on comment below is important.. if you remove it, it will change the processing of the script
                // see http://msdn.microsoft.com/en-us/library/8ka90k2e(VS.85).aspx for details of conditional compilation
                var jsonString = YAHOO.lang.JSON.stringify(this), ie = /*@cc_on!@*/false;
                if (ie && !RequestBatch.container) { // forcibly take this route only for ie
                    var body = document.body, div;
                    RequestBatch.container = div = body.insertBefore(document.createElement('div'), body.firstChild);
                    div.style.height = div.style.width = div.style.margin = div.style.padding = 0;
                    div.style.visibility = div.style.overflow = 'hidden';
                    div.style.display = 'none';
                }
                // generate our callback function that will call their callback function via closure semantics
                var daapiCallbackName = 'daapiCallback' + this.UniqueId;
                var thisRequest = this;
                if (jsonpServerUrl = useJsonp(serverUrl, jsonString, 'RequestBatch.callbacks.' + daapiCallbackName)) {
                    // insert script node with callback function = daapiCallbackName
                    var jsonpScriptNode = document.createElement('script');
                    jsonpScriptNode.type = "text/javascript";
                    jsonpScriptNode.src = jsonpServerUrl;
                    var headElem = document.getElementsByTagName('head')[0];
                    RequestBatch.callbacks[daapiCallbackName] = (function(userCallback, headElem, scriptNode) {
                        return function(responses) {
                            if (thisRequest.HasTemplate()) {
                                userCallback(responses);
                            } else {
                                // clean up after ourselves
                                userCallback(responses.ResponseBatch);
                                userCallback = headElem = scriptNode = null;
                            }
                        }
                    })(callback, headElem, jsonpScriptNode);
                    headElem.appendChild(jsonpScriptNode);
                }
                else {
                    var form = generateForm(this.UniqueId, serverUrl, jsonString);
                    new iframe(form, { onComplete: function(request) { processResponse(callback, request, thisRequest.HasTemplate()); } }, this.UniqueId);
                }
                // Insert tracker image node for stat tracking.
                thisRequest.InitializeTracking(serverUrl);
                // in case they reuse the requestbatch
                this.UniqueId = counter++;
            }
        };
    })();
}

function generateForm(formId, serverUrl, inputVal) {
    // create the form
	var form = document.createElement("form");
	form.acceptCharset = "UTF-8";
	form.name = "f" + formId;
	form.id = "f" + formId;
	form.action = serverUrl;

	// create the input element on the form
	var inputElem = document.createElement("input");
	inputElem.name = "jsonRequest";
	inputElem.type = "hidden";
	inputElem.value = inputVal;
	form.appendChild(inputElem);

	// Firefox has a behavior on refresh that displays a popup confirming that is it reloading a form.
	// We work around this by attempting to perform a get action if the size is below a threshold, else
	// we will run as a post
	form.method = "post";
    if(navigator.userAgent.toLowerCase().indexOf('firefox') != -1) {
        var separator = serverUrl.indexOf('?') == -1 ? "?" : "&";
        var fullRequestURL = serverUrl + separator + "jsonRequest="+ escape(inputVal);
        if (fullRequestURL.length < 4000) {
            // we plan to perform a get, so we need to parse the sid out of the url and place it
            // inside the form
            var sidPos = serverUrl.indexOf('sid=');
            if (sidPos != -1) {
                var endPos = serverUrl.indexOf('&', sidPos);
                var sid = serverUrl.substring(sidPos + 'sid='.length, endPos == -1 ? serverUrl.length : endPos);
	            var sidInputElem = document.createElement("input");
	            sidInputElem.name = "sid";
	            sidInputElem.type = "hidden";
	            sidInputElem.value = sid;
	            form.appendChild(sidInputElem);
	            // remove the sid from the url
	            form.action = serverUrl.substring(0, sidPos-1);
            }
            form.method = "get";
        }
    }

	(RequestBatch.container || document.body).appendChild(form);
	return form;
}

function processResponse(callback, request, isTemplated)
{
    pendingRequests--;
    try {
        if (isTemplated) {
            callback(request.ResponseText);
        } else {
            var jsonResponse = unescape(request.responseText);
            jsonResponse = jsonResponse.replace(/\\\>/g, ">");
            var responseObject = YAHOO.lang.JSON.parse(jsonResponse);
            try {
                callback(responseObject.ResponseBatch);
            } catch (e) {
                DirectAccessErrorHandler("exception during client callback", e);
            }
        }
    } catch (e) {
        DirectAccessErrorHandler("exception during processResponse", e);
    }
}

function getPendingRequestCount()
{
    return pendingRequests;
}


// ------------------------------------------------------------------------------------
// This file contains all the request type objects for the SiteLife JSON Direct API.
// Create instances of these objects, place them in a RequestBatch, and send them off.
// ------------------------------------------------------------------------------------

(function() { // wrapped in a function to keep the Class variable out of the global scope
    var Class = function() {
        return function() {
            this.initialize.apply(this, arguments);
        }
    };
    // Identify a user
    UserKey = Class();
    UserKey.prototype = {
        initialize: function(key) {
            var data = new Object();
            data.Key = key;
            this.UserKey = data;
        }
    };
    // Identify a comment
    CommentKey = Class();
    CommentKey.prototype = {
        initialize: function(key) {
            var data = new Object();
            data.Key = key;
            this.CommentKey = data;
        }
    };
    // Identify an article
    ArticleKey = Class();
    ArticleKey.prototype = {
        initialize: function(key) {
            var data = new Object();
            data.Key = key;
            this.ArticleKey = data;
        }
    };

    // Identify a persona message
    PersonaMessageKey = Class();
    PersonaMessageKey.prototype = {
        initialize: function(key) {
            var data = new Object();
            data.Key = key;
            this.PersonaMessageKey = data;
        }
    };

    // Identify a review
    ReviewKey = Class();
    ReviewKey.prototype = {
        initialize: function(key) {
            var data = new Object();
            data.Key = key;
            this.ReviewKey = data;
        }
    };

    // Identify a gallery
    GalleryKey = Class();
    GalleryKey.prototype = {
        initialize: function(key) {
            var data = new Object();
            data.Key = key;
            this.GalleryKey = data;
        }
    };

    // Identify a photo
    PhotoKey = Class();
    PhotoKey.prototype = {
        initialize: function(key) {
            var data = new Object();
            data.Key = key;
            this.PhotoKey = data;
        }
    };

    // Identify a video
    VideoKey = Class();
    VideoKey.prototype = {
        initialize: function(key) {
            var data = new Object();
            data.Key = key;
            this.VideoKey = data;
        }
    };

    // Identify a blog with this blog key
    BlogKey = Class();
    BlogKey.prototype = {
        initialize: function(key) {
            var data = new Object();
            data.Key = key;
            this.BlogKey = data;
        }
    };

    // Identify a blog post with this blog post key
    BlogPostKey = Class();
    BlogPostKey.prototype = {
        initialize: function(key) {
            var data = new Object();
            data.Key = key;
            this.BlogPostKey = data;
        }
    };

    // Identify a custom item with this CustomItemKey
    CustomItemKey = Class();
    CustomItemKey.prototype = {
        initialize: function(key) {
            var data = new Object();
            data.Key = key;
            this.CustomItemKey = data;
        }
    };

    // Identify a custom collection with this CustomCollectionKey
    CustomCollectionKey = Class();
    CustomCollectionKey.prototype = {
        initialize: function(key) {
            var data = new Object();
            data.Key = key;
            this.CustomCollectionKey = data;
        }
    };


    // Identify a Forum Category
    ForumCategoryKey = Class();
    ForumCategoryKey.prototype = {
        initialize: function(key) {
            var data = new Object();
            data.Key = key;
            this.ForumCategoryKey = data;
        }
    };

    // Identify a Forum
    ForumKey = Class();
    ForumKey.prototype = {
        initialize: function(key) {
            var data = new Object();
            data.Key = key;
            this.ForumKey = data;
        }
    };

    // Identify a forum discussion with this DiscussionKey
    DiscussionKey = Class();
    DiscussionKey.prototype = {
        initialize: function(key) {
            var data = new Object();
            data.Key = key;
            this.DiscussionKey = data;
        }
    };

    // Identify a Forum Post
    ForumPostKey = Class();
    ForumPostKey.prototype = {
        initialize: function(key) {
            var data = new Object();
            data.Key = key;
            this.ForumPostKey = data;
        }
    };

    // Identify an Event
    EventKey = Class();
    EventKey.prototype = {
        initialize: function(key) {
            var data = new Object();
            data.Key = key;
            this.EventKey = data;
        }
    };

    // Identify an Event
    EventSetKey = Class();
    EventSetKey.prototype = {
        initialize: function(key) {
            var data = new Object();
            data.Key = key;
            this.EventSetKey = data;
        }
    };

    // Identify a Community Group
    CommunityGroupKey = Class();
    CommunityGroupKey.prototype = {
        initialize: function(key) {
            var data = new Object();
            data.Key = key;
            this.CommunityGroupKey = data;
        }
    };

    // Identify a CommunityGroup Membership
    CommunityGroupMembershipKey = Class();
    CommunityGroupMembershipKey.prototype = {
        initialize: function(communityGroupKey, userKey) {
            var data = new Object();
            data.CommunityGroupKey = communityGroupKey;
            data.UserKey = userKey;
            this.CommunityGroupMembershipKey = data;
        }
    };


    // Identify a CommunityGroup Invitation
    CommunityGroupInvitationKey = Class();
    CommunityGroupInvitationKey.prototype = {
        initialize: function(communityGroupKey, userKey) {
            var data = new Object();
            data.CommunityGroupKey = communityGroupKey;
            data.UserKey = userKey;
            this.CommunityGroupInvitationKey = data;
        }
    };

    // Identify a CommunityGroup Registrant
    CommunityGroupRegistrantKey = Class();
    CommunityGroupRegistrantKey.prototype = {
        initialize: function(communityGroupKey, userKey) {
            var data = new Object();
            data.CommunityGroupKey = communityGroupKey;
            data.UserKey = userKey;
            this.CommunityGroupRegistrantKey = data;
        }
    };

    // Identify a CommunityGroup Banned User
    CommunityGroupBannedUserKey = Class();
    CommunityGroupBannedUserKey.prototype = {
        initialize: function(communityGroupKey, userKey) {
            var data = new Object();
            data.CommunityGroupKey = communityGroupKey;
            data.UserKey = userKey;
            this.CommunityGroupBannedUserKey = data;
        }
    };

    PollKey = Class();
    PollKey.prototype = {
        initialize: function(pollKey) {
            var data = new Object();
            data.Key = pollKey;
            this.PollKey = data;
        }
    }

    // Points/Badging
    BadgeFamilyKey = Class();
    BadgeFamilyKey.prototype = {
        initialize: function(badgeFamilyKey) {
            var data = new Object();
            data.Key = badgeFamilyKey;
            this.BadgeFamilyKey = data;
        }
    }

    LeaderboardKey = Class();
    LeaderboardKey.prototype = {
        initialize: function(leaderboardKey) {
            var data = new Object();
            data.Key = leaderboardKey;
            this.LeaderboardKey = data;
        }
    }
    
    FeedActivityKey = Class();
    FeedActivityKey.prototype = {
        initialize: function(feedActivityKey){
            var data = new Object();
            data.Key = feedActivityKey;
            this.FeedActivityKey = data;
        }
    }
    
    RatingsReferenceKey = Class();
    RatingsReferenceKey.prototype = {
        initialize: function(ratingsReferenceKey){
            var data = new Object();
            data.Key = ratingsReferenceKey;
            this.RatingsReferenceKey = data;
        }
    }

    // Wrapper to request a comment page
    CommentPage = Class();
    CommentPage.prototype = {
        initialize: function(articleKey, numberPerPage, onPage, sort, findCommentKey) {
            var data = new Object();
            data.ArticleKey = articleKey;
            data.NumberPerPage = numberPerPage;
            data.OnPage = onPage;
            data.Sort = sort;
            data.FindCommentKey = findCommentKey;
            this.CommentPage = data;
        }
    };

    // Wrapper to request a persona message page
    PersonaMessagePage = Class();
    PersonaMessagePage.prototype = {
        initialize: function(userKey, numberPerPage, onPage, sort) {
            var data = new Object();
            data.UserKey = userKey;
            data.NumberPerPage = numberPerPage;
            data.OnPage = onPage;
            data.Sort = sort;
            this.PersonaMessagePage = data;
        }
    };

    // Wrapper to request a review page
    ReviewPage = Class();
    ReviewPage.prototype = {
        initialize: function(articleKey, numberPerPage, onPage, sort) {
            var data = new Object();
            data.ArticleKey = articleKey;
            data.NumberPerPage = numberPerPage;
            data.OnPage = onPage;
            data.Sort = sort;
            this.ReviewPage = data;
        }
    };

    // wrapper to request a page of reviews by user
    UserReviewPage = Class();
    UserReviewPage.prototype = {
        initialize: function(userKey, numberPerPage, onPage, sort) {
            var data = new Object();
            data.UserKey = userKey;
            data.NumberPerPage = numberPerPage;
            data.OnPage = onPage;
            data.Sort = sort;
            this.UserReviewPage = data;
        }
    };

    // Wrapper of types a gallery can contain
    MediaType = Class();
    MediaType.prototype = {
        initialize: function(name) {
            var data = new Object();
            data.Name = name;
            this.MediaType = data;
        }
    };
    // Wrapper to request a page of public galleries
    PublicGalleryPage = Class();
    PublicGalleryPage.prototype = {
        initialize: function(numberPerPage, onPage, mediaType) {
            var data = new Object();
            data.NumberPerPage = numberPerPage;
            data.OnPage = onPage;
            data.MediaType = mediaType;
            this.PublicGalleryPage = data;
        }
    };
    // Wrapper to request a page of user galleries
    UserGalleryPage = Class();
    UserGalleryPage.prototype = {
        initialize: function(userKey, numberPerPage, onPage, mediaType) {
            var data = new Object();
            data.UserKey = userKey;
            data.NumberPerPage = numberPerPage;
            data.OnPage = onPage;
            data.MediaType = mediaType;
            this.UserGalleryPage = data;
        }
    };
    // Wrapper to request a page of photos
    PhotoPage = Class();
    PhotoPage.prototype = {
        initialize: function(galleryKey, numberPerPage, onPage, sort) {
            var data = new Object();
            data.GalleryKey = galleryKey;
            data.NumberPerPage = numberPerPage;
            data.OnPage = onPage;
            data.Sort = sort;
            this.PhotoPage = data;
        }
    };
    // Wrapper to request a page of videos
    VideoPage = Class();
    VideoPage.prototype = {
        initialize: function(galleryKey, numberPerPage, onPage, sort) {
            var data = new Object();
            data.GalleryKey = galleryKey;
            data.NumberPerPage = numberPerPage;
            data.OnPage = onPage;
            data.Sort = sort;
            this.VideoPage = data;
        }
    };
    // Wrapper to request a comment action
    CommentAction = Class();
    CommentAction.prototype = {
        initialize: function(commentOnKey, onPageUrl, onPageTitle, commentBody) {
            var data = new Object();
            data.CommentOnKey = commentOnKey;
            data.OnPageUrl = onPageUrl;
            data.OnPageTitle = onPageTitle;
            data.CommentBody = commentBody;
            this.CommentAction = data;
        }
    };
    // Wrapper to request a review action
    ReviewAction = Class();
    ReviewAction.prototype = {
        initialize: function(reviewOnThisKey, onPageUrl, onPageTitle,
                        reviewTitle, reviewRating, reviewBody, reviewPros, reviewCons) {
            var data = new Object();
            data.ReviewOnKey = reviewOnThisKey;
            data.OnPageUrl = onPageUrl;
            data.OnPageTitle = onPageTitle;
            data.ReviewTitle = reviewTitle;
            data.ReviewRating = reviewRating;
            data.ReviewBody = reviewBody;
            data.ReviewPros = reviewPros;
            data.ReviewCons = reviewCons;
            this.ReviewAction = data;
        }
    };
    // Wrapper to request a recommend action
    RecommendAction = Class();
    RecommendAction.prototype = {
        initialize: function(recommendThisKey, articleTitle) {
            var data = new Object();
            data.RecommendThisKey = recommendThisKey;
            if (articleTitle) {
                data.OnPageTitle = articleTitle;
            }

            this.RecommendAction = data;
        }
    };
    // Wrapper to request a rate action
    RateAction = Class();
    RateAction.prototype = {
        initialize: function(rateThisKey, rating, multiRate, ratingsReferenceKey) {
            var data = new Object();
            data.RateThisKey = rateThisKey;
            data.Rating = rating;
            if (typeof (multiRate) != "undefined") {
                data.MultiRate = multiRate;
            }
            if (typeof (ratingsReferenceKey) !== "undefined") {
                    data.RatingsReferenceKey = ratingsReferenceKey;
            }
            this.RateAction = data;
        }
    };

    // Permanently delete a gallery, video or photo
    DeleteContentAction = Class();
    DeleteContentAction.prototype = {
        initialize: function(deleteThisContent) {
            var data = new Object();
            data.DeleteThisContent = deleteThisContent;
            this.DeleteContentAction = data;
        }
    };

    // Email from the SiteLife system
    EmailContentAction = Class();
    EmailContentAction.prototype = {
        initialize: function(toAddress, subject, body) {
            var data = new Object();
            data.ToAddress = toAddress;
            data.Subject = subject;
            data.Body = body;
            this.EmailContentAction = data;
        }
    };

    // Email from the SiteLife system with user key as target
    EmailContentWithUserIDAction = Class();
    EmailContentWithUserIDAction.prototype = {
        initialize: function(toUserKey, subject, body) {
            var data = new Object();
            data.UserKey = toUserKey;
            data.Subject = subject;
            data.Body = body;
            this.EmailContentWithUserIDAction = data;
        }
    };

    // Wrapper to request a report abuse action
    ReportAbuseAction = Class();
    ReportAbuseAction.prototype = {
        initialize: function(reportThisKey, abuseReason, abuseDescription) {
            var data = new Object();
            data.ReportThisKey = reportThisKey;
            data.AbuseReason = abuseReason;
            data.AbuseDescription = abuseDescription;
            this.ReportAbuseAction = data;
        }
    };
    // Category used for discovery
    Category = Class();
    Category.prototype = {
        initialize: function(name) {
            var data = new Object();
            data.Name = name;
            this.Category = data;
        }
    };
    // Section used for discovery
    Section = Class();
    Section.prototype = {
        initialize: function(name) {
            var data = new Object();
            data.Name = name;
            this.Section = data;
        }
    };
    // Update or create an article
    UpdateArticleAction = Class();
    UpdateArticleAction.prototype = {
        initialize: function(updateArticle, onPageUrl, onPageTitle, section, categories) {
            var data = new Object();
            data.UpdateArticle = updateArticle;
            data.OnPageUrl = onPageUrl;
            data.OnPageTitle = onPageTitle;
            data.Section = section;
            data.Categories = categories;
            this.UpdateArticleAction = data;
        }
    };
    // Update or create a gallery
    UpdateGalleryAction = Class();
    UpdateGalleryAction.prototype = {
        initialize: function(updateGallery, galleryType, mediaType, title, description, tags, section, galleryPromo) {
            var data = new Object();
            data.UpdateGallery = updateGallery;
            data.GalleryType = galleryType;
            data.MediaType = mediaType;
            data.Title = title;
            data.Description = description;
            data.Tags = tags;
            data.Section = section;
            data.GalleryPromo = galleryPromo;
            this.UpdateGalleryAction = data;
        }
    };
    // Update or create a photo
    UpdatePhotoAction = Class();
    UpdatePhotoAction.prototype = {
        initialize: function(updatePhoto, title, description, tags, section) {
            var data = new Object();
            data.UpdatePhoto = updatePhoto;
            data.Title = title;
            data.Description = description;
            data.Tags = tags;
            data.Section = section;
            this.UpdatePhotoAction = data;
        }
    };
    // Update or create a video
    UpdateVideoAction = Class();
    UpdateVideoAction.prototype = {
        initialize: function(updateVideo, title, description, tags, section) {
            var data = new Object();
            data.UpdateVideo = updateVideo;
            data.Title = title;
            data.Description = description;
            data.Tags = tags;
            data.Section = section;
            this.UpdateVideoAction = data;
        }
    };
    // 
    GalleryType = Class();
    GalleryType.prototype = {
        initialize: function(name) {
            var data = new Object();
            data.Name = name;
            this.GalleryType = data;
        }
    };
    // GalleryPromo used for setting promotional text for public galleries
    GalleryPromo = Class();
    GalleryPromo.prototype = {
        initialize: function(title, body, photoKey) {
            var data = new Object();
            data.Title = title;
            data.Body = body;
            data.PhotoKey = photoKey;
            this.GalleryPromo = data;
        }
    };
    // UserTier used for discovery
    UserTier = Class();
    UserTier.prototype = {
        initialize: function(name) {
            var data = new Object();
            data.Name = name;
            this.UserTier = data;
        }
    };
    // MembershipTier used for community groups
    MembershipTier = Class();
    MembershipTier.prototype = {
        initialize: function(name) {
            var data = new Object();
            data.Name = name;
            this.MembershipTier = data;
        }
    };
    // Activity used for discovery
    Activity = Class();
    Activity.prototype = {
        initialize: function(name) {
            var data = new Object();
            data.Name = name;
            this.Activity = data;
        }
    };
    // Discovery on articles
    DiscoverArticlesAction = Class();
    DiscoverArticlesAction.prototype = {
        initialize: function(searchSections, searchCategories, limitToContributors, activity, age, maximumNumberOfDiscoveries) {
            var data = new Object();
            data.SearchSections = searchSections;
            data.SearchCategories = searchCategories;
            data.LimitToContributors = limitToContributors;
            data.Activity = activity;
            data.Age = age;
            data.MaximumNumberOfDiscoveries = maximumNumberOfDiscoveries;

            this.DiscoverArticlesAction = data;
        }
    };

    // Action used to add a friend
    AddFriendAction = Class();
    AddFriendAction.prototype = {
        initialize: function(friendUserKey) {
            var data = new Object();
            data.FriendUserKey = friendUserKey;
            this.AddFriendAction = data;
        }
    };

    // Action used to add a message
    AddPersonaMessageAction = Class();
    AddPersonaMessageAction.prototype = {
        initialize: function(toUserKey, body) {
            var data = new Object();
            data.ToUserKey = toUserKey;
            data.Body = body;
            this.AddPersonaMessageAction = data;
        }
    };

    // Action used to remove a message
    RemovePersonaMessageAction = Class();
    RemovePersonaMessageAction.prototype = {
        initialize: function(personaMessageKey) {
            var data = new Object();
            data.PersonaMessageKey = personaMessageKey;
            this.RemovePersonaMessageAction = data;
        }
    };

    // Action used to approve a friend
    ApproveFriendAction = Class();
    ApproveFriendAction.prototype = {
        initialize: function(friendUserKey, isApproved) {
            var data = new Object();
            data.FriendUserKey = friendUserKey;
            data.IsApproved = isApproved;
            this.ApproveFriendAction = data;
        }
    };

    // Action used to remove a friend
    RemoveFriendAction = Class();
    RemoveFriendAction.prototype = {
        initialize: function(friendUserKey) {
            var data = new Object();
            data.FriendUserKey = friendUserKey;
            this.RemoveFriendAction = data;
        }
    };

    // Action used to add an enemy
    AddEnemyAction = Class();
    AddEnemyAction.prototype = {
        initialize: function(enemyUserKey) {
            var data = new Object();
            data.EnemyUserKey = enemyUserKey;
            this.AddEnemyAction = data;
        }
    };

    // Action used to remove an enemy
    RemoveEnemyAction = Class();
    RemoveEnemyAction.prototype = {
        initialize: function(enemyUserKey) {
            var data = new Object();
            data.EnemyUserKey = enemyUserKey;
            this.RemoveEnemyAction = data;
        }
    };

    // Wrapper to request a friend page
    FriendPage = Class();
    FriendPage.prototype = {
        initialize: function(userKey, numberPerPage, onPage, isPendingList, filterKey, filterValue) {
            var data = new Object();
            data.UserKey = userKey;
            data.NumberPerPage = numberPerPage;
            data.OnPage = onPage;
            data.IsPendingList = isPendingList;
            data.FilterKey = filterKey;
            data.FilterValue = filterValue;
            this.FriendPage = data;
        }
    };

    // Wrapper to request if a given user key is a friend of the user specified by the second parameter
    // if the userKey parameter is not specified, the currently logged-in user is used
    IsFriend = Class();
    IsFriend.prototype = {
        initialize: function(friendUserKey, userKey) {
            var data = new Object();
            data.FriendUserKey = friendUserKey;
            data.UserKey = userKey;
            this.IsFriend = data;
        }
    };

    // Wrapper to request a friend page
    EnemyPage = Class();
    EnemyPage.prototype = {
        initialize: function(userKey, numberPerPage, onPage, sort) {
            var data = new Object();
            data.UserKey = userKey;
            data.NumberPerPage = numberPerPage;
            data.OnPage = onPage;
            data.Sort = sort;
            this.EnemyPage = data;
        }
    };

    // Discovery on content
    DiscoverContentAction = Class();
    DiscoverContentAction.prototype = {
        initialize: function(searchSections, searchCategories, limitToContributors, activity, contentType, age, maximumNumberOfDiscoveries, filterBySiteOfOrigin, parentKeys) {
            var data = new Object();
            data.SearchSections = searchSections;
            data.SearchCategories = searchCategories;
            data.LimitToContributors = limitToContributors;
            data.Activity = activity;
            data.ContentType = contentType;
            data.Age = age;
            data.MaximumNumberOfDiscoveries = maximumNumberOfDiscoveries;
            data.FilterBySiteOfOrigin = filterBySiteOfOrigin;
            if (parentKeys) {
                data.ParentKeys = parentKeys;
            }
            this.DiscoverContentAction = data;
        }
    };

    // Content type for discovery
    ContentType = Class();
    ContentType.prototype = {
        initialize: function(name) {
            var data = new Object();
            data.Name = name;
            this.ContentType = data;
        }
    };

    UpdateUserProfileAction = Class();
    UpdateUserProfileAction.prototype = {
        initialize: function(userKey,
                            aboutMe,
                            location,
                            signature,
                            dateOfBirth,
                            sex,
                            personaPrivacyMode,
                            commentsTabVisible,
                            photosTabVisible,
                            messagesOpenToEveryone,
                            isEmailNotificationsEnabled,
                            selectedStyleId,
                            customAnswers,
                            extendedProfile) {

            var data = new Object();
            data.UserKey = userKey;
            data.AboutMe = aboutMe;
            data.Location = location;
            data.Signature = signature;
            data.DateOfBirth = dateOfBirth;
            data.Sex = sex;
            data.PersonaPrivacyMode = personaPrivacyMode;
            data.CommentsTabVisible = commentsTabVisible;
            data.PhotosTabVisible = photosTabVisible;
            data.MessagesOpenToEveryone = messagesOpenToEveryone;
            data.IsEmailNotificationsEnabled = isEmailNotificationsEnabled;
            data.SelectedStyleId = selectedStyleId;
            data.CustomAnswers = customAnswers;
            data.ExtendedProfile = extendedProfile;
            this.UpdateUserProfileAction = data;
        }
    };

    UpdateUserBlockedSettingAction = Class();
    UpdateUserBlockedSettingAction.prototype = {
        initialize: function(userKey, isBlocked) {
            var data = new Object;
            data.UserKey = userKey;
            data.IsBlocked = isBlocked;
            this.UpdateUserBlockedSettingAction = data;
        }
    };

    SearchAction = Class();
    SearchAction.prototype = {
        initialize: function(searchType, searchString, numberPerPage, onPage) {
            var data = new Object();
            data.SearchType = searchType;
            data.SearchString = searchString;
            data.NumberPerPage = numberPerPage;
            data.OnPage = onPage;
            this.SearchAction = data;
        }
    };

    // Wrapper to request a watch item page
    WatchItemPage = Class();
    WatchItemPage.prototype = {
        initialize: function(userKey, numberPerPage, onPage) {
            var data = new Object();
            data.UserKey = userKey;
            data.NumberPerPage = numberPerPage;
            data.OnPage = onPage;
            this.WatchItemPage = data;
        }
    };

    // Wrapper to add a watch item
    AddWatchItemAction = Class();
    AddWatchItemAction.prototype = {
        initialize: function(userKey, watchTargetKey, title, url) {
            var data = new Object();
            data.UserKey = userKey;
            data.WatchTargetKey = watchTargetKey;
            data.WatchItemTitle = title;
            data.WatchItemUrl = url;
            this.AddWatchItemAction = data;
        }
    };

    // Wrapper to delete a watch item
    DeleteWatchItemAction = Class();
    DeleteWatchItemAction.prototype = {
        initialize: function(userKey, watchTargetKey) {
            var data = new Object();
            data.UserKey = userKey;
            data.WatchTargetKey = watchTargetKey;
            this.DeleteWatchItemAction = data;
        }
    };

    // Wrapper to request a blog post page
    BlogPostPage = Class();
    BlogPostPage.prototype = {
        initialize: function(blogKey, numberPerPage, onPage, sort, blogPostState, restrictToOwner, includeFuturePosts) {
            var data = new Object();
            data.BlogKey = blogKey;
            data.NumberPerPage = numberPerPage;
            data.OnPage = onPage;
            data.Sort = sort;
            data.BlogPostState = blogPostState;
            if ((typeof (restrictToOwner) == 'undefined') || (restrictToOwner == null)) {
                // Default to false for backwards compatibility
                restrictToOwner = false;
            }
            data.RestrictToOwner = restrictToOwner.toString();
            if ((typeof (includeFuturePosts) == 'undefined') || (includeFuturePosts == null)) {
                // Default to false for backwards compatibility
                includeFuturePosts = false;
            }
            data.IncludeFuturePosts = includeFuturePosts.toString();
            this.BlogPostPage = data;
        }
    };

    // Wrapper to request a blog post page by Tag
    BlogPostsByTagPage = Class();
    BlogPostsByTagPage.prototype = {
        initialize: function(blogKey, tag, numberPerPage, onPage, sort) {
            var data = new Object();
            data.BlogKey = blogKey;
            data.Tag = tag;
            data.NumberPerPage = numberPerPage;
            data.OnPage = onPage;
            data.Sort = sort;
            this.BlogPostsByTagPage = data;
        }
    };


    // Wrapper to request a blog post archive count
    BlogPostArchiveCount = Class();
    BlogPostArchiveCount.prototype = {
        initialize: function(blogKey) {
            var data = new Object();
            data.BlogKey = blogKey;
            this.BlogPostArchiveCount = data;
        }
    };


    // Wrapper to request a blog post archive content page
    BlogPostArchiveContentPage = Class();
    BlogPostArchiveContentPage.prototype = {
        initialize: function(blogKey, month, numberPerPage, onPage, sort) {
            var data = new Object();
            data.BlogKey = blogKey;
            data.Month = month;
            data.NumberPerPage = numberPerPage;
            data.OnPage = onPage;
            data.Sort = sort;
            this.BlogPostArchiveContentPage = data;
        }
    };


    // Wrapper to request a user comment page
    UserCommentPage = Class();
    UserCommentPage.prototype = {
        initialize: function(userKey, numberPerPage, onPage, sort, commentsOnly) {
            var data = new Object();
            data.UserKey = userKey;
            data.NumberPerPage = numberPerPage;
            data.OnPage = onPage;
            data.Sort = sort;
            data.CommentsOnly = commentsOnly;
            this.UserCommentPage = data;
        }
    };


    // Wrapper to request blog tag 
    RecentBlogTag = Class();
    RecentBlogTag.prototype = {
        initialize: function(blogKey) {
            var data = new Object();
            data.BlogKey = blogKey;
            this.RecentBlogTag = data;
        }
    };


    // Wrapper to request recent user photo page
    RecentUserPhotoPage = Class();
    RecentUserPhotoPage.prototype = {
        initialize: function(userKey, numberPerPage, onPage) {
            var data = new Object();
            data.UserKey = userKey;
            data.NumberPerPage = numberPerPage;
            data.OnPage = onPage;
            this.RecentUserPhotoPage = data;
        }
    };

    // Wrapper to request recent user video page
    RecentUserVideoPage = Class();
    RecentUserVideoPage.prototype = {
        initialize: function(userKey, numberPerPage, onPage) {
            var data = new Object();
            data.UserKey = userKey;
            data.NumberPerPage = numberPerPage;
            data.OnPage = onPage;
            this.RecentUserVideoPage = data;
        }
    };


    // Wrapper to request recent public gallery page
    RecentPublicGalleryPage = Class();
    RecentPublicGalleryPage.prototype = {
        initialize: function(userKey, numberPerPage, onPage) {
            var data = new Object();
            data.UserKey = userKey;
            data.NumberPerPage = numberPerPage;
            data.OnPage = onPage;
            this.RecentPublicGalleryPage = data;
        }
    };


    // Wrapper to request recent user activity page
    RecentUserActivity = Class();
    RecentUserActivity.prototype = {
        initialize: function(userKey) {
            var data = new Object();
            data.UserKey = userKey;
            this.RecentUserActivity = data;
        }
    };


    // Wrapper to request page of user media submission counts
    UserMediaSubmissionsCountPage = Class();
    UserMediaSubmissionsCountPage.prototype = {
        initialize: function(userKey, mediaType, numberPerPage, onPage) {
            var data = new Object();
            data.UserKey = userKey;
            data.MediaType = mediaType;
            data.NumberPerPage = numberPerPage;
            data.OnPage = onPage;
            this.UserMediaSubmissionsCountPage = data;
        }
    };


    // Wrapper to request recent forum discussion page
    RecentForumDiscussionPage = Class();
    RecentForumDiscussionPage.prototype = {
        initialize: function(userKey, numberPerPage, onPage) {
            var data = new Object();
            data.UserKey = userKey;
            data.NumberPerPage = numberPerPage;
            data.OnPage = onPage;
            this.RecentForumDiscussionPage = data;
        }
    };


    // Wrapper to request user group forum page
    UserGroupForumPage = Class();
    UserGroupForumPage.prototype = {
        initialize: function(userKey, numberPerPage, onPage, sort) {
            var data = new Object();
            data.UserKey = userKey;
            data.NumberPerPage = numberPerPage;
            data.OnPage = onPage;
            data.Sort = sort;
            this.UserGroupForumPage = data;
        }
    };

    // Update or create a blog
    UpdateBlogAction = Class();
    UpdateBlogAction.prototype = {
        initialize: function(updateBlog, title, tagline, blogRollEntries, blogType, commentApproval) {
            var data = new Object();
            data.BlogKey = updateBlog;
            data.Title = title;
            data.Tagline = tagline;
            data.BlogRollEntries = blogRollEntries;
            data.BlogType = blogType;
            if ((typeof (commentApproval) == 'undefined' || (commentApproval == null))) {
                // Default to Everyone for backwards compatibility.
                commentApproval = "NoChange";
            }
            data.CommentApproval = commentApproval;
            this.UpdateBlogAction = data;
        }
    };

    // The blogRollEntry used in UpdateBlogAction
    BlogRollEntry = Class();
    BlogRollEntry.prototype = {
        initialize: function(name, url) {
            var data = new Object();
            data.Name = name;
            data.Url = url;
            this.BlogRollEntry = data;
        }
    };

    // Bookmark used in UpdateCommunityGroupAction
    Bookmark = Class();
    Bookmark.prototype = {
        initialize: function(title, link) {
            var data = new Object();
            data.Title = title;
            data.Link = link;
            this.Bookmark = data;
        }
    };

    // CommunityGroupVisibility used in UpdateCommunityGroupAction
    CommunityGroupVisibility = Class();
    CommunityGroupVisibility.prototype = {
        initialize: function(name) {
            var data = new Object();
            data.Name = name;
            this.CommunityGroupVisibility = data;
        }
    };

    // Update or create a blog post, key can be either a post key (update case)
    // or a blog key (create case)
    UpdateBlogPostAction = Class();
    UpdateBlogPostAction.prototype = {
        initialize: function(key, title, body, tags, publishDate, published) {
            var data = new Object();
            data.TargetThis = key;
            data.Title = title;
            data.Body = body;
            data.Tags = tags;
            data.Date = publishDate;
            data.Published = published;
            this.UpdateBlogPostAction = data;
        }
    };

    // Identify a forum discussion with this DiscussionKey 
    DiscussionKey = Class();
    DiscussionKey.prototype = {
        initialize: function(key) {
            var data = new Object();
            data.Key = key;
            this.DiscussionKey = data;
        }
    };

    // Identify a custom item with this CustomItemKey
    CustomItemKey = Class();
    CustomItemKey.prototype = {
        initialize: function(key) {
            var data = new Object();
            data.Key = key;
            this.CustomItemKey = data;
        }
    };

    // Identify a custom collection with this CustomCollectionKey
    CustomCollectionKey = Class();
    CustomCollectionKey.prototype = {
        initialize: function(key) {
            var data = new Object();
            data.Key = key;
            this.CustomCollectionKey = data;
        }
    };

    // Update or create a custom item in storage
    UpdateCustomItemAction = Class();
    UpdateCustomItemAction.prototype = {
        initialize: function(customItemKey, name, mimeType, displayText, content, includeInRecentActivity) {
            var data = new Object();
            data.CustomItemKey = customItemKey;
            data.Name = name;
            data.MimeType = mimeType;
            data.DisplayText = displayText;
            data.Content = content;
            if ((typeof (includeInRecentActivity) == 'undefined') || (includeInRecentActivity == null)) {
                // Default to true for backwards compatibility
                includeInRecentActivity = true;
            }
            data.IncludeInRecentActivity = includeInRecentActivity
            this.UpdateCustomItemAction = data;
        }
    };

    // Add a new custom collection to storage
    AddCustomCollectionAction = Class();
    AddCustomCollectionAction.prototype = {
        initialize: function(customCollectionKey, customCollectionName) {
            var data = new Object();
            data.CustomCollectionKey = customCollectionKey;
            data.CustomCollectionName = customCollectionName;
            this.AddCustomCollectionAction = data;
        }
    };

    // Insert an item into a custom collection
    InsertIntoCollectionAction = Class();
    InsertIntoCollectionAction.prototype = {
        initialize: function(customCollectionKey, insertThisKey, position) {
            var data = new Object();
            data.CustomCollectionKey = customCollectionKey;
            data.InsertThisKey = insertThisKey;
            data.Position = position;
            this.InsertIntoCollectionAction = data;
        }
    };

    // Remove an item from a custom collection (position can be null to specify to remove all occurrences of item)
    RemoveFromCollectionAction = Class();
    RemoveFromCollectionAction.prototype = {
        initialize: function(customCollectionKey, removeThisKey, position) {
            var data = new Object();
            data.CustomCollectionKey = customCollectionKey;
            data.RemoveThisKey = removeThisKey;
            data.Position = position;
            this.RemoveFromCollectionAction = data;
        }
    };

    // Get a page of items out of a custom collection
    CustomCollectionPage = Class();
    CustomCollectionPage.prototype = {
        initialize: function(customCollectionKey, numberPerPage, onPage, sort) {
            var data = new Object();
            data.CustomCollectionKey = customCollectionKey;
            data.NumberPerPage = numberPerPage;
            data.OnPage = onPage;
            data.Sort = sort;
            this.CustomCollectionPage = data;
        }
    };


    // Get a page of items out of a custom collection
    EditorMessageRequest = Class();
    EditorMessageRequest.prototype = {
        initialize: function() {
            this.EditorMessageRequest = new Object();
        }
    };

    // Retrieve a user's tags for the given content type
    UserTags = Class();
    UserTags.prototype = {
        initialize: function(userKey, contentType) {
            var data = new Object();
            data.UserKey = userKey;
            data.ContentType = contentType;
            this.UserTags = data;
        }
    };


    // Get an item's ContentPolicy
    GetContentPolicyAction = Class();
    GetContentPolicyAction.prototype = {
        initialize: function(targetKey, userTier, action) {
            var data = new Object();
            data.TargetKey = targetKey;
            data.UserTier = userTier;
            data.ContentPolicyActionType = action;
            this.GetContentPolicyAction = data;
        }
    }

    // Set an item's ContentPolicy
    SetContentPolicyAction = Class();
    SetContentPolicyAction.prototype = {
        initialize: function(targetKey, userTier, action, policy) {
            var data = new Object();
            data.TargetKey = targetKey;
            data.UserTier = userTier;
            data.ContentPolicyActionType = action;
            data.ContentPolicy = policy;
            this.SetContentPolicyAction = data;
        }
    }

    ContentPolicy = Class();
    ContentPolicy.prototype = {
        initialize: function(name) {
            var data = new Object();
            data.Name = name;
            this.ContentPolicy = data;
        }
    };

    ContentPolicyActionType = Class();
    ContentPolicyActionType.prototype = {
        initialize: function(name) {
            var data = new Object();
            data.Name = name;
            this.ContentPolicyActionType = data;
        }
    };

    // Updates a Forum's meta data
    UpdateForumAction = Class();
    UpdateForumAction.prototype = {
        initialize: function(forumKey, title, description) {
            var data = new Object();
            data.ForumKey = forumKey;
            data.Title = title;
            data.Description = description;
            this.UpdateForumAction = data;
        }
    };

    //Adds/Updates a Forum Discussion's meta data. If the key is a ForumKey, it will be added as a new Discussion.
    //If the key is a ForumDiscussionKey, the existing forum discussion will be updated.
    UpdateForumDiscussionAction = Class();
    UpdateForumDiscussionAction.prototype = {
        initialize: function(key, title, body, isQuestion, isPoll, section, categories) {
            var data = new Object();
            data.TargetThis = key;
            data.Title = title;
            data.Body = body;
            data.IsQuestion = typeof (isQuestion) == 'string' ? isQuestion : (isQuestion ? "true" : "false");
            data.IsPoll = typeof (isPoll) == 'string' ? isPoll : (isPoll ? "true" : "false");
            if (typeof (section) != "undefined") {
                data.Section = section;
            }
            if (typeof (categories) != "undefined") {
                data.Categories = categories;
            }
            this.UpdateForumDiscussionAction = data;
        }
    };

    //Adds/Updates a Forum Post's meta data. If the key is a ForumDiscussionKey, it will be added as a new Post.
    //If the key is a ForumPostKey, the existing forum post will be updated.
    UpdateForumPostAction = Class();
    UpdateForumPostAction.prototype = {
        initialize: function(key, title, body, isQuestion) {
            var data = new Object();
            data.TargetThis = key;
            data.Title = title;
            data.Body = body;
            data.IsQuestion = isQuestion;
            this.UpdateForumPostAction = data;
        }
    };

    //Updates a Forum Discussion's Sticky flag
    ForumToggleDiscussionStickyAction = Class();
    ForumToggleDiscussionStickyAction.prototype = {
        initialize: function(discussionKey) {
            var data = new Object();
            data.DiscussionKey = discussionKey;
            this.ForumToggleDiscussionStickyAction = data;
        }
    };

    //Opens/Closes a Forum Discussion
    ForumToggleDiscussionClosedAction = Class();
    ForumToggleDiscussionClosedAction.prototype = {
        initialize: function(discussionKey) {
            var data = new Object();
            data.DiscussionKey = discussionKey;
            this.ForumToggleDiscussionClosedAction = data;
        }
    };

    //Retrieves a paginated list of Discussions for a particular Forum
    ForumDiscussionsPage = Class();
    ForumDiscussionsPage.prototype = {
        initialize: function(forumKey, numberPerPage, oneBasedOnPage, sort) {
            var data = new Object();
            data.ForumKey = forumKey;
            data.NumberPerPage = numberPerPage;
            data.OnPage = oneBasedOnPage;
            data.Sort = sort;
            this.ForumDiscussionsPage = data;
        }
    };

    //Retrieves a paginated list of Posts for a particular Forum
    ForumPostsPage = Class();
    ForumPostsPage.prototype = {
        initialize: function(forumDiscussionKey, numberPerPage, oneBasedOnPage, sort, findPostKey) {
            var data = new Object();
            data.DiscussionKey = forumDiscussionKey;
            data.NumberPerPage = numberPerPage;
            data.OnPage = oneBasedOnPage;
            data.Sort = sort;
            data.FindPostKey = findPostKey;
            this.ForumPostsPage = data;
        }
    };

    //Retrieves a paginated list of forums for a particular category
    ForumCategoriesPage = Class();
    ForumCategoriesPage.prototype = {
        initialize: function(numberPerPage, oneBasedOnPage) {
            var data = new Object();
            data.NumberPerPage = numberPerPage;
            data.OnPage = oneBasedOnPage;
            this.ForumCategoriesPage = data;
        }
    };

    //Retrieves a paginated list of forums for a particular category
    ForumsPage = Class();
    ForumsPage.prototype = {
        initialize: function(categoryKey, numberPerPage, oneBasedOnPage, sort) {
            var data = new Object();
            data.ForumCategoryKey = categoryKey;
            data.NumberPerPage = numberPerPage;
            data.OnPage = oneBasedOnPage;
            data.Sort = sort;
            this.ForumsPage = data;
        }
    };

    ForumSearchAction = Class();
    ForumSearchAction.prototype = {
        initialize: function(searchKey, searchString, numberPerPage, onPage) {
            var data = new Object();
            data.TargetThis = searchKey;
            data.SearchString = searchString;
            data.NumberPerPage = numberPerPage;
            data.OnPage = onPage;
            this.ForumSearchAction = data;
        }
    };

    // Retrieves a paginated list of community groups
    CommunityGroupPage = Class();
    CommunityGroupPage.prototype = {
        initialize: function(numberPerPage, oneBasedOnPage, sort, section) {
            var data = new Object();
            data.NumberPerPage = numberPerPage;
            data.OnPage = oneBasedOnPage;
            data.Sort = sort;
            if ((typeof (section) == 'undefined') || (section == null)) {
                // Default section to All
                section = new Section("All");
            }
            data.Section = section;
            this.CommunityGroupPage = data;
        }
    };

    // Retrieves a paginated list of community groups
    CommunityGroupMembership = Class();
    CommunityGroupMembership.prototype = {
        initialize: function(groupKey, userKey) {
            var data = new Object();
            data.CommunityGroupKey = groupKey;
            data.UserKey = userKey;
            this.CommunityGroupMembership = data;
        }
    };


    // Retrieves a paginated list of community groups
    CommunityGroupMembershipPage = Class();
    CommunityGroupMembershipPage.prototype = {
        initialize: function(key, numberPerPage, oneBasedOnPage, sort, membershipFilter) {
            var data = new Object();
            data.Key = key;
            data.NumberPerPage = numberPerPage;
            data.OnPage = oneBasedOnPage;
            data.Sort = sort;
            data.MembershipFilter = membershipFilter;
            this.CommunityGroupMembershipPage = data;
        }
    };

    // Retrieves a paginated list of registrants
    CommunityGroupRegistrantPage = Class();
    CommunityGroupRegistrantPage.prototype = {
        initialize: function(key, numberPerPage, oneBasedOnPage, sort) {
            var data = new Object();
            data.CommunityGroupKey = key;
            data.NumberPerPage = numberPerPage;
            data.OnPage = oneBasedOnPage;
            data.Sort = sort;
            this.CommunityGroupRegistrantPage = data;
        }
    };

    // Retrieves a paginated list of banned users
    CommunityGroupBannedUserPage = Class();
    CommunityGroupBannedUserPage.prototype = {
        initialize: function(key, numberPerPage, oneBasedOnPage, sort) {
            var data = new Object();
            data.CommunityGroupKey = key;
            data.NumberPerPage = numberPerPage;
            data.OnPage = oneBasedOnPage;
            data.Sort = sort;
            this.CommunityGroupBannedUserPage = data;
        }
    };

    // Retrieves a paginated list of invited users
    CommunityGroupInvitedUserPage = Class();
    CommunityGroupInvitedUserPage.prototype = {
        initialize: function(key, numberPerPage, oneBasedOnPage, sort) {
            var data = new Object();
            data.CommunityGroupKey = key;
            data.NumberPerPage = numberPerPage;
            data.OnPage = oneBasedOnPage;
            data.Sort = sort;
            this.CommunityGroupInvitedUserPage = data;
        }
    };



    // Creates a new or updates an existing community group
    UpdateCommunityGroupAction = Class();
    UpdateCommunityGroupAction.prototype = {
        initialize: function(key, title, description, categories, visibility, bookmarks, section, photoKey) {
            var data = new Object();
            data.CommunityGroupKey = key;
            data.Title = title;
            data.Description = description;
            data.Categories = categories;
            data.Visibility = visibility,
        data.Bookmarks = bookmarks;
            data.Section = section;
            data.PhotoKey = photoKey;
            this.UpdateCommunityGroupAction = data;
        }
    };

    // Updates an existing commnity group's bookmarks
    UpdateCommunityGroupBookmarksAction = Class();
    UpdateCommunityGroupBookmarksAction.prototype = {
        initialize: function(key, bookmarks) {
            var data = new Object();
            data.CommunityGroupKey = key;
            data.Bookmarks = bookmarks;
            this.UpdateCommunityGroupBookmarksAction = data;
        }
    };

    // Creates or updates a user's membership in a group, with options to ban the user from the group.
    UpdateCommunityGroupMembershipAction = Class();
    UpdateCommunityGroupMembershipAction.prototype = {
        initialize: function(communityGroupKey, userKey, membershipTier, isBanned, banMessage) {
            var data = new Object();
            data.CommunityGroupKey = communityGroupKey;
            data.UserKey = userKey;
            data.MembershipTier = membershipTier;
            data.IsBanned = isBanned;
            data.BanMessage = banMessage;
            this.UpdateCommunityGroupMembershipAction = data;
        }
    };

    // Enables a user to request membership in a community group or an admin to invite a non-member.
    RequestCommunityGroupMembershipAction = Class();
    RequestCommunityGroupMembershipAction.prototype = {
        initialize: function(communityGroupKey, userKey, message) {
            var data = new Object();
            data.CommunityGroupKey = communityGroupKey;
            data.UserKey = userKey;
            data.Message = message;
            this.RequestCommunityGroupMembershipAction = data;
        }
    };

    //Retrieves a paginated list of Events for a particular EventSetKey
    EventsPage = Class();
    EventsPage.prototype = {
        initialize: function(eventSetKey, startDate, endDate, numberPerPage, oneBasedOnPage, sort) {
            var data = new Object();
            data.EventSetKey = eventSetKey;
            data.StartDate = startDate;
            data.EndDate = endDate;
            data.NumberPerPage = numberPerPage;
            data.OnPage = oneBasedOnPage;
            data.Sort = sort;
            this.EventsPage = data;
        }
    };

    // Update or creates an Event, key can be either an EventKey (update case)
    // or an EventSetKey (create case)
    UpdateEventAction = Class();
    UpdateEventAction.prototype = {
        initialize: function(key, title, description, location, bookmarkName, bookmarkUrl, startDate, endDate, utcOffset) {
            var data = new Object();
            data.TargetThis = key;
            data.Title = title;
            data.Description = description;
            data.Location = location;
            data.BookmarkName = bookmarkName;
            data.BookmarkUrl = bookmarkUrl;
            data.StartDate = startDate;
            data.EndDate = endDate;
            data.UtcOffset = utcOffset;
            this.UpdateEventAction = data;
        }
    };


    // Retrieve a paginated list of recent group activities
    RecentMiniFeedActivity = Class();
    RecentMiniFeedActivity.prototype = {
        initialize: function(communityGroupKey, onPage, numberPerPage) {
            var data = new Object();
            data.CommunityGroupKey = communityGroupKey;
            data.OnPage = onPage;
            data.NumberPerPage = numberPerPage
            this.RecentMiniFeedActivity = data;
        }
    }

    //Retrieve a list of Most Active Users in a CommunityGroup
    CommunityGroupMostActiveMembers = Class();
    CommunityGroupMostActiveMembers.prototype = {
        initialize: function(communityGroupKey, age, maximumNumberOfMembers) {
            var data = new Object();
            data.CommunityGroupKey = communityGroupKey;
            data.Age = age;
            data.MaximumNumberOfMembers = maximumNumberOfMembers
            this.CommunityGroupMostActiveMembers = data;
        }
    }

    // perform a search for content within a specific community group
    CommunityGroupSearchAction = Class();
    CommunityGroupSearchAction.prototype = {
        initialize: function(communityGroupKey, searchType, searchString, numberPerPage, onPage) {
            var data = new Object();
            data.CommunityGroupKey = communityGroupKey;
            data.SearchType = searchType;
            data.SearchString = searchString;
            data.OnPage = onPage;
            data.NumberPerPage = numberPerPage;
            this.CommunityGroupSearchAction = data;
        }
    }

    // perform a search for content within a specific community group
    RequestDeleteCommunityGroupAction = Class();
    RequestDeleteCommunityGroupAction.prototype = {
        initialize: function(communityGroupKey, deleteReason) {
            var data = new Object();
            data.CommunityGroupKey = communityGroupKey;
            data.DeleteReason = deleteReason;
            this.RequestDeleteCommunityGroupAction = data;
        }
    }

    CommunityGroupRecentForumDiscussions = Class();
    CommunityGroupRecentForumDiscussions.prototype = {
        initialize: function(communityGroupKey, age, maximumNumberOfDiscussions) {
            var data = new Object();
            data.CommunityGroupKey = communityGroupKey;
            data.Age = age;
            data.MaximumNumberOfDiscussions = maximumNumberOfDiscussions;
            this.CommunityGroupRecentForumDiscussions = data;
        }
    }


    SystemTimeInfo = Class();
    SystemTimeInfo.prototype = {
        initialize: function() {
            var data = new Object();
            this.SystemTimeInfo = data;
        }
    }

    PrivateMessageFolderList = Class();
    PrivateMessageFolderList.prototype = {
        initialize: function() {
            var data = new Object();
            this.PrivateMessageFolderList = data;
        }
    }


    PrivateMessage = Class();
    PrivateMessage.prototype = {
        initialize: function(folderID, messageID) {
            var data = new Object();
            data.FolderID = folderID;
            data.MessageID = messageID;
            this.PrivateMessage = data;
        }
    }

    PrivateMessagePage = Class();
    PrivateMessagePage.prototype = {
        initialize: function(folderID, numberPerPage, onPage, messageReadState) {
            var data = new Object();
            data.FolderID = folderID;
            data.NumberPerPage = numberPerPage;
            data.OnPage = onPage;
            data.MessageReadState = messageReadState;
            this.PrivateMessagePage = data;
        }
    }

    PrivateMessageSendAction = Class();
    PrivateMessageSendAction.prototype = {
        initialize: function(subject, body, recipientList) {
            var data = new Object();
            data.Subject = subject;
            data.Body = body;
            data.RecipientList = recipientList;
            this.PrivateMessageSendAction = data;
        }
    }

    PrivateMessageMoveMessageAction = Class();
    PrivateMessageMoveMessageAction.prototype = {
        initialize: function(sourceFolderID, destinationFolderID, messageIDList) {
            var data = new Object();
            data.SourceFolderID = sourceFolderID;
            data.DestinationFolderID = destinationFolderID;
            data.MessageIDList = messageIDList;
            this.PrivateMessageMoveMessageAction = data;
        }
    }

    PrivateMessageDeleteMessageAction = Class();
    PrivateMessageDeleteMessageAction.prototype = {
        initialize: function(sourceFolderID, messageIDList) {
            var data = new Object();
            data.SourceFolderID = sourceFolderID;
            data.MessageIDList = messageIDList;
            this.PrivateMessageDeleteMessageAction = data;
        }
    }

    PrivateMessageEmptyTrashAction = Class();
    PrivateMessageEmptyTrashAction.prototype = {
        initialize: function() {
            var data = new Object();
            this.PrivateMessageEmptyTrashAction = data;
        }
    }


    PrivateMessageCreateFolderAction = Class();
    PrivateMessageCreateFolderAction.prototype = {
        initialize: function() {
            var data = new Object();
            data.FolderID = "Inbox";
            this.PrivateMessageCreateFolderAction = data;
        }
    }

    FirstUnreadPost = Class();
    FirstUnreadPost.prototype = {
        initialize: function(discussionKey, numberPerPage, sort) {
            var data = new Object();
            data.DiscussionKey = discussionKey;
            data.NumberPerPage = numberPerPage;
            data.Sort = sort;
            this.FirstUnreadPost = data;
        }
    }

    LatestPost = Class();
    LatestPost.prototype = {
        initialize: function(discussionKey, numberPerPage, sort) {
            var data = new Object();
            data.DiscussionKey = discussionKey;
            data.NumberPerPage = numberPerPage;
            data.Sort = sort;
            this.LatestPost = data;
        }
    }

    UpdateDiscussionLastReadAction = Class();
    UpdateDiscussionLastReadAction.prototype = {
        initialize: function(discussionKey, postKey, forceUpdate) {
            var data = new Object();
            data.DiscussionKey = discussionKey;
            if (postKey) {
                data.ForumPostKey = postKey;
            }
            if (forceUpdate) {
                data.ForceUpdate = true;
            }
            else {
                data.ForceUpdate = false;
            }
            this.UpdateDiscussionLastReadAction = data;
        }
    }

    UpdateForumAllReadAction = Class();
    UpdateForumAllReadAction.prototype = {
        initialize: function(forumKey) {
            var data = new Object();
            data.ForumKey = forumKey;
            this.UpdateForumAllReadAction = data;
        }
    }

    UpdateCategoryAllReadAction = Class();
    UpdateCategoryAllReadAction.prototype = {
        initialize: function(categoryKey) {
            var data = new Object();
            data.ForumCategoryKey = categoryKey;
            this.UpdateCategoryAllReadAction = data;
        }
    }

    UpdateExternalUserIdAction = Class();
    UpdateExternalUserIdAction.prototype = {
        initialize: function(externalSiteName, externalSiteUserId, forUser) {
            var data = new Object();
            data.ExternalSiteName = externalSiteName;
            data.ExternalSiteUserId = externalSiteUserId;
            data.ForUser = forUser;
            this.UpdateExternalUserIdAction = data;
        }
    }

    UpdateSubscriptionAction = Class();
    UpdateSubscriptionAction.prototype = {
        initialize: function(discussionKey, subscribe) {
            var data = new Object();
            data.DiscussionKey = discussionKey;
            data.Subscribe = subscribe;
            this.UpdateSubscriptionAction = data;
        }
    }

    UpdatePollAction = Class();
    UpdatePollAction.prototype = {
        initialize: function(pollOnKey, question, answers) {
            var data = new Object();
            data.PollOnKey = pollOnKey;
            data.Question = question;
            data.Answers = answers;
            this.UpdatePollAction = data;
        }
    }

    TogglePollIsClosedAction = Class();
    TogglePollIsClosedAction.prototype = {
        initialize: function(pollKey) {
            var data = new Object();
            data.ToggleThisPoll = pollKey;
            this.TogglePollIsClosedAction = data;
        }
    }

    PostPollAnswerAction = Class();
    PostPollAnswerAction.prototype = {
        initialize: function(pollToAnswer, indexOfAnswer) {
            var data = new Object();
            data.PollToAnswer = pollToAnswer;
            data.IndexOfAnswer = indexOfAnswer;
            this.PostPollAnswerAction = data;
        }
    }

    PollPage = Class();
    PollPage.prototype = {
        initialize: function(pollOnKey, numberPerPage, onPage, sort) {
            var data = new Object();
            data.PollOnKey = pollOnKey;
            data.NumberPerPage = numberPerPage;
            data.OnPage = onPage;
            data.Sort = sort;
            this.PollPage = data;
        }
    }

    CheckFilteredWords = Class();
    CheckFilteredWords.prototype = {
        initialize: function(keyValueDictionary) { // key is the string ID, value is the string to be checked - formatted like { "key1":"string1", "key2":"string2" }.
            var data = new Object();
            data.WordDictionary = keyValueDictionary;
            this.CheckFilteredWords = data;
        }
    }

    //Points&Badging
    AwardPointsAction = Class();
    AwardPointsAction.prototype = {
        initialize: function(userKey, points, currencyType) {
            var data = new Object();
            data.UserKey = userKey;
            data.Points = points;
            data.CurrencyType = currencyType;
            this.AwardPointsAction = data;
        }
    }

    BadgeFamily = Class();
    BadgeFamily.prototype = {
        initialize: function(badgeFamilyKey) {
            var data = new Object();
            data.BadgeFamilyKey = badgeFamilyKey;
            this.BadgeFamily = data;
        }
    }

    BadgeFamilies = Class();
    BadgeFamilies.prototype = {
        initialize: function() {
            var data = new Object();
            this.BadgeFamilies = data;
        }
    }

    BadgingEventAction = Class();
    BadgingEventAction.prototype = {
        initialize: function(activityName, activityTags, userTags) {
            var data = new Object();
            data.ActivityName = activityName;
            data.ActivityTags = activityTags
            data.UserTags = userTags;
            this.BadgingEventAction = data;
        }
    }

    GrantBadgeAction = Class();
    GrantBadgeAction.prototype = {
        initialize: function(userKey, badgeFamilyKey, badgeKey) {
            var data = new Object();
            data.UserKey = userKey;
            data.BadgeFamilyKey = badgeFamilyKey
            data.BadgeKey = badgeKey;
            this.GrantBadgeAction = data;
        }
    }

    Leaderboard = Class();
    Leaderboard.prototype = {
        initialize: function(leaderboardKey) {
            var data = new Object();
            data.LeaderboardKey = leaderboardKey;
            this.Leaderboard = data;
        }
    }

    Leaderboards = Class();
    Leaderboards.prototype = {
        initialize: function() {
            var data = new Object();
            this.Leaderboards = data;
        }
    }

    LeaderboardRankingsPage = Class();
    LeaderboardRankingsPage.prototype = {
        initialize: function(leaderboardKey, oneBasedOnPage) {
            var data = new Object();
            data.LeaderboardKey = leaderboardKey;
            data.OnPage = oneBasedOnPage;
            this.LeaderboardRankingsPage = data;
        }
    }

    RevokeBadgeAction = Class();
    RevokeBadgeAction.prototype = {
        initialize: function(userKey, badgeFamilyKey, badgeKey) {
            var data = new Object();
            data.UserKey = userKey;
            data.BadgeFamilyKey = badgeFamilyKey
            data.BadgeKey = badgeKey;
            this.RevokeBadgeAction = data;
        }
    }

    PointsAndBadgingRuleValidationAction = Class();
    PointsAndBadgingRuleValidationAction.prototype = {
        initialize: function(rules) {
            var data = new Object();
            data.Rules = rules;
            this.PointsAndBadgingRuleValidationAction = data;
        }
    }

    AbuseItemPage = Class();
    AbuseItemPage.prototype = {
        initialize: function(numberPerPage, onPage, section, maxReportsPerItem) {
            var data = new Object();
            data.NumberPerPage = numberPerPage;
            data.OnPage = onPage;
            data.Section = section;
            data.MaxReportsPerItem = maxReportsPerItem;
            this.AbuseItemPage = data;
        }
    }

    AbuseItem = Class();
    AbuseItem.prototype = {
        initialize: function(targetKey) {
            var data = new Object();
            data.TargetKey = targetKey;
            this.AbuseItem = data;
        }
    }

    ClearAbuseAction = Class();
    ClearAbuseAction.prototype = {
        initialize: function(targetKey) {
            var data = new Object();
            data.TargetKey = targetKey;
            this.ClearAbuseAction = data;
        }
    }

    SetCommentBlockingStateAction = Class();
    SetCommentBlockingStateAction.prototype = {
        initialize: function(commentKey, blockingState) {
            var data = new Object();
            data.CommentKey = commentKey;
            data.CommentBlockingState = blockingState;
            this.SetCommentBlockingStateAction = data;
        }
    }
    //Community feed
    CommunityFeedRequest = Class();
    CommunityFeedRequest.prototype = {
        initialize: function(activityForTypes, count) {
            var data = new Object();
            data.ActivityForTypes = activityForTypes;
            data.Count = count;
            this.CommunityFeedRequest = data;
        }
    }

    // updates the flag on individual content as to
    // whether or not the content will be included in
    // discovery results
    UpdateDiscoveryFilterFlagOnContentAction = Class();
    UpdateDiscoveryFilterFlagOnContentAction.prototype = {
        initialize: function(content, excludeContentFlag, siteList) {
            var data = new Object();
            data.DiscoveryFilterFlagExcludeThisContent = content;
            data.ExcludeContentFlag = excludeContentFlag;
            data.SiteList = siteList;
            this.UpdateDiscoveryFilterFlagOnContentAction = data;
        }
    };

    SendTwitterMessageAction = Class();
    SendTwitterMessageAction.prototype = {
        initialize: function(message, url, template) {
            var data = new Object();
            data.Message = message;
            data.Url = url;
            data.Template = template;
            this.SendTwitterMessageAction = data;
        }
    }

    UserTwitterStatus = Class();
    UserTwitterStatus.prototype = {
        initialize: function(userKey) {
            var data = new Object();
            data.UserKey = userKey;
            this.UserTwitterStatus = data;
        }
    }


    UserTwitterFriends = Class();
    UserTwitterFriends.prototype = {
        initialize: function(numberPerPage, onPage) {
            var data = new Object();
            data.NumberPerPage = numberPerPage;
            data.OnPage = onPage;
            this.UserTwitterFriends = data;
        }
    }

    UserExtendedPrefs = Class();
    UserExtendedPrefs.prototype = {
        initialize: function(userKey) {
            var data = new Object();
            data.UserKey = userKey;
            this.UserExtendedPrefs = data;
        }
    }
    FriendFeedRequest = Class();
    FriendFeedRequest.prototype = {
        initialize: function(forUserKey, pageNumber, includeTypes) {
            var data = new Object();
            data.ForUserKey = forUserKey;
            data.PageNumber = pageNumber;
            data.IncludeTypes = includeTypes;
            this.FriendFeedRequest = data;
        }
    }
    
    AddFriendFeedReactionRequest = Class();
    AddFriendFeedReactionRequest.prototype = {
        initialize: function(reactionOnKey, authorUserKey, body) {
            var data = new Object();
            data.ReactionOnKey = reactionOnKey;
            data.AuthorKey = authorUserKey;
            data.Body = body;
            this.AddFriendFeedReactionRequest = data;
	}
    }
    
    UpdateUserExtendedPrefAction = Class();
    UpdateUserExtendedPrefAction.prototype = {
        initialize: function(name, value) {
            var data = new Object();
            data.PrefName = name;
            data.PrefValue = value;
            this.UpdateUserExtendedPrefAction = data;
        }
    }
    
    UpdateUserPathRequest = Class();
    UpdateUserPathRequest.prototype = {
        initialize: function(userKey, path){
            var data = new Object();
            data.User = userKey;
            data.Path = path;
            this.UpdateUserPathRequest = data;
        }
    }
    
    DeleteFriendFeedReactionRequest = Class();
    DeleteFriendFeedReactionRequest.prototype = {
        initialize: function(onFeedActivityKey, reactionKey) {
            var data = new Object();
            data.ReactionOnKey = onFeedActivityKey;
            data.ReactionKey = reactionKey;
            this.DeleteFriendFeedReactionRequest = data;
        }
    }
    
    UsersForPathRequest = Class();
    UsersForPathRequest.prototype = {
        initialize: function(forPath, includeSubPaths){
            var data = new Object();
            data.Path = forPath;
            data.IncludeSubPaths = includeSubPaths;
            this.UsersForPathRequest = data;
        }
    }
    
    SetFriendFeedUserVisibilityRequest = Class();
    SetFriendFeedUserVisibilityRequest.prototype = {
        initialize: function(feedOwner, forUser, isVisible){
            var data = new Object();
            data.FeedOwnerUserKey = feedOwner;
            data.ForUserKey = forUser;
            data.Visible = isVisible;
            this.SetFriendFeedUserVisibilityRequest = data;
        }
    }
    
    HiddenFriendFeedUsersRequest = Class();
    HiddenFriendFeedUsersRequest.prototype = {
        initialize: function(forUserKey){
            var data = new Object();
            data.ForUserKey = forUserKey;
            this.HiddenFriendFeedUsersRequest = data;
	}
    }
    
    PathForUserRequest = Class();
    PathForUserRequest.prototype = {
        initialize: function(forUserKey){
            var data = Object();
            data.User = forUserKey;
            this.PathForUserRequest = data;
        }
    }
})();




