/*Simple Slider from http://www.subtledifference.com.au/jquery/slider/*/
function simpleSlide(b,c,d,e,f,g,h){$('.'+d).unbind("mouseover").unbind("mouseout");if(h){$timeUse=h}else{$timeUse=c}$('.'+d).animate({left:b},$timeUse,function(){$('.'+d+' li:last-child').after($('.'+d+' li:first-child').remove());$('.'+d).css({left:0});simpleSlide(b,c,d,e,f,true)});$('.'+d).mouseover(function(){$('.'+d).stop()});$('.'+d).mouseout(function(){var a=(c/(b*-1))*((b-leftCurrent())*-1);simpleSlide(b,c,d,e,f,true,h)});function leftCurrent(){return parseInt($('.'+d).css("left").split('px'))}if(g!==true&&e===true){$('#'+d).after('<div id="sControl"><div class="sWrap"><a href="javascript:void(0);" class="sStart"><span>Start<\/span><\/a><a href="javascript:void(0);" class="sStop"><span>Stop<\/span><\/a><\/div><\/div>');$(".sStart").click(function(){$('.'+d).stop();var a=(c/(b*-1))*((b-leftCurrent())*-1);simpleSlide(b,c,d,e,f,true,h)});$(".sStop").click(function(){$('.'+d).stop()})}if(g!==true&&f===true){$('#'+d).before('<div id="sDisplay"><div class="sDisWrap">&nbsp;<\/div><\/div>')}}
/**
 * Tabs - jQuery plugin for accessible, unobtrusive tabs
 * @requires jQuery v1.0.3
 *
 * http://stilbuero.de/tabs/
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 * Version: 2.7.2
 */

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}('(4(z){z.23({9:{2d:0}});z.1z.9=4(y,x){3(K y==\'2E\')x=y;x=z.23({J:(y&&K y==\'1Y\'&&y>0)?--y:0,12:C,H:z.1d?2h:V,R:V,1p:\'2K&#2D;\',21:\'R-2z-\',1A:C,1x:C,1w:C,1v:C,1u:\'34\',2p:C,2o:C,2m:V,2j:C,19:C,16:C,1g:\'9-1H\',N:\'9-29\',1a:\'9-12\',1b:\'9-26\',1t:\'9-1K\',1C:\'9-2B\',22:\'10\'},x||{});z.7.1j=z.7.1j||z.7.Z&&K 2x==\'4\';4 1y(){1X(0,0)}G 5.Y(4(){2 v=5;2 j=z(\'15.\'+x.1g,v);j=j.X()&&j||z(\'>15:6(0)\',v);2 n=z(\'a\',j);3(x.R){2 w={};n.Y(4(){z(5).2l(\'<I>\'+z(5).2l()+\'</I>\');2 a=x.21+(++z.9.2d);2 b=\'#\'+a;w[b]=5.1O;5.1O=b;z(\'<10 W="\'+a+\'" 31="\'+x.1b+\'"></10>\').2g(v)})}2 u=z(\'10.\'+x.1b,v);u=u.X()&&u||z(\'>\'+x.22,v);j.P(\'.\'+x.1g)||j.O(x.1g);u.Y(4(){2 a=z(5);a.P(\'.\'+x.1b)||a.O(x.1b)});2 p=z(\'8\',j).2b(z(\'8.\'+x.N,j)[0]);3(p>=0){x.J=p}3(1c.B){n.Y(4(a){3(5.B==1c.B){x.J=a;3((z.7.Z||z.7.2T)&&!x.R){2 b=z(1c.B);2 c=b.17(\'W\');b.17(\'W\',\'\');1n(4(){b.17(\'W\',c)},2O)}1y();G V}})}3(z.7.Z){1y()}u.18(\':6(\'+x.J+\')\').1F().1o().2I(\':6(\'+x.J+\')\').O(x.1t);3(!x.R){z(\'8\',j).1f(x.N).6(x.J).O(x.N)}3(x.2m){2 t=4(e){2 b=z.2C(u.1l(),4(a){2 h,1B=z(a);3(e){3(z.7.1j){a.11.2A(\'20\');a.11.E=\'\';a.1k=C}h=1B.S({\'1q-E\':\'\'}).E()}D{h=1B.E()}G h}).2y(4(c,d){G d-c});3(z.7.1j){u.Y(4(){5.1k=b[0]+\'1Z\';5.11.2w(\'20\',\'5.11.E = 5.1k ? 5.1k : "2v"\')})}D{u.S({\'1q-E\':b[0]+\'1Z\'})}};t();2 r=v.1W;2 l=v.1h;2 q=z(\'#9-1V-1U-X\').1l(0)||z(\'<I W="9-1V-1U-X">M</I>\').S({1T:\'2u\',2t:\'2s\',2r:\'2q\'}).2g(T.1S).1l(0);2 s=q.1h;32(4(){2 b=v.1W;2 a=v.1h;2 c=q.1h;3(a>l||b!=r||c!=s){t((b>r||c<s));r=b;l=a;s=c}},1R)}2 m={},14={},1Q=x.2p||x.1u,1P=x.2o||x.1u;3(x.1x||x.1A){3(x.1x){m[\'E\']=\'1F\';14[\'E\']=\'1K\'}3(x.1A){m[\'L\']=\'1F\';14[\'L\']=\'1K\'}}D{3(x.1w){m=x.1w}D{m[\'1q-2n\']=0;1Q=x.H?1R:1}3(x.1v){14=x.1v}D{14[\'1q-2n\']=0;1P=x.H?1R:1}}2 o=x.2j,19=x.19,16=x.16;n.1s(\'2k\',4(){2 c=z(5).1e(\'8:6(0)\');3(v.1r||c.P(\'.\'+x.N)||c.P(\'.\'+x.1a)){G V}2 a=5.B;3(z.7.Z){z(5).U(\'13\');3(x.H){z.1d.1N(a);1c.B=a.1M(\'#\',\'\')}}D 3(z.7.1L){2 b=z(\'<2i 30="\'+a+\'"><10><2Z 2X="2f" 2W="h" /></10></2i>\').1l(0);b.2f();z(5).U(\'13\');3(x.H){z.1d.1N(a)}}D{3(x.H){1c.B=a.1M(\'#\',\'\')}D{z(5).U(\'13\')}}});n.1s(\'1J\',4(){2 a=z(5).1e(\'8:6(0)\');3(z.7.1L){a.1i({L:0},1,4(){a.S({L:\'\'})})}a.O(x.1a)});3(x.12&&x.12.1I){2e(2 i=0,k=x.12.1I;i<k;i++){n.6(--x.12[i]).U(\'1J\').1o()}};n.1s(\'2c\',4(){2 a=z(5).1e(\'8:6(0)\');a.1f(x.1a);3(z.7.1L){a.1i({L:1},1,4(){a.S({L:\'\'})})}});n.1s(\'13\',4(b){2 g=b.2V;2 e=5,8=z(5).1e(\'8:6(0)\'),F=z(5.B),Q=u.18(\':2U\');3(v.1r||8.P(\'.\'+x.N)||8.P(\'.\'+x.1a)||K o==\'4\'&&o(5,F[0],Q[0])===V){5.2a();G V}v[\'1r\']=2h;3(F.X()){3(z.7.Z&&x.H){2 d=5.B.1M(\'#\',\'\');F.17(\'W\',\'\');1n(4(){F.17(\'W\',d)},0)}4 1G(){3(x.H&&g){z.1d.1N(e.B)}Q.1i(14,1P,4(){z(e).1e(\'8:6(0)\').O(x.N).2S().1f(x.N);3(K 19==\'4\'){19(e,F[0],Q[0])}Q.O(x.1t).S({1T:\'\',28:\'\',E:\'\',L:\'\'});F.1f(x.1t).1i(m,1Q,4(){F.S({28:\'\',E:\'\',L:\'\'});3(z.7.Z){Q[0].11.18=\'\';F[0].11.18=\'\'}3(K 16==\'4\'){16(e,F[0],Q[0])}v[\'1r\']=C})})}3(!x.R){1G()}D{2 f=z(5),I=z(\'I\',5)[0],27=I.1E;f.O(x.1C);3(x.1p){I.1E=x.1p}1n(4(){z(e.B).2R(w[e.B],4(){1G();3(x.1p){I.1E=27}f.1f(x.1C)})},0)}}D{2Q(\'2P P 2N 2M 26.\')}2 a=1D.2L||T.1m&&T.1m.25||T.1S.25||0;2 c=1D.2J||T.1m&&T.1m.24||T.1S.24||0;1n(4(){1D.1X(a,c)},0);5.2a();G x.H&&!!g});3(x.R){n.6(x.J).U(\'13\').1o()}3(x.H){z.1d.2Y(4(){n.6(x.J).U(\'13\').1o()})}})};2 A=[\'2k\',\'1J\',\'2c\'];2e(2 i=0;i<A.1I;i++){z.1z[A[i]]=(4(d){G 4(c){G 5.Y(4(){2 b=z(\'15.9-1H\',5);b=b.X()&&b||z(\'>15:6(0)\',5);2 a;3(!c||K c==\'1Y\'){a=z(\'8 a\',b).6((c&&c>0&&c-1||0))}D 3(K c==\'2H\'){a=z(\'8 a[@1O$="#\'+c+\'"]\',b)}a.U(d)})}})(A[i])}z.1z.2G=4(){2 c=[];5.Y(4(){2 a=z(\'15.9-1H\',5);a=a.X()&&a||z(\'>15:6(0)\',5);2 b=z(\'8\',a);c.2F(b.2b(b.18(\'.9-29\')[0])+1)});G c[0]}})(33);',62,191,'||var|if|function|this|eq|browser|li|tabs||||||||||||||||||||||||||||hash|null|else|height|toShow|return|bookmarkable|span|initial|typeof|opacity||selectedClass|addClass|is|toHide|remote|css|document|trigger|false|id|size|each|msie|div|style|disabled|click|hideAnim|ul|onShow|attr|filter|onHide|disabledClass|containerClass|location|ajaxHistory|parents|removeClass|navClass|offsetHeight|animate|msie6|minHeight|get|documentElement|setTimeout|end|spinner|min|locked|bind|hideClass|fxSpeed|fxHide|fxShow|fxSlide|unFocus|fn|fxFade|jq|loadingClass|window|innerHTML|show|switchTab|nav|length|disableTab|hide|safari|replace|update|href|hideSpeed|showSpeed|50|body|display|font|watch|offsetWidth|scrollTo|number|px|behaviour|hashPrefix|tabStruct|extend|scrollTop|scrollLeft|container|text|overflow|selected|blur|index|enableTab|remoteCount|for|submit|appendTo|true|form|onClick|triggerTab|html|fxAutoHeight|width|fxHideSpeed|fxShowSpeed|hidden|visibility|absolute|position|block|1px|setExpression|XMLHttpRequest|sort|tab|removeExpression|loading|map|8230|object|push|activeTab|string|not|pageYOffset|Loading|pageXOffset|such|no|500|There|alert|load|siblings|opera|visible|clientX|value|type|initialize|input|action|class|setInterval|jQuery|normal'.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 = "/template-images/js/loadingAnimation.gif";
/*changed iframe src to add src='/e.htm' as a real file with no data in it which avoids the SSL issue in IE6*/

/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/
//on page load call tb_init
$(document).ready(function(){
	tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
	imgLoader = new Image();// preload image
	imgLoader.src = tb_pathToImage;
});

//add thickbox to href & area elements that have a class of .thickbox
function tb_init(domChunk){
	$(domChunk).click(function(){
	var t = this.title || this.name || null;
	var a = this.href || this.alt;
	var g = this.rel || false;
	tb_show(t,a,g);
	this.blur();
	return false;
	});
}

function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link

	try {
		if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
			$("body","html").css({height: "100%", width: "100%"});
			$("html").css("overflow","hidden");
			if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
				$("body").append("<iframe id='TB_HideSelect' src='/e.htm'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
				$("#TB_overlay").click(tb_remove);
			}
		}else{//all others
			if(document.getElementById("TB_overlay") === null){
				$("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
				$("#TB_overlay").click(tb_remove);
			}
		}

		if(tb_detectMacXFF()){
			$("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
		}else{
			$("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
		}

		if(caption===null){caption="";}
		$("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page
		$('#TB_load').show();//show loader

		var baseURL;
	   if(url.indexOf("?")!==-1){ //ff there is a query string involved
			baseURL = url.substr(0, url.indexOf("?"));
	   }else{
	   		baseURL = url;
	   }

	   var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
	   var urlType = baseURL.toLowerCase().match(urlString);

		if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images

			TB_PrevCaption = "";
			TB_PrevURL = "";
			TB_PrevHTML = "";
			TB_NextCaption = "";
			TB_NextURL = "";
			TB_NextHTML = "";
			TB_imageCount = "";
			TB_FoundURL = false;
			if(imageGroup){
				TB_TempArray = $("a[@rel="+imageGroup+"]").get();
				for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
					var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
						if (!(TB_TempArray[TB_Counter].href == url)) {
							if (TB_FoundURL) {
								TB_NextCaption = TB_TempArray[TB_Counter].title;
								TB_NextURL = TB_TempArray[TB_Counter].href;
								TB_NextHTML = "<span id='TB_next'>&nbsp;&nbsp;<a href='#'>Next &gt;</a></span>";
							} else {
								TB_PrevCaption = TB_TempArray[TB_Counter].title;
								TB_PrevURL = TB_TempArray[TB_Counter].href;
								TB_PrevHTML = "<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>&lt; Prev</a></span>";
							}
						} else {
							TB_FoundURL = true;
							TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length);
						}
				}
			}

			imgPreloader = new Image();
			imgPreloader.onload = function(){
			imgPreloader.onload = null;

			// Resizing large images - orginal by Christian Montoya edited by me.
			var pagesize = tb_getPageSize();
			var x = pagesize[0] - 150;
			var y = pagesize[1] - 150;
			var imageWidth = imgPreloader.width;
			var imageHeight = imgPreloader.height;
			if (imageWidth > x) {
				imageHeight = imageHeight * (x / imageWidth);
				imageWidth = x;
				if (imageHeight > y) {
					imageWidth = imageWidth * (y / imageHeight);
					imageHeight = y;
				}
			} else if (imageHeight > y) {
				imageWidth = imageWidth * (y / imageHeight);
				imageHeight = y;
				if (imageWidth > x) {
					imageHeight = imageHeight * (x / imageWidth);
					imageWidth = x;
				}
			}
			// End Resizing

			TB_WIDTH = imageWidth + 30;
			TB_HEIGHT = imageHeight + 60;
			$("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div>");

			$("#TB_closeWindowButton").click(tb_remove);

			if (!(TB_PrevHTML === "")) {
				function goPrev(){
					if($(document).unbind("click",goPrev)){$(document).unbind("click",goPrev);}
					$("#TB_window").remove();
					$("body").append("<div id='TB_window'></div>");
					tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
					return false;
				}
				$("#TB_prev").click(goPrev);
			}

			if (!(TB_NextHTML === "")) {
				function goNext(){
					$("#TB_window").remove();
					$("body").append("<div id='TB_window'></div>");
					tb_show(TB_NextCaption, TB_NextURL, imageGroup);
					return false;
				}
				$("#TB_next").click(goNext);

			}

			document.onkeydown = function(e){
				if (e == null) { // ie
					keycode = event.keyCode;
				} else { // mozilla
					keycode = e.which;
				}
				if(keycode == 27){ // close
					tb_remove();
				} else if(keycode == 190){ // display previous image
					if(!(TB_NextHTML == "")){
						document.onkeydown = "";
						goNext();
					}
				} else if(keycode == 188){ // display next image
					if(!(TB_PrevHTML == "")){
						document.onkeydown = "";
						goPrev();
					}
				}
			};

			tb_position();
			$("#TB_load").remove();
			$("#TB_ImageOff").click(tb_remove);
			$("#TB_window").css({display:"block"}); //for safari using css instead of show
			};

			imgPreloader.src = url;
		}else{//code to show html

			var queryString = url.replace(/^[^\?]+\??/,'');
			var params = tb_parseQuery( queryString );

			TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL
			TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL
			ajaxContentW = TB_WIDTH - 30;
			ajaxContentH = TB_HEIGHT - 45;

			if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window
					urlNoQuery = url.split('TB_');
					$("#TB_iframeContent").remove();
					if(params['modal'] != "true"){//iframe no modal
						$("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>");
					}else{//iframe modal
					$("#TB_overlay").unbind();
						$("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;'> </iframe>");
					}
			}else{// not an iframe, ajax
					if($("#TB_window").css("display") != "block"){
						if(params['modal'] != "true"){//ajax no modal
						$("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>close</a> or Esc Key</div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>");
						}else{//ajax modal
						$("#TB_overlay").unbind();
						$("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");
						}
					}else{//this means the window is already up, we are just loading new content via ajax
						$("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";
						$("#TB_ajaxContent")[0].style.height = ajaxContentH +"px";
						$("#TB_ajaxContent")[0].scrollTop = 0;
						$("#TB_ajaxWindowTitle").html(caption);
					}
			}

			$("#TB_closeWindowButton").click(tb_remove);

				if(url.indexOf('TB_inline') != -1){
					$("#TB_ajaxContent").append($('#' + params['inlineId']).children());
					$("#TB_window").unload(function () {
						$('#' + params['inlineId']).append( $("#TB_ajaxContent").children() ); // move elements back when you're finished
					});
					tb_position();
					$("#TB_load").remove();
					$("#TB_window").css({display:"block"});
				}else if(url.indexOf('TB_iframe') != -1){
					tb_position();
					//if($.browser.safari){//safari needs help because it will not fire iframe onload
						$("#TB_load").remove();
						$("#TB_window").css({display:"block"});
					//}
				}else{
					$("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method
						tb_position();
						$("#TB_load").remove();
						tb_init("#TB_ajaxContent a.thickbox");
						$("#TB_window").css({display:"block"});
					});
				}

		}

		if(!params['modal']){
			document.onkeyup = function(e){
				if (e == null) { // ie
					keycode = event.keyCode;
				} else { // mozilla
					keycode = e.which;
				}
				if(keycode == 27){ // close
					tb_remove();
				}
			};
		}

	} catch(e) {
		//nothing here
	}
}

