// JavaScript Document

$(document).ready(function() {

	//	sets my static header and footer
	//	$("#header").pinFooter();
	/*
	var height = parseInt( document.getElementById('container').offsetHeight);
	var window_height = getWindowHeight();
	if( window_height > height) {
		height = window_height;
	}
	$("#navigation").css("height",height + "px");
	*/
	
	/*
	var all_status = get_cookie( "all" );
	check_all_status();
	
	//	handles sub navigation display
	$("#nav_switch").click(function(){
		if( $(this).html() == "[Show All]" ) {
			show_sub_nav();
			show_sub_sub_nav();
			set_cookie( "all", 1, 7 );
			$(this).html("[Hide All]");
		} else {
			hide_sub_nav();
			hide_sub_sub_nav();
			$("." + MAINPAGE).show();
			$("." + SUBPAGE).show();
			set_cookie( "all", 0, 7 );
			$(this).html("[Show All]");
		}
	});
	*/
	
	//	handles sub sub navigation display
	if( PAGE == "DSP 嵌入式信号处理" || PAGE == "DSP Invention 发明" || PAGE == "DSP Business 业务介绍" ) {
		$(".DSP嵌入式信号处理").css("color","#ffcc00");
		$("#sub_sub_nav_DSPInvention发明").show();
		$("#sub_sub_nav_DSPBusiness业务介绍").show();
	} else if( PAGE == "Async 高速可编程逻辑" || PAGE == "Async Invention 发明" ) {
		$(".Async高速可编程逻辑").css("color","#ffcc00");
		$("#sub_sub_nav_AsyncInvention发明").show();
	} else if( PAGE == "MHE 微米热交换" || PAGE == "Inventor 孟文晋" ) {
		$(".MHE微米热交换").css("color","#ffcc00");
		$("#sub_sub_nav_Inventor孟文晋").show();
	} else if( PAGE == "WX《世界变迁》" || PAGE == "World Transformations" ) {
		$(".WX《世界变迁》").css("color","#ffcc00");
		$("#sub_sub_nav_WorldTransformations").show();
	} else if( PAGE == "BioPharm 生物制药" || PAGE == "Inventor 丘小庆 李荣旗" ) {
		$(".BioPharm生物制药").css("color","#ffcc00");
		$("#sub_sub_nav_Inventor丘小庆李荣旗").show();
	}
	
	/*
	function hide_sub_nav() {
		$(".sub_nav").hide();
	}
	
	function show_sub_nav() {
		$(".sub_nav").show();
	}
	
	function hide_sub_sub_nav() {
		$(".sub_sub_nav").hide();
	}
	
	function show_sub_sub_nav() {
		$(".sub_sub_nav").show();
	}
	
	function check_all_status() {
		if( all_status == 1 ) {
			show_sub_nav();
			show_sub_sub_nav();
			$("#nav_switch").html("[Hide All]");
		}
	}
	*/
	
	//	lightbox gallery for events
	$('.event a').lightBox();
	
});

/*
$(window).resize(function() {
	$("#header").pinFooter();
});
*/

// Dependable function to get Window Height
/*
function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
};
*/

/*
function set_cookie( c_name, value, expiredays ) {
	var exdate = new Date();
	exdate.setDate( exdate.getDate() + expiredays );
	document.cookie = c_name + "=" + escape( value ) + ( ( expiredays == null ) ? "" : ";expires=" + exdate.toUTCString() );
}

function get_cookie( c_name ) {
	if( document.cookie.length > 0 ) {
		c_start = document.cookie.indexOf( c_name + "=" );
		if( c_start != -1 ) {
			c_start = c_start + c_name.length + 1;
			c_end = document.cookie.indexOf( ";", c_start );
			if( c_end == -1 ) {
				c_end = document.cookie.length;
			}
		return unescape( document.cookie.substring( c_start, c_end ) );
		}
	}
	return "";
}
*/
