/////////////////////////////
////  月影社区 WF66.COM  ////
////  JS  调用 VER 3.0   ////
/////////////////////////////

//背景图片
//if (screen.width==1024){;document.write("<body background=../../images/bg.gif>");}else{;document.write("<body background=images/bg2.gif>");}

//确认框
function checkclick(msg){if(confirm(msg)){event.returnValue=true;}else{event.returnValue=false;}}

//横点线
function bian_a(){
document.write("<table cellSpacing=0 cellPadding=0 align=center border=0><tr><td height=8 width=8><img src=images/bian/bg_0ltop.gif></td><td background=images/bian/bg_01.gif></td><td><img src=images/bian/bg_0rtop.gif></td></tr><tr><td background=images/bian/bg_03.gif></td><td vAlign=center align=middle bgColor=#ffffff>")
}

function bian_b(){
document.write("</td><td background=images/bian/bg_04.gif></td></tr><tr><td><img src=images/bian/bg_0lbottom.gif></td><td background=images/bian/bg_02.gif></td><td height=8 width=8><img src=images/bian/bg_0rbottom.gif></td></tr></table>")
}

function xian(){
document.write("<center><table border=0 width=760  cellpadding=0 cellspacing=0 bgcolor=#FFFFFF background=images/t-bg-5.gif height=1><tr><td></td></tr></table></center>")
}

function xian2(){
document.write("<center><table border=0 width=100%  cellpadding=0 cellspacing=0 bgcolor=#FFFFFF background=images/t-bg-5.gif height=1><tr><td></td></tr></table></center>")
}

//显示问候
function wenhou(){
hour=new Date().getHours()
if(hour < 6){document.write(" 凌晨好! ")}
else if (hour < 9){document.write(" 早上好! ")}
else if (hour < 12){document.write(" 上午好! ")}
else if (hour < 14){document.write(" 中午好! ")}
else if (hour < 17){document.write(" 下午好! ")}
else if (hour < 19){document.write(" 傍晚好! ")}
else if (hour < 22){document.write(" 晚上好! ")}
else {document.write(" 夜里好! ")}
}

//MAIL登陆
function gook() {
if (usernameshow.value == "")
{
alert("用户名不可为空");
usernameshow.focus();
return ;
}

if (pwshow.value == "")
{
alert("密码不可为空");
pwshow.focus();
return ;
}
f1.username.value = usernameshow.value;
f1.pwhidden.value = encode(pwshow.value, parseInt(f1.picnum.value));
f1.submit();
}

function encode(datastr, bassnum) {
var tempstr;
var tchar;
var newdata = "";
for (var i = 0; i < datastr.length; i++)
{
tchar = 65535 + bassnum - datastr.charCodeAt(i);
tchar = tchar.toString();
while(tchar.length < 5)
{
tchar = "0" + tchar;
}
newdata = newdata + tchar;
}
return newdata;
}


//鼠标滚动图片大小
function moon_img(e, o)
{
var zoom = parseInt(o.style.zoom, 10) || 100;
zoom += event.wheelDelta / 12;
if (zoom > 0) o.style.zoom = zoom + '%';
return false;
}


//搜索
function gosearch()
 {
var key=document.myform.keyword.value;
 var openNum=0;
 for (var i=0;i<document.myform.checkbox.length;i++)
 {
 if (document.myform.checkbox[i].checked)
 {
 openNum += 1;
 if (key!="")
 {
 window.open(document.myform.checkbox[i].value.replace("wf66com",key));
 }else{
 window.open(document.myform.checkbox[i].value);
 }
 }
 }
 //如果没有选择搜索引擎用第一个搜索引擎搜索
 if (openNum==0)
 {
 if (key!="")
 {
 window.open(document.myform.checkbox[0].value.replace("wf66com",key));
 }else{
 window.open(document.myform.checkbox[0].value);
 } 
 }
 return false;
 }


