var cncShop = {
    utility:"utility",
    members:[
        {
            field:"general",
            solution:["default","category","signin","signin_template","error","configuration","exceptionlogs","overflowunderflow","statistic","utilityMedia","utilityPaging"]
        },
        {
            field:"debuggable",
            solution:["accessories","classify","exception","flash","images","inc","js","links","media","template","signin","ss","xmls","xsls","sa","su","footer","header","office2000","office2003","officeXP","ads","bg","bitmaps","topicface","Userface","uploadfile","template","archives","users","usertemplate"]
        },
        {
            field:"assembly",
            solution:["⊙","/",".","~","!","@","#","$","%","^","&","*","_","+","|","`","?",">","<",":",";","(",")","[","]","{","}","\\",".","-","=","'"," "]
        },
        {
            field:"suffix",
            solution:["js","vbs","inc","htm","html","aspx","xml","xsl","doc","xls","ppt","gif","jpg","jpe","jpeg","bmp","txt"]
        },
        {
             field:"method",
             solution:["GET","POST","Content-Type","application/x-www-form-urlencoded","distinct","action","script","language","javascript","src"]
        }
    ]
};
/***********************************************************************************/
var _url = ""+ document.location;
_url=_url.toLowerCase();
document.write('<script language="JavaScript" src="/js/ads/tb_Nav_Ads.js"></script>');
document.write('<script language="JavaScript" src="/js/statistic.js"></script>');
document.write('<script language="JavaScript" src="/js/header/clsmenus.js"></script>');
document.write('<script language="JavaScript" src="/js/Province/tb_City.js"></script>');
document.write('<script language="JavaScript" src="/js/shopping-navigation/cat/cat.js"></script>');
document.write('<script language="JavaScript" src="/js/shortmsg/shortmessage.js"></script>');
if( _url.indexOf("bbs")>=1 ) {
	document.write('<script language="JavaScript" src="/js/bbs/clsmenus.js"></script>');
} else if( _url.indexOf("trade")>-1 || _url.indexOf("su")>-1 || _url.indexOf("stores")>-1) {
	document.write('<script language="JavaScript" src="/js/Product_Cls/tb_Product_Cls.js"></script>');
	document.write('<script language="JavaScript" src="/js/Product_Cls/tb_Product_Sub.js"></script>');
	document.write('<script language="JavaScript" src="/js/Product_Cls/tb_Product_Progeny.js"></script>');
	document.write('<script language="JavaScript" src="/js/Product_Cls/tb_Product_Model.js"></script>');
} else if ( _url.indexOf("pub")>-1 ) { // pages
	document.write('<script language="JavaScript" src="/js/shopping-navigation/cat/tb_Nav_Surroundings.js"></script>');
	document.write('<script language="JavaScript" src="/js/shopping-navigation/cat/tb_Nav_ConsumeObject.js"></script>');
	document.write('<script language="JavaScript" src="/js/shopping-navigation/cat/tb_Nav_CompanyScale.js"></script>');
	document.write('<script language="JavaScript" src="/js/shopping-navigation/cat/tb_Nav_PerCapitaComsuption.js"></script>');
	document.write('<script language="JavaScript" src="/js/shopping-navigation/cat/tb_Nav_CharacteristicsService.js"></script>');
}
function getBizStatus(selObj){
	if( selObj.innerHTML=="营业状态" ) {
		var bizStatus = {};
		bizStatus["value"]=[0,1,2,3,4,5,6,7];
		bizStatus["field"]=["正常营业","已经倒闭","停业整顿","内部装修","迁移地址","改变经营","转让","其它"];
		var s="";
		for( var i=0; i<bizStatus["value"].length; i++ ) {
			s+="<option value='"+bizStatus["value"][i]+"'>"+bizStatus["field"][i]+"</option>";
		}
		selObj.innerHTML = "<select id='bizstat' name='bizstat' onchange=\"bizStatus_onchange(this);\"><option>营业状态</option>"+s+"</select>";;
	}
}
function bizStatus_onchange(selObj){
	document.location.href="?bizstat="+selObj.options[selObj.selectedIndex].value+"&agent="+o.agent+"&clsid="+o.clsid;
}
function onTabIndex( obj ){
	if ( typeof obj=="string" )
		obj = getElement( obj );
	if ( obj ) 
		 obj.focus();
}
function setAds(obj,ad_Id,w,h,defaultimgurl){
	var imgurl,weburl;
	for( var i=0; i<SP_Nav_Ads_Id.length; i++ ) {
		if( SP_Nav_Ads_Id[i]==ad_Id ) {
			imgurl = SP_Nav_Ads_ImgUrl[i];
			weburl = SP_Nav_WebUrl[i];
		}
	}
	var s = getImageWhitFlash(w,h,imgurl,false,defaultimgurl,weburl);
	if( typeof obj=="string" )
		obj = getElement(obj);
	if( obj ) 
		obj.innerHTML = s;
}
// there was a problem with firefox and netscape and opera
function getAds(ad_Id,w,h,defaultimgurl,isTransparent){
	if( typeof SP_Nav_Ads_Id=="undefined" )
		return "";
	var imgurl,weburl,graphics=new Array();
	for( var i=0; i<SP_Nav_Ads_Id.length; i++ ) {
		graphics[i] = new Image();
		graphics[i].src = SP_Nav_Ads_ImgUrl[i]
		if( SP_Nav_Ads_Id[i]==ad_Id ) {
			imgurl = graphics[i].src;
			weburl = SP_Nav_WebUrl[i];
		}
	}
	var s = getImageWhitFlash(w,h,imgurl,isTransparent,defaultimgurl,weburl);
	return s;
}
function preload_bitmaps(){
	var graphics = new Array();
	var args = preload_bitmaps.arguments;
	for( var i=0; i<args.length; i++ ) {
		graphics[i] = new Image();
		graphics[i].src = args[i];
		alert( graphics[i].src);
	}
}
/***********************************************************************************/
if( typeof o !="object" ) var o = new Object();
o.TradeStateArray = ["0,等待买家付款,royalblue","1,交易在进行中,goldenrod","2,该交易已成功,olivedrab","3,交易已经失败,orangered","4,交易已经退款,inactivecaption","5,等待发货的交易,cadetblue","6,被冻结的交易,magenta"];
o.agent=1;
o.url  = ""+document.location;
o.action = null;
o.clsid  = 0;
o.subid  = 0;
o.ajax = null;
o.domain = window.document.location.protocol +"//"+ window.document.domain;
o.isLayerObject  = ((document.layers)?(true):(false));
o.isOperaBrowser = window.navigator.userAgent.toLowerCase().indexOf("opera")!=-1;
o.siteName = "太原信息港";
o.filter = /^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
o.maximumPermissibleLimit = 0;
o.exit = function(url){
   if(url==null||url=="")
      url=document.referrer;
   if(url=='')
      url='/';
   window.document.location=url;
}
String.prototype.format = function(){
	var selObj = this;
	var length = String.prototype.format.arguments.length;
	for ( var i=0; i<length; i++ )
		selObj = selObj.replace( new RegExp("\\{"+ i +"\\}","g"), String.prototype.format.arguments[i] );
	return selObj;
}
o.o = function(){
	var elements = new Array();
	for ( var i=0; i<o.o.arguments.length; i++ ) {
		var element = o.o.arguments[i];
		if ( typeof element=="string" )
			element = document.getElementById(element);
		if ( o.o.arguments.length==1 )
			return element;
		elements.push(element);
	} return elements;
}
o.close = function(debug){
  if( debug ) {
      alert(debug);
      return;
  } else {
     window.parent.opener = null;
     window.close();
  }
} 
o.GetColorScheme = function(clsid){
    for( var i=0; i<ColorSchemes.length; i++ ) {
        a = ColorSchemes[i].split("|");
        if( clsid == a[0] )
           return a[1]; 
    } return "#ff9900";
}
/*************************************************
* set this property for get clsid from the URL
*************************************************/
o.ClsId = function(){
    var pattern = /(cat)-([\d]+)/g;
    if( pattern.test(o.url) )
        return RegExp.$2;
        
    var clsid = getUrlParam("clsid");
    if( /([\d]+)/.test(clsid) )
        return RegExp.$1;
    return 0;
}
function iframe(w,h,src,id){return'<iframe src="'+src+'" id="'+id+'" width="'+w+'" height="'+h+'" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>';}
/***********************************************
* 市 City for DropDownList
************************************************/
function getCityDropDownList(agent,selectName ){
    var s="";
    for( var i=0; i<tb_City_CityId.length; i++ ) {
         if( 1==tb_City_ProvinceId[i] ) {
			 if(agent==tb_City_CityId[i]){
				f=" selected";
			 } else {
				f="";
			 }
			 s+="<option value='"+tb_City_CityId[i]+"'"+f+">"+tb_City_City[i]+"</option>";
         }
    } return "<select id='"+selectName+"' name='"+selectName+"'>"+s+"</select>";
}
/***********************************************
* 市 City for getSingleAgent
************************************************/
function getSingleAgent(){
	for( var i=0; i<tb_City_ProvinceId.length; i++ )
		if( tb_City_CityId[i]==o.agent )
			return tb_City_City[i];
}
function getSingleProxy(proxy){
	for( var i=0; i<tb_City_ProvinceId.length; i++ )
		if( tb_City_CityId[i]==proxy )
			return tb_City_City[i];
}
/********************************************************************
* 产品图片预览 zoomInProductImage selfObj.src
*********************************************************************/
function previewpic(obj){
    if( typeof(obj)=="string")
        obj = getElement(obj);
    var w = this.open(); 
    w.htmlContainer = "<html><head><title>"+this.document.title+"</title></head><body style=\"margin:0px;padding:0px;background:url("+obj.src+") center no-repeat;\">"+flash('100%','100%','/flash/beautify/3.swf',true)+"</body>";
    w.document.write(w.htmlContainer);
    w.document.close();
    w.focus();
}
function isValidImageUrl(url){
	if( url==null||url==""||url.lastIndexOf(".")==-1 )
		return false;
	var suffix = url.substring(url.lastIndexOf(".")).toLowerCase();
	if( suffix==".swf"||suffix==".jpg"||suffix==".gif"||suffix==".jpe"||suffix==".jpeg"||suffix==".bmp"||suffix==".png" )
		return true;
	return false;
}
function isImageUrl(url){
	var suffix = url.substring(url.lastIndexOf(".")).toLowerCase();
	if( suffix==".swf" ) {
		return false;
	}  return true;
}
function onFocusField(obj){
    if( typeof obj=="string") obj=getElement(obj);
    if(!obj) return;
    obj.style.cssText = "background-color:orangered;color:white;";
    setTimeout(function(){
        obj.style.cssText = "";
    },1000);
}
function getImageOrFlash( w,h,imgurl,isTransparent,defaulturl ){
	if( w!="" ) 
		w = "width:"+w+";";
	if( h!="" )
		h = "height:"+h+";";
	var size = "style=\""+w+h+"\"";
	if( imgurl != null && imgurl.length>4) {
		if( isValidImageUrl(imgurl) ) {
			if( isImageUrl(imgurl) ) {
				return "<img "+size+" src='"+ imgurl +"' class='media' onclick=\"previewpic(this);\"/>";
			} else {
				return "<div class='media' onclick=\"Go('"+imgurl+"');\">"+flash(w,h,imgurl,isTransparent)+"</div>";
			}
		}
	}
	if( defaulturl!=null&&defaulturl.length>4 ){
		return "<img style=\"width:"+w+";height:"+h+"\" src='"+ defaulturl +"' class='media' onclick=\"previewpic(this);\"/>";
	}
	return "";
}
function getImageWhitFlash( w,h,imgurl,isTransparent,defaultimageurl,weburl ){
	if( imgurl != null && imgurl.length>4) {
		if( isValidImageUrl(imgurl) ) {
			if( isImageUrl(imgurl) ) {
				return "<img width='"+w+"' height='"+h+"' src='"+ imgurl +"' class='media' onclick=\"Go('"+weburl+"');\"/>";
			} else {
				return "<div class='media' onclick=\"Go('"+weburl+"');\" width='"+w+"' height='"+h+"'>"+flash(w,h,imgurl,isTransparent)+"</div>";
			}
		}
	}
	if( defaultimageurl!=null&&defaultimageurl.length>4 ){
		return "<img width='"+w+"' height='"+h+"' src='"+ defaultimageurl +"' class='media' onclick=\"Go('"+weburl+"');\"/>";
	}
	return "";
}
function getImageAndFlash( w,h,imgurl,isTransparent,defaultimageurl,weburl ){
	if( h!="" )
		h = " height="+h;
	var size = "width="+w+h;
	if( imgurl != null && imgurl.length>4) {
		if( isValidImageUrl(imgurl) ) {
			if( isImageUrl(imgurl) ) {
				return "<img "+size+" src='"+ imgurl +"' onclick=\"previewpic(this);\" style='border:1px solid black;'/>";
			} else {
				return "<div "+size+" onclick=\"Go('"+weburl+"');\">"+flash(w,h,imgurl,isTransparent)+"</div>";
			}
		}
	}
	if( defaultimageurl!=null&&defaultimageurl.length>4 ){
		return "<img "+size+" src='"+ defaultimageurl +"' onclick=\"previewpic(this);\"/>";
	}
	return "";
}
function Go(url){
	window.open(url);
}
function showOnlineStatistic(){
	if ( getCColl(1)==1||getCColl(1)==2||getCColl(1)==3)
		Go("/_sa/CNC/OnlineStatistic/");
}
/*************************************************
* set this property for get ColorSchemes of item from property of clsid
************************************************
o.ColorScheme = function(){
    var clsid = o.ClsId();
    var a;
    for( var i=0; i<ColorSchemes.length; i++ ) {
        a = ColorSchemes[i].split("|");
        if( clsid == a[0] )
           return a[1]; 
    } return "#ff9900";
}*/
/*************************************************
* get the value of parameter from URL
*************************************************/
function getUrlParam(name){
    var result = 0;
    var url = o.url.toLowerCase();
    try{
        name = name.toLowerCase();
        var s,a;
        if( url.indexOf("?")!=-1 ) {
            url = url.split("?")[1];
            if( url.indexOf("&")!=-1 ) {
              s = url.split("&");
              for( var i=0; i<s.length; i++ ) {
                  if( s[i].indexOf("=")!=-1 ) {
                      a = s[i].split("=");
                      if( a[0].toLowerCase() == name ) {
                          result = a[1];
                          break;
                      }
                  }
              }  
            } else {
                if( url.indexOf("=")!=-1 ) {
                    a = url.split("=");
                    if( a[0].toLowerCase() == name )
                        result = a[1];    
                }
            }
        } else if( url.indexOf("detail") && url.indexOf(",")!=-1 ) {
            url = url.split("art")[1].replace(/(\/)/g,"");
            a = url.split(",");
            switch(name){
               case "userid": 
                   result = a[0];break;
               case "clsid":
                   result = a[1];break;
               case "subid":
                   result = a[2];break;
               case "id":
                   result = a[3];break;
            }
        }
    }catch(e){
        alert("获得result异常:"+ e.message);
    }
    return result;
}
/*************************************************
* 获得A单值
*************************************************/
function getSingleAncestorA(clsid){
	for( var i=0; i<AncestorAID.length; i++ ) 
	    if( AncestorAID[i] == clsid )
			return AncestorCAT[i];
}
function load_AncestorDropDownList_A( obj, clsid, subid ){
	if ( typeof obj=="string" )
		 obj = getElement( obj );
	if ( !obj )
		return;
	var option = document.createElement("option");
	option.setAttribute("value",0);
	option.appendChild(document.createTextNode("　　"));
	obj.appendChild( option );
	for ( var i=0; i<AncestorAID.length; i++ ) {
		option = document.createElement("option");
		option.setAttribute("value",AncestorAID[i]);
		option.appendChild(document.createTextNode(AncestorCAT[i]));
		if ( o.clsid==AncestorAID[i] ) 
			 option.selected = true;
		obj.appendChild( option );
	}
}
/*************************************************
* 获得B单值
*************************************************/
function getSingleAncestorB(clsid,subid){
	if( clsid<=0 || subid<=0 )
		return ""
	for( var i=0; i<granddadBID.length; i++ ) {
		if( clsid == granddadAID[i] ) {
			if( granddadBID[i] == subid ) {
				return granddadCAT[i];
			}
		}
	} return "";
}
function load_AncestorDropDownList_B( obj, clsid, subid ) {
	if ( typeof obj=="string" )
		 obj = getElement( obj );
	if ( !obj )
		return;
	var option = document.createElement("option");
	option.setAttribute("value",0);
	option.appendChild(document.createTextNode("　　　"));
	obj.appendChild(option);
	var color = o.ColorScheme();
	for( var i=0; i<granddadBID.length; i++ ) {
		if( clsid == granddadAID[i] ) {
			option = document.createElement("option");
			option.setAttribute("value",granddadBID[i]);
			option.appendChild(document.createTextNode(granddadCAT[i]));
			if( subid == granddadBID[i] ) {
				option.style.cssText = "background-color:"+color+";color:white";
				option.selected = true;
			}
			obj.appendChild(option);
		}
	}
}
/*************************************************
* 获得单值产品父分类
*************************************************/
function getSingleProduct_Cls(pcid){
    for( var i=0; i<tb_Product_Cls_ProductCId.length;i++ )
       if( pcid == tb_Product_Cls_ProductCId[i] )
            return tb_Product_Cls_Product[i];
    return "";
}
/*************************************************
* 获得单值产品子分类
*************************************************/
function getSingleProduct_Sub(psid){
    for( var i=0; i<tb_Product_Sub_ProductSId.length;i++ )
       if( psid == tb_Product_Sub_ProductSId[i] )
            return tb_Product_Sub_Product[i];
    return "";
}
/*************************************************
* 获得单值产品孙分类
*************************************************/
function getSingleProduct_Progeny(ppid){
    for( var i=0; i<tb_Product_Progeny_ProductPId.length;i++ )
       if( ppid == tb_Product_Progeny_ProductPId[i] )
            return tb_Product_Progeny_Product[i];
    return "";
}
/*************************************************
* 获得单值产品曾孙分类
*************************************************/
function getSingleProduct_Model(pmid){
    for( var i=0; i<tb_Product_Model_ProductMId.length;i++ )
       if( pmid == tb_Product_Model_ProductMId[i] )
            return tb_Product_Model_Product[i];
    return "";
}
/*************************************************
* 获得子商品分类列表
*************************************************/
function sProducts(cid,pcid,psid,masteruserid){
    if( cid<=0 || pcid<=0 )return "";
    var f,s="";
    var url = "?masteruserid="+masteruserid+"&clsid="+cid+"&pcid="+pcid+"&page="+o.CurrentPage;
    for( var i=0; i<tb_Product_Sub_ProductSId.length; i++ ) {
        if( pcid == tb_Product_Sub_ProductCId[i] ) {
            f = tb_Product_Sub_ProductSId[i]==psid ? " style='color:red;'":"";
            s += "<a href='"+url+"&psid="+tb_Product_Sub_ProductSId[i]+"'"+f+">"+tb_Product_Sub_Product[i]+"</a>　";
        }
    } return s==""?"":"<div id='subpc'>"+s+"</div>";
}
/*************************************************
* 获得孙商品分类列表
*************************************************/
function pProducts(cid,pcid,psid,ppid,masteruserid){
    if( cid<=0 || pcid<=0 || psid<=0 )return "";
    var f,s="";
    var url = "?masteruserid="+masteruserid+"&clsid="+cid+"&pcid="+pcid+"&psid="+psid+"&page="+o.CurrentPage;
    for( var i=0; i<tb_Product_Progeny_ProductPId.length; i++ ) {
        if( psid == tb_Product_Progeny_ProductSId[i] ){
            f=tb_Product_Progeny_ProductPId[i]==ppid ?" style='color:red;'":"";
            s += "<a href='"+url+"&ppid="+tb_Product_Progeny_ProductPId[i]+"'"+f+">"+tb_Product_Progeny_Product[i]+"</a>　";
        }
    } return s==""?"":"<div id='subpp'>"+s+"</div>";
}
/*************************************************
* 获得曾孙商品分类列表
*************************************************/
function mProducts(cid,pcid,psid,ppid,pmid,masteruserid){
    if( cid<=0 || pcid<=0 || psid<=0 || ppid<=0 )return "";
    var f,s = "";
    var url = "?masteruserid="+masteruserid+"&clsid="+cid+"&pcid="+pcid+"&psid="+psid+"&ppid="+ppid+"&page="+o.CurrentPage;
    for( var i=0; i<tb_Product_Model_ProductMId.length; i++ ) {
        if( ppid == tb_Product_Model_ProductPId[i] ) {
            f=tb_Product_Model_ProductMId[i]==pmid ?" style='color:red;'":"";
            s += "<a href='"+url+"&pmid="+tb_Product_Model_ProductMId[i]+"'"+f+">"+tb_Product_Model_Product[i]+"</a>　";
        }
    } return s==""?"":"<div id='subpm'>"+s+"</div>";
}
/*************************************************
* 商品父分类DropDownList下拉列表
*************************************************/
function tb_Product_Cls_DropDownList( obj,pcid, optstr ){
    if( typeof tb_Product_Cls_ProductCId != "object" ) {
        alert("tb_Product_Cls_ProductCId is null");return;
    }
    if( typeof obj == "string" )
        obj = getElement(obj);
    if( !obj ) {
        alert("obj is null");return;
    }
    var option;
    for( var i=0; i<tb_Product_Cls_ProductCId.length; i++ ) {
        option = document.createElement("option");
        option.setAttribute("value",tb_Product_Cls_ProductCId[i]);
        option.appendChild(document.createTextNode(tb_Product_Cls_Product[i]));
        if( pcid==tb_Product_Cls_ProductCId[i] || tb_Product_Cls_Product[i]==optstr) {
           option.selected = true;
        }
        obj.appendChild(option);
    }
}
function eXtensible(parameters){
    var s = (g(2,1)+g(1,12)+g(2,1));
    if( null == parameters ){
       return s+g(0,5)+g(2,2)+g(3,6);
    } return ((s + parameters )+ (g(2,2)+g(3,6)));
} function SingInDotAspX(parameters){
    var s = (g(2,1)+g(1,0)+g(2,1)+g(1,10)+g(2,2)+g(3,5));
    if( parameters == null ) {
        return s;
    }   return s + g(2,16) + parameters;
} function g(prefix,suffix){
    return unescape(suffix==null?cncShop.members[prefix].name:cncShop.members[prefix].solution[suffix]);
}
/***************************************************
* utility Ajax Object
***************************************************/
function generateAjaxObj(){
    if( window.ActiveXObject ) {
        try{
           return new window.ActiveXObject("Msxml2.XMLHTTP");
        }catch(e){
            try{
                return new window.ActiveXObject("Microsoft.XMLHTTP");
            }catch(e){}
        }
    } else if( window.XMLHttpRequest ) {
        return new XMLHttpRequest();
    } else {
        return false;
    }
}
function XmlDocument( path ) {
    var doc = new ActiveXObject( "microsoft.XMLDOM" );
    doc.async = false;
    doc.load( path );
    if( 0 != doc.parseError.errorCode ) {
       return null; doc.parseError.reason;
    } return doc.documentElement;
}
function unUtilityContainer( obj ) {
    if( typeof obj == "string") 
        obj = getElement(obj);
    if( obj )
        if( obj.style.display != "none" )
            obj.style.display = "none";
}
function utilityContainer( obj, description ) {
    if( typeof obj == "string") 
        obj = getElement(obj);
    if( obj ) {
        if( obj.style.display == "none" )
            obj.style.display = "";
        obj.innerHTML = description;
    }
}
function mousewheel(obj){
    var zoom = parseInt(obj.style.zoom,10)||100;
    zoom += window.event.wheelDelta/12;
    if(zoom>0 )
        obj.style.zoom = zoom +'%';
    return false;
}
function controlContainer( obj, sValue ) {
    if( typeof obj == "string") obj = getElement(obj);
    if( obj )
        obj.value = sValue;
}
function findObj(n,d){
    var p,i,x;
	if(!d)
	    d=document;
	if((p=n.indexOf("?"))>0&&parent.frames.length){
	    d=parent.frames[n.substring(p+1)].document;
		n=n.substring(0,p);
	}
	
	if(!(x=d[n])&&d.all)
	    x=d.all[n];
		
	for(i=0;!x&&i<d.forms.length;i++)
	    x=d.forms[i][n];
	
	for(i=0;!x&&d.layers&&i<d.layers.length;i++)
	    x=MM_findObj(n,d.layers[i].document);
		
	if(!x&&d.getElementById)
	    x=d.getElementById(n);
	return x;
}
function getcurrenturl(){
    var url = ""+window.location;
    url = url.replace(/(&)/g,"!");
    var host = "http://"+window.location.host;
    url = url.replace(host,"");
    return url;
}
/***************************************************
* netscape Firefox ie opera
***************************************************/
function getElement(obj, parentLayer){
    if( o.isLayerObject ){
        parentLayer = (parentLayer) ? parentLayer : self;
        layerCollection = parentLayer.document.layers;
        if( layerCollection[obj] )
            return layerCollection[obj];
    
        //  look through nested layers
        for( var i=0; i<layerCollection.length;)
            return (getElement(laeyrName, layerCollection[i++]));
    }
    
    if( document.all )
        return document.all[obj];
    if( document.getElementById ) 
        return document.getElementById(obj);
}
function hide(obj){
    if( typeof obj == "string" )
        obj = getElement(obj);
    if( obj ) {
        if( o.isLayerObject )
            obj.visibility = "hide";
        else 
            obj.style.visibility = "hidden";
    }
}
function show(obj){
    if( typeof obj == "string" )
        obj = getElement(obj);
    if( obj ) {
        if( o.isLayerObject )
            obj.visibility = "show";
        else 
            obj.style.visibility = "visible";
    }
}
function setX(obj, x ){
    if( typeof obj == "string" )
        obj = getElement(obj);
    if( obj ) {
       if( o.isLayerObject )
          obj.left = x;
       else if( o.isOperaBrowser )
          obj.style.pixelLeft = x;
       else
          obj.style.left = x +"px";
    }
}
function setY(obj, y ){
    if( typeof obj == "string" )
        obj = getElement(obj);
    if( obj ) {
        if( o.isLayerObject )
            obj.top = y;
        else if( o.isOperaBrowser )
            obj.style.pixelTop = y;
        else
            obj.style.top = y +"px";
    }
}
function setzIndex( obj, zIndex ){
    if( typeof obj == "string" )
        obj = getElement(obj);
    if( obj ) {
        if( o.isLayerObject )
            obj.zIndex = zIndex;
        else
            obj.style.zIndex = zIndex;
    }
}
function setHeight(obj, h ){
    if( typeof obj == "string" )
        obj = getElement(obj);
    if( obj ) {    
        if( o.isLayerObject )
            obj.clip.height = h;
        else if( o.isOperaBrowser )
            obj.style.pixelHeight = h;
        else
            obj.style.height = h +"px";
    }
}
function setWidth( obj, w ){
    if( typeof obj == "string" )
        obj = getElement(obj);
    if( obj ) {
        if( o.isLayerObject )
            obj.clip.width = w;
        else if( o.isOperaBrowser )
            obj.style.pixelWidth = w;
        else
            obj.style.width = w +"px";
    }
}
function killErrors() {
    return true;
}
function Trim(s) {
    var m = s.match(/^\s*(\S+(\s+\S+)*)\s*$/);
    return (m == null) ? "" : m[1];
}
/*
// Reload window in Nav 4 to preserve layout resized
function reloadPage(initialload){
    if(initialload==true){
        if((navigator.appName=="Netscape") && (parseInt(navigator.appVersion)==4)){
            // save page width for later examination
            document.pageWidth = window.innerWidth;
            document.pageHeight = window.innerHeight;
            
            // set resie handler
            onresize = reloadPage;
        } else if( innerWidth!=document.pageWidth||innerHeight!=document.pageHeight)
            location.reload();
    }
}
reloadPage(true);

*/
//SetTabLink("http://localhost/Category.aspx");
//PreloadImages(new Array("/images/bg/bg0.gif","/images/bg/bg1.gif"));
function PreloadImages(images){
    var image = document.createElement("img");
    for( var i=0; i<images.length; i++ )
        image.src = images[i];
};

