/**
 * jQuery.ScrollTo - Easy element scrolling using jQuery.
 * Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 9/11/2008
 * @author Ariel Flesler
 * @version 1.4
 *
 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
 */

/*start Popup layers */
;(function($){var ua=navigator.userAgent;var moz=$.browser.mozilla&&/gecko/i.test(ua);var webkit=$.browser.safari&&/Safari\/[5-9]/.test(ua);var expr=$.browser.msie&&(function(){var div=document.createElement('div');try{div.style.setExpression('width','0+0');div.style.removeExpression('width');}
catch(e){return false;}
return true;})();function sz(el,p){return parseInt($.css(el,p))||0;};function hex2(s){var s=parseInt(s).toString(16);return(s.length<2)?'0'+s:s;};function gpc(node){for(;node&&node.nodeName.toLowerCase()!='html';node=node.parentNode){var v=$.css(node,'backgroundColor');if(v=='rgba(0, 0, 0, 0)')
continue;if(v.indexOf('rgb')>=0){var rgb=v.match(/\d+/g);return'#'+hex2(rgb[0])+hex2(rgb[1])+hex2(rgb[2]);}
if(v&&v!='transparent')
return v;}
return'#ffffff';};function getWidth(fx,i,width){switch(fx){case'round':return Math.round(width*(1-Math.cos(Math.asin(i/width))));case'cool':return Math.round(width*(1+Math.cos(Math.asin(i/width))));case'sharp':return Math.round(width*(1-Math.cos(Math.acos(i/width))));case'bite':return Math.round(width*(Math.cos(Math.asin((width-i-1)/width))));case'slide':return Math.round(width*(Math.atan2(i,width/i)));case'jut':return Math.round(width*(Math.atan2(width,(width-i-1))));case'curl':return Math.round(width*(Math.atan(i)));case'tear':return Math.round(width*(Math.cos(i)));case'wicked':return Math.round(width*(Math.tan(i)));case'long':return Math.round(width*(Math.sqrt(i)));case'sculpt':return Math.round(width*(Math.log((width-i-1),width)));case'dog':return(i&1)?(i+1):width;case'dog2':return(i&2)?(i+1):width;case'dog3':return(i&3)?(i+1):width;case'fray':return(i%2)*width;case'notch':return width;case'bevel':return i+1;}};$.fn.corner=function(options){if(this.length==0){if(!$.isReady&&this.selector){var s=this.selector,c=this.context;$(function(){$(s,c).corner(options);});}
return this;}
return this.each(function(index){var $this=$(this);var o=[options||'',$this.attr($.fn.corner.defaults.metaAttr)||''].join(' ').toLowerCase();var keep=/keep/.test(o);var cc=((o.match(/cc:(#[0-9a-f]+)/)||[])[1]);var sc=((o.match(/sc:(#[0-9a-f]+)/)||[])[1]);var width=parseInt((o.match(/(\d+)px/)||[])[1])||10;var re=/round|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dog/;var fx=((o.match(re)||['round'])[0]);var edges={T:0,B:1};var opts={TL:/top|tl|left/.test(o),TR:/top|tr|right/.test(o),BL:/bottom|bl|left/.test(o),BR:/bottom|br|right/.test(o)};if(!opts.TL&&!opts.TR&&!opts.BL&&!opts.BR)
opts={TL:1,TR:1,BL:1,BR:1};if($.fn.corner.defaults.useNative&&fx=='round'&&(moz||webkit)&&!cc&&!sc){if(opts.TL)
$this.css(moz?'-moz-border-radius-topleft':'-webkit-border-top-left-radius',width+'px');if(opts.TR)
$this.css(moz?'-moz-border-radius-topright':'-webkit-border-top-right-radius',width+'px');if(opts.BL)
$this.css(moz?'-moz-border-radius-bottomleft':'-webkit-border-bottom-left-radius',width+'px');if(opts.BR)
$this.css(moz?'-moz-border-radius-bottomright':'-webkit-border-bottom-right-radius',width+'px');return;}
var strip=document.createElement('div');strip.style.overflow='hidden';strip.style.height='1px';strip.style.backgroundColor=sc||'transparent';strip.style.borderStyle='solid';var pad={T:parseInt($.css(this,'paddingTop'))||0,R:parseInt($.css(this,'paddingRight'))||0,B:parseInt($.css(this,'paddingBottom'))||0,L:parseInt($.css(this,'paddingLeft'))||0};if(typeof this.style.zoom!=undefined)this.style.zoom=1;if(!keep)this.style.border='none';strip.style.borderColor=cc||gpc(this.parentNode);var cssHeight=$.curCSS(this,'height');for(var j in edges){var bot=edges[j];if((bot&&(opts.BL||opts.BR))||(!bot&&(opts.TL||opts.TR))){strip.style.borderStyle='none '+(opts[j+'R']?'solid':'none')+' none '+(opts[j+'L']?'solid':'none');var d=document.createElement('div');$(d).addClass('jquery-corner');var ds=d.style;bot?this.appendChild(d):this.insertBefore(d,this.firstChild);if(bot&&cssHeight!='auto'){if($.css(this,'position')=='static')
this.style.position='relative';ds.position='absolute';ds.bottom=ds.left=ds.padding=ds.margin='0';if(expr)
ds.setExpression('width','this.parentNode.offsetWidth');else
ds.width='100%';}
else if(!bot&&$.browser.msie){if($.css(this,'position')=='static')
this.style.position='relative';ds.position='absolute';ds.top=ds.left=ds.right=ds.padding=ds.margin='0';if(expr){var bw=sz(this,'borderLeftWidth')+sz(this,'borderRightWidth');ds.setExpression('width','this.parentNode.offsetWidth - '+bw+'+ "px"');}
else
ds.width='100%';}
else{ds.position='relative';ds.margin=!bot?'-'+pad.T+'px -'+pad.R+'px '+(pad.T-width)+'px -'+pad.L+'px':(pad.B-width)+'px -'+pad.R+'px -'+pad.B+'px -'+pad.L+'px';}
for(var i=0;i<width;i++){var w=Math.max(0,getWidth(fx,i,width));var e=strip.cloneNode(false);e.style.borderWidth='0 '+(opts[j+'R']?w:0)+'px 0 '+(opts[j+'L']?w:0)+'px';bot?d.appendChild(e):d.insertBefore(e,d.firstChild);}}}});};$.fn.uncorner=function(){if(moz||webkit)
this.css(moz?'-moz-border-radius':'-webkit-border-radius',0);$('div.jquery-corner',this).remove();return this;};$.fn.corner.defaults={useNative:true,metaAttr:'data-corner'};})(jQuery);

(function($){var openedPopups=[];var popupLayerScreenLocker=false;var focusableElement=[];var setupJqueryMPopups={screenLockerBackground:"#000",screenLockerOpacity:"0.9"};$.setupJMPopups=function(settings){setupJqueryMPopups=jQuery.extend(setupJqueryMPopups,settings);return this;}
$.openPopupLayer=function(settings){if(typeof(settings.name)!="undefined"&&!checkIfItExists(settings.name)){settings=jQuery.extend({width:"auto",height:"auto",parameters:{},target:"",success:function(){},error:function(){},beforeClose:function(){},afterClose:function(){},reloadSuccess:null,escClose:"yes",clickClose:"",cache:false},settings);loadPopupLayerContent(settings,true);return this;}}
$.closePopupLayer=function(name){if(name){for(var i=0;i<openedPopups.length;i++){if(openedPopups[i].name==name){var thisPopup=openedPopups[i];openedPopups.splice(i,1)
thisPopup.beforeClose();$("#popupLayer_"+name).fadeOut(function(){$("#popupLayer_"+name).remove();focusableElement.pop();if(focusableElement.length>0){$(focusableElement[focusableElement.length-1]).focus();}
thisPopup.afterClose();hideScreenLocker(name);});break;}}}else{if(openedPopups.length>0){$.closePopupLayer(openedPopups[openedPopups.length-1].name);}}
return this;}
$.reloadPopupLayer=function(name,callback){if(name){for(var i=0;i<openedPopups.length;i++){if(openedPopups[i].name==name){if(callback){openedPopups[i].reloadSuccess=callback;}
loadPopupLayerContent(openedPopups[i],false);break;}}}else{if(openedPopups.length>0){$.reloadPopupLayer(openedPopups[openedPopups.length-1].name);}}
return this;}
function setScreenLockerSize(){if(popupLayerScreenLocker){$('#popupLayerScreenLocker').height($(document).height()+"px");$('#popupLayerScreenLocker').width($(document.body).outerWidth(true)+"px");}}
function checkIfItExists(name){if(name){for(var i=0;i<openedPopups.length;i++){if(openedPopups[i].name==name){return true;}}}
return false;}
function showScreenLocker(){if($("#popupLayerScreenLocker").length){if(openedPopups.length==1){popupLayerScreenLocker=true;setScreenLockerSize();$('#popupLayerScreenLocker').fadeIn();}
if($.browser.msie&&$.browser.version<7){$("select:not(.hidden-by-jmp)").addClass("hidden-by-jmp hidden-by-"+openedPopups[openedPopups.length-1].name).css("visibility","hidden");}
$('#popupLayerScreenLocker').css("z-index",parseInt(openedPopups.length==1?999:$("#popupLayer_"+openedPopups[openedPopups.length-2].name).css("z-index"))+1);}else{$("body").append("<div id='popupLayerScreenLocker'><!-- --></div>");$("#popupLayerScreenLocker").css({position:"absolute",background:setupJqueryMPopups.screenLockerBackground,left:"0",top:"0",opacity:setupJqueryMPopups.screenLockerOpacity,display:"none"});showScreenLocker();}}
function hideScreenLocker(popupName){if(openedPopups.length==0){screenlocker=false;$('#popupLayerScreenLocker').fadeOut();}else{$('#popupLayerScreenLocker').css("z-index",parseInt($("#popupLayer_"+openedPopups[openedPopups.length-1].name).css("z-index"))-1);}
if($.browser.msie&&$.browser.version<7){$("select.hidden-by-"+popupName).removeClass("hidden-by-jmp hidden-by-"+popupName).css("visibility","visible");}}
function setPopupLayersPosition(popupElement,animate){if(popupElement){if(popupElement.width()<$(window).width()){var leftPosition=(document.documentElement.offsetWidth-popupElement.width())/2;}else{var leftPosition=document.documentElement.scrollLeft+5;}
if(popupElement.height()<$(window).height()){var topPosition=document.documentElement.scrollTop+($(window).height()-popupElement.height())/2;}else{var topPosition=document.documentElement.scrollTop+5;}
var positions={left:leftPosition+"px",top:topPosition+"px"};if(!animate){popupElement.css(positions);}else{popupElement.animate(positions,"slow");}
setScreenLockerSize();}else{for(var i=0;i<openedPopups.length;i++){setPopupLayersPosition($("#popupLayer_"+openedPopups[i].name),true);}}}
function showPopupLayerContent(popupObject,newElement,data){var idElement="popupLayer_"+popupObject.name;if(newElement){showScreenLocker();$("body").append("<div id='"+idElement+"'><!-- --></div>");var zIndex=parseInt(openedPopups.length==1?1000:$("#popupLayer_"+openedPopups[openedPopups.length-2].name).css("z-index"))+2;}else{var zIndex=$("#"+idElement).css("z-index");}
var popupElement=$("#"+idElement);popupElement.css({visibility:"hidden",width:popupObject.width=="auto"?"":popupObject.width+"px",height:popupObject.height=="auto"?"":popupObject.height+"px",position:"absolute","z-index":zIndex});var linkAtTop="<a href='#' class='jmp-link-at-top' style='position:absolute; left:-9999px; top:-1px;'> </a><input class='jmp-link-at-top' style='position:absolute; left:-9999px; top:-1px;' />";var linkAtBottom="<a href='#' class='jmp-link-at-bottom' style='position:absolute; left:-9999px; bottom:-1px;'> </a><input class='jmp-link-at-bottom' style='position:absolute; left:-9999px; top:-1px;' />";popupElement.html(linkAtTop+data+linkAtBottom);setPopupLayersPosition(popupElement);popupElement.css("display","none");popupElement.css("visibility","visible");if(newElement){popupElement.fadeIn();}else{popupElement.show();}
$("#"+idElement+" .jmp-link-at-top, "+"#"+idElement+" .jmp-link-at-bottom").focus(function(){$(focusableElement[focusableElement.length-1]).focus();});var jFocusableElements=$("#"+idElement+" a:visible:not(.jmp-link-at-top, .jmp-link-at-bottom), "+"#"+idElement+" *:input:visible:not(.jmp-link-at-top, .jmp-link-at-bottom)");if(jFocusableElements.length==0){var linkInsidePopup="<a href='#' class='jmp-link-inside-popup' style='position:absolute; left:-9999px;'> </a>";popupElement.find(".jmp-link-at-top").after(linkInsidePopup);focusableElement.push($(popupElement).find(".jmp-link-inside-popup")[0]);}else{jFocusableElements.each(function(){if(!$(this).hasClass("jmp-link-at-top")&&!$(this).hasClass("jmp-link-at-bottom")){focusableElement.push(this);return false;}});}
$(focusableElement[focusableElement.length-1]).focus();popupObject.success();if(popupObject.reloadSuccess){popupObject.reloadSuccess();popupObject.reloadSuccess=null;}}
function loadPopupLayerContent(popupObject,newElement){if(newElement){openedPopups.push(popupObject);}
if(popupObject.target!=""){showPopupLayerContent(popupObject,newElement,$("#"+popupObject.target).html());}else{$.ajax({url:popupObject.url,data:popupObject.parameters,cache:popupObject.cache,dataType:"html",method:"GET",success:function(data){showPopupLayerContent(popupObject,newElement,data);},error:popupObject.error});}}
$(window).resize(function(){setScreenLockerSize();setPopupLayersPosition();});$(document).keydown(function(e){if(e.keyCode==27){$.closePopupLayer();}});})(jQuery);

/*end Popup layers */

;(function(h){var m=h.scrollTo=function(b,c,g){h(window).scrollTo(b,c,g)};m.defaults={axis:'y',duration:1};m.window=function(b){return h(window).scrollable()};h.fn.scrollable=function(){return this.map(function(){var b=this.parentWindow||this.defaultView,c=this.nodeName=='#document'?b.frameElement||b:this,g=c.contentDocument||(c.contentWindow||c).document,i=c.setInterval;return c.nodeName=='IFRAME'||i&&h.browser.safari?g.body:i?g.documentElement:this})};h.fn.scrollTo=function(r,j,a){if(typeof j=='object'){a=j;j=0}if(typeof a=='function')a={onAfter:a};a=h.extend({},m.defaults,a);j=j||a.speed||a.duration;a.queue=a.queue&&a.axis.length>1;if(a.queue)j/=2;a.offset=n(a.offset);a.over=n(a.over);return this.scrollable().each(function(){var k=this,o=h(k),d=r,l,e={},p=o.is('html,body');switch(typeof d){case'number':case'string':if(/^([+-]=)?\d+(px)?$/.test(d)){d=n(d);break}d=h(d,this);case'object':if(d.is||d.style)l=(d=h(d)).offset()}h.each(a.axis.split(''),function(b,c){var g=c=='x'?'Left':'Top',i=g.toLowerCase(),f='scroll'+g,s=k[f],t=c=='x'?'Width':'Height',v=t.toLowerCase();if(l){e[f]=l[i]+(p?0:s-o.offset()[i]);if(a.margin){e[f]-=parseInt(d.css('margin'+g))||0;e[f]-=parseInt(d.css('border'+g+'Width'))||0}e[f]+=a.offset[i]||0;if(a.over[i])e[f]+=d[v]()*a.over[i]}else e[f]=d[i];if(/^\d+$/.test(e[f]))e[f]=e[f]<=0?0:Math.min(e[f],u(t));if(!b&&a.queue){if(s!=e[f])q(a.onAfterFirst);delete e[f]}});q(a.onAfter);function q(b){o.animate(e,j,a.easing,b&&function(){b.call(this,r,a)})};function u(b){var c='scroll'+b,g=k.ownerDocument;return p?Math.max(g.documentElement[c],g.body[c]):k[c]}}).end()};function n(b){return typeof b=='object'?b:{top:b,left:b}}})(jQuery);
/**
 * jQuery.LocalScroll - Animated scrolling navigation, using anchors.
 * Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 6/3/2008
 * @author Ariel Flesler
 * @version 1.2.6
 **/
;(function($){var g=location.href.replace(/#.*/,''),h=$.localScroll=function(a){$('body').localScroll(a)};h.defaults={duration:1e3,axis:'y',event:'click',stop:1};h.hash=function(a){a=$.extend({},h.defaults,a);a.hash=0;if(location.hash)setTimeout(function(){i(0,location,a)},0)};$.fn.localScroll=function(b){b=$.extend({},h.defaults,b);return(b.persistent||b.lazy)?this.bind(b.event,function(e){var a=$([e.target,e.target.parentNode]).filter(c)[0];a&&i(e,a,b)}):this.find('a,area').filter(c).bind(b.event,function(e){i(e,this,b)}).end().end();function c(){var a=this;return!!a.href&&!!a.hash&&a.href.replace(a.hash,'')==g&&(!b.filter||$(a).is(b.filter))}};function i(e,a,b){var c=a.hash.slice(1),d=document.getElementById(c)||document.getElementsByName(c)[0],f;if(d){e&&e.preventDefault();f=$(b.target||$.scrollTo.window());if(b.lock&&f.is(':animated')||b.onBefore&&b.onBefore.call(a,e,d,f)===!1)return;if(b.stop)f.queue('fx',[]).stop();f.scrollTo(d,b).trigger('notify.serialScroll',[d]);if(b.hash)f.queue(function(){location=a.hash;$(this).dequeue()})}}})(jQuery);
/**
 * jQuery[a] - Animated scrolling of series
 * Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 3/20/2008
 * @author Ariel Flesler
 * @version 1.2.1
 *
 * http://flesler.blogspot.com/2008/02/jqueryserialscroll.html
 */
;(function($){var a='serialScroll',b='.'+a,c='bind',C=$[a]=function(b){$.scrollTo.window()[a](b)};C.defaults={duration:1e3,axis:'x',event:'click',start:0,step:1,lock:1,cycle:1,constant:1};$.fn[a]=function(y){y=$.extend({},C.defaults,y);var z=y.event,A=y.step,B=y.lazy;return this.each(function(){var j=y.target?this:document,k=$(y.target||this,j),l=k[0],m=y.items,o=y.start,p=y.interval,q=y.navigation,r;if(!B)m=w();if(y.force)t({},o);$(y.prev||[],j)[c](z,-A,s);$(y.next||[],j)[c](z,A,s);if(!l.ssbound)k[c]('prev'+b,-A,s)[c]('next'+b,A,s)[c]('goto'+b,t);if(p)k[c]('start'+b,function(e){if(!p){v();p=1;u()}})[c]('stop'+b,function(){v();p=0});k[c]('notify'+b,function(e,a){var i=x(a);if(i>-1)o=i});l.ssbound=1;if(y.jump)(B?k:w())[c](z,function(e){t(e,x(e.target))});if(q)q=$(q,j)[c](z,function(e){e.data=Math.round(w().length/q.length)*q.index(this);t(e,this)});function s(e){e.data+=o;t(e,this)};function t(e,a){if(!isNaN(a)){e.data=a;a=l}var c=e.data,n,d=e.type,f=y.exclude?w().slice(0,-y.exclude):w(),g=f.length,h=f[c],i=y.duration;if(d)e.preventDefault();if(p){v();r=setTimeout(u,y.interval)}if(!h){n=c<0?0:n=g-1;if(o!=n)c=n;else if(!y.cycle)return;else c=g-n-1;h=f[c]}if(!h||d&&o==c||y.lock&&k.is(':animated')||d&&y.onBefore&&y.onBefore.call(a,e,h,k,w(),c)===!1)return;if(y.stop)k.queue('fx',[]).stop();if(y.constant)i=Math.abs(i/A*(o-c));k.scrollTo(h,i,y).trigger('notify'+b,[c])};function u(){k.trigger('next'+b)};function v(){clearTimeout(r)};function w(){return $(m,l)};function x(a){if(!isNaN(a))return a;var b=w(),i;while((i=b.index(a))==-1&&a!=l)a=a.parentNode;return i}})}})(jQuery);
/*
 * jQuery Cycle Plugin (with Transition Definitions)
 * Examples and documentation at: http://jquery.malsup.com/cycle/
 * Copyright (c) 2007-2009 M. Alsup
 * Version: 2.73 (04-NOV-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
 *
 * Originally based on the work of:
 *	1) Matt Oakes
 *	2) Torsten Baldes (http://medienfreunde.com/lab/innerfade/)
 *	3) Benjamin Sterling (http://www.benjaminsterling.com/experiments/jqShuffle/)
 */
(function(i){var l="2.73";if(i.support==undefined){i.support={opacity:!(i.browser.msie)}}function a(q){if(i.fn.cycle.debug){f(q)}}function f(){if(window.console&&window.console.log){window.console.log("[cycle] "+Array.prototype.join.call(arguments," "))}}i.fn.cycle=function(r,q){var s={s:this.selector,c:this.context};if(this.length===0&&r!="stop"){if(!i.isReady&&s.s){f("DOM not ready, queuing slideshow");i(function(){i(s.s,s.c).cycle(r,q)});return this}f("terminating; zero elements found by selector"+(i.isReady?"":" (DOM not ready)"));return this}return this.each(function(){var w=m(this,r,q);if(w===false){return}if(this.cycleTimeout){clearTimeout(this.cycleTimeout)}this.cycleTimeout=this.cyclePause=0;var x=i(this);var y=w.slideExpr?i(w.slideExpr,this):x.children();var u=y.get();if(u.length<2){f("terminating; too few slides: "+u.length);return}var t=k(x,y,u,w,s);if(t===false){return}var v=t.continuous?10:h(t.currSlide,t.nextSlide,t,!t.rev);if(v){v+=(t.delay||0);if(v<10){v=10}a("first timeout: "+v);this.cycleTimeout=setTimeout(function(){e(u,t,0,!t.rev)},v)}})};function m(q,t,r){if(q.cycleStop==undefined){q.cycleStop=0}if(t===undefined||t===null){t={}}if(t.constructor==String){switch(t){case"stop":q.cycleStop++;if(q.cycleTimeout){clearTimeout(q.cycleTimeout)}q.cycleTimeout=0;i(q).removeData("cycle.opts");return false;case"pause":q.cyclePause=1;return false;case"resume":q.cyclePause=0;if(r===true){t=i(q).data("cycle.opts");if(!t){f("options not found, can not resume");return false}if(q.cycleTimeout){clearTimeout(q.cycleTimeout);q.cycleTimeout=0}e(t.elements,t,1,1)}return false;case"prev":case"next":var u=i(q).data("cycle.opts");if(!u){f('options not found, "prev/next" ignored');return false}i.fn.cycle[t](u);return false;default:t={fx:t}}return t}else{if(t.constructor==Number){var s=t;t=i(q).data("cycle.opts");if(!t){f("options not found, can not advance slide");return false}if(s<0||s>=t.elements.length){f("invalid slide index: "+s);return false}t.nextSlide=s;if(q.cycleTimeout){clearTimeout(q.cycleTimeout);q.cycleTimeout=0}if(typeof r=="string"){t.oneTimeFx=r}e(t.elements,t,1,s>=t.currSlide);return false}}return t}function b(q,r){if(!i.support.opacity&&r.cleartype&&q.style.filter){try{q.style.removeAttribute("filter")}catch(s){}}}function k(y,J,u,t,E){var C=i.extend({},i.fn.cycle.defaults,t||{},i.metadata?y.metadata():i.meta?y.data():{});if(C.autostop){C.countdown=C.autostopCount||u.length}var r=y[0];y.data("cycle.opts",C);C.$cont=y;C.stopCount=r.cycleStop;C.elements=u;C.before=C.before?[C.before]:[];C.after=C.after?[C.after]:[];C.after.unshift(function(){C.busy=0});if(!i.support.opacity&&C.cleartype){C.after.push(function(){b(this,C)})}if(C.continuous){C.after.push(function(){e(u,C,0,!C.rev)})}n(C);if(!i.support.opacity&&C.cleartype&&!C.cleartypeNoBg){g(J)}if(y.css("position")=="static"){y.css("position","relative")}if(C.width){y.width(C.width)}if(C.height&&C.height!="auto"){y.height(C.height)}if(C.startingSlide){C.startingSlide=parseInt(C.startingSlide)}if(C.random){C.randomMap=[];for(var H=0;H<u.length;H++){C.randomMap.push(H)}C.randomMap.sort(function(L,w){return Math.random()-0.5});C.randomIndex=0;C.startingSlide=C.randomMap[0]}else{if(C.startingSlide>=u.length){C.startingSlide=0}}C.currSlide=C.startingSlide=C.startingSlide||0;var x=C.startingSlide;J.css({position:"absolute",top:0,left:0}).hide().each(function(w){var L=x?w>=x?u.length-(w-x):x-w:u.length-w;i(this).css("z-index",L)});i(u[x]).css("opacity",1).show();b(u[x],C);if(C.fit&&C.width){J.width(C.width)}if(C.fit&&C.height&&C.height!="auto"){J.height(C.height)}var D=C.containerResize&&!y.innerHeight();if(D){var v=0,B=0;for(var F=0;F<u.length;F++){var q=i(u[F]),K=q[0],A=q.outerWidth(),I=q.outerHeight();if(!A){A=K.offsetWidth}if(!I){I=K.offsetHeight}v=A>v?A:v;B=I>B?I:B}if(v>0&&B>0){y.css({width:v+"px",height:B+"px"})}}if(C.pause){y.hover(function(){this.cyclePause++},function(){this.cyclePause--})}if(c(C)===false){return false}var s=false;t.requeueAttempts=t.requeueAttempts||0;J.each(function(){var N=i(this);this.cycleH=(C.fit&&C.height)?C.height:N.height();this.cycleW=(C.fit&&C.width)?C.width:N.width();if(N.is("img")){var L=(i.browser.msie&&this.cycleW==28&&this.cycleH==30&&!this.complete);var O=(i.browser.mozilla&&this.cycleW==34&&this.cycleH==19&&!this.complete);var M=(i.browser.opera&&((this.cycleW==42&&this.cycleH==19)||(this.cycleW==37&&this.cycleH==17))&&!this.complete);var w=(this.cycleH==0&&this.cycleW==0&&!this.complete);if(L||O||M||w){if(E.s&&C.requeueOnImageNotLoaded&&++t.requeueAttempts<100){f(t.requeueAttempts," - img slide not loaded, requeuing slideshow: ",this.src,this.cycleW,this.cycleH);setTimeout(function(){i(E.s,E.c).cycle(t)},C.requeueTimeout);s=true;return false}else{f("could not determine size of image: "+this.src,this.cycleW,this.cycleH)}}}return true});if(s){return false}C.cssBefore=C.cssBefore||{};C.animIn=C.animIn||{};C.animOut=C.animOut||{};J.not(":eq("+x+")").css(C.cssBefore);if(C.cssFirst){i(J[x]).css(C.cssFirst)}if(C.timeout){C.timeout=parseInt(C.timeout);if(C.speed.constructor==String){C.speed=i.fx.speeds[C.speed]||parseInt(C.speed)}if(!C.sync){C.speed=C.speed/2}while((C.timeout-C.speed)<250){C.timeout+=C.speed}}if(C.easing){C.easeIn=C.easeOut=C.easing}if(!C.speedIn){C.speedIn=C.speed}if(!C.speedOut){C.speedOut=C.speed}C.slideCount=u.length;C.currSlide=C.lastSlide=x;if(C.random){C.nextSlide=C.currSlide;if(++C.randomIndex==u.length){C.randomIndex=0}C.nextSlide=C.randomMap[C.randomIndex]}else{C.nextSlide=C.startingSlide>=(u.length-1)?0:C.startingSlide+1}if(!C.multiFx){var G=i.fn.cycle.transitions[C.fx];if(i.isFunction(G)){G(y,J,C)}else{if(C.fx!="custom"&&!C.multiFx){f("unknown transition: "+C.fx,"; slideshow terminating");return false}}}var z=J[x];if(C.before.length){C.before[0].apply(z,[z,z,C,true])}if(C.after.length>1){C.after[1].apply(z,[z,z,C,true])}if(C.next){i(C.next).bind(C.prevNextEvent,function(){return o(C,C.rev?-1:1)})}if(C.prev){i(C.prev).bind(C.prevNextEvent,function(){return o(C,C.rev?1:-1)})}if(C.pager){d(u,C)}j(C,u);return C}function n(q){q.original={before:[],after:[]};q.original.cssBefore=i.extend({},q.cssBefore);q.original.cssAfter=i.extend({},q.cssAfter);q.original.animIn=i.extend({},q.animIn);q.original.animOut=i.extend({},q.animOut);i.each(q.before,function(){q.original.before.push(this)});i.each(q.after,function(){q.original.after.push(this)})}function c(w){var u,s,r=i.fn.cycle.transitions;if(w.fx.indexOf(",")>0){w.multiFx=true;w.fxs=w.fx.replace(/\s*/g,"").split(",");for(u=0;u<w.fxs.length;u++){var v=w.fxs[u];s=r[v];if(!s||!r.hasOwnProperty(v)||!i.isFunction(s)){f("discarding unknown transition: ",v);w.fxs.splice(u,1);u--}}if(!w.fxs.length){f("No valid transitions named; slideshow terminating.");return false}}else{if(w.fx=="all"){w.multiFx=true;w.fxs=[];for(p in r){s=r[p];if(r.hasOwnProperty(p)&&i.isFunction(s)){w.fxs.push(p)}}}}if(w.multiFx&&w.randomizeEffects){var t=Math.floor(Math.random()*20)+30;for(u=0;u<t;u++){var q=Math.floor(Math.random()*w.fxs.length);w.fxs.push(w.fxs.splice(q,1)[0])}a("randomized fx sequence: ",w.fxs)}return true}function j(r,q){r.addSlide=function(u,v){var t=i(u),w=t[0];if(!r.autostopCount){r.countdown++}q[v?"unshift":"push"](w);if(r.els){r.els[v?"unshift":"push"](w)}r.slideCount=q.length;t.css("position","absolute");t[v?"prependTo":"appendTo"](r.$cont);if(v){r.currSlide++;r.nextSlide++}if(!i.support.opacity&&r.cleartype&&!r.cleartypeNoBg){g(t)}if(r.fit&&r.width){t.width(r.width)}if(r.fit&&r.height&&r.height!="auto"){$slides.height(r.height)}w.cycleH=(r.fit&&r.height)?r.height:t.height();w.cycleW=(r.fit&&r.width)?r.width:t.width();t.css(r.cssBefore);if(r.pager){i.fn.cycle.createPagerAnchor(q.length-1,w,i(r.pager),q,r)}if(i.isFunction(r.onAddSlide)){r.onAddSlide(t)}else{t.hide()}}}i.fn.cycle.resetState=function(r,q){q=q||r.fx;r.before=[];r.after=[];r.cssBefore=i.extend({},r.original.cssBefore);r.cssAfter=i.extend({},r.original.cssAfter);r.animIn=i.extend({},r.original.animIn);r.animOut=i.extend({},r.original.animOut);r.fxFn=null;i.each(r.original.before,function(){r.before.push(this)});i.each(r.original.after,function(){r.after.push(this)});var s=i.fn.cycle.transitions[q];if(i.isFunction(s)){s(r.$cont,i(r.elements),r)}};function e(x,q,w,y){if(w&&q.busy&&q.manualTrump){i(x).stop(true,true);q.busy=false}if(q.busy){return}var u=q.$cont[0],A=x[q.currSlide],z=x[q.nextSlide];if(u.cycleStop!=q.stopCount||u.cycleTimeout===0&&!w){return}if(!w&&!u.cyclePause&&((q.autostop&&(--q.countdown<=0))||(q.nowrap&&!q.random&&q.nextSlide<q.currSlide))){if(q.end){q.end(q)}return}if(w||!u.cyclePause){var v=q.fx;A.cycleH=A.cycleH||i(A).height();A.cycleW=A.cycleW||i(A).width();z.cycleH=z.cycleH||i(z).height();z.cycleW=z.cycleW||i(z).width();if(q.multiFx){if(q.lastFx==undefined||++q.lastFx>=q.fxs.length){q.lastFx=0}v=q.fxs[q.lastFx];q.currFx=v}if(q.oneTimeFx){v=q.oneTimeFx;q.oneTimeFx=null}i.fn.cycle.resetState(q,v);if(q.before.length){i.each(q.before,function(B,C){if(u.cycleStop!=q.stopCount){return}C.apply(z,[A,z,q,y])})}var s=function(){i.each(q.after,function(B,C){if(u.cycleStop!=q.stopCount){return}C.apply(z,[A,z,q,y])})};if(q.nextSlide!=q.currSlide){q.busy=1;if(q.fxFn){q.fxFn(A,z,q,s,y)}else{if(i.isFunction(i.fn.cycle[q.fx])){i.fn.cycle[q.fx](A,z,q,s)}else{i.fn.cycle.custom(A,z,q,s,w&&q.fastOnEvent)}}}q.lastSlide=q.currSlide;if(q.random){q.currSlide=q.nextSlide;if(++q.randomIndex==x.length){q.randomIndex=0}q.nextSlide=q.randomMap[q.randomIndex]}else{var t=(q.nextSlide+1)==x.length;q.nextSlide=t?0:q.nextSlide+1;q.currSlide=t?x.length-1:q.nextSlide-1}if(q.pager){i.fn.cycle.updateActivePagerLink(q.pager,q.currSlide)}}var r=0;if(q.timeout&&!q.continuous){r=h(A,z,q,y)}else{if(q.continuous&&u.cyclePause){r=10}}if(r>0){u.cycleTimeout=setTimeout(function(){e(x,q,0,!q.rev)},r)}}i.fn.cycle.updateActivePagerLink=function(q,r){i(q).each(function(){i(this).find("a").removeClass("activeSlide").filter("a:eq("+r+")").addClass("activeSlide")})};function h(v,s,u,r){if(u.timeoutFn){var q=u.timeoutFn(v,s,u,r);while((q-u.speed)<250){q+=u.speed}a("calculated timeout: "+q+"; speed: "+u.speed);if(q!==false){return q}}return u.timeout}i.fn.cycle.next=function(q){o(q,q.rev?-1:1)};i.fn.cycle.prev=function(q){o(q,q.rev?1:-1)};function o(r,u){var q=r.elements;var t=r.$cont[0],s=t.cycleTimeout;if(s){clearTimeout(s);t.cycleTimeout=0}if(r.random&&u<0){r.randomIndex--;if(--r.randomIndex==-2){r.randomIndex=q.length-2}else{if(r.randomIndex==-1){r.randomIndex=q.length-1}}r.nextSlide=r.randomMap[r.randomIndex]}else{if(r.random){if(++r.randomIndex==q.length){r.randomIndex=0}r.nextSlide=r.randomMap[r.randomIndex]}else{r.nextSlide=r.currSlide+u;if(r.nextSlide<0){if(r.nowrap){return false}r.nextSlide=q.length-1}else{if(r.nextSlide>=q.length){if(r.nowrap){return false}r.nextSlide=0}}}}if(i.isFunction(r.prevNextClick)){r.prevNextClick(u>0,r.nextSlide,q[r.nextSlide])}e(q,r,1,u>=0);return false}function d(r,s){var q=i(s.pager);i.each(r,function(t,u){i.fn.cycle.createPagerAnchor(t,u,q,r,s)});i.fn.cycle.updateActivePagerLink(s.pager,s.startingSlide)}i.fn.cycle.createPagerAnchor=function(u,v,s,t,w){var r;if(i.isFunction(w.pagerAnchorBuilder)){r=w.pagerAnchorBuilder(u,v)}else{r='<a href="#">'+(u+1)+"</a>"}if(!r){return}var x=i(r);if(x.parents("body").length===0){var q=[];if(s.length>1){s.each(function(){var y=x.clone(true);i(this).append(y);q.push(y[0])});x=i(q)}else{x.appendTo(s)}}x.bind(w.pagerEvent,function(A){A.preventDefault();w.nextSlide=u;var z=w.$cont[0],y=z.cycleTimeout;if(y){clearTimeout(y);z.cycleTimeout=0}if(i.isFunction(w.pagerClick)){w.pagerClick(w.nextSlide,t[w.nextSlide])}e(t,w,1,w.currSlide<u);return false});if(w.pagerEvent!="click"){x.click(function(){return false})}if(w.pauseOnPagerHover){x.hover(function(){w.$cont[0].cyclePause++},function(){w.$cont[0].cyclePause--})}};i.fn.cycle.hopsFromLast=function(t,s){var r,q=t.lastSlide,u=t.currSlide;if(s){r=u>q?u-q:t.slideCount-q}else{r=u<q?q-u:q+t.slideCount-u}return r};function g(s){function r(t){t=parseInt(t).toString(16);return t.length<2?"0"+t:t}function q(w){for(;w&&w.nodeName.toLowerCase()!="html";w=w.parentNode){var t=i.css(w,"background-color");if(t.indexOf("rgb")>=0){var u=t.match(/\d+/g);return"#"+r(u[0])+r(u[1])+r(u[2])}if(t&&t!="transparent"){return t}}return"#ffffff"}s.each(function(){i(this).css("background-color",q(this))})}i.fn.cycle.commonReset=function(v,t,u,r,s,q){i(u.elements).not(v).hide();u.cssBefore.opacity=1;u.cssBefore.display="block";if(r!==false&&t.cycleW>0){u.cssBefore.width=t.cycleW}if(s!==false&&t.cycleH>0){u.cssBefore.height=t.cycleH}u.cssAfter=u.cssAfter||{};u.cssAfter.display="none";i(v).css("zIndex",u.slideCount+(q===true?1:0));i(t).css("zIndex",u.slideCount+(q===true?0:1))};i.fn.cycle.custom=function(B,v,q,s,r){var A=i(B),w=i(v);var t=q.speedIn,z=q.speedOut,u=q.easeIn,y=q.easeOut;w.css(q.cssBefore);if(r){if(typeof r=="number"){t=z=r}else{t=z=1}u=y=null}var x=function(){w.animate(q.animIn,t,u,s)};A.animate(q.animOut,z,y,function(){if(q.cssAfter){A.css(q.cssAfter)}if(!q.sync){x()}});if(q.sync){x()}};i.fn.cycle.transitions={fade:function(r,s,q){s.not(":eq("+q.currSlide+")").css("opacity",0);q.before.push(function(v,t,u){i.fn.cycle.commonReset(v,t,u);u.cssBefore.opacity=0});q.animIn={opacity:1};q.animOut={opacity:0};q.cssBefore={top:0,left:0}}};i.fn.cycle.ver=function(){return l};i.fn.cycle.defaults={fx:"fade",timeout:4000,timeoutFn:null,continuous:0,speed:1000,speedIn:null,speedOut:null,next:null,prev:null,prevNextClick:null,prevNextEvent:"click",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:!i.support.opacity,cleartypeNoBg:false,nowrap:0,fastOnEvent:0,randomizeEffects:1,rev:0,manualTrump:true,requeueOnImageNotLoaded:true,requeueTimeout:250}})(jQuery);
/*
 * jQuery Cycle Plugin Transition Definitions
 * This script is a plugin for the jQuery Cycle Plugin
 * Examples and documentation at: http://malsup.com/jquery/cycle/
 * Copyright (c) 2007-2008 M. Alsup
 * Version:	 2.72
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */
(function(a){a.fn.cycle.transitions.none=function(c,d,b){b.fxFn=function(g,e,f,h){a(e).show();a(g).hide();h()}};a.fn.cycle.transitions.scrollUp=function(d,e,c){d.css("overflow","hidden");c.before.push(a.fn.cycle.commonReset);var b=d.height();c.cssBefore={top:b,left:0};c.cssFirst={top:0};c.animIn={top:0};c.animOut={top:-b}};a.fn.cycle.transitions.scrollDown=function(d,e,c){d.css("overflow","hidden");c.before.push(a.fn.cycle.commonReset);var b=d.height();c.cssFirst={top:0};c.cssBefore={top:-b,left:0};c.animIn={top:0};c.animOut={top:b}};a.fn.cycle.transitions.scrollLeft=function(d,e,c){d.css("overflow","hidden");c.before.push(a.fn.cycle.commonReset);var b=d.width();c.cssFirst={left:0};c.cssBefore={left:b,top:0};c.animIn={left:0};c.animOut={left:0-b}};a.fn.cycle.transitions.scrollRight=function(d,e,c){d.css("overflow","hidden");c.before.push(a.fn.cycle.commonReset);var b=d.width();c.cssFirst={left:0};c.cssBefore={left:-b,top:0};c.animIn={left:0};c.animOut={left:b}};a.fn.cycle.transitions.scrollHorz=function(c,d,b){c.css("overflow","hidden").width();b.before.push(function(h,f,g,e){a.fn.cycle.commonReset(h,f,g);g.cssBefore.left=e?(f.cycleW-1):(1-f.cycleW);g.animOut.left=e?-h.cycleW:h.cycleW});b.cssFirst={left:0};b.cssBefore={top:0};b.animIn={left:0};b.animOut={top:0}};a.fn.cycle.transitions.scrollVert=function(c,d,b){c.css("overflow","hidden");b.before.push(function(h,f,g,e){a.fn.cycle.commonReset(h,f,g);g.cssBefore.top=e?(1-f.cycleH):(f.cycleH-1);g.animOut.top=e?h.cycleH:-h.cycleH});b.cssFirst={top:0};b.cssBefore={left:0};b.animIn={top:0};b.animOut={left:0}};a.fn.cycle.transitions.slideX=function(c,d,b){b.before.push(function(g,e,f){a(f.elements).not(g).hide();a.fn.cycle.commonReset(g,e,f,false,true);f.animIn.width=e.cycleW});b.cssBefore={left:0,top:0,width:0};b.animIn={width:"show"};b.animOut={width:0}};a.fn.cycle.transitions.slideY=function(c,d,b){b.before.push(function(g,e,f){a(f.elements).not(g).hide();a.fn.cycle.commonReset(g,e,f,true,false);f.animIn.height=e.cycleH});b.cssBefore={left:0,top:0,height:0};b.animIn={height:"show"};b.animOut={height:0}};a.fn.cycle.transitions.shuffle=function(e,f,d){var c,b=e.css("overflow","visible").width();f.css({left:0,top:0});d.before.push(function(i,g,h){a.fn.cycle.commonReset(i,g,h,true,true,true)});if(!d.speedAdjusted){d.speed=d.speed/2;d.speedAdjusted=true}d.random=0;d.shuffle=d.shuffle||{left:-b,top:15};d.els=[];for(c=0;c<f.length;c++){d.els.push(f[c])}for(c=0;c<d.currSlide;c++){d.els.push(d.els.shift())}d.fxFn=function(m,j,l,g,i){var h=i?a(m):a(j);a(j).css(l.cssBefore);var k=l.slideCount;h.animate(l.shuffle,l.speedIn,l.easeIn,function(){var o=a.fn.cycle.hopsFromLast(l,i);for(var q=0;q<o;q++){i?l.els.push(l.els.shift()):l.els.unshift(l.els.pop())}if(i){for(var r=0,n=l.els.length;r<n;r++){a(l.els[r]).css("z-index",n-r+k)}}else{var s=a(m).css("z-index");h.css("z-index",parseInt(s)+1+k)}h.animate({left:0,top:0},l.speedOut,l.easeOut,function(){a(i?this:m).hide();if(g){g()}})})};d.cssBefore={display:"block",opacity:1,top:0,left:0}};a.fn.cycle.transitions.turnUp=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,true,false);f.cssBefore.top=e.cycleH;f.animIn.height=e.cycleH});b.cssFirst={top:0};b.cssBefore={left:0,height:0};b.animIn={top:0};b.animOut={height:0}};a.fn.cycle.transitions.turnDown=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,true,false);f.animIn.height=e.cycleH;f.animOut.top=g.cycleH});b.cssFirst={top:0};b.cssBefore={left:0,top:0,height:0};b.animOut={height:0}};a.fn.cycle.transitions.turnLeft=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,false,true);f.cssBefore.left=e.cycleW;f.animIn.width=e.cycleW});b.cssBefore={top:0,width:0};b.animIn={left:0};b.animOut={width:0}};a.fn.cycle.transitions.turnRight=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,false,true);f.animIn.width=e.cycleW;f.animOut.left=g.cycleW});b.cssBefore={top:0,left:0,width:0};b.animIn={left:0};b.animOut={width:0}};a.fn.cycle.transitions.zoom=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,false,false,true);f.cssBefore.top=e.cycleH/2;f.cssBefore.left=e.cycleW/2;f.animIn={top:0,left:0,width:e.cycleW,height:e.cycleH};f.animOut={width:0,height:0,top:g.cycleH/2,left:g.cycleW/2}});b.cssFirst={top:0,left:0};b.cssBefore={width:0,height:0}};a.fn.cycle.transitions.fadeZoom=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,false,false);f.cssBefore.left=e.cycleW/2;f.cssBefore.top=e.cycleH/2;f.animIn={top:0,left:0,width:e.cycleW,height:e.cycleH}});b.cssBefore={width:0,height:0};b.animOut={opacity:0}};a.fn.cycle.transitions.blindX=function(d,e,c){var b=d.css("overflow","hidden").width();c.before.push(function(h,f,g){a.fn.cycle.commonReset(h,f,g);g.animIn.width=f.cycleW;g.animOut.left=h.cycleW});c.cssBefore={left:b,top:0};c.animIn={left:0};c.animOut={left:b}};a.fn.cycle.transitions.blindY=function(d,e,c){var b=d.css("overflow","hidden").height();c.before.push(function(h,f,g){a.fn.cycle.commonReset(h,f,g);g.animIn.height=f.cycleH;g.animOut.top=h.cycleH});c.cssBefore={top:b,left:0};c.animIn={top:0};c.animOut={top:b}};a.fn.cycle.transitions.blindZ=function(e,f,d){var c=e.css("overflow","hidden").height();var b=e.width();d.before.push(function(i,g,h){a.fn.cycle.commonReset(i,g,h);h.animIn.height=g.cycleH;h.animOut.top=i.cycleH});d.cssBefore={top:c,left:b};d.animIn={top:0,left:0};d.animOut={top:c,left:b}};a.fn.cycle.transitions.growX=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,false,true);f.cssBefore.left=this.cycleW/2;f.animIn={left:0,width:this.cycleW};f.animOut={left:0}});b.cssBefore={width:0,top:0}};a.fn.cycle.transitions.growY=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,true,false);f.cssBefore.top=this.cycleH/2;f.animIn={top:0,height:this.cycleH};f.animOut={top:0}});b.cssBefore={height:0,left:0}};a.fn.cycle.transitions.curtainX=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,false,true,true);f.cssBefore.left=e.cycleW/2;f.animIn={left:0,width:this.cycleW};f.animOut={left:g.cycleW/2,width:0}});b.cssBefore={top:0,width:0}};a.fn.cycle.transitions.curtainY=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,true,false,true);f.cssBefore.top=e.cycleH/2;f.animIn={top:0,height:e.cycleH};f.animOut={top:g.cycleH/2,height:0}});b.cssBefore={left:0,height:0}};a.fn.cycle.transitions.cover=function(f,g,e){var i=e.direction||"left";var b=f.css("overflow","hidden").width();var c=f.height();e.before.push(function(j,d,h){a.fn.cycle.commonReset(j,d,h);if(i=="right"){h.cssBefore.left=-b}else{if(i=="up"){h.cssBefore.top=c}else{if(i=="down"){h.cssBefore.top=-c}else{h.cssBefore.left=b}}}});e.animIn={left:0,top:0};e.animOut={opacity:1};e.cssBefore={top:0,left:0}};a.fn.cycle.transitions.uncover=function(f,g,e){var i=e.direction||"left";var b=f.css("overflow","hidden").width();var c=f.height();e.before.push(function(j,d,h){a.fn.cycle.commonReset(j,d,h,true,true,true);if(i=="right"){h.animOut.left=b}else{if(i=="up"){h.animOut.top=-c}else{if(i=="down"){h.animOut.top=c}else{h.animOut.left=-b}}}});e.animIn={left:0,top:0};e.animOut={opacity:1};e.cssBefore={top:0,left:0}};a.fn.cycle.transitions.toss=function(e,f,d){var b=e.css("overflow","visible").width();var c=e.height();d.before.push(function(i,g,h){a.fn.cycle.commonReset(i,g,h,true,true,true);if(!h.animOut.left&&!h.animOut.top){h.animOut={left:b*2,top:-c/2,opacity:0}}else{h.animOut.opacity=0}});d.cssBefore={left:0,top:0};d.animIn={left:0}};a.fn.cycle.transitions.wipe=function(s,m,e){var q=s.css("overflow","hidden").width();var j=s.height();e.cssBefore=e.cssBefore||{};var g;if(e.clip){if(/l2r/.test(e.clip)){g="rect(0px 0px "+j+"px 0px)"}else{if(/r2l/.test(e.clip)){g="rect(0px "+q+"px "+j+"px "+q+"px)"}else{if(/t2b/.test(e.clip)){g="rect(0px "+q+"px 0px 0px)"}else{if(/b2t/.test(e.clip)){g="rect("+j+"px "+q+"px "+j+"px 0px)"}else{if(/zoom/.test(e.clip)){var o=parseInt(j/2);var f=parseInt(q/2);g="rect("+o+"px "+f+"px "+o+"px "+f+"px)"}}}}}}e.cssBefore.clip=e.cssBefore.clip||g||"rect(0px 0px 0px 0px)";var k=e.cssBefore.clip.match(/(\d+)/g);var u=parseInt(k[0]),c=parseInt(k[1]),n=parseInt(k[2]),i=parseInt(k[3]);e.before.push(function(w,h,t){if(w==h){return}var d=a(w),b=a(h);a.fn.cycle.commonReset(w,h,t,true,true,false);t.cssAfter.display="block";var r=1,l=parseInt((t.speedIn/13))-1;(function v(){var y=u?u-parseInt(r*(u/l)):0;var z=i?i-parseInt(r*(i/l)):0;var A=n<j?n+parseInt(r*((j-n)/l||1)):j;var x=c<q?c+parseInt(r*((q-c)/l||1)):q;b.css({clip:"rect("+y+"px "+x+"px "+A+"px "+z+"px)"});(r++<=l)?setTimeout(v,13):d.css("display","none")})()});e.cssBefore={display:"block",opacity:1,top:0,left:0};e.animIn={left:0};e.animOut={left:0}}})(jQuery);

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}('o.L.M=5(c){c=o.N({3:6,2:C,s:t,u:"O",w:"P",p:"Q",x:"R",D:"S"},c);0 d;0 e;0 f=q;0 g=t;0 h=o(T);0 i;0 j;0 k=5(){h.y();e=h.z();4(h.z()>c.3){h.U(":V("+(c.3-1)+")").A();d=c.3;n()}};0 l=5(){4(!f){0 a=d+c.3;h.A();h.E(d,a).y();d=a;4(d>=e){f=t;i.B("r")}4(c.s)c.2.7("."+c.p).v(d/c.3);j.F("r");g=q}};0 m=5(){4(!g){0 a=d-c.3;h.A();h.E((a-c.3),a).y();d=a;4(d==c.3){g=t;j.B("r")}4(c.s)c.2.7("."+c.p).v(d/c.3);i.F("r");f=q}};0 n=5(){4(c.2===C){c.2=o(\'<G 8="W"></G>\');h.X(h.z()-1).H(c.2)}0 a=$(\'<a 8="\'+c.u+\'" I="#">&Y; Z</a><a 8="\'+c.w+\'" I="#">10 &11;</a>\');o(c.2).12(a);4(c.s){0 b=\'<9 8="\'+c.D+\'"><9 8="\'+c.p+\'"></9> / <9 8="\'+c.x+\'"></9></9>\';c.2.7("."+c.u).H(b);c.2.7("."+c.p).v(1);c.2.7("."+c.x).v(13.14(e/c.3))}i=c.2.7("."+c.w);j=c.2.7("."+c.u);j.B("r");i.J(5(){l();K q});j.J(5(){m();K q})};k()};',62,67,'var||pager|perpage|if|function||find|class|span|||||||||||||||jQuery|pagenumber|false|qp_disabled|showcounter|true|prev|text|next|totalnumber|show|size|hide|addClass|null|counter|slice|removeClass|div|after|href|click|return|fn|quickpaginate|extend|qp_next|qp_prev|qp_pagenumber|qp_totalnumber|qp_counter|this|filter|gt|qc_pager|eq|laquo|Prev|Next|raquo|append|Math|ceil'.split('|'),0,{}))


