﻿// JScript 文件

var base={ 
    Version:"1.0", 
    CreateDate:'2008-08-28', 
    ReleaseDate:'', 
    init:function(){ 
        //判断浏览器 
        var nu=navigator.userAgent; 
        this.isOpera=window.opera && opera.buildNumber; 
        this.isWebKit = /WebKit/.test(ua); 
  this.isOldWebKit = t.isWebKit && !window.getSelection().getRangeAt; 
  this.isIE = !t.isWebKit && !t.isOpera && (/MSIE/gi).test(ua) && (/Explorer/gi).test(navigator.appName); 
  this.isIE6 = t.isIE && /MSIE [56]/.test(ua); 
  this.isGecko = !t.isWebKit && /Gecko/.test(ua); 
  this.isGecko3 = t.isGecko && /(Firefox|Minefield)\/[3-9]/.test(ua); 
  this.isMac = ua.indexOf('Mac') != -1; 
    }, 
    is:function(o,style){//判断类型,o为对象，style为类型如string,object 
        var n=typeof(o);//typeof取得对象类型，但数组和null取到的都是object对象typeof一般只能返回如下几个结果：number,boolean,string,function,object,undefined 
         
        if(!t) 
            return n!='undefined'; 
        if(t=='array' && (o instanceof Array)) //instanceof同样也是判断对象类型,如果o是array类型，则返因结果为true 
            return true; 
         
        return n==t; 
        
    }, 
    isFunction:function(fn){ 
        return !!fn && typeof fn != "string" && !fn.nodeName &&  
   fn.constructor != Array && /function/i.test( fn + "" ); 
    }, 
    each:function(obj,fn,args){//动态创建对象,obj为对象，fn为对象方法,args:参数 
        var n,l,val; 
        if(!obj) 
            return 0; 
         args =args|| obj; 
       if(typeof(obj.length)!='undefined'){ 
            for(n=0,l=obj.length;n<l;n++){ 
                if(fn.call(args,obj[n],n,obj)==false) 
                    return 0; 
            } 
        }else{ 
            //Hashtables 
            for(n in obj){ 
                if(obj.hasOwnProperty(n)){ 
                    if(fn.call(args,obj[n],n,obj)==false) 
                        return 0; 
                } 
            } 
        } 
        return 1; 
    }, 
    extend:function(o,e){//扩展方法 
        var i,a=arguments;//参数 
         
        for(i=1;i<a.length;i++){ 
            if(a[i]!=null) 
                e=a[i];//取得参数方法 
                this.each(e,function(v,n){ 
                    if(typeof(v)!='undefined') 
                        o[n]=v; 
                }); 
        } 
        return o; 
    }, 
    trim:function(t){//去掉两边空格 
        return (t?''+t:'').replace(/^\s*|\s*$/g,''); 
    }, 
    createClass:function(s,p){//s表示需要创建的命名空间，p在此命名空间下的所有方法 
        var current=this,sp,name_space,currName,scn,c,de=0; 
         
        //类型的格式 
        s=/^((static) )?([\w.]+)(:([\w.]+))?/.exec(s); 
        //取得类的名称 
        currName=s[3].match(/(^|\.)(\w+)$/i)[2]; 
        //创建一个新的命名空间 
        name_space=current.createNS(s[3].replace(/\.\w+$/,'')); 
        //判断是否已经存在 
        if(name_space[currName]) 
            return; 
        //创建一个静态的类 
        if(s[2]=='static'){ 
            name_space[currName]=p; 
            if(this.onCreate) 
                this.onCreate(s[2],s[3],name_space[currName]); 
            return; 
        } 
        //创建一个默认构造函数 
        if(!p[currName]){ 
            p[currName]=function(){}; 
            de=1;//构造函数创建 
        } 
        //添加扩展方法 
        name_space[currName]=p[currName]; 
        name_space[currName]=current.extend(name_space[currName].prototype,p); 
         
        if(s[5]){//类的继承,有待完成 
            sp=current.resolve(s[5]);//分解已有名称空间 
            //sp=sp.prototype; 
            scn=s[5].match(/\.(\w+)$/i)[1];//取得类名称 
             
            c=name_space[currName]; 
             
        } 
          this.onCreate(s[2],s[3],ns[cn].prototype); 
    }, 
    resolve:function(n,o){//分解已有命名空间 
        var i,v; 
        o= o|| window; 
        if(n.indexOf('.')!=-1){ 
            n=n.split('.');//对字符串进行分解 
            for(i=0,v=n.length;i<v;i++){ 
                o=o[n[i]];//取得已经有名称 
                if(!o) 
                    break; 
            } 
        } 
        else { o=o[n];} 
        return o; 
    }, 
    createNS:function(n,o){//创建命名空间，n是要创建的命名空间名 
        var i,v; 
        o=o || window; 
         
        n=n.split('.');//对字符串进行分解 
        for(i=0;i<n.length;i++){ 
            v=n[i]; 
            if(!o[v]) 
                o[v]={}; 
             
            o=o[v]; 
        } 
         
        return o; 
    } 
}; 
window.$$=base; 
base.init; 
(function(){ 
    base.createClass('static base.utils.Ajax',{ 
        get:function(url,data,callback){ 
            if(base.isFunction(data)){ 
                callback=data; 
                data=null; 
            } 
           return this.Ajax({ 
            type:"GET", 
            data:data, 
            url:url, 
            callback:callback 
           }); 
        }, 
       post:function(url,data,callback){ 
            if(base.isFunction(data)){ 
                callback=data; 
                data=null; 
            } 
           return this.Ajax({ 
            type:"POST", 
            data:data, 
            url:url, 
            callback:callback 
           }); 
        }, 
        Ajax:function(s){ 
            if(typeof s.data !="String" && s.data) 
                 s.data=this.param(s.data); 
             if(s.type.toLowerCase()=="get" && s.data!=""){ 
                s.url+=(s.url.match(/\?/)?"":"?"); 
                s.url+=s.data; 
             } 
             if(s.type.toLowerCase()=="post"){ 
                 s.url+=(s.url.match(/\?/)?"":"?"); 
             } 
             s.url+="&_="+Math.random(); 
             var xmlHttp; 
             try 
             { 
                xmlHttp=new XMLHttpRequest(); 
             } 
             catch(e){ 
                try 
                { 
                    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); 
                } 
                catch(e){ 
                    xmlHttp=new ActiveXObject("Microsft.XMLHTTP"); 
                } 
             } 
            if( xmlHttp == null){ 
                return ; 
            } 
            xmlHttp.onreadystatechange=function(){ 
                if(xmlHttp.readyState==4){ 
                    if(xmlHttp.status==200){ 
                        if(s.callback && s.callback!=null && s.callback!=""){ 
                            var tmp=s.callback; 
                           eval(tmp(xmlHttp.responseText)); 
                        } 
                    } 
                } 
            } 
            xmlHttp.open(s.type,s.url,true); 
            xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 
            if(s.type.toLowerCase()=="post"){ 
                xmlHttp.send(s.data); 
            }else{ xmlHttp.send(null);} 
        }, 
        param:function(d){//取得序列化数值 
            var dataInfo=[]; 
            if(d.constructor != Array && d) 
                for(var i in d){ 
                    if(d[i]  && d.constructor !=Array && typeof d !='String'){ 
                       dataInfo.push(encodeURIComponent(i)+"="+encodeURIComponent(d[i])); 
                    } 
                } 
             return dataInfo.join('&').replace(/%20/g, "+") 
        } 
    }); 
})();  


