function OpenCustomerView(id)
{
	window.open("CustomerDetails.aspx?id=" + id,"","menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,width=460,height=400,top=150,left=250");
}

function OpenOrderMemberView(id)
{
	window.open("OrderMemberDetails.aspx?id=" + id,"","menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,width=460,height=400,top=150,left=250");
}

function OpenJoinMemberView(id)
{
	window.open("JoinMemberDetails.aspx?id=" + id,"","menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,width=460,height=400,top=150,left=250");
}


function OpenBusinessView(id){
    window.open("BusinessDetails.aspx?id=" + id,"","menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,width=460,height=400,top=150,left=250");
}

function OpenApplyJoinView(id){
    window.open("ApplyJoinDetails.aspx?id=" + id,"","menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,width=460,height=400,top=150,left=250");
}


function OpenBusinessMod(id){
    window.open("BusinessMod.aspx?id=" + id,"","menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,width=460,height=400,top=150,left=250");
}

function OpenDiamondView(id)
{
	window.open("DiamondDetails.aspx?id=" + id,"","menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no,width=480,height=400,top=150,left=250");
}

function OpenBracketView(id){
    window.open("BracketView.aspx?id=" + id,"","menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no,width=480,height=400,top=150,left=250");
}

function OpenDiamondActive(id){
    window.open("DiamondActive.aspx?id=" + id,"","menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no,width=480,height=400,top=150,left=250");
}

function OpenDiamondNote(id){
    window.open("../CSNoteExtend.aspx?adid=" + id,"","");
}

function OpenOrderView(id)
{
	window.open("OrderDetails.aspx?id=" + id,"","menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,width=460,height=400,top=150,left=250");
}


function OpenOrderView2(id)
{
	window.open("OrderDetails.aspx?id=" + id,"","menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,width=520,height=550,top=150,left=250");
}

function OpenOrderHandler(id,tp){
    window.open("OrderHandler.aspx?type=" + tp + "&id=" + id,"","");
}

function OpenCustomerOrder2(id)
{
    window.open("CustomerOrders.aspx?t=4&cid=" + id,"","menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,width=750,height=550,top=150,left=250");
}

function OpenCustomerCoinsView(id)
{
	window.open("CustomerCoins.aspx?id=" + id,"","menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,width=460,height=400,top=150,left=250");
}

function OpenCommentView(id)
{
	window.open("Comments.aspx?id=" + id,"","menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,width=460,height=400,top=150,left=250");
}

function selectTab(obj,tab,tab2)
{
    document.getElementById('m'+obj).className = "selected";
    document.getElementById(obj).className = "dselected";
    document.getElementById('m'+tab).className = "noselect";
    document.getElementById(tab).className = "dnoselect";
    if(tab2!=undefined)
    {
        document.getElementById('m' + tab2).className = "noselect";
        document.getElementById(tab2).className = "dnoselect";
    }
}

function OpenPlayerView2(id)
{
    window.open("PlayerView.aspx?id=" + id,"","menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,width=530,height=460,top=150,left=250");
}

function QueryString(source, name)
{
  var reg = new RegExp("(^|\\?|&)"+ name +"=([^&]*)(\\s|&|$)", "i");
  
  if (reg.test(source)) return RegExp.$2; return "";
};

function DBWPager_Judge(PNID){
    if (event.keyCode ==13){
        DBWPager_Goto(PNID);
        event.cancelBubble=true;
    }
}

function DBWPager_Goto(PNID){
    var Prefix = location.href;
    var p = QueryString(Prefix,"Page");
    if(p=="")
        Prefix += "&Page=";
    else{
        var i = Prefix.indexOf("&Page=");
        Prefix = Prefix.substring(0,i);
        //alert(Prefix);
        Prefix += "&Page=";
    }
    //var obj = document.getElementById(PNID);
    var objs = document.getElementsByName(PNID);
    var obj;
    for(var j=0;j<objs.length;j++){
        if(objs[j].value!=""){
            obj = objs[j];
            break;
        }
    }
    var str_pn = obj.value==""?"1":obj.value;
    var i_pn = parseInt(str_pn);
    if(isNaN(i_pn))
        i_pn = 1;
    location.href = Prefix + i_pn;
    return false;
}

function DPriceGoto(dF,dT){
    var odF = document.getElementById(dF);
    var odT = document.getElementById(dT);
    var str_odF = odF.value==""?"1":odF.value;
    var str_odT = odT.value==""?"100000000":odT.value;
    var i_odF = parseInt(str_odF);
    var i_odT = parseInt(str_odT);
    if(isNaN(i_odF))
        i_odF = 0;
    if(isNaN(i_odT))
        i_odT = 1000000000;
    //alert("List.aspx?p=-1&pA=1&pAF=" + i_odF +"&pAT=" + i_odT);
    //location.href = "List.aspx?p=-1&pA=1&pAF=" + i_odF +"&pAT=" + i_odT;
    window.open("List.aspx?p=-1&pA=1&pAF=" + i_odF +"&pAT=" + i_odT);
}