//表单提交
function ybbsize(theSmilie){
if (theSmilie) {
document.form.content.value= '[size=' + theSmilie + ']'+ document.form.content.value + '[/size]';
}
}
function ybbfont(theSmilie){
if (theSmilie) {
document.form.content.value= '[font=' + theSmilie + ']'+ document.form.content.value + '[/font]';
}
}
function YBBurl() {
var enterURL   = prompt("请输入主页地址", "http://");
if (enterURL) {
var ToAdd = "[URL]"+enterURL+"[/URL]";
document.form.content.value+=ToAdd;
}
}
function YBBimage() {
var enterURL   = prompt("请输入图片地址", "http://");
if (enterURL) {
var ToAdd = "[IMG]"+enterURL+"[/IMG]";
document.form.content.value+=ToAdd;
}
}
function YBBemail() {
var emailAddress = prompt("请输入邮件地址","");
if (emailAddress) {
var ToAdd = "[EMAIL]"+emailAddress+"[/EMAIL]";
document.form.content.value+=ToAdd;
}
}
function YBBflash() {
var enterURL  = prompt("请输入FLASH地址", "http://");
var entersize = prompt("请输入视频的宽度高度", "500,375");
if (enterURL) {
var ToAdd = "[FLASH="+entersize+"]"+enterURL+"[/FLASH]";
document.form.content.value+=ToAdd;
}
}
function YBBrm() {
var enterURL  = prompt("请输入RealPlayer文件地址", "");
var entersize = prompt("请输入视频宽度,高度", "500,375");
if (enterURL) {
var ToAdd = "[RM="+entersize+"]"+enterURL+"[/RM]";
document.form.content.value+=ToAdd;
}
}
function YBBmp() {
var enterURL  = prompt("请输入Media Player文件地址", "");
var entersize = prompt("请输入视频宽度,高度", "500,420");
if (enterURL) {
var ToAdd = "[MP="+entersize+"]"+enterURL+"[/MP]";
document.form.content.value+=ToAdd;
}
}
function YBBbold() {
document.form.content.value="[B]"+document.form.content.value+"[/B]";
}
function YBBitalic() {
document.form.content.value="[I]"+document.form.content.value+"[/I]";
}
function YBBunder() {
document.form.content.value="[U]"+document.form.content.value+"[/U]";
}
function YBBcenter() {
document.form.content.value="[CENTER]"+document.form.content.value+"[/CENTER]";
}
function YBBquote() {
document.form.content.value="[QUOTE]"+document.form.content.value+"[/QUOTE]";
}
function MM_findObj(n, d) { 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i>d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}
function insertTag(MyString)
{
fontbegin='[color=' + MyString + ']'
fontend='[/color]'
document.form.content.value=fontbegin+document.form.content.value+fontend;
document.form.content.focus();
}
var base_hexa = "0123456789ABCDEF";
function dec2Hexa(number)
{
   return base_hexa.charAt(Math.floor(number / 16)) + base_hexa.charAt(number % 16);
}
function RGB2Hexa(TR,TG,TB)
{
  return "#" + dec2Hexa(TR) + dec2Hexa(TG) + dec2Hexa(TB);
}
function lightCase(MyObject,objName)
{
	MM_findObj(objName).bgColor = MyObject.bgColor;
}
col = new Array;
col[0] = new Array(255,0,255,-1,255,-1);
col[1] = new Array(255,0,0,1,0,0);
col[2] = new Array(255,-1,255,0,0,0);
col[3] = new Array(0,0,255,0,0,1);
col[4] = new Array(0,0,255,-1,255,0);
col[5] = new Array(0,1,0,0,255,0);
col[6] = new Array(255,-1,0,0,255,-1);

function rgb(pas,w,h){
	for (j=0;j<6+1;j++){
		for (i=0;i<pas+1;i++){
			r = Math.floor(col[j][0]+col[j][1]*i*(255)/pas);
			g = Math.floor(col[j][2]+col[j][3]*i*(255)/pas);
			b = Math.floor(col[j][4]+col[j][5]*i*(255)/pas);
		  codehex = r + '' + g + '' + b;
		  document.write('<td bgColor=\"' + RGB2Hexa(r,g,b) + '\"onmouseover="lightCase(this,\'ColorUsed\')" onClick=\"insertTag(this.bgColor)\" width=\"'+w+'\" height=\"'+h+'\"><IMG height='+h+' width='+w+' border=0 title=\"字体颜色：'+RGB2Hexa(r,g,b)+'\"></TD>\n');
		}
	}
}

