var signin_temp = "" ;
//var L_VERSION ="669";
$(document).ready(function() 
{ 
	$('#btnLoginSun').click(function () {
		onSigninSun($(this));
	});
	
	$('#btnPwdOk').click(function () {
		changePwd();
	});
	$('#txtCode').focus() ;
}) ;

function onSigninSun(obj) {
	$('#err_mesg').text('') ;
	$('#err_summary').text('') ;
	if ($('#txtCode').val() == '')
	{
		$('#err_code').show() ;
		$('#txtCode').focus() ;
		$('#err_mesg').text("Employee code can not be blank.") ;
		return false ;
	}
	else 
		$('#err_code').hide() ;
			
	var data = { "type": "i","id": $('#txtCode').val(), "pwd": $('#txtPwd').val(),"turn_off":"y" } ;
	var url = "request.pzx?c=" + signinsun_url + "&d=" + new Date().getTime() ;	

	callServer(url,"json",data,onSigninSunResponse,obj) ;

}


function onSigninSunResponse(obj,data) {
	if (data == null) 
	{
		alert('invalid response : ' + JSON.stringify(data)) ;
	}
	else 
	{
		if (data.status == '0') {
			openSite(data.data + "&d=" + new Date().getTime());
		} else {
			$('#err_mesg').text(data.mesg) ;
		}
	}
}

