function fun_confirm(form,file)
{
	var choice=confirm("Are you sure you want to delete?: " + file);
	if (choice==true)
   	{
   		document [form].submit();
   	}
}

function quickNotes_clear() {
	if(confirm("Do you really want to CLEAR the Notepad?")==true) {
		document.quickNotes.contents.value=' ';
	}
}

function quickNotes_submit() 
{
	document.quickNotes.submit();
}


	// Function: show(ID)
	// Purpose:  Display layer of element by ID
	function my_show(ID) 
	{
   	   if (document.getElementById(ID))
   	   {
      		var element = document.getElementById(ID);
      		element.style.display="block";
   	   }
	}

	// Function: hide(ID)
	// Purpose:  Hide layer of element by ID
	function my_hide(ID) 
	{
   	   if (document.getElementById(ID))
   	   {
      		var element = document.getElementById(ID);
      		element.style.display="none";
   	   }
	}


	function setScrollbarTrackColor(COLOR,ID)
	{
   	   if (document.getElementById(ID))
   	   {
      		var element = document.getElementById(ID);
		element.style.scrollbarTrackColor=COLOR;
   	   }


	}

function validateLogin()
{
	if(document.login.username.value=="")
	{
		window.alert("You must provide a username!");
	}
	else if(document.login.password.value=="")
	{
		window.alert("You must provide a password!");
	}
	else
	{
		document.login.submit();
	}
}
function validateEmail(ID)
{
	// sendto,subject,emailbody
	if(document.getElementById(ID).sendto.value=="")
	{
		window.alert("You must provide an email address!");
	}
	else if(document.getElementById(ID).subject.value=="")
	{
		window.alert("You must provide a subject!");
	}
	else if(document.getElementById(ID).emailbody.value=="")
	{
		window.alert("You must provide a message!");
	}
	else
	{
		document.getElementById(ID).submit();
	}
}

function switchToolTab(ID)
{
	// Calendar, notepad, MP3, Email, Bookmarks

	var INACTIVE = "none";
	var ACTIVE = "block";

	if(ID=="Calendar")
	{
		document.getElementById("Calendar").style.display=ACTIVE;
	}
	else
		document.getElementById("Calendar").style.display=INACTIVE;


	if(ID=="notepad")
	{
		document.getElementById("notepad").style.display=ACTIVE;
	}
	else
		document.getElementById("notepad").style.display=INACTIVE;

	if(ID=="MP3")
	{
		document.getElementById("MP3").style.display=ACTIVE;
	}
	else
		document.getElementById("MP3").style.display=INACTIVE;

	if(ID=="Email")
	{
		document.getElementById("Email").style.display=ACTIVE;
	}
	else
		document.getElementById("Email").style.display=INACTIVE;

	if(ID=="Bookmarks")
	{
		document.getElementById("Bookmarks").style.display=ACTIVE;
	}
	else
		document.getElementById("Bookmarks").style.display=INACTIVE;

}

function getViewportX()
{
	var X=0;
	if(window.innerWidth)
	{
		X=parseInt(window.innerWidth);
	}
	else if(document.documentElement.scrollWidth)
	{
		X=parseInt(document.documentElement.scrollWidth);
	}
	else if(document.body.scrollWidth)
	{
		X=parseInt(document.body.scrollWidth);
	}
	else
		X=-1;
	return X;
}

function getViewportY()
{
	var Y=0;
	if(window.innerHeight)
	{
		Y=parseInt(window.innerHeight);
	}
	else if(document.documentElement.scrollHeight)
	{
		Y=parseInt(document.documentElement.scrollHeight);
	}
	else if(document.body.scrollHeight)
	{
		Y=parseInt(document.body.scrollHeight);
	}
	else
		Y=-1;

	if(parseInt(document.body.parentNode.scrollHeight)>Y)
		Y=parseInt(document.body.parentNode.scrollHeight);

	return Y;
}

function setFullScreenBG(ID)
{
	var el=document.getElementById(ID);
	el.style.left="0px";
	el.style.top="0px";
	el.style.width=getViewportX()+"px";
	el.style.height=getViewportY()+"px";
	el.style.display="block";
	return;
}

function showAjaxEmailForm()
{
	setFullScreenBG('fullscreen');
	showEmailExpanded('emailExpanded'); // ajax
	var el=document.getElementById('emailExpanded');
	el.style.position="absolute";
	el.style.top="50px";
	el.style.left=((getViewportX()/2)-300)+"px";
	el.style.display="block";
	window.scrollTo(0,0);
	return;
}