//加载单页图文信息
function ShowSin()
{ 
    window.$Sin=base;
    //取得当前页面的栏目编号
    var cid=parent.document.getElementById("hidC_id").value;

    $Sin.utils.Ajax.get("../../ShowASP/Pic/Xml_AjaxSin.aspx?",{page:cid},function (datas){
        var strArray=new Array();   
        strArray=datas.split("|||");   
        document.getElementById("divPic").innerHTML=strArray[0];
        document.getElementById("hid").value = strArray[1]
    });
}

//加载新闻列表信息
function ShowNewsList()
{
    window.$NewsList=base;

    var cid="A|"+document.getElementById("hidC_id").value+"|"+document.getElementById("hidPage").value+"|"+document.getElementById("hidDivCss").value;         
    
    $NewsList.utils.Ajax.get("../../ShowASP/News/Xml_AjaxNews.aspx?",{page:cid},function (datas){
        var strArray=new Array();   
        strArray=datas.split("|||");   
        document.getElementById("divNewsList").innerHTML=strArray[0];
        document.getElementById("lblboot").innerHTML=strArray[1];
    });
}

//加载新闻详细信息
function ShowNewsInfo()
{
    window.$NewsInfo=base;
    var id;
    if(document.getElementById("hID") != null)
    {
        id=document.getElementById("hID");
    }
    if(document.getElementById("hidId") != null)
    {
        id=document.getElementById("hidId");
    }
    
    var cid="B|"+ id.value;
    $NewsInfo.utils.Ajax.get("../../ShowASP/News/Xml_AjaxNews.aspx?",{page:cid},function (datas){
        var strArray=new Array();   
        strArray=datas.split("|||"); 
        document.getElementById("lblTitle1").innerHTML=strArray[0];     
        document.getElementById("lblMore1").innerHTML=strArray[1];  
        document.getElementById("spOri").innerHTML=strArray[2]; 
    });
}

