//ProtoType
String.prototype.trim = function()
	{
		return this.replace(/(^\s*)|(\s*$)/g,"");
	}

String.prototype.is=function(n)
	{
		switch (n) {
			case 0:		//是否大于等于0的正整数
				var re=/^[0-9.]+$/ig,c=0;
				if(this.match(re)==null){return false;}
				c=parseInt(this);
				if(c!=this || c<0){return false;}else{return true;}
			break;

			case 1:		//是否是WEB图像文件（扩展名为：jpeg、jpg、gif、png、bmp）
				var re=/\.(jpeg|jpg|gif|png|bmp)$/ig;
				return this.match(re)==null ? false : true;
			break;

			case 2:		//是否是大于0的数字
				var re=/^\+?([0-9]+\.)?[0-9]+$/ig;
				if(this.match(re)==null){return false;}
				var a=parseFloat(this);
				if(isNaN(a)){return false;}
				if(a<=0){return false;}
				return true;
			break;

			case 3:		//是否是大于等于0的数字
				var re=/^\+?([0-9]+\.)?[0-9]+$/ig;
				if(this.match(re)==null){return false;}
				var a=parseFloat(this);
				if(isNaN(a)){return false;}
				if(a<0){return false;}
				return true;
			break;
			case 5:		//是否是电子邮件地址
				var re=/^[^\s@]+@[^\s@]{4,}$/ig;
				if(this.match(re)==null){return false;}
				return true;
			break;
		}
		return null;
	}

String.prototype.test=function(dataArray,runCode)		//判断某格式化字符串中是否包含c
	{
		switch (runCode) {
		case 0:				//String为由某个字符隔开的字符串，比如“a'b'c”，判断某字符串是否在String中，调用方式：a.test(Array(c,'"'),0)，此时返回true或false
			var c=dataArray[0],g=encodeURIComponent(dataArray[1]),d=encodeURIComponent(this);

			c=encodeURIComponent(c);

			var objReg=new RegExp('(^|'+g+')'+c+'('+g+'|$)','i');

			return objReg.test(d);
			break;
		}
		return null;
	}

String.prototype.fm=function(runCode,dataArray)	//按某种方式格式化字符串
	{
		switch (runCode) {
			case 0:			//runCode=0，调用方法：itClientName.value.fm(Array('b',3),0)，比如：将“a”格式化为“bba”
				var c=dataArray[0],n=dataArray[1],a=this;
				if(c.length==0){return a;}
				while(a.length<n){
					a=c+a;
				}
				return a;
				break;
			case 1:			//返回以K计的文件尺寸；
				if(this.is(0)==false){return this;}
				return Math.round(parseInt(this)/1000);
			break;
			case 2:			//如果String是文件名，则返回扩展名，如果没有，则返回''；
				var re=/\.([\s\S]*?)$/i;
				var cArray=this.match(re);
				if(cArray){return cArray[1];}else{return '';}
			break;
			case 3:			//将类似１２的字符更换为12；
				var c=this;
				var arr=new Array('１','２','３','４','５','６','７','８','９','０');
				var arr1=new Array('1','2','3','4','5','6','7','8','9','0');
				for (var i=0; i<arr.length; i++) {
					c=c.replace(arr[i],arr1[i]);
				}
				return c;
			break;
		}
		return null;
	}

if(window.Node)		//设置Node
	{
		Node.prototype.innerText=function()
			{
				if(Node.hasChildNodes()==false){return null;}
				var a=Node.childNodes,c='';
				for (var i=0; i<a.length; i++) {
					if(a.nodeType==3){c+=a.nodeValue;alert(a.nodeValue);}
				}
				return c;
			}
		Node.prototype.swapNode=function(Node){	// 交换节点
			var nextSibling=this.nextSibling;
			var parentNode=this.parentNode;
			Node.parentNode.replaceChild(this,Node);
			parentNode.insertBefore(Node,nextSibling);
		}
		//点击
		Node.prototype.click=function ()
			{
				var evt = document.createEvent("MouseEvents");
				evt.initMouseEvent("click", true, true, window,0, 0, 0, 0, 0, false, false, false, false, 0, null);
				this.dispatchEvent(evt);
			}
	}

//=========================
//====== 定义Dom开始 ======
//=========================

//====== 定义Dom扩展属性 ======
function aLeft(d)
	{
		var a=d,b=0;
		while (a) {
			if(a.offsetLeft){
				b=b+a.offsetLeft;
			}
			a=a.offsetParent;
		}
		return b;
	}
function aRight(a)
	{
		return aLeft(a)+a.offsetWidth;
	}
function aTop(d)
	{
		var a=d,b=0;
		while (a) {
			if(a.offsetTop){
				b=b+a.offsetTop;
			}
			a=a.offsetParent;
		}
		return b;
	}
function aBottom(a)
	{
		return aTop(a)+a.offsetHeight;
	}
function getStyle(a,styleName)	//获得currentStyle的内容
	{
		if(document.all){
			return a.currentStyle.getAttribute(styleName,0);
		}
		else {
			var re=/([A-Z]+)/g;
			var c=styleName;
			if(c.match(re)!=null){
				c=c.replace(re,'-$1');
				c=c.toLowerCase();
			}
			return window.getComputedStyle(a,'').getPropertyValue(c);
		}
	}
function htEditorGetZIndex(b)	//获得b对象的子对象中最大的z-index
	{
		var zIndex=0,curIndex=0,cnNode=null;
		for (var i=0; i<b.childNodes.length; i++) {
			cnNode=b.childNodes[i];
			if(cnNode.nodeType==1){
				curIndex=fs(0,$(cnNode).getStyle('zIndex'));
				zIndex=curIndex>zIndex ? curIndex : zIndex;
			}
		}
		return zIndex;
	}
function childrenByTagName(a,tagName)	//返回a对象第一级子对象中tagName的数组
	{
		var arr=new Array(),b;
		if(a.hasChildNodes()==false){return arr;}
		for (var i=0; i<a.childNodes.length; i++) {
			b=a.childNodes[i];
			if(b.nodeType==1){
				if(b.tagName.toLowerCase()==tagName){arr.push($(b));}
			}
		}
		return arr;
	}
//返回某对象所包含的文本内容
function inText(a)
	{
		if(document.all){return a.innerText;}
		else{
			var c=a.innerHTML;
			var re=/<[0-9a-z]+[\s\S]*?>/ig;
			c=c.replace(re,'');
			var re=/<\/[0-9a-z]+>/ig;
			c=c.replace(re,'');
			return c;
		}
	}
//向某对象插入新的文本，这会替换该对象所有子对象，包括原有文本
function setText(a,c)
	{
		while(a.hasChildNodes()){
			a.removeChild(a.firstChild);
		}
		var oText=document.createTextNode(c);
		a.appendChild(oText);
	}
//返回某对象的左右边框宽度＋左右padding宽度＋左右margin宽度
function propertyWidth(a)
	{
		var n=fs(0,a.getStyle('borderLeftWidth'));
		n=n+fs(0,a.getStyle('borderRightWidth'));
		n=n+fs(0,a.getStyle('paddingLeft'));
		n=n+fs(0,a.getStyle('paddingRight'));
		n=n+fs(0,a.getStyle('marginLeft'));
		n=n+fs(0,a.getStyle('marginRight'));
		return n;
	}
//返回某对象的上下边框宽度＋上下padding宽度＋上下margin宽度
function propertyHeight(a)
	{
		var n=fs(0,a.getStyle('borderTopWidth'));
		n=n+fs(0,a.getStyle('borderBottomWidth'));
		n=n+fs(0,a.getStyle('paddingTop'));
		n=n+fs(0,a.getStyle('paddingBottom'));
		n=n+fs(0,a.getStyle('marginTop'));
		n=n+fs(0,a.getStyle('marginBottom'));
		return n;
	}
//返回某对象的父对象的className为特定值的对象
function parentClassName(d,cName)
	{
		var a=d,strName;
		while (a) {
			a=a.parentNode;
			if(a){
				strName=document.all ? a.className :a.getAttribute('class',0);
				if(strName==cName){return a;}
			}
		}
		return null;
	}
//返回某对象的父对象中，tagName为特定值的最近的父对象，没有则返回null
function parentByTagName(a,tagName)
	{
		var c=tagName.toLowerCase();
		var d=a;
		while (d) {
			d=d.parentNode;
			if(d.tagName.toLowerCase()==c){
				return d;
			}
		}
		return null;
	}

//返回某对象的tagName为特定值，className为特定值的对象数组
function childClassName(a,tagName,cName)
	{
		var arr=new Array();
		var oElements=a.getElementsByTagName(tagName);
		if(oElements){
			for (var i=0; i<oElements.length; i++) {
				var strName=document.all ? oElements[i].className : oElements[i].getAttribute('class',0);
				if(strName==cName){arr.push(oElements[i]);}
			}
		}
		return arr;
	}
//返回某对象的tagName为特定值，className为特定值的对象数组中的第一个对象
function childClassNameFirst(a,tagName,cName)
	{
		var arr=childClassName(a,tagName,cName);
		if(arr.length>0){return arr[0]}else{return null;}
	}

//调用方式：a.childBy(tagName,type,name)，返回某对象的子对象中，tagName、type、name（区分大小写）为指定值的第一个子对象，如果没有，则返回null
function childBy(a)
	{
		var tagName=arguments.length>=2 ? arguments[1].toLowerCase() : null;
		var type=arguments.length>=3 ? arguments[2].toLowerCase() : null;
		var name=arguments.length>=4 ? arguments[3] : null;
		var b=null;
		var bln=false;
		if(a.hasChildNodes()){
			for (var i=0; i<a.childNodes.length; i++) {
				b=a.childNodes[i];
				if(b.nodeType==1){
					bln=true;
					//测试tagName
					if(tagName!=null){
						if(b.tagName){
							if(b.tagName.toLowerCase()!=tagName){
								bln=false
							}
						}
						else{
							bln=false;
						}
					}
					//测试type
					if(bln && type!=null){
						var c=b.getAttribute('type',0);
						if(c!=null){
							if(c.toLowerCase()!=type){bln=false;}
						}
						else {
							bln=false;
						}
					}
					//测试name
					if(bln && name!=null){
						var c=b.getAttribute('name',0);
						if(c!=null){
							if(c!=name){bln=false;}
						}
						else {
							bln=false;
						}
					}
					//根据以上测试结果决定是否返回对象
					if(bln){return b;}
				}
			}
		}
		return null;
	}
//调用方式：a.childNodeBy(nodeName)，返回某对象的子对象中，nodeName为指定值的第一个子对象，如果没有，则返回null
function childNodeBy(a)
	{
		var nodeName=arguments.length>=2 ? arguments[1].toLowerCase() : null;
		//var type=arguments.length>=3 ? arguments[2].toLowerCase() : null;
		//var name=arguments.length>=4 ? arguments[3] : null;
		var b=null;
		var bln=false;
		if(a.hasChildNodes()){
			for (var i=0; i<a.childNodes.length; i++) {
				b=a.childNodes[i];
				if(b.nodeType==1){
					bln=true;
					//测试tagName
					if(tagName!=null){
						if(b.tagName){
							if(b.tagName.toLowerCase()!=tagName){
								bln=false
							}
						}
						else{
							bln=false;
						}
					}
					//测试type
					if(bln && type!=null){
						var c=b.getAttribute('type',0);
						if(c!=null){
							if(c.toLowerCase()!=type){bln=false;}
						}
						else {
							bln=false;
						}
					}
					//测试name
					if(bln && name!=null){
						var c=b.getAttribute('name',0);
						if(c!=null){
							if(c!=name){bln=false;}
						}
						else {
							bln=false;
						}
					}
					//根据以上测试结果决定是否返回对象
					if(bln){return b;}
				}
			}
		}
		return null;
	}

