
/*********
网站名称：福娃网络模板定制中心
QQ:290409929
http:www.mice.org.cn
***********/
//防止与其它库冲突
jQuery.noConflict();

//通用切换
//containerId - 容器选择符(class, id, tag)
//defaultIndex - 默认选中的标签索引，从0开始
//titOnClassName -标签选中时的样式
//tagName - 可选参数，自定义标题标签，默认为li （dl>dt>ul>li）
function SwitchTab(containerId, defaultIndex, titOnClassName, tagName)
{
    var st;
    var tagName = (tagName == '' || tagName == null || tagName == undefined) ? 'li' : tagName;
    var defaultIndex = (defaultIndex == '' || defaultIndex == null || defaultIndex == undefined) ? 0 : defaultIndex;
    var titOnClassName = (titOnClassName == '' || titOnClassName == null || titOnClassName == undefined) ? 'on' : titOnClassName;
    var obj = jQuery(containerId);
    
    //根据defaultIndex初始化
    obj.find("dd").hide();
    obj.find("dt " + tagName + ":eq(" + defaultIndex + ")").addClass(titOnClassName);
    obj.find("dd:eq(" + defaultIndex + ")").fadeIn(
    {
        queue: false,
        duration: 500
    });
    
    //处理交互事件
    obj.find("dt " + tagName).each(function(i, ele)
    {
        jQuery(ele).click(function()
        {
            st = setTimeout(function()
            {
                ShowSTCon(obj, i, titOnClassName, tagName);
                st = null;
                
            }, 100);
        }, function()
        {
            if (st != null) 
                clearTimeout(st);
        });
    });
}



function ShowSTCon(obj, i, titOnClassName, tagName)
{
    obj.find("dt ." + titOnClassName).removeClass(titOnClassName);
    obj.find("dd").hide();
    obj.find("dt " + tagName + ":eq(" + i + ")").addClass(titOnClassName);
    obj.find("dd:eq(" + i + ")").blur().fadeIn(
    {
        queue: false,
        duration: 500
    });//show();
}

//收起展开内容
function ShowContent(linkid, contentid)
{
    var content = document.getElementById(contentid);
    if (content.style.display == "none") 
    {
        content.style.display = "";
        document.getElementById(linkid).innerHTML = "<img src='Images/open.gif' border='0'/>";
        document.getElementById(linkid).title = "隐藏内容介绍";
    }
    else 
    {
        content.style.display = "none";
        document.getElementById(linkid).innerHTML = "<img src='Images/close.gif' border='0'/>";
        document.getElementById(linkid).title = "显示内容介绍";
    }
}

function ShowMore(linkid, morecontentid, summaryid)
{
    var content = document.getElementById(morecontentid);
    if (content.style.display == "none") 
    {
        content.style.display = "";
        //document.getElementById(linkid).style.display = "none";
        document.getElementById(linkid).innerHTML = "<img src='Images/close.gif' border='0'/>";
        document.getElementById(linkid).title = "隐藏内容介绍";
        document.getElementById(summaryid).style.display = "none";
        
    }
    else 
    {
        content.style.display = "none";
        document.getElementById(summaryid).style.display = "";
        document.getElementById(linkid).innerHTML = "<img src='Images/open.gif' border='0'/>";
        document.getElementById(linkid).title = "显示内容介绍";
    }
}

function refreshValidateCodeImage(ValidateCodeImageControl)
{
    ValidateCodeImageControl.src = ValidateCodeImageControl.src + '?code=' + randomNum(10);
}

function randomNum(n)
{
    var rnd = '';
    for (var i = 0; i < n; i++) 
        rnd += Math.floor(Math.random() * 10);
    return rnd;
}