/*
 * Thickbox 3 - One Box To Rule Them All.
 * By Cody Lindley (http://www.codylindley.com)
 * Copyright (c) 2007 cody lindley
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/
var tb_pathToImage = "images/loadingAnimation.gif";
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}('$(o).2S(9(){1u(\'a.18, 3n.18, 3i.18\');1w=1p 1t();1w.L=2H});9 1u(b){$(b).s(9(){6 t=X.Q||X.1v||M;6 a=X.u||X.23;6 g=X.1N||P;19(t,a,g);X.2E();H P})}9 19(d,f,g){3m{3(2t o.v.J.2i==="2g"){$("v","11").r({A:"28%",z:"28%"});$("11").r("22","2Z");3(o.1Y("1F")===M){$("v").q("<U 5=\'1F\'></U><4 5=\'B\'></4><4 5=\'8\'></4>");$("#B").s(G)}}n{3(o.1Y("B")===M){$("v").q("<4 5=\'B\'></4><4 5=\'8\'></4>");$("#B").s(G)}}3(1K()){$("#B").1J("2B")}n{$("#B").1J("2z")}3(d===M){d=""}$("v").q("<4 5=\'K\'><1I L=\'"+1w.L+"\' /></4>");$(\'#K\').2y();6 h;3(f.O("?")!==-1){h=f.3l(0,f.O("?"))}n{h=f}6 i=/\\.2s$|\\.2q$|\\.2m$|\\.2l$|\\.2k$/;6 j=h.1C().2h(i);3(j==\'.2s\'||j==\'.2q\'||j==\'.2m\'||j==\'.2l\'||j==\'.2k\'){1D="";1G="";14="";1z="";1x="";R="";1n="";1r=P;3(g){E=$("a[@1N="+g+"]").36();25(D=0;((D<E.1c)&&(R===""));D++){6 k=E[D].u.1C().2h(i);3(!(E[D].u==f)){3(1r){1z=E[D].Q;1x=E[D].u;R="<1e 5=\'1X\'>&1d;&1d;<a u=\'#\'>2T &2R;</a></1e>"}n{1D=E[D].Q;1G=E[D].u;14="<1e 5=\'1U\'>&1d;&1d;<a u=\'#\'>&2O; 2N</a></1e>"}}n{1r=1b;1n="1t "+(D+1)+" 2L "+(E.1c)}}}S=1p 1t();S.1g=9(){S.1g=M;6 a=2x();6 x=a[0]-1M;6 y=a[1]-1M;6 b=S.z;6 c=S.A;3(b>x){c=c*(x/b);b=x;3(c>y){b=b*(y/c);c=y}}n 3(c>y){b=b*(y/c);c=y;3(b>x){c=c*(x/b);b=x}}13=b+30;1a=c+2G;$("#8").q("<a u=\'\' 5=\'1L\' Q=\'1o\'><1I 5=\'2F\' L=\'"+f+"\' z=\'"+b+"\' A=\'"+c+"\' 23=\'"+d+"\'/></a>"+"<4 5=\'2D\'>"+d+"<4 5=\'2C\'>"+1n+14+R+"</4></4><4 5=\'2A\'><a u=\'#\' 5=\'Z\' Q=\'1o\'>1l</a> 1k 1j 1s</4>");$("#Z").s(G);3(!(14==="")){9 12(){3($(o).N("s",12)){$(o).N("s",12)}$("#8").C();$("v").q("<4 5=\'8\'></4>");19(1D,1G,g);H P}$("#1U").s(12)}3(!(R==="")){9 1i(){$("#8").C();$("v").q("<4 5=\'8\'></4>");19(1z,1x,g);H P}$("#1X").s(1i)}o.1h=9(e){3(e==M){I=2w.2v}n{I=e.2u}3(I==27){G()}n 3(I==3k){3(!(R=="")){o.1h="";1i()}}n 3(I==3j){3(!(14=="")){o.1h="";12()}}};16();$("#K").C();$("#1L").s(G);$("#8").r({Y:"T"})};S.L=f}n{6 l=f.2r(/^[^\\?]+\\??/,\'\');6 m=2p(l);13=(m[\'z\']*1)+30||3h;1a=(m[\'A\']*1)+3g||3f;W=13-30;V=1a-3e;3(f.O(\'2j\')!=-1){1E=f.1B(\'3d\');$("#15").C();3(m[\'1A\']!="1b"){$("#8").q("<4 5=\'2f\'><4 5=\'1H\'>"+d+"</4><4 5=\'2e\'><a u=\'#\' 5=\'Z\' Q=\'1o\'>1l</a> 1k 1j 1s</4></4><U 1W=\'0\' 2d=\'0\' L=\'"+1E[0]+"\' 5=\'15\' 1v=\'15"+1f.2c(1f.1y()*2b)+"\' 1g=\'1m()\' J=\'z:"+(W+29)+"p;A:"+(V+17)+"p;\' > </U>")}n{$("#B").N();$("#8").q("<U 1W=\'0\' 2d=\'0\' L=\'"+1E[0]+"\' 5=\'15\' 1v=\'15"+1f.2c(1f.1y()*2b)+"\' 1g=\'1m()\' J=\'z:"+(W+29)+"p;A:"+(V+17)+"p;\'> </U>")}}n{3($("#8").r("Y")!="T"){3(m[\'1A\']!="1b"){$("#8").q("<4 5=\'2f\'><4 5=\'1H\'>"+d+"</4><4 5=\'2e\'><a u=\'#\' 5=\'Z\'>1l</a> 1k 1j 1s</4></4><4 5=\'F\' J=\'z:"+W+"p;A:"+V+"p\'></4>")}n{$("#B").N();$("#8").q("<4 5=\'F\' 3c=\'3b\' J=\'z:"+W+"p;A:"+V+"p;\'></4>")}}n{$("#F")[0].J.z=W+"p";$("#F")[0].J.A=V+"p";$("#F")[0].3a=0;$("#1H").11(d)}}$("#Z").s(G);3(f.O(\'37\')!=-1){$("#F").q($(\'#\'+m[\'26\']).1T());$("#8").24(9(){$(\'#\'+m[\'26\']).q($("#F").1T())});16();$("#K").C();$("#8").r({Y:"T"})}n 3(f.O(\'2j\')!=-1){16();3($.1q.35){$("#K").C();$("#8").r({Y:"T"})}}n{$("#F").34(f+="&1y="+(1p 33().32()),9(){16();$("#K").C();1u("#F a.18");$("#8").r({Y:"T"})})}}3(!m[\'1A\']){o.21=9(e){3(e==M){I=2w.2v}n{I=e.2u}3(I==27){G()}}}}31(e){}}9 1m(){$("#K").C();$("#8").r({Y:"T"})}9 G(){$("#2Y").N("s");$("#Z").N("s");$("#8").2X("2W",9(){$(\'#8,#B,#1F\').2V("24").N().C()});$("#K").C();3(2t o.v.J.2i=="2g"){$("v","11").r({A:"1Z",z:"1Z"});$("11").r("22","")}o.1h="";o.21="";H P}9 16(){$("#8").r({2U:\'-\'+20((13/2),10)+\'p\',z:13+\'p\'});3(!(1V.1q.2Q&&1V.1q.2P<7)){$("#8").r({38:\'-\'+20((1a/2),10)+\'p\'})}}9 2p(a){6 b={};3(!a){H b}6 c=a.1B(/[;&]/);25(6 i=0;i<c.1c;i++){6 d=c[i].1B(\'=\');3(!d||d.1c!=2){39}6 e=2a(d[0]);6 f=2a(d[1]);f=f.2r(/\\+/g,\' \');b[e]=f}H b}9 2x(){6 a=o.2M;6 w=1S.2o||1R.2o||(a&&a.1Q)||o.v.1Q;6 h=1S.1P||1R.1P||(a&&a.2n)||o.v.2n;1O=[w,h];H 1O}9 1K(){6 a=2K.2J.1C();3(a.O(\'2I\')!=-1&&a.O(\'3o\')!=-1){H 1b}}',62,211,'|||if|div|id|var||TB_window|function||||||||||||||else|document|px|append|css|click||href|body||||width|height|TB_overlay|remove|TB_Counter|TB_TempArray|TB_ajaxContent|tb_remove|return|keycode|style|TB_load|src|null|unbind|indexOf|false|title|TB_NextHTML|imgPreloader|block|iframe|ajaxContentH|ajaxContentW|this|display|TB_closeWindowButton||html|goPrev|TB_WIDTH|TB_PrevHTML|TB_iframeContent|tb_position||thickbox|tb_show|TB_HEIGHT|true|length|nbsp|span|Math|onload|onkeydown|goNext|Esc|or|close|tb_showIframe|TB_imageCount|Close|new|browser|TB_FoundURL|Key|Image|tb_init|name|imgLoader|TB_NextURL|random|TB_NextCaption|modal|split|toLowerCase|TB_PrevCaption|urlNoQuery|TB_HideSelect|TB_PrevURL|TB_ajaxWindowTitle|img|addClass|tb_detectMacXFF|TB_ImageOff|150|rel|arrayPageSize|innerHeight|clientWidth|self|window|children|TB_prev|jQuery|frameborder|TB_next|getElementById|auto|parseInt|onkeyup|overflow|alt|unload|for|inlineId||100||unescape|1000|round|hspace|TB_closeAjaxWindow|TB_title|undefined|match|maxHeight|TB_iframe|bmp|gif|png|clientHeight|innerWidth|tb_parseQuery|jpeg|replace|jpg|typeof|which|keyCode|event|tb_getPageSize|show|TB_overlayBG|TB_closeWindow|TB_overlayMacFFBGHack|TB_secondLine|TB_caption|blur|TB_Image|60|tb_pathToImage|mac|userAgent|navigator|of|documentElement|Prev|lt|version|msie|gt|ready|Next|marginLeft|trigger|fast|fadeOut|TB_imageOff|hidden||catch|getTime|Date|load|safari|get|TB_inline|marginTop|continue|scrollTop|TB_modal|class|TB_|45|440|40|630|input|188|190|substr|try|area|firefox'.split('|'),0,{}))

  

$(document).ready(function() {
	$.ajaxSetup ({
		cache: false
	});
	
	/*Browse by page */
	
	$('.checker').toggle(
	
	                    function(){
	
	                         $(this).attr('src','http://www.localsecrets.com/images/check.gif');
	                         $(this).next('h3').addClass("aquavate");
	
	                    }, function() { 
	
	                         $(this).attr('src','http://www.localsecrets.com/images/uncheck.gif');
	                         $(this).next('h3').removeClass("aquavate");
	
          });

	

	/* Some functions we will be needing later */
	function selectNav() {$(this).parents('ul:first').find('a').removeClass('selected').end().end().addClass('selected');}
	function trigger(data) {var el = $(".module-d-tab").find('a[href$="' + data.id + '"]').get(0);selectNav.call(el);}
	function trigger2(data) {var el = $(".module-b-tab").find('a[href$="' + data.id + '"]').get(0);selectNav.call(el);}
	function trigger3(data) {var el = $(".module-b-inner").find('a[href$="' + data.id + '"]').get(0);selectNav.call(el);}

	$("h3").bind("dblclick", function(){
	      $(this).next("div").toggleClass("hidden");
	    });

	$('.globback').click(function(){$("div#search").slideDown("slow",function(){$("div#advanced-search-panel").effect("transfer", {to: "div#search"}, 1000);$("div#advanced-search-panel").slideUp();$("p.advback").show("slow");})})
	
	$('.advback').click(function(){$("div#advanced-search-panel").slideDown("slow",function(){$("div#search").effect("transfer", {to: "div#advanced-search-panel"}, 1000);$("p.advback").hide("slow");$("div#search").hide("slow");})})


	/* Bits and bobs to make the widgets work and enhance site functionality */

	/* This one adds little icons before certain links */
	$("a:contains('Enter')").addClass("enter");
	$("a:contains('Print')").addClass("printer");
	$("a:contains('Re-Print')").addClass("printer");
	$("a:contains('Send to Mobile')").addClass("mobile");
	$("a:contains('Send to mobile')").addClass("mobile");
	$("a:contains('Terms')").addClass("read");
	$("a:contains('Enter Competition')").removeClass("enter");
	$("a:contains('Entertainment')").removeClass("enter");
	$("a:contains('Terms ')").removeClass("read");
	$("a:contains('Prints')").removeClass("printer");
	/* These deal with the footer - the first turns a panel into a clickable link and the second changes the class of the panel on hover */
	
	$(".big-target").click(function(){window.location=$(this).find("a").attr("href");return false;});
	$(".big-target").css("cursor","pointer");
	$("div.footbox").click(function(){window.location=$(this).find("a").attr("href");return false;});
	$("div.footbox").hover(function(){$(this).addClass('boxon')},function(){$(this).removeClass('boxon')});
	
	/* These deal with the upcoming box - the first turns a panel into a clickable link and the second changes the class of the panel on hover */
	
	$("#notices ul li").click(function(){window.location=$(this).find("a").attr("href");return false;});
	$("#notices ul li").hover(function(){$(this).addClass('notices-on')},function(){$(this).removeClass('notices-on')});
	
	$("#notices-new ul li").click(function(){window.location=$(this).find("a").attr("href");return false;});
	$("#notices-new ul li").hover(function(){$(this).addClass('notices-on')},function(){$(this).removeClass('notices-on')});