//helper functions below
function tb_showIframe(){
	$("#TB_load").remove();
	$("#TB_window").css({display:"block"});
}

function tb_remove() {
 	$("#TB_imageOff").unbind("click");
	$("#TB_closeWindowButton").unbind("click");
	$("#TB_window").fadeOut("fast",function(){$('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();});
	$("#TB_load").remove();
	if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
		$("body","html").css({height: "auto", width: "auto"});
		$("html").css("overflow","");
	}
	document.onkeydown = "";
	document.onkeyup = "";
	return false;
}

function tb_position() {
$("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
	if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
		$("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
	}
}

function tb_parseQuery ( query ) {
   var Params = {};
   if ( ! query ) {return Params;}// return empty object
   var Pairs = query.split(/[;&]/);
   for ( var i = 0; i < Pairs.length; i++ ) {
      var KeyVal = Pairs[i].split('=');
      if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
      var key = unescape( KeyVal[0] );
      var val = unescape( KeyVal[1] );
      val = val.replace(/\+/g, ' ');
      Params[key] = val;
   }
   return Params;
}

function tb_getPageSize(){
	var de = document.documentElement;
	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
	var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
	arrayPageSize = [w,h];
	return arrayPageSize;
}

function tb_detectMacXFF() {
  var userAgent = navigator.userAgent.toLowerCase();
  if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
    return true;
  }
}


/*
 * Date picker plugin for jQuery
 * http://kelvinluck.com/assets/jquery/datePicker
 *
 * Copyright (c) 2006 Kelvin Luck (kelvinluck.com)
 * Licensed under the MIT License:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * $LastChangedDate: 2007-04-12 10:01:01 +0100 (Thu, 12 Apr 2007) $
 * $Rev: 1672 $
 */

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}('8.E=f(){9(1v.23==M){1v.23={3X:f(){}}}4 X=[\'3q\',\'3j\',\'3b\',\'32\',\'45\',\'43\',\'3W\',\'3T\',\'3Q\',\'3M\',\'3E\',\'3x\'];4 1p=[\'3n\',\'3i\',\'3d\',\'3a\',\'35\',\'31\',\'2X\'];4 W={p:\'42\',n:\'3V\',c:\'3S\',b:\'3P 1d\'};4 1h=\'1R\';4 x="/";4 1f=C;4 N;4 G;4 H;4 S;4 A;4 1P=f(2k){4 s=\'0\'+2k;h s.38(s.1C-2)};4 19=f(P){2H(1h){O\'2R\':r=P.1l(x);h t v(r[0],Q(r[1])-1,r[2]);O\'1R\':r=P.1l(x);h t v(r[2],Q(r[1])-1,Q(r[0]));O\'2L\':r=P.1l(x);1N(4 m=0;m<12;m++){9(r[1].1j()==X[m].1J(0,3).1j()){h t v(Q(r[2]),m,Q(r[0]))}}h M;O\'2v\':2D:4 1G=1G?1G:[2,1,0];r=P.1l(x);h t v(r[2],Q(r[0])-1,Q(r[1]))}};4 1F=f(d){4 18=d.g();4 1g=1P(d.k()+1);4 1b=1P(d.14());2H(1h){O\'2R\':h 18+x+1g+x+1b;O\'1R\':h 1b+x+1g+x+18;O\'2L\':h 1b+x+X[d.k()].1J(0,3)+x+18;O\'2v\':2D:h 1g+x+1b+x+18}};4 Y=f(P){4 U=t v();9(P==M){d=t v(U.g(),U.k(),1)}I{d=P;d.2i(1)}9((d.k()<G.k()&&d.g()==G.g())||d.g()<G.g()){d=t v(G.g(),G.k(),1)}I 9((d.k()>H.k()&&d.g()==H.g())||d.g()>H.g()){d=t v(H.g(),H.k(),1)}4 R=8("<j></j>").q(\'u\',\'B-D\');4 1q=17;4 2b=G.14();4 1s=\'\';9(!(d.k()==G.k()&&d.g()==G.g())){1q=C;4 2d=d.k()==0?t v(d.g()-1,11,1):t v(d.g(),d.k()-1,1);4 2c=8("<a></a>").q(\'13\',\'Z:;\').J(W.p).1a(f(){8.E.1S(2d,l);h C});1s=8("<j></j>").q(\'u\',\'1o-37\').J(\'&36;\').o(2c)}4 1B=17;4 1Z=H.14();1H=\'\';9(!(d.k()==H.k()&&d.g()==H.g())){1B=C;4 1X=t v(d.g(),d.k()+1,1);4 1V=8("<a></a>").q(\'13\',\'Z:;\').J(W.n).1a(f(){8.E.1S(1X,l);h C});1H=8("<j></j>").q(\'u\',\'1o-30\').J(\'&2Y;\').2W(1V)}4 1U=8("<a></a>").q(\'13\',\'Z:;\').J(W.c).1a(f(){8.E.2O()});R.o(8("<j></j>").q(\'u\',\'1o-2S\').o(1U),8("<2Q></2Q>").J(X[d.k()]+\' \'+d.g()));4 1T=8("<1n></1n>");1N(4 i=N;i<N+7;i++){4 L=i%7;4 1k=1p[L];1T.o(8("<2P></2P>").q({\'41\':\'40\',\'3Z\':1k,\'1Q\':1k,\'u\':(L==0||L==6?\'2M\':\'L\')}).J(1k.1J(0,1)))}4 1O=8("<2K></2K>");4 2G=(t v(d.g(),d.k()+1,0)).14();4 y=N-d.3U();9(y>0)y-=7;4 2F=(t v()).14();4 2B=d.k()==U.k()&&d.g()==U.g();4 w=0;2z(w++<6){4 1K=8("<1n></1n>");1N(4 i=0;i<7;i++){4 L=(N+i)%7;4 16={\'u\':(L==0||L==6?\'2M \':\'L \')};9(y<0||y>=2G){V=\' \'}I 9(1q&&y<2b-1){V=y+1;16[\'u\']+=\'2x\'}I 9(1B&&y>1Z-1){V=y+1;16[\'u\']+=\'2x\'}I{d.2i(y+1);4 1I=1F(d);V=8("<a></a>").q({\'13\':\'Z:;\',\'2A\':1I}).J(y+1).1a(f(e){8.E.2C(8.q(l,\'2A\'),l);h C})[0];9(S&&S==1I){8(V).q(\'u\',\'3R\')}}9(2B&&y+1==2F){16[\'u\']+=\'U\'}1K.o(8("<2t></2t>").q(16).o(V));y++}1O.o(1K)}R.o(8("<2s></2s>").q(\'3O\',2).o("<1L></1L>").2q("1L").o(1T).1M().o(1O.3N())).o(1s).o(1H);9(8.2p.2o){4 1D=[\'<1D u="3L" 3K="-1" 3J="3I.J" \',\'3F="1x:2m; 3D:3C;\',\'3B: 0;\',\'3A:0;\',\'z-3z:-1; 3y:3w(3v=\\\'0\\\');\',\'3u:2h;\',\'3t:2h"/>\'].3s(\'\');R.o(1y.3r(1D))}R.2g({\'1x\':\'2m\'});h R[0]};4 10=f(c){8(\'j.B-D a\',A[0]).1w();8(\'j.B-D\',A[0]).2f();8(\'j.B-D\',A[0]).3p();A.o(c)};4 T=f(){8(\'j.B-D a\',A).1w();8(\'j.B-D\',A).2f();8(\'j.B-D\',A).2g({\'1x\':\'3o\'});8(1y).1w(\'2e\',1u);3m A;A=3l};4 3k=f(e){4 2a=e.29?e.29:(e.28?e.28:0);9(2a==27){T()}h C};4 1u=f(e){9(!1f){4 1t=8.2p.2o?1v.3h.3g:e.1t;4 26=8(1t).1m(\'j.B-D-1r\');9(26.3f(0).3e!=\'1d-1e-25\'){T()}}};h{24:f(){h W.b},2j:f(){9(A){T()}l.3c();4 F=8(\'F\',8(l).1m(\'F\')[0])[0];G=F.1A;H=F.15;N=F.N;A=8(l).1M().2q(\'>j.B-D-1r\');4 d=8(F).22();9(d!=\'\'){9(1F(19(d))==d){S=d;10(Y(19(d)))}I{S=C;10(Y())}}I{S=C;10(Y())}8(1y).2l(\'2e\',1u)},1S:f(d,e){1f=17;10(Y(d));1f=C},2C:f(d,K){39=d;4 $1z=8(\'F\',8(K).1m(\'F\')[0]);$1z.22(d);$1z.3G(\'3H\');T(K)},2O:f(){T(l)},2u:f(i){i.21=17},2n:f(i){h i.21!=M},34:f(20,1E){1h=20.1j();x=1E?1E:"/"},33:f(1Y,2r,1W){1p=1Y;X=2r;W=1W},2J:f(i,w){9(w==M)w={};9(w.2y==M){i.1A=t v()}I{i.1A=19(w.2y)}9(w.2w==M){i.15=t v();i.15.2Z(i.15.g()+5)}I{i.15=19(w.2w)};i.N=w.2I==M?0:w.2I}}}();8.2E.1m=f(s){4 K=l;2z(17){9(8(s,K[0]).1C>0){h(K)}K=K.1M();9(K[0].1C==0){h C}}};8.2E.E=f(a){l.2V(f(){9(l.3Y.1j()!=\'F\')h;8.E.2J(l,a);9(!8.E.2n(l)){4 1i=8.E.24();4 1c;9(a&&a.2U){1c=8(l).q(\'1Q\',1i).2T(\'1d-1e\')}I{1c=8("<a></a>").q({\'13\':\'Z:;\',\'u\':\'1d-1e\',\'1Q\':1i}).o("<2N>"+1i+"</2N>")}8(l).44(\'<j u="1d-1e-25"></j>\').46(8(\'<j></j>\').q(\'u\',\'B-D-1r\').o(8("<j></j>").q({\'u\':\'B-D\'})),1c);1c.2l(\'1a\',8.E.2j);8.E.2u(l)}});h l};',62,255,'||||var||||jQuery|if||||||function|getFullYear|return||div|getMonth|this|||append||attr|dParts||new|class|Date||dateSeparator|curDay||_openCal|popup|false|calendar|datePicker|input|_firstDate|_lastDate|else|html|ele|weekday|undefined|_firstDayOfWeek|case|dIn|Number|jCalDiv|_selectedDate|_closeDatePicker|today|dayStr|navLinks|months|_getCalendarDiv|javascript|_draw|||href|getDate|_endDate|atts|true|dY|_strToDate|click|dD|calBut|date|picker|_drawingMonth|dM|dateFormat|chooseDate|toLowerCase|day|split|findClosestParent|tr|link|days|firstMonth|wrapper|prevLinkDiv|target|_checkMouse|window|unbind|display|document|theInput|_startDate|finalMonth|length|iframe|separator|_dateToStr|parts|nextLinkDiv|dStr|substr|thisRow|thead|parent|for|tBody|_zeroPad|title|dmy|changeMonth|headRow|closeLink|nextLink|aNavLinks|nextMonth|aDays|lastDate|format|_inited|val|console|getChooseDateStr|holder|cp||which|keyCode|key|firstDate|prevLink|lastMonth|mousedown|empty|css|3000px|setDate|show|num|bind|block|isInited|msie|browser|find|aMonths|table|td|setInited|mdy|endDate|inactive|startDate|while|rel|thisMonth|selectDate|default|fn|todayDate|lastDay|switch|firstDayOfWeek|setDateWindow|tbody|dmmy|weekend|span|closeCalendar|th|h3|ymd|close|addClass|inputClick|each|prepend|Saturday|gt|setFullYear|next|Friday|April|setLanguageStrings|setDateFormat|Thursday|lt|prev|substring|selectedDate|Wednesday|March|blur|Tuesday|className|get|srcElement|event|Monday|February|_handleKeys|null|delete|Sunday|none|remove|January|createElement|join|height|width|Opacity|Alpha|December|filter|index|left|top|absolute|position|November|style|trigger|change|blank|src|tabindex|bgiframe|October|children|cellspacing|Choose|September|selected|Close|August|getDay|Next|July|log|nodeName|abbr|col|scope|Prev|June|wrap|May|after'.split('|'),0,{}))

