function lockNum_Index(value,num)
{
	if(value.length>=num)
	{
		event.keyCode = 0;
	}else
	{
		if ((event.keyCode < 48) || (event.keyCode > 58)) 
		{
			event.keyCode = 0;
		}
	}
}
function lockNum()
{
	if ((event.keyCode < 48) || (event.keyCode > 58)) 
	{
		event.keyCode = 0;
	}
}
function lockfNum(num)
{
	if (((event.keyCode < 48) || (event.keyCode > 58)) && (event.keyCode != 46)) 
	{
		event.keyCode = 0;
	}
	if ((event.keyCode == 46) && (num.indexOf('.') >0))
	{
		event.keyCode = 0;
	}
}

function CenterOpenWin(url,width,height,style)
{
	if(typeof(NewCenterWin) != 'undefined'){NewCenterWin.close();}
	NewCenterWin=window.open(url,'NewCenterWin','height=' + height + ',width=' + width +',left='+(screen.width-width)/2+ ',top='+(screen.Height-height)/2 + ',' +style);
	NewCenterWin.focus();
}
//預覽法院原始檔
function DataShowWin(url)
{
	NewDataShowWin=window.open(url,'NewDataShowWin','height=500,width=760,left='+(screen.width-760)/2+ ',top='+(screen.Height-500)/2 + ',scrollbars=yes');
	NewDataShowWin.focus();
}
//預覽搜尋結果
function SearchWin(url)
{
	NewSearchWin = window.open(url,"NewSearchWin","width=750,height=650,resizable=yes,scrollbars=yes,status=yes,left=" + (screen.width-750)/2 + ",top=" + (screen.Height-650)/2);
	NewSearchWin.focus();		
}
//預覽案件內容
function ShowWin(url)
{
    NewShowWin=window.open(url,'NewShowWin','resizable=yes,scrollbars=yes,width=700,height=600,left='+(screen.width-700)/2+ ',top='+(screen.Height-600)/2,'');
    NewShowWin.focus();
}
//展示業務
function ShowSales(id)
{
    NewSalesWin=window.open('../SalesShow.aspx?ID='+id ,'NewSalesWin','resizable=yes,scrollbars=yes,width=450,height=500,left='+(screen.width-450)/2+ ',top='+(screen.Height-500)/2,'');
    NewSalesWin.focus();
}
//Dialog開啟
function CenterOpenDialog(url,width,height,style)
{
    showModalDialog(url,self,'dialogHeight: '+ height +'px; dialogWidth: ' + width + 'px; dialogTop: '+(screen.Height-height)/2 + 'px; dialogLeft: '+(screen.width-width)/2+ 'px;' +style.replace('=',':').replace(',',';'));
}
function CheckDel(message,obj)
{
	var x=window.confirm(message)
	if(x)
	__doPostBack(obj,'');
}
function Hide(table,buttonhid,buttonshow)
{
	document.getElementById(table).style.display='none';
	buttonshow.style.display='';
	buttonhid.style.display='none';
}
function Show(table,buttonhid,buttonshow)
{
	document.getElementById(table).style.display='';
	buttonshow.style.display='none';
	buttonhid.style.display='';
}

//動態圖
function KB_keepItInIE(theName,theWantTop,theWantLeft)
{
    theRealTop=parseInt(document.body.scrollTop)
    theTrueTop=theWantTop+theRealTop
    document.all[theName].style.top=theTrueTop
    theRealLeft=parseInt(document.body.scrollLeft)
    theTrueLeft=theWantLeft+theRealLeft
    document.all[theName].style.left=theTrueLeft
}
function KB_keepItInNN(theName,theWantX,theWantY)
{
    theRealLay=document.layers[theName]
    theBadX=self.pageYOffset
    theBadY=self.pageXOffset
    theRealX=theBadX+theWantX
    theRealY=theBadY+theWantY
    theRealLay.moveTo(theRealY,theRealX)
}

document.onmousedown = AnimationXY

var mouseX=0
var mouseY=0
function AnimationXY()
{
    mouseX=event.x
    mouseY=event.y
}
//動畫展示
function AnimationShow(Obj)
{
    $get(Obj).style.position='absolute';
    $get(Obj).style.zindex='151';
    $get(Obj).style.display='';
    $get(Obj).style.left=mouseX-5+document.getElementsByTagName("html")[0].scrollLeft;
    $get(Obj).style.top=mouseY-5+document.getElementsByTagName("html")[0].scrollTop;
    ani=new AjaxControlToolkit.Animation.FadeInAnimation($get(Obj),0.1,30,0.1,0.9);
    ani.play();
}
function AnimationShowRight(Obj)
{
    $get(Obj).style.position='absolute';
    $get(Obj).style.zindex='151';
    $get(Obj).style.display='';
    $get(Obj).style.left=mouseX+document.getElementsByTagName("html")[0].scrollLeft-$get(Obj).clientWidth;
    $get(Obj).style.top=mouseY+document.getElementsByTagName("html")[0].scrollTop;
    ani=new AjaxControlToolkit.Animation.FadeInAnimation($get(Obj),0.1,30,0.1,0.9);
    ani.play();
}
function AnimationShowCenter(Obj)
{
    $get(Obj).style.position='absolute';
    $get(Obj).style.zindex='151';
    $get(Obj).style.display='';
    $get(Obj).style.left=(document.getElementsByTagName("html")[0].offsetWidth-$get(Obj).clientWidth)/2;
    $get(Obj).style.top=(document.getElementsByTagName("html")[0].offsetHeight-$get(Obj).clientHeight)/2;
    ani=new AjaxControlToolkit.Animation.FadeInAnimation($get(Obj),0.1,30,0.1,0.9);
    ani.play();
}
function AnimationHide(Obj)
{
//    $get(Obj).style.left=0;
//    $get(Obj).style.top=document.getElementsByTagName("html")[0].offsetHeight;
    ani=new AjaxControlToolkit.Animation.FadeOutAnimation($get(Obj),0.5);
//    ani=new AjaxControlToolkit.Animation.FadeInAnimation($get(Obj),0.1,30,0.1,0.5);
    ani.play();
    $get(Obj).style.display='none';
}