//	$("#notices-new ul li:last").css();

	$('a#login-link').click(function(){$('div#login-panel').load(websiteURL+'loadheader.cfm?template=login&rr='+jsRandomNumber).slideToggle('4000').siblings(".hider:visible").slideUp("slow");$(this).toggleClass("active");$(this).siblings(".spec-button a").removeClass("active");return false;});
	$('a#account-button').click(function(){$('div#account-panel').load(websiteURL+'loadheader.cfm?template=account&rr='+jsRandomNumber).slideToggle('4000').siblings(".hider:visible").slideUp("slow");$(this).toggleClass("active");$(this).siblings(".spec-button a").removeClass("active");return false;});
	$('a#email-button').click(function(){$('div#email-panel').load(websiteURL+'loadheader.cfm?template=email&rr='+jsRandomNumber).slideToggle('4000').siblings(".hider:visible").slideUp("slow");$(this).toggleClass("active");$(this).siblings(".spec-button a").removeClass("active");return false;});
	$('a#promote').click(function(){$('div#promote-panel').load(websiteURL+'loadheader.cfm?template=promote&rr='+jsRandomNumber).slideToggle('4000').siblings(".hider:visible").slideUp("slow");$(this).toggleClass("active");$(this).siblings(".spec-button a").removeClass("active");return false;});
	$('a#explore-button').click(function(){$('div#explore-panel').load(websiteURL+'loadheader.cfm?template=explore&rr='+jsRandomNumber).slideToggle('4000').siblings(".hider:visible").slideUp("slow");$(this).toggleClass("active");$(this).siblings(".spec-button a").removeClass("active");return false;});
	$('a#locator-button').click(function(){$('div#locate-panel').load(websiteURL+'loadheader.cfm?template=locator&rr='+jsRandomNumber).slideToggle('4000').siblings(".hider:visible").slideUp("slow");$(this).toggleClass("active");$(this).siblings(".spec-button a").removeClass("active");return false;});
	$('a#register-button').click(function(){$('div#register-panel').load(websiteURL+'loadheader.cfm?template=register&rr='+jsRandomNumber).slideToggle('4000').siblings(".hider:visible").slideUp("slow");$(this).toggleClass("active");$(this).siblings(".spec-button a").removeClass("active");return false;});
	$('a#cards-button').click(function(){$('div#cards-panel').load(websiteURL+'loadheader.cfm?template=cards&rr='+jsRandomNumber).slideToggle('4000').siblings(".hider:visible").slideUp("slow");$(this).toggleClass("active");$(this).siblings(".spec-button a").removeClass("active");return false;});
	$('.spec-button.active').click(function(){$('.hider').css("display","none")});
	
	$('#ads').cycle({fx:'fade',speed:1500,timeout:5000,next:'#s3',pause:1});
	$('#ads-3-party').cycle({fx:'fade',speed:1500,timeout:10000,next:'#s3',pause:1});
	
	$('#whatson-tabs').localScroll({target:'#whatson-panels',duration:700});
	$('#whatson-tabs > li:first').find('a').addClass('selected');
	$('#whatson-tabs > li').find('a').click(selectNav);
	$("#whatson-panels").serialScroll({items:'div',navigation:$("#whatson-tabs li a",this),axis:'xy',onAfter: trigger,duration: 500,force:true});
	$('#searchradio li a').click(function(){$('#searchradio li a').removeClass('selected');$(this).addClass('selected');var toLoad = $(this).attr('href');$('#search').load(toLoad);return false;});
	$("#moreso").live("click", function() {  
	var toLoad = $(this).attr('href');
	$('#search').load(toLoad);
	return false;	
	}); 
	
	
	$('#searchboxtop').hide();
	$('#searchquery').focus(function(){$('#searchboxtop').slideDown('slow');});
	$('#searchquery').blur(function(){$('#searchboxtop').slideUp('slow');});
	function hideLowerSearch(){$('#searchboxtop').slideUp('slow');}
	function showLowerSearch(){$('#searchboxtop').slideDown('slow');}
	/*$('#searchwrapper').hoverIntent(showLowerSearch,hideLowerSearch);*/

	
	$('#nav li a').click(function(){
								  
		var toLoad = $(this).attr('href')+' #content';
		$('#content').hide('fast',loadContent);
		$('#load').remove();
		$('#wrapper').append('<span id="load">LOADING...</span>');
		$('#load').fadeIn('normal');
		window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5);
		function loadContent() {
			$('#content').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#content').show('normal',hideLoader());
		}
		function hideLoader() {
			$('#load').fadeOut('normal');
		}
		return false;
		
	});
	
	$(".change-location").click(function(){
		var str = this.id;
		var splitstr = str.split("_");
		createCookie(splitstr[0],splitstr[1],'');
		//---------set the new town label
		var town_label="";
		switch(splitstr[1])
		{
			case "1":
				town_label="Cambridge";
				break;
			case "2":
				town_label="Ely";
				break;
			case "3":
				town_label="Newmarket";
				break;
			case "4":
				town_label="Royston";
				break;
			case "5":
				town_label="Saffron Walden";
				break;
			case "6":
				town_label="St Neots";
				break;
			case "7":
				town_label="Huntingdon-St Ives";
				break;
			case "10":
				town_label="Bury St Edmunds";
				break;
			default:
				//do nothing
		}
		$('h2#logo-label').html(town_label);
	});
	//------------- bake and eat cookies ------------------------
	function createCookie(name,value,days) {
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
	}	
	//---------------------------------------------------------


	
	//START	 - To show span after search	
	function defaultShowSpan(){
		if(locationOptions() == '')	$("#loc_options").hide(); else $("#loc_options").html(locationOptions());

		if(locationWhatson() == '')	$("#loc_whatson").hide(); else $("#loc_whatson").html(locationWhatson());
			
		if(venueOptions() == '') $("#venue_options").hide(); else $("#venue_options").html(venueOptions());
			
		if(venueWhatson() == '') $("#venue_whatson").hide(); else $("#venue_whatson").html(venueWhatson());
			
		if(venueFeatures() == '') $("#venue_features").hide(); else $("#venue_features").html(venueFeatures());
			
		if(groupOptions() == '') $("#group_options").hide(); else $("#group_options").html(groupOptions());
			
		if(offerOptions() == '') $("#offer_options").hide(); else $("#offer_options").html(offerOptions());
			
		if(venueLifestyle() == '') $("#venue_lifestyle").hide(); else $("#venue_lifestyle").html(venueLifestyle());
	}
	//END
	defaultShowSpan();
	/*
	function upcomingRotate(){
			$("#upcoming li").hide();
			$("div#notices-new").load(websiteURL+'loaddynamic.cfm?template=upcoming');		 
			$("#upcoming li").show("slide", {}, 2000);
			setTimeout(function(){upcomingRotate()},30000);
	}
	if($("#upcoming").length > 0)
		setTimeout(function(){upcomingRotate()},30000);
		
	*/
	
	function rotate(thenum){
	var currentitem = thenum;
	var totalitems = $("#upcoming li").length;
	var toshow = parseInt((thenum + 1)%totalitems);
	$("#upcoming li").hide();
	$("#upcoming li").eq(toshow).show("slide", {}, 1000);
	setTimeout(function(){rotate(toshow)},15000);
	}

	rotate('0');
	
	function competitionsrotate(thenum){
	var currentitem = thenum;
	var totalitems = $("#upcoming-competitions li").length;
	var toshow = parseInt((thenum + 1)%totalitems);
	$("#upcoming-competitions li").hide();
	$("#upcoming-competitions li").eq(toshow).show("slide", {}, 1000);
	setTimeout(function(){competitionsrotate(toshow)},20000);
	}

	competitionsrotate('0');