/*
 * jQuery EasIng v1.1.2 - http://gsgd.co.uk/sandbox/jquery.easIng.php
 *
 * Uses the built In easIng capabilities added In jQuery 1.1
 * to offer multiple easIng options
 *
 * Copyright (c) 2007 George Smith
 * Licensed under the MIT License:
 *   http://www.opensource.org/licenses/mit-license.php
 */

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}('l.K(l.q,{U:9(x,t,b,c,d){6 c*(t/=d)*t+b},T:9(x,t,b,c,d){6-c*(t/=d)*(t-2)+b},S:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t+b;6-c/2*((--t)*(t-2)-1)+b},Q:9(x,t,b,c,d){6 c*(t/=d)*t*t+b},L:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t+1)+b},P:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t+b;6 c/2*((t-=2)*t*t+2)+b},O:9(x,t,b,c,d){6 c*(t/=d)*t*t*t+b},N:9(x,t,b,c,d){6-c*((t=t/d-1)*t*t*t-1)+b},V:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t+b;6-c/2*((t-=2)*t*t*t-2)+b},R:9(x,t,b,c,d){6 c*(t/=d)*t*t*t*t+b},W:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t*t*t+1)+b},Y:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t*t+b;6 c/2*((t-=2)*t*t*t*t+2)+b},17:9(x,t,b,c,d){6-c*8.y(t/d*(8.g/2))+c+b},16:9(x,t,b,c,d){6 c*8.m(t/d*(8.g/2))+b},15:9(x,t,b,c,d){6-c/2*(8.y(8.g*t/d)-1)+b},13:9(x,t,b,c,d){6(t==0)?b:c*8.h(2,10*(t/d-1))+b},X:9(x,t,b,c,d){6(t==d)?b+c:c*(-8.h(2,-10*t/d)+1)+b},12:9(x,t,b,c,d){e(t==0)6 b;e(t==d)6 b+c;e((t/=d/2)<1)6 c/2*8.h(2,10*(t-1))+b;6 c/2*(-8.h(2,-10*--t)+2)+b},11:9(x,t,b,c,d){6-c*(8.o(1-(t/=d)*t)-1)+b},Z:9(x,t,b,c,d){6 c*8.o(1-(t=t/d-1)*t)+b},M:9(x,t,b,c,d){e((t/=d/2)<1)6-c/2*(8.o(1-t*t)-1)+b;6 c/2*(8.o(1-(t-=2)*t)+1)+b},14:9(x,t,b,c,d){f s=1.k;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.r(c)){a=c;f s=p/4}j f s=p/(2*8.g)*8.u(c/a);6-(a*8.h(2,10*(t-=1))*8.m((t*d-s)*(2*8.g)/p))+b},D:9(x,t,b,c,d){f s=1.k;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.r(c)){a=c;f s=p/4}j f s=p/(2*8.g)*8.u(c/a);6 a*8.h(2,-10*t)*8.m((t*d-s)*(2*8.g)/p)+c+b},F:9(x,t,b,c,d){f s=1.k;f p=0;f a=c;e(t==0)6 b;e((t/=d/2)==2)6 b+c;e(!p)p=d*(.3*1.5);e(a<8.r(c)){a=c;f s=p/4}j f s=p/(2*8.g)*8.u(c/a);e(t<1)6-.5*(a*8.h(2,10*(t-=1))*8.m((t*d-s)*(2*8.g)/p))+b;6 a*8.h(2,-10*(t-=1))*8.m((t*d-s)*(2*8.g)/p)*.5+c+b},H:9(x,t,b,c,d,s){e(s==w)s=1.k;6 c*(t/=d)*t*((s+1)*t-s)+b},I:9(x,t,b,c,d,s){e(s==w)s=1.k;6 c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},J:9(x,t,b,c,d,s){e(s==w)s=1.k;e((t/=d/2)<1)6 c/2*(t*t*(((s*=(1.z))+1)*t-s))+b;6 c/2*((t-=2)*t*(((s*=(1.z))+1)*t+s)+2)+b},A:9(x,t,b,c,d){6 c-l.q.v(x,d-t,0,c,d)+b},v:9(x,t,b,c,d){e((t/=d)<(1/2.i)){6 c*(7.n*t*t)+b}j e(t<(2/2.i)){6 c*(7.n*(t-=(1.5/2.i))*t+.i)+b}j e(t<(2.5/2.i)){6 c*(7.n*(t-=(2.G/2.i))*t+.C)+b}j{6 c*(7.n*(t-=(2.E/2.i))*t+.B)+b}},18:9(x,t,b,c,d){e(t<d/2)6 l.q.A(x,t*2,0,c,d)*.5+b;6 l.q.v(x,t*2-d,0,c,d)*.5+c*.5+b}});',62,71,'||||||return||Math|function|||||if|var|PI|pow|75|else|70158|jQuery|sin|5625|sqrt||easing|abs|||asin|easeOutBounce|undefined||cos|525|easeInBounce|984375|9375|easeOutElastic|625|easeInOutElastic|25|easeInBack|easeOutBack|easeInOutBack|extend|easeOutCubic|easeInOutCirc|easeOutQuart|easeInQuart|easeInOutCubic|easeInCubic|easeInQuint|easeInOutQuad|easeOutQuad|easeInQuad|easeInOutQuart|easeOutQuint|easeOutExpo|easeInOutQuint|easeOutCirc||easeInCirc|easeInOutExpo|easeInExpo|easeInElastic|easeInOutSine|easeOutSine|easeInSine|easeInOutBounce'.split('|'),0,{}))


