// JavaScript Document// Example:
var d=document;
var w=window;
var QueryVariable=d.location.search;
var is_opera_d  = (navigator.userAgent.toLowerCase().indexOf('opera') != -1);
/*
读取 cookies
readCookie(string cookieName)
return string cookies value or null value
*/
function readCookie(name)
{var cookieValue = "";var search = name + "=";
var cookies=decodeURIComponent(d.cookie)
  if(cookies.length > 0)
  { 
    offset = cookies.indexOf(search);
    if (offset != -1)
    { 
      offset += search.length;
      end = cookies.indexOf("&", offset);
      if (end == -1) end = cookies.length;
	  try{
      cookieValue = decodeURIComponent(cookies.substring(offset, end));
	  }catch(e){
		  cookieValue = unescape(cookies.substring(offset, end));
		  }
    }
  }
  return cookieValue;
}
/*
get query's value from QueryVariable
return string or null value
*/

function getQueryVariable(w) {
  var query = QueryVariable.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == w) {
      return pair[1];
    }
  } 
  return "";
}

function $$(s)
{
	return d.frames?d.frames[s]:$(s).contentWindow;
}
function $c(s)
{
	return d.createElement(s);
}
function exist(s)
{
	return $(s)!=null;
}
function dw(s)
{
	d.write(s);
}
function isNull(_sVal)
{
	return (_sVal == "" || _sVal == null || _sVal == "undefined");
}
function removeNode(s)
{
	if(exist(s))
	{
		$(s).innerHTML = '';
		$(s).removeNode?$(s).removeNode():$(s).parentNode.removeChild($(s));
	}
}

/**
* 去除左空格
*/
function lTrim(str)
{
	var whitespace = new String(" \t\n\r");
	var s = new String(str);
	if (whitespace.indexOf(s.charAt(0)) != -1)
	{
		var j=0, i = s.length;
		while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
		{
			j++;
		}
		s = s.substring(j, i);
	}
	return s;
}

/*
* 去除右空格
*/
function rTrim(str)
{
	var whitespace = new String(" \t\n\r");
	var s = new String(str);
	if (whitespace.indexOf(s.charAt(s.length-1)) != -1)
	{
		var i = s.length - 1;
		while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
		{
			i--;
		}
		s = s.substring(0, i+1);
	}
	return s;
}

/**
*去除两端空格
*/
function trim(str)
{return rTrim(lTrim(str));}
String.trim = function(){return this.replace(/(^[ |　]*)|([ |　]*$)/g, "");}

function fucCheckNUM(NUM)
{
 var i,j,strTemp,x
 strTemp="0123456789.";
 if (NUM.length== 0){
	//alert("没有填写完整")
  return false;}
 for (i=0;i<NUM.length;i++)
 {
  j=strTemp.indexOf(NUM.charAt(i)); 
  if (j==-1)
  {return false;}
 }
return true;
}


function resizeImage(obj, MaxW, MaxH)
{var imageObject;
    if (obj != null) imageObject = obj;
    var state=imageObject.readyState;
	//alert(state)
	if(state!='complete') {
        setTimeout("ResizeImage("+obj+","+MaxW+","+MaxH+")",150);
		return;
    }
    var oldImage = new Image();
    oldImage.src = imageObject.src;
    var dW=oldImage.width; var dH=oldImage.height;
    if(dW>MaxW || dH>MaxH) {
        a=dW/MaxW; b=dH/MaxH;
        if(b>a) a=b;
        dW=dW/a; dH=dH/a;
    }
    if(dW > 0 && dH > 0) {
        imageObject.width=dW;
		imageObject.height=dH;
	}
}

/**
* 把字符串转换为utf8
*/
function utf8(wide)
{
	var c,s;
	var enc='';
	var i=0;
	while(i<wide.length)
	{
		c=wide.charCodeAt(i++);
		if(c>=0xDC00&&c<0xE000)	continue;
		
		if(c>=0xD800&&c<0xDC00)
		{
			if(i>=wide.length)continue;
			s=wide.charCodeAt(i++);
			if(s<0xDC00||c>=0xDE00)continue;
			c=((c-0xD800)<<10)+(s-0xDC00)+0x10000;
		}
		
		if(c<0x80) enc+=String.fromCharCode(c);
		else if(c<0x800)enc+=String.fromCharCode(0xC0+(c>>6),0x80+(c&0x3F));
		else if(c<0x10000)enc+=String.fromCharCode(0xE0+(c>>12),0x80+(c>>6&0x3F),0x80+(c&0x3F));
		else enc+=String.fromCharCode(0xF0+(c>>18),0x80+(c>>12&0x3F),0x80+(c>>6&0x3F),0x80+(c&0x3F));
	}
	
	return enc;	
}

