function SetParam()
{
    var data = XmlHttpPostMethodText("GetColumn.aspx","ColId="+$('ddlColId').value);
    if(data== "")
    {
        return;
    }
    else
    {
        var param = data.split('$');
        if(param.length==7)
        {
            $('rdBtnPageType_'+(param[0]-1)).checked=true;
            $('txtTemplatePath').value = param[1];
            $('rdBtnChargeType'+param[2]).checked=true;
            $('txtChargeHourCount').value=param[3];
            $('txtChargeViewCount').value=param[4];
            $('txtPointCount').value=param[5];
            if(param[6]=="True")
            {
                $('chkBoxIsAllowComment').checked=true;
            }
       }
    }
}
/*
function SetParamuser()
{
    var data = XmlHttpPostMethodText("../../System/Info/GetColumn.aspx","ColId="+$('ddlColId').value);
    if(data== "")
    {
        return;
    }
    else
    {
        var param = data.split('$');
        $('rdBtnPageType_'+(param[0]-1)).checked=true;
        $('txtTemplatePath').value = param[1];
        $('rdBtnChargeType'+param[2]).checked=true;
        $('txtChargeHourCount').value=param[3];
        $('txtChargeViewCount').value=param[4];
    }
}
*/
function GetColor(img_val,input_val)
{
    var PaletteLeft,PaletteTop
    var obj = $("colorPalette");
    ColorImg = img_val;
    ColorValue = $(input_val);
    if (obj){
        PaletteLeft = getOffsetLeft(ColorImg)
        PaletteTop = (getOffsetTop(ColorImg) + ColorImg.offsetHeight)
        if (PaletteLeft+150 > parseInt(document.body.clientWidth)) PaletteLeft = parseInt(event.clientX)-260;
        if (PaletteTop > parseInt(document.body.clientHeight)) PaletteTop = parseInt(document.body.clientHeight)-165;
        obj.style.left = PaletteLeft + "px";
        obj.style.top = PaletteTop + "px";
        if (obj.style.visibility=="hidden")
        {
            obj.style.visibility="visible";
        }else {
            obj.style.visibility="hidden";
        }
    }
}
function getOffsetTop(elm) {
    var mOffsetTop = elm.offsetTop;
    var mOffsetParent = elm.offsetParent;
    while(mOffsetParent){
        mOffsetTop += mOffsetParent.offsetTop;
        mOffsetParent = mOffsetParent.offsetParent;
    }
    return mOffsetTop;
}
function getOffsetLeft(elm) {
    var mOffsetLeft = elm.offsetLeft;
    var mOffsetParent = elm.offsetParent;
    while(mOffsetParent) {
        mOffsetLeft += mOffsetParent.offsetLeft;
        mOffsetParent = mOffsetParent.offsetParent;
    }
    return mOffsetLeft;
}
function setColor(color)
{
    if(ColorImg.id=='FontColorShow' && color=="#") color='#000000';
    if(ColorImg.id=='FontBgColorShow' && color=="#") color='#FFFFFF';
    if (ColorValue){ColorValue.value = color.substr(1);}
    if (ColorImg && color.length>1){
        ColorImg.src='../../Images/Rect.gif';
        ColorImg.style.backgroundColor = color;
    }else if(color=='#'){ ColorImg.src='../../Images/rectNoColor.gif';}
    $("colorPalette").style.visibility="hidden";
}
function CheckTitle(TableName)
{
    var title = $("txtTitle").value.trim();
    if(title.length==0)
    {
        alert('请填写检测标题！');
        $("txtTitle").focus();
        return;
    }
     var flag = CheckHas("../Common/CheckHas.aspx",title,"Title",TableName)
     if(!flag)
     {
        alert("标题不存在！");
        $("txtTitle").focus();
     }
     else
     {
        alert("标题已存在！");
        $("txtTitle").focus();
     }
}
function SetTitleType(obj){
    var temp=obj;
    if(temp==1){
        $('rbComm').checked=true;
        ShowImgUrl.style.display="none";
        $('chkBoxIsSideShow').disabled=true;
    }
    else if(temp==2){
        $('rbImg').checked=true;
        ShowImgUrl.style.display="";
         $('chkBoxIsSideShow').disabled=false;
    }
}
function GetTitleType()
{
    if($("rbComm").checked){
        ShowDefault.style.display="";
        ShowImgUrl.style.display="none";
        $('chkBoxIsSideShow').disabled=true;
    }
   else if($("rbImg").checked){
        ShowImgUrl.style.display="";
        ShowDefault.style.display="";
        $('chkBoxIsSideShow').disabled=false;
    }
}
function SetIsOuter()
{
    if($('rbOuter').checked)
    {
        ShowOurterUrl.style.display="";
        ShowDefault.style.display="none";
        Tabs1.style.display="none";
        Tabs2.style.display="none";
        Tabs3.style.display="none";
    }
    else
    {
        ShowOurterUrl.style.display="none";
        ShowDefault.style.display="";
        Tabs0.style.display="";
        ShowTabs(0);
    }
}
function SepTagName()
{
    $("txtTagNameStr").focus();
    if(document.selection)
    {
        var range=document.selection.createRange();
        range.text="|";
    }
}
function btnSetToppicStr(val)
{
    var lst1=$("lBoxTopicIdStr");
    var length=lst1.options.length;
    var tt="";
    if(val=="ChooseAll")
    {
        for(var i=0;i<length;i++)
        {
            lst1.options[i].selected = true;
        }
    }
    else
    {
        for(var i=0;i<length;i++)
        {
            lst1.options[i].selected = false;
        }
    }
}
function GetLinkage(ParName,SelName,TypeId,Property)
{
    var ParentId=$(ParName).value;
    var ParentText=$(ParName).options[$(ParName).selectedIndex].text;
    var PropertyId=$(Property).value;
    $(ParName.replace("select","txt")+"_Id").value=ParentId;
    $(ParName.replace("select","txt")).value=ParentText;
    if(ParentId=="0")
    {
        $(SelName).length=1;
        $(SelName).options[0].text = "请选择";
        $(SelName).options[0].value = "0";
        $(SelName.replace("select","txt")).value=0;
    }
    else
    {
        if(TypeId=="0")
        {
            Common_Linkage.GetLinkageDs(ParentId,SelName,PropertyId,Call_Back_Linkage);
        }
        else
        {
            Common_Linkage.GetLinkageDs(ParentId,SelName,PropertyId,Call_Back_Linkage_Update);
        }
    }
}
function GetUserLinkage(ParName,SelName,TypeId,Property)
{
    var ParentId=$(ParName).value;
    var ParentText=$(ParName).options[$(ParName).selectedIndex].text;
    var PropertyId=$(Property).value;
    $(ParName.replace("select","txt")+"_Id").value=ParentId;
    $(ParName.replace("select","txt")).value=ParentText;
    if(ParentId=="0")
    {
        $(SelName).length=1;
        $(SelName).options[0].text = "请选择";
        $(SelName).options[0].value = "0";
        $(SelName.replace("select","txt")).value=0;
    }
    else
    {
        if(TypeId=="0")
        {
            Common_Linkage.GetUserLinkageDs(ParentId,SelName,PropertyId,Call_Back_Linkage);
        }
        else
        {
            Common_Linkage.GetUserLinkageDs(ParentId,SelName,PropertyId,Call_Back_Linkage_Update);
        }
    }
}
function Call_Back_Linkage(res)
{
    var SelName=res.value.Tables[1].Rows[0]["SelName"];
    $(SelName).length=0;
    if(res.value.Tables[0].Rows.length>0)
    {
        for(var i=0;i<res.value.Tables[0].Rows.length;i++)
        {
            $(SelName).length++;
            $(SelName).options[i].text = res.value.Tables[0].Rows[i]["Name"];
            $(SelName).options[i].value = res.value.Tables[0].Rows[i]["Id"];
        }
        $(SelName.replace("select","txt")).value=res.value.Tables[0].Rows[0]["Name"];
        $(SelName.replace("select","txt")+"_Id").value=res.value.Tables[0].Rows[0]["Id"];
    }
    else
    {
        $(SelName).length=1;
        $(SelName).options[0].text = "无相关子类";
        $(SelName).options[0].value = "0";
        $(SelName.replace("select","txt")).value="无";
        $(SelName.replace("select","txt")+"_Id").value=0;
    }
}
function GetSmallLinkage(SelName)
{
    var SelId=$(SelName).value;
    var SelIdText=$(SelName).options[$(SelName).selectedIndex].text;
    $(SelName.replace("select","txt")).value=SelIdText;
    $(SelName.replace("select","txt")+"_Id").value=SelId;
}
function Call_Back_Linkage_Update(res)
{
    var SelName=res.value.Tables[1].Rows[0]["SelName"];
    $(SelName).length=0;
    if(res.value.Tables[0].Rows.length>0)
    {
        for(var i=0;i<res.value.Tables[0].Rows.length;i++)
        {
            $(SelName).length++;
            $(SelName).options[i].text = res.value.Tables[0].Rows[i]["Name"];
            $(SelName).options[i].value = res.value.Tables[0].Rows[i]["Id"];
            if(res.value.Tables[0].Rows[i]["Id"]==$(SelName.replace("select","txt")+"_Id").value)
            {
                $(SelName).options[i].selected=true;
            }
        }
    }
    else
    {
        $(SelName).length=1;
        $(SelName).options[0].text = "无相关子类";
        $(SelName).options[0].value = "0";
        $(SelName.replace("select","txt")).value="无";
        $(SelName.replace("select","txt")+"_Id").value=0;
    }
}
function GetGipsIndexNum()
{
    $("txtIndexNum").value=$("IndexNum").value;
}
function SelProperty(web,seltype,name,id,protype,siteid)
{
    WinOpenDialog('' + web + '/Common/SelectPropertyOpen.aspx?SelType=' + seltype + '&Control=' + name + '&Id=' + id + '&ProType=' + protype + '&siteid=' + siteid + '','600','400');
}
function SetListBoxInput(Name,Name1)
{
    if($(Name1).checked==true)
    {
        $(Name).value=$(Name).value+","+$(Name1+"_span").innerText;
    }
    else
    {
        $(Name).value=$(Name).value.replace(","+$(Name1+"_span").innerText,"");
    }
}
function SetListBoxMultiple(Name)
{
    $(Name).value="";
    var Name1=Name+"_Id";
    for(var i=0;i<$(Name1).options.length;i++)
    {
        if($(Name1).options[i].selected)
        {
            var e = $(Name1).options[i];
            $(Name).value=$(Name).value+","+e.text;
        }
    }
}
function JsNumberText(){
    if (!(((window.event.keyCode >= 48) && (window.event.keyCode <= 57)) || (window.event.keyCode == 13) || (window.event.keyCode == 46) || (window.event.keyCode == 45))){
        window.event.keyCode = 0;
    }
}