//cycle lite (fade only)...
(function(D){var A="Lite-1.0";D.fn.cycle=function(E){return this.each(function(){E=E||{};if(this.cycleTimeout){clearTimeout(this.cycleTimeout)}this.cycleTimeout=0;this.cyclePause=0;var I=D(this);var J=E.slideExpr?D(E.slideExpr,this):I.children();var G=J.get();if(G.length<2){if(window.console&&window.console.log){window.console.log("terminating; too few slides: "+G.length)}return }var H=D.extend({},D.fn.cycle.defaults,E||{},D.metadata?I.metadata():D.meta?I.data():{});H.before=H.before?[H.before]:[];H.after=H.after?[H.after]:[];H.after.unshift(function(){H.busy=0});var F=this.className;H.width=parseInt((F.match(/w:(\d+)/)||[])[1])||H.width;H.height=parseInt((F.match(/h:(\d+)/)||[])[1])||H.height;H.timeout=parseInt((F.match(/t:(\d+)/)||[])[1])||H.timeout;if(I.css("position")=="static"){I.css("position","relative")}if(H.width){I.width(H.width)}if(H.height&&H.height!="auto"){I.height(H.height)}var K=0;J.css({position:"absolute",top:0,left:0}).hide().each(function(M){D(this).css("z-index",G.length-M)});D(G[K]).css("opacity",1).show();if(D.browser.msie){G[K].style.removeAttribute("filter")}if(H.fit&&H.width){J.width(H.width)}if(H.fit&&H.height&&H.height!="auto"){J.height(H.height)}if(H.pause){I.hover(function(){this.cyclePause=1},function(){this.cyclePause=0})}D.fn.cycle.transitions.fade(I,J,H);J.each(function(){var M=D(this);this.cycleH=(H.fit&&H.height)?H.height:M.height();this.cycleW=(H.fit&&H.width)?H.width:M.width()});J.not(":eq("+K+")").css({opacity:0});if(H.cssFirst){D(J[K]).css(H.cssFirst)}if(H.timeout){if(H.speed.constructor==String){H.speed={slow:600,fast:200}[H.speed]||400}if(!H.sync){H.speed=H.speed/2}while((H.timeout-H.speed)<250){H.timeout+=H.speed}}H.speedIn=H.speed;H.speedOut=H.speed;H.slideCount=G.length;H.currSlide=K;H.nextSlide=1;var L=J[K];if(H.before.length){H.before[0].apply(L,[L,L,H,true])}if(H.after.length>1){H.after[1].apply(L,[L,L,H,true])}if(H.click&&!H.next){H.next=H.click}if(H.next){D(H.next).bind("click",function(){return C(G,H,H.rev?-1:1)})}if(H.prev){D(H.prev).bind("click",function(){return C(G,H,H.rev?1:-1)})}if(H.timeout){this.cycleTimeout=setTimeout(function(){B(G,H,0,!H.rev)},H.timeout+(H.delay||0))}})};function B(J,E,I,K){if(E.busy){return }var H=J[0].parentNode,M=J[E.currSlide],L=J[E.nextSlide];if(H.cycleTimeout===0&&!I){return }if(I||!H.cyclePause){if(E.before.length){D.each(E.before,function(N,O){O.apply(L,[M,L,E,K])})}var F=function(){if(D.browser.msie){this.style.removeAttribute("filter")}D.each(E.after,function(N,O){O.apply(L,[M,L,E,K])})};if(E.nextSlide!=E.currSlide){E.busy=1;D.fn.cycle.custom(M,L,E,F)}var G=(E.nextSlide+1)==J.length;E.nextSlide=G?0:E.nextSlide+1;E.currSlide=G?J.length-1:E.nextSlide-1}if(E.timeout){H.cycleTimeout=setTimeout(function(){B(J,E,0,!E.rev)},E.timeout)}}function C(E,F,I){var H=E[0].parentNode,G=H.cycleTimeout;if(G){clearTimeout(G);H.cycleTimeout=0}F.nextSlide=F.currSlide+I;if(F.nextSlide<0){F.nextSlide=E.length-1}else{if(F.nextSlide>=E.length){F.nextSlide=0}}B(E,F,1,I>=0);return false}D.fn.cycle.custom=function(K,H,I,E){var J=D(K),G=D(H);G.css({opacity:0});var F=function(){G.animate({opacity:1},I.speedIn,I.easeIn,E)};J.animate({opacity:0},I.speedOut,I.easeOut,function(){J.css({display:"none"});if(!I.sync){F()}});if(I.sync){F()}};D.fn.cycle.transitions={fade:function(F,G,E){G.not(":eq(0)").css("opacity",0);E.before.push(function(){D(this).show()})}};D.fn.cycle.ver=function(){return A};D.fn.cycle.defaults={timeout:4000,speed:1000,next:null,prev:null,before:null,after:null,height:"auto",sync:1,fit:0,pause:0,delay:0,slideExpr:null}})(jQuery);
/*!
 * jQuery Form Plugin
 * version: 2.63 (29-JAN-2011)
 * @requires jQuery v1.3.2 or later
 *
 * Examples and documentation at: http://malsup.com/jquery/form/
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
(function(b){function q(){if(b.fn.ajaxSubmit.debug){var a="[jquery.form] "+Array.prototype.join.call(arguments,"");if(window.console&&window.console.log)window.console.log(a);else window.opera&&window.opera.postError&&window.opera.postError(a)}}b.fn.ajaxSubmit=function(a){function f(){function x(){var j=i.attr("target"),l=i.attr("action");o.setAttribute("target",w);o.getAttribute("method")!="POST"&&o.setAttribute("method","POST");o.getAttribute("action")!=e.url&&o.setAttribute("action",e.url);e.skipEncodingOverride||
i.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"});e.timeout&&setTimeout(function(){E=true;s()},e.timeout);var t=[];try{if(e.extraData)for(var u in e.extraData)t.push(b('<input type="hidden" name="'+u+'" value="'+e.extraData[u]+'" />').appendTo(o)[0]);v.appendTo("body");r.attachEvent?r.attachEvent("onload",s):r.addEventListener("load",s,false);o.submit()}finally{o.setAttribute("action",l);j?o.setAttribute("target",j):i.removeAttr("target");b(t).remove()}}function s(){m=r.contentWindow?
r.contentWindow.document:r.contentDocument?r.contentDocument:r.document;if(!(!m||m.location.href==e.iframeSrc)){r.detachEvent?r.detachEvent("onload",s):r.removeEventListener("load",s,false);var j=true;try{if(E)throw"timeout";var l=e.dataType=="xml"||m.XMLDocument||b.isXMLDoc(m);q("isXml="+l);if(!l&&window.opera&&(m.body==null||m.body.innerHTML==""))if(--H){q("requeing onLoad callback, DOM not available");setTimeout(s,250);return}k.responseText=m.body?m.body.innerHTML:m.documentElement?m.documentElement.innerHTML:
null;k.responseXML=m.XMLDocument?m.XMLDocument:m;k.getResponseHeader=function(I){return{"content-type":e.dataType}[I]};var t=/(json|script)/.test(e.dataType);if(t||e.textarea){var u=m.getElementsByTagName("textarea")[0];if(u)k.responseText=u.value;else if(t){var z=m.getElementsByTagName("pre")[0],F=m.getElementsByTagName("body")[0];if(z)k.responseText=z.textContent;else if(F)k.responseText=F.innerHTML}}else if(e.dataType=="xml"&&!k.responseXML&&k.responseText!=null)k.responseXML=J(k.responseText);
G=K(k,e.dataType,e)}catch(B){q("error caught:",B);j=false;k.error=B;e.error.call(e.context,k,"error",B);y&&b.event.trigger("ajaxError",[k,e,B])}if(k.aborted){q("upload aborted");j=false}if(j){e.success.call(e.context,G,"success",k);y&&b.event.trigger("ajaxSuccess",[k,e])}y&&b.event.trigger("ajaxComplete",[k,e]);y&&!--b.active&&b.event.trigger("ajaxStop");e.complete&&e.complete.call(e.context,k,j?"success":"error");setTimeout(function(){v.removeData("form-plugin-onload");v.remove();k.responseXML=null},
100)}}var o=i[0];if(b(":input[name=submit],:input[id=submit]",o).length)alert('Error: Form elements must not have name or id of "submit".');else{var e=b.extend(true,{},b.ajaxSettings,a);e.context=e.context||e;var w="jqFormIO"+(new Date).getTime(),v=b('<iframe id="'+w+'" name="'+w+'" src="'+e.iframeSrc+'" />'),r=v[0];v.css({position:"absolute",top:"-1000px",left:"-1000px"});var k={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},
setRequestHeader:function(){},abort:function(){this.aborted=1;v.attr("src",e.iframeSrc)}},y=e.global;y&&!b.active++&&b.event.trigger("ajaxStart");y&&b.event.trigger("ajaxSend",[k,e]);if(e.beforeSend&&e.beforeSend.call(e.context,k,e)===false)e.global&&b.active--;else if(!k.aborted){var E=0,A=o.clk;if(A){var C=A.name;if(C&&!A.disabled){e.extraData=e.extraData||{};e.extraData[C]=A.value;if(A.type=="image"){e.extraData[C+".x"]=o.clk_x;e.extraData[C+".y"]=o.clk_y}}}e.forceSync?x():setTimeout(x,10);var G,
m,H=50,J=b.parseXML||function(j,l){if(window.ActiveXObject){l=new ActiveXObject("Microsoft.XMLDOM");l.async="false";l.loadXML(j)}else l=(new DOMParser).parseFromString(j,"text/xml");return l&&l.documentElement&&l.documentElement.nodeName!="parsererror"?l:null},L=b.parseJSON||function(j){return window.eval("("+j+")")},K=function(j,l,t){var u=j.getResponseHeader("content-type")||"",z=l==="xml"||!l&&u.indexOf("xml")>=0;j=z?j.responseXML:j.responseText;z&&j.documentElement.nodeName==="parsererror"&&b.error&&
b.error("parsererror");if(t&&t.dataFilter)j=t.dataFilter(j,l);if(typeof j==="string")if(l==="json"||!l&&u.indexOf("json")>=0)j=L(j);else if(l==="script"||!l&&u.indexOf("javascript")>=0)b.globalEval(j);return j}}}}if(!this.length){q("ajaxSubmit: skipping submit process - no element selected");return this}if(typeof a=="function")a={success:a};var d=this.attr("action");if(d=typeof d==="string"?b.trim(d):"")d=(d.match(/^([^#]+)/)||[])[1];d=d||window.location.href||"";a=b.extend(true,{url:d,type:this[0].getAttribute("method")||
"GET",iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},a);d={};this.trigger("form-pre-serialize",[this,a,d]);if(d.veto){q("ajaxSubmit: submit vetoed via form-pre-serialize trigger");return this}if(a.beforeSerialize&&a.beforeSerialize(this,a)===false){q("ajaxSubmit: submit aborted via beforeSerialize callback");return this}var c,h,g=this.formToArray(a.semantic);if(a.data){a.extraData=a.data;for(c in a.data)if(a.data[c]instanceof Array)for(var n in a.data[c])g.push({name:c,
value:a.data[c][n]});else{h=a.data[c];h=b.isFunction(h)?h():h;g.push({name:c,value:h})}}if(a.beforeSubmit&&a.beforeSubmit(g,this,a)===false){q("ajaxSubmit: submit aborted via beforeSubmit callback");return this}this.trigger("form-submit-validate",[g,this,a,d]);if(d.veto){q("ajaxSubmit: submit vetoed via form-submit-validate trigger");return this}c=b.param(g);if(a.type.toUpperCase()=="GET"){a.url+=(a.url.indexOf("?")>=0?"&":"?")+c;a.data=null}else a.data=c;var i=this,p=[];a.resetForm&&p.push(function(){i.resetForm()});
a.clearForm&&p.push(function(){i.clearForm()});if(!a.dataType&&a.target){var D=a.success||function(){};p.push(function(x){var s=a.replaceTarget?"replaceWith":"html";b(a.target)[s](x).each(D,arguments)})}else a.success&&p.push(a.success);a.success=function(x,s,o){for(var e=a.context||a,w=0,v=p.length;w<v;w++)p[w].apply(e,[x,s,o||i,i])};c=b("input:file",this).length>0;n=i.attr("enctype")=="multipart/form-data"||i.attr("encoding")=="multipart/form-data";if(a.iframe!==false&&(c||a.iframe||n))a.closeKeepAlive?
b.get(a.closeKeepAlive,f):f();else b.ajax(a);this.trigger("form-submit-notify",[this,a]);return this};b.fn.ajaxForm=function(a){if(this.length===0){var f={s:this.selector,c:this.context};if(!b.isReady&&f.s){q("DOM not ready, queuing ajaxForm");b(function(){b(f.s,f.c).ajaxForm(a)});return this}q("terminating; zero elements found by selector"+(b.isReady?"":" (DOM not ready)"));return this}return this.ajaxFormUnbind().bind("submit.form-plugin",function(d){if(!d.isDefaultPrevented()){d.preventDefault();
b(this).ajaxSubmit(a)}}).bind("click.form-plugin",function(d){var c=d.target,h=b(c);if(!h.is(":submit,input:image")){c=h.closest(":submit");if(c.length==0)return;c=c[0]}var g=this;g.clk=c;if(c.type=="image")if(d.offsetX!=undefined){g.clk_x=d.offsetX;g.clk_y=d.offsetY}else if(typeof b.fn.offset=="function"){h=h.offset();g.clk_x=d.pageX-h.left;g.clk_y=d.pageY-h.top}else{g.clk_x=d.pageX-c.offsetLeft;g.clk_y=d.pageY-c.offsetTop}setTimeout(function(){g.clk=g.clk_x=g.clk_y=null},100)})};b.fn.ajaxFormUnbind=
function(){return this.unbind("submit.form-plugin click.form-plugin")};b.fn.formToArray=function(a){var f=[];if(this.length===0)return f;var d=this[0],c=a?d.getElementsByTagName("*"):d.elements;if(!c)return f;var h,g,n,i,p,D;h=0;for(p=c.length;h<p;h++){g=c[h];if(n=g.name)if(a&&d.clk&&g.type=="image"){if(!g.disabled&&d.clk==g){f.push({name:n,value:b(g).val()});f.push({name:n+".x",value:d.clk_x},{name:n+".y",value:d.clk_y})}}else if((i=b.fieldValue(g,true))&&i.constructor==Array){g=0;for(D=i.length;g<
D;g++)f.push({name:n,value:i[g]})}else i!==null&&typeof i!="undefined"&&f.push({name:n,value:i})}if(!a&&d.clk){a=b(d.clk);c=a[0];if((n=c.name)&&!c.disabled&&c.type=="image"){f.push({name:n,value:a.val()});f.push({name:n+".x",value:d.clk_x},{name:n+".y",value:d.clk_y})}}return f};b.fn.formSerialize=function(a){return b.param(this.formToArray(a))};b.fn.fieldSerialize=function(a){var f=[];this.each(function(){var d=this.name;if(d){var c=b.fieldValue(this,a);if(c&&c.constructor==Array)for(var h=0,g=c.length;h<
g;h++)f.push({name:d,value:c[h]});else c!==null&&typeof c!="undefined"&&f.push({name:this.name,value:c})}});return b.param(f)};b.fn.fieldValue=function(a){for(var f=[],d=0,c=this.length;d<c;d++){var h=b.fieldValue(this[d],a);h===null||typeof h=="undefined"||h.constructor==Array&&!h.length||(h.constructor==Array?b.merge(f,h):f.push(h))}return f};b.fieldValue=function(a,f){var d=a.name,c=a.type,h=a.tagName.toLowerCase();if(f===undefined)f=true;if(f&&(!d||a.disabled||c=="reset"||c=="button"||(c=="checkbox"||
c=="radio")&&!a.checked||(c=="submit"||c=="image")&&a.form&&a.form.clk!=a||h=="select"&&a.selectedIndex==-1))return null;if(h=="select"){var g=a.selectedIndex;if(g<0)return null;d=[];h=a.options;var n=(c=c=="select-one")?g+1:h.length;for(g=c?g:0;g<n;g++){var i=h[g];if(i.selected){var p=i.value;p||(p=i.attributes&&i.attributes.value&&!i.attributes.value.specified?i.text:i.value);if(c)return p;d.push(p)}}return d}return b(a).val()};b.fn.clearForm=function(){return this.each(function(){b("input,select,textarea",
this).clearFields()})};b.fn.clearFields=b.fn.clearInputs=function(){return this.each(function(){var a=this.type,f=this.tagName.toLowerCase();if(a=="text"||a=="password"||f=="textarea")this.value="";else if(a=="checkbox"||a=="radio")this.checked=false;else if(f=="select")this.selectedIndex=-1})};b.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=="function"||typeof this.reset=="object"&&!this.reset.nodeType)this.reset()})};b.fn.enable=function(a){if(a===undefined)a=true;return this.each(function(){this.disabled=
!a})};b.fn.selected=function(a){if(a===undefined)a=true;return this.each(function(){var f=this.type;if(f=="checkbox"||f=="radio")this.checked=a;else if(this.tagName.toLowerCase()=="option"){f=b(this).parent("select");a&&f[0]&&f[0].type=="select-one"&&f.find("option").selected(false);this.selected=a}})}})(jQuery);

Shadowbox.init({adapter:'jquery',handleOversize:'drag',useSizzle:false});

jQuery(function($){
	//contact us form submittal...
	$('#myForm').submit(function(){
			$('#response').addClass('ajax-loading');
			$(this).ajaxSubmit({
					success: function(response){
						$('#response').html(response||'').removeClass('ajax-loading');
					}
				});
			return false;
		});
	//fader...
	$('#cyclicFade247').cycle({timeout:6000,speed:1500});
	//news...
	var newsBox = {
			el: $('#newsBoxSlider')
		, host: window.location.href.split('/')
		, speed: 1000 //milliseconds for the slide transition
		, interval: 6000 //milliseconds before next transition (after completion of slide)
		, step: 0 //max height of the items, and therefore the amount that top needs to change by
		, ct: 0 //number of items
		, dir: 1 //=down the list, ie scrolling up
		, indx: 0 //into item array, indicating item currently in view
		, hold: false //set by onHover - true on mouseenter, false on mouseleave
		, pause: false //set by play/pause buttons - true on pause clicked
		, timer: null //timer id
		, next: function(next){ //clears timer and sets up new timer if required...
				if(newsBox.timer !== null){
					window.clearTimeout(newsBox.timer);
					newsBox.timer = null;
				}
				if(next){
					newsBox.timer = window.setTimeout(newsBox.onTimeout, newsBox.interval + newsBox.speed);
				}
			}
		, slide: function(next){ //animate to next item...
				newsBox.next(next);
				newsBox.indx += newsBox.dir;
				if(newsBox.indx >= newsBox.ct){ newsBox.indx -= 2; newsBox.dir *= -1; }
				else if(newsBox.indx < 0){ newsBox.indx = 1; newsBox.dir *= -1; }
				newsBox.el.stop().animate({top: newsBox.indx * newsBox.step * -1}, newsBox.speed);
			}
		, onClick: function(){ //click handler for control buttons...
				this.blur();
				switch(this.id){
					case 'newsBoxControlNext':
						if(newsBox.indx < newsBox.ct - 1){
							newsBox.dir = 1;
							newsBox.slide(!newsBox.pause);
						}
						break;
					case 'newsBoxControlPause':
						newsBox.pause = true;
						$('#newsBoxControl').addClass('newsPaused');
						break;
					case 'newsBoxControlPlay':
						newsBox.pause = false;
						$('#newsBoxControl').removeClass('newsPaused');
						if(newsBox.timer == null){ newsBox.slide(true); }
						break;
					case 'newsBoxControlPrev':
						if(newsBox.indx > 0){
							newsBox.dir = -1;
							newsBox.slide(!newsBox.pause);
						}
						break;
					default:
				}
				return false;
			}
		, onHover: function(ev){ //hover handler for mouse over/off the slider...
				newsBox.hold = ev.type == 'mouseenter';
				$('#newsBoxControlPause').toggleClass('newsPaused');
				if(!newsBox.hold && !newsBox.pause && newsBox.timer === null){
					newsBox.slide(true);
				}
				return false;
			}
		, onShow: function(){ //set up controls, and set up all handlers...
				var ctrl = $('#newsBoxControl'), offset = (ctrl.prev().get(0)||{}).offsetTop||0;
				if(newsBox.ct > 1){ //if only one item, don't need any handlers!
					newsBox.next(true);
					if(ctrl.length){
						offset = offset - ctrl.find('a').click(newsBox.onClick).first().height();
						ctrl.hide().css({top:offset, visibility:'visible'}).fadeIn();
						$(this).hover(newsBox.onHover); //'this' is #newsBoxWindow
					}
				}else{
					ctrl.hide();
				}
			}
		, onTimeout: function(){ //timer handler...
				newsBox.timer = null;
				if(!newsBox.hold && !newsBox.pause){ newsBox.slide(true); }
			}
		};
	if(newsBox.el.length){
		newsBox.host.pop();
		newsBox.win = $('#newsBoxWindow').addClass('newsLoading');
		newsBox.step = newsBox.win.height();
		newsBox.el.load(newsBox.host.join('/') + '/fetch_news.php', function(){
				newsBox.win.removeClass('newsLoading');
				newsBox.ct = newsBox.el.children().height(newsBox.step).addClass('newsSnippets').prepend('<div class="newsSpacer"></div>').length;
				newsBox.onShow.call(newsBox.win);
			});
	}
	$('#c3-1,#c3-2').hover(function(ev){
		$(this).toggleClass('hovering', (ev.type === 'mouseover' || ev.type === 'mouseenter'));
		return false;
	});
});