////////////////////////////////////////////////////////
////////////////////////////////////////////////////////
function Cookies()
{
    this.name;
    this.path="/";
    expires=new Date();
    expires.setTime(expires.getTime()+(86400*365));
    this.expires = expires.toGMTString();
}
Cookies.prototype.SetCookie=function (name,value)
{
    document.cookie=name+"="+value+"; expires="+this.expires+"; path="+this.path+"";
}
Cookies.prototype.getCookie=function (Name)
{
   var search = Name + "=";
   if (document.cookie.length > 0)
   { // if there are any cookies
      offset = document.cookie.indexOf(search) 
      if (offset != -1)
      { // if cookie exists 
         offset += search.length ;
         end = document.cookie.indexOf(";", offset) 
         if (end == -1) 
            end = document.cookie.length;        
         return (unescape(document.cookie.substring(offset, end)));
      } 
   }
   return 0;
}
///

//未完等等[20070825]
Cookies.prototype.getCookieDic=function(vparent,vchildren)
{
    var strchildren =  this.getCookie(vparent);
	//d.title=strchildren
	if (strchildren=="") return "";
    strchildren = strchildren.getQuery(vchildren);
    return (strchildren);////20070827 完成
}
String.prototype.getQuery = function(name)
{
	//d.title=this;
　　var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
　　var r = this.substr(this.indexOf("\?")+1).match(reg);
　　if (r!=null) return unescape(r[2]); return null;
}