function DWeightGoto(dF,dT){
    var odF = document.getElementById(dF);
    var odT = document.getElementById(dT);
    var str_odF = odF.value==""?"1":odF.value;
    var str_odT = odT.value==""?"100000000":odT.value;
    var i_odF = parseInt(str_odF);
    var i_odT = parseInt(str_odT);
    if(isNaN(i_odF))
        i_odF = 0;
    if(isNaN(i_odT))
        i_odT = 1000000000;
    //location.href = "List.aspx?wF=" + i_odF +"&wT=" + i_odT;
    window.open("List.aspx?wF=" + i_odF +"&wT=" + i_odT);
}


function DStyleGoTo(StyleT){
    var obj = document.getElementById(StyleT);
    //location.href="List.aspx?sd=" + obj.value;
    window.open("List.aspx?sc=%C8%AB%B2%BF&sd=" + escape(obj.value),'','');
}

function NoteQuery(id){
    //NotePanel、NoteTitle、NoteBody
    var noteAjax = new Ajax2("text");
    noteAjax.get("NoteQuery.aspx?id=" + id,
        function(result){
           //alert(result);
           var ra =  result.split("$%NEO%&");
           document.getElementById("NotePanel").style.display = "";
           document.getElementById("NoteTitle").innerHTML = ra[0];
          document.getElementById("NoteBody").innerHTML = ra[1]; 
        }
    );
}

function SubmitComment(id,cid){
    //alert(id + "," + cid);
    
    var obj = document.getElementById(id);
    if(obj.value==""){
        alert("评论内容不能为空");
        return;
    }
    
    //alert(obj.value);

    var commentAjax = new Ajax2("text");
    commentAjax.get("SubmitComment.aspx?id=" + cid + "&ct=" + obj.value,
        function(result){
            var obj = document.getElementById(id);
            if(result=="1"){ 
              alert("发表评论成功"); 
              obj.value = "";
              SetPageNumber("up1","1");
            }
            else{
              alert("发表评论失败");
            }
        }
    );  
}

function SelectDiamondHistory(){
    var str = ReadDiamondHistory();
    //alert(str);
    var ListAjax = new Ajax2("text");
    ListAjax.get("AjaxList.aspx?ids=" + str,
        function(result){
            if(result==0){
                return; 
            }
           document.getElementById("tableDiamondHistory").innerHTML = result; 
        }
    );
}

function SelectOtherHistory(){
    var str = ReadOtherHistory();
    //alert(str);
    var ListAjax = new Ajax2("text");
    ListAjax.get("AjaxList.aspx?o=1&ids=" + str,
        function(result){
            if(result==0){
                return; 
            }
           document.getElementById("tableOtherHistory").innerHTML = result; 
        }
    );    
}

function HandMoveTopNav(id){
    var obj = document.getElementById(id + "Div");
    //alert(id + "div" + ":" + obj);
    if(obj != undefined){
        obj.style.display = "";
    }
}

function BankTransferInfoHidden(){
    var obj = document.getElementById("BankTransferInfo");
    if(obj.style.display == "")
        obj.style.display = "none";
    else
        obj.style.display = "";
}


function getPosition(targetObj){
	for(var ox=0,oy=0;targetObj!=null;ox+=targetObj.offsetLeft,oy+=targetObj.offsetTop,targetObj=targetObj.offsetParent);
	return {x:ox,y:oy}
}

function DIVTarget(){
    var obj2 = document.getElementById("DIVTarget");
    var posObj = getPosition(obj2);
    var obj = document.getElementById("DIVTarget2");
    if(obj!=undefined){
        obj.style.left = posObj.x + 312 + "px";
        obj.style.top = posObj.y + 373 + "px";
    }
}

function GoldPriceByDay(){
    var PriceAjax = new Ajax2("text");
    PriceAjax.get("AjaxList.aspx?ExRequest=GoldPriceByDay&timeStamp=" + new Date().getTime(),
        function(result){
            var ra = result.split("||");
            var output = "<ul><li class='GoldPrice'>" + 
                ra[0] + "</li><li class='GoldPrice'>" + ra[1] + "</li><li class='GoldPrice'>" + ra[2].replace(")","").replace("<","") + "</li><li class='GoldPriceEnd'>" + "(以上金价不含损耗费用)" + 
                "</li></ul>";
            document.getElementById("tbGoldPriceByDay_Body").innerHTML = output;
        }
    );
}