﻿function $(par){return document.getElementById(par);}
function $atn(obj,par){try{return obj.getElementsByTagName(par).item(0).firstChild.data;}catch(e){return "";}}
function ajax(url,pars,method,onComplete,asyn,rid)
{
    var http_request = false;

	if(window.XMLHttpRequest)
	{
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {http_request.overrideMimeType('text/xml');}
	}
	else if (window.ActiveXObject) 
	{
		try{http_request = new ActiveXObject("Msxml2.XMLHTTP");}
		catch (e)
		{
		    try{http_request = new ActiveXObject("Microsoft.XMLHTTP");}
			catch (e) {}
		}
	}
	if (!http_request) {window.alert("不能创建XMLHttpRequest对象实例.");return false;}
	
	if(onComplete)
	{
	    http_request.onreadystatechange = function()
        {  
            try
            {
                if(http_request.readyState==4&&http_request.status==200)
                    onComplete(http_request,rid);
            }
            catch(e){alert(e);}  
        }
    }
	/*var _url = url+"?&"+pars+"&r="+Math.random();
	http_request.open(method,_url, asyn);
	http_request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");  
    http_request.send(pars);*/
    if(method.toLowerCase() == "get")
    {  
        http_request.open(method,url+"?&"+pars+"&r="+Math.random(), asyn);
        http_request.send(null);
    }  
    else
    {  
        http_request.open(method,url, asyn);
        http_request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
        http_request.send(pars);
    }
}
function setCookie(name,value)
{
    var Days = 7;
    var exp = new Date(); 
    exp.setTime(exp.getTime()+Days*24*60*60*1000);
    document.cookie = name+"="+escape(value)+ ";expires="+exp.toGMTString();
}
function getCookie(name)
{
    var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
    if(arr=document.cookie.match(reg))
        return unescape(arr[2]);
    else
        return null;
}
function delCookie(name)
{
    var exp = new Date();
    exp.setTime(exp.getTime() - 1);
    var cval=getCookie(name);
    if(cval!=null) document.cookie= name+"="+cval+";expires="+exp.toGMTString();
}
function getBit(m,n) {return (m>>n)&1}function lunar(d){ var nums = "一二三四五六七八九十"; var mons = "正二三四五六七八九十冬腊";var Cal = [0x41A95,0xD4A,0xDA5,0x20B55,0x56A,0x7155B,0x25D,0x92D,0x5192B,0xA95,0xB4A,0x416AA,0xAD5,0x90AB5,0x4BA,0xA5B,0x60A57,0x52B,0xA93,0x40E95];var madd=[0,31,59,90,120,151,181,212,243,273,304,334];var total,m,n,k;var isEnd = false;var t = d.getYear();if (t<1900) t+=1900;total=(t-2001)*365+Math.floor((t-2001)/4)+madd[d.getMonth()]+d.getDate()-23;if(d.getYear()%4==0&&d.getMonth()>1) total++;for(m=0;;m++){k=(Cal[m]<0xfff)?11:12;for(n=k;n>=0;n--){if(total<=29+getBit(Cal[m],n)){ isEnd=true;break;}total = total-29-getBit(Cal[m],n);}if(isEnd) break;}var cYear=2001 + m;var cMonth=k-n+1;var cDay=total;if(k==12){ if(cMonth==Math.floor(Cal[m]/0x10000)+1)cMonth=1-cMonth;if(cMonth>Math.floor(Cal[m]/0x10000)+1) cMonth--; }var cHour=Math.floor((d.getHours()+3)/2); var t=""; if(cMonth<1) { t+="闰";t+=mons.charAt(-cMonth-1);} else {t+=mons.charAt(cMonth-1);}t+="月";t+=(cDay<11)?"初":((cDay<20)?"十":((cDay<30)?"廿":"卅"));if(cDay%10!=0||cDay==10)t+=nums.charAt((cDay-1)%10);return t;}
function date(){var d = new Date(), week = ['日', '一', '二', '三', '四', '五', '六'];var ymd = d.getFullYear() + "年" + (d.getMonth()+1) + "月" + d.getDate() + "日";return ymd + " 农历" + lunar(d) + " 星期" + week[d.getDay()];}