// Ads rotate

	$('#rotate')
		.cycle({
	    fx:     'fade',
	    speed:  '1500',
	    timeout: 7000,
	    pager:  '#pager'
	});


	$(".dropdown dt a").click(function() {
                $(".dropdown dd ul").toggle();
            });
	
	$(".dropdown dt a").mouseover(function() {
                $(".dropdown dd ul").toggle();
            });


	
	$("#cards").removeClass("active");
	
	/* Auto detection system to make all accordions work */

	if ($("div.accordion").length > 0) {
		$("div.accordion").each(function(){
			/*$("h5:first",this).addClass("active"); */
			/*$("div:is(:first)",this).hide();*/
			$("div:not(:first)",this).hide();
			$("h5",this).click(function(){
				$(this).next("div").slideToggle(); //.siblings("div:visible").slideUp()
				$(this).toggleClass("active");
				//$(this).siblings("h5").removeClass("active");
				//var acctrac = $(this).parents('div:eq(0)').attr('id');
				//$.scrollTo('#' + acctrac);
			});
		});
	}
	
	
	if ($("span.accordion2").length > 0) {
			$("span.accordion2").each(function(){
			$("h6:first",this).addClass("active");
			$("dl:not(:first)",this).hide();
			 
			$("h6",this).click(function(){
				$(this).next("dl").slideToggle();//.siblings("dl:visible").slideUp();
				$(this).toggleClass("active");
				//$(this).siblings("h6").removeClass("active");
				//var acctrac = $(this).parents('dl:eq(0)').attr('id');
				//$.scrollTo('#' + acctrac);
			});
		});
	}