//双击自动滚屏
var currentpos,timer;
function sc(){clearInterval(timer);}
function initialize(){timer=setInterval("scrollwindow()",1);}
function scrollwindow(){currentpos=document.body.scrollTop;window.scroll(0,++currentpos);}
document.onmousedown=sc
document.ondblclick=initialize
//表单透明样式
function App(st) {
st.style.filter = 'alpha(opacity=100)'
}			
function DisApp(st) {
st.style.filter = 'alpha(opacity=38)';
}

//变色连接
var rate = 20; 
var obj; 
var act = 0; 
var elmH = 0; 
var elmS = 128; 
var elmV = 255; 
var clrOrg; 
var TimerID; 
var pltsPop=null;
var pltsoffsetX = 10;   // 弹出窗口位于鼠标左侧或者右侧的距离；
var pltsoffsetY = 10;  // 弹出窗口位于鼠标下方的距离；
var pltsPopbg="#FFffff"; //背景色
var pltsPopfg="#880000"; //前景色
var pltsTitle="";
if (navigator.appName.indexOf("Microsoft",0) != -1 && parseInt(navigator.appVersion) >= 4) { 
Browser = true; 
} else { 
Browser = false; 
} 

if (Browser) { 
document.onmousemove = moveToMouseLoc;
document.onmouseover = doRainbowAnchor; 
document.onmouseout = stopRainbowAnchor; 
} 

document.write('<div id=pltsTipLayer style="display: none;position: absolute; z-index:10001"></div>');

