// JavaScript Document


function GetId(id){ // support to more explorer
    if(document.getElementById)
        return document.getElementById(id);
    else if(document.all)
        return document.all[id];
    else if(document.layers)
        return document.layers[id];
    else
        return eval(id);
}

var sUserAgent = navigator.userAgent;
var isOpera = sUserAgent.indexOf("Opera") > -1;
var isIE = sUserAgent.indexOf("compatible") > -1 && sUserAgent.indexOf("MSIE") > -1 && !isOpera;

function getAbsoluteOffsetTop(obj) {
var y = obj.offsetTop;
while (obj = obj.offsetParent) y += obj.offsetTop;
return y;
}

function getAbsoluteOffsetLeft(obj) {
var x = obj.offsetLeft;
while (obj = obj.offsetParent) x += obj.offsetLeft;
return x;
}

function scrollUp(Obj){
  	var speed = 8,te;
    if(getAbsoluteOffsetTop(Obj) < document.documentElement.scrollTop){
        document.documentElement.scrollTop = document.documentElement.scrollTop + (getAbsoluteOffsetTop(Obj) - 5 - document.documentElement.scrollTop)/speed;
		te = window.setTimeout(scrollUp,1,Obj);
	}
	else{
		clearTimeout(te);
	}
}


function winDiv(id){
	this.id = id;
	this.loadHeight = 320; //loading plant height	
	//var state;
}
winDiv.prototype = {
	commentInit : function (){
	    var Obj = GetId("winDiv");
	    if(Obj.style.display=="none"){
	        InitMask(30);
	        scrollUp(GetId("Article_top"+this.id));
		    Obj.style.top =getAbsoluteOffsetTop(GetId("Article_co"+this.id))+"px";
		    Obj.style.left =getAbsoluteOffsetLeft(GetId("Article_co"+this.id))+"px";
		    GetId("winDiv_co").style.width = "575px";
		    GetId("winDiv_tb").style.width="600px";
	     	GetId("winDiv_dr").style.width="600px";
		    GetId("winDiv_co").style.height = "0px";

		    GetId("bt_max").style.display = "";
	        GetId("bt_min").style.display = "none";
		    Obj.style.display="";
		    document.documentElement.style.overflowX = "hidden";
		    document.documentElement.style.overflowY = "hidden";
		 //   GetId("winDiv_cl").onclick = this.Close;
		}		
		GetId("winDiv_if").src="Iframe_comment.aspx?ArtId="+this.id;
        document.documentElement.style.width="500px";
	},
/*	winInit : function(src){
		var Obj = GetId("winDiv");
	    if(Obj.style.display=="none"){
	 //   scrollUp(GetId("Article_top"+this.id));
	    InitMask(50);
	    Obj.style.top =document.documentElement.scrollTop+100+"px";
	  //  Obj.style.left =(document.documentElement.offsetWidth-Obj.offsetWidth)/2+"px";
	  //  Obj.style.top =getAbsoluteOffsetTop(GetId("Article_co"+this.id))+"px";
	 //   Obj.style.left =getAbsoluteOffsetLeft(GetId("Article_co"+this.id))+"px";
	    GetId("winDiv_co").style.height = "0px";
		GetId("winDiv_co").style.width = "890px";
		GetId("winDiv_tb").style.width="900px";
		GetId("winDiv_dr").style.width="900px";
		GetId("bt_max").style.display = "";
	    GetId("bt_min").style.display = "none";
	    Obj.style.display="";
		//   GetId("winDiv_cl").onclick = this.Close;
		}
		GetId("winDiv_co").style.overflowY = "hidden";
		GetId("winDiv_if").src=src;
	},*/

	Max : function(){
	    GetId("bt_max").style.display = "none";
	    GetId("bt_min").style.display = "";
	    window.toptemp = GetId("winDiv").style.top;
	    GetId("winDiv").style.top =  document.documentElement.scrollTop;
	    GetId("winDiv_co").style.height =  document.documentElement.offsetHeight-40 + "px";
	},
	Min : function(){
		GetId("bt_max").style.display = "";
	    GetId("bt_min").style.display = "none";
	    GetId("winDiv").style.top = window.toptemp;
	    var height = GetId("winDiv_if").Document.documentElement.scrollHeight; 
	    var divHeight = document.documentElement.offsetHeight-getAbsoluteOffsetTop(GetId("winDiv"))+document.documentElement.scrollTop-GetId("winDiv_tb").offsetHeight-GetId("winDiv_dr").offsetHeight-25;
	    if(height > divHeight){
	        GetId("winDiv_co").style.height =divHeight + "px"; 
	    }
	    else{
	        GetId("winDiv_co").style.height = GetId("winDiv_if").Document.documentElement.scrollHeight + "px";
	    }
	},
	tbClick : function(){
	    if(GetId("bt_max").style.display != "none")
	        this.Max();
	    else
	        this.Min();
	},
	Close : function(){
	//alert(this.loadHeight)
	GetId("winDiv").style.display="none";
    EndMask();
   
    document.documentElement.style.overflowY = "auto";
	}

}
function InitMask(alpha){
	var div = document.createElement("div");
	div.id = "maskDiv";
	with (div.style) {
		zIndex = 99;
		filter = "Alpha(Opacity="+alpha+")";
		opacity = "0.5";
		backgroundColor ="black";
		position = "absolute";
		top=0+"px";
		}
	//	div.style = "position:absolute;top:0px;left:0px; background-color:black";
	div.style.width = document.documentElement.offsetWidth+"px";
	div.style.height = document.documentElement.scrollHeight+21 +"px";
	return document.body.appendChild(div);
	}