if ($("table.shopping-cart").length > 0) {
	
$('th').addClass('table-heading');
$('tr:not([th]):even').addClass('tableroweven');
$('tr:not([th]):odd').addClass('tablerowodd');

}
	
	if ($("div.results-offerlist-accordion").length > 0) {
		$("div.results-offerlist-accordion").each(function(){
			$("h5:first",this).addClass("active");
			$("dl:not(:first)",this).hide();
			$("h5",this).click(function(){
				$(this).next("dl").slideToggle().siblings("dl:visible").slideUp();
				$(this).toggleClass("active");
				$(this).siblings("h5").removeClass("active");
				var acctrac = $(this).parents('dl:eq(0)').attr('id');
				$.scrollTo('#' + acctrac);
			});
		});
	}
	
	if ($("dl.results-offerlist-accordion").length > 0) {
		$("dl.results-offerlist-accordion").each(function(){
			$("h6:first",this).addClass("active");
			$("div:not(:first)",this).hide();
			$("h6",this).click(function(){
				$(this).next("div").slideToggle().siblings("div:visible").slideUp();
				$(this).toggleClass("active");
				$(this).siblings("h6").removeClass("active");
				var acctrac = $(this).parents('div:eq(0)').attr('id');
				$.scrollTo('#' + acctrac);
			});
		});
	}
	
	
	if ($("dl.results-whatson-accordion").length > 0) {
		$("dl.results-whatson-accordion").each(function(){
			$("h6:first",this).addClass("active");
			$("div:not(:first)",this).hide();
			$("h6",this).click(function(){
				$(this).next("div").slideToggle().siblings("div:visible").slideUp();
				$(this).toggleClass("active");
				$(this).siblings("h6").removeClass("active");
				
			});
		});
	}
	
	if ($("span.accordion").length > 0) {
			$("span.accordion").each(function(){
			$("h6:first",this).addClass("active");
			$("span:not(:first)",this).hide();
			spanCount = $("span:first dl",this).length;
			if(spanCount < 10){
				spanid = $("span:first",this).next().next().attr("id");
				$("span:first",this).next().next().show();
			}
			$("h6",this).click(function(){
				$(this).next("span").slideToggle().siblings("span:visible").slideUp();
				$(this).toggleClass("active");
				$(this).siblings("h6").removeClass("active");
				var acctrac = $(this).parents('span:eq(0)').attr('id');
				$.scrollTo('#' + acctrac);
			});
		});
	}
	
	/* whatsOn results */
	if ($("div.whatson-results-accordion").length > 0) {
		
		alert(1);
		$("div.whatson-results-accordion").each(function(){
														 
														 alert(2);
		$("h4:first",this).addClass("active");
		$("h4",this).click(function(){$(this).toggleClass("active");$(this).siblings("h4").removeClass("active");}
		);
		}
		);
	}
	
	/* Ezine page */
	if ($("div.accordion-ezine").length > 0) {
		$("div.accordion-ezine").each(function(){
		$("h5:first",this).addClass("active");
		$("h5",this).click(function(){$(this).toggleClass("active");$(this).siblings("h5").removeClass("active");}
		);
		}
		);
	}

	if ($("form.sectionSearch").length > 0) {
		$("form.sectionSearch").each(function(){
		$("form.sectionSearch fieldset").hide();
		$("p.searchtoggler",this).click(function(){$(this).next("fieldset").slideToggle();}
		);
		}
		);
	}

	if ($("div#advanced-search-panel").length > 0) {
		$("div#search").hide();
	}


	/* Span for viewing Full Terms*/
	$(".full-terms").click(function(){
		var clkLink = this.id;
		$(".full-terms").each(function(){
			if(clkLink != this.id){
				$('#offer-' + this.id).hide();
			}else
				$('#offer-' + this.id).toggle();
		});
	});

	/* Auto detection system to make modules work */

	if ($("div.module-b").length > 0) {
		$("div.module-b").each(function(){
		var thepanels = '$("div.outer",this)';
		$(".module-b-tab",this).localScroll({target:$(".outer",this),duration:500});
		$(".module-b-tab li:first",this).find('a').addClass('selected');
		$(".module-b-tab li",this).find('a').click(selectNav);
		$(".outer",this).serialScroll({items:'div',navigation:$(".module-b-tab li a",this),axis:'xy',onAfter: trigger2,duration: 500,force:true,interval:15000});
		}
		);
	}
	if ($("div.module-b-inner").length > 0) {
		$("div.module-b-inner").each(function(){
		var thepanels = '$("div.outer",this)';
		$(".module-b-inner-tab",this).localScroll({target:$(".outer",this),duration:500});
		$(".module-b-inner-tab li:first",this).find('a').addClass('selected');
		$(".module-b-inner-tab li",this).find('a').click(selectNav);
		$(".outer",this).serialScroll({items:'div',navigation:$(".module-b-inner-tab li a",this),axis:'xy',onAfter: trigger3,duration: 500,force:true,interval:20000});
		}
		);
	}

	if ($("div.module-a").length > 0) {
		$("div.module-a").each(function(){
		var thepanels = '$("div.outer",this)';
		$(".module-a-tab",this).localScroll({target:$(".outer",this),duration:500});
		$(".module-a-tab li:first",this).find('a').addClass('selected');
		$(".module-a-tab li",this).find('a').click(selectNav);
		$(".outer",this).serialScroll({items:'div',navigation:$(".module-a-tab li a",this),axis:'xy',onAfter: trigger,duration: 500,force:true});
		}
		);
	}

	if ($("div.module-d").length > 0) {
		$("div.module-d").each(function(){
		$(".module-d-tabs li:last",this).after('<img class="next" src="' + websiteImageURL + 'next.png" />');$(".module-d-tabs li:first",this).before('<img class="prev" src="' + websiteImageURL + 'prev.png" />');
		$(".module-d-tabs",this).localScroll({target:$(".module-d-panels",this),duration:500});
		$(".module-d-tabs li:first",this).find('a').addClass('selected');
		$(".module-d-tabs li",this).find('a').click(selectNav);
		$(".module-d-panels",this).serialScroll({items:'div',navigation:$(".module-d-tabs li a",this),prev:$(".module-d-tabs img.prev",this),next:$(".module-d-tabs img.next",this),axis:'xy',onAfter: trigger,duration: 500,force:true,interval:25000});
		}
		);
	}
	
	/* Pagination for modules */
	if ($(".ezine-results").length > 0) {
		$(".ezine-results").each(function(){
			var lister = $(this).attr("id");
			$('#' + lister + " span").quickpaginate( { perpage: 2, showcounter: true, pager: $('#'+lister) } );
		});
	}
	
	if ($(".ezine-sub-results").length > 0) {
		$(".ezine-sub-results").each(function(){
			var lister = $(this).attr("id");
			$('#' + lister + " span").quickpaginate( { perpage: 4, showcounter: true, pager: $('#'+lister) } );
		});
	}
	
	if($(".results-sub-deflist")){
		if ($(".results-sub-deflist").length > 0) {
			$(".results-sub-deflist").each(function(){
				var lister = $(this).attr("id");
				$('#' + lister + " dl").quickpaginate( { perpage: 10, showcounter: true, pager: $('#'+lister) } );
			});		
		
			$("a.qp_prev").click(function(){
				focusId = $(this).parent().prev().attr("id");
				$(this).attr("href","#" + focusId);
				window.location = $(this).attr("href");
			});
			
			$("a.qp_next").click(function(){
				focusId = $(this).parent().prev().attr("id");
				$(this).attr("href","#" + focusId);
				window.location = $(this).attr("href");
			});
			window.onunload = null;
		}
	}
	
	if($(".results-voucher-list")){
		if ($(".results-voucher-list").length > 0) {
			$(".results-voucher-list").each(function(){
				var lister = $(this).attr("id");
				$('#' + lister + " dl").quickpaginate( { perpage: 2, showcounter: true, pager: $('#'+lister) } );
			});		
		
			$("a.qp_prev").click(function(){
				focusId = $(this).parent().prev().attr("id");
				$(this).attr("href","#" + focusId);
				window.location = $(this).attr("href");
			});
			
			$("a.qp_next").click(function(){
				focusId = $(this).parent().prev().attr("id");
				$(this).attr("href","#" + focusId);
				window.location = $(this).attr("href");
			});
		}
	}

	if ($(".results-offerlist").length > 0) {
		$("#offers-list div").quickpaginate( { perpage: 10, showcounter: true, pager: $("#offers-list") } );
	}
	
	if ($(".offer-div-list").length > 0) {
		$(".offer-div-list").each(function(){
			var lister = $(this).attr("id");
			$('#' + lister + " dt").quickpaginate( { perpage: 10, showcounter: true, pager: $('#'+lister) } );
		});
		
		$("a.qp_prev").click(function(){
			focusId = $(this).parent().prev().attr("id");
			$(this).attr("href","#" + focusId);
			window.location = $(this).attr("href");
		});
		
		$("a.qp_next").click(function(){
			focusId = $(this).parent().prev().attr("id");
			$(this).attr("href","#" + focusId);
			window.location = $(this).attr("href");
		});
	}
	
	if ($(".group-div-list").length > 0) {
		$(".group-div-list").each(function(){
			var lister = $(this).attr("id");
			$('#' + lister + " ul").quickpaginate( { perpage: 10, showcounter: true, pager: $('#'+lister) } );
		});
		
		$("a.qp_prev").click(function(){
			focusId = $(this).parent().prev().attr("id");
			$(this).attr("href","#" + focusId);
			window.location = $(this).attr("href");
		});
		
		$("a.qp_next").click(function(){
			focusId = $(this).parent().prev().attr("id");
			$(this).attr("href","#" + focusId);
			window.location = $(this).attr("href");
		});
	}
	
	/*if ($(".search-results").length > 0) {
		$("#results-set div").quickpaginate( { perpage: 10, showcounter: true, pager: $("#results-set") } );
		//$("#results-set p").quickpaginate( { perpage: 10, showcounter: true, pager: $("#results-set") } );
	}*/
	
	if ($(".results-unopened-list").length > 0) {
		$("#offers-unopened-list span").quickpaginate( { perpage: 10, showcounter: true, pager: $("#offers-unopened-list") } );
	}
	
	if ($(".results-opened-list").length > 0) {
		$("#offers-opened-list span").quickpaginate( { perpage: 10, showcounter: true, pager: $("#offers-opened-list") } );
	}