//跳转新闻列表信息
function ToNewsList()
{
    var cid = document.getElementById("hidC_id").value;
    window.location.href="News.aspx?c_id=" + cid;//添加后回到列表页    
}

//加载产品列表信息
function ShowPro()
{ 
    window.$Pro=base; 
    var cid=document.getElementById("hidC_id").value+"|"+document.getElementById("hidPage").value+"|"+document.getElementById("hidDivCss").value;
   
    $Pro.utils.Ajax.get("../../ShowASP/Product/Xml_AjaxPro.aspx?",{page:cid},function (datas){

    var strArray=new Array();   
        strArray=datas.split("|||");   
        
        document.getElementById("divPro").innerHTML=strArray[0];
        document.getElementById("lblboot").innerHTML=strArray[1];
    });
}
//跳转产品列表信息
function ToProList()
{
    var cid = document.getElementById("hidC_id").value;
    window.location.href="Product.aspx?c_id=" + cid;;//添加后回到列表页    
}
//加载单个产品信息
function ShowBle()
{ 

    //document.getElementById("spanMorePic").innerHTML = "";
    window.$Ble=base; 
  　var cid=document.getElementById("hID").value+"|";//+document.getElementById("hidPage").value+"|"+document.getElementById("hidDivCss").value; 
    
    $Ble.utils.Ajax.get("../../ShowASP/Product/Xml_AjaxBlen.aspx?",{page:cid},function (datas){

　　　  var strArray=new Array();   
        strArray=datas.split("|||");   
        
        document.getElementById("spanTitle").innerHTML=strArray[0];
        document.getElementById("pro-img").innerHTML= "<img src='" +strArray[1]+"' alt='" + strArray[0] + "'/>" ;//<img src='<%=pic_url %>' alt='<%=title %>' />
        document.getElementById("spanGuiG").innerHTML=strArray[2];
        document.getElementById("spanPrice").innerHTML=strArray[3];
        document.getElementById("spanMore").innerHTML=strArray[4];
        //alert(strArray[5]);
        document.getElementById("spanMorePic").innerHTML=strArray[5];//;"haoi"
    });
}

//加载产品扩展图片信息
function ShowExPic()
{ 
    document.getElementById("spanMorePic").innerHTML = "";
    
    window.$Ble=base; 
  　var cid=document.getElementById("hID").value+"|ex";//+"|"+document.getElementById("hidPage").value+"|"+document.getElementById("hidDivCss").value; 
    
    $Ble.utils.Ajax.get("../../ShowASP/Product/Xml_AjaxBlen.aspx?",{page:cid},function (datas){

　　　  var strArray=new Array();   
        document.getElementById("spanMorePic").innerHTML=strArray[0];
        
    });
}