/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * Create a cookie with the given name and value and other optional parameters.
 *
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * @desc Create a cookie with all available options.
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.
 * @example $.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * @param String name The name of the cookie.
 * @param String value The value of the cookie.
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * @type undefined
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

/**
 * Get the value of a cookie with the given name.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};



/**
 * Copyright (c) 2008 Stephen Neate (http://jquerystuff.net/)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Ref: jquery.visitorBC.js  - 30 April 2008
 **/

/* class .vcount if found in your panel or on page will display the number of visits by that viewer */

// this function included to make testing easier to reset the cookie
jQuery(function(){ jQuery(".resetVisitor").bind("click", function(){ jQuery(this).visitorBC({vtype:"reset"}); }); });

jQuery.fn.visitorBC = function( settings ) {
	var settings = jQuery.extend({
		vvalue:this,								// visitor panel definition
		vtype:'static',							// visitor panel can be static (in page), fly (fly in) or catfish (bottom of page)
		vtime: 1250,								// speed of activation in milli seconds for panel animation
		vdelay: 750,								// delay in milli seconds before visitor panel activated (not active for Static Panel
		vtop: 100,									// pixels from top for top left edge of visitor panel
		vleft: 100,									// pixels from left for top left edge of visitor panel
		vease:"easeInOutElastic",		// easing method
		vauto:false,								// auto close item based on seconds
		vfocus:false,								// t/f on force cursor focus to visitor element ??
		vcname:'vbc',								// default cookie name
		vcpath:'/',									// default cookie path
		vexpiry:60,									// number of days the cookie lasts for if not deleted
		vmax:9999,									// max visits before before inline panel is not shown (set as 9999 to make unlimited by default)
		vheight:110									// height of catfish panel
		},
		settings ? settings : {});

		// footer based content wrapper
		if( jQuery("#vbcWrapper").is('*') === false ){
			jQuery("body").append('<div id="vbcWrapper"></div>');
		}


		vcookie('visit');

		// cookie settings for visitor plugin
		function vcookie(noShow){
			if(jQuery.cookie(settings.vcname)!=null&&noShow=='visit'){

			// make sure we only count one hit per visitor call
				if( jQuery("#cookieBaseCount").is('*') === false ){
					jQuery("body").append('<input type="hidden" value="0" id="cookieBaseCount"/>');
						ckVal = jQuery.cookie(settings.vcname).split("|");
						ttlVisits = (parseInt(ckVal[0])+1);
						ckVal = ttlVisits+'|'+ckVal[1]+'|'+ckVal[2];
						jQuery.cookie(settings.vcname, ckVal, { expires: settings.vexpiry, path: settings.vcpath });
				}

			}else if(jQuery.cookie(settings.vcname)!=null&&noShow=='noShow'){
				ckVal = jQuery.cookie(settings.vcname).split("|");
				neverView = 1;
				ckVal = ckVal[0]+'|'+neverView+'|'+ckVal[2];
				jQuery.cookie(settings.vcname, ckVal, { expires: settings.vexpiry, path: settings.vcpath });

			}else if(jQuery.cookie(settings.vcname)!=null&&noShow=='noShowCat'){
				ckVal = jQuery.cookie(settings.vcname).split("|");
				neverViewCats = 1;
				ckVal = ckVal[0]+'|'+ckVal[1]+'|'+neverViewCats;
				jQuery.cookie(settings.vcname, ckVal, { expires: settings.vexpiry, path: settings.vcpath });

			}else if(jQuery.cookie(settings.vcname)!=null&&noShow=='count'){
				ckVal = jQuery.cookie(settings.vcname).split("|");
				ckVal = ckVal[0]+'|'+ckVal[1]+'|'+ckVal[2];

			}else if(jQuery.cookie(settings.vcname)!=null&&noShow=='activeFly'){
				ckVal = jQuery.cookie(settings.vcname).split("|");
				ckVal = ckVal[0]+'|1|'+ckVal[2];
				jQuery.cookie(settings.vcname, ckVal, { expires: settings.vexpiry, path: settings.vcpath });

			}else if(jQuery.cookie(settings.vcname)!=null&&noShow=='activeCat'){
				ckVal = jQuery.cookie(settings.vcname).split("|");
				ckVal = ckVal[0]+'|'+ckVal[1]+'|1';
				jQuery.cookie(settings.vcname, ckVal, { expires: settings.vexpiry, path: settings.vcpath });

			}else if(jQuery.cookie(settings.vcname)!=null&&noShow=='reset'){
				ckVal = '0|0|0';
				jQuery.cookie(settings.vcname, ckVal, { expires: settings.vexpiry, path: settings.vcpath });
				alert("visitor based content cookie has been reset");

			}else{
				ckVal = '0|0|0';
				jQuery.cookie(settings.vcname, ckVal, { expires: settings.vexpiry, path: settings.vcpath });
			}

			visitorNumber = ckVal.split("|");
			jQuery(".vcount").text(visitorNumber[0]);
			return ckVal;
		}

		// randomly generate a safe to use class name
		function genClass(){
			var randCharac="0123456789abcdefghijklmnopqrstuvwxyz";
			function randomClass() {
				var result = ""; var r = 0; var randomnumber = 0;
				while( r < 15 ) {
					 r ++; randomnumber = Math.floor(randCharac.length*Math.random()); result += randCharac.substring(randomnumber,randomnumber + 1)
				}
				return result;
			}
			return randomClass();
		}

		// static content function - based on display if visitor has been recognised less than the following times and where the visitor hasn't clicked on don't show
		function appearNow(thisVal){
			visitValue = vcookie('count').split("|");
			if(parseInt(visitValue[0]) < settings.vmax){
				jQuery('.'+thisVal).css({display:"block"});
			}
		}

		// fly in content function
		 function flyNow(thisVal){
			visitValue = vcookie('count').split("|");
			if(parseInt(visitValue[1])!= 1 && visitValue[0] < settings.vmax){ // if dont show me is 1 dont display the visitor panel

				flyIn = function flyInNow(){
					jQuery('.'+thisVal)
						.appendTo("#vbcWrapper")
						.append("<div class='closeItems'><a href='javascript:void(0);' class='closeNoShow closeNow'><span>dont show again</span></a> <a href='javascript:void(0);' class='closeVisitor closeNow'><span>close</span></a></div>")
						.css({display:"block",zIndex:"9999"})
						.animate({'top': settings.vtop+'px','left':settings.vleft+'px'}, settings.vtime, settings.vease);

					jQuery(".closeVisitor").bind("click",function(){
						jQuery('.'+thisVal).animate({'top': -1000+'px','left':-1000+'px'}, settings.vtime, "easeOutQuart").css({display:"block",zIndex:"9999"});
					});

					jQuery(".closeNoShow").bind("click",function(){
						vcookie('noShow'); // close fly in based on never show based on a 60 day cookie
						jQuery('.'+thisVal).animate({'top': -1000+'px','left':-1000+'px'}, settings.vtime, "easeOutQuart").css({display:"block",zIndex:"9999"});
					});
					}

			// activate fly in after delay
			setTimeout("flyIn();",settings.vdelay);
			}
		}

		// catfish pop up - based on display if visitor has been recognised less than the following times
		 function showFish(thisVal){
			visitValue = vcookie('count').split("|");
			if(parseInt(visitValue[2])!= 1 && visitValue[0] < settings.vmax){ // if dont show me is 1 dont display the visitor panel

				showCat = function showCatNow(){
					jQuery('.'+thisVal)
						.appendTo("#vbcWrapper")
						.append("<div class='closeItems'><a href='javascript:void(0);' class='closeCatNoShow closeNow'><span>dont show again</span></a> <a href='javascript:void(0);' class='closeCat closeNow'><span>close</span></a></div>")
						.css({display:"block",zIndex:"9999"})
						.animate({'height': settings.vheight+'px'}, settings.vtime, settings.vease);

					jQuery(".closeCat").bind("click",function(){
						jQuery('.'+thisVal).animate({'height':-0+'px'}, settings.vtime, "easeOutQuart").css({display:"block",zIndex:"999"});
					});

					jQuery(".closeCatNoShow").bind("click",function(){
						vcookie('noShowCat'); // close fly in based on never show based on a 60 day cookie
						jQuery('.'+thisVal).animate({'height':-0+'px'}, settings.vtime, "easeOutQuart").css({display:"block",zIndex:"999"});
					});
					}

			// activate fly in after delay
			setTimeout("showCat();",settings.vdelay);
			}
		}

		if(settings.vtype==='static'){
			// add working class
			var staticClass = genClass(); jQuery(settings.vvalue).addClass(staticClass);
			appearNow(staticClass);
		}else if(settings.vtype==='fly'){
			// add working class
			var flyClass = genClass(); jQuery(settings.vvalue).addClass(flyClass);
			flyNow(flyClass);
		}else if(settings.vtype==='catfish'){
			// add working class
			var catClass = genClass(); jQuery(settings.vvalue).addClass(catClass);
			showFish(catClass);
		}else if(settings.vtype==='reset'){ // this is here to make testing layouts a lot easier
			vcookie('reset');
		}else if(settings.vtype==='activeFly'){ // function to be called if you want to disable the Fly In panel
			vcookie('activeFly');
		}else if(settings.vtype==='activeCat'){ // function to be called if you want to disable the Catfish panel
			vcookie('activeFly');
		}
};


