//调用参数 cx,cy,width,height,filename,flashvars
	function showFlash(cx,cy,width,height,filename,flashvars){
			document.write("<OBJECT codeBase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\"");
			document.write(" height=\""+height+"\" width=\""+width+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" VIEWASTEXT>");
			if(cx != "")
				document.write("<PARAM NAME=\"_cx\" VALUE=\""+cx+"\">");
			if(cy != "")				
				document.write("<PARAM NAME=\"_cy\" VALUE=\""+cy+"\">");			
			document.write("<PARAM NAME=\"FlashVars\" VALUE=\""+flashvars+"\">");
			document.write("<PARAM NAME=\"Movie\" VALUE=\""+filename+"\">");
			document.write("<PARAM NAME=\"Src\" VALUE=\""+filename+"\">");
			document.write("<PARAM NAME=\"WMode\" VALUE=\"Window\">");
			document.write("<PARAM NAME=\"Play\" VALUE=\"-1\">");
			document.write("<PARAM NAME=\"Loop\" VALUE=\"-1\">");
			document.write("<PARAM NAME=\"Quality\" VALUE=\"High\">");
			document.write("<PARAM NAME=\"SAlign\" VALUE=\"\">");
			document.write("<PARAM NAME=\"Menu\" VALUE=\"-1\">");
			document.write("<PARAM NAME=\"Base\" VALUE=\"\">");
			document.write("<PARAM NAME=\"AllowScriptAccess\" VALUE=\"\">");
			document.write("<PARAM NAME=\"Scale\" VALUE=\"ShowAll\">");
			document.write("<PARAM NAME=\"DeviceFont\" VALUE=\"0\">");
			document.write("<PARAM NAME=\"EmbedMovie\" VALUE=\"0\">");
			document.write("<PARAM NAME=\"BGColor\" VALUE=\"\">");
			document.write("<PARAM NAME=\"SWRemote\" VALUE=\"\">");
			document.write("<PARAM NAME=\"MovieData\" VALUE=\"\">");
			document.write("<PARAM NAME=\"SeamlessTabbing\" VALUE=\"1\">");
			document.write("<PARAM NAME=\"Profile\" VALUE=\"0\">");
			document.write("<PARAM NAME=\"ProfileAddress\" VALUE=\"\">");
			document.write("<PARAM NAME=\"ProfilePort\" VALUE=\"0\">");
			document.write("<PARAM NAME=\"AllowNetworking\" VALUE=\"all\">");
			document.write("<PARAM NAME=\"AllowFullScreen\" VALUE=\"false\">");
			document.write("<embed src=\""+filename+"\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"");
			document.write(" type=\"application/x-shockwave-flash\" width=\""+width+"\" height=\""+height+"\" flashvars=\""+flashvars+"\"> </embed>");
			document.write("</OBJECT>");
		}

	//将数字按指定的小数点位数进行格式化
	function FormatNumber(srcStr,nAfterDot)
	{
		var srcStr,nAfterDot;
		var resultStr,nTen;
		srcStr = ""+srcStr+"";
		strLen = srcStr.length;
		dotPos = srcStr.indexOf(".",0);
		if(dotPos == -1)
		{
			if(nAfterDot == 0)
			{
				resultStr = srcStr;
			}
			else
			{
				resultStr = srcStr+".";
			}
			for(i=0;i<nAfterDot;i++)
			{
				resultStr = resultStr+"0";
			}
			return resultStr;
		}
		else
		{
			if((strLen - dotPos - 1) >= nAfterDot)
			{
				nAfter = dotPos + nAfterDot + 1;
				nTen = 1;
				for(j=0;j<nAfterDot;j++)
				{
					nTen = nTen*10;
				}
				resultStr = Math.round(parseFloat(srcStr)*nTen)/nTen+"";
				strLen1 = resultStr.length;
				dotPos1 = resultStr.indexOf(".",0);
				if(dotPos1 == -1)
				{
					return FormatNumber(resultStr,nAfterDot);
				}
				else
				{
					if(strLen1-dotPos1-1<nAfterDot)
					{
						for(i=0;i<(nAfterDot-strLen1+dotPos1+1);i++)
						{
							resultStr = resultStr+"0";
						}
					} 
				}
				return resultStr;
			}
			else
			{
				resultStr = srcStr;
				for(i=0;i<(nAfterDot-strLen+dotPos+1);i++)
				{
					resultStr = resultStr+"0";
				}
				return resultStr;
			}
		}
	}    
	
//字符串处理
	function LTrim(str)
	{
		var whitespace = new String(" \t\n\r");
		var s = new String(str);
		if (whitespace.indexOf(s.charAt(0)) != -1)
		{
			var j=0, i = s.length;
			while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
			{
				j++;
			}
			s = s.substring(j, i);
		}
		return s;
	}
	
	
	function RTrim(str)
	{
		var whitespace = new String(" \t\n\r");
		var s = new String(str);
		if (whitespace.indexOf(s.charAt(s.length-1)) != -1)
		{
			var i = s.length - 1;
			while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
			{
				i--;
			}
			s = s.substring(0, i+1);
		}
		return s;
	}


	function Trim(str)
	{
		return RTrim(LTrim(str));
	}


// 得到当前控件的绝对坐标数值
// this.offsetHeight(控件高) + window.screenTop(屏幕初始高) - document.body.scrollTop(滚动数值) 
	function getY(e)
	{
	    var y=e.offsetTop;
		while(e=e.offsetParent)
		{
			y+=e.offsetTop ;
			      			
		}
		
		return y;
	}
	
	function getX(e)
	{
		var x=e.offsetLeft;
		while(e=e.offsetParent)
		{
			x+=e.offsetLeft  ;
		}
		
		return x;	
	}
	
	//分隔符的字符串处理，返回个数和指定位置的子字符串.
	function DismemberStringCount(strSource,strSeparator)
	{
		return (strSource.split(strSeparator)).length;
	}

	function DismemberString(strSource,strSeparator,iNum)	
	{
		var iNum1 = DismemberStringCount(strSource,strSeparator);
		if(iNum < iNum1)
		{
			return Trim((strSource.split(strSeparator))[iNum]);
		}
		else
		{
			return Trim((strSource.split(strSeparator))[iNum1 - 1]);
		}
		
	}
	
	//选择表格的一行，并将该行的索引值保存在index控件中。
	//选择成功的返回true;没有选择的返回false，index为""
	//index中第一个是被选行之前的颜色，第二个是索引值
	
	function SelectRowData(row,index)
	{
		var j = -1;
		for(i = 0;i < row.parentElement.rows.length;i++)
		{
			
//			row.parentElement.rows[i].style.backgroundColor = "#FFFFFF";
			if(row == row.parentElement.rows[i])
			{
				j = i - 1;
			}				   
		}; 
		
		if(j<0)
		{
			window.document.getElementById(index).value = "";
			return false;
		}
		if((window.document.getElementById(index).value == null) || (window.document.getElementById(index).value == ""))
		{
		}
		else
		{
			k0 = (window.document.getElementById(index).value).indexOf(",");
			k1 = (window.document.getElementById(index).value).length;
			color0 = (window.document.getElementById(index).value).substring(0,k0);
			i = (window.document.getElementById(index).value).substring(k0+1,k1);
			if(row.parentElement.rows[parseInt(i)+1] != null)
			{
				row.parentElement.rows[parseInt(i)+1].style.backgroundColor = color0;
			}
						
		}
		
		window.document.getElementById(index).value = row.style.backgroundColor;
		window.document.getElementById(index).value +=  "," + j;	
		row.style.backgroundColor = "#669999";
		return true;
		
		//   window.document.Form1.row1.bgColor
	}
		
	 
		
	
