// JavaScript Document
//for table

function drawTable( cContent , cName ,filter ,cExtCont){
	name 	= cName || ""

	var fObj 			= new split_filters( filter )
		width			= fObj.width 			|| "100%"
		height			= fObj.height			|| ""
		cICO			= fObj.ico	
		action 			= fObj.action 			|| ""
		margin			= fObj.margin 			|| ""
		contentHeight 	= fObj.contentHeight 	|| ""
		overflowX 		= fObj.overflowX
		overflowY		= "overflow-y:auto;"
		noShadow 		= fObj.noShadow 		|| "blk_shadow"
		
		tdWidth = ""	
	
	if( cICO == null ){
		ico =  '' 
	}else{
		ico = '<img src="'+cIco+'" align="absmiddle">'
	}
	
	if( width != "auto" ){
		tdWidth = "width='100%'"
	}
	if( height == "auto" || height == "" ){
		overflowY = ""
	}
	
	cID	= cContent.id
	content = cContent.innerHTML.replace(/>\r\n\</g,'><')
			  //cContent.outerHTML = ""
			 // cContent.parentNode.removeChild( cContent)
			  
	if( cExtCont == null ){
		extCont ='<div style="margin:0px 0px 0px 0px;width:1px;" >&nbsp;</div>'
	}else{
		extCont	= 	'<div style="display:inline;float:right;margin:5px 8px 0px 0px;color:white;" class="extDiv">'+cExtCont.innerHTML+'</div>'
			  //		cExtCont.outerHTML = ""
			  cExtCont.parentNode.removeChild( cExtCont)
	}
	if( overflowX == null ){
		overflowX =""
	}else{
		overflowX = "overflow-x:auto;position:absolute;"	
	}		  	
		  	

	//if( window.navigator.appName == "Microsoft Internet Explorer" ){
	//	blockBar = '<img src="/images/LibraryBG/block/TC.png" width="100%" height="24" style="position:absolute;margin-top:0px;z-index:-1;border" ondrag="return false">\n'
	//	paddingRight = ''
	//}else{
		blockBar = ''
		paddingRight = ' style="padding-right:1px;background-image:url(/images/LibraryBG/block/TC.png)"'
	//}


		oHTML = '' +
				'<table border="0" align="center" cellpadding="0" cellspacing="0" class="blk_BG" width="'+width+'" height="'+height+'" style="margin:'+margin+'">\n'+
				  '<tr onmousedown="'+action+'" onselectstart="return false" ondrag="return false" style="cursor:default">\n'+
					'<td height="24px">\n'+
						'<table width="100%" border="0" cellspacing="0" cellpadding="0">\n'+
							'<tr>\n'+
							  '<td class="blk_topLeft">&nbsp;</td>\n'+
							 ' <td valign="top" '+paddingRight+'>\n'+
								'<div style="width:100%;height:100%;overflow:hidden;">\n'+
									blockBar+
									'<div class="blk_title">'+ 
										ico+name +					//--标题--//--图标--
									'</div>\n'+
										extCont+
								'</div>\n'+
							  '</td>\n'+
							  '<td class="blk_topRight">&nbsp;</td>\n'+
							'</tr>\n'+
						'</table>\n'+
					'</td>\n'+
				  '</tr>\n'+
				  '<tr>\n'+
					'<td>\n'+
					  '<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">\n'+
						'<tr>\n'+
						  '<td class="blk_left">&nbsp;</td>\n'+
						  '<td id="ES_tableC" style="padding-right:1px">'+
								'<div style="width:100%;height:100%;text-align:left;'+overflowY+overflowX+'" id="ES_tableC_div">\n'+	
									content +					//--内容--
								'</div>\n'+
						  '</td>\n'+
						  '<td class="blk_right">&nbsp;</td>\n'+
						'</tr>\n'+
					  '</table>\n'+
					'</td>\n'+
				  '</tr>\n'+
				  '<tr>\n'+
					'<td height="17px">\n'+
					  '<table width="100%" border="0" cellspacing="0" cellpadding="0">\n'+
						'<tr>\n'+
						  '<td class="blk_bottomLeft">&nbsp;</td>\n'+
						  '<td class="blk_bottom">&nbsp;</td>\n'+
						  '<td class="blk_bottomRight">&nbsp;</td>\n'+
						'</tr>\n'+
					  '</table>\n'+
					'</td>\n'+
				  '</tr>\n'+
				'</table>'		
	
	//document.write(oHTML)
	cContent.innerHTML=oHTML
	colorChange()
}