function dialog()
{
	var titile = '';
	var auto = 'y';
	var width = 240;
	var height = 120;
	var src = "";
	var path = "\/images\/dialog\/";
	var sFunc = '<input id="dialogOk" type="button" value=" 确 定 " onclick="new dialog().reset();" /> <input id="dialogCancel" type="button" value=" 取 消 " onclick="new dialog().reset();" />';
	var sClose = '<input type="image" id="dialogBoxClose" onclick="new dialog().reset();" src="' + path + 'close_blue.gif" border="0" width="16" height="16" align="absmiddle" />';
	var sBody = '\
		<table id="dialogBodyBox" border="0" align="center" cellpadding="0" cellspacing="6" width="100%">\
			<tr height="10"><td colspan="4"></td></tr>\
			<tr><td colspan="4" align="center">\
			<div id="dialogMsgDiv" style="text-align:center"><div id="dialogMsg" style="font-size:12px;line-height:180%;"></div></div>\
			</td></tr>\
			<tr><td id="dialogFunc" colspan="4" align="center">' + sFunc + '</td></tr>\
			<tr height="5"><td colspan="4" align="center"></td></tr>\
		</table>\
	';
	var sIfram = '\
		<iframe id="dialogIframBG" name="dialogIframBG" frameborder="0" marginheight="0" marginwidth="0" hspace="0" vspace="0" scrolling="no" style="position:absolute;z-index:8;display:none;"></iframe>\
	';

	var sBox = '\
		<div id="dialogBox" style="border:1px solid #999999;display:none;z-index:10;width:'+width+'px;">\
		<table width="100%" border="0" cellpadding="0" cellspacing="0">\
			<tr height="24" bgcolor="#6795B4">\
				<td>\
					<table onselectstart="return false;" width="100%" border="0" cellpadding="0" cellspacing="0" style="background-color:#333333;  height:25px; border-top:1px solid #222222;-moz-user-select:none;">\
						<tr>\
							<td width="6" height="24"></td>\
							<td id="dialogBoxTitle" onmousedown="new dialog().moveStart(event, \'dialogBox\')" style="color:#fff;cursor:move;font-size:12px;font-weight:bold;">&nbsp;</td>\
							<td id="dialogClose" width="20" align="right" valign="middle">\
								' + sClose + '\
							</td>\
							<td width="6"></td>\
						</tr>\
					</table>\
				</td>\
			</tr>\
			<tr id="dialogHeight" style="height:' + height + '" valign="top">\
				<td id="dialogBody" bgcolor="#ffffff">' + sBody + '</td>\
			</tr>\
		</table></div>\
		<div id="dialogBoxShadow" style="display:none;z-index:9;"></div>\
	';
	var sBG = '\
		<div id="dialogBoxBG" style="position:absolute;top:0px;left:0px;width:100%;height:100%;filter:alpha(Opacity=50);-moz-opacity:0.5;background-color:#cccccc;"></div>\
	';

	this.show = function()
	{
		this.middle('dialogBox');
		if ($('dialogIframBG'))
		{
			$('dialogIframBG').style.top = $('dialogBox').style.top;
			$('dialogIframBG').style.left = $('dialogBox').style.left;
			$('dialogIframBG').style.width = $('dialogBox').offsetWidth;
			$('dialogIframBG').style.height = $('dialogBox').offsetHeight;
			$('dialogIframBG').style.display = 'block';
		}		
		this.shadow();
	}

	this.reset = function()
	{
		this.close();
	}

	this.close = function()
	{
		if ($('dialogIframBG'))
		{
			$('dialogIframBG').style.display = 'none';
		}
		$('dialogBox').style.display='none';
		$('dialogBoxBG').style.display='none';
		$('dialogBoxShadow').style.display = "none";
		$('dialogBody').innerHTML = sBody;
	}
	this.html = function(_sHtml)
	{
		$("dialogBody").innerHTML = _sHtml;
		this.show();
	}

	this.init = function(big_msg)
	{
		$('dialogCase') ? $('dialogCase').parentNode.removeChild($('dialogCase')) : function(){};
		var oDiv = document.createElement('span');
		oDiv.id = "dialogCase";
		if ('yes' == big_msg)
		{
			oDiv.innerHTML = sBG + sBox;
		}
		else
		{
			if (!is_opera_d)
			{
				oDiv.innerHTML = sBG + sIfram + sBox;
			}
			else
			{
				oDiv.innerHTML = sBG + sBox;
			}
		}
		document.body.appendChild(oDiv);
		$('dialogBoxBG').style.height = document.body.scrollHeight+"px";
	}

	this.button = function(_sId, _sFuc)
	{
		if($(_sId))
		{
			$(_sId).style.display = '';
			if($(_sId).addEventListener)
			{
				if($(_sId).act)
				{
					$(_sId).removeEventListener('click', function(){eval($(_sId).act)}, false);
				}
				$(_sId).act = _sFuc;
				$(_sId).addEventListener('click', function(){eval(_sFuc)}, false);
			}
			else
			{
				if($(_sId).act)
				{
					$(_sId).detachEvent('onclick', function(){eval($(_sId).act)});
				}
				$(_sId).act = _sFuc;
				$(_sId).attachEvent('onclick', function(){eval(_sFuc)});
			}
		}
	}

	this.shadow = function()
	{
		var oShadow = $('dialogBoxShadow');
		var oDialog = $('dialogBox');
		oShadow['style']['position'] = "absolute";
		oShadow['style']['background']	= "#000";
		oShadow['style']['display']	= "";
		oShadow['style']['opacity']	= "0.2";
		oShadow['style']['filter'] = "alpha(opacity=20)";
		oShadow['style']['top'] = oDialog.offsetTop + 6;
		oShadow['style']['left'] = oDialog.offsetLeft + 6;
		oShadow['style']['width'] = oDialog.offsetWidth;
		oShadow['style']['height'] = oDialog.offsetHeight;
	}

	this.open = function(_sUrl, _sMode)
	{
		this.show();
		if(!_sMode || _sMode == "no" || _sMode == "yes"){
			var openIframe = "<iframe width='100%' height='100%' name='iframe_parent' id='iframe_parent' src='" + _sUrl + "' frameborder='0' scrolling='" + _sMode + "'></iframe>";
			$("dialogBody").innerHTML = openIframe;
		}
		$("iframe_parent").style.height=$("iframe_parent").parentNode.offsetHeight+"px"//修正100%高度无法使用的问题
	}

	this.showWindow = function(_sUrl, _iWidth, _iHeight, _sMode)
	{
		var oWindow;
		var sLeft = (screen.width) ? (screen.width - _iWidth)/2 : 0;
		var iTop = -80 + (screen.height - _iHeight)/2;
		iTop = iTop > 0 ? iTop : (screen.height - _iHeight)/2;
		var sTop = (screen.height) ? iTop : 0;
		if(window.showModalDialog && _sMode == "m"){
			oWindow = window.showModalDialog(_sUrl,"","dialogWidth:" + _iWidth + "px;dialogheight:" + _iHeight + "px");
		} else {
			oWindow = window.open(_sUrl, '', 'height=' + _iHeight + ', width=' + _iWidth + ', top=' + sTop + ', left=' + sLeft + ', toolbar=no, menubar=no, scrollbars=' + _sMode + ', resizable=no,location=no, status=no');
			this.reset();
		}
	}

	this.event = function(_sMsg, _sOk, _sCancel, _sClose)
	{
		$('dialogFunc').innerHTML = sFunc;
		$('dialogClose').innerHTML = sClose;
		$('dialogBodyBox') == null ? $('dialogBody').innerHTML = sBody : function(){};
		if (width > 400 && height > 300)
		{
			$('dialogMsg') ? $('dialogMsg').innerHTML = _sMsg  : function(){};
			$('dialogMsg') ? $('dialogMsg')['style']['fontWeight'] = "bold" : function(){};
			$('dialogMsg') ? $('dialogMsg')['style']['fontSize'] = "15px" : function(){};
			$('dialogMsg') ? $('dialogMsg')['style']['color'] = "#ff9900" : function(){};
			$('dialogMsg') ? $('dialogMsg')['style']['height'] = "150px" : function(){};
		}
		else
		{
			$('dialogMsg') ? $('dialogMsg').innerHTML = _sMsg  : function(){};
		}

		_sOk && _sOk != "" ? this.button('dialogOk', _sOk) : $('dialogOk').style.display = 'none';
		_sCancel && _sCancel != "" ? this.button('dialogCancel', _sCancel) : $('dialogCancel').style.display = 'none';
		_sClose ? this.button('dialogBoxClose', _sClose) : function(){};

		this.show();
	}
	this.set = function(_oAttr, _sVal)
	{
		var oShadow = $('dialogBoxShadow');
		var oDialog = $('dialogBox');
		var oHeight = $('dialogHeight');

		if(_sVal != '')
		{
			switch(_oAttr)
			{
				case 'title':
					$('dialogBoxTitle').innerHTML = _sVal;
					title = _sVal;
					break;
				case 'width':
					oDialog['style']['width'] = _sVal+"px";
					width = _sVal;
					break;
				case 'height':
					oHeight['style']['height'] = _sVal+"px";
					height = _sVal;
					break;
				case 'src':
					$('dialogMsgDiv').innerHTML = '\
						<table border="0" align="center" cellpadding="0" cellspacing="0" width="100%">\
							<tr>\
								<td width="30%" align="center"><img id="dialogBoxFace" src="' + path + 'login_wrong.gif" /></td>\
								<td id="dialogMsg" style="font-size:12px;line-height:180%;" width="70%"></td>\
							</tr>\
						</table>\
					';
					$('dialogBoxFace') ? $('dialogBoxFace').src = path + _sVal + '.gif' : function(){};
					src = _sVal;
					break;
				case 'auto':
					auto = _sVal;
			}
		}
		this.middle('dialogBox');

		oShadow['style']['top'] = (oDialog.offsetTop + 6)+"px";
		oShadow['style']['left'] = (oDialog.offsetLeft + 6)+"px";
		oShadow['style']['width'] = oDialog.offsetWidth+"px";
		oShadow['style']['height'] = oDialog.offsetHeight+"px";
	}

	this.moveStart = function (event, _sId)
	{
		var oObj = $(_sId);
		oObj.onmousemove = mousemove;
		oObj.onmouseup = mouseup;
		oObj.setCapture ? oObj.setCapture() : function(){};
		oEvent = window.event ? window.event : event;
		var dragData = {x : oEvent.clientX, y : oEvent.clientY};
		var backData = {x : parseInt(oObj.style.top), y : parseInt(oObj.style.left)};
		function mousemove()
		{
			var oEvent = window.event ? window.event : event;
			var iLeft = oEvent.clientX - dragData["x"] + parseInt(oObj.style.left);
			var iTop = oEvent.clientY - dragData["y"] + parseInt(oObj.style.top);
			oObj.style.left = iLeft;
			oObj.style.top = iTop;
			$('dialogBoxShadow').style.left = (iLeft + 6)+"px";
			$('dialogBoxShadow').style.top = (iTop + 6)+"px";
			if ($('dialogIframBG'))
			{
				$('dialogIframBG').style.left = iLeft+"px";
				$('dialogIframBG').style.top = iTop+"px";
			}
			dragData = {x: oEvent.clientX, y: oEvent.clientY};

		}
		function mouseup()
		{
			var oEvent = window.event ? window.event : event;
			oObj.onmousemove = null;
			oObj.onmouseup = null;
			if(oEvent.clientX < 1 || oEvent.clientY < 1 || oEvent.clientX > document.body.clientWidth || oEvent.clientY > document.body.clientHeight){
				oObj.style.left = backData.y;
				oObj.style.top = backData.x;
				$('dialogBoxShadow').style.left = (backData.y + 6)+"px";
				$('dialogBoxShadow').style.top = (backData.x + 6)+"px";
				if ($('dialogIframBG'))
				{
					$('dialogIframBG').style.left = backData.y+"px";
					$('dialogIframBG').style.top = backData.x+"px";
				}
			}
			oObj.releaseCapture ? oObj.releaseCapture() : function(){};
		}
	}

	this.hideModule = function(_sType, _sDisplay)
	{
		var aIframe = parent.document.getElementsByTagName("iframe");
		var aType = document.getElementsByTagName(_sType);
		var iChildObj, iChildLen;
		for (var i = 0; i < aType.length; i++)
		{
			aType[i].style.display	= _sDisplay;
		}
		for (var j = 0; j < aIframe.length; j++)
		{
			iChildObj = document.frames ? document.frames[j] : aIframe[j].contentWindow;
			try
			{
				iChildLen = iChildObj.document.body.getElementsByTagName(_sType).length;
				for (var k = 0; k < iChildLen; k++)
				{
					iChildObj.document.body.getElementsByTagName(_sType)[k].style.display = _sDisplay;
				}
			}
			catch (e){}
		}
	}

	this.middle = function(_sId)
	{
		try
		{
			var aIframe = parent.document.getElementById("iframe_parent");
		}
		catch (e){}
		if (aIframe) {
			var sClientWidth = aIframe.offsetWidth;
			var sClientHeight = aIframe.offsetHeight;
			var sScrollTop = 0;
		} else {
			var sClientWidth = parent ? parent.document.documentElement.clientWidth : document.documentElement.clientWidth;
			var sClientHeight = parent ? parent.document.documentElement.clientHeight : document.documentElement.clientHeight;
			var sScrollTop = parent ? parent.document.documentElement.scrollTop : documentElement.scrollTop;
			//alert(sClientHeight)
		}
		var sleft = (document.documentElement.clientWidth / 2) - ($(_sId).offsetWidth / 2);
		var iTop = -80 + (sClientHeight / 2 + sScrollTop) - ($(_sId).offsetHeight / 2);
		var sTop = iTop > 0 ? iTop : (sClientHeight / 2 + sScrollTop) - ($(_sId).offsetHeight / 2);
		$(_sId)['style']['display'] = '';
		$(_sId)['style']['position'] = "absolute";
		$(_sId)['style']['left'] = sleft+"px";
		$(_sId)['style']['top'] = sTop+"px";
	}
}


