//Cycle
(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)

//Form File style
if(!window.SI){var SI={};};SI.Files={htmlClass:'SI-FILES-STYLIZED',fileClass:'file',wrapClass:'cabinet',fini:false,able:false,init:function()
{this.fini=true;var ie=0
if(window.opera||(ie&&ie<5.5)||!document.getElementsByTagName){return;}
this.able=true;var html=document.getElementsByTagName('html')[0];html.className+=(html.className!=''?' ':'')+this.htmlClass;},stylize:function(elem)
{if(!this.fini){this.init();};if(!this.able){return;};elem.parentNode.file=elem;elem.parentNode.onmousemove=function(e)
{if(typeof e=='undefined')e=window.event;if(typeof e.pageY=='undefined'&&typeof e.clientX=='number'&&document.documentElement)
{e.pageX=e.clientX+document.documentElement.scrollLeft;e.pageY=e.clientY+document.documentElement.scrollTop;};var ox=oy=0;var elem=this;if(elem.offsetParent)
{ox=elem.offsetLeft;oy=elem.offsetTop;while(elem=elem.offsetParent)
{ox+=elem.offsetLeft;oy+=elem.offsetTop;};};var x=e.pageX-ox;var y=e.pageY-oy;var w=this.file.offsetWidth;var h=this.file.offsetHeight;this.file.style.top=y-(h/2)+'px';this.file.style.left=x-(w-30)+'px';};},stylizeById:function(id)
{this.stylize(document.getElementById(id));},stylizeAll:function()
{if(!this.fini){this.init();};if(!this.able){return;};var inputs=document.getElementsByTagName('input');for(var i=0;i<inputs.length;i++)
{var input=inputs[i];if(input.type=='file'&&input.className.indexOf(this.fileClass)!=-1&&input.parentNode.className.indexOf(this.wrapClass)!=-1)
{this.stylize(input);};};}};

//Fancybox