//====== 定义Dom扩展方法 ======
function setStyle(a,styleName,styleValue)
	{
		if(document.all){a.runtimeStyle.setAttribute(styleName,styleValue,0);}
		else{
			var re=/^([a-z]+)([A-Z]+)([a-z]+)$/;
			var c=styleName;
			if(c.match(re)!=null){
				c=c.replace(re,'$1-$2$3');
				c=c.toLowerCase();
			}
			a.style.setProperty(c,styleValue,null);
		}
	}
function hide(a)
	{
		setStyle(a,'display','none');
	}
//移除某对象所有子对象
function removeAllChildren(a)
	{
		while (a.hasChildNodes()) {
			a.removeChild(a.firstChild);
		}
	}
//移除某对象指定tagName的子对象，包括子对象中的子对象
function removeChildrenByTagName(a,tagName)
	{
		if(a.hasChildNodes()){
			var arr=new Array();
			for (var i=0; i<a.childNodes.length; i++) {
				arr.push(a.childNodes[i]);
			}
			for (var i=0; i<arr.length; i++) {
				var oElement=arr[i];
				if(oElement.nodeType==1){
					if(oElement.tagName.toLowerCase()==tagName){
						a.removeChild(oElement);
					}
					else{
						removeChildrenByTagName(oElement,tagName);
					}
				}
			}
		}
	}
//等比例缩放图像，宽度缩放到targetWidth，其中rate=图片原始的height/width
function resize(a,targetWidth,rate)
	{
		a.setAttribute('width',targetWidth);
		a.setAttribute('height',rate*fs(0,a.width));
	}
//激发click事件
function performClick(a)
	{
		if(document.all){
			a.fireEvent('onclick');
		}
		else{
			var evt=document.createEvent('MouseEvents');
			evt.initMouseEvent('click', true, true, window,0, 0, 0, 0, 0, false, false, false, false, 0, null);
			a.dispatchEvent(evt);
		}
	}

//去除对象的前后空格
function trim(a)
	{
		//如果对象是input type=text
		if(a.tagName.toLowerCase()=='input'){
			if(a.type.toLowerCase()=='text' || a.type.toLowerCase()=='hidden'){
				a.value=a.value.trim();
			}
		}
		//如果对象是textarea
		if(a.tagName.toLowerCase()=='textarea'){
			a.value=a.value.trim();
		}
		//如果对象是form
		if(a.tagName.toLowerCase()=='form'){
			for (var i=0; i<a.elements.length; i++) {
				var b=a.elements[i];
				if(b.tagName.toLowerCase()=='input'){
					if(b.type.toLowerCase()=='text' || b.type.toLowerCase()=='hidden'){
						b.value=b.value.trim();
					}
				}
				if(b.tagName.toLowerCase()=='textarea'){
					b.value=b.value.trim();
				}
			}
		}
	}

//移动对象，调用方式类似：a.move('left',3);，向左移动对象3像素，无论对象是否可以移动
function move(a,strDirection,numSpace)
	{
		a=$(a);
		var num=0;
		var numPosition=0;
		switch (strDirection) {
			case 'left':
				//numPosition=parseInt(a.currentStyle ? a.currentStyle.left : a.style.left);
				numPosition=parseInt(a.getStyle('left'));
				num=numPosition-numSpace;
				a.setStyle('left',num+'px');
			break;
			case 'right':
				//numPosition=parseInt(a.currentStyle ? a.currentStyle.left : a.style.left);
				numPosition=parseInt(a.getStyle('left'));
				num=numPosition+numSpace;
				a.setStyle('left',num+'px');
			break;
			case 'top':
				//numPosition=parseInt(a.currentStyle ? a.currentStyle.top : a.style.left);
				numPosition=parseInt(a.getStyle('top'));
				num=numPosition-numSpace;
				a.setStyle('top',num+'px');
			break;
			case 'bottom':
				//numPosition=parseInt(a.currentStyle ? a.currentStyle.top : a.style.left);
				numPosition=parseInt(a.getStyle('top'));
				num=numPosition+numSpace;
				a.setStyle('top',num+'px');
			break;
		}
	}

//====== 定义Dom扩展属性对象组 ======
var __G=
	{
		'aLeft':aLeft,
		'aRight':aRight,
		'aTop':aTop,
		'aBottom':aBottom,
		'propertyWidth':propertyWidth,
		'propertyHeight':propertyHeight,
		'setStyle':setStyle,
		'getStyle':getStyle,
		'hide':hide,
		'childMaxZIndex':htEditorGetZIndex,
		'childrenByTagName':childrenByTagName,
		'inText':inText,
		'setText':setText,
		'removeAllChildren':removeAllChildren,
		'resize':resize,
		'performClick':performClick,
		'parentClassName':parentClassName,
		'parentByTagName':parentByTagName,
		'childClassName':childClassName,
		'childClassNameFirst':childClassNameFirst,
		'trim':trim,
		'removeChildrenByTagName':removeChildrenByTagName,
		'childBy':childBy,
		'childNodeBy':childNodeBy,
		'move':move
	}
var $=function() {
	if(arguments.length==1){
		var a=arguments[0];
		var el=typeof(a)=='string' ? document.getElementById(a) : a;
		if(el && !el._extendedByMyScriptName){
			for(var i in __G){
				var _tmpFn=function(_fn,_o){//delegate function
					return function(){
						if(typeof(_fn)=="function"){return _fn.apply(null,[_o].concat(Array.prototype.slice.call(arguments)))}else{return null;}
					}
				};
				el[i]=_tmpFn(__G[i],el);
			}
			//this statement is use to stop from too much recursion
			el._extendedByMyScriptName=true;
		}
		return el;
	}
	if(arguments.length==2){
		var dataArray=arguments[0],runCode=arguments[1];
		switch (runCode) {

			case 0:		//调用方式：$(Array(a,'span',elementArray),0)，最后将elementArray设置为a对象所有tagName为span的子对象集合；
				var a=dataArray[0],tagName=dataArray[1],elementArray=dataArray[2];
				var b=a;
				if(b){
					if(b.nodeType==1){
						if(b.tagName.toLowerCase()==tagName){elementArray.push(b);}
					}
					if(b.hasChildNodes()){
						for (var i=0; i<b.childNodes.length; i++) {
							$(Array(b.childNodes[i],tagName,elementArray),0);
						}
					}
				}
			break;

			case 1:		//调用方式：$(Array(a,'span'),1)，返回a对象中第一个tagName为span的子对象；
				var a=dataArray[0],tName=dataArray[1],oSpan;
				if(a.hasChildNodes()){
					for (var i=0; i<a.childNodes.length; i++) {
						if(a.childNodes[i].nodeType==1){
							if(a.childNodes[i].tagName.toLowerCase()==tName){
								return a.childNodes[i];
							}
						}
						oSpan=$(Array(a.childNodes[i],tName,oSpan),1);
						if(oSpan){return oSpan;}
					}
				}
			break;

			case 2:		//调用方式：$(Array(a,'left'),2)返回对象a相对原点的绝对距离；
				var a=dataArray[0],direction=dataArray[1],b=0;
				while (a) {
					if(a.nodeType==1){
						b=b+(direction=='left' ? a.offsetLeft : a.offsetTop);
					}
					a=a.offsetParent;
				}
				return b;
			break;

			case 3:		//调用方式：$('checkBoxName',3)，返回当前文档中，name为checkBoxName的对象集合数组；
				var cArray=new Array();
				var a=document.getElementsByTagName('input'),c=arguments[0];
				if(a==null){return cArray;}
				for (var i=0; i<a.length; i++) {
					if(a[i].type.toLowerCase()=='checkbox'){
						if(a[i].name==c){
							cArray.push(a[i]);
						}
					}
				}
				return cArray;
			break;

			case 5:		//调用方式：$(Array(a,'tr'),5)，返回某对象父对象tagName为tr的对象
				var a=dataArray[0],strTg=dataArray[1];
				var b=a.parentNode;
				while (b) {
					if(b.tagName){
						if(b.tagName.toLowerCase()==strTg){return b;}
					}
					b=b.parentNode;
				}
			break;

			case 6:		//调用方式：$(a,6)，返回某对象的privousSibling（其nodeType为1）
				var a=arguments[0];
				var b=a.previousSibling;
				while (b) {
					if(b.nodeType==1){return b;}
					b=b.previousSibling;
				}
			break;

			case 7:		//调用方式：$(a,7)，返回某对象的nextSibling（其nodeType为1）
				var a=arguments[0];
				var b=a.nextSibling;
				while (b) {
					if(b.nodeType==1){return b;}
					b=b.nextSibling;
				}
			break;

			case 8:		//调用方式：$(a,8)，返回对象a的innerText，但不包括对象a的子对象的innerText
				var a=arguments[0],b,c='';
				if(a.hasChildNodes()){
					for (var i=0; i<a.childNodes.length; i++) {
						b=a.childNodes[i];
						if(b.nodeType==3){c=c+b.nodeValue;}
					}
				}
				return c;
			break;

			case 9:		//调用方式：$(c,9)，返回c的文件后缀，如果c是个文件名的话，否则返回空字符串
				var re=/\.([^.\/]+)(\?|$)/ig;
				var arr=re.exec(arguments[0]);
				if(arr){return arr[1];}
			break;

			case 10:	//调用方式：$('',10)，返回当前文件绝对路径，返回类似：/client/default.asp
				return self.location.pathname.toLowerCase();
			break;

			case 11:	//调用方式：$(a,11)，返回a对象的第一个nodeType＝1的子对象
				var a=arguments[0];
				if(a.hasChildNodes()){
					a=a.childNodes;
					for (var i=0; i<a.length; i++) {
						if(a[i].nodeType==1){return a[i];}
					}
				}
			break;

			case 12:	//调用方式：$('',12)，在某文档中的radio中返回checked对象；
				var a=b.getElementsByTagName('input');
				if(a){
					for (var i=0; i<a.length; i++) {
						if(a[i].type.toLowerCase()=='radio'){
							if(a[i].checked){return a[i];}
						}
					}
				}
			break;

			case 13:	//调用方式：$('',13)，在某文档中的checkbox中返回checked了并且命名了的checkbox对象；
				var a=b.getElementsByTagName('input');
				var cArray=new Array();
				if(a){
					for (var i=0; i<a.length; i++) {
						if(a[i].type.toLowerCase()=='checkbox'){
							if(a[i].checked && a[i].name==arguments[2]){cArray.length++;cArray[cArray.length-1]=a[i];}
						}
					}
					return cArray;
				}
			break;

			case 14:	//调用方式：$(Array(a,b),14)，在同一级对象中，将a、和b之间的对象remove；
				var a=arguments[0][0],b=arguments[0][1],d;
				a=a.nextSibling;
				while (a!=b) {
					d=a.nextSibling;
					a.parentNode.removeChild(a);
					if(d){a=d}else{break;}
				}
			break;

			case 15:	//调用示例：$(a,15)，返回a对象的nodeType为1的子对象集合
				var a=arguments[0],aArray=new Array(),b;
				if(a.hasChildNodes()){
					b=a.childNodes;
					for (var i=0; i<b.length; i++) {
						if(b[i].nodeType==1){aArray.push(b[i]);}
					}
				}
				return aArray;
			break;

			case 16:	//调用示例：$(Array('span','spanItem'),16)，返回当前页面tagName为span，className为spanItem的对象数组
				var tagName=arguments[0][0],className=arguments[0][1],aArray=new Array(),re;
				var cl=document.getElementsByTagName(tagName);
				for (var i=0; i<cl.length; i++) {
					c=cl[i].className;
					if(c==className){aArray.push(cl[i]);}
				}
				return aArray;
			break;

			case 17:	//调用示例：$(Array(a,'dlContent'),17)，返回a对象第一级子对象中className＝dlContent的第一个对象
				var a=arguments[0][0],cName=arguments[0][1];
				if(a.hasChildNodes()==false){return null;}
				a=a.childNodes;
				for (var i=0; i<a.length; i++) {
					if(a[i].nodeType==1){if(a[i].className.toLowerCase()==cName){return a[i];}}
				}
			break;

			case 18:	//调用方式：$(a,18)，返回a对象最深的frame子对象；
				var a=arguments[0];
				while(a.frames.length>0){
					a=a.frames[0];
				}
				return a;
			break;


		}
	}
	return null;
}