function EndMask(){
	GetId("maskDiv").parentNode.removeChild(GetId("maskDiv"))//for w3c
}
function InitGray(){
    document.body.style.filter="Gray";
}
function EndGray(){
    document.body.style.filter=null;
}
var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
//extra height in px to add to iframe in FireFox 1.0+ browsers
var FFextraHeight=getFFVersion>=0.1? 16 : 0
function LoadWindowSize(id){
    var idif = GetId(id+"_if");
    var idco = GetId(id+"_co");
    GetId(id+"_ti").innerText = idif.Document.title;
    var height = idif.height = idif.Document.documentElement.scrollHeight; 
    if(GetId("bt_max").style.display == "none"){
        idco.style.height = document.documentElement.offsetHeight-40 + "px";
    }
    else{
        var divHeight = document.documentElement.offsetHeight-getAbsoluteOffsetTop(GetId(id))+document.documentElement.scrollTop-GetId(id+"_tb").offsetHeight-GetId(id+"_dr").offsetHeight-25;
        height>divHeight ? Pop(idco,divHeight) : Pop(idco, height);
    /*	if(height>divHeight){
    	   // idco.offsetHeight<divHeight?Pop(idco,divHeight):Pop1(idco,divHeight);
        	//Pop(idco,divHeight);
    	}
    	else{
           	//idco.offsetHeight<height?Pop(idco, height):Pop1(idco, height);
    	   // Pop(idco, height);
	    }
	    */
	}
   /* if(id.Document.body.scrollWidth)
        id.height = id.Document.body.scrollHeight; 
    else if(id.contentDocument.body.offsetWidth)
        id.height = id.contentDocument.body.offsetHeight + FFextraHeight;*/
}

var __sto = setTimeout;    
window.setTimeout = function(callback,timeout,param){    
    var args = Array.prototype.slice.call(arguments,2);    
    var _cb = function(){    
        callback.apply(null,args);    
    }    
    __sto(_cb,timeout);    
}  
function Pop(Obj,height){
	var speed = 3,te;
    if(Obj.offsetHeight < height){
		Obj.style.height = Obj.offsetHeight + (height+8-Obj.offsetHeight)/speed+"px";
		te = window.setTimeout(Pop,1,Obj,height);
	}
	else{
		clearTimeout(te);
		//alert('aa');
	}
}

/*function Pop1(Obj,height){
	var speed = 8,te;
    if(Obj.offsetHeight > height+8){
		Obj.style.height = Obj.offsetHeight + (height-Obj.offsetHeight)/speed+"px";
		te = window.setTimeout(Pop1,1,Obj,height);
	}
	else{
		clearTimeout(te);
		
	}
}*/

