﻿function $(id){return document.getElementById(id);}
//加载小图片失败的处理结果
function SImgErr(objID)
{
	$(objID).innerHTML="<img src=\"../images/simgerr.gif\" width=\"200\" height=\"150\" border=\"0\" class=\"SImgStyle_0\" />"
	InitAlpha(objID,70,0);
}
//加载小图
function SetSIMG(objID,img)
{
	//setOpacity($(objID),70);
	$(objID).innerHTML="<img src=\"../html/images/"+img+"\" width=\"200\" height=\"150\" onmouseover=\"SetBIMG('BIMG','"+img+"');\" onmouseout=\"ResetBIMG();\" />";
}
//加载大图片失败的处理结果
function BImgErr(objID)
{
	$(objID).innerHTML="<img src=\"../images/bimgerr.gif\" width=\"400\" height=\"301\" border=\"0\" />"
	InitAlpha(objID,70,0);
}
//加载大图片
function SetBIMG(objID,img)
{
	setOpacity($(objID),70);
	$(objID).innerHTML="<img src=\"../images/bimg_load.gif\"  width=\"126\" height=\"22\" border=\"0\" /><img src=\"../html/images/"+img+"\" width=\"0\" height=\"0\" border=\"0\" style=\"display:none;\" onload=\"ShowBIMG('BIMG','"+img+"')\" onerror=\"BImgErr('BIMG');\">";
	
}
function ShowBIMG(objID,img)
{
	if($("GBIMG"))
	{
		if($("GBIMG").src!="../html/images/"+img)
		{
			$(objID).innerHTML="";
			$(objID).innerHTML="<img alt=\""+img+"\" src=\"../html/images/"+img+"\" width=\"400\" height=\"301\" border=\"0\" id=\"GBIMG\" />";
			InitAlpha('BIMG',70,0);			
		}
	}
	else
	{
		$(objID).innerHTML="";
		$(objID).innerHTML="<img alt=\""+img+"\" src=\"../html/images/"+img+"\" width=\"400\" height=\"301\" border=\"0\" id=\"GBIMG\" />";
		InitAlpha('BIMG',70,0);
	
	}
}
function InitAlpha(objID,opacity,stp)
{
	var obj=$(objID);
	if(stp==0)
	{
		if(opacity<=100)
		{
			setOpacity(obj, opacity);
			opacity += 10;
			window.setTimeout("InitAlpha('"+objID+"',"+opacity+","+stp+")", 50);
		}
	}
	else if(stp==1)
	{
		if(opacity>=70)
		{
			setOpacity(obj, opacity);
			opacity -= 10;
			window.setTimeout("InitAlpha('"+objID+"',"+opacity+","+stp+")", 50);		
		}
	}
}

function setOpacity(obj, opacity)
{
	opacity = (opacity == 100)?99.999:opacity;
	obj.style.filter = "alpha(opacity:"+opacity+")";// IE/Win
	obj.style.KHTMLOpacity = opacity/100;// Safari<1.2, Konqueror
	obj.style.MozOpacity = opacity/100;// Older Mozilla and Firefox
	obj.style.opacity = opacity/100;// Safari 1.2, newer Firefox and Mozilla, CSS3
}
function Ajax_GetXMLHttpRequest() {
	if (window.ActiveXObject) {
		return new ActiveXObject("Microsoft.XMLHTTP");
	} 
	else if (window.XMLHttpRequest) {
		return new XMLHttpRequest();
	}
}
function BrowseCount(PID)
{
	var x = Ajax_GetXMLHttpRequest();
	var URL="../getcount.asp?pid="+PID;
	x.open("POST",URL);
	x.setRequestHeader("REFERER", location.href);
	x.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
	x.onreadystatechange = function()
	{
		if(x.readyState == 4 && x.status == 200)
		{
			$("BCount").innerHTML=x.responseText+" 次";
			x=null;
		}
	}
	x.send(URL);
}