//-------------------------------------------------------------------------------------
// 表单事物提交函数
//-------------------------------------------------------------------------------------
function PostBack( command, parameter )
{
	document.all["txtCommand"].value = command ;
	document.all["txtParameter"].value = parameter

	var theform;
	if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
		theform = document.forms["Form1"];
	}
	else {
		theform = document.Form1;
	}
	theform.submit();
}

function PostDelete( id )
{
	PostBack( "DELETE", id ) ;
}

function PostEdit( id )
{
	PostBack( "EDIT", id ) ;
}

function PostRefresh()
{
	PostBack( "REFRESH", "" ) ;
}

//-------------------------------------------------------------------------------
// 对话框及窗口操作
//-------------------------------------------------------------------------------
function OpenDialog( title, url, w, h )
{
	return showModalDialog( "dialogframe.aspx", title + "$" + url , 
		"dialogHeight:" + h + "px;dialogWidth:" + w + "px;help:no;center:yes;resizable:no;scroll:no;status:no" )
}

function OpenDialogEx( url, w, h )
{
	return showModalDialog( url , 
		"dialogHeight:" + h + "px;dialogWidth:" + w + "px;help:no;center:yes;resizable:no;scroll:no;status:no" )
}

//-----------------------------------------------------------------------------
// 样式设置函数
//-----------------------------------------------------------------------------
function SetStyleClass( objectID, className )
{
	var t = document.getElementById( objectID ) ;
	if ( t == null ) return ;
	t.className = className ;
}

function PopMenu( objectID )
{
	var i ;
	
	for ( i = 1 ; i < 5 ; i++ ) {
		var t = document.getElementById( "popmnuMain" + i ) ;
		if ( t != null ) t.style.visibility = "hidden" ;
	}
	
	var t = document.getElementById( "pop" + objectID ) ;
	if ( t == null ) return ;
	t.style.visibility = "visible" ;
}

function ClosePopMenu()
{
	var i ;
	for ( i = 1 ; i < 4 ; i++ ) {
		var t = document.getElementById( "popmnuMain" + i ) ;
		if ( t != null ) t.style.visibility = "hidden" ;
	}
}

//-------------------------------------------------------------------------------------
// 数据类型
//-------------------------------------------------------------------------------------
function CheckDataType()
{
	var type = document.all["ddlType"].value ;
	
	switch (type) {
		case "C" :
			document.all["txtLength"].disabled = false ;
			document.all["txtDecimal"].disabled = true ;
			document.all["txtDecimal"].value = "" ;
			break ;
		case "V" :
			document.all["txtLength"].disabled = false ;
			document.all["txtDecimal"].disabled = true ;
			document.all["txtDecimal"].value = "" ;
			break ;
		case "I" :
			document.all["txtLength"].disabled = true ;
			document.all["txtLength"].value = "" ;
			document.all["txtDecimal"].disabled = true ;
			document.all["txtDecimal"].value = "" ;
			break ;
		case "N" :
			document.all["txtLength"].disabled = false ;
			document.all["txtDecimal"].disabled = false ;
			break ;
		case "D" :
			document.all["txtLength"].disabled = true ;
			document.all["txtLength"].value = "" ;
			document.all["txtDecimal"].disabled = true ;
			document.all["txtDecimal"].value = "" ;
			break ;
	}
}

//-------------------------------------------------------------------------------------
// 客户端窗口操作
//-------------------------------------------------------------------------------------
function Return( value )
{
	returnValue = value ;
	window.close() ;
}

function Close()
{
	window.close() ;
}

//-------------------------------------------------------------------------------------
// 验证函数, 用于对TEXTAREA的输入内容进行长度验证
// 共提供对 50, 100, 150, 200, 250, 300, 400
// 500, 600, 700, 800, 900, 1000 的长度验证
//-------------------------------------------------------------------------------------
function validateMaxLength50( src, args )
{
	args.IsValid = ( args.Value.length <= 50 ) ;
}

function validateMaxLength100( src, args )
{
	args.IsValid = ( args.Value.length <= 100 ) ;
}

