var alreadyOpen = 0;

function bookMarkTutorial(tutID, userStatus){
	if(userStatus == 0){
		//Not Signed In
		if(alreadyOpen == 0){
			showLoginDialog();
		}
	}else if(userStatus == 1){
		//Signed In
		if(alreadyOpen == 0){
			showLoginDialog();
		}
		doBookMarkTutorial(tutID);
	}
}

function hideText(el){
	if(el.value == 'Type Here'){
		el.value = '';
	}
}

function fieldCheck(oForm){
	var us = document.getElementById('us');
	var ps = document.getElementById('ps');
	if(us.value == "" || us.value == null || us.value == "Type Here"){
		alert("Username cannot be empty!");
	}else if(ps.value == "" || ps.value == null){
		alert("Password cannot be empty!");
	}
}

function hideLoginDialog(){
	var myRoot = document.getElementsByTagName('body')[0];
	myRoot.removeChild(document.getElementById('loginBox'));
	alreadyOpen = 0;
}

function resize_iframe(){

	var height=window.innerWidth;//Firefox
	var tutorialFrame = document.getElementById("tutorialFrame");
	if (document.body.clientHeight){
		height=document.body.clientHeight;//IE
	}
	tutorialFrame.style.height=parseInt(height-tutorialFrame.offsetTop)+"px";
}