//var webUrl = "http://"+location.host+"/mytb";
var webUrl = "http://www.woniu8.com";
function goIndex(){
	document.location = encodeURI(webUrl);
}

function isIE(){ //ie?
if (window.navigator.userAgent.toLowerCase().indexOf("msie")>=1)
    return true;
else
    return false;
}

if(!isIE()){ //firefox innerText define
    HTMLElement.prototype.__defineGetter__("innerText",
    function(){
        var anyString = "";
        var childS = this.childNodes;
        for(var i=0; i<childS.length; i++) {
            if(childS[i].nodeType==1)
                //anyString += childS[i].tagName=="BR" ? "\n" : childS[i].innerText;
                anyString += childS[i].innerText;
            else if(childS[i].nodeType==3)
                anyString += childS[i].nodeValue;
        }
        return anyString;
    }
    );
    HTMLElement.prototype.__defineSetter__("innerText",
    function(sText){
        this.textContent=sText;
    }
    );
}

function setHomePage(hrefValue)
{
	if(document.all) 
	{
	   document.body.style.behavior = 'url(#default#homepage)';
	   document.body.setHomePage(hrefValue);
	}
	else if(window.sidebar) 
	{
		if(window.netscape) 
		{ 
			try 
			{ 
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); 
			} 
			catch(e) 
			{ 
				alert("您的浏览器禁用了此项功能！"); 
			} 
		} 
		var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch); 
		prefs.setCharPref('browser.startup.homepage',hrefValue);
	}
}
function AddFavorite(hrefValue,hrefName)
{
	if ( document.all )
	{
           window.external.addFavorite(hrefValue, hrefName);
       }
       else if( window.sidebar )
       {
           window.sidebar.addPanel( hrefName,hrefValue,'');
       }

}

function blurclick(objid,strvalue,regvalue){
	if(strvalue.length<=0){
		document.getElementById(objid).value=regvalue;
		document.getElementById(objid).className="textboxgray";
	}else{
		document.getElementById(objid).className="textbox";
	}
}

function focusclick(objid,strvalue,regvalue){
	document.getElementById(objid).className="textbox";
	if(strvalue.indexOf(regvalue)>=0){
		document.getElementById(objid).value='';
	}
}
//flash调用
function showFlash(byPath, byWidth, byHeight)
{
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' + byWidth + '" height="' + byHeight + '">');
	document.write(' <param name="movie" value="' + byPath + '">');
	document.write(' <param name="quality" value="high">');
	document.write(' <param name="menu" value="false">');
	document.write(' <param name="wmode" value="transparent">');
	document.write(' <param name="bgcolor" value="#ffffff">');
	document.write(' <embed src="' + byPath + '" quality="high" pluginspage="https://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + byWidth + '" height="' + byHeight + '"></embed>');
	document.write('</object>');
}

function flashFunc(obj,message,color1,color2)
{
	var n=0; 
	for(m=0;m<message.length;m++) 
		obj.innerHTML+='<span id="neonlight'+m+'" style="font-size:12px;color:'+color1+'">'+message.charAt(m)+'</span>';
	function neon()
	{ 
		if (n==0)
		{ 
			for (var m=0;m<message.length;m++) 
			{
				document.getElementById("neonlight"+m).style.color=color1;
			}
		} 
		document.getElementById("neonlight"+n).style.color=color2;
		if (n<message.length-1) n++;
		else n=0;
		setTimeout(neon,50);
   } 
neon();
}

var mouseX;
var mouseY;
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 mouseMove(ev){
    ev = ev || window.event;
    var mousePos = mousePosition(ev);
    mouseX = mousePos.x;
  	mouseY = mousePos.y;
}

document.onmousemove = mouseMove;

function enterRun(eleid){
    if (event.keyCode == 13)
    {
		document.getElementById(eleid).click();
	}
}

function div_show(open_div,close_div,oClassName,cClassName){
	document.getElementById(open_div+'_c').style.display = "";
	document.getElementById(open_div).className = oClassName;
	
	var arr_div = close_div.split(',');
	for(var i=0;i<arr_div.length;i++){
		document.getElementById(arr_div[i]).className = cClassName;
		document.getElementById(arr_div[i]+'_c').style.display = "none";
	}
}

function changeClass(clsName,idName){
	document.getElementById(idName).className = clsName;
}

function enterRun(eleid,evt){
	if (!evt) {    
       evt = window.event;    
   	}
    if (evt.keyCode == 13)
    {
    	if(document.all) 
		{ 
		document.getElementById(eleid).click();
		} 
		else 
		{ 
		var evt1 = document.createEvent("MouseEvents"); 
		evt1.initEvent("click", true, true); 
		document.getElementById(eleid).dispatchEvent(evt1); 
		}
		
	}
}