//### validation rules ###//
/*
  Easy Function Reference - BASED ON rc_formValidtor to mimic via JS...

  checkNotEmpty($field, $msg='', $allowNull) - // essentialy does any data exist
  checkIsNumeric($field, $msg='', $allowNull) - // make sure that the data is a number
**  checkLength($field, $min, $max, $msg='', $allowNull) - //
**  checkIdentical($field, $field2, $msg='', $allowNull) - // used for testing against dual passwords or email entry
  checkIsValidEmail($field, $msg='', $allowNull) - // email validation only regex not MX records
  checkIsText($field, $msg='', $allowNull) - // not needed as alphanumrec is the same sort of thing
  checkIsAlphabetic($field, $msg='', $allowNull) - // same as checkIsNumeric but text only no special characters
  checkIsDigit($field, $msg='', $allowNull) - // same as checkIsNumeric but 0-9 only
  checkIsAlphanum($field, $msg='', $allowNull) - // essentially no special characters
**  checkPassword($field, $field2, $min, $max, $msg='', $allowNull)
**  checkIsOfValues($field, $validValues, $msg='', $allowNull)
**  checkIsWithinRange($field, $min, $max, $msg='', $allowNull)
**  checkIsSmallerThan($field, $value, $msg='', $allowNull)
**  checkIsGreaterThan($field, $value, $msg='', $allowNull)
  checkDateFormat($field, $format, $seperator='-', $msg='', $allowNull) - // checks date via regex dd/mm/yyyy only

** ones not done as yet,

*/

