(function($) {
	$(document).ready(function() {
		ddBayArea();									// controls drop-down for Bay Area High-Tech Home
		tabs();
		css();											// function inside of the file, css.js, for general css purposes to make use of jQuery selectors if applicable
		//$("#homeSelect").css({left:"521px"});
		
		// Call sIFR text replacement
		if(typeof sIFR == "function"){
		    sIFR();
		}
	});
	
	
	/* ------------------------------------- Global Vars --------------------------------------------*/
	var dropDownState = 0;
	
	
	/* ----------------------------- DROP DOWN ------------------------------------------------------------------- */											
	function ddBayArea(){
		$("#canvas").click(function() {
			$("#logo #homeSelect ul").slideUp("fast");
		});
		
		$("#logo div#homeSelect").click(function() {
			if (dropDownState == 0) {
				$("#logo #homeSelect ul").slideDown("fast");
				dropDownState = 1;
				return false;
			} else {
				$("#logo #homeSelect ul").slideUp("fast");
				dropDownState = 0;
			}
			
		});
		
		$("#logo div#homeSelect").mouseover(function(){
			$(this).css({cursor:"hand",cursor:"pointer"});
		});
	}
	
	/* ----------------------------- TABS (introduction, photo navigation, video gallery) ----------------------- */
	function tabs(){
		x = window.location;
		x = x.toString();
		var currentTab;
		if(x.indexOf("photoGallery") > -1){
			currentTab = $("#tabs > #photo").get(0);
			$("#tabs > #photo").addClass("tabOn");
		}else if(x.indexOf("video") > -1){
			currentTab = $("#tabs > #video").get(0);
			$("#tabs > #video").addClass("tabOn");
		}else{
			currentTab = $("#tabs > #intro").get(0);
			$("#tabs > #intro").addClass("tabOn");
		}
		
		$("#tabs > .tab").hover(
			function() {
				$(this).addClass("tabOn");
			},
			function() {
				if (currentTab != this) {
					$(this).removeClass("tabOn");
				}
			}
		);
		
		$("#tabs > .tab").click(function() {
			window.location = $(this).find("a").attr("href");
		});
	}

})(jQuery);