//=========================
//====== 定义Dom结束 ======
//=========================

//==========================
//====== 定义常用对象 ======
//==========================
function oReturnBody()
	{
		var oBody=$(document.documentElement).childrenByTagName('body')[0];
		return oBody;
	}
var g=
	{
		'body':oReturnBody,
		'blnDealMenu':false
	}


//----------------------------------------

	var $s=function (runCode)		//设置
		{
			switch (arguments[0]) {
				case 0:		//调用方式$s(0,a,'abc')，类似a.innerText='abc'功能;
						var a=arguments[1],oText=arguments[2];
						oText=document.createTextNode(oText);
						while(a.hasChildNodes()){a.removeChild(a.firstChild);}
						a.insertBefore(oText,null);
					break;

				case 1:		//调用方式$s(1,a,'aaaa','bbb')，在a对象的子对象序列中插入<input type="hidden" name="aaa" value="bbb">
						var a=arguments[1],strName=arguments[2],strValue=arguments[3],oHidden;
						oHidden=document.createElement('input');
						oHidden.setAttribute('type','hidden',0);
						oHidden.setAttribute('name',strName,0);
						oHidden.setAttribute('value',strValue,0);
						a.insertBefore(oHidden,null);
					break;

				case 2:		//调用方式：$s(2,a,'http://www.hitau.com','海涛科技','htUpdate(this);')，前四项必须有，在a对象的子对象序列中插入<a></a>
						var a=arguments[1],strHref=arguments[2],strText=arguments[3],strOnClick=arguments.length>=4 ? arguments[4] : '';
						var oA=document.createElement('a');
						oA.setAttribute('href',strHref,0);
						if(strOnClick.length>0){oA.setAttribute('onclick',strOnClick,0);}
						var oText=document.createTextNode(strText);
						oA.insertBefore(oText,null);
						a.insertBefore(oA,null);
					break;

				case 3:		//调用方式：$s(3,a)，删除a对象的所有子对象；
					var a=arguments[1];
					while (a.hasChildNodes()) {
						a.removeChild(a.firstChild);
					}
				break;

				case 4:	//调用方式：$s(14,textArea)，将在线编辑器的值赋给给表单对象中textarea项目的value
					var a,b=arguments[1];
					try {
						a=$(self,13);
						a=$(Array(a.document,'body'),1);
						if(b.value!=a.innerHTML){b.value=a.innerHTML;}
					}
					catch (e) {
					}
				break;

			}
		}

	var $c=function ()		//进行check，一般返回true或者false
		{
			switch (arguments[0]) {
				case 0:		//调用方式$c(0,a)，a为特定的radio集合，如果有某一项被选中，则返回true，否则返回false
					var a=arguments[1];
					for (var i=0; i<a.length; i++) {
						if(a[i].checked){return true;}
					}
					return false;
				break;
				default:

			}
			return null;
		}

	var $f=function ()		//各种功能
		{
			switch (arguments[0]) {
				case 0:		//持续连接远程服务器，防止Session过期
					try {
						tao.getHtpText('get','/manage/');
					}
					catch (e) {
					}
					setTimeout('$f(0)',300000);
				break;

				case 1:		//调用方式：$f(1,a)把a对象在当前文档中居中
					var a=arguments[1];
					a.style.left=((document.documentElement.clientWidth-a.clientWidth)/2+document.documentElement.scrollLeft)+'px';
					a.style.top=((document.documentElement.clientHeight-a.clientHeight)/2+document.documentElement.scrollTop)+'px';
				break;

				case 2:		//调用方式：$f(2)，如果当前页面有id为ulMenu的对象，则设置该对象的事件
					var a=$('ulMenu'),liArray=new Array();
					if(a==null){return;}
					$(Array(a,'li',liArray),0);
					for (var i=0; i<liArray.length; i++) {
						liArray[i].onmouseover=function() {$f(3,this);}
						liArray[i].onmouseout=function() {$f(4,this);}
					}
				break;

				case 3:		//调用方式：$f(3,a)，接上面，如果有onmouseover事件，那么则显示a对象中tagName为“ul”的子对象；
					var a=arguments[1];
					var oLi=$(a);
					a=$(Array(a,'ul'),1);
					if(a==null){return;}
					//a.style.left=(a.parentNode.clientWidth+1)+'px';
					a.style.left=(a.parentNode.clientWidth-1)+'px';
					var oElement=$(a);
					a.style.top=oElement.propertyHeight()+oElement.clientHeight+oLi.aTop()>document.documentElement.scrollTop+document.documentElement.clientHeight ? document.documentElement.scrollTop+document.documentElement.clientHeight-(oElement.propertyHeight()+oElement.clientHeight+oLi.aTop())+'px' : '0px';//+'|'+document.documentElement.clientHeight;
					a.style.visibility='visible';
				break;
				case 4:		//调用方式：$f(4,a)，接上面，如果有onmouseout事件，那么则隐藏a对象中tagName为“ul”的子对象；
					var a=arguments[1];
					a=$(Array(a,'ul'),1);
					if(a==null){return;}
					a.style.visibility='hidden';
				break;

				case 5:		//调用方式：$f(5,f)，将form表单中的input、textarea前后的空格去掉；
					var a,f=arguments[1];
					for (var i=0; i<f.length; i++) {
						a=f.elements[i];
						if(a.type.toLowerCase()=='text'){a.value=a.value.trim();}
						if(a.type.toLowerCase()=='textarea'){a.value=a.value.trim();}
					}
				break;

				case 6:		//调用方式：$f(6)，如果当前页面有form表单中的项目存在spanText，则当focus时，变化spanText的表现形式
					var of=document.forms,f,a,aType;
					for (var i=0; i<of.length; i++) {
						f=of[i];
						for (var j=0; j<f.length; j++) {
							a=f.elements[j];
							aType=a.type.toLowerCase();
							if(aType=='text' || aType=='textarea' || aType=='password' || aType=='file' || aType=='select-one' || aType=='radio' || aType=='checkbox'){
								a.onfocus=function(){
									this.select ? this.select() : this.focus();
									var b=$(this,7);
									if(b){
										if(b.className=='spanText'){b.className='spanTextFocus';this.onblur=function(){var d=$(this,7);d.className='spanText';}}
									}
									b=$(this.parentNode,7);
									if(b){
										if(b.className=='spanText'){b.className='spanTextFocus';this.onblur=function(){var d=$(this.parentNode,7);d.className='spanText';}}
									}

								}
							}
						}
					}
				break;

				case 7:		//调用方式：$f(7)，focus某些页面的input
					var c=$('',10);
					switch (c) {
						case '/client/login.asp':
							$('itUserName').focus();
						break;
						case '/client/getpassword.asp':
							$('itUserName').focus();
						break;
						case '/client/setpassword.asp':
							$('ipPassword').focus();
						break;
						default:

					}
				break;

				case 8:		//修正img对象中className包含visual的大小
					var clImg=document.getElementsByTagName('img'),cName,re;
					if(clImg.length==0){return;}
					for (var i=0; i<clImg.length; i++) {
						cName=clImg[i].className;
						if(cName){
							re=/(^| )imgVisual( |$)/ig;
							if(cName.match(re)!=null){
								$f(9,clImg[i]);
							}
						}
					}
				break;

				case 9:		//续上
					var a=arguments[1];
					var src=a.getAttribute('src',0);
					var oImg=document.createElement('img');
					window.attachEvent ? oImg.attachEvent('onload',function(){$f(10,oImg,a);}) : oImg.addEventListener('load',function(){$f(10,this,a);},true);
					oImg.setAttribute('src',src,0);
				break;

				case 10:	//续上
					var oImg=arguments[1];
					var a=arguments[2];
					var widthCur=a.clientWidth;
					var heightCur=a.clientHeight;
					var left=(a.offsetWidth-a.clientWidth)/2-a.clientLeft;
					var top=(a.offsetHeight-a.clientHeight)/2-a.clientTop;
					var width=window.Node ? oImg.width : oImg.getAttribute('width',0);
					var height=window.Node ? oImg.height : oImg.getAttribute('height',0);
					width=parseInt(width);
					height=parseInt(height);
					if(width>widthCur){
						height=Math.floor(widthCur*height/width)
						width=widthCur
					}
					if(height>heightCur){
						width=Math.floor(heightCur*width/height)
						height=heightCur
					}
					a.style.width=width+'px';
					a.style.height=height+'px';
					a.style.padding=((heightCur-height)/2+top)+'px '+((widthCur-width)/2+left)+'px';
				break;

				default:

				case 11:		//产品详细介绍页面中，当鼠标放到图片上后，变换产品中图片
					var a=arguments[1];
					var mImg,b,d,curWidth,curHeight;
					if (a==null) {return;}
					b=a.getElementsByTagName('a');
					if(b.length==null){return;}
					if(b.length<2){return;}
					mImg=b[0].firstChild;
					curWidth=mImg.clientWidth;
					curHeight=mImg.clientHeight;
					for (var i=1; i<b.length; i++) {
						d=b[i];
						d.onmouseover=function() {
							var a,b,f,oldWidth,oldHeight;
							b=this.firstChild;
							//如果是文本，则退出
							if(b.nodeType!=1){return;}
							mImg.setAttribute('src',b.getAttribute('src'),0);
							a=b.cloneNode(true);
							oldWidth=parseInt(a.getAttribute('width'));
							oldHeight=parseInt(a.getAttribute('height'));
							if(isNaN(oldWidth) || isNaN(oldHeight)){oldWidth=268;oldHeight=179}
							if(oldWidth==0 || oldHeight==0){	//如果出现尺寸错误，比如等于0的情况，则到原始图片中去查找尺寸
								f=$(Array($('divWareInfo'),a.getAttribute('src')),1);
								if(f){oldWidth=f.getAttribute('width');oldHeight=f.getAttribute('height');}
							}
							if(oldWidth>curWidth || oldHeight>curHeight){
								if(oldWidth/oldHeight>curWidth/curHeight){
									mImg.style.width='100%';
									mImg.style.height=(curWidth/curHeight)/(oldWidth/oldHeight)*100+'%';
								}
								else{
									mImg.style.height='100%';
									mImg.style.width=(oldWidth/oldHeight)/(curWidth/curHeight)*100+'%';
								}
							}
							else{
								mImg.style.width=oldWidth+'px';
								mImg.style.height=oldHeight+'px';
							}
							a=null;
						}
					}
				break;
			}
		}

