//***************自定义title & alt 层显示效果*****************
sPop=null;

document.write("<style type='text/css'>");
document.write(".cPopText { font-family: Tahoma, Verdana; background-color:  #cc9; border: 1px #900 dashed; font-size: 12px; padding-right: 4px; padding-left: 4px; line-height: 18px; padding-top: 2px; padding-bottom: 2px; visibility: hidden; filter: Alpha(Opacity=80); opacity: 0.9;}");
// filter: Alpha(Opacity=80); opacity: 0.8;
document.write("</style>");
document.write("<div id='ODFpopLayer' style='position:absolute;z-index:1000' class='cPopText'></div>");

function showPopupText(event) {

	if(event.srcElement) o = event.srcElement;
	else o = event.target;

	if(!o || o.name=="xxxxxx_123456789") {return;}
	
	MouseX = event.clientX;
	MouseY = event.clientY;
	
	if(o.alt != null && o.alt != '' ) {o.pop = o.alt;o.alt = '';}
	
	if(o.title != null && o.title != '') {o.pop = o.title;o.title = '';}
	
	if(o.pop != sPop) {
		sPop = o.pop;
		if(sPop == null || sPop == '') {
			document.getElementById("ODFpopLayer").style.visibility = "hidden";
		}
		else {
			popStyle = o.dyclass != null ? o.dyclass : 'cPopText';
			document.getElementById("ODFpopLayer").style.visibility = "visible";
			showIt();
		}
	}
}

function showIt() {
	document.getElementById("ODFpopLayer").className = popStyle;
	//document.getElementById("ODFpopLayer").innerHTML = sPop.replace(/</g,"<").replace(/>/g,">").replace(/\n/g,"<br>");
	document.getElementById("ODFpopLayer").innerHTML = sPop
	var bodySL, bodyST;
	if(window.pageXOffset){
		bodySL=window.pageXOffset;
	}
	else if(document.documentElement&&document.documentElement.scrollLeft){
		bodySL=document.documentElement.scrollLeft;
	}
	else if(document.body){
		bodySL=document.body.scrollLeft; //author: meizz
	}

	if(window.pageYOffset){
		bodyST=window.pageYOffset;
	}
	else if(document.documentElement&&document.documentElement.scrollTop){
		bodyST=document.documentElement.scrollTop;
	}
	else if(document.body){
	bodyST=document.body.scrollTop;
	}

	var bodyCW, bodyCH; 
	if(window.innerWidth){
		bodyCW=window.innerWidth;
	}
	else if(document.documentElement&&document.documentElement.clientWidth){ 
		bodyCW=document.documentElement.clientWidth;
	}
	else if(document.body){
		bodyCW=document.body.clientWidth; //author: meizz
	}

	if(window.innerHeight){
		bodyCH=window.innerHeight;
	}
	else if(document.documentElement&&document.documentElement.clientHeight){ 
		bodyCH=document.documentElement.clientHeight; 
	}
	else if(document.body){
		bodyCH=document.body.clientHeight;
	}

	if(document.getElementById("ODFpopLayer").clientWidth>300){
		var popWidth = 300;
	}
	else{
		var popWidth = document.getElementById("ODFpopLayer").clientWidth;
	}

	var popWidth = document.getElementById("ODFpopLayer").clientWidth;
	var popHeight = document.getElementById("ODFpopLayer").clientHeight;
	var popLeftAdjust = MouseX + 12 + popWidth > bodyCW ? -popWidth - 24 : 0;
	var popTopAdjust = MouseY + 12 + popHeight > bodyCH ? -popHeight - 24 : 0;
	document.getElementById("ODFpopLayer").style.left = (MouseX + 12 + bodySL + popLeftAdjust) + 'px';
	document.getElementById("ODFpopLayer").style.top = (MouseY + 12 + bodyST + popTopAdjust) + 'px';
}

/*showIt()函数结束，一下是函数调用开始*/

if(!document.onmouseover) {
	document.onmouseover = function(e) {
	var event = e ? e : window.event;
	showPopupText(event);
	}
}
//*********层显示效果结束*********//

/*function CheckAll(form)  {
  for (var i=0;i<form.elements.length;i++)    {
    var e = form.elements[i];
    if (e.name != 'chkall') e.checked = form.chkall.checked; 
   }
}
*/function setTab(name,cursel,n){
 for(i=1;i<=n;i++){
  var menu=document.getElementById(name+i);
  var con=document.getElementById("con_"+name+"_"+i);
  menu.className=i==cursel?"hover":"";
  con.style.display=i==cursel?"block":"none";
 }
}
//document.execCommand("BackgroundImageCache", false, true);

//以下两个函数是图片加载自动控制缩放的，在每个要控制的图像中使用DrawImage(this,FitWidth,FitHeight)
//如果要弹出缩放后的图片，请使用后面的VIEW_IMG(THIS,adjSize),通常情况下FitWidth=FitHeight=adjSize
	function DrawImage(ImgD,FitWidth,FitHeight){
		var image=new Image();
		image.src=ImgD.src;
		if(image.width>0 && image.height>0){
			if(image.width/image.height>= FitWidth/FitHeight){
				if(image.width>FitWidth){
				ImgD.width=FitWidth;
				ImgD.height=(image.height*FitWidth)/image.width;
				ImgD.alt='Click to View Large Pic';
				ImgD.style.cursor='hand';
				}
				else{
				ImgD.width=image.width;
				ImgD.height=image.height;
				}
			}
			else{
				if(image.height>FitHeight){
				ImgD.height=FitHeight;
				ImgD.width=(image.width*FitHeight)/image.height;
				ImgD.alt='Click to View Large Pic';
				ImgD.style.cursor='hand';
				}
				else
					{
					ImgD.width=image.width;
					ImgD.height=image.height;
					}
			}
		}
	}
	function view_img(ImgD,adjSize){
		var image=new Image();
		image.src=ImgD.src;
		var image=new Image();
		image.src=ImgD.src;
		//alert('width:'+image.width+' height:'+image.height)
		if(image.width>adjSize || image.height>adjSize){
		window.open('view_img.asp?img='+image.src,'view_img','toolbar=no,scrollbars=yes,resizable=yes')
		}
	}
