isXHTML = document.compatMode=="CSS1Compat" ? true : false;
isIE = !!document.all;

Array.prototype.Add = function(arr)
{
	for(var i=0,j=arr.length;i<j;i++)
	{
		this.push(arr[i]);
	}
}
function isArray(o)
{ 
	return Object.prototype.toString.call(o) === '[object Array]';
}
function $(arg)
{
	if(typeof(arg).toLowerCase() == "object")
	{
		return arg;
	}
	return document.getElementById(arg);
}
function echo(arg)
{
	document.write(arg);
}
function csName(obj,na)
{
	if(!obj)
	{
		return;
	}
	var t = na.substr(0,1);
	var na = na.substr(1);
	var on = obj.className;
	on = on.replace(na,"");
	if(t == "+")
	{
		on = on + " " + na;
	}
	on = on.replace(/ +/g," ").replace(/^ | $/g,"");
	obj.className = on;
	return on;
}
function getNodes(pNode)
{
	if(pNode.nodeType == 3)
	{
		return null;
	}
	var node,nodes = new Array();
	for(var i=0;node= pNode.childNodes[i];i++)
	{
		if(node.nodeType == 1)
		nodes.push(node);
	}
	return nodes;
}
function setCookie(c_name,value,expiredays)
{
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate);
}
function getCookie(c_name)
{
	if (document.cookie.length>0)
	{
		c_start=document.cookie.indexOf(c_name + "=");
		if (c_start!=-1)
		{
			c_start=c_start + c_name.length+1;
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1)
			{
				c_end=document.cookie.length;
			}
			return unescape(document.cookie.substring(c_start,c_end));
		} 
	}
	return "";
}




//private
function getRef()
{
	if(document.referrer != "" && document.referrer != null && document.referrer != undefined)
	{
		var refHost = document.referrer.replace(/^(.+?\/\/)([^\/\\]+)(.*)/gi,"$2");
		var refUrl = RegExp.$1 + RegExp.$2 + RegExp.$3;
		if(!/7lk\.cn/i.test(refHost))
		{
			var oldRef = getCookie("ref");
			oldRef = oldRef.replace(/^([^\n]+\n[^\n]+\n)[\s\S]*/i,"$1");
			refUrl = (new Date().getTime() + "|" + refUrl + "\n" + oldRef).replace(/\n\n/g,"\n").replace(/(.+\n)\1/gi,"$1").replace(/\n$/g,"");
			setCookie("ref",refUrl,365);
			return refUrl;
		}
	}
	return getCookie("ref");
}
function showNav(nav,txt,cid)
{
	var isId = false;
	if(cid != undefined && cid != "{field:cid}" && cid != "")
	{
		isId =true;
	}
	var ns = getNodes($(nav));
	var oldi=-1;
	for(var i=0,j=ns.length;i<j;i++)
	{
		if(isId)
		{
				if(/cid([0-9]+)/.test(ns[i].className))
				{
					if(RegExp.$1 == cid)
					{
						oldi = i;
					}
				}
		}
		if(/cur/.test(ns[i].className))
		{
			oldi = i;
		}
	}
	var _tt;
	for(var i=0,j=ns.length;i<j;i++)
	{
		_tt = (ns[i].innerText || ns[i].textContent).replace(/^ +| +$/g,"");
		if(txt.indexOf(_tt) != -1 || txt == _tt)
		{
			oldi = i;
		}
		csName(ns[i],"-cur");
	}
	csName(ns[oldi],"+cur");
}
function selectPro(si)
{
	$("pros").options[si-1].selected = true;
}
function HoverList(obj,bhref)
{
	obj=$(obj);
	if(bhref == undefined)
	{
		bhref = true;
	}
	var ls = getNodes(obj);
	var _hover= function(os,hi)
	{
		return function()
		{
			for(var i=0,j=os.length;i<j;i++)
			{
				if(i==hi)
				{
					csName(os[i],"+cur");
				}
				else
				{
					csName(os[i],"-cur");
				}
			}
			return bhref;
		}
	}
	var _a;
	for(var i=0,j=ls.length;i<j;i++)
	{
		_a = ls[i].getElementsByTagName("a")[0];
		_a.onmouseover = _hover(ls,i);
		_a.onclick =  _hover(ls,i);
	}
}

