  function activeArt(tg) {   
    		tg.style.backgroundColor = "#EEEEEE";   
  }   
    
  function deactiveArt(tg) {   
    		tg.style.backgroundColor = "";   
  }   
  
    function activeBorder(b,a)  {   
		    b.style.borderColor=a;			
  	}   
    
  function deactiveBorder(b,a) {   
		    b.style.borderColor=a;
  	}   

	   function activeBorder2(b)  {   
		    b.style.borderColor="#06639E";			
  	}   
    
  function deactiveBorder2(b) {   
		    b.style.borderColor="#A4A4A4";
  	}   
  

  function checkformatemail( f ){
  if ( !(/[0-9a-zA-Z_\.\-]+@[0-9a-zA-Z_\.\-]+\.[a-zA-Z][a-zA-Z]+/ig).test( f ) ){
    return true; 
  } else {
    return false;
  }
}

  function check2value( a , b ){	
        if( a != b ) 
			{
				return true;
		}
		else 
			  {
					return false;
			}
  }


function ckblk(chkval)
{
	if(chkval == "")
		return false;
	else if(chkval.indexOf(' ') == 0)
		return false;
	else if(chkval.indexOf('"') == 0)	 
		return false;
	else if(chkval == "'")	 
		return false;
	else
		return true;
}


function checkformatdate(j_day_,j_month_,j_year_)
		{
			if( isNaN(j_day_) || isNaN(j_year_) || (j_year_ == "" ) )
					{
									return true;	
					}

					if(j_month_ == 2) {
									if( j_day_ > 29 )  {											
												return true;
										}						
							}

						if((j_month_ == 4) || (j_month_ == 6) || (j_month_ == 9) || (j_month_ == 11)  ) {
										if((j_day_ > 30) )  {
												return true;
										}
							}
							else {
										if(j_day_ > 31 )  {
										return true;
										}
								}
				return false;
			}


function popupWindow(link_,winname_,top_,left_,width_,height_)  
	{	
		window.open(link_,winname_,'scrollbars=no,resizable=no,top=' + top_ + ',left=' + left_ + ',width=' + width_ + ',height=' + height_ ); 
	}
	
	function popUpWindowCenter(URLStr, width, height)
	{
		LeftPosition = (screen.width) ? (screen.width-width)/2 : 0;
		TopPosition = (screen.height) ? (screen.height-height)/2 : 0;
		
		popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+LeftPosition+', top='+TopPosition+',screenX='+LeftPosition+',screenY='+TopPosition+'');

}

function puUpload( URLStr )	{

		width = 500;
		height = 400;
		LeftPosition = (screen.width) ? (screen.width-width)/2 : 0;
		TopPosition = (screen.height) ? (screen.height-height)/2 : 0;
		
		popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+LeftPosition+', top='+TopPosition+',screenX='+LeftPosition+',screenY='+TopPosition+'');

}

	function popUpWindowCenterHaveMenu(URLStr, width, height)
	{
		LeftPosition = (screen.width) ? (screen.width-width)/2 : 0;
		TopPosition = (screen.height) ? (screen.height-height)/2 : 0;
		
		popUpWin = open(URLStr, 'popUpWin', 'menubar=yes,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+LeftPosition+', top='+TopPosition+',screenX='+LeftPosition+',screenY='+TopPosition+'');

}


function popUpShowMap( URLStr )	{

		width = 370;
		height = 230;
		LeftPosition = (screen.width) ? (screen.width-width)/2 : 0;
		TopPosition = (screen.height) ? (screen.height-height)/2 : 0;
		
		popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+LeftPosition+', top='+TopPosition+',screenX='+LeftPosition+',screenY='+TopPosition+'');

}
	
		function goclose() 
			{
				   window.opener.location.reload();
					window.close()
			}
				

	
		function Checkall(field) 
		{
					if ( form1.chk.length )
								{
											for (uu = 0; uu < form1.chk.length; uu++)
														 {
													    	  form1.chk[uu].checked = field;
														}   
					}	
					else {
								form1.chk.checked = field;
					}		    
		}
		
	function checkformchkbox() {
				var checkvar = document.form1.chk;
				var arrchkvar = document.form1.arrchk;
				arrchkvar.value = "";
				var check = "";				
				
				if ( checkvar.length )
					{
													
										for (uuu = 0; uuu < checkvar.length; uuu++) {
												if (checkvar[uuu].checked){
													  check = "Y";							 							 
													  arrchkvar.value = arrchkvar.value + "&" + checkvar[uuu].value
												}
										  }
					}	
					else {
					
										if (checkvar.checked){
													  check = "Y";							 							 
													  arrchkvar.value = "&" + checkvar.value
										}
					
					}


			  if (check=="") {
		    alert("กรุณาเลือก Record ที่ต้องการลบ อย่างน้อย 1 Record โดย เลือก ทำเครื่องหมายที่ CheckBox ตรงแถวที่ต้องการลบ");
					    return false;
			  }else{
			  					
			  				 if ( confirm('Do you want to delete this item ?')  )
										{
												return true;
										}   
								else
										{
												return false;
										}
			  }
	}
		
			