//加载图片信息
function ShowHon()
{ 
    window.$Hon=base;
    
    var cid=document.getElementById("hidC_id").value+"|"+document.getElementById("hidPage").value+"|"+document.getElementById("hidDivCss").value;
    $Hon.utils.Ajax.get("../../ShowASP/Pic/Xml_AjaxHon.aspx?",{page:cid},function (datas){

var strArray=new Array();   
        strArray=datas.split("|||");   
        
        document.getElementById("divPic").innerHTML=strArray[0];
        document.getElementById("lblboot").innerHTML=strArray[1];   

    });
}

//“访客留言”类信息
function ShowMess()
{ 
    window.$Mess=base;
    
    var cid=document.getElementById("hidC_id").value+"|"+document.getElementById("hidPage").value+"|"+document.getElementById("hidDivCss").value;
    $Mess.utils.Ajax.get("../../ShowASP/Message/Xml_AjaxMess.aspx?",{page:cid},function (datas){

    var strArray=new Array();   
        strArray=datas.split("|||");   
        
        document.getElementById("divNote").innerHTML=strArray[0];
        document.getElementById("lblboot").innerHTML=strArray[1];   

    });
}

//加载文件下载信息
function showDown()
{ 
document.getElementById("lblboot").innerHTML = "";
    window.$Down=base;
    
    if(document.getElementById("hidPage").value != '-1')
    {
        var cid=document.getElementById("hidC_id").value+"|"+document.getElementById("hidPage").value+"|"+document.getElementById("hidDivCss").value;
    }
    else
    {
        var cid=document.getElementById("hidC_id").value+"|1|"+document.getElementById("hidDivCss").value;
    }
    
    $Down.utils.Ajax.get("../../ShowASP/DownLoad/Xml_AjaxDown.aspx?",{page:cid},function (datas){

    var strArray=new Array();   
    strArray=datas.split("|||");   
    document.getElementById("divDownload").innerHTML=strArray[0];
    
    document.getElementById("lblboot").innerHTML=strArray[1];   


    });
}

//“供求列表”类信息
function ShowSDList()
{      
    window.$SDList=base;
           var tag="B|"+document.getElementById("hidC_id").value+"|"+document.getElementById("hidPage").value+"|"+document.getElementById("hidDivCss").value;        
    $SDList.utils.Ajax.get("../../ShowASP/SAndD/Xml_AjaxSandD.aspx?",{page:tag},function (datas){
    //alert(datas);
     var strArray=new Array();   
        strArray=datas.split("|||");   
        document.getElementById("divSaD").innerHTML=strArray[0];
        document.getElementById("lblboot").innerHTML=strArray[1];
    });
}

//跳转供求列表页
function ToSDList()
{
    var cid = document.getElementById("hidC_id").value;
    window.location.href="SaD.aspx?c_id=" + cid;//添加后回到列表页    
}

//“供求内容”类信息
function ShowSDInfo()
{           
  window.$SDInfo=base;

         var tag="A|"+document.getElementById("hidId").value;         
    $SDInfo.utils.Ajax.get("../../ShowASP/SAndD/Xml_AjaxSandD.aspx?",{page:tag},function (datas){

     var strArray=new Array();   
        strArray=datas.split("|||"); 
                 
        document.getElementById("title1").innerHTML=strArray[0];
        document.getElementById("more1").innerHTML=strArray[1];
        document.getElementById("deadline1").innerHTML=strArray[2];
        document.getElementById("imgPic1").innerHTML="<img id=\"imgPic\" src='"+strArray[3]+"' width=\"138\" alt='"+strArray[0]+"' onload='javascript:DrawImage(this,138,138);' />";
        document.getElementById("linkman1").innerHTML=strArray[4];
        document.getElementById("links1").innerHTML=strArray[5];
        document.getElementById("types1").innerHTML=strArray[6];
        document.getElementById("area1").innerHTML=strArray[7];
        document.getElementById("e_mail1").innerHTML=strArray[8];
        document.getElementById("companyName1").innerHTML=strArray[9];
        document.getElementById("companyAddress1").innerHTML=strArray[10];
        document.getElementById("netWork1").innerHTML=strArray[11];
        document.getElementById("postalcode1").innerHTML=strArray[12];
        document.getElementById("type1").innerHTML=strArray[13];
        document.getElementById("fax1").innerHTML=strArray[14];
        document.getElementById("price1").innerHTML=strArray[15];
    });
}