function submitOrder(fr)
{
	if($("realName").value == "")
	{
		$("realName").focus();
		alert("请填写真实姓名");
		return false;
	}
	if($("mobi").value == "")
	{
		$("mobi").focus();
		alert("请填写手机号码");
		return false;
	}
	if($("addr").value == "")
	{
		$("addr").focus();
		alert("请填写收货地址");
		return false;
	}	
	$("ref").value = getRef();
	$("gurl").value=("http://"+window.location.href.replace(/[\?#].*/gi,"")).replace("http://http://","http://");
	$("specCode").value= getCookie("speccode");
	document.charset = "gb2312";
	return true;
}
function loadSwf(div,swf,params)
{
	if(params == undefined)
	{
		params = new Object();
	}
	if(params.width==undefined)
	{
		params.width="100%";
	}
	if(params.height==undefined)
	{
		params.height="100%";
	}
	params.movie = swf;
	var str = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+params.width+'" height="'+params.height+'">';
	for(key in params)
	{
		if(params[key] == null) continue;
		str += '<param name="'+key+'" value="'+params[key]+'">';
	}
	str += '<embed src="'+params['movie']+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"';
	for(key in params)
	{
		if(params[key] == null) continue;
		if(!/^(FlashVars|wmode|scale|quality|bgcolor|width|height|align|allowScriptAccess)$/i.test(key)) continue;
		str += ' '+key+'="'+params[key]+'"';
	}
	str += ' />';
	str += '</object>';
	$(div).innerHTML = str;
}
var FFextraHeight = 0;
 if(window.navigator.userAgent.indexOf("Firefox")>=1)
 {
  FFextraHeight = 16;
  }
 function reSetCWinHeight(iframe)
 {
   if(iframe && !window.opera)
   {
     iframe.style.display = "block";
      if(iframe.contentDocument && iframe.contentDocument.body.offsetHeight)
      {
        iframe.height = iframe.contentDocument.body.offsetHeight + FFextraHeight;
      }
      else if (iframe.Document && iframe.Document.body.scrollHeight)
      {
        iframe.height = iframe.Document.body.scrollHeight;
      }
   }
 }

function scrollBox(arg)
{
	var _self = this;
	this.stopTime = 0;
	this.speed = 1;
	this.time = 10;
	this.stop = false;
	this.box = $(arg);
	this.box.style.overflow = "hidden";
	this.dir = "left";
	this.nowStep = 0;
	this.tarStep = 0;
	this.oneLeng = 0;
	this.maxShowLeng = 0;
	this.init = function()
	{
		var tmpNodes = this.box.innerHTML;
		if(this.dir == "left" || this.dir == "right")
		{
			var _tns = getNodes(this.box);
			this.oneLeng = parseInt(_tns[0].offsetWidth);
			this.tarStep = this.oneLeng * _tns.length;
			this.box.innerHTML = "";
			var longBox = document.createElement("ul");
			this.box.appendChild(longBox);
			longBox.innerHTML = tmpNodes + tmpNodes;
			longBox.style.width = (this.tarStep+10+parseInt(this.box.offsetWidth)) + "px";
			longBox.style.height = this.box.offsetHeight + "px";
			longBox.style.position = "static";
			longBox.style.margin = "0";
			longBox.style.padding = "0";
			this.maxShowLeng = this.box.offsetWidth;
		}
		else
		{
			var _tns = getNodes(this.box);
			this.oneLeng = parseInt(_tns[0].offsetHeight);
			this.tarStep = this.oneLeng* _tns.length;
			this.box.innerHTML = this.box.innerHTML + this.box.innerHTML;
			this.maxShowLeng = this.box.offsetHeight;
		}
		var _stop = false;
		var _stopTime = 0;
		if(this.dir == "left")
		{
			setInterval(function()
			{
				if(!_self.stop)
				{
					if(!_stop)
					{
						if(_self.nowStep >= _self.tarStep)
						{
							_self.nowStep = 0;
						}
						else
						{
							_self.nowStep = _self.nowStep + _self.speed;
						}
						_self.box.scrollLeft = _self.nowStep;
						//计长度
						if(_self.nowStep % _self.maxShowLeng == 0)
						{
							_stop = true;
						}
					}
					else
					{
						//计时;
						_stopTime += _self.time;
						if(_stopTime >= _self.stopTime)
						{
							_stopTime = 0;
							_stop = false;
						}
					}
				}
			},this.time);
		}
		else
		{
 			setInterval(function()
			{
				if(!_self.stop)
				{
					if(!_stop)
					{
						if(_self.nowStep >= _self.tarStep)
						{
							_self.nowStep = 0;
						}
						else
						{
							_self.nowStep = _self.nowStep + _self.speed;
						}
						_self.box.scrollTop = _self.nowStep;
						//计长度
						if(_self.nowStep % _self.maxShowLeng == 0)
						{
							_stop = true;
						}
					}
					else
					{
						//计时;
						_stopTime += _self.time;
						if(_stopTime >= _self.stopTime)
						{
							_stopTime = 0;
							_stop = false;
						}
					}
				}
			},this.time);
		}
		this.box.onmouseover = function()
		{
			_self.stop = true;
		}
		this.box.onmouseout = function()
		{
			_self.stop = false;
		}
	}
}

var IsInstallQQ = false;
try
{
	var xmlhttp=new ActiveXObject("TimwpDll.TimwpCheck");    
	IsInstallQQ = true;            
}catch(e){}
function return_cbQQ(id,obj)
{
	if(IsInstallQQ)
	{
		obj.target="_self";
		obj.href = 'tencent://message/?uin='+ id + '&Site=&Menu=yes&crm=1';
		return false;
	}
	window.open('http://b3.qq.com/webc.htm?new=0&sid='+id+'&o=&q=7', '_blank', 'height=544, width=644,toolbar=no,scrollbars=no,menubar=no,status=no','_blank');
	return false;
}













