$(document).ready(function(){

var ur = $.jqURL.url();
var spur = ur.split('#');
var bio = spur[1];
var bio2 = "#"+bio;
$('.boardDesc').parents('.inthenews').addClass('hide');
$('#boardTop div a').each(function(){
	var h = $(this).attr('href');
	//alert(h);
	$(this).removeClass('selectedMember');
	if(bio2 == h){
		//alert('#box_'+bio);
		$(this).addClass('selectedMember');
	  $('#box_'+bio).removeClass('hide');	
	}
});



	$('#boardTop div a').click(function(){
		if (!$(this).hasClass('disabled')) {
			var bID = $(this).attr('href');
			var sID = bID.substr(1);
			if($(this).hasClass('selectedMember') == true){
				$('#boardTop div a').removeClass('selectedMember');
				$('.boardDesc').addClass('hide');
			} else {
				$('#boardTop div a').removeClass('selectedMember');
				$(this).addClass('selectedMember');
				$('.boardDesc').addClass('hide');
				$('#box_'+sID).removeClass('hide');
			}
		}
	});


	$('#inTheNewsTopBox a, #emailArticleTopBox a').click(function(){
		$('#inTheNewsTopBox a,#emailArticleTopBox a').removeClass('selected').addClass('normal');
		$(this).removeClass('normal').addClass('selected');
		var sID = $(this).attr('id');
		//alert(sID);
		$('#inTheNewsBottomBox div, #emailArticleBottomBox div').addClass('hide');
		$('#box_'+sID).removeClass('hide');
		return false;
	});
	$('#glossaryMenu ul li a').click(function(){
		$('#glossaryMenu ul li a').removeClass('active');
		$(this).addClass('active');
		var sID = $(this).attr('id');
		$('.glossaryBox').addClass('hide');
		$('#box_'+sID).removeClass('hide');
	});
	$('#articleMenus a').click(function(){
		var sID = $(this).attr('id');
		//alert(sID);
		$('.articleBox').addClass('hide');
		$('#box_'+sID).removeClass('hide');

	});
	$('.sideMenuItem a').click(function(){
		$('.sideMenuItem').removeClass('active');
		$(this).parent().addClass('active');
	}).hover(function(){
		//$('.sideMenuItem').removeClass('active');
		$(this).parent().addClass('active');
	},function(){
		$(this).parent().removeClass('active');
	});
	
	
	
	
	/**VIDEO PAGE**/
	if(bio != ''){//IS there something in the url /videolibrary#blah
		if($('#articleMenus').length>0){//as long as the page as the id
			$('#box_'+bio).removeClass('hide');
		}
	}
	
	
	$('.movieBox a.moviePlay').live('click',function(){
		$('#modal_background').show();
		$('#video_player').show();
	});
	
	
	
	$('#close-player,#modal_background').live('click',function(){
		//$('#player').sendEvent("STOP");
		//player.sendEvent("STOP");
		player.sendEvent("stop");
		$('#video_player').hide();
		$('#modal_background').hide();
		
	});
	$('#emailSignup').live('submit',function(){
		var strError ="";
		var strName = $('input[name=name]').val();
		if(fVerifyEmpty(strName)){
			strError +="";
		} else {
			strError += "Please enter name.\r\n";
		}
		
		var strCo = $('input[name=company]').val();
		if(fVerifyEmpty(strCo)){
			strError +="";
		} else {
			strError += "Please enter company.\r\n";
		}
		
		var strTitle = $('input[name=title]').val();
		if(fVerifyEmpty(strTitle)){
			strError +="";
		} else {
			strError += "Please enter title.\r\n";
		}
		
		var strEmail = $('input[name=email]').val();
		//alert(strEmail);
		if(fVerifyEmail(strEmail)){
			strError +="";
		} else {
			strError += "Please enter valid email.\r\n"
		}
		if(strError != ""){
			alert(strError);
			return false;
		} else {
			return true;
		}
	});





});