function gp(p)
{
    if(!p){return;}
    $("_al").innerHTML = "<div style='text-align:center;color:red;line-height:50px'>正在载入...</div>";
    if(arguments.length == 1)
    {
        ajax("/a/","p="+ encodeURIComponent(p),"GET",initpage,true);
    }
    else if (arguments.length == 2)
    {  
        ajax("/a/","p="+ encodeURIComponent(p)+"&id="+encodeURIComponent(arguments[1]),"GET",initpage,true);
    }
    var cid = arguments[1];
    if(!cid){cid = 0;}
    page(p,cid);
}
function page(cp,cid)
{
    var sp = cp-4,ep = cp+4,html="<a href='#top'>回到顶部</a>";
    if(sp<1){sp=1;ep=10;}
    if(cp==1)
        html+='<span class="nextprev">&#171; previous</span>';
    else
        html+='<a class="nextprev" title="转到 前一页" href="#top" onclick="gp('+(cp-1)+','+cid+')">&#171; previous</a>';
    for(var i=sp;i<=ep;i++){if(i==cp)html+='<span class="current">'+i+'</span>';
        else html+='<a title="转到 第'+i+'页" href="#top" onclick="gp('+i+','+cid+')">'+i+'</a>'}
    html+='<a class="nextprev" title="转到 下一页" href="#top" onclick="gp('+(cp+1)+','+cid+')">next &#187;</a>';
    $("pager").innerHTML=html;
}
function initpage(http_request)
{
    try
    {
	    var xmldoc=http_request.responseXML;
	    var nodes = xmldoc.getElementsByTagName("item");
	    var html="",title="",author="",image="",hits=0,recommend=0,link="",description="",pubDate="",cid="";
	    for(i=0;i<nodes.length;i++)
	    {
		    title = $atn(nodes[i],"title");
		    author = $atn(nodes[i],"author");
		    image = $atn(nodes[i],"image");
		    hits = $atn(nodes[i],"hits");
		    re = $atn(nodes[i],"recommend");
		    link = $atn(nodes[i],"link");
		    de = $atn(nodes[i],"description");
		    pub = $atn(nodes[i],"pubDate");
		    cid = $atn(nodes[i],"cid");
		    cname = $atn(nodes[i],"cname");
    		
		    html+='<div class="article_panel" onmouseover="mouseover(this)" onmouseout="mouseout(this)"><div class="title">'+
		    '<a href="'+link+'" target="_blank" title="'+title+'">'+title+'</a></div><div class="info">'+ author +'发布于 '+pub+' | '+hits
		    +' 次阅读 </div><div class="simple"><a title="'+cname+'" href="/class-item' + cid + '.html" target=_blank><img border="0" align="right" alt="" src="'+image+'" /></a>'+de+'[<a href="'+link+'" target="_blank" title="'+
		    title+'">查看全文</a>]</div><div class="articleInfo">已有 '+re+' 个意见 | '+re+'次个用户响应 | <a href="'+link+'" target="_blank">详细内容</a></div></div>'
	    }
	    $("_al").innerHTML = html;
        var pr=0,pc=0,rc=0;
        pr=$atn(xmldoc,"cpr");
        pc=$atn(xmldoc,"tpc");
        rc=$atn(xmldoc,"trc");
    }catch(e){alert("error!");}
}
function show_chkcode(rid)
{
    if($("cnt_chkcode"+rid).style.display=="none")
    {
        $("cnt_chkcode"+rid).innerHTML="<img src='/ValidationImage.aspx' alt='' title='请输入图片上的文字' /><a href='javascript:void(0)' onclick='changeChkcode("+rid+")'>看不清换一个</a>";
        $("cnt_chkcode"+rid).style.display="";
    }
}
function changeChkcode(id)
{
    var img = "/ValidationImage.aspx?"+Math.random();
    var myImage = new Image();
    myImage.src = img; 
    $("cnt_chkcode"+id).getElementsByTagName("img")[0].src=img;
}


