﻿// CAT网 JavaScript Document

var isIe=(document.all)?true:false;
//设置select的可见状态
function setSelectState(state)
{
var objl=document.getElementsByTagName('select');
for(var i=0;i<objl.length;i++)
{
objl[i].style.visibility=state;
}
}


function mousePosition(ev){
if(ev.pageX || ev.pageY){
return {x:ev.pageX, y:ev.pageY};
}
return {
x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,y:ev.clientY + document.body.scrollTop - document.body.clientTop
};
}


//弹出方法
function showMessageBox(wTitle,content,pos,wWidth){

closeWindow();

var bWidth=parseInt(document.documentElement.scrollWidth);
var bHeight=parseInt(document.documentElement.scrollHeight);

if(isIe){
setSelectState('hidden');}
var back=document.createElement("div");
back.id="back";
var styleStr="top:0px;left:0px;position:absolute;background:#555555;width:"+bWidth+"px;height:"+bHeight+"px;";
styleStr+=(isIe)?"filter:alpha(opacity=70);":"opacity:0.40;";
back.style.cssText=styleStr;
document.body.appendChild(back);

var mesW=document.createElement("div");
mesW.id="mesWindow";
mesW.className="mesWindow";
mesW.innerHTML="<div id='hollowdi1ceng'><div id='hollowdi55ceng'><table width='300' height='30' align='center' background='cats_img/index/hi_k/topbg.gif'><tr><td class='cas_web_12song_hui'>&nbsp;&nbsp;"+wTitle+"</td><td style='width:1px;'><input type='button' onclick='closeWindow();' title='关闭窗口' class='' value='关闭' /></td></tr></table>"+content+"<table width='300' height='5' align='center' background='cats_img/index/hi_k/bottombg.gif'><tr><td></td></tr></table></div></div>";

document.body.appendChild(mesW);
}



function showBackground(obj,endInt){
obj.filters.alpha.opacity+=1;
if(obj.filters.alpha.opacity<endInt){
setTimeout(function(){showBackground(obj,endInt)},8);
}
}
//关闭窗口
function closeWindow()
{
if(document.getElementById('back')!=null)
{
document.getElementById('back').parentNode.removeChild(document.getElementById('back'));
}
if(document.getElementById('mesWindow')!=null)
{
document.getElementById('mesWindow').parentNode.removeChild(document.getElementById('mesWindow'));
}
if(isIe){
setSelectState('');
}
}

//测试弹出
function di1cilaiderenhuikandao(ev){
var objPos = mousePosition(ev);

messContent="<table width='300' height='' border='0' cellpadding='5' cellspacing='0' align='center' bgcolor='#ffffff'><tr><td align='center'><embed src='cats_img/index/hi_k/hihuman.swf' width='280' height='250' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' wmode='transparent' menu='false'></embed></td></tr></table>";

showMessageBox('这个网站是干嘛用的？',messContent,objPos,0);
//控制弹出窗口的宽度
}



<!--罗家良网上的
function mOvr(src){ if (!src.contains(event.fromElement)){src.bgColor = '#100421';src.children(0).style.color=''}}
function mOut(src){ if (!src.contains(event.toElement)){src.bgColor = '';src.children(0).style.color=''}}
-->
