/* ===============  VBScript for FSCommand  =============== */
/*
document.writeln('<script language="VBScript">');
document.writeln('<!--');
document.writeln('Sub chat_FSCommand(ByVal command, ByVal args)');
document.writeln(' call chat_DoFSCommand(command, args)');
document.writeln('end sub');
document.writeln('//-->');
document.writeln('</script>');
*/


/* ===============  FUNC for main  =============== */
function login(){
	if(document.form1.savepass.checked){
		setCookie('savepass',1);
		setCookie('cookie_id',document.form1.mail.value);
		setCookie('cookie_pass',document.form1.pass.value);
	} else {
		setCookie('savepass',0);
		clearCookie('cookie_id');
		clearCookie('cookie_pass');
	}
}

function openBlock(name){
  if (document.getElementById(name).style.display == "block") {
    document.getElementById(name).style.display = "none";
  } else {
    document.getElementById(name).style.display = "block";
  }
}


/* ===============  FUNC for Cookie  =============== */
function getCookie(key){
	var tmp = document.cookie+";";
	var tmp1 = tmp.lastIndexOf(key, tmp.length);
	if (tmp1 != -1) {
		tmp = tmp.substring(tmp1, tmp.length);
		var start = tmp.indexOf("=",0)+1;
		var end = tmp.indexOf(";",start);
		return (unescape(tmp.substring(start, end)));
	}
	return ("");
}

function setCookie(key,val,exp) {
        if (exp) {
		var tmp = key +"="+ escape(val) +"; domain=mail-wind.com; expires = "+exp+";path = /;";
	}
	else {
		var tmp = key +"="+ escape(val) +"; domain=mail-wind.com; expires = Fri,31-Dec-2030 23:59:59;path = /;";
	}
	document.cookie=tmp;
}

function clearCookie(key) {
	var tmp = key +"=clear; domain=mail-wind.com; expires = Tue, 1-Jan-1980 00:00:00;path = /;";
	document.cookie=tmp;
}

function setlogin() {
	
	var tmp1 = getCookie('savepass');
	if (tmp1 == 1) {
		document.form1.savepass.checked = true;
		document.form1.mail.value = getCookie('cookie_id');
		document.form1.pass.value = getCookie('cookie_pass');
	} else {
		document.form1.savepass.checked = false;
	}
}


