﻿document.oncontextmenu=new Function("event.returnValue=false");
function MenuFlash()
{
    document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"730\" height=\"51\">");
    document.write("<param name=\"movie\" value=\"images/menu.swf\" />");
    document.write("<param name=\"movie\" value=\"images/menu.swf\" />");
    document.write("<param name=\"quality\" value=\"high\" />");
    document.write("<param name=\"wmode\" value=\"transparent\" />");
    document.write("<embed src=\"images/menu.swf\" width=\"730\" height=\"51\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" wmode=\"transparent\"></embed>");
    document.write("</object>");
}       
/*ajax*/
var http_request;
function createXMLHttpRequest()
{
	if (window.ActiveXObject)
	{
   		http_request = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else if(window.XMLHttpRequest)
	{
   		http_request = new XMLHttpRequest();
	}
}
/*tab select*/
function tabSelect(tabid)
{
     var indexid = tabid.id.substr(3,1);
     var objTabMenu = tabid.parentNode;
     for (var i=1; i<objTabMenu.childNodes.length+1; i++)
     {
         if(indexid==i)
         {
            document .getElementById ("tab"+i).className ="tabcurr";
            document .getElementById ("cont"+i).style .display ="";
         }
         else
         {
            document .getElementById ("tab"+i).className ="tab";
            document .getElementById ("cont"+i).style .display ="none";
         }
     }
}
function itabSelect(tabid,ord)
{
     var indexid = tabid.id.substr(2,1);
     var objTabMenu = tabid.parentNode.parentNode;
     for (var i=1; i<objTabMenu.childNodes.length+1; i++)
     {
         if(indexid==i)
         {
            document .getElementById ("ma"+i+ord).className ="imcur";
            document .getElementById ("mc"+i+ord).style .display ="";
         }
         else
         {
            document .getElementById ("ma"+i+ord).className ="imenu";
            document .getElementById ("mc"+i+ord).style .display ="none";
         }
     }
}
/*check form*/
function validNull(theId,msg)
{
	if(document.getElementById(theId).value == "")
	{
		window.alert(msg);
		document.getElementById(theId).focus();
		return false;
	}
	return true;
}
function copyUrl()
{
    var clipBoardContent=this.location.href;
    window.clipboardData.setData("Text",clipBoardContent);
    alert("复制成功!");
}
function OpenWindows(url)
{
    window.showModalDialog(url,"newwin","dialogHeight: 300px; dialogWidth: 400px;center=yes;middle=yes; edge: raised ; help: no; resizable: no; status: no;scroll:no");    
}
function hideOprArea(theID)
{
     var indexid = theID.id.substr(3,1);
     var objTabMenu = theID.parentNode;
     for (var i=0; i<objTabMenu.childNodes.length; i++)
     {
         if(indexid==i)
         {
            document .getElementById ("ul_"+i).style .display ="";
         }
         else
         {
            document .getElementById ("ul_"+i).style .display ="none";
         }
     }
}
function Getsearch()
{
    var txt=document.getElementById("txtKey").value;
    if(txt!="" && txt!="关键字")
    {
        window.location.href="search.aspx?key="+txt;
    }
    else
    {
        alert("请输入关键字后搜索!");
    }
}
function show_comment()
{
    var txt=document.getElementById("t_comment");
    if(txt.style.display=="none")
        txt.style.display="block";
    else if(txt.style.display=="block")
        txt.style.display="none";
}
function bbsLogin()
{
    var uid=document.getElementById("txtUid").value;
    var pwd=document.getElementById("txtPwd").value;
    if(uid=="")
    {
        alert("请输入用户名!");return;
    }
    if(pwd=="")
    {
        alert("请输入密码!");return;
    }
    
    createXMLHttpRequest();
    http_request.onreadystatechange = bbsLogOk;
    http_request.open('POST', 'ajax/dntLogin.aspx?uid='+uid+'&pwd='+pwd, true);
    http_request.send();
}
function bbsLogOk()
{
    if(http_request.readyState == 4)
    {
        if(http_request.status == 200)
        {
            var result = http_request.responseText;
            var dnt = result.split("|");
            if(dnt[1]=="-1")
            {
                alert(dnt[0]);
                window.location.href="mbrLogin.aspx";
                
            }
            else
            {
                document.getElementById("txtUid").value="";
                document.getElementById("txtPwd").value="";
                document.getElementById("loginok").innerHTML="欢迎："+dnt[0]+"&nbsp;&nbsp;<a href='#' class='login' onclick='logout();'>[退出]</a>";
                document.getElementById("logint").style.display="none";
            }
        }
    }
}
function relogin(uid)
{
    document.getElementById("loginok").innerHTML="欢迎："+uid+"&nbsp;&nbsp;<a href='#' onclick='logout();'>[退出]</a>";
    document.getElementById("logint").style.display="none";
}
function replyComment(i)
{
    /*show comment*/
    var txt=document.getElementById("t_comment");
    if(txt.style.display=="none")
        txt.style.display="block";
        
    var userName=window.ctl00_ContentPlaceHolder1_GridView1.rows.item(i).cells.item(1).innerText; 
    
    document.getElementById("ctl00_ContentPlaceHolder1_txtComment").value="@"+i+"楼 "+userName+" ： ";
}
function KeepCatalog(cat)
{
    if(cat!=0)
    {
        document.getElementById("ul_"+cat).style.display="";
    }
}
function logout()
{
    createXMLHttpRequest();
    http_request.onreadystatechange = bbsLogOut;
    http_request.open('POST', 'ajax/dntLogin.aspx?key=out', true);
    http_request.send();
}
function bbsLogOut()
{
    if(http_request.readyState == 4)
    {
        if(http_request.status == 200)
        {
            var result = http_request.responseText;
            if(result=="1")
            {
                document.getElementById("loginok").style.display="none";
                document.getElementById("logint").style.display="";
            }
        }
    }
}
 //change catalog
var req1;
function changRes(id)
{
	if (window.ActiveXObject)
	{
   		req1 = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else if(window.XMLHttpRequest)
	{
   		req1 = new XMLHttpRequest();
	}

    req1.onreadystatechange = getSendResult;
    req1.open('GET', 'ajax/SortList.aspx?id='+id, true);
    req1.send(null);
}
function getSendResult()
{
    if(req1.readyState == 4)
    {
        if(req1.status == 200)
        {
            var result = req1.responseText;
            document.getElementById("ddlRes2").options.length=0;
            var piArray = result.split(",");
            document.getElementById("ddlRes2").options.add(new Option("-- 小类 --","-1"));
            for(var i=0;i<piArray.length;i++)
            {
                if(piArray[i].length>0)
                {
                    var ary1 = piArray[i].toString().split("|");
                    document.getElementById("ddlRes2").options.add(new Option(ary1[1].toString(),ary1[0].toString()));
                }
            }
            if(document.getElementById("ctl00_ContentPlaceHolder1_Hidden1").value!="-1")
            {
                document.getElementById("ddlRes2").value=document.getElementById("ctl00_ContentPlaceHolder1_Hidden1").value;
            }
        }
    }
}
function getcatalog(txt)
{
    document.getElementById("ctl00_ContentPlaceHolder1_Hidden1").innerText=txt;
}
//change os
var req;
function changeOs(id)
{
    if (window.ActiveXObject)
	{
   		req = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else if(window.XMLHttpRequest)
	{
   		req = new XMLHttpRequest();
	}
    req.onreadystatechange = getOsList;
    req.open('GET', 'ajax/SortList.aspx?oID='+id, true);
    req.send(null);
}
function getOsList()
{
    if(req.readyState == 4)
    {
        if(req.status == 200)
        {
            var result = req.responseText;
            document.getElementById("ddlOs2").options.length=0;
            var piArray = result.split(",");
            document.getElementById("ddlOs2").options.add(new Option("-- 小类 --","-1"));
            for(var i=0;i<piArray.length;i++)
            {
                if(piArray[i].length>0)
                {
                    var ary1 = piArray[i].toString().split("|");
                    document.getElementById("ddlOs2").options.add(new Option(ary1[1].toString(),ary1[0].toString()));
                }
            }
            if(document.getElementById("ctl00_ContentPlaceHolder1_Hidden2").value!="-1")
            {
                document.getElementById("ddlOs2").value=document.getElementById("ctl00_ContentPlaceHolder1_Hidden2").value;
            }
        }
    }
}
function getOsValue(txt)
{
    document.getElementById("ctl00_ContentPlaceHolder1_Hidden2").innerText=txt;
}
/*setup show*/
function ShowSetup(theId)
{
    var setupDiv = theId.parentNode.parentNode.parentNode.childNodes.length;
    for(var i=0;i<setupDiv;i++)
    {
        if(theId.parentNode.parentNode.parentNode.childNodes[i].className=="showSetup")
        {
            theId.parentNode.parentNode.parentNode.childNodes[i].style.display ="";
        }
        
    }
}
function HideSetup(theId)
{
    theId.parentNode.style.display ="none";
}
function DownSoft2(id,oid,uid)
{
    if(uid==1)
    {
        document.getElementById("ctl00_ContentPlaceHolder1_hlink").href="mbrLogin.aspx?reqUrl="+window.location.href;
    }
    else
    {
        document.getElementById("ctl00_ContentPlaceHolder1_hlink").href="Download.aspx?id="+id+"&oID="+oid;
    }
}
function DownSoft1(id,oid)
{
    document.getElementById("ctl00_ContentPlaceHolder1_hlink").href="Download.aspx?id="+id+"&oID="+oid;
}

//change mobile no
var req_m;
function changeMobile(id)
{
    if (window.ActiveXObject)
	{
   		req_m = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else if(window.XMLHttpRequest)
	{
   		req_m = new XMLHttpRequest();
	}
    req_m.onreadystatechange = getMobileList;
    req_m.open('GET', 'ajax/SortList.aspx?bID='+id, true);
    req_m.send(null);
}
function getMobileList()
{
    if(req_m.readyState == 4)
    {
        if(req_m.status == 200)
        {
            var result = req_m.responseText;
            document.getElementById("ddlPinPai2").options.length=0;
            var piArray = result.split(",");
            document.getElementById("ddlPinPai2").options.add(new Option("--型号--","-1"));
            for(var i=0;i<piArray.length;i++)
            {
                if(piArray[i].length>0)
                {
                    var ary1 = piArray[i].toString().split("|");
                    document.getElementById("ddlPinPai2").options.add(new Option(ary1[1].toString(),ary1[0].toString()));
                }
            }
            if(document.getElementById("ctl00_ContentPlaceHolder1_Hidden3").value!="-1")
            {
                document.getElementById("ddlPinPai2").value=document.getElementById("ctl00_ContentPlaceHolder1_Hidden3").value;
            }
        }
    }
}
function getMobileValue(txt)
{
    document.getElementById("ctl00_ContentPlaceHolder1_Hidden3").innerText=txt;
}
function SelectMobileNo(txt)
{
    //var iphoneNO=txt.replace(/\r\n/ig,'');
    document.getElementById("mobileList").innerText=txt;
}
var mobileTop = 0;
function initLeftCata()
{
	var scrollTop;
	if(typeof window.pageYOffset != 'undefined'){
		scrollTop = window.pageYOffset;
	}
	else if(typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat'){
		scrollTop = document.documentElement.scrollTop;
	} 
	else if (typeof document.body != 'undefined') { 
		scrollTop = document.body.scrollTop; 
	}
	if(document.getElementById("leftgongdong")!=null)
	{
	    if(scrollTop > mobileTop)
	    {
		    eval(document.getElementById("leftgongdong").style.marginTop = scrollTop - mobileTop + 14);
	    }
	    else
	    {
		    eval(document.getElementById("leftgongdong").style.marginTop = 0);
	    }
	}
	setTimeout("initLeftCata()", 50);
}
function show_step()
{
    var txt=document.getElementById("d_steup");
    if(txt.style.display=="none")
        txt.style.display="block";
    else if(txt.style.display=="block")
        txt.style.display="none";
}
function show_mlist()
{
    var txt=document.getElementById("mobileList");
    if(txt.style.display=="none")
        txt.style.display="block";
    else if(txt.style.display=="block")
        txt.style.display="none";
}
stuHover = function() {
    var cssRule;
    var newSelector;
    for (var i = 0; i < document.styleSheets.length; i++)
        for (var x = 0; x < document.styleSheets[i].rules.length; x++) {
        cssRule = document.styleSheets[i].rules[x];
        if (cssRule.selectorText.indexOf("LI:hover") != -1) {
            newSelector = cssRule.selectorText.replace(/LI:hover/gi, "LI.iehover");
            document.styleSheets[i].addRule(newSelector, cssRule.style.cssText);
        }
    }
    var getElm = document.getElementById("nav").getElementsByTagName("LI");
    for (var i = 0; i < getElm.length; i++) {
        getElm[i].onmouseover = function() {
            this.className += " iehover";
        }
        getElm[i].onmouseout = function() {
            this.className = this.className.replace(new RegExp(" iehover\\b"), "");
        }
    }
}
if (window.attachEvent) window.attachEvent("onload", stuHover);