/*
 * FancyBox - jQuery Plugin
 * Simple and fancy lightbox alternative
 *
 * Examples and documentation at: http://fancybox.net
 * 
 * Copyright (c) 2008 - 2010 Janis Skarnelis
 *
 * Version: 1.3.1 (05/03/2010)
 * Requires: jQuery v1.3+
 *
 * 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){var m,u,x,g,D,i,z,A,B,p=0,e={},q=[],n=0,c={},j=[],E=null,s=new Image,G=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,S=/[^\.]\.(swf)\s*$/i,H,I=1,k,l,h=false,y=b.extend(b("<div/>")[0],{prop:0}),v=0,O=!b.support.opacity&&!window.XMLHttpRequest,J=function(){u.hide();s.onerror=s.onload=null;E&&E.abort();m.empty()},P=function(){b.fancybox('<p id="fancybox_error">The requested content cannot be loaded.<br />Please try again later.</p>',{scrolling:"no",padding:20,transitionIn:"none",transitionOut:"none"})},
K=function(){return[b(window).width(),b(window).height(),b(document).scrollLeft(),b(document).scrollTop()]},T=function(){var a=K(),d={},f=c.margin,o=c.autoScale,t=(20+f)*2,w=(20+f)*2,r=c.padding*2;if(c.width.toString().indexOf("%")>-1){d.width=a[0]*parseFloat(c.width)/100-40;o=false}else d.width=c.width+r;if(c.height.toString().indexOf("%")>-1){d.height=a[1]*parseFloat(c.height)/100-40;o=false}else d.height=c.height+r;if(o&&(d.width>a[0]-t||d.height>a[1]-w))if(e.type=="image"||e.type=="swf"){t+=r;
w+=r;o=Math.min(Math.min(a[0]-t,c.width)/c.width,Math.min(a[1]-w,c.height)/c.height);d.width=Math.round(o*(d.width-r))+r;d.height=Math.round(o*(d.height-r))+r}else{d.width=Math.min(d.width,a[0]-t);d.height=Math.min(d.height,a[1]-w)}d.top=a[3]+(a[1]-(d.height+40))*0.5;d.left=a[2]+(a[0]-(d.width+40))*0.5;if(c.autoScale===false){d.top=Math.max(a[3]+f,d.top);d.left=Math.max(a[2]+f,d.left)}return d},U=function(a){if(a&&a.length)switch(c.titlePosition){case "inside":return a;case "over":return'<span id="fancybox-title-over">'+
a+"</span>";default:return'<span id="fancybox-title-wrap"><span id="fancybox-title-left"></span><span id="fancybox-title-main">'+a+'</span><span id="fancybox-title-right"></span></span>'}return false},V=function(){var a=c.title,d=l.width-c.padding*2,f="fancybox-title-"+c.titlePosition;b("#fancybox-title").remove();v=0;if(c.titleShow!==false){a=b.isFunction(c.titleFormat)?c.titleFormat(a,j,n,c):U(a);if(!(!a||a==="")){b('<div id="fancybox-title" class="'+f+'" />').css({width:d,paddingLeft:c.padding,
paddingRight:c.padding}).html(a).appendTo("body");switch(c.titlePosition){case "inside":v=b("#fancybox-title").outerHeight(true)-c.padding;l.height+=v;break;case "over":b("#fancybox-title").css("bottom",c.padding);break;default:b("#fancybox-title").css("bottom",b("#fancybox-title").outerHeight(true)*-1);break}b("#fancybox-title").appendTo(D).hide()}}},W=function(){b(document).unbind("keydown.fb").bind("keydown.fb",function(a){if(a.keyCode==27&&c.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if(a.keyCode==
37){a.preventDefault();b.fancybox.prev()}else if(a.keyCode==39){a.preventDefault();b.fancybox.next()}});if(b.fn.mousewheel){g.unbind("mousewheel.fb");j.length>1&&g.bind("mousewheel.fb",function(a,d){a.preventDefault();h||d===0||(d>0?b.fancybox.prev():b.fancybox.next())})}if(c.showNavArrows){if(c.cyclic&&j.length>1||n!==0)A.show();if(c.cyclic&&j.length>1||n!=j.length-1)B.show()}},X=function(){var a,d;if(j.length-1>n){a=j[n+1].href;if(typeof a!=="undefined"&&a.match(G)){d=new Image;d.src=a}}if(n>0){a=
j[n-1].href;if(typeof a!=="undefined"&&a.match(G)){d=new Image;d.src=a}}},L=function(){i.css("overflow",c.scrolling=="auto"?c.type=="image"||c.type=="iframe"||c.type=="swf"?"hidden":"auto":c.scrolling=="yes"?"auto":"visible");if(!b.support.opacity){i.get(0).style.removeAttribute("filter");g.get(0).style.removeAttribute("filter")}b("#fancybox-title").show();c.hideOnContentClick&&i.one("click",b.fancybox.close);c.hideOnOverlayClick&&x.one("click",b.fancybox.close);c.showCloseButton&&z.show();W();b(window).bind("resize.fb",
b.fancybox.center);c.centerOnScroll?b(window).bind("scroll.fb",b.fancybox.center):b(window).unbind("scroll.fb");b.isFunction(c.onComplete)&&c.onComplete(j,n,c);h=false;X()},M=function(a){var d=Math.round(k.width+(l.width-k.width)*a),f=Math.round(k.height+(l.height-k.height)*a),o=Math.round(k.top+(l.top-k.top)*a),t=Math.round(k.left+(l.left-k.left)*a);g.css({width:d+"px",height:f+"px",top:o+"px",left:t+"px"});d=Math.max(d-c.padding*2,0);f=Math.max(f-(c.padding*2+v*a),0);i.css({width:d+"px",height:f+
"px"});if(typeof l.opacity!=="undefined")g.css("opacity",a<0.5?0.5:a)},Y=function(a){var d=a.offset();d.top+=parseFloat(a.css("paddingTop"))||0;d.left+=parseFloat(a.css("paddingLeft"))||0;d.top+=parseFloat(a.css("border-top-width"))||0;d.left+=parseFloat(a.css("border-left-width"))||0;d.width=a.width();d.height=a.height();return d},Q=function(){var a=e.orig?b(e.orig):false,d={};if(a&&a.length){a=Y(a);d={width:a.width+c.padding*2,height:a.height+c.padding*2,top:a.top-c.padding-20,left:a.left-c.padding-
20}}else{a=K();d={width:1,height:1,top:a[3]+a[1]*0.5,left:a[2]+a[0]*0.5}}return d},N=function(){u.hide();if(g.is(":visible")&&b.isFunction(c.onCleanup))if(c.onCleanup(j,n,c)===false){b.event.trigger("fancybox-cancel");h=false;return}j=q;n=p;c=e;i.get(0).scrollTop=0;i.get(0).scrollLeft=0;if(c.overlayShow){O&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});
x.css({"background-color":c.overlayColor,opacity:c.overlayOpacity}).unbind().show()}l=T();V();if(g.is(":visible")){b(z.add(A).add(B)).hide();var a=g.position(),d;k={top:a.top,left:a.left,width:g.width(),height:g.height()};d=k.width==l.width&&k.height==l.height;i.fadeOut(c.changeFade,function(){var f=function(){i.html(m.contents()).fadeIn(c.changeFade,L)};b.event.trigger("fancybox-change");i.empty().css("overflow","hidden");if(d){i.css({top:c.padding,left:c.padding,width:Math.max(l.width-c.padding*
2,1),height:Math.max(l.height-c.padding*2-v,1)});f()}else{i.css({top:c.padding,left:c.padding,width:Math.max(k.width-c.padding*2,1),height:Math.max(k.height-c.padding*2,1)});y.prop=0;b(y).animate({prop:1},{duration:c.changeSpeed,easing:c.easingChange,step:M,complete:f})}})}else{g.css("opacity",1);if(c.transitionIn=="elastic"){k=Q();i.css({top:c.padding,left:c.padding,width:Math.max(k.width-c.padding*2,1),height:Math.max(k.height-c.padding*2,1)}).html(m.contents());g.css(k).show();if(c.opacity)l.opacity=
0;y.prop=0;b(y).animate({prop:1},{duration:c.speedIn,easing:c.easingIn,step:M,complete:L})}else{i.css({top:c.padding,left:c.padding,width:Math.max(l.width-c.padding*2,1),height:Math.max(l.height-c.padding*2-v,1)}).html(m.contents());g.css(l).fadeIn(c.transitionIn=="none"?0:c.speedIn,L)}}},F=function(){m.width(e.width);m.height(e.height);if(e.width=="auto")e.width=m.width();if(e.height=="auto")e.height=m.height();N()},Z=function(){h=true;e.width=s.width;e.height=s.height;b("<img />").attr({id:"fancybox-img",
src:s.src,alt:e.title}).appendTo(m);N()},C=function(){J();var a=q[p],d,f,o,t,w;e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));o=a.title||b(a).title||e.title||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(o===""&&e.orig)o=e.orig.attr("alt");d=a.nodeName&&/^(?:javascript|#)/i.test(a.href)?e.href||null:e.href||a.href||null;if(e.type){f=e.type;if(!d)d=e.content}else if(e.content)f="html";else if(d)if(d.match(G))f=
"image";else if(d.match(S))f="swf";else if(b(a).hasClass("iframe"))f="iframe";else if(d.match(/#/)){a=d.substr(d.indexOf("#"));f=b(a).length>0?"inline":"ajax"}else f="ajax";else f="inline";e.type=f;e.href=d;e.title=o;if(e.autoDimensions&&e.type!=="iframe"&&e.type!=="swf"){e.width="auto";e.height="auto"}if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick=false;e.enableEscapeButton=false;e.showCloseButton=false}if(b.isFunction(e.onStart))if(e.onStart(q,p,e)===false){h=false;
return}m.css("padding",20+e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(i.children())});switch(f){case "html":m.html(e.content);F();break;case "inline":b('<div class="fancybox-inline-tmp" />').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(i.children())}).bind("fancybox-cancel",function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity();
s=new Image;s.onerror=function(){P()};s.onload=function(){s.onerror=null;s.onload=null;Z()};s.src=d;break;case "swf":t='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+e.width+'" height="'+e.height+'"><param name="movie" value="'+d+'"></param>';w="";b.each(e.swf,function(r,R){t+='<param name="'+r+'" value="'+R+'"></param>';w+=" "+r+'="'+R+'"'});t+='<embed src="'+d+'" type="application/x-shockwave-flash" width="'+e.width+'" height="'+e.height+'"'+w+"></embed></object>";m.html(t);
F();break;case "ajax":a=d.split("#",2);f=e.ajax.data||{};if(a.length>1){d=a[0];if(typeof f=="string")f+="&selector="+a[1];else f.selector=a[1]}h=false;b.fancybox.showActivity();E=b.ajax(b.extend(e.ajax,{url:d,data:f,error:P,success:function(r){if(E.status==200){m.html(r);F()}}}));break;case "iframe":b('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" scrolling="'+e.scrolling+'" src="'+e.href+'"></iframe>').appendTo(m);N();break}},$=function(){if(u.is(":visible")){b("div",
u).css("top",I*-40+"px");I=(I+1)%12}else clearInterval(H)},aa=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('<div id="fancybox-tmp"></div>'),u=b('<div id="fancybox-loading"><div></div></div>'),x=b('<div id="fancybox-overlay"></div>'),g=b('<div id="fancybox-wrap"></div>'));if(!b.support.opacity){g.addClass("fancybox-ie");u.addClass("fancybox-ie")}D=b('<div id="fancybox-outer"></div>').append('<div class="fancy-bg" id="fancy-bg-n"></div><div class="fancy-bg" id="fancy-bg-ne"></div><div class="fancy-bg" id="fancy-bg-e"></div><div class="fancy-bg" id="fancy-bg-se"></div><div class="fancy-bg" id="fancy-bg-s"></div><div class="fancy-bg" id="fancy-bg-sw"></div><div class="fancy-bg" id="fancy-bg-w"></div><div class="fancy-bg" id="fancy-bg-nw"></div>').appendTo(g);
D.append(i=b('<div id="fancybox-inner"></div>'),z=b('<a id="fancybox-close"></a>'),A=b('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),B=b('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));z.click(b.fancybox.close);u.click(b.fancybox.cancel);A.click(function(a){a.preventDefault();b.fancybox.prev()});B.click(function(a){a.preventDefault();b.fancybox.next()});if(O){x.get(0).style.setExpression("height",
"document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'");u.get(0).style.setExpression("top","(-20 + (document.documentElement.clientHeight ? document.documentElement.clientHeight/2 : document.body.clientHeight/2 ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )) + 'px'");D.prepend('<iframe id="fancybox-hide-sel-frame" src="javascript:\'\';" scrolling="no" frameborder="0" ></iframe>')}}};
b.fn.fancybox=function(a){b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(d){d.preventDefault();if(!h){h=true;b(this).blur();q=[];p=0;d=b(this).attr("rel")||"";if(!d||d==""||d==="nofollow")q.push(this);else{q=b("a[rel="+d+"], area[rel="+d+"]");p=q.index(this)}C();return false}});return this};b.fancybox=function(a,d){if(!h){h=true;d=typeof d!=="undefined"?d:{};q=[];p=d.index||0;if(b.isArray(a)){for(var f=0,o=a.length;f<o;f++)if(typeof a[f]==
"object")b(a[f]).data("fancybox",b.extend({},d,a[f]));else a[f]=b({}).data("fancybox",b.extend({content:a[f]},d));q=jQuery.merge(q,a)}else{if(typeof a=="object")b(a).data("fancybox",b.extend({},d,a));else a=b({}).data("fancybox",b.extend({content:a},d));q.push(a)}if(p>q.length||p<0)p=0;C()}};b.fancybox.showActivity=function(){clearInterval(H);u.show();H=setInterval($,66)};b.fancybox.hideActivity=function(){u.hide()};b.fancybox.next=function(){return b.fancybox.pos(n+1)};b.fancybox.prev=function(){return b.fancybox.pos(n-
1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a,10);if(a>-1&&j.length>a){p=a;C()}if(c.cyclic&&j.length>1&&a<0){p=j.length-1;C()}if(c.cyclic&&j.length>1&&a>=j.length){p=0;C()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");J();e&&b.isFunction(e.onCancel)&&e.onCancel(q,p,e);h=false}};b.fancybox.close=function(){function a(){x.fadeOut("fast");g.hide();b.event.trigger("fancybox-cleanup");i.empty();b.isFunction(c.onClosed)&&c.onClosed(j,n,c);j=e=[];n=p=0;c=e={};h=false}
if(!(h||g.is(":hidden"))){h=true;if(c&&b.isFunction(c.onCleanup))if(c.onCleanup(j,n,c)===false){h=false;return}J();b(z.add(A).add(B)).hide();b("#fancybox-title").remove();g.add(i).add(x).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");i.css("overflow","hidden");if(c.transitionOut=="elastic"){k=Q();var d=g.position();l={top:d.top,left:d.left,width:g.width(),height:g.height()};if(c.opacity)l.opacity=1;y.prop=1;b(y).animate({prop:0},{duration:c.speedOut,easing:c.easingOut,
step:M,complete:a})}else g.fadeOut(c.transitionOut=="none"?0:c.speedOut,a)}};b.fancybox.resize=function(){var a,d;if(!(h||g.is(":hidden"))){h=true;a=i.wrapInner("<div style='overflow:auto'></div>").children();d=a.height();g.css({height:d+c.padding*2+v});i.css({height:d});a.replaceWith(a.children());b.fancybox.center()}};b.fancybox.center=function(){h=true;var a=K(),d=c.margin,f={};f.top=a[3]+(a[1]-(g.height()-v+40))*0.5;f.left=a[2]+(a[0]-(g.width()+40))*0.5;f.top=Math.max(a[3]+d,f.top);f.left=Math.max(a[2]+
d,f.left);g.css(f);h=false};b.fn.fancybox.defaults={padding:10,margin:20,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.3,overlayColor:"#666",titleShow:true,titlePosition:"outside",titleFormat:null,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",
easingIn:"swing",easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,onStart:null,onCancel:null,onComplete:null,onCleanup:null,onClosed:null};b(document).ready(function(){aa()})})(jQuery);

jQuery(document).ready(function($){
$("a.fancybug").fancybox({
	'type': 'iframe',
	'width': 520,
	'height': 900,
	'autoScale': false,
	'scrolling': 'no'
	});
	
$("a.fancycom").fancybox({
	'type': 'iframe',
	'width': 520,
	'height': 700,
	'autoScale': false,
	'scrolling': 'no',
	'titleShow': false
	});
	
	
$("a.fancypol").fancybox({
	'type': 'iframe',
	'width': 520,
	'height': 750,
	'autoScale': false,
	'scrolling': 'no',
	'titleShow': false
	});
	
$("a.fancybox").fancybox();     								  
    //Tabbed Panel on Home Page
    $('#tab_content div:not(".active")').hide();
    $('#tab_container ul.tabs a').click(function(){
        var tab_id = $(this).attr('id');
        $('#tab_container ul.tabs a').removeClass('active');
        $(this).addClass('active');
        $('#tab_content div').hide();
        $("#"+tab_id+"c").show();
    });

    // AJAX MailChimp Send
    $("#mailing_list_form").submit(function(){
        var data = {
            mailing_name : $('#mailing_name').val(),
            mailing_email : $('#mailing_email').val(),
            mailing_zipcode : $('#mailing_zipcode').val(),
            mailing : '1'
        };
        var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
        var emailToVal = $("#mailing_email").val();
        if($('#mailing_email').val() == '' || $('#mailing_email').val() == 'Email Address' || (!emailReg.test(emailToVal))){
            //alert('Please enter a valid email address')
            $('#mailing_list_wrapper p').replaceWith('<span style="color:red;height:28px;display:block;line-height:28px;">Please enter a valid email address.</span>');
            return false
        } else {
            $('#mailing_submit').replaceWith('<img src="images/loading.gif"/>');
            var thank_you_message = "<div id=\"mailing_list_wrapper\">";
            thank_you_message = thank_you_message + "<form method=\"post\" action=\"\" id=\"mailing_list_form\">";
            thank_you_message = thank_you_message + "<h2>SIGN UP FOR THE APEX PEST EMAIL LIST</h2>";
            thank_you_message = thank_you_message + "<p>Stay informed, get tips on keeping your home pest free, receive discounts &amp; special offers.</p>";
            thank_you_message = thank_you_message + "<div class=\"thank_you_message\">Thank you for signing up to our mailing list. You will receive an email confirming your subscription shortly.</div>";
            thank_you_message = thank_you_message + "</form>";
            thank_you_message = thank_you_message + "</div>";
            $.ajax({
                url: "/asp/list_subscribe.asp",
                type: 'POST',
                data: data,
                success: function(){
                    $('#mailing_list_wrapper').html(thank_you_message);
                }
            });
            return false;
        }
    });
    
    // AJAX Contact Form Send
    $("#contact_form").submit(function(){
        var data = {
            contact_first_name : $('#contact_first_name').val(),
            contact_last_name : $('#contact_last_name').val(),
            contact_email_address : $('#contact_email_address').val(),
            contact_phone : $('#contact_phone').val(),
            contact_message : $('#contact_message').val(),
            contact : '1'
        };
        var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
        var emailToVal = $("#contact_email_address").val();
        if($('#contact_first_name').val() == '' || $('#contact_first_name').val() == 'First Name' ||
           $('#contact_last_name').val() == '' || $('#contact_last_name').val() == 'Last Name' ||
           $('#contact_phone').val() == '' || $('#contact_phone').val() == 'Phone Number' ||
           $('#contact_email_address').val() == '' || $('#contact_email_address').val() == 'Email Address' || (!emailReg.test(emailToVal)) 
          ){
          	  $('.errormsg').detach();
          	  $('.contact_text h2').after('<p style="color:red;" class="errormsg">Please fill out your first name, last name, email address, and phone number.</p>');
              //alert('Please fill out your first name, last name, email address, and phone number');
              return false
        }else{
            $('#contact_submit').replaceWith('<img src="images/loading.gif"/>');
            $.ajax({
                type: 'POST',
                url: "asp/contact_form.asp",
                dataType: "application/x-www-form-urlencoded",
                data: data,
                async: false,
                success: function(){
                    $('#contact_form').html('<div id="thanks"><p>Thank you for contacting us; rest assured that your opinion is of great importance. We strive to respond within 24 hours of receiving requests and look forward to further communication and the opportunity to serve you.</p></div>');
                }
            });
            $('.errormsg').detach();
            return false;
        }
    });

    // AJAX Employement Form Send
    $("#employment_form").submit(function(){
        var data = {
            emp_first_name : $('#emp_first_name').val(),
            emp_last_name : $('#emp_last_name').val(),
            emp_email_address : $('#emp_email_address').val(),
            emp_phone : $('#emp_phone').val(),
            emp_job : $('#emp_job').val(),
            resumeatt : $('#emp_resume').val(),
            employment : '1'
        };
        if($('#emp_email_address').val() == '' || $('#emp_email_address').val() == 'Email Address'){
            alert('Please enter your email address')
            return false
        } else {
            $('#apply_submit').replaceWith('<img src="images/loading.gif"/>');
            $.ajax({
                url: "asp/employment_form.asp",
                type: 'POST',
                data: data,
                success: function(){
                    $('#employment_form').html('<div id="thanks"><p>Thank you for your application!</p></div>');
                }
            });
            return false;
        }
    });

    // AJAX Inspection Form Send
    $("#inspection_form").submit(function(){
    	var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
        var emailToVal = $("#inspec_email").val();
        
        var phoneReg = /^([0-9]( |-)?)?(\(?[0-9]{3}\)?|[0-9]{3})( |-)?([0-9]{3}( |-)?[0-9]{4}|[0-9]{7})$/;
        var phoneToVal = $("#inspec_phone").val();
        
        var data = {
            inspec_first_name : $('#inspec_first_name').val(),
            inspec_last_name : $('#inspec_last_name').val(),
            inspec_street : $('#inspec_street').val(),
            inspec_city : $('#inspec_city').val(),
            inspec_state : $('#inspec_state').val(),
            inspec_zip : $('#inspec_zip').val(),
            inspec_phone : $('#inspec_phone').val(),
            inspec_email : $('#inspec_email').val(),
            inspec_sqft : $('#inspec_sqft').val(),
            inspec_area : $('#inspec_area').val(),
            inspec_best_time : $('#inspec_best_time').val(),
            inspec_refer : $('#inspec_refer').val(),
            inspec_pest : $('#inspec_pest:checked').val(),
            inspec_lawn : $('#inspec_lawn:checked').val(),
            inspec_termite : $('#inspec_termite:checked').val(),
            inspec_commercial : $('#inspec_commercial:checked').val(),
            other_interest : $('#other_interest').val(),
            optin : $('#optin:checked').val(),
            offer_name : $('#offer_name').val(),
            inspection : '1'
        };
        if($('#inspec_first_name').val() == '' || $('#inspec_first_name').val() == '*First Name' ||
           $('#inspec_last_name').val() == '' || $('#inspec_last_name').val() == '*Last Name' ||
           $('#inspec_phone').val() == '' || $('#inspec_phone').val() == '*Phone Number' ||
           $('#inspec_email').val() == '' || $('#inspec_email').val() == '*Email Address' || $('#inspec_area').val() == '*Not Specified'
          ){
          	  $('.errormsg').detach();
          	  $('#fieldset_left').before('<p style="color:red;" class="errormsg">Please fill out your first name, last name, email address, phone number and select a service location.</p>');
              return false
        
        }else if(!emailReg.test(emailToVal)){
          	  $('.errormsg').detach();
          	  $('#fieldset_left').before('<p style="color:red;" class="errormsg">Please enter a valid email address.</p>');
          	  return false
          	  
        }else if(!phoneReg.test(phoneToVal)){
          	  $('.errormsg').detach();
          	  $('#fieldset_left').before('<p style="color:red;" class="errormsg">Please enter a valid phone number including area code.</p>');
          	  return false
        
        }else{
            $('#inspection_submit').replaceWith('<img src="images/loading.gif"/>');
            var thank_you_message = "<div class=\"thank_you_message\">"; 
            thank_you_message = thank_you_message + "<p>Thank you for contacting us regarding a quote/inspection. Our technicians will process your request and you can expect a phone call within 24 hours. We'll send you a confirmation e-mail shortly.<img height='1' width='1' style='border-style:none;' alt='' src='http://www.googleadservices.com/pagead/conversion/1063433518/?label=wqz0CPLS0AEQruqK-wM&amp;guid=ON&amp;script=0'/></p>";
            thank_you_message = thank_you_message + "</div>";
            $.ajax({
            	type: 'POST',
                url: "asp/quote_form.asp",
                dataType: "application/x-www-form-urlencoded",
                data: data,
                async: false,
                success: function(html){
                    $('#inspection_form').html(thank_you_message);
                }
            });
            return false;
        }
    });
    
    //the show/hide for the job openings
    $('#avail_pos ul li:first').addClass('POSactive');
    $('div.job_desc:first').addClass('POSactive');
    $('#avail_pos ul li').click(function(){
    	var index = $('#avail_pos ul li').index(this);
        $('#avail_pos ul li.POSactive').removeClass('POSactive');
        $(this).addClass('POSactive');
        var the_id = $(this).attr('id');
        var content_id = 'c'+index;
        $('div.POSactive').removeClass('POSactive');
        $('#'+content_id).addClass('POSactive');

    });

    //the show/hide for the FAQ
    $('#faq ul li:first').addClass('FAQactive');
    $('div.faq_ans:first').addClass('FAQactive');
    $('#faq ul li').click(function(){
    	var index = $('#faq ul li').index(this);
        $('#faq ul li.FAQactive').removeClass('FAQactive');
        $(this).addClass('FAQactive');
        var the_id = $(this).attr('id');
        var content_id = 'c'+index;
        $('div.FAQactive').removeClass('FAQactive');
        $('#'+content_id).addClass('FAQactive');

    });
    
    //Slideshow
    $('#slider').cycle({
        fx: 'fade',
        next: '#next_slide',
        prev: '#prev_slide',
        timeout: 10000
    });

    //What to Look For
    $('#wtlf_btns li').click(function(){
        $('#wtlf_btns li.active').removeClass('active');
        $(this).addClass('active');
        var the_id = $(this).text();
        $('#wtlf_slider div').hide();
        $('#slide' + the_id).show();
    });

    function nextslide(){
        var li_pos = $('#wtlf_btns li:last').hasClass('active');
        if(li_pos){
            $('#wtlf_btns li:first').click();
        }else{
            $('#wtlf_btns li.active').next().click();
        }
    };

    var infLoopStop = '0';
    var infLoop = null;
    $("#wtlf_btns").mouseenter(function(){
        infLoopStop = '1';
        return infLoopStop;
    });
    infLoop=function(){
        nextslide();
        if(infLoopStop == '0') {
            window.setTimeout(infLoop,6000);
        }
    };
    infLoop();

    //show/hide for Service Area
    $('ul.counties li').toggle(function(){
        $('ul.counties li ul').css('display', 'none');
        $(this).children('ul').css('display', 'block');
    }, function(){
        $(this).children('ul').css('display', 'none');
    });
    
	SI.Files.stylizeAll();    
});