// event like listener for validation
function validDocEL(){
 $(".req1").blur( function() {  // if label has class validate and an input field
	 var v = $(this).attr("id"); // get ID to validate
	 var vr = $(this).attr("class"); // get all rules for input field
	inputCheck(v,vr) } );

	$(".req1").change( function() {  // capture input on change
	 var v = $(this).attr("id");
	 var vr = $(this).attr("class"); // get all rules for input field
	inputCheck(v,vr) } );
}



function validDoc(){
 var formValidated = true;
 $(".req1").each(function(i){  // if label has class validate and an input field
  var v = $(this).attr("id"); // get ID to validate
	 var vr = $(this).attr("class"); // get all rules for input field
  if(inputCheck(v,vr) == false){
    //alert(inputCheck(v,vr));
    formValidated = false;
  }} );



if(formValidated == false){
 // ThickBox pop up custom modal
  $("#errorHere").removeClass("noDisplay");
	//$("#customDialog h1").text("Form Errors Found");
  //$("#customDialog .text").text("Please Check: Sorry we found an error/s, can you please check and correct all items marked in red.");
  //tb_show('SORRY WE FOUND SOME ERRORS', '#TB_inline?height=200&width=335&inlineId=customDialog&modal=true', null);
  //$("#TB_window").css({ border: "0", background:"transparent" });
  return false;
}

}