$(".reloader").live("click", function() {  
	var toLoad = $(this).attr('href');
	$('#reloadarea').load(toLoad);
	return false;	
	}); 


	/* Automagically makes the results lists work */
	function toggler(){
		var showText="quick info";
		var hideText="close info";
		$(".toggle").prev().append(' <a href="#" class="toggleLink" style="font-weight:normal" title="Show/hide features and mini-reviews">'+showText+'</a>');
		$('.toggle').hide();
		$('a.toggleLink').click(function() {
			if ($(this).html()==showText)
				$(this).html(hideText);
			else 
				$(this).html(showText);
			$(this).parent().next('.toggle').toggle('slow');
			return false;
		});
	}
	toggler();
	
	/* SEARCH OPTIONS */
	function togglerSearch(){
		var showText="Show";
		var hideText="Hide";
		$(".toggle-search").prev().append(' (<a href="#" class="toggleSearchLink">'+showText+'</a>)');
		$('.toggle-search').hide();
		$('a.toggleSearchLink').click(function() {
			if ($(this).html()==showText) {
				$(this).html(hideText);
				/* For search span hide */
				$(this).parent().next().next().hide('slow');
			}
			else {
				$(this).html(showText);
				/* For search span show ----START---- */
				switch($(this).parent().next().next().attr("id")){
					//Location options[Eatingout]
					case "loc_options":
						htmlSpan = locationOptions();
						break;
					//Whats on location options
					case "loc_whatson":
						htmlSpan = locationWhatson();
						break;
					//Venue options[Common]
					case "venue_options":
						htmlSpan = venueOptions();
						break;
					//Lifestyle venue options
					case "venue_lifestyle":
						htmlSpan = venueLifestyle();
						break;
					//Whats on venue options
					case "venue_whatson":
						htmlSpan = venueWhatson();
						break;
					//Offer options
					case "offer_options":
						htmlSpan = offerOptions();
						break;
					case "group_options":
						htmlSpan = groupOptions();
						break;
					case "venue_features":
						htmlSpan = venueFeatures();
						break;
				}
				$(this).parent().next().next().html(htmlSpan);
				$(this).parent().next().next().show('slow');
				/* For search span show ----END---- */
			}
			$(this).parent().next('.toggle-search').toggle('slow');
			return false;
		});
	}
	togglerSearch();
	
	/* Location Options */
	function locationOptions(){
		distanceVal = $('select#distance option:selected').text();
		areaVal = $('select#areatownid option:selected').text();
		if(($('select#distance option:selected').val() == 0) && ($('#postcode').val() == "") && ($('select#areatownid option:selected').val() == 0))
			var locationHtml = '';
		else{
			var locationHtml = '<b>You have selected:</b><br />';
			if($('select#distance option:selected').val() != 0)//Distance value
				locationHtml = locationHtml + 'Distance: ' + distanceVal + '<br />';					
			if($('input#postcode').val() != "")//Postal code
				locationHtml = locationHtml + 'Postcode: ' + $('input#postcode').val() + '<br />';					
			else if($('select#areatownid option:selected').val() != 0)//Location value
				locationHtml = locationHtml + 'Location: ' + areaVal + '<br />';
		}
		return locationHtml;
	}
	/* Location whats on options */
	function locationWhatson(){
		distanceVal = $('select#distance option:selected').text();
		areaVal = $('select#areatownid option:selected').text();
		if(($('select#distance option:selected').val() == 0) && ($('#postcode').val() == "") && ($('select#areatownid option:selected').val() == 0) && ($('#fCalDate').val() == "") && ($('#tCalDate').val() == ""))
			var locationWhatHtml = '';
		else{
			var locationWhatHtml = '<b>You have selected:</b><br />';
			if($('select#distance option:selected').val() != 0)//Distance value
				locationWhatHtml = locationWhatHtml + 'Distance: ' + distanceVal + '<br />';					
			if($('#postcode').val() != "")//Postal code
				locationWhatHtml = locationWhatHtml + 'Postal code: ' + $('#postcode').val() + '<br />';					
			else if($('select#areatownid option:selected').val() != 0)//Location value
				locationWhatHtml = locationWhatHtml + 'Location: ' + areaVal + '<br />';						
			if($('#fCalDate').val() != "")//From date
				locationWhatHtml = locationWhatHtml + 'From: ' + $('#fCalDate').val() + '<br />';
			if($('#tCalDate').val() != "")//To date
				locationWhatHtml = locationWhatHtml + 'To: ' + $('#tCalDate').val() + '<br />';
		}
		return locationWhatHtml;
	}
	/* Venue options */
	function venueOptions(){
		venueType = $('select#venuetypeid option:selected').val();
		cusineType = $('select#cuisineid option:selected').val();
		pricepermeal = $('select#avgpricepermealid option:selected').val();
		if((venueType == 0) && (cusineType == 0) && (pricepermeal == 0))
			var venueHtml = '';
		else{
			var venueHtml = '<b>You have selected:</b><br />';					
			if(venueType != 0)//Venue Type
				venueHtml = venueHtml + 'Type of venue: ' + $('select#venuetypeid option:selected').text() + '<br />';
			if(cusineType != 0)//Serving
				venueHtml = venueHtml + 'Serving: ' + $('select#cuisineid option:selected').text() + '<br />';					
			if(pricepermeal != 0)//Price per meal
				venueHtml = venueHtml + 'Avg. price per meal: ' + $('select#avgpricepermealid option:selected').text() + '<br />';
		}
		return venueHtml;
	}
	/* Venue lifestyle options */
	function venueLifestyle(){
		serviceType = $('select#servicetypeid option:selected').val();
		if(serviceType == 0)
			var venueLifestyleHtml = '';
		else{
			var venueLifestyleHtml = '<b>You have selected:</b><br />';					
			if(serviceType != 0)//Service Type
				venueLifestyleHtml = venueLifestyleHtml + 'Service type: ' + $('select#servicetypeid option:selected').text() + '<br />';
		}
		return venueLifestyleHtml;
	}
	/* Venue whatson */
	function venueWhatson(){
		searchCategory = $('select#searchCategory option:selected').val();
		if(($('#searchVenue').val() == "") && (searchCategory == 0))
			var venueWhatsonHtml = '';
		else{
			var venueWhatsonHtml = '<b>You have selected:</b><br />';						
			if($('#searchVenue').val() != "")//Venue name
				venueWhatsonHtml = venueWhatsonHtml + 'Venue name: ' + $('#searchVenue').val() + '<br />';					
			if(searchCategory != 0)//Event category
				venueWhatsonHtml = venueWhatsonHtml + 'Event category: ' + $('select#searchCategory option:selected').text() + '<br />';
		}
		return venueWhatsonHtml;
	}
	/* offer options */
	function offerOptions(){
		dayOfWeek = $('select#dayofweek option:selected').val();
		timeOfWeek = $('select#offervalidityidlist option:selected').val();
		offerType = $('select#zoffertype option:selected').val();
		if((dayOfWeek == "") && (timeOfWeek == "") && (offerType == ""))
			var offerHtml = '';
		else{
			var offerHtml = '<b>You have selected:</b><br />';	
			if(dayOfWeek != "")//Day
				offerHtml = offerHtml + 'Day: ' + $('select#dayofweek option:selected').text() + '<br />';					
			if(timeOfWeek != "")//Time
				offerHtml = offerHtml + 'Time: ' + $('select#offervalidityidlist option:selected').text() + '<br />';					
			if(offerType != "")//Week
				offerHtml = offerHtml + 'Type: ' + $('select#zoffertype option:selected').text() + '<br />';
		}
		return offerHtml;
	}
	/* group options */
	function groupOptions(){
		typeorg = $('select#typeorg option:selected').val();
		if(typeorg == "")
			var groupHtml = '';
		else{
			var groupHtml = '<b>You have selected:</b><br />';					
			if(typeorg != "")//Type
				groupHtml = groupHtml + 'Type: ' + $('select#typeorg option:selected').text() + '<br />';
		}
		return groupHtml;
	}
	/* Venue features */
	function venueFeatures(){
		venueFeat = $('select#venueFeatures option:selected').val();
		atmosphereId = $('select#Atmosphereid option:selected').val();
		lsratingid = $('select#lsratingid option:selected').val();
		cuisinestyleid = $('select#cuisinestyleid option:selected').val();
		OpeningStyleid = $('select#OpeningStyleid option:selected').val();
		OpeningStyleday = $('select#OpeningStyleday option:selected').val();
		lswratingid = $('select#lswratingid option:selected').val();
		DisabledAccessid = $('select#DisabledAccessid option:selected').val();
		capacity = $('select#capacity option:selected').val();
		smokingpolicyid = $('select#smokingpolicyid option:selected').val();
		if((venueFeat == 0) && (smokingpolicyid == 0) && (capacity == 0) && (DisabledAccessid == 0) && (atmosphereId == 0) && (lsratingid == 0) && (cuisinestyleid == 0) && (OpeningStyleid == 0) && (OpeningStyleday == 0) && (lswratingid == 0))
			var venueOptHtml = '';
		else{
			var venueOptHtml = '<b>You have selected:</b><br />';					
			if(venueFeat != 0)//Venue should have
				venueOptHtml = venueOptHtml + 'Venue should have: ' + $('select#venueFeatures option:selected').text() + '<br />';					
			if(atmosphereId != 0)//Atmosphere
				venueOptHtml = venueOptHtml + 'Atmosphere: ' + $('select#Atmosphereid option:selected').text() + '<br />';				
			if(lsratingid != 0)//Local Secrets Stars
				venueOptHtml = venueOptHtml + 'Local Secrets Stars: ' + $('select#lsratingid option:selected').text() + '<br />';				
			if(cuisinestyleid != 0)//Style of cuisine
				venueOptHtml = venueOptHtml + 'Style of cuisine: ' + $('select#cuisinestyleid option:selected').text() + '<br />';					
			if(OpeningStyleid != 0)//Opening hours
				venueOptHtml = venueOptHtml + 'Opening hours: ' + $('select#OpeningStyleid option:selected').text() + '<br />';					
			if(OpeningStyleday != 0)//Open on
				venueOptHtml = venueOptHtml + 'Open on: ' + $('select#OpeningStyleday option:selected').text() + '<br />';					
			if(lswratingid != 0)//Wine rating
				venueOptHtml = venueOptHtml + 'Wine rating: ' + $('select#lswratingid option:selected').text() + '<br />';					
			if(DisabledAccessid != 0)//Disabled access
				venueOptHtml = venueOptHtml + 'Disabled access: ' + $('select#DisabledAccessid option:selected').text() + '<br />';					
			if(capacity != 0)//capacity
				venueOptHtml = venueOptHtml + 'Capacity: ' + $('select#capacity option:selected').text() + '<br />';					
			if(smokingpolicyid != 0)//Smoking policy
				venueOptHtml = venueOptHtml + 'Smoking policy: ' + $('select#smokingpolicyid option:selected').text() + '<br />';
		}
		return venueOptHtml;
	}

	$(".results-sub-deflist dl:odd").css("background-color","#fafafa").css("border-bottom","1px solid #ddd");
	$(".results-sub-deflist dl:even").css("border-bottom","1px solid #ddd");
	$(".group-div-list ul:odd").css("background-color","#fafafa").css("border-bottom","1px solid #ddd");
	$(".group-div-list ul:even").css("border-bottom","1px solid #ddd");
	
	/*$(".img-wrapper img:odd").css("float","left");
	$(".img-wrapper img:even").css("float","right");
	$(".footer-links img:odd").css("float","left");
	$(".footer-links img:even").css("float","right");
	*/
	
	$("ul.sf-menu").superfish({
						animation: {opacity:'show',height:'show'},
						pathClass: 'current',
						autoArrows:false
	});
	
	$(".bookatable-results").click(function(){
		$("#booking_div").toggle();
	});
	
	$("#book_party").click(function(){
		$("#booking_venue_box").show();
		$("#party_size").hide();
	});
	
	$("#openall").click(function(){
		if ($("span.accordion2").length > 0) {
			$("span.accordion2").each(function(){
				$("h6",this).addClass("active");
				$("dl",this).show();
			});
		}
		
		if ($("div.accordion").length > 0) {
		$("div.accordion").each(function(){
			$("h5",this).addClass("active");
			$("div",this).show();
			
		});
	}
	});
	
	$("#closeall").click(function(){
		if ($("span.accordion2").length > 0) {
			$("span.accordion2").each(function(){
				$("h6",this).removeClass("active");
				$("dl",this).hide();
			});
		}
		
		if ($("div.accordion").length > 0) {
		$("div.accordion").each(function(){
			$("h5",this).removeClass("active");
			$("div",this).hide();
			
		});
	}
	});

