//程序[TL网点]版权所有 http://www.tlweb.net

//右键提示函数，TL编制
function mouseright(text)
{ text_title=text;
  document.onmousedown=mouse_right;
}
function mouse_right()
{ if(event.button >=2 )
    { alert(text_title);
      return false;
    }
   else return true;
}

//得到随机整数函数，TL编制
//参数：随机整数上限
function getrandom(n)
{
var m;
m=Math.floor(Math.random()*(n+1));
if(m>n) m=n; else if(m<0) m=0;
return m.toString();
}

//网页标题闪烁函数，TL编制
//参数：标题名
function flash_title(pagename)
{
var tl_now=new Date();
if(tl_now.getSeconds()%2==0)
 document.title=pagename+" ";
 else
 document.title=" "+pagename;
delete tl_now;
setTimeout("flash_title(\""+pagename+"\")",1000);
}

//彩色文本函数，TL编制
//参数：文本,色彩("r"--红,"g"--绿,"b"--蓝,"w"--白,缺省时为白),方向("|"--纵向,"-"--横向,缺剩时为横向)
function colortext(text,textcolor,hv)
{
var l,i,r,c1,c2,c3;
if(typeof(hv)=='undefined') hv="-";
if(typeof(textcolor)=='undefined') textcolor="w"; else textcolor=textcolor.toLowerCase();
if(textcolor=="w"||textcolor=="r"||textcolor=="g"||textcolor=="b")
 {
   r=Math.random()*50;
   l=text.length;
   for(i=0;i < l;i++)
    {
      switch (textcolor)
       {
        case "w":
           c1=c2=c3=Math.floor((l-i)/l*40+215);
           break;
        case "r":
           c1=255; c2=Math.floor(r*Math.sin(i/l)); c3=Math.floor(i/l*r);
           break;
        case "g":
           c2=255; c3=Math.floor(r*Math.sin(i/l)); c1=Math.floor(i/l*r);
           break;
        case "b":
           c3=255; c1=Math.floor(r*Math.sin(i/l)); c2=Math.floor(i/l*r);
           break;
       } 
      document.write(text.substring(i,i+1).fontcolor("#"+I_to_C(c1)+I_to_C(c2)+I_to_C(c3)));
      if(hv=="|") document.write("<BR>");
    }
 }
 else
   document.write(text.fontcolor(textcolor));
}

function I_to_C(I)
{ var c1=Math.floor(I/16),c2=I%16;
  return String.fromCharCode(c1>9?55+c1:48+c1,c2>9?55+c2:48+c2);
}

//无刷新请求服务器节点数据函数，TL编制
//参数：请求ASP文件名,节点名
//返回值:发送到客户端文本
function guestsend_nodedata(aspfile,node_data)
{ var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  xmlhttp.Open("POST",aspfile,false);
  xmlhttp.Send("<NODE>"+escape(node_data)+"</NODE>");
  return unescape(xmlhttp.responseText);
}

//视频播放函数，TL编制
//参数：请求URL文件位置,播放器宽度
//返回值:HTML
function playtv(url,tv_width)
{ var tv_width_=Math.floor(tv_width).toString(),tv_height_=Math.floor(tv_width*0.75+66).toString(),wh;
  if(tv_width>0)
    wh='width="'+tv_width_+'" height="'+tv_height_+'"';
   else
    wh='';
  return '<object '+wh+' classid="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6">  <param name="URL" value="'+url+'">  <param name="rate" value="1">  <param name="balance" value="0">  <param name="currentPosition" value="0">  <param name="defaultFrame" value="">  <param name="playCount" value="1">  <param name="autoStart" value="-1">  <param name="currentMarker" value="-1">  <param name="invokeURLs" value="0">  <param name="baseURL" value="">  <param name="volume" value="80">  <param name="mute" value="0">  <param name="uiMode" value="full">  <param name="stretchToFit" value="0">  <param name="windowlessVideo" value="0">  <param name="enabled" value="-1">  <param name="enableContextMenu" value="0">  <param name="fullScreen" value="0">  <param name="SAMIStyle" value="">  <param name="SAMILang" value="">  <param name="SAMIFilename" value="">  <param name="captioningID" value="">  </object>';
}
