/******************************************************

             好心情多用户留言系统 ver 1.0

         程序设计：E路飞扬
         版权所有：心扬工作室

         发布：2005-12-5
         演示：http://xchngg.126.com
          技术支持:http://www.yuepin.com/bbs

*******************************************************/
function findObj(theObj, theDoc){
	var i, foundObj;
<!--//  
	if(!theDoc) theDoc = document;
	if(!(foundObj = theDoc[theObj]) && theDoc.all)
  		foundObj = theDoc.all[theObj];
	for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    	foundObj = theDoc.forms[i][theObj];
	if(!foundObj && document.getElementById)
  		foundObj = document.getElementById(theObj);

	return foundObj;
}

// -----------------------------------------
//            Show Date & Time
// -----------------------------------------
function timeString(){
	today=new Date();
	var hours = today.getHours();
	var minutes = today.getMinutes();
	var seconds = today.getSeconds();
	var timeValue = ((hours >12) ? hours -12 :hours); timeValue += ((minutes < 10) ? ":0" : ":") + minutes;
	timeValue += (hours >= 12) ? " PM" : " AM";
	timeString= document.write("",today.getYear(),"-","",today.getMonth()+1,"-","",today.getDate()," ",timeValue);
	return timeString
}


// -----------------------------------------
//             Creat Tool Tips
// -----------------------------------------

/* Example:
 <BODY>
 <div id="toolTipLayer" style="position:absolute; visibility: hidden; z-index:0"></div>
 <script language="JavaScript"> initToolTips(); </script>
 ...
 <span onMouseOver="showToolTip('标签文字');" onMouseOut ="showToolTip();">hello,world</a>
 ...
*/

var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var ie4 = document.all;
var offsetX = 0;
var offsetY = 20;
var toolTipSTYLE="";

function initToolTips(){
  if(ns4||ns6||ie4){
    if(ns4) toolTipSTYLE = document.toolTipLayer;
    else if(ns6) toolTipSTYLE = document.getElementById("toolTipLayer").style;
    else if(ie4) toolTipSTYLE = document.all.toolTipLayer.style;
    if(ns4) document.captureEvents(Event.MOUSEMOVE);
    else {
      toolTipSTYLE.visibility = "visible";
      toolTipSTYLE.display = "none";
    }
    document.onmousemove = moveToMouseLoc;
  }
}

function showToolTip(content){
  if(content==null) { // hide: note - function ... showToolTip.arguments ... 
    if(ns4) toolTipSTYLE.visibility = "hidden";
    else toolTipSTYLE.display = "none";
  } else { // show
    if(ns4){
      toolTipSTYLE.document.write(content);
      toolTipSTYLE.document.close();
      toolTipSTYLE.visibility = "visible";
    }
    if(ns6){
      document.getElementById("toolTipLayer").innerHTML = content;
      toolTipSTYLE.display='block'
    }
    if(ie4){
      document.all("toolTipLayer").innerHTML=content;
      toolTipSTYLE.display='block'
    }
  }
}

function moveToMouseLoc(e){
  if(ns4||ns6){
    x = e.pageX;
    y = e.pageY;
  } else {
    x = event.x + document.body.scrollLeft;
    y = event.y + document.body.scrollTop;
  }
  toolTipSTYLE.left = x + offsetX;
  toolTipSTYLE.top = y + offsetY;
  return true;
}


// -----------------------------------------

////////////////////   myscript /////////////
function toolTip(msgName, msgEmail, msgPage, msgOicq, msgIp, msgTime){
    if(msgName!=null){
    	var	content = '<table align=left><tr><td nowrap class=ToolTip>' +
    		'　姓名： ' + msgName +  '<br>' +
    		'　邮件： ' + msgEmail +  '<br>' +
    		'　主页： ' + msgPage +  '<br>' +
    		'　Q Q ： ' + msgOicq +  '<br>' +
    		'　I P ： ' + msgIp +  '<br>' +
    		'　时间： ' + msgTime +  '&nbsp\;</td></tr></table>';
		showToolTip(content);    
    }else{
    	showToolTip();
    }
}
///////////////////////
function AddText(NewCode) {
document.FORM.articlecontent.value+=NewCode;
}
function showface(){
 window.open("lib/face.php","faces","top=120,left=320,width=680,height=480,scrollbars=no,resizable=yes,copyhistory=auto");
}

function AddFace(files){
	document.FORM.face.options[document.FORM.face.selectedIndex].value = files;
	alert("你选择的是:"+files);
}
function showimage(){
     document.images.faceimg.src="images/face/"+document.FORM.face.options[document.FORM.face.selectedIndex].value;}
 function room(){
  self.moveTo(0,0)
  self.resizeTo(screen.availWidth,screen.availHeight);
}
/////////add messages/////////
currentX = currentY = 0;
lastScrollX = 0; lastScrollY = 0;
NS = (document.layers) ? 1 : 0;
IE = (document.all) ? 1: 0;

function heartBeat() {
if(IE) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; }
if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; }
if(diffY != lastScrollY) {
percent = .1 * (diffY - lastScrollY);
if(percent > 0) percent = Math.ceil(percent);
else percent = Math.floor(percent);
if(IE) document.all.floater.style.pixelTop += percent;
if(NS) document.floater.top += percent; 
lastScrollY = lastScrollY + percent;
}
position_x=document.body.offsetWidth/2+document.body.scrollLeft-650+280;
if(IE) document.all.floater.style.pixelLeft =position_x;
if(NS) document.floater.left += percent;
}

if(NS || IE) action = window.setInterval("heartBeat()",1);
///////// SHOW MENU /////////////
function MM_findObj(n, d) { //v4.0
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);
if(!x && document.getElementById) x=document.getElementById(n); return x;}
function MM_showHideLayers() { //v3.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
obj.visibility=v; }}
//showhidelayer

function mOvr(src, cOvr) 
{if (!src.contains(event.fromElement)) {src.style.cursor = "default";src.bgColor = cOvr;}}
function mOut(src, cOut) 
{if (!src.contains(event.toElement)) {src.style.cursor = "default";src.bgColor = cOut;}}
//changetdcolor
// -->
