/**
 * @author his90
 */
var siteurl='http://www.tcrsh.com.tw/CM';
var ajax;

function loginCheck()
{
	
	if($('ID').value.length == 0 || $('ID').value.length < 2)
	{
		$('ID').focus();
		$('ID').style.backgroundColor = '#ffcc00';
		return false;
	}else
	{
		$('ID').style.backgroundColor = '';
	}//end if
		
	
	if($('PWD').value.length == 0 ||  $('PWD').value.length < 2)
	{
		$('PWD').focus();
		$('PWD').style.backgroundColor = '#ffcc00';
		return false;
	}else
	{
		$('PWD').style.backgroundColor = '';
	}//end if


	$('LoginMsgBox').innerHTML = '驗證處理中...請稍後!!';
	new Effect.Appear('LoginMsgBox',{duration:1});
	
	ajax =  new Ajax.Updater('LoginMsgBox',siteurl+'/ajax.php?p=login',{method:'post', parameters:Form.serialize('LoginForm'), onComplete:function(){new Effect.Appear('LoginMsgBox');},asynchronous:true, evalScripts:true});		
}//end func


//Call Logout ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function showLogoutBut()
{
	if($('LogoutBox').style.display == 'none')
	{
		new Effect.SlideDown('LogoutBox',{duration:0.5});
	}else
	{
		new Effect.SwitchOff('LogoutBox',{duration:0.5});
	}//end if
}//end func

//Call Menu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function showMenu()
{
	new Effect.Appear('MenuBox',{duration:0.2});
}//end func

//Logout ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function logout()
{
	ajax =  new Ajax.Updater('MainBox',siteurl+'/ajax.php?p=exit',{method:'get', onComplete:function(){new Effect.Appear('MainBox');},asynchronous:true, evalScripts:true});		
}//end func