function reHeight(id){
    this.id = id;
	//this.Div = GetId(id);
}
reHeight.prototype = {
	Init : function (){	
		//alert('aa');
		var wd = this;
		document.onselectstart = new Function("return false");
		document.onmousemove = function(){ wd.iMove();} 
		document.onmouseup = function(){ wd.End();}
		
		wd.oldY = event.y;  // oldY = pageY;
		wd.oldDivY = GetId(this.id).offsetHeight; //2为div border
		//alert(this.id);
		wd.win = wd.Init_div();
		wd.mask = wd.Init_mask();
		},
	Init_div : function(){		//Init Div
	    var win = GetId(this.id);
		var div = document.createElement("div");
		div.id = "reHeightDiv";
		div.style.top = getAbsoluteOffsetTop(win) + "px";
		div.style.left = getAbsoluteOffsetLeft(win) + "px";
		div.style.width = win.offsetWidth + "px";
		div.style.height = this.oldDivY + "px";
		with (div.style) {
			filter = "Alpha(Opacity=15)";
			opacity = "0.5";
			zIndex = 102;
		}
		return document.body.appendChild(div);
	},
	Init_mask : function(){		//Init Mask
		var div = document.createElement("div");
		div.id = "reHeightMask";
		div.style.top = this.win.style.top;
		div.style.left = this.win.style.left;
		div.style.width = this.win.style.width;
		div.style.height = this.oldDivY + "px";
		with (div.style) {
			filter = "Alpha(Opacity=0)";
			opacity = "0.5";
			backgroundColor ="black";
			position = "absolute";
			zIndex = 101;
		}
		return document.body.appendChild(div);
	},
	iMove : function(){	//when move the mouse change the height
		this.win.style.height = this.oldDivY + event.y - this.oldY;
	},
	End : function(){  //the end
		//this.id.style.height = this.div.offsetHeight + "px";
		var height = GetId(this.id+"_co").offsetHeight + this.win.offsetHeight - GetId(this.id).offsetHeight;
	//	if(GetId(this.id+"_if").Document.documentElement.scrollHeight>height){
	//	    if(GetId(this.id+"_co").style.overflowY == "hidden"){
	//	        GetId("winDiv_co").style.overflowY = "scroll";
	//	         GetId("winDiv_co").style.width = GetId("winDiv_co").offsetWidth -10 + "px";
//	//	    }
	//	}
		GetId(this.id+"_co").style.height = height;
		document.onmousemove =null;
		document.onmouseup =null;
		document.onselectstart = new Function("return true");
		this.win.parentNode.removeChild(this.win)//for w3c
		this.mask.parentNode.removeChild(this.mask)//for w3c
	}
}


function getOs()
{
   if(navigator.userAgent.indexOf("MSIE")>0)return 1;;
   if(isFirefox=navigator.userAgent.indexOf("Firefox")>0)return 2;;
   if(isSafari=navigator.userAgent.indexOf("Safari")>0)return 3;;   
   if(isCamino=navigator.userAgent.indexOf("Camino")>0)return 4;;
   if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0)return 5;;
   return 0;;
}
/* 取浏览器 类型 */



/*
tip_top = document.createElement("DIV"); 
tip_top.id = "tip_top"; 
tip_middle = document.createElement("DIV"); 
tip_middle.id = "tip_middle"; 
tip_bottom = document.createElement("DIV"); 
tip_bottom.id = "tip_bottom"; 

toolTip.appendChild(tip_top); 
toolTip.appendChild(tip_middle); 
toolTip.appendChild(tip_bottom); 
*/
  


/* 设置tooltip属性 */

