// JavaScript Document
function openLogin(){
	$('#bgLayer').height($(window.body).height());
	$('#bgLayer').animate({opacity:'0.5'},250);
	$( '#bgLayer' ).css( 'display', 'block' );
	$( '#userLogin' ).css( 'display', 'block' );
	$( '#login' ).css( 'display', 'block' );
}

function closeLogin(){

	$('#bgLayer').css("opacity",'0.0');
	$('#userLogin').css("opacity",'0.0');	
	$('#login').css("opacity",'0.0');	
	$('#bgLayer').css("display",'none');
	$('#userLogin').css("display",'none');
	$('#login').css("display",'none');

}
function checkForm(){
	
	//判空
	checkFormState=0;
	checkNull("username|password|checkcode");
	
	if(checkFormState!=0){
		return false;
	}else{
		document.getElementById("password").value = hex_md5( document.getElementById("password").value );
		return true;
	}
}
function refreshVcode(){
	document.getElementById('vCodeImg').innerHTML = '<img src="../common/newCode.php?'+Math.random()+'" onclick="refreshVcode()" />';
}
function logout(goal){
	jQuery.ajax({
		url: '../web/clear.php',
		type: 'GET',
		dataType: 'text',
		timeout: 1000,
		error: function(){
			alert('未能请求到数据，请刷新');
		},
		success: function(result){
			if( result==1 ){
				alert('退出成功！');
				document.location.href=goal;
			}else{
				alert('退出失败！');
				document.location.href=goal;
			}
		
		}
	});
}
function openXunlei(){
	$('#bgLayer').height($(window.body).height());
	$('#bgLayer').animate({opacity:'0.5'},250);
	$( '#bgLayer' ).css( 'display', 'block' );
	$( '#userLogin' ).css( 'display', 'block' );
	$( '#openxunlei' ).css( 'display', 'block' );
}

function closeXunlei(){

	$('#bgLayer').css("display",'none');
	$('#userLogin').css("display",'none');
	$( '#openxunlei' ).css( 'display', 'none' );

}
var GLOBAL={
	browser:(function(){
		var userAgent = window.navigator.userAgent.toLowerCase();
		var val={
				ie:/msie/.test(userAgent),
				ie6:/msie 6/.test(userAgent),
				ie7:/msie 7/.test(userAgent),
				ie8:/msie 8/.test(userAgent),
				firefox:/firefox/.test(userAgent),
				chrome:/chrome/.test(userAgent),
				safari:/safari/.test(userAgent)&&!(/chrome/.test(userAgent)),
				opera:/opera/.test(userAgent)
			}
		return val;
	})()
}

