//产生随机数
function CreateRnd() {
   var rnd=Math.random()+"";
   return rnd.substring(2,rnd.length-1);
}
//建立水平滚动
function CreateHorMarquee() {
    var mBody_obj;
    try {
      mBody_obj=document.getElementById(arguments[0]);
	}
	catch(e) {
	   alert("无法获得滚动html域！");
	   return "";
	}
	var mBody_id=arguments[0]+CreateRnd();  //显示图层id
	var mBody_margin_top=arguments[1];		//顶层间隔像素
	var mBody_width=arguments[2];			//滚动宽度
	var mBody_height=arguments[3];			//滚动高度
	var element_space=arguments[4];			//滚动元素间隔

	if(mBody_margin_top<0) mBody_margin_top=0;
	if(mBody_width<0) mBody_width=0;
	if(mBody_height<0) mBody_height=0;
	if(element_space<0) element_space=4;
	
    var elm_html=mBody_obj.innerHTML;
    elm_html=elm_html.replace(/{52a2aaae-085d-4187-97ea-8c30db990436}/img,'<TD noWrap="true">');
    elm_html=elm_html.replace(/{FBF23B40-E3F0-101B-8488-00AA003E56F8}/img,'</TD>\n<TD width="'+element_space+'">\n<IMG height="10" width="'+element_space+'" style="visibility: hidden;">\n</TD>');
    var m=elm_html.match(/^\s*<!--\s*(\S+(\s+\S+)*)\s*-->\s*$/); //去除注释
    if(m!=null) elm_html=m[1];
    else return "";


	if(elm_html=="") return "";

	//alert(elm_html);

    try {
      document.write('<DIV id="'+mBody_id+'" style="MARGIN-TOP: '+mBody_margin_top+'px; OVERFLOW: hidden; WIDTH: '+mBody_width+'px; HEIGHT: '+mBody_height+'px">\n');
      document.write('<TABLE width=0 cellspacing=0>\n');
      document.write('  <TBODY>\n');
      document.write('    <TR>\n');
      document.write('      <TD id='+mBody_id+'1>\n');
      document.write('         <TABLE cellSpacing=0>\n');
      document.write('           <TBODY>\n');
      document.write('             <TR>\n');
      document.write('			    <!--滚动图片 begin-->\n');
	  document.write(elm_html);
//    document.write('				<TD noWrap="true">\n');
//    document.write('				   this is tst mdfdf his llkdfd you lsfsfll fdf  dfdjiyiuflsjfsofuulsjflsfjsl fsfoaufaloveyou\n');
//    document.write('				</TD>\n');
//    document.write('                <TD width="'+element_space+'">\n');
//    document.write('				   <IMG height="10" width="'+element_space+'" style="visibility: hidden;">\n');
//    document.write('				</TD>\n');
      document.write('				<!--滚动图片 end-->\n');
      document.write('             </TR>\n');
      document.write('           </TBODY>\n');
      document.write('         </TABLE>\n');
      document.write('      </TD>\n');
      document.write('      <TD id='+mBody_id+'2></TD>\n');
      document.write('    </TR>\n');
      document.write('  </TBODY>\n');
      document.write('</TABLE>\n');
      document.write('</DIV>\n');	
	}
    catch(e) {
	   //alert(e.description);
	}

	return mBody_id;  //返回id
}
//运行水平滚动
function RunHorMarquee() {
	var mBody_id=arguments[0];  //显示图层id
	var speed=arguments[1];  //速度
	var toward=arguments[2]; //方向
	if(speed<1) speed=10; //速度数值越大速度越慢
    if(mBody_id=="") return;

	try {
	   var demo=document.getElementById(mBody_id);
	   var demo1=document.getElementById(mBody_id+"1");
	   var demo2=document.getElementById(mBody_id+"2");
	   demo2.innerHTML=demo1.innerHTML;
	   var Marquee=function() {
		  if(demo2.offsetWidth-demo.scrollLeft<=0)
		  demo.scrollLeft-=demo1.offsetWidth
		  else{
			demo.scrollLeft++
		  }
	   }
	   var MyMar=setInterval(Marquee,speed)
	   demo.onmouseover=function() {clearInterval(MyMar)}
	   demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}  
	}
	catch(e) {
	}

}
//调用方式
//<span id="scroll1" style="width:0px; height:0px;visibility: hidden;">
//<!--
//{52a2aaae-085d-4187-97ea-8c30db990436}
//this is tst mdfdf his llkdfd you lsfsfll fdf  dfdjiyiuflsjfsofuulsjflsfjsl fsfoaufaloveyou
//{FBF23B40-E3F0-101B-8488-00AA003E56F8}
//-->
//</span>
//创建并运行水平滚动层
//RunHorMarquee(CreateHorMarquee("scroll1",10,700,140,10),10,1);

//在新空窗口中打开一张图片
function my_open_image(url) {
  try
  {
     var wnd=window.open("about:blank");
     wnd.document.open();
     wnd.document.write("<table width='100%' height='100%' border='0' cellpadding='0' cellspacing='0'><tr><td align='center' valign='middle'><img src='"+url+"' border='0'></td></tr></table>");
     wnd.document.close(); 
  }
  catch (e)
  {
	 
  }
}
//在新空窗口中打开一个链接
function my_open_window(url) {
  try
  {
     var wnd=window.open("about:blank","","scrollbars=0,toolbar=no");
	 wnd.document.location.href=url;
  }
  catch (e)
  {
	 
  }
}
//在新空窗口中打开一个链接
function my_open_window_1(url) {
  try
  {
     var wnd=window.open("about:blank","");
	 wnd.document.location.href=url;
  }
  catch (e)
  {
	 
  }
}
//自动缩小到指定表格的大小
function w_resize_t() {
	if (arguments.length<1) return;
    t_name=arguments[0];
	bar_height=18;
    caption_height=25;
    try
    {
      w=eval("document.all."+t_name+".clientWidth");
      h=eval("document.all."+t_name+".clientHeight");  
    }
    catch(e)
    {
      return;
    }
    if(w+bar_height+8>window.screen.width) w=window.screen.width-bar_height-8;
    if(h+caption_height+8>window.screen.height) h=window.screen.height-caption_height-8;
    window.moveTo((window.screen.width-(w+bar_height+8))/2,(window.screen.height-(h+caption_height+8))/2);
    window.resizeTo(w+bar_height+8,h+caption_height+8);
}

//提交表单给另一网页
function my_submit() {
   if(arguments.length<1) {
	  alert("请传入要提交的网页路径！");
	  return;
   }
   ul=arguments[0];
   if(ul=="")
   {
	  alert("请传入要提交的网页路径！");
	  return;
   }

   try
   {
	  
	  with(document.forms[0]) {
		 action=ul;
		 submit();
	  }  
   }
   catch (e)
   {
		//alert(e.description);
   }
	  
}