if ($("table.shopping-cart").length > 0) {
	
$('th').addClass('table-heading');
$('tr:not([th]):even').addClass('tableroweven');
$('tr:not([th]):odd').addClass('tablerowodd');

}
/* NEW from Mark (November 2009) - this is the code that makes the news ticker work */

	$('#tick')
	.cycle({
	    fx:     'scrollLeft',
	    speed:  '500',
	    timeout: 7000,
	    slideExpr:'li',
	    next:'#ticknext',
	    prev:'#tickprev',
	    pause:1
	});
	
	$('#magazine-panels')
	.cycle({
	    fx:     'cover',
	    speed:  '250',
	    timeout: 0,
	    slideExpr:'div',
		pager:  '#magazine-nav',
	    pause:1
	});
	$('#travel-panels')
	.cycle({
	    fx:     'cover',
	    speed:  '250',
	    timeout: 0,
	    slideExpr:'div',
		pager:  '#travel-nav',
	    pause:1
	});
	
	/*$('#lifestyle-panels')
	.cycle({
		fx:     'cover',
		speed:  '1000',
		timeout: 0,
		slideExpr:'div',
		pager:  '#lifestyletabs',
		pagerAnchorBuilder: function(idx, slide) {
		// return selector string for existing anchor
		return '#lifestyletabs li:eq(' + idx + ') a';
		}
	});*/

	$('#tickpause').toggle(function() {

                $('#tick').cycle('pause');
                $(this).attr({ src: "images/pause.gif"});

                }, function() {

                $('#tick').cycle('resume', true);
                $(this).attr({ src: "images/play.gif"});
        }); 
        
	/* End of news ticker code */
	

