function login_check()  {
	if(document.login.username.value=="")  {
		alert("Please input your username!");
		return false;
	} else if(document.login.username.value.length<1) {
		alert("Your username is invalid,please check it!");
		return false;
	} else if(document.login.username.value.length>30) {
		alert("Your username is invalid,please check it!");
		return false;
	} else if(document.login.password.value=="") {
		alert("Please input your password!");
		return false;
	} else if(document.login.password.value.length<2) {
		alert("Your password is invalid,please try again!");
		return false;
	} else if(document.login.password.value.length>18){
		alert("Your password length is larger than 18,please check it!");
		return false;
	} else  {
		return true;
	}
}
function getpass() {
  window.open('http://mail.green-down.com/cgi-bin/getpass.cgi?lang=gb','','top=100,left=150,width=350,height=200');
}

var username='';
var the_cookie=document.cookie;
var each_cookie=the_cookie.split('; ');  
for(var i=0;i<each_cookie.length;i++) {
    var  each_value=each_cookie[i].split('=');
    if(each_value[0]=='username')
        username=each_value[1];
}
function read_cookie() {
    if(username.indexOf('%40') != -1)    {
        var username_value=username.split('%40')
        document.login.username.value=username_value[0];
        document.login.mail_domain.value=username_value[1];
	}
}

function change_lang(){	
	var selected_option=document.login.lang.selectedIndex;
	switch (selected_option) {
		case 0:
			location.href="http://mail.green-down.com/cgi-bin/index.cgi?change_lang=gb";
			break;
		case 1:
			location.href="http://mail.green-down.com/cgi-bin/index.cgi?change_lang=big5";
			break;
		case 2:
			location.href="http://mail.green-down.com/cgi-bin/index.cgi?change_lang=eng";
			break;
	}		
}