//其它通用函数
	//返回XMLHttp对象
	function htp()
			{
				var a=window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
				return a;
			}
	//格式化字符串
	function fs(runCode,c)
		{
			switch (runCode) {
				case 0:		//调用方式：fs(0,c)，将含数字的字符串用parseInt函数格式化为≥0的整数，如果字符串不能解析为数字或者解析为负数，则格式化为0
					var b=0;
						b=parseInt(c);
						if(isNaN(b)){b=0;}
						if(b<0){b=0;}
						return b;
				break;

				case 1:		//调用方式：fs(1,c)，将在线编辑器里的字符串进行优化
					//去除<br></p>中的<br>
					var str=arguments[1];
					var re=/<br><\/p>/ig;
					str=str.replace(re,'</p>');
					re=/(<[^>]+?)( _[a-z]+="[0-9]+")/ig;
					str=str.replace(re,'$1');
					return str;
				break;

				case 2:		//调用方式：fs(2,c)，将c格式化为数字，如果不能解析为数字，则格式化为0
					var numNumber=parseFloat(arguments[1]);
					if(isNaN(numNumber)){return 0;}else{return numNumber;}
				break;

				case 3:		//调用方式：fs(3,c)，返回c右边点后的内容
					var re=/\.([^.]*)$/i;
					var arr=c.match(re);
					return arr ? arr[1].toLowerCase() : '';
				break;

				default:
			}
			return null;
		}
	function insert(dataArray,runCode)	//将某对象插入到另一对象中
		{
			switch (runCode) {
				case 0:		//在线导购中，在客户或导购列表中，插入客户或导购的姓名，此时调用方式为：insert(Array(a,text),0)
					var a=dataArray[0],txt=dataArray[1];
					var objA=document.createElement('a');
					var objText=document.createTextNode(txt);
					objA.insertBefore(objText,null);
					IE ? objA.attachEvent('onclick',function(){htSelectFocus(objA.firstChild.nodeValue);return false;}) : objA.addEventListener('click',function(){htSelectFocus(this.firstChild.nodeValue);return false;},true);
					a.insertBefore(objA,null);
					break;
				case 1:		//在select中插入option（不含value），此时调用方式为：insert(Array(a,text),1)，其中a为select对象，text为要插入的option的text值
						var a=dataArray[0],txt=dataArray[1];
						var oOption=document.createElement('option');
						var oText=document.createTextNode(txt);
						oOption.insertBefore(oText,null);
						a.insertBefore(oOption,null);
					break;
				case 2:		//在表格中插入行此时调用方式为：insert(Array(oTable,oCell1,oCell2...),2)，其中oCell1为<td></td>里面的内容，可能是textNode
						var oTable=dataArray[0];
						var oTr=oTable.insertRow(-1),oCell;
						for (var i=1; i<dataArray.length; i++) {
							oCell=oTr.insertCell(-1);
							oCell.insertBefore(dataArray[i],null);
						}
					break;
			}
		}

	function resizeImg(runCode,a)					//更改某对象的尺寸
		{
			switch (runCode) {
				case 0:			//如果图像对象尺寸宽度大于父对象，则等比例更改图像对象大小至父对象的大小，并且留下margin为12像素的空间；
					pWidth=a.parentNode.clientWidth-24;
					aWidth=a.offsetWidth;
					aHeight=a.offsetHeight;
					if(aWidth<=pWidth){return;}
					aHeight=Math.floor(aHeight/aWidth*pWidth);
					aWidth=pWidth;
					a.style.width=(aWidth-(a.offsetWidth-a.clientWidth))+'px';
					a.style.height=(aHeight-(a.offsetHeight-a.clientHeight))+'px';
				break;
				default:

			}
		}

	function mask()			//遮罩
		{
			//如果没有输入参数
			if(arguments.length==0){
				var a=$('divMask');
				if(a==null){
					a=document.createElement('div');
					a.setAttribute('id','divMask',0);
					a.style.width=document.body.scrollWidth+'px';
					a.style.height=document.body.scrollHeight+'px';
					a.style.backgroundColor='#FFF';
					a.style.position='absolute';
					a.style.left=0;
					a.style.top=0;
					a.style.filter='alpha(opacity=80)';
					a.style.opacity='0.5';
					//a.style.mozOpacity='0.2';
					document.body.insertBefore(a,null);
				}
			}
			//如果输入参数数量为1，则在当前document创建绝对遮罩，输入参数应当为mask的id，如果该id已经存在，则remove
			if(arguments.length==1){
				var idName=arguments[0];
				var oMask=$(idName);
				if(oMask){oMask.parentNode.removeChild(oMask);return;}
				oMask=$(document.createElement('div'));
				oMask.setAttribute('id',idName,0);
				oMask.style.position='absolute';
				oMask.style.left=0;
				oMask.style.top=0;
				//oMask.setStyle('width',document.documentElement.scrollWidth+'px');
				oMask.setStyle('width',$(document.documentElement).childrenByTagName('body')[0].scrollWidth+'px');
				//oMask.setStyle('height',document.documentElement.scrollHeight+'px');
				oMask.setStyle('height',$(document.documentElement).childrenByTagName('body')[0].scrollHeight+'px');
				oMask.style.filter='Alpha(Opacity=62)';
				oMask.style.opacity='0.62';
				oMask.style.backgroundColor='#FFF';
				oMask.setStyle('zIndex',$(document.body).childMaxZIndex()+1);
				document.body.appendChild(oMask);
				//oMask.focus();
			}
		}

	//调用方式：submitForm(f,'',url)，通过XMLHttp同步提交Post数据，返回页面内容；
	//submitForm(f,'',url,returnFunction)，异步调用，returnFunction为接收返回值的函数名;
	function submitForm(f,strAlert,url,returnFunction)
		{
			var a,c='',state='',blnAnyc=false;
			if(arguments.length>=4){blnAnyc=true;}
			if(strAlert.length>0){if(confirm(strAlert)==false){return false;}}
			for (var i=0; i<f.length; i++) {
				a=f.elements[i];
				if (a.name.length>0) {
					switch(a.type.toLowerCase()){
						case 'text':
							c=c+a.name+'='+encodeURIComponent(a.value)+'&';
							//c=c+a.name+'='+a.value+'&';
							break;
						case 'password':
							c=c+a.name+'='+encodeURIComponent(a.value)+'&';
							break;
						case 'hidden':
							c=c+a.name+'='+encodeURIComponent(a.value)+'&';
							break;
						case 'checkbox':
							if(a.checked){c=c+a.name+'='+encodeURIComponent(a.value)+'&';}
							break;
						case 'radio':
							if(a.checked){c=c+a.name+'='+encodeURIComponent(a.value)+'&';}
							break;
						case 'select-one':
							c=c+a.name+'='+encodeURIComponent(a[a.selectedIndex].value)+'&';
							break;
						case 'textarea':
							c=c+a.name+'='+encodeURIComponent(a.value)+'&';
							break;
					}
				}
			}
			if (c.length>0) {c=c.substring(0,c.length-1);}
			var objHtp=this.htp();
			if(blnAnyc){
				objHtp.onreadystatechange=function ()
					{
						if(objHtp.readyState==4){returnFunction(objHtp);}
					}
				objHtp.open('post',url,true);
				objHtp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
				objHtp.send(c);
			}
			else{
				objHtp.open('post',url,false);
				objHtp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
				objHtp.send(c);
				c=objHtp.responseText;
				//maskWaite(false);
				//state=c.substring(0,1);
				//c=c.substring(1,c.length);
				objHtp=null;
				return c;
			}
		}

	//调用方式：submitFormGet(f,'',url);通过XMLHttp提交get数据，同步返回页面内容；
	//调用方式：submitFormGet(f,'',url,returnFunction)，异步调用，returnFunction为接收返回值的函数名;
	function submitFormGet(f,strAlert,strUrl,returnFunction)
		{
			var a,c='',state='',blnAnyc=false,url=strUrl;
			if(arguments.length>=4){blnAnyc=true;}
			if(strAlert.length>0){if(confirm(strAlert)==false){return false;}}
			for (var i=0; i<f.length; i++) {
				a=f.elements[i];
				if (a.name.length>0) {
					switch(a.type.toLowerCase()){
						case 'text':
							c=c+a.name+'='+encodeURIComponent(a.value)+'&';
							//c=c+a.name+'='+a.value+'&';
							break;
						case 'password':
							c=c+a.name+'='+encodeURIComponent(a.value)+'&';
							break;
						case 'hidden':
							c=c+a.name+'='+encodeURIComponent(a.value)+'&';
							break;
						case 'checkbox':
							if(a.checked){c=c+a.name+'='+encodeURIComponent(a.value)+'&';}
							break;
						case 'radio':
							if(a.checked){c=c+a.name+'='+encodeURIComponent(a.value)+'&';}
							break;
						case 'select-one':
							c=c+a.name+'='+encodeURIComponent(a[a.selectedIndex].value)+'&';
							break;
						case 'textarea':
							c=c+a.name+'='+encodeURIComponent(a.value)+'&';
							break;
					}
				}
			}
			if (c.length>0) {c=c.substring(0,c.length-1);}

			//判断url的格式，如果前面有?号，则要加上&，否则加上?
			url=url.indexOf('?')==-1 ? url+'?'+c : url+'&'+c;

			var objHtp=window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
			if(blnAnyc){
				objHtp.onreadystatechange=function ()
					{
						if(objHtp.readyState==4){returnFunction(objHtp);}
					}
				objHtp.open('get',url,true);
				objHtp.send(null);
			}
			else{
				objHtp.open('get',url,false);
				objHtp.send(null);
				c=objHtp.responseText;
				objHtp=null;
				return c;
			}
		}

	//创建弹出窗口，返回该窗口对象
	function createDialog()
		{
			var oDiv=document.createElement('div');
			var oBody=$(document.documentElement).childrenByTagName('body')[0];
			var numHeight=arguments.length>=1 ? arguments[0] : 0;
			oDiv.setAttribute('id','divDialog',0);
			oDiv.style.position='absolute';
			oDiv.style.width='480px';
			oDiv.style.border='1px solid #999';
			oDiv.style.backgroundColor='#EEE';
			oDiv.style.left=oBody.scrollLeft+(oBody.clientWidth-480)/2+'px';
			if(numHeight>0){oDiv.style.top=document.documentElement.scrollTop+(document.documentElement.clientHeight-numHeight)/2+'px';}
			oDiv.style.zIndex=$(document.body).childMaxZIndex()+1;
			var oClose=document.createElement('a');
			oClose.setAttribute('id','aCloseDialog',0);
			oDiv.appendChild(oClose);
			var oText=document.createTextNode('×');
			oClose.appendChild(oText);
			oClose.style.display='block';
			oClose.style.borderBottom='1px solid #999';
			oClose.style.textAlign='right';
			oClose.style.padding='3px';
			oClose.style.cursor='hand';
			var oDivContent=document.createElement('div');
			oDivContent.setAttribute('id','divDialogContent',0);
			oDivContent.style.padding='12px';
			oText=document.createTextNode('请稍候……');
			var oImg=document.createElement('img');
			oImg.setAttribute('src','/common/images/site/wait2009.gif',0);
			oImg.setAttribute('width','64',0);
			oImg.setAttribute('height','64',0);
			oImg.setAttribute('border','0',0);
			var oBr=document.createElement('br');
			var oP=document.createElement('p');
			oP.appendChild(oText);
			oP.appendChild(oBr);
			oP.appendChild(oImg);
			oP.style.textAlign='center';
			oDivContent.appendChild(oP);
			oDiv.appendChild(oDivContent);
			return new Array(oDiv,oDivContent,oClose);
		}
	function addContentToDialog(a,oDivContent)
		{
			if(a.readyState!=4){return;}
			var c=a.responseText;
			oDivContent.innerHTML=c;
			//try {
				oDivContent.parentNode.style.top=document.documentElement.scrollTop+(document.documentElement.clientHeight-oDivContent.parentNode.clientHeight)/2+'px';
			//}
			//catch (e) {
			//}
			a=null;

			//如果是购物车弹出窗口
			try {
				var oNumber=$('spanShoppingCartDialogNumber');
				if(oNumber){
					var oSpan=$('spanTopNavigateShoppingCartNumber');
					if(oSpan){
						oSpan.removeAllChildren();
						var oTxt=oNumber.firstChild.cloneNode(true);
						oSpan.appendChild(oTxt);
					}
				}
			}
			catch (e) {
			}
		}

	//添加事件，通用于主流浏览器
	function addEvent(el, type, handler, capture) {
		//举例：addEvent(this.parentElement,'mouseenter',function(event){self.blnCanScroll=false;},false);
		//如果是firefox
		if (typeof el.addEventListener != 'undefined') {
			if (type === 'mouseenter') {
				el.addEventListener('mouseover', _addEvent(handler), capture);
			}
			else if (type === 'mouseleave') {
				el.addEventListener('mouseout', _addEvent(handler), capture);
			} else {
				el.addEventListener(type, handler, capture);
			}
		} else if (typeof el.attachEvent != 'undefined') {
			//如果是IE
			el.attachEvent('on' + type, handler);
		} else {
			el['on' + type] = handler;
		}
	}
	function _addEvent(handler) {
		return function (e) {
			var parent = e.relatedTarget;
			while ( parent && parent != this ) {
				try { parent = parent.parentNode; }
				catch(e) { break; }
			}
			if ( parent != this )handler.call(this, e);
		}
	}