//定制侧边栏目
function LeftCol(pos)
{
    if(pos == "leftcol")//修改页面的左侧定制栏目../ShowASP/Control/controlAjax.aspx
    {
//        if(document.getElementById("Leftusercol1_leftEdit") != null)
//        {
//            document.getElementById("Leftusercol1_leftEdit").style.display = "none";
//        }
        document.getElementById("Leftusercol1_leftCol").innerHTML  ="";
        var hcid= document.getElementById("hidC_id");
        var hinfoid= document.getElementById("hidId");
        var tag = "leftcol";
        if(hinfoid != null)
        {
            $$.utils.Ajax.get("../../ShowASP/Control/controlAjax.aspx?",{page:tag,cid:hcid.value,infoid:hinfoid.value},function (datas)
            {
                document.getElementById("Leftusercol1_leftCol").innerHTML = datas;         
            });
        }
        else
        {
            $$.utils.Ajax.get("../../ShowASP/Control/controlAjax.aspx?",{page:tag,cid:hcid.value},function (datas)
            {
                document.getElementById("Leftusercol1_leftCol").innerHTML = datas;          
            }); 
        }
    }
    else if(pos == "pleftcol")//修改页面的左侧定制栏目../ShowASP/Control/controlAjax.aspx
    {
//        if(parent.document.getElementById("Leftusercol1_leftEdit") != null)
//        {
//            parent.document.getElementById("Leftusercol1_leftEdit").style.display = "none";
//        }
        parent.document.getElementById("Leftusercol1_leftCol").innerHTML  ="";
        var hcid= parent.document.getElementById("hidC_id");
        var hinfoid= parent.document.getElementById("hidId");
        var tag = "pleftcol";
        if(hinfoid != null)
        {
            $$.utils.Ajax.get("../../ShowASP/Control/controlAjax.aspx?",{page:tag,cid:hcid.value,infoid:hinfoid.value},function (datas)
            {
                parent.document.getElementById("Leftusercol1_leftCol").innerHTML = datas;   
                            //幻灯片
            var hidTeShuID=document.getElementById("Leftusercol1_hidTeShuID").value;
            if(hidTeShuID!=""&&hidTeShuID!="0")
            {
                //alert("22");
                new Imgpptfilter("slide"+hidTeShuID+"","showtext_"+hidTeShuID+"","hover","normal");
            }      
            });
        }
        else
        {
            $$.utils.Ajax.get("../../ShowASP/Control/controlAjax.aspx?",{page:tag,cid:hcid.value},function (datas)
            {
                parent.document.getElementById("Leftusercol1_leftCol").innerHTML = datas;   
                            //幻灯片
            var hidTeShuID=document.getElementById("Leftusercol1_hidTeShuID").value;
            if(hidTeShuID!=""&&hidTeShuID!="0")
            {
                //alert("22");
                new Imgpptfilter("slide"+hidTeShuID+"","showtext_"+hidTeShuID+"","hover","normal");
            }       
            }); 
        }
        

            
//            //滚动图片
//            var hidTeShuID2=document.getElementById("hidTeShuID2").value;
//            if(hidTeShuID2!=""&&hidTeShuID2!="0")
//            {
//                
//            }
    }  
}


function LeftShow()
{
    //alert(111);
    parent.document.getElementById("saveDiv").innerHTML="";
    $$.utils.Ajax.get("../../ShowASP/Control/leftShowAjax.aspx",function (datas)
            {
               //alert(datas);
                parent.document.getElementById("saveDiv").innerHTML = datas;          
            }); 
}
function spans(ss,txtpic)
{
    var lm=ss;
    var pictxt=txtpic;
    var spanname="";
    var s_name="";
    spanname = document.getElementById(lm).value;
    s_name=spanname.match(/[^\\]+(?=\.)|[^\\.]+$/);
    document.getElementById(pictxt).value=s_name;
    document.getElementById(pictxt).focus();
    document.getElementById(pictxt).select();
}