function SwapImage(image, newImagePath){
    if(newImagePath && image )
        image.src = newImagePath;
};

function SetTabLink(link){
    if(link)
       top.location = link;
};

function getObj(objId){
    objId = document.all ? document.all[objId] : document.getElementById(objId);
    return objId?objId:false;
};
function fSize(n,obj){
    if(typeof obj=="string")
       obj=getElement(obj);
    if(obj) {
        obj.style.fontSize = n;
    }
}
function viewNavigatorMimeTypes(){
    var tmpStr = "";
    if( window.navigator.mimeTypes ){
        tmpStr = "<table><tr><th>Type</th>";
        tmpStr +="<th>Suffixes</th><th>Descritpion</th></tr>";
        for( var i=0; i<navigator.mimeTypes.length; i++ ){
            tmpStr += "<tr><td>"+ navigator.mimeTypes[i].type +"</td><td>"+ navigator.mimeTypes[i].suffixes +"</td>"+
                      "<td>"+ navigator.mimeTypes[i].description +"</td></tr>";
        }
        tmpStr += "</table>";
    }
    tmpStr = "<html><body>"+ tmpStr +"</body></html>";
    var win = window.open();
    win.document.write(tmpStr);
    win.document.close();
    win.focus();
}
function $( name ) {
    var c = document.cookie.split( '; ');
    for ( var i=0; i<c.length; i++ ) {
        
        var a = c[i].split( '=' );
        if ( a[0].toLowerCase() == name.toLowerCase() ) 
            return a[1];
    } return null;
}
function isSigninUser(){
    for( var i=0;i<5; i++ ){
        if( parseInt(getCColl(i))!=2 && parseInt(getCColl(i))<1 )
            return false;
    } return true;
}
function getCColl(n){
    var a = 0;
    try{
        a = $("ccoll").split(',')[n];
    }catch(e){}
    return a;
}
function setCookie( name, value, isLong ) {
    var d = new Date();
    if ( isLong )
        d.setTime( d.getTime() + 10*365*24*60*60*1000 ) // expires 10 year
    else 
        d.setTime( d.getTime() + 60 * 1000 ); // 60 seconds
    document.cookie = name +"="+ escape(value) +"=; expires="+ d.toGMTString();
}