//执行函数

	//收藏商品
	function favouriteWare(oElement)
		{
			var strUrl=oElement.getAttribute('href',0);
			var re=/wareID=([0-9]+)/i;
			var arr=strUrl.match(re);
			if(arr==null){return;}
			var wareID=arr[1];
			mask('maskFavouriteWare');
			var arrDiv=createDialog(200);
			var oDiv=arrDiv[0];
			var oContent=arrDiv[1];
			var oClose=arrDiv[2];
			oClose.onclick=function ()
				{
					mask('maskFavouriteWare');
					oClose.parentNode.parentNode.removeChild(oClose.parentNode);
					return false;
				}
			document.body.appendChild(oDiv);
			var oHtp=htp();
			oHtp.onreadystatechange=function ()
				{
					addContentToDialog(oHtp,oContent);
				}
			oHtp.open('get','/ware/favourite_ware.asp?wareID='+wareID,true);
			oHtp.send(null);
		}
	//收藏商品时，登录
	function checkFormFavouriteWare(f)
		{
			f.userName.value=f.userName.value.trim();
			f.password.value=f.password.value.trim();
			if(f.userName.value.length==0){alert('请填写登录用户名，谢谢。');f.userName.select();return false;}
			if(f.password.value.length==0){alert('请填写登录密码，谢谢。');f.password.select();return false;}
			submitForm(f,'','/ware/favourite_ware.asp',getFormFavouriteWare);
			$('divDialogContent').innerHTML='<p style="text-align:center;">请稍候……</p>';
			return false;
		}
	//收藏商品时，登录后返回信息
	function getFormFavouriteWare(a)
		{
			var c=a.responseText;
			$('divDialogContent').innerHTML=c;
			a=null;
		}
	//添加商品到购物车
	function aw(aLink)
		{
			var query=null;

			var url=aLink.getAttribute('href');

			//判断url是否正常
			var re=/\/ware\/shoppingcart\.asp\?(wareID=[0-9]+&(amp;)?qty=[0-9]+[\s\S]*)/i;
			var arr=url.match(re);
			if(arr!=null){query=arr[1];}

			var re=/wareID=([0-9]+)/i;
			var arr=url.match(re);
			if(arr==null){return false;}
			var wareID=arr[1];

			////2009-11-20添加：目的是在客户领取婵真美菁4小套的时候，提醒客户备注替换品，可以随时删除本段代码
			//try {
				//wareID=wareID*1;
				//if(wareID==1037){
					////if(confirm('请问您看了重要通知中关于“本品已经断货，您可以选择免费领取婵真银杏4小套或婵真DeAGE美菁瑞迪艾美白4小套来代替本品”的内容吗？\n如果是，请记得告知淡淡香——在提交订单前，填写在订单备注信息中就可以了，谢谢。')==false){return false;}
					//alert('提醒您一下，在提交订单前，请记得将您的选择写在订单备注中哦。\n（如果您不明白，请看本商品的详细介绍页面的“重要通知”或者加客服QQ315277888垂询）。\n   谢谢^_^');
				//}
			//}
			//catch (e) {
			//}
			////2009-11-20添加结束

			//数量
			var qty=1;
			if(arguments.length>=2){
				var oSelect=arguments[1];
				if(oSelect){
					qty=oSelect[oSelect.selectedIndex].value;
				}
			}

			//隐藏下拉框
			try {
				$('selectQty').setStyle('display','none');
			}
			catch (e) {
			}

			arr=createDialog();
			var oDiv=arr[0];
			var oContent=arr[1];
			var oClose=arr[2];
			oClose.onclick=function ()
				{
					mask('maskAddWareToShoppingCart');
					oClose.parentNode.parentNode.removeChild(oClose.parentNode);
					//显示下拉框
					try {
						$('selectQty').setStyle('display','inline');
					}
					catch (e) {
					}
					return false;
				}
			mask('maskAddWareToShoppingCart');
			document.body.appendChild(oDiv);
			oDiv.style.top=document.documentElement.scrollTop+(document.documentElement.clientHeight-oDiv.clientHeight)/2+'px';
			var oHtp=htp();
			oHtp.onreadystatechange=function ()
				{
					addContentToDialog(oHtp,oContent);
				}
			oHtp.open('get','/ware/shoppingcart_dialog.asp?'+(query==null ? 'wareID='+wareID+'&qty='+qty : query),true);
			oHtp.send(null);
			//var c=oHtp.responseText;
			//oContent.innerHTML=c;
		}

	//显示配送费用
	function showSendFee(aLink)
		{
			var url=aLink.getAttribute('href');
			//var re=/wareID=([0-9]+)/i;
			//var arr=url.match(re);
			//if(arr==null){return false;}
			//var wareID=arr[1];
			arr=createDialog();
			var oDiv=arr[0];
			var oContent=arr[1];
			var oClose=arr[2];
			oClose.onclick=function ()
				{
					mask('maskShowSendFee');
					oClose.parentNode.parentNode.removeChild(oClose.parentNode);
					return false;
				}
			mask('maskShowSendFee');
			oDiv.style.top=document.documentElement.scrollTop+(document.documentElement.clientHeight-360)/2+'px';
			document.body.appendChild(oDiv);
			var oHtp=htp();
			oHtp.onreadystatechange=function ()
				{
					addContentToDialog(oHtp,oContent);
				}
			//oHtp.open('get','/ware/showsendfee.asp?wareID='+wareID,true);
			oHtp.open('get',url,true);
			oHtp.send(null);
		}
	//显示其他配送费用
	function showSendFeeOther(aLink)
		{
			var url=aLink.getAttribute('href');
			$('divShowSendFee').innerHTML='请稍候……';
			var oHtp=htp();
			oHtp.onreadystatechange=function ()
				{
					addContentToDialog(oHtp,$('divShowSendFee'));
				}
			oHtp.open('get',url,true);
			oHtp.send(null);
		}

	//统计某链接的点击
	function recordHref(strUrl)
		{
			var objHtp=htp();
			var c='/action/pageclose.asp?url='+encodeURIComponent(strUrl);
			objHtp.open('get',c,true);
			objHtp.send(null);
		}

	//添加到货通知信息
	function soldOutCancelNote(oLink)
		{
			var url=oLink.getAttribute('href',0);
			var oRemote=new objRemoteAccess();
			oRemote.openNewWindow(url,480,190,true);
		}
	//添加到货通知信息时，登录
	function checkFormSoldOutCancelNote(f)
		{
			f.userName.value=f.userName.value.trim();
			f.password.value=f.password.value.trim();
			if(f.userName.value.length==0){alert('请填写登录用户名，谢谢。');f.userName.select();return false;}
			if(f.password.value.length==0){alert('请填写登录密码，谢谢。');f.password.select();return false;}

			var oRemote=new objRemoteAccess();
			oRemote.submitForm(f,'/ware/soldoutcancelnote.asp',checkFormSoldOutCancelNote_handle);

			//submitForm(f,'','/ware/favourite_ware.asp',getFormFavouriteWare);
			//$('divDialogContent').innerHTML='<p style="text-align:center;">请稍候……</p>';
			return false;
		}
	//返回信息
	function checkFormSoldOutCancelNote_handle(c)
		{
			var oDiv=$('divForOpenNewWindowContent');
			oDiv.innerHTML=c;
		}