function _error_msg_show(msg, click, icon, title)
{
    click = click ? click : ' ';
    icon = icon ? icon : '';
    title = title ? title : '小二提示';
    dg=new dialog();
    dg.init();
    dg.set('src', get_icon(icon));
    dg.set('title', title);
    dg.event(msg, click, '', click);
}


function errgoback(msg,title)
{
    title = title ? title : '发生错误';
    dg=new dialog();
    dg.init();
    dg.set('src', get_icon("login_wrong.gif"));
    dg.set('title', title);
    dg.event(msg, "alert(123)", '', "history.go(-1)");
	$("dialogOk").value="返回";
}

//this.event = function(_sMsg, _sOk, _sCancel, _sClose)

function _confirm_msg_show(msg, click_ok, click_no, title, width, height)
{
    click_ok = click_ok ? click_ok : ' ';
    click_no = click_no ? click_no : ' ';
    title = title ? title : '小二提醒';

    dg=new dialog();
    dg.init();
    dg.set('src', get_icon('login_wrong.gif'));
    dg.set('title', title);
	if (width)
    {
        dg.set('width', width);
    }
    if (height)
    {
        dg.set('height', height);
    }
    dg.event(msg, click_ok, click_no, click_no);
	$("dialogOk").value="继续提交";
	$("dialogCancel").value="我要修改";
}