$('#slideintro')
	.cycle({
		fx:     'scrollRight',
		speed:  750,
		timeout: 0,
		cleartype:!$.support.opacity,
		pager:  '#paginator'

});

$('#gohome').click(function(){
$('html, body').animate({scrollTop:0}, 'slow');
return false;
});


/* Home page left widgets */


$('#whatsonwrapper')
.cycle({
fx: 'cover',
speed: '1000',
timeout: 0,
slideExpr:'div.panel',
pager: '#whatsontabs',
pagerAnchorBuilder: function(idx, slide) {
// return selector string for existing anchor
return '#whatsontabs li:eq(' + idx + ') a';
}
});


if ($("#whatsonajaxloader").length > 0) {

	$("#whatsonajaxloader").hide();
}


$("#whatsonajaxajax").live("click",function() {
									
									$("#whatsonloader").hide();
									$("#whatsonajaxloader").show();
									
var theaddress = $(this).attr('href')
$('#whatsonwrapper').load(theaddress,null,function(){
$('#whatsonwrapper')
.cycle({
fx: 'cover',
speed: '1000',
timeout: 0,
slideExpr:'div.panel',
pager: '#whatson',
pagerAnchorBuilder: function(idx, slide) {
return '#whatson li:eq(' + idx + ') a';
}
});
});
return false;
});


$('#dspanelholder')
.cycle({
	fx: 'cover',
	speed: '250',
	timeout: 20000,
	slideExpr:'div.dspanel',
	pager: '#dstorelist',
	pagerAnchorBuilder: function(idx, slide) {
	return '#dstorelist li:eq(' + idx + ') a';
	}
});


/* new eatingout homepage widget */

function initEating(){
var ranNum= Math.floor(Math.random()*5);
$('#eatingtabs li a').eq(ranNum).addClass("activeSlide");
$('#eatingtabs2 li').eq(ranNum).stop().animate({left: "209px"},{queue:false,duration:1500});
$('#eating-panels img').hide();
$('#eating-panels img').eq(ranNum).show();
}

initEating();


$("#eatingtabs li a").hoverIntent(
function () {
var num = $('#eatingtabs li a').index(this);
$('#eatingtabs li a').removeClass("activeSlide");
$('#eatingtabs2 li').stop().animate({left: "0px"},{queue:false,duration:500});
$(this).addClass("activeSlide");
$('#eating-panels img').hide();
$('#eating-panels img').eq(num).show();
$('#eatingtabs2 li').eq(num).stop().animate({left: "209px"},{queue:false,duration:1500});
},
function () {
}
);


function initLifestyle(){
var ranNum= Math.floor(Math.random()*5);
$('#lifestyletabs li a').eq(ranNum).addClass("activeSlide");
$('#lifestyletabs2 li').eq(ranNum).stop().animate({left: "209px"},{queue:false,duration:1500});
$('#lifestyle-panels img').hide();
$('#lifestyle-panels img').eq(ranNum).show();
}

initLifestyle();


$("#lifestyletabs li a").hoverIntent(
function () {
var num = $('#lifestyletabs li a').index(this);
$('#lifestyletabs li a').removeClass("activeSlide");
$('#lifestyletabs2 li').stop().animate({left: "0px"},{queue:false,duration:500});
$(this).addClass("activeSlide");
$('#lifestyle-panels img').hide();
$('#lifestyle-panels img').eq(num).show();
$('#lifestyletabs2 li').eq(num).stop().animate({left: "209px"},{queue:false,duration:1500});
},
function () {
}
);


if ($("#bookingcallheader").length > 0) {
	
	 
			 
			$("#bookingcallheader").click(function (){
														
							 
							$("#bookingcallheader").trigger("click");
						});
			}
			 

 


	
	
	
	/* start popup layers */

	$('.popper').live("click",function(){
	var popname = $(this).attr("data-popname");
	var popwidth = $(this).attr("data-popwidth");
	var popurl = $(this).attr("href");
		$.openPopupLayer({
			name: popname,
			width: popwidth,
			url: popurl,
			screenLockerOpacity:"0.8",
			cache: false,
			success:function(){
				$('#booking-title').corner("cc:#121313 rounded top 7px");
				$('#booking-footer').corner("cc:#121313 rounded bottom 7px");
				$('.ajrounded').corner("rounded 7px");
				$('.buttonised').corner("rounded 7px");
				$('#popupLayer_' + popname + ' a.booking-close').click(function(){
					$.closePopupLayer(popname);
					return false
					});
				}
		});
	return false;
	});
	
	
	
	
	$('.repopped').live("click",function(){
	var popname = $(this).attr("data-popname");
	var popwidth = $(this).attr("data-popwidth");
	var popurl = $(this).attr("href");
		$.openPopupLayer({
			name: popname,
			width: 600,
			url: popurl,
			cache: false,
			success:function(){
				$('.roundedbox').corner("cc:#121313 rounded 7px");
				}
		});
	return false;
	});
	
//popover("second","900","popuptrial2.htm");




 

/*

$('#pop_over').live("click",function(){
									   
									   	//$('#popupLayer_myfirstpopup').load('popuptrial3.html');
											
										popover('mypopover',600,'popuptrial2.html')
																			
											
																			
																			});


*/


/* end popup layers */


/*
	if ($.browser.msie) { 
		$('.mbutton:not(input)').corner("rounded 5px");
	}
	

*/
			
		 
	function reloadThickBoxLinks()
	
	{
		
		if($(".thickbox-click").length >0) 
		 
				{
			  
					$(".thickbox-click").live('click',function(event){
																	 
												event.preventDefault();
												
												//alert("Entered1");												
																								
												var URL =  $(this).attr("thickurl");
												
												tb_show("",URL);												
																					
												tb_init('a.thickbox');
												 
												
														
											});			
				}
			
			
		 
			if($(".thickbox-staticlink").length >0) 
		 
				{
			  
					$(".thickbox-staticlink").live('click',function(event){
																	 
												event.preventDefault();
												
												//alert("Entered2");
												
												var URL =  $(this).attr("thickurl");
												
												tb_show("",URL);									
												
												tb_init('a.thickbox');									 
											 
														
											});			
				}
				
			if($(".thickbox-staticlink-popup").length >0) 
		 
				{
			  
					$(".thickbox-staticlink-popup").live('click',function(event){
																	 
												event.preventDefault();
												
												var hrefURL =  $(this).attr("href");
												
												openpopup('myfirstpopup',900,hrefURL);
																						 	
														
											});			
				}

	}
	
	
	reloadThickBoxLinks();


if($(".bookatablehelp").length >0) 
				 
					{
					
						$(".bookatablehelp").click(function(event){
																		 
															event.preventDefault();
															var obj = new Object();
															
															 var URL =  $(this).attr("href");
															 
															 openpopupurl('popoverhelpbox',600,URL);
															 
															 
															});
														 
						
					}
		
	


});

function openpopup(data_popname,data_popwidth,data_href){
		
			var popname = data_popname;
			var popwidth = data_popwidth;
			var popurl = data_href;
			
				if($(".loadimage").length >0) 
		 
				{
				
				
					$(".loadimage").show();
					
				}
			
						
			$.openPopupLayer({
				name: popname,
				width: popwidth,
				url: popurl,
				screenLockerOpacity:"0.8",
				cache: false,
				success:function(){
					$('#booking-title').corner("cc:#121313 rounded top 7px");
					$('#booking-footer').corner("cc:#121313 rounded bottom 7px");
					$('.ajrounded').corner("rounded 7px");
					$('.buttonised').corner("rounded 7px");
					$('#popupLayer_' + popname + ' a.booking-close').click(function(){
						$.closePopupLayer(popname);
						return false
						});
					}
			});
	}

function reload_pop(theTarget,theURL){
	
	
		/*alert('reload-popup'); */
		
		if($(".loadimage").length >0) 
		 
		{
				
				
					$(".loadimage").show();
					
		}
		
		var modTarget = "#popupLayer_" + theTarget;
		$(modTarget).load(theURL,function(){
		$('#booking-title').corner("cc:#121313 rounded top 7px");
		$('#booking-footer').corner("cc:#121313 rounded bottom 7px");
		$('.ajrounded').corner("rounded 7px");
		$('#popupLayer_' + theTarget + ' a.booking-close').click(function(){
		$.closePopupLayer();
			});
});
}

function popover(popname,popwidth,popurl){
		$.openPopupLayer({
			name: popname,
			width: popwidth,
			url: popurl,
			screenLockerOpacity:"0.8",
			cache: false,
			success:function(){
				$('#booking-title').corner("cc:#121313 rounded top 7px");
				$('#booking-footer').corner("cc:#121313 rounded bottom 7px");
				$('.ajrounded').corner("rounded 7px");
				$('.roundedbox').corner("cc:#121313 rounded 7px");
				$('#popupLayer_' + popname + ' a.booking-close').click(function(){
					$.closePopupLayer(popname);
					return false
					});
				}
		});
	}
	
	
function openpopupdiv(data_popname,data_popwidth,divID){
		
			var popname = data_popname;
			var popwidth = data_popwidth;
			var pDivID = divID;
			
						
			$.openPopupLayer({
				name: popname,
				width: popwidth,
				target: pDivID,
				screenLockerOpacity:"0.8",
				cache: false,
				success:function(){
					$('.msg-title').corner("cc:#121313 rounded top 7px");
					$('.msg-footer').corner("cc:#121313 rounded bottom 7px");
					$('.ajrounded').corner("rounded 7px");
					$('.buttonised').corner("rounded 7px");
					$('#popupLayer_' + popname + ' a.msg-close').click(function(){
						$.closePopupLayer(popname);
						return false
						});
					}
			});
	}
	
function openpopupurl(data_popname,data_popwidth,popurl){
		
			var popname = data_popname;
			var popwidth = data_popwidth;
			var purl = popurl;
			
			 
			
						
			$.openPopupLayer({
				name: popname,
				width: popwidth,
				url: purl,
				screenLockerOpacity:"0.8",
				cache: false,
				success:function(){
					$('.msg-title').corner("cc:#121313 rounded top 7px");
					$('.msg-footer').corner("cc:#121313 rounded bottom 7px");
					$('.ajrounded').corner("rounded 7px");
					$('.buttonised').corner("rounded 7px");
					$('#popupLayer_' + popname + ' a.msg-close').click(function(){
						$.closePopupLayer(popname);
						return false
						});
					}
			});
	}
