function ConfirmLogout() 
{
	var input=confirm("Are you sure you want to logout?");
	if (input) 
	{
		document.logoutForm.submit();
	}
}

function ConfirmDelete(what) 
{
	var extra="";
	if (what=="folder")
	{
		extra=" (all bookmarks in this folder will be deleted)";
	}
	var input=confirm("Are you sure you want to delete this "+what+extra+"?");
	if (input) 
	{
		return true;
	}
	else
	{
		return false;
	}
}

function login_validation()
{
	if (document.forms['login_form'].elements['user_name'].value=="")
	{
		alert("Enter your user name");
		document.forms['login_form'].elements['user_name'].focus();
		return false;
	}
	else if (document.forms['login_form'].elements['pass'].value=="")
	{
		alert("Enter your password");
		document.forms['login_form'].elements['pass'].focus();
		return false;
	}
	else
		return true;
}

//this is for the color fade in of a message box (on the main page)
var rcolor=255;
var gcolor=255;
var bcolor=255;
var userRcolor;
var userGcolor;
var userBcolor;
function fade_text(to_fade,end_color)
{
	if (end_color)//this is the first time the function is called
	{
		if (end_color.indexOf('#')!=-1)//we have the # at the beginning
		{
			userRcolor=end_color.substring(1,3)
			userGcolor=end_color.substring(3,5)
			userBcolor=end_color.substring(5,7)
		}
		else
		{
			userRcolor=end_color.substring(0,2)
			userGcolor=end_color.substring(2,4)
			userBcolor=end_color.substring(4,6)
		}
		//convert the hex to decimal
		userRcolor = parseInt(userRcolor, 16);
		userGcolor = parseInt(userGcolor, 16);
		userBcolor = parseInt(userBcolor, 16);
	}
	document.getElementById(to_fade).style.color="rgb("+rcolor+","+gcolor+","+bcolor+")"; 
	var go_again=0;
	if (rcolor>userRcolor)
	{
		go_again=1;
		rcolor=rcolor-4;
	}
	
	if (gcolor>userGcolor)
	{
		go_again=1;
		gcolor=gcolor-4;
	}
	
	if (bcolor>userBcolor)
	{
		go_again=1;
		bcolor=bcolor-4;
	}

	if(go_again)
	{
		setTimeout('fade_text("'+to_fade+'")',11);
	}
}