function SubmitCmt(rid)
{
    var id=$("hidArticleID").value;
    var title = $("tbxTitle"+rid).value;
    var username = $("tbxName"+rid).value;
    var homepage = $("tbxHomepage"+rid).value;
    var email = $("tbxEmail"+rid).value;
    var content = $("tbxComment"+rid).value;
    var chkcode = $("tbxChkcode"+rid).value;
    
    if(content=="")
    {
        $("cmtInfo"+rid).innerHTML = "请输入评论内容！";
        $("cmtInfo"+rid).style.display = "";
        return;
    }
    if(chkcode=="")
    {
        $("cmtInfo"+rid).innerHTML = "请输入验证码内容！";
        $("cmtInfo"+rid).style.display = "";
        return;
    }
    if(email!="")
        if(!/(\S)+[@]{1}(\S)+[.]{1}(\w)+/.test(email))
        {
            $("cmtInfo"+rid).innerHTML="请输入格式正确的 e-mail 地址！";
            $("cmtInfo"+rid).style.display = "";
            return;
        }
    var p="id="+id+"&reid="+rid+"&title="+title+"&username="+username+"&homepage="+homepage
    +"&email"+email+"&content="+content+"&chkcode="+chkcode;
    $("SubmitCmt"+rid).style.display="none";
    $("cmtInfo"+rid).innerHTML = "正在发送数据......";
    $("cmtInfo"+rid).style.display = "";
    ajax("/a/postcommnet.aspx",encodeURI(p),"POST",submitcomment,true,rid);
}

function submitcomment(http_request,rid)
{
    var text = http_request.responseText;
	if(text == "0")
	{
	    $("cmtform"+rid).reset();
        $("cmtInfo"+rid).style.display="none";
	    $("info"+rid).innerHTML="评论成功！";
	    $("info"+rid).style.display="";
	    $("SubmitCmt"+rid).style.display="";
	    initcommnet();
	}
	else
	{
        $("cmtInfo"+rid).innerHTML = text;
        if(text=="验证码已过期,请重新输入!")
            changeChkcode();
        $("SubmitCmt"+rid).style.display="";
	}
}