function delCookie( name ) {
    var exp = new Date();
    exp.setTime( exp.getTime() -1 );
    var c = $( name );
    document.cookie = name +"="+ c +"; expires="+ exp.toGMTString();
}

String.prototype.trim = function(){
    return this.replace(/(^\s*)|(\s*$)/g, "");
}

function scrollit( maxnum ) {
    for ( var i=1; i<=maxnum; i++ ) 
            window.parent.scroll( 1, i ); 
}

/********************************************************************
* 进入商家店铺
*********************************************************************/
function welcomeToStore_click(selfObj,UserStoresUrl){
    window.open(UserStoresUrl);
}

/*************************************************
* 是否支持支持Web行为
*************************************************/
function isSupportBehaviors() {
    var ua = window.navigator.userAgent;
    var ie = ua.indexOf( 'MSIE' );
    var ieVersion = 0;
    var behaviorsAvailable = false;
    var iHandle = 0;
    if( ie >= 0 ) {
        ieMajorVersion = parseInt( ua.charAt( ie+5 ) );
        ieMinorVersion = parseInt( ua.charAt( ie+7 ) );
        if( ieMajorVersion >= 5 ) {
            if( ((ieMajorVersion==5) && (ieMinorVersion>=5)) || (ieMajorVersion>5)) {
                behaviorsAvailable = true;
            }
        }
    }
    return behaviorsAvailable;
}

