var num = 0;
var vLeft = 100;
var vTop = 100;



    function quciInit(){
		//document.onmouseup=function(){canShow(1);};
		
	    var divs = document.getElementsByTagName("div");
		var centers = document.getElementsByTagName("center");
		var tables = document.getElementsByTagName("table");
		var bodyChild = document.body.childNodes;
		
        for(var i = 0;i<divs.length;i++) 
        {
			//div
			for(var childIndex=0;childIndex<bodyChild.length;childIndex++){
				if(divs[i] == bodyChild[childIndex]){
			        if(divs[i].id){
                        if("neirong1" != divs[i].id && "hlyd" != divs[i].id){
				        	divs[i].onmouseup = function(){canShow(1);};
				        }
			        }else{
			        	divs[i].onmouseup = function(){canShow(1);};
			        }
				}
			}
        }

		for(var i = 0;i<tables.length;i++) 
        {
			//table
			for(var childIndex=0;childIndex<bodyChild.length;childIndex++){
				if(tables[i] == bodyChild[childIndex]){
			        tables[i].onmouseup = function(){canShow(1);};
				}
			}
        }

		/*for(var i = 0;i<centers.length;i++) 
        {
			//center
			for(var childIndex=0;childIndex<bodyChild.length;childIndex++){
				if(centers[i] == bodyChild[childIndex]){
			        centers[i].onmouseup = function(){canShow(1);};
				}
			}
        }*/
		
	};

function canShow(param){
	if(num>0){
	    num +=param;
		return;
	}else{
	    num +=param;
		vLeft = mouseX(event);
		vTop = mouseY(event);
	}
	setTimeout(getWordProxy,500);
};

function getWordProxy(){
    if(num==1){
	    if(getWords()){
	        document.getElementById("neirong").value=document.getElementById("neirong").value + getWords();
		    showMessage('neirong1');
		}else{
		    Hide();
		}
	}else{
	    document.getElementById("neirong").value=document.getElementById("neirong").value;
		showMessage('neirong1');
	}
	num=0;
};

function getWords()
{   
    var text;
	if (window.getSelection) {
        text = window.getSelection().toString()
    } else {
        if (document.selection && document.selection.createRange) {
            text = document.selection.createRange().text
        }
    }
    return text;
};

function slow_hide()
{
  document.getElementById("neirong").value=''; 	
};


function mouseX(evt) {
    if (evt.pageX) return evt.pageX;
	else if (evt["clientX"])
	   return evt.clientX + (document.documentElement.scrollLeft ?
	   document.documentElement.scrollLeft :
	   document.body.scrollLeft);
	else return null;
};

function mouseY(evt) {
	if (evt.pageY) return evt.pageY;
	else if (evt.clientY)
	   return evt.clientY + (document.documentElement.scrollTop ?
	   document.documentElement.scrollTop :
	   document.body.scrollTop);
	else return null;
};

function showMessage(showid){
   var infoDiv = document.getElementById('neirong1');
   infoDiv.style.left = vLeft;
   infoDiv.style.top = vTop;
   document.getElementById(showid).style.display='block';
   JsUtil.fadeIn(showid);
};

function Hide(){
    var m=document.getElementById("neirong1");
    if(m)
        m.style.display="none";
};

quciInit();


document.write('<div id="neirong1" style="display:none;position:absolute; left:483px; top:433px;width:280px; border:1px #F7D670 solid; background-color:#FFFBEC; font-size:12px; z-index:2;"><span style="float:left;  color:#F60;padding:7px 0 5px 10px; font-weight:bold;">&#25105;&#35201;&#33719;&#21462;&#30340;&#25991;&#23383;</span><span onClick="Hide()" style="cursor:pointer; float:right; padding-top:5px;"><img src="image/closel.gif" border="0" /></span><textarea style="overflow:visible; width:270px; padding:5px;font-size:9pt; line-height:18px; background:url(image/bg.gif) repeat center; border:none; " id="neirong" ></textarea><span style="margin-left:10px;">&#30005;&#35805;&#21495;&#30721;&#65306;<input type="text" size="20" id="vphone"></span><div id="hlyd" style="padding:5px 0 5px 40px;"><input type="button" onClick="sendSms()" value="&#21457;&#36865;" style="border:1px #FDCB9D solid; background-color:#F4A224; width:60px; color:#fff; height:20px; line-height:18px;" />&nbsp;&nbsp;&nbsp;<input type="button" value="&#37325;&#32622;" onClick="slow_hide()"  style="border:1px #FDCB9D solid; background-color:#F4A224; width:60px; color:#fff; height:20px; line-height:18px;"/></div></div>');