function draw_close( which , where ){
	which = which || "parent.showDetail"
	cHtml = ''+
			'<div style="height:auto;width:auto;overflow:hidden;margin:3px 0px 0px 0px;">\n'+
				'<img src="/Images/libraryBG/blk_close.png"'+
					' onclick="'+which+'.style.top=\'-10000\'"'+
					' onmousedown="this.src=\'/Images/libraryBG/blk_close2.png\'"'+
					' onmouseup="this.src=\'/Images/libraryBG/blk_close.png\'"'+
					' onmouseout="this.src=\'/Images/libraryBG/blk_close.png\'"'+
				'>\n'+
			'</div>\n'
			if( where != null ){
				where.innerHTML = ""
			}
	document.write(cHtml)
	
	if( where == null ){
		draw_close = function(){ return }
	}
}

/*function draw_close_Show(){
	cHtml = ''+
			'<div style="height:auto;width:auto;overflow:hidden;margin:3px 0px 0px 0px;">\n'+
				'<img src="../Images/libraryBG/blk_close.png"'+
					' onclick="alert(parent.ES_win.hide())"'+
					' onmousedown="this.src=\'../Images/libraryBG/blk_close2.png\'"'+
					' onmouseup="this.src=\'../Images/libraryBG/blk_close.png\'"'+
					' onmouseout="this.src=\'../Images/libraryBG/blk_close.png\'"'+
				'>\n'+
			'</div>\n'
	document.write(cHtml)
	draw_close_Show = function(){ return }
}*/
//---分拆变量
//使用方法:var kkk = new split_filters( filter )
//		取值: aaa = kkk.item1
function split_filters( filter ){
	if( filter != null ){	
		filter	= filter + ","
		filter	= filter.replace(/"/g,"")
		filter	= filter.replace(/http:\/\//g,"\@SS_URL\@")
		filters = filter.split(",")	
		if( filters.length > 1 ){
			for( var i = 0 ; i < filters.length - 1; i ++ ){	
				newVar = filters[i].split(":")
				if( newVar.length > 1 ){
					eval('this.'+newVar[0] + '="' + newVar[1] + '"')
				}
			}
		}
	}
}


//---更改颜色
function colorChange(){
	oHtml = ''+
			'<script defer>'+
				'obj=document.all.tags("table");\n'+
				'for( var i = 0 ; i < obj.length ; i ++ ){\n'+
					'if( obj[i].borderColor.toUpperCase()=="#A0C6D3"){\n'+
						'obj[i].borderColor = "#b3b6b9"\n'+
					'}'+
					'if( obj[i].style.background.toUpperCase()=="#D7E5EB"){\n'+
						'obj[i].style.background = "#E6E9EC"\n'+
						'obj[i].style.filter = "progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#CDF4FE,endColorStr=white)"\n'+
					'}'+
				'}\n'+
				'obj=document.all.tags("form");\n'+
				'for( var i = 0 ; i < obj.length ; i ++ ){\n'+
					'if( obj[i].style.background.toUpperCase()=="#D7E5EB"){\n'+
						'obj[i].style.background = "#E6E9EC"\n'+
						'obj[i].style.filter = "progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#CDF4FE,endColorStr=white)"\n'+
					'}'+
				'}\n'+
				'obj=document.all.tags("tr");\n'+
				'for( var i = 0 ; i < obj.length ; i ++ ){\n'+
					'if( obj[i].bgColor.toUpperCase()=="#D2FFF4"){\n'+
						'obj[i].bgColor = "#D2FFF4"\n'+
					'}'+
				'}\n'+
			'</script>'
	document.write(oHtml)
}