//自定义类
	//=========== 走马灯类开始 ================
			var oMove=function (oParent,colElements,strDirection,numSpace,timeSpace,cssNameDivPage,numSpacePage,numPageMarginRight,numPageMarginBottom)
				{
					//strDirection='left' || 'top'
					//调用说明：预先设置一个父容器，父容器的样式如下：
						//display:block;
						//position:relative;或absolute
						//border-width:0;
						//width:150px;
						//height:100px;
						//overflow:hidden;
					//子对象，也就是一个个的“页面”，样式如下：
						//display:block;
						//position:absolute;
						//width:150px;
						//height:120px;
						//left:0;
						//top:0;
					//页码样式固定为：
						//.divMousePage
							//{
								//position:absolute;
								//border:1px solid #000;
								//width:16px;
								//height:16px;
								//line-height:16px;
								//text-align:center;
								//font-size:12px;
								//cursor:pointer;
							//}
					//调用示例：
						//var curMove=new oMove(oDivParent,arrDivs,'top',5,100,'divMousePage',3,3,3);
						//curMove.init();
						//oDivParent，父容器对象；
						//colDivs，子对象数组；
						//'left'或'top'，滚动方向；
						//5，滚动一次移动的距离；
						//100，滚动一次的时间间隔；
						//divMousePage，页码div的样式名称；
						//numSpacePage，页面div之间的距离；
						//numPageMarginRight，最右边的页码对象距父对象右边的距离；
						//numPageMarginBottom，页对象距父对象下边的距离；

					this.parentElement=$(oParent);
					this.numSpace=numSpace;
					this.timeSpace=timeSpace;
					this.curElement=null;
					//设置页码属性
					for (var i=0, len=colElements.length; i<len; i++) {
						var oElement=colElements[i];
						oElement._page=i+1;
					}
					this.colElements=colElements.slice();
					this.colElementsInit=colElements.slice();
					this.cssNameDivPage=cssNameDivPage;
					this.blnCanScroll=true;
					this.blnMousePage=false;
					this.blnRemove=false;	//是否正在进行拆解，在进行拆解时，是不能移动的
					this.strDirection=strDirection;
					this.spacePage=numSpacePage;
					this.numPageMarginRight=numPageMarginRight;
					this.numPageMarginBottom=numPageMarginBottom;
					this.divPageID=null;
					this.arrDivPages=new Array();

					var self=this;
					addEvent(this.parentElement,'mouseenter',function(event){self.blnCanScroll=false;},false);
					addEvent(this.parentElement,'mouseleave',function(event){self.blnCanScroll=true;},false);

					//this.show();
				}
			//初始化
			oMove.prototype.init=function ()
				{
					var oDiv=null;
					var	oDivPrevious=null;
					var oDivParent=this.parentElement;
					var colDivs=this.colElements;
					var num=null;

					//将子对象按顺序进行排列
					for (var i=0, len=colDivs.length; i<len; i++) {
						oDiv=$(colDivs[i]);
						if(i>0){
							oDivPrevious=colDivs[i-1];
							//num=oDivPrevious.offsetLeft+oDivPrevious.offsetWidth;
							num=this.direction(0,oDivPrevious);
							oDiv.setStyle(this.direction(1),num+'px');
						}
					}

					//设置页码
					this.setPage();
					//开始滚动
					this.beginMove();
				}
			//涉及到方向的，都归纳到一个函数中
			oMove.prototype.direction=function (n)
				{
					switch (n) {
						case 0:
							var oDivPrevious=arguments[1];
							var num=null;
							if(this.strDirection=='left'){
								num=oDivPrevious.offsetLeft+oDivPrevious.offsetWidth;
							}
							else{
								num=oDivPrevious.offsetTop+oDivPrevious.offsetHeight;
							}
							return num;
						break;
						//用于setStyle(xxx,yyy)中的xxx，调用方式：this.direction(1)
						case 1:
							if(this.strDirection=='left'){
								return 'left';
							}
							else{
								return 'top';
							}
						break;
						case 2:
							if(this.strDirection=='left'){
								return 'left';
							}
							else{
								return 'top';
							}
						break;
						case 3:
							if(this.strDirection=='left'){
								return 'right';
							}
							else{
								return 'bottom';
							}
						break;
						case 5:
							var oDiv=arguments[1];
							if(this.strDirection=='left'){
								return oDiv.offsetLeft;
							}
							else{
								return oDiv.offsetTop;
							}
						break;
						case 6:
							var arr=arguments[1];
							//arr[arr.length-1].offsetLeft
							if(this.strDirection=='left'){
								return arr[arr.length-1].offsetLeft;
							}
							else{
								return arr[arr.length-1].offsetTop;
							}
						break;
						case 7:
							var curDiv=arguments[1];
							//numCur=curDiv.offsetLeft+curDiv.offsetWidth;
							//numCur=this.direction(7,curDiv);
							if(this.strDirection=='left'){
								return curDiv.offsetLeft+curDiv.offsetWidth;
							}
							else{
								return curDiv.offsetTop+curDiv.offsetHeight;
							}
						break;
						case 8:
							var curDiv=arguments[1];
							//if(curDiv.offsetLeft<0){
							//if(this.direction(8,curDiv)<0){
							if(this.strDirection=='left'){
								return curDiv.offsetLeft;
							}
							else{
								return curDiv.offsetTop;
							}
						break;
						case 9:
							//返回offsetLeft或offsetTop，调用方式：this.direction(9,a);
							//var n1=a.offsetLeft;
							//var n2=b.offsetLeft;
							//var n1=this.direction(9,a);
							//var n2=this.direction(9,b);
							var curElement=arguments[1];
							if(this.strDirection=='left'){
								return curElement.offsetLeft;
							}
							else{
								return curElement.offsetTop;
							}
						break;
						case 10:
							//返回对象调用move方式时的移动方向，分为left、right、top、bottom，目前仅支持left、top
							//调用方式：this.direction(10)
							if(this.strDirection=='left'){
								return 'left';
							}
							else{
								return 'top';
							}
						break;
						case 11:
							//返回对象的offsetWidth或offsetHeight
							//调用方式：this.direction(11,a)
							var a=arguments[1];
							if(this.strDirection=='left'){
								return a.offsetWidth;
							}
							else{
								return a.offsetHeight;
							}
						break;
						case 12:
							//返回对象runtimeStyle中的left或top，数值
							//调用方式：this.direction(12,a)
							var a=arguments[1];
							if(this.strDirection=='left'){
								return parseInt(a.getStyle('left'));
							}
							else{
								return parseInt(a.getStyle('top'));
							}
						break;
					}
				}
			//设置页码
			oMove.prototype.setPage=function ()
				{
					//设置页码对象
					var numPage=this.colElementsInit.length;
					var numRight=null;
					for (var i=1, len=numPage; i<=len; i++) {
						var oTxt=document.createTextNode(i);
						var oDiv=document.createElement('div');
						oDiv=$(oDiv);
						oDiv.appendChild(oTxt);

						//设置oDiv的样式
						try {
							oDiv.setAttribute('class',this.cssNameDivPage,0);
							oDiv.setAttribute('className',this.cssNameDivPage,0);
						}
						catch (e) {
						}

						//加入到this.parentElement
						this.parentElement.appendChild(oDiv);
						numRight=(len-i)*this.spacePage+this.numPageMarginRight+(len-i)*oDiv.offsetWidth;
						oDiv.setStyle('right',numRight+'px');
						oDiv.setStyle('bottom',this.numPageMarginBottom+'px');
						oDiv.setStyle('zIndex',2);

						//设置oDiv的onmouseover事件
						var self=this;
						addEvent(oDiv,'mouseenter',function(event){self.blnMousePage=true;self.reset();self.mousePage(event);},false);
						addEvent(oDiv,'mouseleave',function(event){self.resetResume();},false);

						//加入到页码对象数组
						this.arrDivPages.push(oDiv);
					}
				}

			//设置页面事件
			oMove.prototype.mousePage=function ()
				{
					var oEvt=window.event ? window.event : arguments[0];
					var oElement=oEvt.srcElement ? oEvt.srcElement : oEvt.target;
					oElement=$(oElement);

					var numPage=oElement.inText();
					this.curElement=this.colElementsInit[numPage-1];
					if(this.blnRemove==false){
						this.mouseMove();
					}
				}

			//开始正常滚动
			oMove.prototype.beginMove=function ()
				{

					//debugger;

					//设置要移动到0位的项，即设置curElement，并开始移动
					if(this.blnCanScroll==false || this.blnRemove==true){
						var self = this;
						setTimeout(function(){self.beginMove();},500);
						return;
					}
					var oElement=null;
					for (var i=0, len=this.colElements.length; i<len; i++) {
						oElement=this.colElements[i];
						//if(oElement.offsetLeft>0){
						if(this.direction(9,oElement)>0){
							this.curElement=oElement;
							break;
						}
					}
					if(this.blnCanScroll && this.blnRemove==false){
						var self = this;
						setTimeout(function(){if(self.blnCanScroll && self.blnRemove==false){self.move();}else{self.beginMove();}},3000);
					}
					else{
						var self = this;
						setTimeout(function(){self.beginMove();},500);
					}
				}

			//正常滚动
			oMove.prototype.move=function ()
				{
					//var oDiv=$('divSub2');
					//如果目前是由鼠标控制，则退出
					if(this.blnMousePage){
						var self=this;
						setTimeout(function(){self.beginMove();},500);
						return;
					}

					var oDiv=this.curElement;
					var numSpace=this.numSpace;
					var numSpaceMove=0;
					var curDiv=null;
					//if(oDiv.offsetLeft>0){
					if(this.direction(9,oDiv)>0){
						//numSpaceMove=oDiv.offsetLeft>numSpace ? numSpace : oDiv.offsetLeft;
						numSpaceMove=this.direction(9,oDiv)>numSpace ? numSpace : this.direction(9,oDiv);
						var	oDivPrevious=null;
						//var oDivParent=$('divParent');
						var oDivParent=this.parentElement;
						//var colDivs=oDivParent.childClassName('div','divSub');
						var colDivs=this.colElements;
						for (var i=0, len=colDivs.length; i<len; i++) {
							curDiv=$(colDivs[i]);
							//curDiv.move('left',numSpaceMove);
							curDiv.move(this.direction(10),numSpaceMove);
						}
						//setTimeout('move()',1);
						var self = this;
						setTimeout(function(){self.move();},this.timeSpace);
					}
					else{
						this.moveEnd();

						//准备进行下一次移动
						this.beginMove();
					}
				}

			//鼠标进入后，将相应的页面移动到指定位置
			oMove.prototype.mouseMove=function ()
				{
					var oDiv=this.curElement;
					var numSpace=this.numSpace;
					var numSpaceMove=0;
					var curDiv=null;
					//var strDirection='left';
					var strDirection=this.direction(2);
					var numOffset=this.direction(5,oDiv);

					//if(oDiv.offsetLeft!=0){
					if(numOffset!=0){
						//numSpaceMove=Math.abs(oDiv.offsetLeft)>numSpace ? numSpace : Math.abs(oDiv.offsetLeft);
						numSpaceMove=Math.abs(numOffset)>numSpace ? numSpace : Math.abs(numOffset);
						if(numOffset<0){
							strDirection=this.direction(3);
						}
						var	oDivPrevious=null;
						//var oDivParent=$('divParent');
						var oDivParent=this.parentElement;
						//var colDivs=oDivParent.childClassName('div','divSub');
						var colDivs=this.colElements;
						for (var i=0, len=colDivs.length; i<len; i++) {
							curDiv=$(colDivs[i]);
							curDiv.move(strDirection,numSpaceMove);
						}
						var self = this;
						setTimeout(function(){self.mouseMove();},this.timeSpace);
					}
					else{
						//如果已经到达位置，则变更顺序，将offsetLeft为负数的调到后面去
						//this.moveEnd();
						//仅移动页码指示器
						this.blnRemove=true;
						this.movePageID();
						this.blnRemove=false;

						//取消限制状态
						this.blnMousePage=false;
					}
				}

			//移动结束后需要做的事情
			oMove.prototype.moveEnd=function ()
				{
						//debugger;

						this.blnRemove=true;

						//移动页码指示器
						this.movePageID();

						//当最后的子对象offsetLeft || offsetTop<=0时，调整顺序
						var arr=this.colElementsInit;
						var num=this.direction(6,arr);
						//if(arr[arr.length-1].offsetLeft<=0){
						if(num<=0){
							var curDiv=null;
							var	oDivPrevious=null;
							var oDivParent=this.parentElement;
							var colDivs=this.colElements;

							//获得最大的offsetLeft+offsetWidth || offsetTop+offsetHeight
							var numMax=0;
							var numCur=0;
							for (var i=0, len=colDivs.length; i<len; i++) {
								curDiv=$(colDivs[i]);
								//numCur=curDiv.offsetLeft+curDiv.offsetWidth;
								numCur=this.direction(7,curDiv);
								if(numCur>numMax){numMax=numCur;}
							}
							//将offsetLeft或offsetTop为负值的对象替换到另一面去
							for (var i=0, len=colDivs.length; i<len; i++) {
								curDiv=$(colDivs[i]);
								//if(curDiv.offsetLeft<0){
								if(this.direction(8,curDiv)<0){
									//curDiv.setStyle('left',numMax+'px');
									curDiv.setStyle(this.direction(1),numMax+'px');
									//numMax=curDiv.offsetLeft+curDiv.offsetWidth;
									numMax=this.direction(7,curDiv);
								}
							}
						}

						//对对象数组进行重新排序
						var self=this;
						//this.colElements.sort(this.arrSort);
						this.colElements.sort(function (){return self.arrSort(arguments[0],arguments[1]);});

						this.blnRemove=false;

				}

			//将子对象对象按照1、2、3……5的顺序排列
			oMove.prototype.reset=function ()
				{

					//debugger;

					this.blnRemove=true;

					//思路：将子对象按照_page值从高到低循环，如果低的排在高的后面，则将低的排在高的前面，在此之前，先clone一个子对象放在原位置， _page设置为0
					for (var len=this.colElementsInit.length,i=len-2; i>=0; i--) {
						var oElement=this.colElementsInit[i];
						var oPrevious=this.colElementsInit[i+1];
						var pointPrevious=this.direction(9,oPrevious);
						var pointElement=this.direction(9,oElement);
						//如果低的排在高的后面，则进行调整
						if(pointElement>pointPrevious){
							var oNode=oElement.cloneNode(true);
							//debugger;
							oNode._extendedByMyScriptName=false;
							oNode=$(oNode);
							oNode._page=-oElement._page;
							this.parentElement.appendChild(oNode);
							//debugger;
							oNode.setStyle(this.direction(1),this.direction(12,oElement)+'px');
							this.colElements.push(oNode);
							var pointElementCur=pointPrevious-this.direction(11,oElement);
							oElement.setStyle(this.direction(1),pointElementCur+'px');
						}

						//break;
					}

					//对对象数组进行重新排序
					var self=this;
					//this.colElements.sort(this.arrSort);
					this.colElements.sort(function (){return self.arrSort(arguments[0],arguments[1]);});

					this.blnRemove=false;
				}

			//将子对象恢复排列
			oMove.prototype.resetResume=function ()
				{
					this.blnRemove=true;

					//思路：将子对象按照_page值从低到高循环，如果left为负值，则移动到_page相同但为负的对象的位置上，然后把_page为负的对象去掉
					for (var i=0, len=this.colElementsInit.length; i<len-1; i++) {
						var oElement=this.colElementsInit[i];
						//如果对象已经隐藏，则移动到_page相同但为负的对象的位置上，然后把后者去掉
						if(this.direction(7,oElement)<=0){
							var pageCur=oElement._page;
							for (var j=0, len1=this.colElements.length; j<len1; j++) {
								var oDiv=this.colElements[j];
								if(oDiv._page==-pageCur){
									var pointDiv=this.direction(12,oDiv);
									oElement.setStyle(this.direction(1),pointDiv+'px');
									oDiv.parentNode.removeChild(oDiv);
									this.colElements.splice(j,1);
									break;
								}
							}
						}
					}

					//对对象数组进行重新排序
					var self=this;
					//this.colElements.sort(this.arrSort);
					this.colElements.sort(function (){return self.arrSort(arguments[0],arguments[1]);});

					this.blnRemove=false;

				}

			oMove.prototype.arrSort=function (a,b)
				{
					//var n1=a.offsetLeft;
					//var n2=b.offsetLeft;
					var n1=this.direction(9,a);
					var n2=this.direction(9,b);
					if(n1<n2){
						return -1;
					}
					else{
						if(n1==n2){
							return 0;
						}
						else{
							return 1;
						}
					}
				}
			//移动页面指示器
			oMove.prototype.movePageID=function ()
				{
					if(this.divPageID==null){
						var oDiv=document.createElement('div');
						oDiv=$(oDiv);
						oDiv.setStyle('position','absolute');
						oDiv.setStyle('width','20px');
						oDiv.setStyle('height','20px');
						oDiv.setStyle('backgroundColor','#CCC');
						oDiv.setStyle('border','1px solid #CCC');
						this.parentElement.appendChild(oDiv);
						this.divPageID=oDiv;
					}

					var numCurPage=1;
					for (var i=0, len=this.colElementsInit.length; i<len; i++) {
						if(this.colElementsInit[i]==this.curElement){
							numCurPage=i+1;
						}
					}

					var oDivPage=this.arrDivPages[numCurPage-1];
					var oDiv=this.divPageID;
					oDiv.setStyle('left',oDivPage.offsetLeft+'px');
					oDiv.setStyle('top',oDivPage.offsetTop+'px');

				}
			//
			oMove.prototype.show=function ()
				{
					var c='this.blnRemove='+this.blnRemove+';this.blnCanScroll='+this.blnCanScroll;
					c=c+';'+'this.blnMousePage='+this.blnMousePage;
					document.title=c;
					var self=this;
					setTimeout(function(){self.show();},1000);
				}
			//类结束

	//======= 单个走马灯类定义开始 =========
		var oMoveSingle=function (oParent,sourceElement,leftElement,rightElement,strDirection,numSpace,numSpaceSpec,timeSpace)
			{
				//循环滚动父容器中的一个单独子对象

				//参数说明
					//oDivParent，父容器对象；
					//sourceElement，要循环滚动的子对象；
					//leftElement，能响应mouseover的对象，鼠标放上去能加速朝默认方向滚动；
					//rightElement，能响应mouseover的对象，鼠标放上去能加速朝默认反方向滚动；
					//自动滚动方向：strDirection='left' || 'top' || 'right' || 'bottom'
					//numSpace，滚动一次移动的距离，像素；
					//numSpaceSpec，指定滚动一次移动的距离，像素；
					//timSpace，滚动一次的时间间隔，毫秒；

				//调用说明：预先设置一个父容器，父容器的样式如下：
					//display:block;
					//position:relative;或absolute
					//border-width:0;
					//width:150px;
					//height:100px;
					//overflow:hidden;
				//子对象，样式如下：
					//display:block;
					//position:absolute;
					//width:150px;
					//height:120px;
					//left:-100px;
					//top:0;
				//调用示例：
					//var curMoveSingle=new oMoveSingle(oDivParent,oDiv,oButtonLeft,oButtonRight,'left',5,25,100);
					//curMoveSingle.init();

				this.parentElement=$(oParent);
				this.strDirection=strDirection;
				this.numSpace=numSpace;
				this.numSpaceSpec=numSpaceSpec;
				this.timeSpace=timeSpace;
				this.sourceElement=$(sourceElement);
				this.colElements=new Array(this.sourceElement);
				//var numLeft=this.parentElement.offsetWidth+this.sourceElement.offsetWidth;

				var numLeft=this.drtn(0,this.parentElement)+this.drtn(0,this.sourceElement);
				while (parseInt(this.colElements[this.colElements.length-1].getStyle(this.drtn(1)))<numLeft) {
					var oElement=this.sourceElement.cloneNode(true);
					oElement._extendedByMyScriptName=false;
					oElement=$(oElement);
					this.parentElement.appendChild(oElement);
					var numMax=parseInt(this.colElements[this.colElements.length-1].getStyle(this.drtn(1)))+this.drtn(0,this.colElements[this.colElements.length-1]);
					oElement.setStyle(this.drtn(1),numMax+'px');
					this.colElements.push(oElement);
				}
				this.blnMouseOver=false;
				this.blnMouseOverDirection1=false;
				this.blnMouseOverDirection2=false;

				var self=this;
				addEvent(this.parentElement,'mouseenter',function(event){self.blnMouseOver=true;},false);
				addEvent(this.parentElement,'mouseleave',function(event){self.blnMouseOver=false;},false);
				addEvent(leftElement,'mouseenter',function(event){self.blnMouseOverDirection1=true;self.moveSpec(self.strDirection);},false);
				addEvent(leftElement,'mouseleave',function(event){self.blnMouseOverDirection1=false;},false);
				addEvent(rightElement,'mouseenter',function(event){self.blnMouseOverDirection2=true;self.moveSpec(self.drtn(2));},false);
				addEvent(rightElement,'mouseleave',function(event){self.blnMouseOverDirection2=false;},false);
			}

		//按照方向返回一些内容
		oMoveSingle.prototype.drtn=function (n,a)
			{
				switch (n) {
					case 0:
						//返回对象的offsetWidth或offsetHeight
						if(this.strDirection=='left' || this.strDirection=='right'){
							return a.offsetWidth;
						}
						else{
							return a.offsetHeight;
						}
					break;
					case 1:
						//返回left或top
						if(this.strDirection=='left' || this.strDirection=='right'){
							return 'left';
						}
						else{
							return 'top';
						}
					break;
					case 2:
						//返回反方向字符串
						if(this.strDirection=='left'){
							return 'right';
						}
						if(this.strDirection=='right'){
							return 'left';
						}
						if(this.strDirection=='top'){
							return 'bottom';
						}
						if(this.strDirection=='bottom'){
							return 'top';
						}
					break;

				}
			}

		//初始化
		oMoveSingle.prototype.init=function ()
			{
				this.move();
			}

		//正常滚动
		oMoveSingle.prototype.move=function ()
			{
				//如果目前鼠标不在上面，则滚动
				if(this.blnMouseOver==false){
					var curDiv=null;
					var numSpaceMove=this.numSpace;
					var colDivs=this.colElements;
					for (var i=0, len=colDivs.length; i<len; i++) {
						curDiv=$(colDivs[i]);
						curDiv.move(this.strDirection,numSpaceMove);
					}

					//进行设置，保证两端有1个对象在范围外
					this.moveSet();
				}
				var self = this;
				setTimeout(function(){self.move();},this.timeSpace);
			}
		//指定滚动
		oMoveSingle.prototype.moveSpec=function (strDirection)
			{
				//如果目前鼠标不在上面，则不滚动
				if(this.blnMouseOverDirection1==false && strDirection=='left'){
					return null;
				}
				if(this.blnMouseOverDirection2==false && strDirection=='right'){
					return null;
				}
				var curDiv=null;
				var numSpaceMove=this.numSpaceSpec;
				var colDivs=this.colElements;
				for (var i=0, len=colDivs.length; i<len; i++) {
					curDiv=$(colDivs[i]);
					curDiv.move(strDirection,numSpaceMove);
				}

				//进行设置，保证两端有1个对象在范围外
				this.moveSet();

				var self = this;
				setTimeout(function(){self.moveSpec(strDirection);},this.timeSpace);
			}
		//设置，保证两端有1个对象在范围外
		oMoveSingle.prototype.moveSet=function ()
			{
				var num=0;
				var colDivs=this.colElements;
				//如果第一个子对象的left≤子对象的-offsetWidth*1.5，则将第一个子对象放到最后
				var curDiv=this.colElements[0];
				var numLeft=parseInt(curDiv.getStyle(this.drtn(1)));
				var numWidth=this.drtn(0,curDiv);
				if(numLeft<=-numWidth*1.5){
					//获得最大的距离
					var rightDiv=this.colElements[this.colElements.length-1];
					var numRight=parseInt(rightDiv.getStyle(this.drtn(1)));
					numRight=numRight+this.drtn(0,rightDiv);
					curDiv.setStyle(this.drtn(1),numRight+'px');
				}
				else{
					//否则就将最末的对象放到第一的位置
					var rightDiv=this.colElements[this.colElements.length-1];
					numLeft=numLeft-this.drtn(0,rightDiv);
					rightDiv.setStyle(this.drtn(1),numLeft+'px');
				}

				//对对象数组进行重新排序
				var self=this;
				this.colElements.sort(function (){return self.arrSort(arguments[0],arguments[1]);});
			}

		//排序
		oMoveSingle.prototype.arrSort=function (a,b)
			{
				//debugger;
				//var n1=a.offsetLeft;
				//var n2=b.offsetLeft;
				var n1=parseInt(a.getStyle(this.drtn(1)));
				var n2=parseInt(b.getStyle(this.drtn(1)));
				//var n2=this.direction(9,b);
				if(n1<n2){
					return -1;
				}
				else{
					if(n1==n2){
						return 0;
					}
					else{
						return 1;
					}
				}
			}
	//======= 单个走马灯类定义结束 =========

	//定义远端通信类
		var objRemoteAccess=function (){}
		objRemoteAccess.prototype.htp=function()
			{
				var a=window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
				return a;
			}
		//异步以post方式提交表单，调用方式：objRemoteAccess.submitForm(f,url,returnFunction,curObject);其中curObject可以省略
		//通过XMLHttp异步提交Post数据，通过调用returnFunction函数（调用方式：returnFunction(c)），返回页面内容
		objRemoteAccess.prototype.submitForm=function(f,url,returnFunction)
			{
				var a,c='';

				//遮罩
				var oMask=this.mask();

				var curObject=arguments.length>=3 ? arguments[3] : null;

				//获取数据
				for (var i=0; i<f.length; i++) {
					a=f.elements[i];
					if (a.name.length>0) {
						switch(a.type.toLowerCase()){
							case 'text':
								c=c+a.name+'='+encodeURIComponent(a.value)+'&';
								break;
							case 'password':
								c=c+a.name+'='+encodeURIComponent(a.value)+'&';
								break;
							case 'hidden':
								c=c+a.name+'='+encodeURIComponent(a.value)+'&';
								break;
							case 'checkbox':
								if(a.checked){c=c+a.name+'='+encodeURIComponent(a.value)+'&';}
								break;
							case 'radio':
								if(a.checked){c=c+a.name+'='+encodeURIComponent(a.value)+'&';}
								break;
							case 'select-one':
								c=c+a.name+'='+encodeURIComponent(a[a.selectedIndex].value)+'&';
								break;
							case 'textarea':
								c=c+a.name+'='+encodeURIComponent(a.value)+'&';
								break;
						}
					}
				}
				if (c.length>0) {c=c.substring(0,c.length-1);}

				//提交数据
				var objHtp=this.htp();
				objHtp.onreadystatechange=function (){
					if(objHtp.readyState==4){
						oMask.parentNode.removeChild(oMask);
						var c=objHtp.responseText;
						objHtp=null;
						if(returnFunction){
							returnFunction(c,curObject);
						}
					}
				}
				objHtp.open('post',url,true);
				objHtp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
				objHtp.send(c);
			}

		//调用方式：objRemoteAccess.getHtp(url,returnFunction,curObject,strFormat);异步调用，返回页面内容
		//url：要返回内容的页面网址；
		//returnFunction：returnFunction为接收返回值的函数名，如果没有则为null；
		//curObject：可省略，在回调时要传送的对象，如果定义了strFormat，而不需要定义本项，则设定为null；
		//strFormat：可省略，定义返回的信息格式，指定为text时为“text”，指定为xml时为“xml”，省略时默认返回text；
		objRemoteAccess.prototype.getHtp=function(url,returnFunction)
			{
				//遮罩
				var oMask=this.mask();

				var curObject=arguments.length>=3 ? arguments[2] : null;
				var strFormat=arguments.length>=4 ? arguments[3] : 'text';

				var blnAnyc=true;
				var objHtp=this.htp();
				objHtp.onreadystatechange=function ()
					{
						if(objHtp.readyState==4){
							oMask.parentNode.removeChild(oMask);
							var c=null;
							switch (strFormat) {
								case 'text':
									c=objHtp.responseText;
								break;
								case 'xml':
									c=objHtp.responseXML;
								break;
							}
							objHtp=null;
							if(returnFunction){
								returnFunction(c,curObject);
							}
						}
					}
				objHtp.open('get',url,true);
				objHtp.send(null);
			}

		//以弹出窗口形式打开一个页面
		//调用方式：objRemoteAccess.getHtp(url,width,height,blnScroll);
		//url，要打开的页面网址，必填；
		//width，窗口的宽度，必填；
		//height，窗口的高度，必填，不指定时设为null；
		//blnScroll，窗口的内容超过高度时，是否显示滚动条，必填，true or false；
		//firstFocusElement，打开窗口后，需要focus的element，必填，不指定时设为null；
		objRemoteAccess.prototype.openNewWindow=function (url,width,height,blnScroll,firstFocusElement)
			{
				//遮罩
				var oMask=this.maskCommon();
				oMask.setAttribute('id','maskForOpenNewWindow',0);

				var oBody=g.body();

				//设置div
				var oDiv=$(document.createElement('div'));
				oDiv.setAttribute('id','divForOpenNewWindow',0);
				oDiv.setStyle('position','absolute');
				oDiv.setStyle('border','1px solid #999');
				oDiv.setStyle('backgroundColor','#EEE');
				oDiv.setStyle('width',width+'px');
				oDiv.setStyle('zIndex',oBody.childMaxZIndex()+1);
				if(height!=null){
					oDiv.setStyle('height',height+'px');
				}

				oBody.appendChild(oDiv);

				var left=oBody.scrollLeft+((oBody.offsetWidth-oDiv.offsetWidth)/2);
				var top=document.documentElement.scrollTop+((document.documentElement.clientHeight-oDiv.offsetHeight)/2);
				//if(numHeight>0){oDiv.style.top=document.documentElement.scrollTop+(document.documentElement.clientHeight-numHeight)/2+'px';}
				oDiv.setStyle('left',left+'px');
				oDiv.setStyle('top',top+'px');


				//设置关闭窗口的链接
				var oText=document.createTextNode('×');
				var oLink=$(document.createElement('a'));
				oLink.appendChild(oText);
				addEvent(oLink,'click',function(){oDiv.parentNode.removeChild(oDiv);oMask.parentNode.removeChild(oMask);},false);

				oLink.setAttribute('id','aForOpenNewWindowClose',0);
				oLink.setStyle('display','block');
				oLink.setStyle('padding','3px');
				oLink.setStyle('borderBottom','1px solid #999');
				oLink.setStyle('backgroundColor','#CCC');
				oLink.setStyle('height','18px');
				oLink.setStyle('lineHeight','18px');
				oLink.setStyle('textAlign','right');
				oLink.setStyle('cursor','pointer');

				oDiv.appendChild(oLink);

				//设置内容
				var oDivContent=$(document.createElement('div'));
				oDivContent.setAttribute('id','divForOpenNewWindowContent',0);
				oDivContent.setStyle('padding','8px');

				var oTextWait=document.createTextNode('请稍候……');
				var oImg=document.createElement('img');
				oImg.setAttribute('src','/common/images/site/wait2009.gif',0);
				oImg.setAttribute('width','64',0);
				oImg.setAttribute('height','64',0);
				oImg.setAttribute('border','0',0);
				var oBr=document.createElement('br');
				var oP=$(document.createElement('p'));
				oP.appendChild(oTextWait);
				oP.appendChild(oBr);
				oP.appendChild(oImg);
				oP.setStyle('textAlign','center');
				oDivContent.appendChild(oP);

				if(height!=null && blnScroll){
					oDivContent.setStyle('width',(width-24)+'px');
					oDivContent.setStyle('height',(height-25)+'px');
				}

				oDiv.appendChild(oDivContent);


				//获得页面内容
				var objHtp=this.htp();
				addEvent(objHtp,'readystatechange',function(){
					if(objHtp.readyState==4){
						var c=objHtp.responseText;
						objHtp=null;
						oDivContent.innerHTML=c;

						//设置焦点
						if(firstFocusElement){
							if(typeof(firstFocusElement)=='string'){
								$(firstFocusElement).focus();
							}
							else{
								firstFocusElement.focus();
							}
						}
					}
				},false);
				objHtp.open('get',url,true);
				objHtp.send(null);
			}

		//遮罩，返回等待遮罩层对象
		objRemoteAccess.prototype.mask=function ()
			{
				//debugger;
				var oBody=g.body();
				var oDiv=document.createElement('div');
				oDiv=$(oDiv);
				oDiv.setStyle('position','absolute');
				//oDiv.setStyle('backgroundColor','#FFF');
				//oDiv.setStyle('filter','alpha(opacity=80)');
				//oDiv.setStyle('opacity','0.5');
				oDiv.setStyle('left','0');
				oDiv.setStyle('top','0');
				//oDiv.setStyle('width',(document.documentElement.scrollLeft+document.documentElement.offsetWidth)+'px');
				oDiv.setStyle('width',oBody.offsetWidth+'px');
				//oDiv.setStyle('height',(document.documentElement.scrollTop+document.documentElement.offsetHeight)+'px');
				oDiv.setStyle('height',oBody.offsetWidth+'px');
				oDiv.setStyle('zIndex',oBody.childMaxZIndex()+1);
				oBody.appendChild(oDiv);

				var oDivSub=document.createElement('div');
				oDivSub=$(oDivSub);
				oDivSub.setStyle('position','absolute');
				oDivSub.setStyle('backgroundColor','#FFF');
				oDivSub.setStyle('filter','alpha(opacity=80)');
				oDivSub.setStyle('opacity','0.5');
				oDivSub.setStyle('left','0');
				oDivSub.setStyle('top','0');
				oDivSub.setStyle('width','100%');
				oDivSub.setStyle('height','100%');
				oDiv.appendChild(oDivSub);

				var oImg=document.createElement('img');
				oImg=$(oImg);
				oImg.setAttribute('src','/common/images/site/wait2009.gif',0);
				oImg.setAttribute('width','64px',0);
				oImg.setAttribute('height','64px',0);
				oImg.setAttribute('border','0',0);
				oImg.setStyle('position','absolute');

				oImg.setStyle('left',(oBody.scrollLeft+(oBody.offsetWidth-64)/2)+'px');
				oImg.setStyle('top',(document.documentElement.scrollTop+(document.documentElement.offsetHeight-64)/2)+'px');
				oDiv.appendChild(oImg);

				return oDiv;
			}

		//遮罩，返回普通遮罩层对象
		objRemoteAccess.prototype.maskCommon=function ()
			{
				//debugger;
				var oBody=g.body();
				var oDiv=document.createElement('div');
				oDiv=$(oDiv);
				oDiv.setStyle('position','absolute');
				oDiv.setStyle('backgroundColor','#FFF');
				oDiv.setStyle('filter','alpha(opacity=60)');
				oDiv.setStyle('opacity','0.5');
				oDiv.setStyle('left','0');
				oDiv.setStyle('top','0');
				//debugger;
				oDiv.setStyle('width',oBody.offsetWidth+'px');
				oDiv.setStyle('height',oBody.offsetHeight+'px');
				oDiv.setStyle('zIndex',oBody.childMaxZIndex()+1);
				oBody.appendChild(oDiv);

				return oDiv;
			}
	//与远端通信的类结束

//页面加载后执行
;
(
	function ()
		{
			if(g.blnDealMenu){return;}
			try {
				document.documentElement.doScroll('left');
			}
			catch (e) {
				setTimeout(arguments.callee,10);
				return;
			}
			g.blnDealMenu=true;
			$f(2);
		}
)();

addEvent(window,'load',function()
	{
		//如果有urlMenu对象，则设置该对象的事件
		if(g.blnDealMenu==false){
			g.blnDealMenu=true;
			$f(2);
		}
		//如果有form表单中的项目存在spanText，则当focus时，变化spanText的表现形式
		$f(6);
		//focus某些input
		$f(7);
		//修正img对象中className包含visual的大小
		$f(8);
		//如果页面存在着页首标题，则在加载完毕后去掉
		var oPageTitle=$('h1PageTitle');
		if(oPageTitle){oPageTitle.parentNode.removeChild(oPageTitle);}
		var oWareName=$('h1WareName');
		var oWareInfo=$('divWareExplain');
		if(oWareName){oWareName.parentNode.removeChild(oWareName);}
		if(oWareInfo){oWareInfo.parentNode.removeChild(oWareInfo);}
		//如果当前页面有启动函数，则执行启动函数
		if(self.htOnLoad){htOnLoad();}
	},false);