function get_icon(icons)
{
	var icon = 'login_wrong';
	return icon;
}
function openWindow(_sUrl, _sWidth, _sHeight, _sTitle, _sScroll, ok)
{
	if (ok == null && document.readyState != "complete")
	{
		setTimeout(function(){openWindow( _sUrl, _sWidth, _sHeight, _sTitle, _sScroll, 1);},500);
		return false;
	}
	var oEdit = new dialog();
	oEdit.init('yes');
	oEdit.set('title', _sTitle ? _sTitle : "系统提示信息" );
	oEdit.set('width', _sWidth);
	oEdit.set('height', _sHeight);
	oEdit.set('auto', 'n');
	oEdit.open(_sUrl, _sScroll != "yes" ? 'no' : 'yes');
}


////////////////////////////////////////
////////////////////////////////////////
//邮件订阅
function dyEmail(eName){
	var email=trim($(eName).value);
	if (!checkmail(email)) {alert("邮件地址不正确");return;}
	$.Ajax.get("/member/user_append2EmailList.asp?email="+email,
			   function(x){
				   if(x.responseText=='ok'){
				   alert("您的邮件已订阅成功！");
				   $("index_email").value="";
				   }
				   }
				  ,
				  function(x){(alert(x.responseText))}
			   )
	}
	