// used to pretest if the field is required and to split class data into usable items
function inputCheck(v,vr){
 var returnVar = true;
 rules = vr.split(" "); // array all classes at space
 $.each(rules, function(i, n){ // check all class values being 'rules'
  var doVal = n.search(/vr#/); // for each rule check for validation trigger vr#
   if(doVal != -1){ // if vr# exists run next pass to find rules
	   r = n.split("#"); // split at # to find all rules
	   rules = r[1];
	   // check to see if required exists...
	   if(r[1].search(/req/) != -1){
	     req = true;
	   }else{
	     req = false;
	   }
    if(validCheck(v,req,rules) == false){
      returnVar = false;
    }
   }
  }
 );
 return returnVar;
}

// the validator checks validation rules for the field sent
function validCheck(v,req,rules){
	ru = rules.split(":"); // split at : to find an exact rule
	if(ru.length == 1 && req==true){ // check for just required value - find out how many items are in the array ru.lenght
	  return checkNotEmpty(v);
	}else if(ru[0] == 'email' || ru[1] == 'email'){ // email check
	  return checkIsValidEmail(v,req);
	}else if(ru[0] == 'phone' || ru[1] == 'phone'){ // email check
	  return phoneNumber(v,req);
	}else if(ru[0] == 'number' || ru[1] == 'number'){ // email check
	  return checkIsNumeric(v,req);
	}else if(ru[0] == 'date' || ru[1] == 'date'){ // email check
	  return checkDateFormat(v,req);
	}else if(ru[0] == 'alpha' || ru[1] == 'alpha'){ // email check
	  return checkIsAlphanum(v,req);
	}else if(ru[0] == 'digit' || ru[1] == 'digit'){ // email check
	  return checkIsDigit(v,req);
	}else if(ru[0] == 'alphab' || ru[1] == 'alphab'){ // email check
   return checkIsAlphabetic(v,req);
	}else{
	 return false;
	}
} // end validCheck

// basic does this exist data
function checkNotEmpty(v){
 var fielddata = document.getElementById(v).value;
 var data = $.trim(fielddata);
 var m = 'This field is required'; // message for this error
  if(data==null || data==""){
		  return failure(v,m);
	 }else{
		  return success(v);
	 }
}


// numbers only including .
function checkIsNumeric(v,req) {
  var data=document.getElementById(v).value;
  var data=$.trim(data).replace(/[a-zA-Z ]+/g,'');

  if(req==true && data == '' || data == null){ // check if this is a required field
    var m = 'A number is required'; // message for this error
	   return failure(v,m);
  }else if(data != ''){
    document.getElementById(v).value = data;
	   return success(v);
 	}else if(data == '' && req == false){
    document.getElementById(v).value = data;
	   return successFalse(v);
  }else{
	   var m = 'Expecting numbers only please correct'; // message for this error
	   return failure(v,m);
	 }
}

// phone number data
function phoneNumber(v,req){
  var tnumber=$.trim(document.getElementById(v).value);
  var telnr = /^\+?[0-9 ()-.]+[0-9]$/;
	 if(req==true && tnumber == ''){ // check if this is a required field
	   var m = 'A phone number is required'; // message for this error
		  return failure(v,m);
	 }else if(tnumber != '' && telnr.test(tnumber)){
		  if(tnumber.length > 8 && tnumber.length < 16){
		    return success(v);
		  }else{
	     var m = 'Your phone number appears incorrect. (Permitted are digits, space ()-. and leading +)'; // message for this error
		    return failure(v,m);
		  }
	 }else if(tnumber == '' && req == false){
		  return successFalse(v);
  }else if(req==false && telnr.test(tnumber)  && length.tnumber > 8 && length.tnumber < 14){
		  if(tnumber.length > 8 && tnumber.length < 16){
		    return success(v);
		  }else{
	     var m = 'Your phone number appears incorrect. (Permitted are digits, space ()-. and leading +)'; // message for this error
		    return failure(v,m);
		  }
	 }else{
	    var m = 'Your phone number appears incorrect. (Permitted are digits, space ()-. and leading +)'; // message for this error
		   return failure(v,m);
	 }
}

// date entry
function checkDateFormat(v,req){
	  var dateE=$.trim(document.getElementById(v).value);
	  var dateChar=/(0[1-9]|[12][0-9]|3[01])+\/(0[1-9]|1[012])+\/(19|20)\d\d/;
	  if(req==true && dateE == ''){ // check if this is a required field
	    var m = 'A date is required'; // message for this error
		   return failure(v,m);
	  }else if(dateE != '' && dateChar.test(dateE) || req==false && dateChar.test(dateE)){
		   return success(v);
	  }else if(dateE == '' && req == false){
		   return successFalse(v);
	  }else{
	    var m = 'Not a valid date format, expecting dd/mm/yyyy. Please use pop up selector or re-type'; // message for this error
		   return failure(v,m);
	  }
}

// check is alphanumeric
function checkIsAlphanum(v,req){
	  var dataA=$.trim(document.getElementById(v).value);
	  var dateChar=/^[a-z0-9]+$/i;
	  if(req==true && dataA == ''){ // check if this is a required field
	    var m = 'Some input is required'; // message for this error
		   return failure(v,m);
	  }else if(dataA != '' && dateChar.test(dataA) || req==false && dateChar.test(dataA)){
		   return success(v);
	  }else if(dataA == '' && req == false){
		   return successFalse(v);
	  }else{
	    var m = 'Please use numbers or text only, no special characters like (.,)*&^ etc...'; // message for this error
		   return failure(v,m);
	  }
}

// check is digit
function checkIsDigit(v,req){
	  var dataA=$.trim(document.getElementById(v).value);
	  var dateChar=/^[0-9]+$/;
	  if(req==true && dataA == ''){ // check if this is a required field
	    var m = 'Some input is required'; // message for this error
		   return failure(v,m);
	  }else if(dataA != '' && dateChar.test(dataA) || req==false && dateChar.test(dataA)){
		   return success(v);
	  }else if(dataA == '' && req == false){
		    return successFalse(v);
	  }else{
	    var m = 'Please use numbers only, no special characters like (.,)*&^ etc... or text a-z'; // message for this error
		   return failure(v,m);
	  }
}

// check is alphabetic
function checkIsAlphabetic(v,req){
	  var dataA=$.trim(document.getElementById(v).value);
	  var dateChar=/^[a-z]+$/i;
	  if(req==true && dataA == ''){ // check if this is a required field
     var m = 'Some input is required'; // message for this error
		   return failure(v,m);
	   }else if(dataA != '' && dateChar.test(dataA) || req==false && dateChar.test(dataA)){
      return success(v);
	   }else if(dataA == '' && req == false){
		    return successFalse(v);
	   }else{
	     var m = 'Please use a-z or A-Z only, and no special characters like (.,)*&^ etc...'; // message for this error
		    return failure(v,m);
	   }
}

// email check
function checkIsValidEmail(v,req){
	  var emaile=$.trim(document.getElementById(v).value);
	  var emailchar=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	  if(req==true && emaile == ''){ // check if this is a required field
	    var m = 'An email address is required'; // message for this error
		   return failure(v,m);
	  }else if(emaile != '' && emailchar.test(emaile) || req==false && emailchar.test(emaile)){
		   return success(v);
	  }else if(emaile == '' && req == false){
 		 return successFalse(v);
	  }else{
	    var m = 'Not a valid email address'; // message for this error
		   return failure(v,m);
	  }

}


// failure details, change class and add comments
function failure(v,m){ var fail = true;$('#' + v).css({"border":"1px solid red"});$('#' + v).addClass("failApp"); $('#sta_' + v).addClass("failApp");$('#sta_' + v).removeClass("successApp");$('#' + v).removeClass("successApp");$('#' + v + '_msg').css({display:"block"}); $('#' + v + '_msg').html(m);return false;}
// success details, display green for go class
function success(v){$('#' + v).css({"border":"1px solid #79A450"});$('#' + v).removeClass("failApp");$('#sta_' + v).removeClass("failApp");$('#' + v).removeClass("error-php");$('#sta_' + v).addClass("successApp");$('#' + v).addClass("successApp");$('#' + v + '_msg').css({display:"none"});return true;}
// success false is a success without requiring a tick
function successFalse(v){$('#' + v).removeClass("failApp");$('#sta_' + v).removeClass("failApp");$('#sta_' + v).removeClass("successApp");$('#' + v).removeClass("successApp");$('#' + v + '_msg').css({display:"none"});return true;}

//### end validation rules ###//




/* =========================================================

// jquery.innerfade.js

// Datum: 2007-01-29
// Firma: Medienfreunde Hofmann & Baldes GbR
// Autor: Torsten Baldes
// Mail: t.baldes@medienfreunde.com
// Web: http://medienfreunde.com

// based on the work of Matt Oakes http://portfolio.gizone.co.uk/applications/slideshow/

// ========================================================= */


;(function($) {

$.fn.innerfade = function(options) {

	this.each(function(){ 	
		
		var settings = {
			animationtype: 'fade',
			speed: 'normal',
			timeout: 2000,
			type: 'sequence',
			containerheight: 'auto',
			runningclass: 'innerfade'
		};
		
		if(options)
			$.extend(settings, options);
		
		var elements = $(this).children();
	
		if (elements.length > 1) {
		
			$(this).css('position', 'relative');
	
			$(this).css('height', settings.containerheight);
			$(this).addClass(settings.runningclass);
			
			for ( var i = 0; i < elements.length; i++ ) {
				$(elements[i]).css('z-index', String(elements.length-i)).css('position', 'absolute');
				$(elements[i]).hide();
			};
		
			if ( settings.type == 'sequence' ) {
				setTimeout(function(){
					$.innerfade.next(elements, settings, 1, 0);
				}, settings.timeout);
				$(elements[0]).show();
			} else if ( settings.type == 'random' ) {
				setTimeout(function(){
					do { current = Math.floor ( Math.random ( ) * ( elements.length ) ); } while ( current == 0 )
					$.innerfade.next(elements, settings, current, 0);
				}, settings.timeout);
				$(elements[0]).show();
			}	else {
				alert('type must either be \'sequence\' or \'random\'');
			}
			
		}
		
	});
};


$.innerfade = function() {}
$.innerfade.next = function (elements, settings, current, last) {

	if ( settings.animationtype == 'slide' ) {
		$(elements[last]).slideUp(settings.speed, $(elements[current]).slideDown(settings.speed));
	} else if ( settings.animationtype == 'fade' ) {
		$(elements[last]).fadeOut(settings.speed);
		$(elements[current]).fadeIn(settings.speed);
	} else {
		alert('animationtype must either be \'slide\' or \'fade\'');
	};
	
	if ( settings.type == 'sequence' ) {
		if ( ( current + 1 ) < elements.length ) {
			current = current + 1;
			last = current - 1;
		} else {
			current = 0;
			last = elements.length - 1;
		};
	}	else if ( settings.type == 'random' ) {
		last = current;
		while (	current == last ) {
			current = Math.floor ( Math.random ( ) * ( elements.length ) );
		};
	}	else {
		alert('type must either be \'sequence\' or \'random\'');
	};
	setTimeout((function(){$.innerfade.next(elements, settings, current, last);}), settings.timeout);
};
})(jQuery);
