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

//關閉報名表單視窗
function closeRegBox()
{
	if($('RegBox').style.display == '')
	{
		new Effect.SwitchOff('RegBox',{duration:0.1});
		if($('CurseBox').style.display == '')
		{
			new Effect.Move('CurseBox',{delay:0.7, x: 220, y: 0 });
		}//end if	
	}//end if
}//end func

//關閉 Mask ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function closeMask()
{
	if($('Mask').style.display == '')
	{
		new Effect.Fade('Mask',{duration:0.2});
	}//end if
}//end func

//Agree 我同意 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function Agree(sn)
{
	var CSN = $('send_csn').value;
	var QString = "&Agree="+sn+"&CSN="+CSN;
	ajax =  new Ajax.Updater('Msg',siteurl+'/ajax.php?p=check_agree',{method:'post', postBody:QString, onComplete:function(){new Effect.Appear('Msg',{duration:1,from:0,to:1});},asynchronous:true, evalScripts:true});			
}//end func

//Not Agree 不同意 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function NotAgree()
{	
	new Effect.Fade('RegNoteBox',{duration:0});
	closeMask();
}//end func

//表單檢測 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function sendReg()
{
 	if($('Name').value.length == 0 || $('Name').value.length < 2)
 	{
 		$('Name').style.backgroundColor='#ffcc00';
 		$('Name').focus();
 		return false;	
 	}else
 	{
 		$('Name').style.backgroundColor='';
 	}//end if	
 	
 	if($('WNum').value.length == 0 || $('WNum').value.length < 2)
 	{
 		$('WNum').style.backgroundColor='#ffcc00';
 		$('WNum').focus();
 		return false;	
 	}else
 	{
 		$('WNum').style.backgroundColor='';
 	}//end if	
 	
 	if($('WArea').value.length == 0 || $('WArea').value.length < 2)
 	{
 		$('WArea').style.backgroundColor='#ffcc00';
 		$('WArea').focus();
 		return false;	
 	}else
 	{
 		$('WArea').style.backgroundColor='';
 	}//end if	 	
 
  	if($('Dept').value.length == 0 || $('Dept').value.length < 2)
 	{
 		$('Dept').style.backgroundColor='#ffcc00';
 		$('Dept').focus();
 		return false;	
 	}else
 	{
 		$('Dept').style.backgroundColor='';
 	}//end if
 
   	if($('DeptNum').value.length == 0 || $('DeptNum').value.length < 2)
 	{
 		$('DeptNum').style.backgroundColor='#ffcc00';
 		$('DeptNum').focus();
 		return false;	
 	}else
 	{
 		$('DeptNum').style.backgroundColor='';
 	}//end if

  	if($('Position').value.length == 0 || $('Position').value.length < 2)
 	{
 		$('Position').style.backgroundColor='#ffcc00';
 		$('Position').focus();
 		return false;	
 	}else
 	{
 		$('Position').style.backgroundColor='';
 	}//end if
 
  	if($('Tel').value.length == 0 || $('Tel').value.length < 3)
 	{
 		$('Tel').style.backgroundColor='#ffcc00';
 		$('Tel').focus();
 		return false;	
 	}else
 	{
 		$('Tel').style.backgroundColor='';
 	}//end if 

  	if($('Cell').value.length == 0 || $('Cell').value.length < 9)
 	{
 		$('Cell').style.backgroundColor='#ffcc00';
 		$('Cell').focus();
 		return false;	
 	}else
 	{
 		$('Cell').style.backgroundColor='';
 	}//end if

  	if($('IDNum').value.length == 0 || $('IDNum').value.length < 10)
 	{
 		$('IDNum').style.backgroundColor='#ffcc00';
 		$('IDNum').focus();
 		return false;	
 	}else
 	{
 		$('IDNum').style.backgroundColor='';
 	}//end if
 	 
  	if($('School').value.length == 0 || $('School').value.length < 2)
 	{
 		$('School').style.backgroundColor='#ffcc00';
 		$('School').focus();
 		return false;	
 	}else
 	{
 		$('School').style.backgroundColor='';
 	}//end if 	 
 
   	if($('SDept').value.length == 0 || $('SDept').value.length < 2)
 	{
 		$('SDept').style.backgroundColor='#ffcc00';
 		$('SDept').focus();
 		return false;	
 	}else
 	{
 		$('SDept').style.backgroundColor='';
 	}//end if

	//Su Data 2008-10-14 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  	if($('SuName').value.length == 0 || $('SuName').value.length < 2)
 	{
 		$('SuName').style.backgroundColor='#ffcc00';
 		$('SuName').focus();
 		return false;	
 	}else
 	{
 		$('SuName').style.backgroundColor='';
 	}//end if
 
   	if($('SuTel').value.length == 0 || $('SuTel').value.length < 3)
 	{
 		$('SuTel').style.backgroundColor='#ffcc00';
 		$('SuTel').focus();
 		return false;	
 	}else
 	{
 		$('SuTel').style.backgroundColor='';
 	}//end if
	//Su Data 2008-10-14 End ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  	if($('AName').value.length == 0 || $('AName').value.length < 2)
 	{
 		$('AName').style.backgroundColor='#ffcc00';
 		$('AName').focus();
 		return false;	
 	}else
 	{
 		$('AName').style.backgroundColor='';
 	}//end if
 
   	if($('ATel').value.length == 0 || $('ATel').value.length < 3)
 	{
 		$('ATel').style.backgroundColor='#ffcc00';
 		$('ATel').focus();
 		return false;	
 	}else
 	{
 		$('ATel').style.backgroundColor='';
 	}//end if


 	 
 	 
 	//Send Data ###############################
	ajax =  new Ajax.Updater('RegFormBox',siteurl+'/ajax.php?p=reg_send',{method:'post', parameters:Form.serialize('RegForm'), onComplete:function(){new Effect.Appear('RegFormBox');},asynchronous:true, evalScripts:true});	 	 	
 }//end func