function validateMaxLength150( src, args )
{
	args.IsValid = ( args.Value.length <= 150 ) ;
}

function validateMaxLength200( src, args )
{
	args.IsValid = ( args.Value.length <= 200 ) ;
}

function validateMaxLength250( src, args )
{
	args.IsValid = ( args.Value.length <= 250 ) ;
}

function validateMaxLength300( src, args )
{
	args.IsValid = ( args.Value.length <= 300 ) ;
}

function validateMaxLength400( src, args )
{
	args.IsValid = ( args.Value.length <= 400 ) ;
}

function validateMaxLength500( src, args )
{
	args.IsValid = ( args.Value.length <= 500 ) ;
}

function validateMaxLength600( src, args )
{
	args.IsValid = ( args.Value.length <= 600 ) ;
}

function validateMaxLength700( src, args )
{
	args.IsValid = ( args.Value.length <= 700 ) ;
}

function validateMaxLength800( src, args )
{
	args.IsValid = ( args.Value.length <= 800 ) ;
}

function validateMaxLength900( src, args )
{
	args.IsValid = ( args.Value.length <= 900 ) ;
}

function validateMaxLength1000( src, args )
{
	args.IsValid = ( args.Value.length <= 1000 ) ;
}


function doPrint(){
var str="<html>\n<meta http-equiv='content-type' content='text/html; charset=gb2312'>";
var article;
var css;
var strAdBegin="<!--NEWSZW_HZH_BEGIN-->";
var strAdEnd="<!--NEWSZW_HZH_END-->";
var strFontSize='【<a href="javascript:doZoom(16)">大</a> <a href="javascript:doZoom(14)">中</a> <a href="javascript:doZoom(12)">小</a>】'.toLowerCase()
var strdoPrint="doPrint()";
var strTmp;

	css="<style>"
	+"td,.f12{font-size:12px}"
	+"body{font-family:宋体}"
	+".f24 {font-size:24px;}"
	+".f14 {font-size:14px;}"
	+".a {font-size:14.9px;line-height:130%}"
	+".title14 {font-size:14px;line-height:130%}"
	+".l17 {line-height:170%;}"
	+".x14 {font-size:14px;line-height:130%}"
         +"a.a02:link,a.a02:active,a.a02:visited,a.a02:hover{text-decoration:none;color: #311bad;}"
	+"a.htt:link,a.htt:active,a.htt:visited{text-decoration:none;color: #7b4109;}"
	+"</style>";

	str +=	css;
	str +=	'<meta http-equiv="content-type" content="text/html; charset=gb2312">';
	str +=	'<title>'+document.title+'</title>';
	str +=	"<body bgcolor=#ffffff topmargin=5 leftmargin=5 marginheight=5 marginwidth=5 onLoad='window.print()'>";
	str +=	"<center><table width=600 border=0 cellspacing=0 cellpadding=0><tr><td height=34 width=150 valign=bottom>上海巨澜新闻中心</td><td valign=bottom>首页</a> <font color=#3118ad>&gt;</font> 新闻 <font color=#3118ad>&gt;</font> <font color=#898a8e>正文</font>"
	str +=	"</td><td align=right valign=bottom><a href='javascript:history.back()'>返回</a>　<a href='javascript:window.print()'>打印</a></td></tr></table>";
	str +=	"<table width=600 border=0 cellpadding=0 cellspacing=20 bgcolor=#F2F4F2><tr><td>";
	
		article=document.getElementById('article').innerHTML;
		if(article.indexOf(strAdBegin)!=-1){
			str +=article.substr(0,article.indexOf(strAdBegin));
			strTmp=article.substr(article.indexOf(strAdEnd)+strAdEnd.length, article.length);
		}else{
			strTmp=article
		}
		str +=strTmp
		str += window.location.href
		str +=	"</td></tr></table></center>";
		str +=	"</body></html>";
		document.write(str);
		document.close();
}

function doZoom(size)
{
	document.getElementById('zoom').style.fontSize=size+'px'
}