function checkmail(email)
{
    var pattern=/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9-])+/;
    return pattern.test(email);
}

if (document.all){ 
 window.attachEvent("onload",changA)//对于IE 
} 
else{ 
 window.addEventListener("load",changA,false);//对于FireFox 
} 


function changA(){
	var as=document.getElementsByTagName("a");
	//alert(as.length);
	for(var i=0;i<as.length;i++){
		funx(as[i]);
		}
}


function funx(a){
 var pattern=/(home|clothes)\/([a-zA-Z0-9]){2,}\.html$/;
 if(!isNull(a.getAttribute("target"))) return;//已有	target属性了,退出			 
 var href=a.href;
 if (isNull(href)) return;//是个锚点,退出	
 if(pattern.test(href)){a.target="_blank";}
}



 function callServer(Tasp,Tname,Tpara,tdiv)
 {	 	
	var u_name = $V(Tname);
  	if ((u_name == null) || (u_name == "")) return;
 	var param = "action="+Tpara+"&senduser="+escape(u_name)+"&randnum=" + Math.random()
	$.Ajax.update(Tasp+"?"+param,tdiv)
	//callServer('webdata.asp','username','checkuser','test1');
 }


function addEvent(e, _sFuc,act)
	{
		if(e)
		{
			if(e.addEventListener)
			{
				if(e.act)
					e.removeEventListener(act, function(){eval(e.act)}, false);
				e.act = _sFuc;
				e.addEventListener(act, function(){eval(_sFuc)}, false);
			}
		else
			{
				if(e.act)
				{
					e.detachEvent('on'+act, function(){eval(e.act)});
				}
				e.act = _sFuc;
				e.attachEvent('on' + act, function(){eval(_sFuc)});
			}
		}
	}