function initcommnet()
{
    $("cmtmsgs").innerHTML = "正在载入评论数据，请稍等......";
    
    var p="id="+$("hidArticleID").value;
    
    ajax("/a/getcomment.aspx",encodeURI(p),"GET",loadcomment,true,0);
}
function loadcomment(http_request)
{
    var xmldoc=http_request.responseXML;
    var cmtnumber = $atn(xmldoc,"total");
    var nodes = xmldoc.getElementsByTagName("item");
    var cid=0, uname="",rid=0,dig=0,tp=0,content="",dtime="",html="",hothtml="";
    for(var i=0;i<nodes.length;i++)
	{
	    cid=$atn(nodes[i],"cid");
	    uname=$atn(nodes[i],"uname");
	    rid=$atn(nodes[i],"ReID");
	    dig=$atn(nodes[i],"digg");
	    tp=$atn(nodes[i],"trample");
	    content=$atn(nodes[i],"Content");
	    dtime=$atn(nodes[i],"Date");
	    
	    if(uname=="")
	        uname="匿名人士";
	    html+='<div class="cmt_msg" id="#cmd'+cid+'"><div class="msginfo"><div class="ptime">发表于 '+dtime
	    +'</div> 第 '+(i+1)+' 楼 &nbsp; '+uname+' </div><div class="cmt_msg_cnt">';
	    if(rid==0)
	        html+=content;
	    else
	        html+=quotecmt(xmldoc,rid)+content;
	    html+='</div><div class="repost"><a href="javascript:void(0)" onclick="_reply('+cid+')">回复</a>'+
        '<a href="javascript:void(0)" onclick="_sustain('+cid+')">支持</a>(<span id="_sid'+cid+'">'+dig+'</span>)'+
        '<a href="javascript:void(0)" onclick="_against('+cid+')">反对</a>(<span id="_sgs'+cid+'">'+tp+'</span>)'+
        '<a href="javascript:void(0)" onclick="_report('+cid+')">举报</a>'+
        '</div><div id="_reply'+cid+'"></div></div>';
        
        if(dig>=10)
        {
            hothtml += '<div class="cmt_msg"><div class="msginfo"><div class="ptime">发表于 '+dtime
	        +'</div> <a href="#cmd'+cid+'">第 '+(i+1)+' 楼</a> &nbsp; '+uname+' </div><div class="cmt_msg_cnt">'+content
	        +'</div></div>';
        }
	}
	$("cmtcount").innerText=cmtnumber;
	if(html=="")
	{
	    $("cmtmsgs").innerHTML="暂无评论";
	    $("_hot").innerHTML="暂无评论";
	}
	else
	    $("cmtmsgs").innerHTML=html;
	if(hothtml=="")
	    $("_hot").innerHTML="暂无评论";
	else
	    $("_hot").innerHTML = hothtml;
}
function quotecmt(xmldoc,reid)
{
    var nodes = xmldoc.getElementsByTagName("item");
    var uname="",rid=0,dig=0,tp=0,content="",dtime="",html="";
    for(var i=0;i<nodes.length;i++)
    {
        cid=$atn(nodes[i],"cid");
        uname=$atn(nodes[i],"uname");
	    rid=$atn(nodes[i],"ReID");
	    dig=$atn(nodes[i],"digg");
	    tp=$atn(nodes[i],"trample");
	    content=$atn(nodes[i],"Content");
	    dtime=$atn(nodes[i],"Date");
	    
	    if(uname=="")
	        uname="匿名人士";
        if(cid==reid&&rid==0)
        {
            html += '<fieldset class="fieldset"><legend class="legend">引用 '+uname+' 发表于 '+dtime+' 的评论:</legend>'
            +'<div class="quotecontent">'+content+'</div></fieldset>';
            break;
        }
        else
        {
            if(cid==reid)
            {
                html += '<fieldset class="fieldset"><legend class="legend">引用 '+uname+' 发表于 '+dtime+' 的评论:</legend>'
                +'<div class="quotecontent">'+quotecmt(xmldoc,rid)+content+'</div></fieldset>';
            }
        }
    }
    return html;
}
function _reply(id)
{   
    $("_reply"+id).innerHTML='<div class="quickrpl"><div class="quickrplTitle">快速回复</div>'+
    '<form id="cmtform'+id+'" method="post" action="" onsubmit="return false">'+
    '<div class="line">评论主题：<input class="cmt_body_textbox" id="tbxTitle'+id+'" type="text" /></div>'+
    '<div class="line">您的大名：<input class="cmt_body_textbox" id="tbxName'+id+'" type="text" /></div>'+
    '<div class="line">您的主页：<input class="cmt_body_textbox" id="tbxHomepage'+id+'" type="text" /></div>'+
    '<div class="line">您的邮箱：<input class="cmt_body_textbox" id="tbxEmail'+id+'" type="text" /></div>'+
    '<div class="area">您的评论：<textarea class="cmt_body_textarea" id="tbxComment'+id+'" cols="20" rows="2" onblur="show_chkcode('+id
    +')"></textarea></div><div class="line">'+
    '<div class="left">验 &nbsp;证 码：<input class="cmt_chkcode" id="tbxChkcode'+id+'" type="text" onfocus="show_chkcode('+id
    +')" /></div><div id="cnt_chkcode'+id+'" style="display:none"></div></div>'+
    '<div class="errorbox" style="display:none;" id="cmtInfo'+id+'"></div><div class="cmt_submit">'+
    '<input id="SubmitCmt'+id+'" type="image" value="" src="/skins/default/images/btn_tj.png" onclick="SubmitCmt('+id+')" />'+
    ' <a href="javascript:void(0)" onclick="_creply('+id+')">关闭快速回复</a></div>'+
    '<div style="display:none;" class="msgText" id="info'+id+'"></div></form></div>';
}
function _creply(id){$("_reply"+id).innerHTML="";}
function _sustain(cid)
{
    if(getCookie("_fac"+cid)==null)
    {
        var p="op=d&id="+cid;
        ajax("/a/commentop.aspx",encodeURI(p),"GET",_sustaindo,true,cid);
        $("_reply"+cid).innerHTML='<div class="errorbox">正在建立连接……</div>';
    }
    else
        $("_reply"+cid).innerHTML='<div class="errorbox"><a style="float:right" href="javascript:void(0)" onclick="_creply('+cid+')">X</a>您已经投过票了！</div>';
}
function _sustaindo(httprequest,cid)
{
    var text = httprequest.responseText;
    if(text)
    {
        setCookie("_fac"+cid,cid);
        $("_sid"+cid).innerHTML = text;
        $("_reply"+cid).innerHTML='<div class="msgText"><a style="float:right" href="javascript:void(0)" onclick="_creply('+cid+')">X</a>感谢您的参与！</div>';
    }
}
function _against(cid)
{
    if(getCookie("_fac"+cid)==null)
    {
        var p="op=a&id="+cid;
        ajax("/a/commentop.aspx",encodeURI(p),"GET",_againstdo,true,cid);
        $("_reply"+cid).innerHTML='<div class="errorbox">正在建立连接……</div>';
    }
    else
        $("_reply"+cid).innerHTML='<div class="errorbox"><a style="float:right" href="javascript:void(0)" onclick="_creply('+cid+')">X</a>您已经投过票了！</div>';
}
function _againstdo(httprequest,cid)
{
    var text = httprequest.responseText;
    if(text)
    {
        setCookie("_fac"+cid,cid);
        $("_sgs"+cid).innerHTML = text;
        $("_reply"+cid).innerHTML='<div class="msgText"><a style="float:right" href="javascript:void(0)" onclick="_creply('+cid+')">X</a>感谢您的参与！</div>';
    }
}
function _report(cid)
{
    if(getCookie("_far"+cid)==null)
    {
        var p="op=r&id="+cid;
        ajax("/a/commentop.aspx",encodeURI(p),"GET",null,true,cid);
        $("_reply"+cid).innerHTML='<div class="msgText"><a style="float:right" href="javascript:void(0)" onclick="_creply('+cid+')">X</a>感谢您的举报！</div>';
        setCookie("_far"+cid,cid);
    }
    else
       $("_reply"+cid).innerHTML='<div class="errorbox"><a style="float:right" href="javascript:void(0)" onclick="_creply('+cid+')">X</a>您已经举报过了！</div>'; 
}
function digg(id)
{
    if(getCookie("_a"+id)==null)
    {
        var p="op=fad&id="+id;
        ajax("/a/aop.aspx",encodeURI(p),"GET",_dg,true,id);
        $("_fainfo").innerHTML='<div class="errorbox">正在提交……</div>';
    }
    else
        $("_fainfo").innerHTML='<div class="errorbox"><a style="float:right" href="javascript:void(0)" onclick="_cinfo()">X</a>您已经投过票了！</div>';
}
function tramp(id)
{
    if(getCookie("_a"+id)==null)
    {
        var p="op=fat&id="+id;
        ajax("/a/aop.aspx",encodeURI(p),"GET",_tp,true,id);
        $("_fainfo").innerHTML='<div class="errorbox">正在提交……</div>';
    }
    else
       $("_fainfo").innerHTML='<div class="errorbox"><a style="float:right" href="javascript:void(0)" onclick="_cinfo()">X</a>您已经投过票了！</div>';

}
function _dg(http,id)
{
    var text = http.responseText;
    if(text)
    {
        setCookie("_a"+id,id);
        $("fa_dg"+id).innerHTML = text;
        $("_fainfo").innerHTML='<div class="msgText"><a style="float:right" href="javascript:void(0)" onclick="_cinfo()">X</a>感谢您的参与！</div>';
    }
}
function _tp(http,id)
{
    var text = http.responseText;
    if(text)
    {
        setCookie("_a"+id,id);
        $("fa_tp"+id).innerHTML = text;
        $("_fainfo").innerHTML='<div class="msgText"><a style="float:right" href="javascript:void(0)" onclick="_cinfo()">X</a>感谢您的参与！</div>';
    }
}
function _cinfo(){$("_fainfo").innerHTML="";}
function loaddg()
{
    var id=$("hidArticleID").value;
    var rd="1";
    if(getCookie("_ar"+id)==null) rd="0";
    var p="op=all&id="+id+"&rd="+rd;
    ajax("/a/aop.aspx",encodeURI(p),"GET",_initload,true,id);
    getPN(id);
}
function _initload(http,id)
{
    var text = http.responseText;
    var ss = text.split(',');
    var aid=$("hidArticleID").value;
    setCookie("_ar"+aid,aid);
    $("fa_dg"+id).innerHTML = ss[0];
    $("fa_tp"+id).innerHTML = ss[1]; 
    $("_rn").innerHTML = ss[2];
    
}
function _font(par)
{
    switch(par)
    {
        case 0:
            $("content").style.fontSize = "12px";
            break;
        case 1:
            $("content").style.fontSize = "14px";
            break;
        case 2:
            $("content").style.fontSize = "16px";
            break;
    }
}
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;
}
function addfavorite()
{
    var title="自由原子 www.freeAtom.Com";
    var url="http://www.freeAtom.Com/";
   switch(getOs())
   {
       case 1:window.external.addFavorite(url,title);break;
       case 2:window.sidebar.addPanel(title, url, "");break;
       case 0:alert("您的浏览器也太牛了，我都不知道怎么操作了，你还是自己动手吧！");break;
   }
}
function setHomepage()
{
    var title="自由原子 www.freeAtom.Com";
    var url="http://www.freeAtom.Com/";
    
    if (document.all)
    {
        document.body.style.behavior='url(#default#homepage)';
        document.body.setHomePage(url);
    }
    else if (window.sidebar)
    {
        if(window.netscape)
        {
         try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");}
         catch (e){alert("该操作被浏览器拒绝，如果想启用该功能，请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true" );}
    } 
        var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
        prefs.setCharPref(title,url);
    }
}
function chksuggest()
{
    if($("tbxTitle").value == "")
    {
        $("divInfo").innerHTML = "请输入主题！";
        $("tbxTitle").focus();
        return false;
    }
    if($("tbxContent").value == "")
    {
        $("divInfo").innerHTML = "请输入内容！";
        $("tbxContent").focus();
        return false;
    }
    if($("tbxChkcode").value == "")
    {
        $("divInfo").innerHTML = "请输入验证码！";
        $("tbxChkcode").focus();
        return false;
    }
    if($("tbxQQ").value != "")
    {
        if(!/\d{5,10}/.test($("tbxQQ").value))
        {
            $("divInfo").innerHTML = "请输入正确的QQ号码！";
            $("tbxQQ").focus();
            return false;
        }
    }
    if($("tbxEmail").value != "")
    {
        if(!/(\S)+[@]{1}(\S)+[.]{1}(\w)+/.test($("tbxEmail").value))
        {
            $("divInfo").innerHTML = "请输入正确的Email地址！";
            $("tbxEmail").focus();
            return false;
        }
    }
    return true;
}
function getPN(id)
{
    if($("_aPrevious").innerHTML==""||$("_aNext").innerHTML=="")
        ajax("/a/geta.aspx",encodeURI("id="+id),"GET",_pni,true);
}
function _pni(http)
{
    var xml = http.responseXML;
    var p=null,n=null,pt="",pu="",nt="",nu="",pp="",nn="";
    p =xml.getElementsByTagName("previous");
    n = xml.getElementsByTagName("Next");
    
    pt=$atn(p[0],"title");
    pu=$atn(p[0],"url")
    nt=$atn(n[0],"title");
    nu=$atn(n[0],"url");
    
    if(pu!="javascript:void(0)")
        pp='<a href="'+pu+'" target="_blank" title="'+pt+'">'+pt+'</a>';
    else
        pp='<a href="'+pu+'" title="'+pt+'">'+pt+'</a>';
    $("_aPrevious").innerHTML=pp;
    
    if(nu!="javascript:void(0)")
        nn='<a href="'+nu+'" target="_blank" title="'+nt+'">'+nt+'</a>';
    else
        nn='<a href="'+nu+'" title="'+nt+'">'+nt+'</a>';
    $("_aNext").innerHTML=nn;
}
function correctPNG() 
{
    for(var i=0; i<document.images.length; i++)
    {
        var img = document.images[i]
        var imgName = img.src.toUpperCase()
        if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
        {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText 
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle  
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
            img.outerHTML = strNewHTML
            i = i-1
        }
    }
}
function mouseover(obj){obj.style.backgroundColor="#f4f8fe";}
function mouseout(obj){obj.style.backgroundColor="#fff";}