// Example:
// writeCookie("myCookie", "my name", 24);
// Stores the string "my name" in the cookie "myCookie" which expires after 24 hours.
/*function writeCookie(name, value, hours)
{
  var expire = "";
  if(hours != null)
  {
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire;
}*/

var againValue;

function changeUser(){
	if(document.getElementById){
		document.getElementById("loginUser").style.display='none';
		document.getElementById("chooseUser").style.display='inline';
		document.getElementById("chooseUser").focus();
		document.getElementById("chooseUser").select();
		document.getElementById("changeUserButon").style.display='none';
		return false;
	} else {
		return true;
	}
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function doMove() {
	var foo = document.getElementById("info")
	
	if(setTimeout){
		if(foo.style.height != '1px'){
			foo.style.height = (parseInt(foo.style.height)-5)+'px';
			
			if(foo.style.padding != '0px') foo.style.padding = (parseInt(foo.style.padding)-1)+'px';
			if(foo.style.marginBottom != '0px') foo.style.marginBottom = (parseInt(foo.style.marginBottom)-1)+'px';
			if(foo.style.marginTop != '0px') foo.style.marginTop = (parseInt(foo.style.marginTop)-1)+'px';
			
			setTimeout(doMove,30);
		} else {
			foo.style.display = 'none';
			setHideCookie();
		}
	} else {
		foo.style.display = 'none';
		setHideCookie();
	}
}

function setHideCookie(){
//	alert(againValue);
	if(againValue === true){
		eraseCookie("remember");
		eraseCookie("hide");
	} else {
		createCookie("hide", "", 0.02);
	}
}

function hideLogin(again){	
	
	againValue = again;
	
	if(document.getElementById){
		
		animHide('info')
		
		/*var foo = document.getElementById("info");
		
		foo.innerHTML = '';
		foo.style.border = 'none';
		
		doMove();*/
		
	} else {
		document.loginForm.style.display = 'none';
	}
	setHideCookie();
}

function focusLogin(){
	var foo = document.getElementById("loginPass").focus();
}
