var curHome = 1; $(document).ready(function() { /* HANDLE TOGGLE VALUES IN INPUT BOXES */ var x = 0; $(".toggle").each(function() { togglevals[x] = $(this).val(); $(this).attr({"togglenum":x}); x++; }); $(".toggle").click(function() { var togglenum = $(this).attr("togglenum"); if ($(this).val() == togglevals[togglenum]) $(this).val(""); }); $(".toggle").bind("blur",function() { var togglenum = $(this).attr("togglenum"); if ($(this).val() == '') $(this).val(togglevals[togglenum]); }); /* END TOGGLE BOX HANDLING */ /* HANDLE HOVER EFFECTS */ $(".fade").css({"opacity":0.5}); $(".fade").hover(function() { $(this).fadeTo("slow",0.9); },function() { $(this).fadeTo("fast",0.5); }); /* END HOVER EFFECTS */ /* SCROLL TO TOP */ $('a[href=#top]').click(function(){ $('html, body').animate({scrollTop:0}, 'slow'); return false; }); $(".colorbox").colorbox(); /* HOME INTERACT */ if ($("#homeInteract").length > 0) { $("#homeInteract a").click(function() { var id = $(this).attr("id").replace("interact_r",""); if (id != curHome && id != 4) { $("#homel"+curHome).fadeOut("normal",null); $("#homel"+id).fadeIn("normal",null); $("#interact_r"+curHome+" img").attr({"src":"/images/homeR"+curHome+".png"}); $("#interact_r"+id+" img").attr({"src":"/images/on/homeR"+id+".png"}); curHome = id; } if (id != 4) return false; }); } /* HANDLE HOVER IMAGE CHANGES */ $(".flip").hover(function() { if ($(this).attr("class").indexOf("flip") < 0) return false; if ($(this).attr("src").indexOf("images/images/") < 0) { $(this).attr({"src":$(this).attr("src").replace("images/","images/images/")}); } },function() { if ($(this).attr("class").indexOf("flip") < 0) return false; $(this).attr({"src":$(this).attr("src").replace("images/images/","images/")}); }); /* END HOVER IMAGE CHANGES */ /* OUR PEOPLE */ if ($("#ourPeople").length > 0) { $("#ourPeople div.box").hover(function() { var i = $(this).attr("id"); $("#"+i+" img.off").fadeOut("normal",null); $("#"+i+" img.on").fadeIn("normal",null); },function() { var i = $(this).attr("id"); $("#"+i+" img.off").fadeIn("normal",null); $("#"+i+" img.on").fadeOut("normal",null); }); } }); /* AUTO ROTATING PHOTOS */ var g_curpic = 1; var g_maxpics = 3; var g_pictimer = ''; function rotateMainPic() { if (g_pictimer != '') clearTimeout(g_pictimer); $("#pic"+g_curpic).fadeOut("slow",null); g_curpic++; if (g_curpic > g_maxpics) g_curpic = 1; $("#pic"+g_curpic).fadeIn("slow",function() { g_pictimer = setTimeout("rotateMainPic()",7000); }); } /* END AUTO ROTATING PHOTOS */ /* SWAP PHOTO */ function showSwapPhoto(id,direction) { if (id == null) { var ids = getNextAndPrevPhoto(); id = ids[direction]; if (id == undefined) return false; } $('.swapGallery img:visible').hide(); $('#photo-'+id).show(); $("#galleryTop .right a").removeClass("selected"); $("#galleryTop .right a#link-"+id).addClass("selected"); getNextAndPrevPhoto(); return false; } function getNextAndPrevPhoto() { var cur = $("#galleryTop .right a.numLink").index($(".selected")); var max = $("#galleryTop .right a.numLink").length; if (max == 1 || cur == -1) $("#nextPhotoLink, #prevPhotoLink").hide(); else { var next = cur+1; var prev = cur-1; if (next < max) { var nextImgId = $("#galleryTop .right a.numLink:eq("+next+")").attr("id").replace("link-",""); if (nextImgId*1 == 0) $("#nextPhotoLink").addClass("disabled"); else $("#nextPhotoLink").removeClass("disabled"); } else $("#nextPhotoLink").addClass("disabled"); if (prev >= 0) { var prevImgId = $("#galleryTop .right a.numLink:eq("+prev+")").attr("id").replace("link-",""); if (prevImgId*1 == 0) $("#prevPhotoLink").addClass("disabled"); else $("#prevPhotoLink").removeClass("disabled"); } else $("#prevPhotoLink").addClass("disabled"); } return [prevImgId,nextImgId]; } /* END SWAP PHOTO */