function showdiv(sid,wapper) {
    $('#' + sid).show();
}
function closediv(sid) {
	$('#' + sid).hide();
}
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";
    }
}

function chknn(o,c){
	var s=$('#' + o).attr('value');
	if(s.length==0){alert('“'+c+'”不能为空');return(false);}
	return(true);
}

function chkf(o,c)
{
	var s=$('#' + o).attr('value');
	s=s.replace(/(^\s*)|(\s*$)/g,"");
	if(s.length==0){return(true)}
	if(isNaN(s)){alert('请在“'+c+'”内输入有效的数字');return(false);}
	return(true);
}
function chkd(o,c)
{
	var s=$('#' + o).attr('value');
	s=s.replace(/(^\s*)|(\s*$)/g,"");
	if(s.length==0){return(true)}
	ss = s.replace('-','/');
	sss = ss.replace('-','/');
	var xxx = new Date(sss);
	if(isNaN(xxx)){alert('请在“'+c+'”内输入有效的日期(例如2008-8-18)');return(false);}
	return(true);
}
function chklen(o,l,c)
{
	var s=$('#' + o).attr('value');
	s=s.replace(/(^\s*)|(\s*$)/g,"");
	if(s.length > l){alert('"'+c+'"超出最大长度'+l);return(false);}
	return(true);
}
function sel(a,srco){
    $("input[@type=checkbox][@name='"+a+"']").each(function(){
        $(this).attr("checked",$(srco).attr('checked'));
    });
}
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 = "<font " + imgID + imgClass + imgTitle
   + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
   + "(src=\'" + img.src + "\', sizingMethod='scale');\"></font>"
   img.outerHTML = strNewHTML
   i = i-1
  }
}
}
//取得左边的位移
function getL(objc){
    return($('#' + objc).offset().left);
}
//取得顶部的位移
function getT(objc){
    return($('#' + objc).offset().top);
}
function HtmlDecode(text){
    return text.replace(/&amp;/g,'&').replace(/&quot;/g,'\"').replace(/&lt;/g,'<').replace(/&gt;/g,'>')
}
function XTopMap(w, h, strTopMap){
    var m_TopImgs = new Array();
    var m_w = w;
    var m_h = h;
    var addW = 2;
    var m_nowPic = 0;
    var m_hTimer;
    var m_strTopMap = strTopMap;
    this.TopImgItem = function (imgUrl, strUrl, strText){
        this.img = new Image();
        this.img.src = imgUrl;
        this.strUrl = strUrl;
        this.strText = HtmlDecode(strText);
    }
    this.AddImgItem = function (strUrl, imgUrl, strText){
        m_TopImgs[m_TopImgs.length] = new this.TopImgItem(imgUrl, strUrl, strText);
    }
    this.Length = function(){
        return m_TopImgs.length;
    }
    this.GetTopImgItem = function(l){
        return m_TopImgs[l];
    }
    this.change_img = function(){
        if(!m_nowPic){
            m_nowPic = 1;
        }
        document.getElementById(m_strTopMap + "_pic").src = m_TopImgs[m_nowPic-1].img.src;
        document.getElementById(m_strTopMap + "_url").href = m_TopImgs[m_nowPic-1].strUrl;
        document.getElementById(m_strTopMap + "_url").title = m_TopImgs[m_nowPic-1].strText.replace("&#39;","'");
        for (var i=1;i<=m_TopImgs.length;i++){
            document.getElementById(m_strTopMap + "_xxjdjj"+i).className='';
        }
        document.getElementById(m_strTopMap + "_xxjdjj"+m_nowPic).className='here';
        m_nowPic++;
        if( m_nowPic > m_TopImgs.length ){m_nowPic = 1}
        hTimer = setTimeout('eval("'+m_strTopMap+'.change_img()")', 5000);
    }
    this.imgClick = function(n){
        m_nowPic = n;
        window.clearInterval(hTimer);
        this.change_img();
    }
    this.show = function(){
        document.write('<style>');
        document.write('#imgShow{width:'+m_w+'px;height:'+m_h+'px;margin:0;position:relative;overflow:hidden}');
        document.write('#imgShow img{width:'+m_w+'px;height:'+m_h+'px}');
        document.write('#imgNum{position:absolute;bottom:10px;right:6px;width:175px;height:14px}');
        document.write('#imgNum div{text-align:right}');
        document.write('#imgNum a{display:-moz-inline-block;display:-moz-inline-box;display:inline-block;width:20px;height:14px;line-height:14px;margin-left:2px;text-align:center;font:10px tahoma,MingLiu;color:#fff;background-color:#555}');
        document.write('#imgNum a:hover{background-color:#f90;text-decoration:none}');
        document.write('#imgNum a.here{background-color:#f90;text-decoration:none;font-weight:bold}');
        document.write('</style>');
        document.write('<div id="imgShow">');
        document.write('<div><a id="' + m_strTopMap + '_url" target="_blank"><img id="'+m_strTopMap + '_pic" style="filter:progid:DXImageTransform.Microsoft.RevealTrans (duration=0,transition=23)" width='+m_w+' height='+m_h+' /></a></div>');
        document.write('<div id="imgNum"><div>');
        for(var i=1;i<m_TopImgs.length+1;i++){
            document.write('<a href="javascript:'+m_strTopMap+'.imgClick('+i+');" id="'+m_strTopMap+'_xxjdjj'+i+'">'+i+'</a>');
        }
        document.write('</div></div></div>');
    }
}
window.attachEvent("onload", correctPNG);