/* 设置tooltip属性 
  popWidth=dypopLayer.clientWidth;   
  popHeight=dypopLayer.clientHeight;   
  if(MouseX+12+popWidth>document.body.clientWidth)   popLeftAdjust=-popWidth-24   
  else   popLeftAdjust=0;   
  if(MouseY+12+popHeight>document.body.clientHeight)   popTopAdjust=-popHeight-24   
  else   popTopAdjust=0;   
  dypopLayer.style.left=MouseX+12+document.body.scrollLeft+popLeftAdjust;   
  dypopLayer.style.top=MouseY+12+document.body.scrollTop+popTopAdjust;   
  dypopLayer.style.filter="Alpha(Opacity=0)";   

*/ 
function showTitleplus(evt) 
{ 
    var titlePlus = GetId("titleplus");
	evt = window.event?window.event:evt; 
	srcElem = evt.srcElement?evt.srcElement:evt.target; 
	if(srcElem.tagName.toUpperCase()=="A" && srcElem.title!="")
	{ 
	   window.title_content = srcElem.title; 
	   srcElem.title = ""; 
	 //  alert(event.x+"##"+event.y);
	   var tempstr = window.title_content;
	   var str = tempstr.split(",");  
	   if(str.length == 2){
	        titlePlus.innerHTML = "<div id=\"titleplus_top\"></div><div id=\"titleplus_content\">"+str[0]+"</div><div id=\"titleplus_bottom\">"+str[1]+"</div>";}
	   else{titlePlus.innerHTML = "<div id=\"titleplus_top\"></div><div id=\"titleplus_content\">"+tempstr+"</div><div id=\"titleplus_bottom\" style='height:15px'></div>";}
	   pos = findPosition(srcElem); 

	   x=pos[0];y=pos[1]; 
	   titlePlus.style.left = event.x+ document.documentElement.scrollLeft - 45 +"px";   
	   if(getOs() == 2){ titlePlus.style.top = event.y -60+"px"; }
	   else{ //cStyle.top = event.y-toolTip.offsetHeight +"px";
	    //  alert(titlePlus.offsetHeight);
	      titlePlus.style.top = y- titlePlus.offsetHeight+"px";
	     // titlePlus.style.top = event.y + document.documentElement.scrollTop - titlePlus.offsetHeight-10 +"px";
	   }
	   titlePlus.style.filter = "Alpha(Opacity=100)"; 
	} 
} 
  
function findPosition( oLink ) { 
  if( oLink.offsetParent ) { 
    for( var posX = 0, posY = 0; oLink.offsetParent; oLink = oLink.offsetParent ) { 
      posX += oLink.offsetLef; 
      posY += oLink.offsetTop; 
    } 
    return [ posX, posY ]; 
  } else { 
    return [ oLink.x, oLink.y ]; 
  } 
} 
  
function hideTitleplus(evt) 
{ 
	GetId("titleplus").style.left="-300px";
    GetId("titleplus").style.filter = "Alpha(Opacity=0)"
    evt = window.event?window.event:evt; 
    srcElem = evt.srcElement?evt.srcElement:evt.target; 
    srcElem.title = window.title_content;
    window.title_content = "";
} 
document.onmouseover = showTitleplus; 
document.onmouseout = hideTitleplus; 

function showTitleplus_manual(thestr) 
{ 
    var titlePlus = GetId("titleplus");
	var tempstr = thestr;
	var str = tempstr.split(",");  
	if(str.length == 2){
	     titlePlus.innerHTML = "<div id=\"titleplus_top\"></div><div id=\"titleplus_content\">"+str[0]+"</div><div id=\"titleplus_bottom\">"+str[1]+"</div>";
	  }
	 else{titlePlus.innerHTML = "<div id=\"titleplus_top\"></div><div id=\"titleplus_content\">"+tempstr+"</div><div id=\"titleplus_bottom\" style='height:15px'></div>";}
	 titlePlus.style.left = event.x+ document.documentElement.scrollLeft - 45 +"px";  
     
	if(getOs() == 2){ titlePlus.style.top = event.y -60+"px"; }
	else{titlePlus.style.top = event.y + document.documentElement.scrollTop - titlePlus.offsetHeight-5 +"px"; }
	titlePlus.style.filter = "Alpha(Opacity=100)";  
	   
} 
function hideTitleplus_manual() 
{ 
    GetId("titleplus").style.filter = "Alpha(Opacity=0)"
  	GetId("titleplus").style.left="-300px";
} 

function SetFontsize(id,size){
    eval(id).style.fontSize=size;
}
function SetFontweight(id,btid,str,calstr){   
    if(eval(id).style.fontWeight != "bold"){
        eval(id).style.fontWeight="bold";
        eval(btid).innerText=calstr;
    }
    else{
        eval(id).style.fontWeight="normal";
        eval(btid).style.textDecoration="none";
        eval(btid).innerText=str;
    }
}
/*
function FadeOut(){
   // var id=GetId(Div_id);
    if(new_window.filters.Alpha.opacity<100) {
		    new_window.filters.Alpha.opacity += 10;
		    setTimeout("FadeOut()",500);
		}
	else{

	}
}
function fadeOut(){
	if(dypopLayer.filters.Alpha.opacity<popOpacity) {
		dypopLayer.filters.Alpha.opacity+=showPopStep;
		tFadeOut=setTimeout("fadeOut()",50);
		}
	else {
		dypopLayer.filters.Alpha.opacity=popOpacity;
		tFadeWaiting=setTimeout("fadeIn()",tPopShow);
		}
}
*/
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}