$(document).ready(function(){$("ul.subnav").parent().append("<span></span>");$("ul.topnav li a.topnav-has-children").hover(function(){$(this).parent().find("ul.subnav").slideDown("fast").show();$(this).parent().hover(function(){},function(){$(this).parent().find("ul.subnav").slideUp("slow")})}).hover(function(){$(this).addClass("subhover")},function(){$(this).removeClass("subhover")});$("ul.topnav li span").click(function(){$(this).parent().find("ul.subnav").slideDown("fast").show();$(this).parent().hover(function(){},function(){$(this).parent().find("ul.subnav").slideUp("slow")})}).hover(function(){$(this).addClass("subhover")},function(){$(this).removeClass("subhover")})});jQuery.fn.boxy=function(a){a=a||{};return this.each(function(){var c=this.nodeName.toLowerCase(),b=this;if(c=="a"){jQuery(this).click(function(){var h=Boxy.linkedTo(this),e=this.getAttribute("href"),g=jQuery.extend({actuator:this,title:this.title},a);if(h){h.show()}else{if(e.indexOf("#")>=0){var f=jQuery(e.substr(e.indexOf("#"))),d=f.clone(true);f.remove();g.unloadOnHide=false;new Boxy(d,g)}else{if(!g.cache){g.unloadOnHide=true}Boxy.load(this.href,g)}}return false})}else{if(c=="form"){jQuery(this).bind("submit.boxy",function(){Boxy.confirm(a.message||"Please confirm:",function(){jQuery(b).unbind("submit.boxy").submit()});return false})}}})};function Boxy(b,a){this.boxy=jQuery(Boxy.WRAPPER);jQuery.data(this.boxy[0],"boxy",this);this.visible=false;this.options=jQuery.extend({},Boxy.DEFAULTS,a||{});if(this.options.modal){this.options=jQuery.extend(this.options,{center:true,draggable:false})}if(this.options.actuator){jQuery.data(this.options.actuator,"active.boxy",this)}this.setContent(b||"<div></div>");this._setupTitleBar();this.boxy.css("display","none").appendTo(document.body);this.toTop();if(this.options.fixed){if(jQuery.browser.msie&&jQuery.browser.version<7){this.options.fixed=false}else{this.boxy.addClass("fixed")}}if(this.options.center&&Boxy._u(this.options.x,this.options.y)){this.center()}else{this.moveTo(Boxy._u(this.options.x)?this.options.x:Boxy.DEFAULT_X,Boxy._u(this.options.y)?this.options.y:Boxy.DEFAULT_Y)}if(this.options.show){this.show()}}Boxy.EF=function(){};jQuery.extend(Boxy,{WRAPPER:"<table cellspacing='0' cellpadding='0' border='0' class='boxy-wrapper'><tr><td class='top-left'></td><td class='top'></td><td class='top-right'></td></tr><tr><td class='left'></td><td class='boxy-inner'></td><td class='right'></td></tr><tr><td class='bottom-left'></td><td class='bottom'></td><td class='bottom-right'></td></tr></table>",DEFAULTS:{title:null,closeable:true,draggable:true,clone:false,actuator:null,center:true,show:true,modal:false,fixed:true,closeText:"[close]",unloadOnHide:false,clickToFront:false,behaviours:Boxy.EF,afterDrop:Boxy.EF,afterShow:Boxy.EF,afterHide:Boxy.EF,beforeUnload:Boxy.EF},DEFAULT_X:50,DEFAULT_Y:50,zIndex:1337,dragConfigured:false,resizeConfigured:false,dragging:null,load:function(b,a){a=a||{};var c={url:b,type:"GET",dataType:"html",cache:false,success:function(d){d=jQuery(d);if(a.filter){d=jQuery(a.filter,d)}new Boxy(d,a)}};jQuery.each(["type","cache"],function(){if(this in a){c[this]=a[this];delete a[this]}});jQuery.ajax(c)},get:function(a){var b=jQuery(a).parents(".boxy-wrapper");return b.length?jQuery.data(b[0],"boxy"):null},linkedTo:function(a){return jQuery.data(a,"active.boxy")},alert:function(b,c,a){return Boxy.ask(b,["OK"],c,a)},confirm:function(b,c,a){return Boxy.ask(b,["OK","Cancel"],function(d){if(d=="OK"){c()}},a)},ask:function(c,f,j,l){l=jQuery.extend({modal:true,closeable:false},l||{},{show:true,unloadOnHide:true});var e=jQuery("<div></div>").append(jQuery('<div class="question"></div>').html(c));var a={},h=[];if(f instanceof Array){for(var d=0;d<f.length;d++){a[f[d]]=f[d];h.push(f[d])}}else{for(var b in f){a[f[b]]=b;h.push(f[b])}}var g=jQuery('<form class="answers"></form>');g.html(jQuery.map(h,function(i){return"<input type='button' value='"+i+"' />"}).join(" "));jQuery("input[type=button]",g).click(function(){var i=this;Boxy.get(this).hide(function(){if(j){j(a[i.value])}})});e.append(g);new Boxy(e,l)},isModalVisible:function(){return jQuery(".boxy-modal-blackout").length>0},_u:function(){for(var a=0;a<arguments.length;a++){if(typeof arguments[a]!="undefined"){return false}}return true},_handleResize:function(a){var b=jQuery(document);jQuery(".boxy-modal-blackout").css("display","none").css({width:b.width(),height:b.height()}).css("display","block")},_handleDrag:function(a){var b;if(b=Boxy.dragging){b[0].boxy.css({left:a.pageX-b[1],top:a.pageY-b[2]})}},_nextZ:function(){return Boxy.zIndex++},_viewport:function(){var e=document.documentElement,a=document.body,c=window;return jQuery.extend(jQuery.browser.msie?{left:a.scrollLeft||e.scrollLeft,top:a.scrollTop||e.scrollTop}:{left:c.pageXOffset,top:c.pageYOffset},!Boxy._u(c.innerWidth)?{width:c.innerWidth,height:c.innerHeight}:(!Boxy._u(e)&&!Boxy._u(e.clientWidth)&&e.clientWidth!=0?{width:e.clientWidth,height:e.clientHeight}:{width:a.clientWidth,height:a.clientHeight}))}});Boxy.prototype={estimateSize:function(){this.boxy.css({visibility:"hidden",display:"block"});var a=this.getSize();this.boxy.css("display","none").css("visibility","visible");return a},getSize:function(){return[this.boxy.width(),this.boxy.height()]},getContentSize:function(){var a=this.getContent();return[a.width(),a.height()]},getPosition:function(){var a=this.boxy[0];return[a.offsetLeft,a.offsetTop]},getCenter:function(){var b=this.getPosition();var a=this.getSize();return[Math.floor(b[0]+a[0]/2),Math.floor(b[1]+a[1]/2)]},getInner:function(){return jQuery(".boxy-inner",this.boxy)},getContent:function(){return jQuery(".boxy-content",this.boxy)},setContent:function(a){a=jQuery(a).css({display:"block"}).addClass("boxy-content");if(this.options.clone){a=a.clone(true)}this.getContent().remove();this.getInner().append(a);this._setupDefaultBehaviours(a);this.options.behaviours.call(this,a);return this},moveTo:function(a,b){this.moveToX(a).moveToY(b);return this},moveToX:function(a){if(typeof a=="number"){this.boxy.css({left:a})}else{this.centerX()}return this},moveToY:function(a){if(typeof a=="number"){this.boxy.css({top:a})}else{this.centerY()}return this},centerAt:function(a,c){var b=this[this.visible?"getSize":"estimateSize"]();if(typeof a=="number"){this.moveToX(a-b[0]/2)}if(typeof c=="number"){this.moveToY(c-b[1]/2)}return this},centerAtX:function(a){return this.centerAt(a,null)},centerAtY:function(a){return this.centerAt(null,a)},center:function(b){var a=Boxy._viewport();var c=this.options.fixed?[0,0]:[a.left,a.top];if(!b||b=="x"){this.centerAt(c[0]+a.width/2,null)}if(!b||b=="y"){this.centerAt(null,c[1]+a.height/2)}return this},centerX:function(){return this.center("x")},centerY:function(){return this.center("y")},resize:function(b,a,d){if(!this.visible){return}var c=this._getBoundsForResize(b,a);this.boxy.css({left:c[0],top:c[1]});this.getContent().css({width:c[2],height:c[3]});if(d){d(this)}return this},tween:function(c,a,e){if(!this.visible){return}var d=this._getBoundsForResize(c,a);var b=this;this.boxy.stop().animate({left:d[0],top:d[1]});this.getContent().stop().animate({width:d[2],height:d[3]},function(){if(e){e(b)}});return this},isVisible:function(){return this.visible},show:function(){if(this.visible){return}if(this.options.modal){var a=this;if(!Boxy.resizeConfigured){Boxy.resizeConfigured=true;jQuery(window).resize(function(){Boxy._handleResize()})}this.modalBlackout=jQuery('<div class="boxy-modal-blackout"></div>').css({zIndex:Boxy._nextZ(),opacity:0.7,width:jQuery(document).width(),height:jQuery(document).height()}).appendTo(document.body);this.toTop();if(this.options.closeable){jQuery(document.body).bind("keypress.boxy",function(b){var c=b.which||b.keyCode;if(c==27){a.hide();jQuery(document.body).unbind("keypress.boxy")}})}}this.boxy.stop().css({opacity:1}).show();this.visible=true;this._fire("afterShow");return this},hide:function(b){if(!this.visible){return}var a=this;if(this.options.modal){jQuery(document.body).unbind("keypress.boxy");this.modalBlackout.animate({opacity:0},function(){jQuery(this).remove()})}this.boxy.stop().animate({opacity:0},300,function(){a.boxy.css({display:"none"});a.visible=false;a._fire("afterHide");if(b){b(a)}if(a.options.unloadOnHide){a.unload()}});return this},toggle:function(){this[this.visible?"hide":"show"]();return this},hideAndUnload:function(a){this.options.unloadOnHide=true;this.hide(a);return this},unload:function(){this._fire("beforeUnload");this.boxy.remove();if(this.options.actuator){jQuery.data(this.options.actuator,"active.boxy",false)}},toTop:function(){this.boxy.css({zIndex:Boxy._nextZ()});return this},getTitle:function(){return jQuery("> .title-bar h2",this.getInner()).html()},setTitle:function(a){jQuery("> .title-bar h2",this.getInner()).html(a);return this},_getBoundsForResize:function(c,a){var b=this.getContentSize();var e=[c-b[0],a-b[1]];var d=this.getPosition();return[Math.max(d[0]-e[0]/2,0),Math.max(d[1]-e[1]/2,0),c,a]},_setupTitleBar:function(){if(this.options.title){var b=this;var a=jQuery("<div class='title-bar'></div>").html("<h2>"+this.options.title+"</h2>");if(this.options.closeable){a.append(jQuery("<a href='#' class='close'></a>").html(this.options.closeText))}if(this.options.draggable){a[0].onselectstart=function(){return false};a[0].unselectable="on";a[0].style.MozUserSelect="none";if(!Boxy.dragConfigured){jQuery(document).mousemove(Boxy._handleDrag);Boxy.dragConfigured=true}a.mousedown(function(c){b.toTop();Boxy.dragging=[b,c.pageX-b.boxy[0].offsetLeft,c.pageY-b.boxy[0].offsetTop];jQuery(this).addClass("dragging")}).mouseup(function(){jQuery(this).removeClass("dragging");Boxy.dragging=null;b._fire("afterDrop")})}this.getInner().prepend(a);this._setupDefaultBehaviours(a)}},_setupDefaultBehaviours:function(a){var b=this;if(this.options.clickToFront){a.click(function(){b.toTop()})}jQuery(".close",a).click(function(){b.hide();return false}).mousedown(function(c){c.stopPropagation()})},_fire:function(a){this.options[a].call(this)}};var headline_count;var headline_interval;var old_headline=0;var current_headline=0;var sn_pause=8000;$(document).ready(function(){headline_count=$("div.headline").size();$("div.headline:eq("+current_headline+")").css("top","5px");headline_interval=setInterval(headline_rotate,sn_pause);$("#scrollup").hover(function(){clearInterval(headline_interval)},function(){headline_interval=setInterval(headline_rotate,sn_pause);headline_rotate()})});function headline_rotate(){current_headline=(old_headline+1)%headline_count;$("div.headline:eq("+old_headline+")").animate({top:-205},"slow",function(){$(this).css("top","210px")});$("div.headline:eq("+current_headline+")").animate({top:5},"slow");old_headline=current_headline}$(function(){var b=null;var a=null;$("#BtnClient").click(function(){a=new Boxy.ask("<form id='client-login'><strong>Username:</strong><br /><br /><input type='text' name='userid'><strong>Password:</strong><br /><br /><input type='password' name='password'></form>",["Login","Close"],function(c){if(c=="Login"){alert("Invalid Username or Password\n Please Try Again")}},{title:"Client Portal Login"});return false});$("#Email2Friend").click(function(){b=new Boxy.load("/boxy-form-email2friend.php?t="+$("#cPageTitle").val(),{title:"Email a Friend",draggable:false,modal:true,behaviours:function(d){d.find("#form-e2f").submit(function(){var e=d.find("#Yemail").val();var c=d.find("#Femail").val();if(echeck(c)&&echeck(c)){Boxy.get(this).setContent("<div id='e2f-container' style='text-align: center;'>SENDING<br /><img src=\"/images/forms/form-loading-anim.gif\"></div>");$.post("/ajax/email2friend-submit.php",{Subject:$("#cPageTitle").val(),pUrl:$("#cPageURL").val(),Yname:d.find("#Yname").val(),Yemail:d.find("#Yemail").val(),Femail:d.find("#Femail").val(),Fname:d.find("#Fname").val(),Comment:d.find("#Comment").val()},function(f){$("#e2f-container").html("<div id='e2f-container'>"+f+"</div>")})}return false})}});return false})});function echeck(g){var f="Invalid Email Addresses";var a="@";var b=".";var e=g.indexOf(a);var c=g.length;var d=g.indexOf(b);if(g.indexOf(a)==-1){alert(f);return false}if(g.indexOf(a)==-1||g.indexOf(a)==0||g.indexOf(a)==c){alert(f);return false}if(g.indexOf(b)==-1||g.indexOf(b)==0||g.indexOf(b)==c){alert(f);return false}if(g.indexOf(a,(e+1))!=-1){alert(f);return false}if(g.substring(e-1,e)==b||g.substring(e+1,e+2)==b){alert(f);return false}if(g.indexOf(b,(e+2))==-1){alert(f);return false}if(g.indexOf(" ")!=-1){alert(f);return false}return true}$(function(){$("#s").focus(function(){if($(this).val()=="Search our website ..."){$(this).val("");$(this).addClass("wtext")}});$("#s").blur(function(){if($(this).val()==""){$(this).val("Search our website ...");$(this).removeClass("wtext")}});$("#AddFav").click(function(){bookmarksite();return false})});function bookmarksite(){if(document.all){window.external.AddFavorite(location.href,document.title)}else{if(window.sidebar){window.sidebar.addPanel(document.title,location.href,"")}}};