var defaultA;//存放节点
function createListen(e,i)
{
var defaultStyle=""//
var categoryId=e.categoryid;
if ($("floatDiV_" + categoryId).innerHTML.length<10) return;
e=e.parentNode;

var over=function(abc){
	var obj=e;
	  var top=0;   
	  var   left=0;   
	  var   width=obj.offsetWidth;   
	  var   height=obj.offsetHeight;   
		  while   (obj.offsetParent)   {
				  top   +=   obj.offsetTop;   
				  left   +=   obj.offsetLeft;   
				  obj   =   obj.offsetParent;   
				  }
		top-=88;
		defaultStyle="top:"+top+"px;left:"+(left+145)+"px; display:block";
	  $("apDiv1").setStyle(defaultStyle);
	  $("apDiv1").innerHTML=$("floatDiV_" + categoryId).innerHTML;
	  classArr.each(function(n,i){$(n).removeClassName("q")});
	  defaultA=e.childNodes[0];
	  $(defaultA).addClassName("q");
	}

var out=function(){
	var v1=$("productClassMenu");
		if(w.event){
			var e=w.event.toElement;
		}else{
			var e=this;
			}
		try{
		if($(e).parentIndex(v1)==-1){$("apDiv1").style.display="none"; $(defaultA).removeClassName("q");}
		}catch(mm){}
}
	if (document.all){ 
	 e.attachEvent("onmouseover",over);
	 $("productClassMenu").attachEvent("onmouseout",out);
	} 
	else{ 
	 e.addEventListener("mouseover",over,false);
	 $("productClassMenu").addEventListener("mouseout",out,false);
	} 
}
/*更新购物车内物品的数量*/
function refreshCar()
{
	//$.Ajax.update("\/shopcar\/addProduct\.asp\?action=count","topcar");
	var ccc=$.Ajax.Request("\/shopcar\/addProduct\.asp","GET","action=count",function(x){
					try{
					$("topcar").innerHTML=x.responseText;
					}catch(xxx){}
					
			})
	
	
}

function gdscroll(gap)
{
	var gdscroll = $('gdscroll');
	gdscroll.scrollTop += gap;
}

/*添加对最近浏览的支持*/
if (document.all)
	 w.attachEvent("onload",showLastview);
	else 
	 w.addEventListener("load",showLastview,false);

var __xxx;
function showLastview(){
	var aid
	var url=d.location.href;
	var pattern=/(home|clothes)\/([a-zA-Z0-9]){2,}\.html$/;
	try{aid=id}catch(e){aid=0}
 	if(!pattern.test(url)){aid=0};
	if(self.document.documentElement.clientWidth<800) return;
	var oDiv=document.createElement("DIV");
	oDiv.id="lastview"
	document.body.appendChild(oDiv);
	var ccc=$.Ajax.Request("\/member\/lastview\.asp","GET","id="+aid,function(x){
					try{
					$("lastview").innerHTML=x.responseText;
					w.setTimeout(isviewsomePro,400);
					__xxx=w.setInterval(MoveLayer,800);
					}catch(xxx){}
					
			})
		
	}

function showkf(){
	var div=$("kfdiv");
	if (isNull(div)) return;
	div.setStyle("right:6px;display:block;position:absolute")
	w.setInterval(function(){
						   	var y = 80;
							y += d.documentElement.scrollTop;
							$("kfdiv").style.top = y+'px';
							//$("tracqfloater").setStyle("right:6px; left:");
						   },800);

	}


function MoveLayer() {
var y = 110;
y += d.documentElement.scrollTop;
$("lastview").style.top = y+'px';
}

function isviewsomePro(){
	try{
		try{
		if($("gdscroll").innerHTML.length<10){clearInterval(__xxx);removeNode($("lastview"));return;}
		}catch(rrr){}
		
		$($("gdscroll").lastChild.firstChild).setStyle("margin-bottom:0px");
		}catch(e){}
	}

function addEvent(el,evname,func)
{
    if(el.attachEvent)
    {
        el.attachEvent("on"+evname,func);
    }
    else if(el.addEventListener)
    {
        el.addEventListener(evname,func,true);
    }
    else
    {
        el["on"+evname]=func;
    }
}
function removeEvent(el,evname,func)
{
    if(el.detachEvent)
    {
        el.detachEvent("on"+evname,func);
    }
    else if(el.removeEventListener)
    {
        el.removeEventListener(evname,func,true);
    }
    else
    {
        el["on"+evname]=null;
    }
}

