// JavaScript Document

/**************************************
 Ingalls Health System 
 Javascript - dropdown navigation
 ©2010 Method Engine, LLC
 www.methodengine.com
***************************************/

var navTimeout	= 500;
var navClosetimer = 0;
var navDDmenuitem = 0;
var curProjView = 1;

// open hidden layer
function mopen(tabId, id){		
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(navDDmenuitem) navDDmenuitem.style.visibility = 'hidden';
	// get new layer and show it
	if(id == "dd-web" || id == "dd-branding" || id == "dd-more" || id == "dd-copyright"){
	  navDDmenuitem = document.getElementById(id);
	  navDDmenuitem.style.visibility = 'visible';
	}
}

function resetBkImgs(){
	if(document.getElementById('web-tab') != null){
		 document.getElementById('web-tab').className = "norm";
		 document.getElementById('branding-tab').className = "norm";
		 document.getElementById('more-tab').className = "norm";
		 document.getElementById('copyright-tab').className = "norm";
	}
}

// close showed layer
function mclose(){
	resetBkImgs();
	if(navDDmenuitem) navDDmenuitem.style.visibility = 'hidden';
}

// go close timer
function mclosetime(){
	navClosetimer = window.setTimeout(mclose, navTimeout);
}

// cancel close timer
function mcancelclosetime(){
	if(navClosetimer)
	{
		window.clearTimeout(navClosetimer);
		navClosetimer = null;
	}
}

// close layer when click-out


function showDiv(id){
	document.getElementById(id).className = "show";
	if(id == "appointBoxInner"){
		document.getElementById("appoint_name").value = "";	
		document.getElementById("appoint_phone").value = "";	
		document.getElementById("appoint_email").value = "";	
		document.getElementById("appoint_message").value = "";	
	}
}
function hideDiv(id){
	document.getElementById(id).className = "hide";
}
function showVid(num, myFLV){
	vidNum = num;
	curStageImg = document.getElementById('bluestage_'+vidNum).src;
	document.getElementById('bluestage_'+vidNum).src = 'imgs/bluestage.jpg';
	//alert(curStageImg);
	playingVideo = 1;
	vidID = "myVid_" + vidNum;
	newID = "#"+vidID;
	$(newID).flash({swf:'flash/vplayer.swf', width: 545,height: 307, flashvars: { flvName: myFLV}});
}

function hideVid(id1, id2){
	newID = "#"+id2;
	$(newID).flash().remove();
}

function hideMe(id){
	document.getElementById(id).className = 'drinfo hide';
}
function showMe(id){
	document.getElementById(id).className = 'drinfo show';
}

function toggleCE(num){
	id1 = "class_"+num;
	id2 = "classDetail_"+num;
	id3 = "icon_"+num;
	curName = document.getElementById(id1).className;

	if(curName == "oneCE"){
		document.getElementById(id1).className = "oneCE-selected";
		document.getElementById(id2).className = "show";
		document.getElementById(id3).src = "imgs/minus.gif";
	}else{
		document.getElementById(id1).className = "oneCE";
		document.getElementById(id2).className = "hide";
		document.getElementById(id3).src = "imgs/plus.gif";
	}
}

function toggleItm(toggleItm){
	imgId = "icon-" + toggleItm; 
	divId = "accord-" + toggleItm; 
	
	if(document.getElementById(divId).className == "hide"){
		document.getElementById(imgId).src = "imgs/minus.gif";
		document.getElementById(divId).className = "show";
	}else{
		document.getElementById(imgId).src = "imgs/plus.gif";
		document.getElementById(divId).className = "hide";
	}
}


$(document).ready(function() {						
		$('#info').click(function(){
			var coverCurrentMarginLeft = $(".cover", $('.captionfull')).css("margin-left");
			//alert(coverCurrentMarginLeft);
			if(coverCurrentMarginLeft == '-300px'){
				$(".cover").animate({marginLeft:'0px'}, 'fast');
				
			}else {
				$(".cover", $('.captionfull')).stop().animate({marginLeft:'-300px'}, 'fast');
			}
		});
		
	
		$("#pulldownMenu").click(function(){
			var everthingCurrentMarginTop = $('#everything').css("margin-top");
			if(everthingCurrentMarginTop == '0px'){
				$('#everything').animate({marginTop:'-310px'}, 'slow');
			}else {
				$('#everything').stop().animate({marginTop:'0px'}, 'slow');
			}
		});
		
		$("#close").click(function(){
			$('#everything').animate({marginTop:'-310px'}, 'slow');
	   });
		
		$('#nextproject').hover(function() {
			$('#nextproject').stop().animate({'paddingRight':'0'}, 'fast');
			}, function() {
			$('#nextproject').stop().animate({'paddingRight':'10'}, 'fast');
			});
		
		
		
					
});