function doRainbowAnchor() 
//--------变色
{ 
//if (Browser && act != 1) { 
//obj = event.srcElement; 
//while (obj.tagName != 'A' && obj.tagName != 'BODY') { 
//obj = obj.parentElement; 
//if (obj.tagName == 'A' || obj.tagName == 'BODY') 
//break; 
//} 
//if (obj.tagName == 'A' && obj.href != '') { 
//act = 1; 
//clrOrg = obj.style.color; 
//TimerID = setInterval("ChangeColor()",100); 
//} 
//} 
//---------变色、显示

{  var o=event.srcElement;
    if(o.alt!=null && o.alt!=""){o.dypop=o.alt;o.alt=""};
    if(o.title!=null && o.title!=""){o.dypop=o.title;o.title=""};
    pltsPop=o.dypop;
    if(pltsPop!=null&&pltsPop!=""&&typeof(pltsPop)!="undefined")
    {
pltsTipLayer.style.left=-1000;
pltsTipLayer.style.display='';
var Msg=pltsPop.replace(/\n/g,"<br>");
Msg=Msg.replace(/\0x13/g,"<br>");
var re=/\{(.[^\{]*)\}/ig;
if(!re.test(Msg))pltsTitle="";
else{
   re=/\{(.[^\{]*)\}(.*)/ig;
     pltsTitle=Msg.replace(re,"$1")+" ";
   re=/\{(.[^\{]*)\}/ig;
   Msg=Msg.replace(re,"");
   Msg=Msg.replace("<br>","");}
   var attr=(document.location.toString().toLowerCase().indexOf("")>0?"nowrap":"");
        var content =
       '<table style="FILTER:alpha(opacity=100) shadow(color=#6f6f6f,direction=135);" id=toolTipTalbe ><tr><td><table class=td_m cellspacing="0" cellpadding="0" border=0 style="width:100%">'+
       '<tr id=pltsPoptop ><th valign=bottom  class=td_m><p id=topleft align=left>'+pltsTitle+'</p><p id=topright align=right style="display:none">'+pltsTitle+'</th></tr>'+
       '<tr><td "+attr+" class=bg_td style="padding-left:5px;padding-right:5px;padding-top: 3px;padding-bottom:3px;line-height:135%">'+Msg+'</td></tr>'+
       '<tr id=pltsPopbot style="display:none"><th valign=bottom><p id=botleft align=left>'+pltsTitle+'</p><p id=botright align=right style="display:none">'+pltsTitle+'</th></tr>'+
       '</table></td></tr></table>';
        pltsTipLayer.innerHTML=content;
        toolTipTalbe.style.width=Math.min(pltsTipLayer.clientWidth,document.body.clientWidth/2.2);
        moveToMouseLoc();
        return true;
       }
    else
    {
     pltsTipLayer.innerHTML='';
       pltsTipLayer.style.display='none';
        return true;
    }
}

//----------显示
}


function doRainbow() 
{ 
if (Browser && act != 1) { 
act = 1; 
obj = event.srcElement; 
clrOrg = obj.style.color; 
TimerID = setInterval("ChangeColor()",100); 
} 
} 
function stopRainbow() 
{ 
if (Browser && act != 0) { 
obj.style.color = clrOrg; 
clearInterval(TimerID); 
act = 0; 
} 
} 

function stopRainbowAnchor() 
{ 
if (Browser && act != 0) { 
if (obj.tagName == 'A') { 
obj.style.color = clrOrg; 
clearInterval(TimerID); 
act = 0; 
} 
} 
} 
function ChangeColor() 
{ 
obj.style.color = makeColor(); 
} 
function makeColor() 
{ 
if (elmS == 0) { 
elmR = elmV; elmG = elmV; elmB = elmV; 
} 
else { 
t1 = elmV; 
t2 = (255 - elmS) * elmV / 255; 
t3 = elmH % 60; 
t3 = (t1 - t2) * t3 / 60; 
if (elmH < 60) { 
elmR = t1; elmB = t2; elmG = t2 + t3; 
} 
else if (elmH < 120) { 
elmG = t1; elmB = t2; elmR = t1 - t3; 
} 
else if (elmH < 180) { 
elmG = t1; elmR = t2; elmB = t2 + t3; 
} 
else if (elmH < 240) { 
elmB = t1; elmR = t2; elmG = t1 - t3; 
} 
else if (elmH < 300) { 
elmB = t1; elmG = t2; elmR = t2 + t3; 
} 
else if (elmH < 360) { 
elmR = t1; elmG = t2; elmB = t1 - t3; 
} 
else { 
elmR = 0; elmG = 0; elmB = 0; 
} 
} 
elmR = Math.floor(elmR); 
elmG = Math.floor(elmG); 
elmB = Math.floor(elmB); 
clrRGB = '#' + elmR.toString(16) + elmG.toString(16) + elmB.toString(16); 
elmH = elmH + rate; 
if (elmH >= 360) 
elmH = 0; 
return clrRGB; 
}


function moveToMouseLoc()
{
if(pltsTipLayer.innerHTML=='')return true;
var MouseX=event.x;
var MouseY=event.y;
//window.status=event.y;
var popHeight=pltsTipLayer.clientHeight;
var popWidth=pltsTipLayer.clientWidth;
if(MouseY+pltsoffsetY+popHeight>document.body.clientHeight)
{
    popTopAdjust=-popHeight-pltsoffsetY*1.5;
    pltsPoptop.style.display="none";
    pltsPopbot.style.display="";
}
  else
{
     popTopAdjust=0;
    pltsPoptop.style.display="";
    pltsPopbot.style.display="none";
}
if(MouseX+pltsoffsetX+popWidth>document.body.clientWidth)
{
  popLeftAdjust=-popWidth-pltsoffsetX*2;
  topleft.style.display="none";
  botleft.style.display="none";
  topright.style.display="";
  botright.style.display="";
}
else
{
  popLeftAdjust=0;
  topleft.style.display="";
  botleft.style.display="";
  topright.style.display="none";
  botright.style.display="none";
}
pltsTipLayer.style.left=MouseX+pltsoffsetX+document.body.scrollLeft+popLeftAdjust;
pltsTipLayer.style.top=MouseY+pltsoffsetY+document.body.scrollTop+popTopAdjust;
   return true;
}