function showUsernameNote()
	{
		document.getElementById("username").className = 'input_normal';
		var usernameNote = document.getElementById("usernameNote");
		usernameNote.innerHTML = Cloud_UserNameNote;
		usernameNote.className = 'note_text';
	}
	function showLoginPage(){
	//var data = {};
	//data.file= [];
	//$.post("/ZTECloud/LoadLoginPage",data,function(){})
	window.location.href = "login.html";
}
	
$(document).ready(function(){

	$('#username').focus();	
})
	
function checkUsernameValid(){

		var username = document.getElementById('username').value;

		if(isEmptyString(username)){
			showUsernameErrorInfo(1);
			return false;
		}
	
		var reg = /@/;
		if(reg.test(username))
		{
			if(isEmailValid(username)){
				return true;
			} else{
				showUsernameErrorInfo(2);
				return false;
			}		
		}
		else
		{
				if(isPhoneValid(username)){
					return true;
				} else{
					showUsernameErrorInfo(2);
					return false;
				}
		}
	}
function showUsernameErrorInfo(errorInfo)
	{
		var usernameNote = document.getElementById("usernameNote");
		if (errorInfo == 1){
			text = UserNameErorNullText;
			}
		else if (errorInfo == 2){
			text = UserNameErorFormText;
			}

		usernameNote.innerHTML = text;
		usernameNote.className = "note_error";
	}

function checkCaptchaValid(){
	var captcha = document.getElementById("register_captcha").value;
	if(isEmptyString(captcha)){
		showRegisterCaptchaErrorInfo(CaptChaNoteText);
		return false;
	} else{
		initCaptchaNote();
		return true;
	}
	}
function showRegisterCaptchaErrorInfo(errorInfo){
	var registerCaptchaNote = document.getElementById("registerCaptchaNote");
	registerCaptchaNote.innerHTML = errorInfo;
	registerCaptchaNote.className = "note_error";
	}
function initCaptchaNote(){
	var registerCaptchaNote = document.getElementById("registerCaptchaNote");
	registerCaptchaNote.innerHTML = "&nbsp";
	registerCaptchaNote.className = "note_text";
	}
function reloadCapImg()
	{
	var captCha = document.getElementById("register_captcha_image");
	captCha.src = "https://cloud.ztedevices.com:443/ZCloud/captcha.show"
	}
function findPassword()
	{
	$('#progressLabel').html(LogingLabel);
	$('#progress').modal();
		
		$('#content').addClass("disabled");	
		$("input").attr("disabled","disabled");

		url = 'https://cloud.ztedevices.com:8445/authorise/usergetpwd?';
		var username = document.getElementById('username').value;
	
		var reg = /@/;
		if(reg.test(username))
		{
			type = 'email=';
		}
		else
		{
			type = 'phone=';
		}
		url = url + type + username + '&lan=cn&callback=findPasswordCallback';
		var script = document.createElement('script');
		script.setAttribute('src', url);
		document.getElementsByTagName('head')[0].appendChild(script);
		
		
	}
function StopProgress()
	{
		$('a.modalCloseImg').click();
	}	
	
function findPasswordCallback(data)
{
	console.log('findPasswordCallback', data);
	$('#content').removeClass("disabled");	
	$("input").removeAttr("disabled");
	if (data.code == 200)
	{
		var data = {};
		data.code = '';
		$.post("/ZTECloud/FindPasswordSucc", data);
		//$.post("/ZTECloud/LoadLoginPage", data);
		window.location.href = 'login.html'
	}
	else
	{
		alert(Cloud_FindPwd_Failed);
	}
	StopProgress()
}