//---------------------------------------------------加入购物车
function add2car(id){
var Property="";
var arr=$("#cpxx_right li[order=1]");
var selectObject;
for(var i=0; i<arr.length;i++){
	if(arr[i].innerHTML.toLowerCase().indexOf("<select>")>-1)
	{
		var nodeCount=$.Browse.isIE()?arr[i].childNodes.length-1:arr[i].childNodes.length;
		for(var n=0;i<nodeCount;n++){
				if(arr[i].childNodes[n].tagName.toLowerCase()=="select"){
					Property+=(document.all?arr[i].childNodes[0].innerText:arr[i].childNodes[0].textContent)+arr[i].childNodes[n].options[arr[i].childNodes[n].selectedIndex].text+'\r\n';break;
				}
		}
	}
	else
	{Property+=(document.all?arr[i].innerText:arr[i].textContent)+'\r\n'}
}
if(Property=='') Property='空'

//$.Ajax.Request(url,method,parameters,onComplete,onError)

var ccc=$.Ajax.Request("\/shopcar\/addProduct\.asp","GET","action=add&id="+id+"&Property="+escape(Property),function(x){
					var rt=x.responseText;
					if (isNaN(rt)){
						alert(rt);return;//直接输出错误信息
					}
					$("#carshop_box #hvat strong")[0].innerHTML=rt;
					$("carshop_box").style.display="block";
					refreshCar();
	}
	,function(x){
	alert(x.responseText)
	})
}


if (!(document.all)){ //firefox innerText define 
	HTMLElement.prototype.__defineGetter__("innerText",function(){return this.textContent; }); 
	HTMLElement.prototype.__defineSetter__("innerText",function(sText){this.textContent=sText; }); 
} 

//添加非ie添加两个属性 outerHTML canHaveChildren currentStyle
if(typeof(HTMLElement)!="undefined" && !window.opera && !document.all){
HTMLElement.prototype.__defineGetter__("outerHTML",function()
  {
    var a=this.attributes, str="<"+this.tagName, i=0;for(;i<a.length;i++)
    if(a[i].specified) str+=" "+a[i].name+'="'+a[i].value+'"';
    if(!this.canHaveChildren) return str+" />";
    return str+">"+this.innerHTML+"</"+this.tagName+">";
  }); 

   HTMLElement.prototype.__defineGetter__("canHaveChildren",function()
  {
    switch(this.tagName.toLowerCase())
    {
      case "area": case "base":  case "basefont":
      case "col":  case "frame": case "hr":
      case "img":  case "br":    case "input":
      case "link": case "meta":  case "isindex":
      case "param":return false;
    } return true;
  });
   		
HTMLElement.prototype.__defineGetter__("currentStyle", function(){return this.ownerDocument.defaultView.getComputedStyle(this,null);})
}

//添加insertAdjacentHTML,insertAdjacentText
if(typeof(HTMLElement)!="undefined" && !window.opera && !document.all){
HTMLElement.prototype.insertAdjacentHTML=function(where, html)
{
   var e=this.ownerDocument.createRange();
   e.setStartBefore(this);
   e=e.createContextualFragment(html);
   switch (where)
   {
     case 'beforeBegin': this.parentNode.insertBefore(e, this);break;
     case 'afterBegin': this.insertBefore(e, this.firstChild); break;
     case 'beforeEnd': this.appendChild(e); break;
     case 'afterEnd':
       if(!this.nextSibling) this.parentNode.appendChild(e);
       else this.parentNode.insertBefore(e, this.nextSibling); break;
   }
}; 

HTMLElement.prototype.insertAdjacentText=function(where,txtStr){
        var parsedText=document.createTextNode(txtStr);
        this.insertAdjacentElement(where,parsedText);
        }

} 

//模拟DotNet的string.format 
String.prototype.format=function()
{
  if(arguments.length==0) return this;
  for(var s=this, i=0; i<arguments.length; i++)
    s=s.replace(new RegExp("\\{"+i+"\\}","g"), arguments[i]);
  return s;
}; 

function QQtalk(sigkey) {
    var tempSrc='http://sighttp.qq.com/wpa.js?rantime='+Math.random()+'&sigkey='+sigkey;
    var oldscript=document.getElementById('testJs');
    var newscript=document.createElement('script');
    newscript.setAttribute('type','text/javascript');
    newscript.setAttribute('id', 'testJs');
    newscript.setAttribute('src',tempSrc);
    if(oldscript == null) {
        document.body.appendChild(newscript);
    }
    else {
        oldscript.parentNode.replaceChild(newscript, oldscript);
    }
    return false;
}
