function ClearPrompt( lbl_id )
{
	if( document.getElementById( lbl_id ) != null )
	{
		document.getElementById( lbl_id ).innerHTML = '';
	}
}

function isDigit( prompt, s )   
{   
	var patrn = /^[0-9]{1,20}$/;   
	if ( !patrn.test( s ) )
	{
		alert( prompt + '只能是数字！' );
		return false;
	}
	return true;
}

function isPostCode( s )
{
	var patrn = /^\d{6}$/;
	if( !patrn.test( s ) )
	{
		alert( "邮政编码格式不正确！" );
		return false;
	}
	return true;
}

function isMobile( s )
{
	var patrn = /^0?13[0,1,3,5,6,8,9]\d{8}$/;
	if( !patrn.test( s ) )
	{
		alert( "移动电话格式不正确！" );
		return false;
	}
	return true;
}

function isTel( s )
{
	var patrn = /^0\d{2,3}\-\d{7,8}$/;
	if( !patrn.test( s ) )
	{
		alert( "固定电话格式不正确！" );
		return false;
	}
	return true;
}

function isDate( prompt, d)
{ 
	if( d == "" )
	{
		return true;
	}
	var date = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})/; 
	if ( !date.test( d ) )
	{ 
		alert( prompt + "日期格式不正确！" );
		return false;
	} 
	return true;
} 

function isDateYear( prompt, year)
{ 
	if( year == "" )
	{
		return true;
	}
	if ( parseInt( year ) < 1900 )
	{ 
		alert( prompt + "要大于1900年！" );
		return false;
	} 
	return true;
} 

function checkMail( email )
{
    var patrn = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;
    if( !patrn.test(email) )
    {
        alert('请输入正确邮箱地址！');
		return false;
    }
    return true;
}

function Delete( delUrl )
{
	if( window.confirm('您真的要删除吗？') )
	{
		window.location = delUrl;
	}
}

function ValidateTextBoxNotNull( tb, prompt )
{
	var obj_tb = document.getElementById( tb );
	if( obj_tb != null && obj_tb.value == '' )
	{
		window.alert( prompt + '不能为空！' );
		obj_tb.focus();
		return false;
	}
	
	return true;
}

function Confirm( operation )
{
	return window.confirm( "您真的要" + operation + "吗？" );
}

function WinOpen( url )
{
    if( url != "#" && url != "" && url != "http://" )
    {
        window.open( url, "" );
    }
}

function AddFavorite( title, url ) 
{ 
	if ( document.all )
	{
		window.external.AddFavorite(url, title);
	}
	else if( window.sidebar )
	{ 
		window.sidebar.addPanel( title, url, "" );
	}
}

// 下拉菜单脚本
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
	}
// End

function flashWrite(url,w,h,id,bg,vars){

	
	var flashStr=
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
	"<param name='allowScriptAccess' value='always' />"+
	"<param name='movie' value='"+url+"' />"+
	"<param name='FlashVars' value='"+vars+"' />"+
	"<param name='menu' value='false' />"+
	"<param name='quality' value='high' />"+
	"<param name='wmode' value='opaque' />"+
	"<param name='bgcolor' value='"+bg+"' />"+	
	"<embed src='"+url+"' FlashVars='"+vars+"' menu='false' wmode='opaque' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object>";

	
	document.write(flashStr);

}

function flashWriteW(url,w,h,id,bg,vars){

	
	var flashStr=
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
	"<param name='allowScriptAccess' value='always' />"+
	"<param name='movie' value='"+url+"' />"+
	"<param name='FlashVars' value='"+vars+"' />"+
	"<param name='menu' value='false' />"+
	"<param name='quality' value='high' />"+
	"<param name='bgcolor' value='"+bg+"' />"+
	"<param name='wmode' value='transparent' />"+
	"<embed src='"+url+"' FlashVars='"+vars+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object>";

	
	document.write(flashStr);

}

 var newsID = '';
 function news(id){
  var newsObj = document.getElementById('a' + newsID);
  if(newsObj){
    newsObj.style.display = 'none';
    document.getElementById('b' + newsID).className = 'option2';
  }
  var obj = document.getElementById('a' + id);
  document.getElementById('b' + id).className = 'option1';
  obj.style.display = '';
  newsID = id;
 }
        
        var news1ID = '';
 function news1(id){
  var news1Obj = document.getElementById('c' + news1ID);
  if(news1Obj){
    news1Obj.style.display = 'none';
    document.getElementById('d' + news1ID).className = 'option2';
  }
  var obj = document.getElementById('c' + id);
  document.getElementById('d' + id).className = 'option1';
  obj.style.display = '';
  news1ID = id;
 }
 
 function djs1(){
var timedate= new Date("8/8/2008 20:00:00");
var times= "距北京奥运会开幕";
var now = new Date();
var date = timedate.getTime() - now.getTime();
var time = Math.floor(date / (1000 * 60 * 60 * 24));
if (time >= 0)
document.write( times+"还有:"+time+"天")
}

function updateTrainingHistory( thID )
{
	window.open("traininghistory_update.aspx?thID=" + thID,"newwin","width=450px,height=300px");
}

function delTrainingHistory( thID )
{
	if( confirm("真的要删除吗，删除后不可恢复！") )
	{
		window.open("traininghistory_del.aspx?thID=" + thID,"newwin","width=10px,height=10px,left=-0,top=5000");
	}
}
function addTrainingHistory()
{
	window.open("traininghistory_add.aspx","newwin","width=450px,height=300px");
}

function updateCertificate( cID )
{
	window.open("certificate_update.aspx?cID=" + cID,"newwin","width=450px,height=300px");
}

function delCertificate( cID )
{
	if( confirm("真的要删除吗，删除后不可恢复！") )
	{
		window.open("certificate_del.aspx?cID=" + cID,"newwin","width=10px,height=10px,left=-0,top=5000");
	}
}
function addCertificate()
{
	window.open("certificate_add.aspx","newwin","width=450px,height=300px");
}


function updateWorkHistory( whID )
{
	window.open("workhistory_update.aspx?whID=" + whID,"newwin","width=450px,height=300px");
}

function delWorkHistory( whID )
{
	if( confirm("真的要删除吗，删除后不可恢复！") )
	{
		window.open("workhistory_del.aspx?whID=" + whID,"newwin","width=10px,height=10px,left=-0,top=5000");
	}
}
function addWorkHistory()
{
	window.open("workhistory_add.aspx","newwin","width=450px,height=300px");
}

function updateEducationHistory( ehID )
{
	window.open("educationhistory_update.aspx?ehID=" + ehID,"newwin","width=450px,height=300px");
}

function delEducationHistory( ehID )
{
	if( confirm("真的要删除吗，删除后不可恢复！") )
	{
		window.open("educationhistory_del.aspx?ehID=" + ehID,"newwin","width=10px,height=10px,left=-0,top=5000");
	}
}
function addEducationHistory()
{
	window.open("educationhistory_add.aspx","newwin","width=450px,height=300px");
}