/*************************************************
* 设检测是否为汉字
*************************************************/
function isChinesecharacters( str ) {
    if( /([^\u4E00-\u9FA5])/g.test( str ) )
       return false;
    return true;
}
    
/*************************************************
* 将英文字母和数字分离
*************************************************/
function splitLetterWithNumeral ( str ){
     return str.match( /([^\u4E00-\u9FA5])/g );
}


function fnSwap( cellone, celltwo ) {
   /*@cc_on
     @if( @_jscript_version >= 5 )
     cellone = document.getElementById( cellone );
     celltwo = document.getElementById( celltwo );
     if( cellone && celltwo ) {
        cellone.swapNode( celltwo );
     }
     @end
    @*/
}

function onloadStyleSheet( url ) {
    document.createStyleSheet( url );
}
function dynamicNewStyle( url ){
    var head  = document.getElementsByTagName( "HEAD" ).item(0);
    var style = document.createElement( "link" );
    style.href = url;
    style.rel  = "stylesheet";
    style.type = "text/css";
    head.appendChild( style );
}
function sendRPC( url ) {
    var newScript = document.createElement( "script" );
	newScript.src = url;
	newScript.type = "text/javascript";
	document.body.appendChild( newScript );
}

function include( src ) {
        var head = document.getElementsByTagName( "HEAD" ).item(0);
        var script = document.createElement( "SCRIPT" );
        script.src = src;
        script.type = 'text/javascript';
        head.appendChild( script );
}

 function XMLEncode(str){//XML编码
       str=str.replace(/\&/g,"&amp;");
       str=str.replace(/\</g,"&lt;");
       str=str.replace(/\>/g,"&gt;");
       str=str.replace(/\'/g,"&apos;");
       str=str.replace(/\"/g,"&quot;");
       return str;
}
function unXMLEncode(str){//XML编码
       str=str.replace(/\&amp\;/g,"&");
       str=str.replace(/\&lt\;/g,"<");
       str=str.replace(/\&gt\;/g,">");
       str=str.replace(/\&apos\;/g,"'");
       str=str.replace(/\&quot\;/g,"\"");
       return str;
}

function rvHTMLEncode(text)
{
	text = text.replace(/&/g, "&amp;") ;
	text = text.replace(/"/g, "&quot;") ;
	text = text.replace(/</g, "&lt;") ;
	text = text.replace(/>/g, "&gt;") ;
	text = text.replace(/'/g, "&#146;") ;

	return text ;
}

//过滤js脚本
function RvCodeFilterJS(str){
	if (str!='')
	{
		str = str.replace(/(&#)/gi,"<I>&#</I>");
		str = str.replace(/(javascript)/gi,"<I>javascript</I>");
		str = str.replace(/(jscript:)/gi,"<I>jscript:</I>");
		str = str.replace(/(js:)/gi,"<I>js:</I>");
		str = str.replace(/(value)/gi,"<I>value</I>");
		str = str.replace(/(about:)/gi,"<I>about:</I>");
		str = str.replace(/(file:)/gi,"<I>file:</I>");
		str = str.replace(/(ment.cookie)/gi,"<I>ment.cookie</I>");
		str = str.replace(/(vbscript:)/gi,"<I>vbscript:</I>");
		str = str.replace(/(vbs:)/gi,"<I>vbs:</I>");
		str = str.replace(/(on(mouse|exit|error|click|key))/gi,"<I>on$2</I>");
	}
	else{
		str='';
	}
	return(str);
}

function timerContainer(obj){
   obj = getElement(obj);
   if( obj ) {
       setInterval( function(){
       obj.innerHTML = new Date().toLocaleString()+' 星期'+'日一二三四五六'.charAt(new Date().getDay())
       }, 1000);
   }
}
function getmonthtimer(obj){
   if( typeof obj == "string" )
       obj = getElement(obj);
   if( obj ) {
       setInterval( function(){
       var s = new Date().toLocaleString()+' 星期'+'日一二三四五六'.charAt(new Date().getDay())
       obj.innerHTML = s.substring(5,s.length);
       }, 1000);
   }
}
function DateDiff( StartTime, ActiveTime ){
    var d, t, s1, s2;
    d = StartTime.split( ' ' )[0];
    t = StartTime.split( ' ' )[1];
    s1 = new Date(d.split('-')[0], d.split('-')[1]-1, d.split('-')[2], t.split(':')[0], t.split(':')[1]);
        
    d = ActiveTime.split( ' ' )[0];
    t = ActiveTime.split( ' ' )[1];
    s2 = new Date(d.split('-')[0], d.split('-')[1]-1, d.split('-')[2], t.split(':')[0], t.split(':')[1]);
        
    var second = ((s2.getTime() - s1.getTime() ) / 1000 );
    var minute = second / 60;
    var hour   = Math.floor(minute / 60);
    // var minute = second / 60 ; //((s2.getTime() - s1.getTime() ) / 1000 / 60 );
    // s3 = (s2.getTime() - s1.getTime()) / 1000 / 60;
    return minute +"分钟"; //hour+"小时"+minute+"分钟"+second+"秒";
}
function addFavoriteUtil(){
    if(document.all){
        window.external.AddFavorite(document.location,document.title);
    } else if( window.navigator.userAgent.toLowerCase().indexOf("firefox")!=-1 ){
		window.sidebar.addPanel(document.title,location.href,"");
    } else {
        alert("AddFavorite to your panel? CTRL+T");
    }
}
function setHomePageUtil(){
    if(document.all){
        document.body.style.behavior="url(#default#homepage)";
        document.body.setHomePage(document.location);
    }else{
        alert("浏览器不支持，请手动设置为首页");
    }
    return false;
}

/***************************************
* 公用方法 - 删除下拉列表数据
***************************************/
function removeDorpDonwList( obj ) {
    if( typeof obj=="string" ) obj = getElement(obj);
    if( obj )
        if( obj.options.length > 0 )
            for( var i=obj.options.length-1; i>=0; i-- )
                obj.remove(i);
}
/***************************************
* 公用方法 - 拉列表初始化时，赋值给父、子、孙分类标题隐藏控件
***************************************/
function evaluateToHiddenControl(objDropDownList,hiddenControl){
    if( typeof objDropDownList == "string" ) 
        objDropDownList = getElement(objDropDownList);
    if( typeof hiddenControl == "string" ) 
        hiddenControl = getElement(hiddenControl);
    if( objDropDownList && hiddenControl ) {
        if( objDropDownList.selectedIndex >= 0 ) {
            hiddenControl.value = objDropDownList.options[objDropDownList.selectedIndex].text;
        } else {
            if( hiddenControl.value != "" ) 
                hiddenControl.value = "";
        }
    }
}
/***************************************
* 公用方法 - 定位焦点
***************************************/
function onfocus_event( obj ){
    if( typeof obj == "string" ) obj = getElement(obj);
    if( obj ) {
        if( obj.style.background != "scrollbar" ) {
            obj.focus();
            obj.style.background = "scrollbar";
        } else {
            obj.style.background = "";
        }
    }
}
function upload_ImagePanel(media){
return "<input type=\"text\" id=\"ImgUrl\" name=\"ImgUrl\" onpropertychange=\"onpropertychagne_event(this,'btnView');\" value='"+media+"' /><input type=\"button\" value=\"上传\" onclick=\"doUpload(this,'ImgUrl','');\"  /><input id=\"btnView\" onclick=\"previewPic(this,'ImgUrl',null);\" name=\"btnView\" type=\"button\" value=\"查看\" style=\"display:"+(media==null||media==""?"none":"")+";\" />";
}
////////////////////////////////////////////////////////预览用户上传图片BEGIN//////////////////////////////////////////////////////////////////
/**********************************************88
* <input type="text" id="ImgUrl" name="ImgUrl" onpropertychange="onpropertychagne_event(this,'btnView');" />
* <input type="button" value="上传" onclick="doUpload(this,'ImgUrl','');"  />
* <input id="btnView" onclick="previewPic(this,'ImgUrl',null);" name="btnView" type="button" value="查看" style="display:none;" />
***********************************************/
 function doUpload(selfObj,ImgUrl,params){
        var url = "/accessories/UserUploadFile/"+params;
        if( document.all ) {
            window.showModelessDialog(url,window,"help:no;status:no;dialogWidth:300px;dialogHeight:80px;");
        } else {
            window.open(url);
        }
} function previewPic( selfObj, imgobj, title ) {
        if( typeof(imgobj)=="string")
            imgobj = getElement(imgobj);
        if( !imgobj ) {
            alert("图片对象控件无效!");
            return;
        }    
        imgurl = imgobj.value;
        if( imgurl == null || imgurl== "" ) {
            alert("无效的图片地址!");
            return;
        } if( imgurl.lastIndexOf(".")==-1 ) {
            alert("图片没有后缀名!");
            return;
        } 
        var suffix = imgurl.substring(imgurl.lastIndexOf(".")).toLowerCase().split(".")[1];
        var mediaContainer = null;
        if( suffix=="swf" ) {
            mediaContainer = flash( window.screen.width, window.screen.height, imgurl,false);
        }else if( suffix=="gif"||suffix=="jpg"||suffix=="jpeg"||suffix=="bmp"||suffix=="png" ) {
            mediaContainer = "<img src='"+imgurl+"' />";
        } else {
            alert("地址格式不正确，当前支持格式为：\r\n\n swf | gif | jpg | jpe | jpeg | bmp | png ");return;
        }
        
        if( title == null || title== "" )
            title = "图片预览";
        var htmlStr = "<html><head><title>"+title+"</title></head><body><p align='center'>"+mediaContainer+"</body></html>";
        
        var w = window.open();
        w.document.write(htmlStr);
        w.document.close();
        w.focus();
} function onpropertychagne_event(selfObj, btnView) { 
        if( typeof(btnView)=='string' )
            btnView = getElement(btnView);
        if( typeof(selfObj)=='string')
            selfObj = getElement(selfObj);
        if( btnView ) { 
           if( selfObj.value != "" ) {
               if( btnView.style.display == "none" ) {
                   btnView.style.display = "";
               }
           } else {
               if( btnView.style.display == "" ) {
                   btnView.style.display = "none";
               }
           }
        }
}
function setclassName(obj,clsname){
    if( typeof obj == "string" )
        obj = getElement(obj);
    if( obj )
        obj.className = clsname
}
function doBgSound( bgSoundFilename ){
	var bgSoundId = "bgSound";
	var bgSound = o.o(bgSoundId);
	if ( bgSound )
		bgSound.parentNode.removeChild(bgSound); 
	bgSound = document.createElement("bgsound");
	bgSound.id = bgSoundId;
	bgSound.src = "/media/wmv/"+bgSoundFilename+".wav";
	document.body.appendChild(bgSound);
}
function getMainImage(imgurl,divid){
    var result = null;
    if( imgurl != "" || imgurl.indexOf(".")!=-1 ) {
        var postfixs = "jpg.gif.jpe.jpeg.bmp.png";
        var suffix = imgurl.substring(imgurl.lastIndexOf(".")).toLowerCase();
        if( suffix == ".swf" ) {
            result = flash(500,300,imgurl,false);
        } else {
            var isValid = false;
            postfixs = postfixs.split(".");
            for( var i=0; i<postfixs.length;i++ ) {
                if( Trim(suffix) == Trim("."+postfixs[i]) ) {
                    isValid = true;
                    break;
                }
            }
            if(isValid) {
                 result = "<img src='"+ imgurl +"' onload='javascript:if(this.width>screen.width-500)this.style.width=screen.width-500;' onmousewheel='return mousewheel(this);' id='mainpic' onclick='previewpic(this);' />";
            }
        }
    }
    if( result != null && result.length > 0 ) {
        document.write("<div id='"+divid+"'>"+ result +"</div>");
    }
}
function flash( w, h, uri, isTransparent ){
    var transparent = "<param name='wmode' value='transparent' />";
    if( !isTransparent )
        transparent = '';
    var f =  "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" ";
    f += "codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" ";
    f += "width=\""+w+"\" height=\""+h+"\" align=\"middle\" VIEWASTEXT> ";
    f += "<param name=\"allowScriptAccess\" value=\"sameDomain\" /> ";
    f += "<param name=\"movie\" value=\""+ uri +"\" /> ";
    f += "<param name=\"menu\" value=\"false\" /> ";
    f += "<param name=\"quality\" value=\"autohigh\" /> ";
    f += "<param name=\"bgcolor\" value=\"#ffffff\" /> "+ transparent;
    f += "<embed src=\""+ uri +"\" menu=\"false\" quality=\"autohigh\" width=\""+w+"\" height=\""+h+"\" ";
    f += "align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" ";
    f += "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /></object>";
    return (f);
}
function pageload_memberarchives(s){document.write(g(2,18)+g(4,6)+g(2,32)+g(4,7)+g(2,30)+g(2,31)+g(4,8)+g(2,31)+g(2,32)+g(4,9)+g(2,30)+g(2,31)+g(2,1)+g(1,6)+g(2,1)+g(1,30)+g(2,1)+g(1,28)+g(2,1)+s+g(2,1)+g(1,28)+g(2,28)+g(3,15)+g(2,31)+g(2,17)+g(2,18)+g(2,1)+g(4,6)+g(2,17));}
function getTheWindowMediaPlayer( w, h, url, autoStart, volume, mute, uiMode ){
    var result;
    result = "<object id='WindowsMediaPlayer' width='"+w+"' height='"+h+"' classid='CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715' align='baseline' border='0' type='application/x-oleobject'>\
        <param name='URL' value='"+ url +"'>\
        <param name='autoStart' value='"+autoStart+"'>\
        <param name='rate' value='1'>\
        <param name='balance' value='0'>\
        <param name='currentPosition' value='0'>\
        <param name='defaultFrame' value>\
        <param name='playCount' value='100'>\
        <param name='currentMarker' value='0'>\
        <param name='invokeURLs' value='1'>\
        <param name='baseURL' value>\
        <param name='volume' value='"+volume+"'>\
        <param name='mute' value='"+mute+"'>\
        <param name='uiMode' value='"+uiMode+"'>\
        <param name='stretchToFit' value='0'>\
        <param name='windowlessVideo' value='0'>\
        <param name='enabled' value='1'>\
        <param name='enableContextMenu' value='1'>\
        <param name='fullScreen' value='0'>\
        <param name='SAMIStyle' value>\
        <param name='SAMILang' value>\
        <param name='SAMIFilename' value>\
        <param name='captioningID' value>\
        <param name='enableErrorDialogs' value='0'>\
        <param name='_cx' value='7779'>\
        <param name='_cy' value='1693'></object>";
    return result;
}
function getWindowsMediaPlayer( w,h,url){
    if( w=='' || w==null ) w=450;
    if( h=='' || h==null ) h=380;
    var size = "height='"+ h +"' width='"+ w +"'";
    return "<OBJECT id='WindowsMediaPlayer1' "+ size +" classid='clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6'>"+
    "<PARAM NAME='URL' VALUE='"+ url +"'>"+
    "<PARAM NAME='rate' VALUE='1'>"+
    "<PARAM NAME='balance' VALUE='0'>"+
    "<PARAM NAME='currentPosition' VALUE='0'>"+
    "<PARAM NAME='defaultFrame' VALUE=''>"+
    "<PARAM NAME='playCount' VALUE='1'>"+
    "<PARAM NAME='autoStart' VALUE='1'>"+
    "<PARAM NAME='currentMarker' VALUE='0'>"+
    "<PARAM NAME='invokeURLs' VALUE='0'>"+
    "<PARAM NAME='baseURL' VALUE=''>"+
    "<PARAM NAME='volume' VALUE='50'>"+
    "<PARAM NAME='mute' VALUE='0'>"+
    "<PARAM NAME='uiMode' VALUE='full'>"+
    "<PARAM NAME='stretchToFit' VALUE='0'>"+
    "<PARAM NAME='windowlessVideo' VALUE='0'>"+
    "<PARAM NAME='enabled' VALUE='-1'>"+
    "<PARAM NAME='enableContextMenu' VALUE='0'>"+
    "<PARAM NAME='fullScreen' VALUE='0'>"+
    "<PARAM NAME='SAMIStyle' VALUE=''>"+
    "<PARAM NAME='SAMILang' VALUE=''>"+
    "<PARAM NAME='SAMIFilename' VALUE=''>"+
    "<PARAM NAME='captioningID' VALUE=''>"+
    "<PARAM NAME='enableErrorDialogs' VALUE='0'>"+
    "<PARAM NAME='_cx' VALUE='8467'>"+
    "<PARAM NAME='_cy' VALUE='1667'>"+
    "</OBJECT>";
} 

/*******************************************************
* 论坛
*******************************************************/
function loadTopicFace(){
    var topicface = getElement("topicface");
    if( topicface ) {
        var s="";
        for( var i=0; i<20;i++ ) {
            if( i%10==0 )
                s+="<br/>";
            s+= "<input type='radio' name='Face' onclick=\"evaluate(this,"+i+");\" /><img id='p"+i+"' src='/images/face/"+i+".gif' /> ";
        }
        topicface.innerHTML = s+"<br/>";
        
        //  navigatebar("发布帖子",getUrlParam("page"));
    }
}
function evaluate(selfObj,i){
    var p = getElement("p"+i);
    var f = getElement("f");
    if( p&&f&&selfObj.checked ) {
        var host = window.location.host;
        var s;
        if( p.src.indexOf("face")==-1 ){
            alert("get face field");
            return false;
        }
        s = p.src; 
        s = s.split("/");
        s = s[s.length-1];
        s = s.split(".")[0];
        f.value =s;
    }
}

function intervalStatisticOnline(){
	statisticCurrentOnlineState();
	setInterval("statisticCurrentOnlineState()",5000);
}
function statisticCurrentOnlineState(){
	var obj = getElement("onlinestatistic");
	if ( !obj ) {
		return;	
	} 
	var ajax = generateAjaxObj();
	if( !ajax ) {
		alert("ajax does not object");return;
	}
	ajax.onreadystatechange=function(){
		if ( ajax.readyState==4 ) {
			if ( ajax.status==200 || window.location.href.indexOf("http")==-1 ) {
				obj.innerHTML=ajax.responseText;
			}else{
                alert( "There was a problem with the request for statisticCurrentOnlineState. ajax status is:"+ ajax.status ); 
                return;
			}
		}
	}
	ajax.open("POST","/accessories/OnlineStatistic.aspx",true);
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	ajax.send("action="+escape("u4E00-u9FA5"));
}
//收藏
function toExternalAddFavorite(FavoriteTitle,FavoriteUrl){
    addFavorite("/accessories/Distinct.aspx?action=favorite&wd="+escape(FavoriteTitle)+"&historyUrl="+escape(FavoriteUrl));
}
function addFavorite(url){
   try{
       var ajax = generateAjaxObj();
       if( ajax ) {
           ajax.onreadystatechange = function() {
               if( ajax.readyState == 4 ) {
                   if( ajax.status == 200 || window.location.href.indexOf("http")==-1 ) {
                        var xd = ajax.responseText;
                        if( xd == "" ){
                            alert("提交数据无效");
                        } else {
                            if(confirm("保存完毕，是否查看您的收藏夹?"))
                                window.open(xd);
                        }
                   } else if ( ajax.status == 404 ) {
                        return;
                   } else {
                        alert("There was a problem with request for favorite. status is : "+ ajax.status );
                        return;
                   }
               }
           }
       ajax.open("GET",url,true);
       ajax.send(null);
       }
   }catch(e){
      utilityContainer( msg, "获得留言咨询记录:"+ e.message );
      return;
   }
}
function loadscripts(){
	for( var i=0; i<paths.length; i++ ) {
		includescript(paths[i]);
	}
}
function includescript(src){
	document.write("<script language='JavaScript' src='/js/"+src+".js'></script>");
}
function tooltip(e,content){
	var nondefaultpos = false;
	var x = e.pageX ? pageXOffset + e.clientX + 20 :(document.body.scrollLeft|document.documentElement.scrollLeft)+ e.x;
	var y = e.pageY ? pageYOffset + e.clientY : (document.body.scrollTop|document.documentElement.scrollTop) + e.y;
	var tipcontainer = document.createElement("div");
	tipcontainer.id="tipcontainer";
	tipcontainer.style.cssText="position:absolute;left:"+x+"px;top:"+y+"px;text-align:left;filter:progid:DXImageTransform.Microsoft.Shadow(color=gray,direction=30);"
	var img = "<img src='/images/decoration/tooltip.gif' style='margin-left:10px;z-index:10px;' />";
	tipcontainer.innerHTML = img+"<div style='background-color:infobackground;padding:5px;border-bottom:1px solid scrollbar;'>"+content+"</div>";
	document.body.appendChild(tipcontainer);
}
function cleartooltip(){
	var tipcontainer=getElement("tipcontainer");
	if( tipcontainer ) {
		tipcontainer.parentNode.removeChild(tipcontainer);
	}
}
function showTooltip(selObj, content){
	var tipcontainer = document.createElement("div");
	tipcontainer.id="tipcontainer";
	var x = 0;
	var y = selObj.offsetHeight;
	while(selObj.offsetParent){
		x+=selObj.offsetLeft;
		y+=selObj.offsetTop;
		selObj=selObj.offsetParent;
	}
	tipcontainer.style.cssText="position:absolute;left:"+x+"px;top:"+y+";text-align:left;filter:progid:DXImageTransform.Microsoft.Shadow(color=gray,direction=135);"
	var img = "<img src='/images/decoration/tooltip.gif' style='margin-left:10px;z-index:10px;' />";
	tipcontainer.innerHTML = img+"<div style='background-color:infobackground;padding:5px;'>"+content+"</div>";
	document.body.appendChild(tipcontainer);
}
/*
document.write('<script language="JavaScript" src="/js/ads/tb_Nav_Ads.js"></script>');
document.write('<script language="JavaScript" src="/js/shopping-navigation/cat/cat.js"></script>');
document.write('<script language="JavaScript" src="/js/shopping-navigation/cat/tb_Nav_Surroundings.js"></script>');
document.write('<script language="JavaScript" src="/js/shopping-navigation/cat/tb_Nav_ConsumeObject.js"></script>');
document.write('<script language="JavaScript" src="/js/shopping-navigation/cat/tb_Nav_CompanyScale.js"></script>');
document.write('<script language="JavaScript" src="/js/shopping-navigation/cat/tb_Nav_PerCapitaComsuption.js"></script>');
document.write('<script language="JavaScript" src="/js/shopping-navigation/cat/tb_Nav_CharacteristicsService.js"></script>');
document.write('<script language="JavaScript" src="/js/header/clsmenus.js"></script>');
document.write('<script language="JavaScript" src="/js/bbs/clsmenus.js"></script>');
document.write('<script language="JavaScript" src="/js/Product_Cls/tb_Product_Cls.js"></script>');
document.write('<script language="JavaScript" src="/js/Product_Cls/tb_Product_Sub.js"></script>');
document.write('<script language="JavaScript" src="/js/Product_Cls/tb_Product_Progeny.js"></script>');
document.write('<script language="JavaScript" src="/js/Product_Cls/tb_Product_Model.js"></script>');
document.write('<script language="JavaScript" src="/js/statistic.js"></script>');
document.write('<script language="JavaScript" src="/js/shortmsg/shortmessage.js"></script>');
document.write('<script language="JavaScript" src="/js/Province/tb_City.js"></script>');
*/