/*首页导航条商城换链接及后加统计代码*/

$(document).ready(function(){
	$("#naviBar a").eq(2).attr("href","http://rd.cnzz.com/rd.htm?id=11949&r=http%3A%2F%2Fwww.cnjiaju.com%2Fstore.php").after("<img src=\"http://si1.cnzz.com/stat.gif?id=11949\" border=\"0px\" width=\"0px\" height=\"0px\" style=\"vertical-align:top;\"/>");
});

function on_resize(){
	window.moveTo(-4,-4);
	window.resizeTo(screen.width+8,screen.height-20);
}

inputCheckObject = null ;
inputCheckError  = false ;

function input_check(obj,submitClick,mode)
{
	this_form = obj.form ;
	err = '' ;

	if ( ( obj.type=="select-one" || obj.type=="select-multiple" ) ) {
		if ( obj.notNull>0 && obj.options[obj.selectedIndex].value=='' ) {
			err = obj.formatDesc ? obj.formatDesc : "必须选择一项!" ;
		}
	}

	if ( obj.type=="radio" ) {
		var vt = inputValue_( obj ) ;
		if ( obj.notNull>0 && vt==''  ) {
			err = obj.formatDesc ? obj.formatDesc : "必须选择一项!" ;
		}
	}

	if ( obj.type=="text" || obj.type=="textarea" ) {
		if ( obj.value.match(".+") || obj.notNull == 1 || mode==1 ) {
			matches = obj.value.match("([^ ]+[ ]*)*[^ ]+") ;
			obj.value = matches ? matches[0] : '';

			if ( ( obj.fieldtype=="datetime" || obj.fieldtype=="date" ) && obj.value != 'yyyy-mm-dd' && obj.value != '0000-00-00' && obj.value != '0000-00-00 00:00:00' ) {
				if ( ! checkDate(obj.value) ) {
					err = "日期格式错误，请按\"年4位-月2位-日2位\"输入" ;
				}
			}

			if( obj.input_len > 0 && obj.value.length != obj.input_len) err = "必须输入"+obj.input_len+"位字符！" ;

			//alert(obj.name+obj.format) ;
			if ( obj.format && obj.format != '' && ( obj.notNull > 0 || obj.value!='' ) ) {
				matches = obj.value.match(obj.format) ;
				//if ( matches ) alert(matches[0]) ;
				if ( ( ! matches || matches[0] != obj.value ) && ( submitClick ) )
				err = obj.formatDesc ? obj.formatDesc : "格式错误!" ;
			}
		}
	}

	checkModify(obj) ;

	if ( err != '' ) {
		alert( err ) ;
		if ( ! inputCheckError && obj.visible ) obj.focus() ;
		inputCheckError = true ;
		return err ;
	} else {
		inputCheckError = false ;
		return err ;
	}
}
function checkDate(date)
{
	var dateRgx = /^(\d{4}|\d{2})([-./])(\d{1,2})([-./])(\d{1,2})( [0-2][0-9]:[0-5][0-9](:[0-5][0-9])?)?$/ ;
	ymd = date.match(dateRgx) ;
	if(String(ymd)=="null")   return false;

	y = ymd[1] ;
	m = ymd[3] ;
	d = ymd[5] ;

	oDate = new Date(parseInt(y),parseInt(m)-1,parseInt(d));
	var year = oDate.getYear() ;
	var month = oDate.getMonth()+1 ;
	var day = oDate.getDate() ;

	return ( year==y && month==m && day==d );
}

function inputValue_( input )
{
	type = input.type ;
	switch ( type ) {
		case "checkbox" :
		inputValue = input.checked ? input.value : 0 ;
		break ;
		case "select-one" :
		if ( input.selectedIndex==-1 || input.selectedIndex>input.options.length-1 || ! input.options[input.selectedIndex] )
		input.selectedIndex = 0 ;
		inputValue = input.options[input.selectedIndex].value ;
		break ;
		case "select-multiple" :
		inputValue = "" ;
		for(j=0; j<input.options.length; j++) {
			if ( input.options[j].selected && input.options[j].value) {
				inputValue += input.options[j].value+"|" ;
			}
		}
		if ( inputValue != "" ) inputValue = '|'+ inputValue ;
		break ;
		case "radio" :
		name = input.name ;
		form = input.form ;
		inputValue = "" ;
		if ( form[name].length ) {
			for( j=0; j<form[name].length; j++ ) {
				if ( form[name][j].checked ) inputValue = form[name][j].value ;
			}
		} else {
			if ( form[name].checked ) inputValue = form[name].value ;
		}
		break ;
		case "text" :
		if ( input.GeValue ) inputValue = input.GeValue ;
		else if ( input.value_prefix ) inputValue = input.value_prefix + input.value ;
		else inputValue = input.value ;
		break ;
		default :
		inputValue = input.value
	}
	return  inputValue ;
}

function setValue(input,value)
{
	type = input.type ;
	switch ( type ) {
		case "checkbox" :
		input.checked = (value==input.value || value.indexOf(','+input.value+',')!=-1)? 1 : 0 ;
		break ;
		case "radio" :
		name = input.name ;
		form = input.form ;
		if ( form[name][0] ) {
			for( j=0; j<form[name].length; j++ ) {
				if ( form[name][j].value == value ) form[name][j].checked=1 ;
			}
		} else {
			form[name].checked=1 ;
		}
		break ;
		case "text" :
		if ( input.value_prefix ) input.value = value.substr(input.value_prefix.length) ;
		else input.value = value ;
		break ;
		default :
		if ( input.geSelect==1 ) {
			tt = dymicSelect(input.previousSibling) ;
			tt.value = value ;
			dymicSelect( tt ) ;
		}
		input.value = value ;
	}
}

function getSideCell(object,cellNumber) {
	if ( ! cellNumber ) cellNumber = 8 ; //下格

	var pCell = obj.parentNode  ;
	while ( pCell.tagName != 'TD' ) pCell = pCell.parentNode ;

	pRow = pCell.parentNode ;
	pTable = pRow.parentNode ;

	for ( cellNo=0 ; pRow.cells[cellNo]!=pCell && cellNo<pRow.cells.length; cellNo++) ;
	for ( rowNo=0 ; pTable.rows[rowNo]!=pRow && rowNo<pTable.rows.length; rowNo++) ;

	if ( cellNumber > 6 && rowNo<pTable.rows.length-1 ) rowNo ++ ;
	else if ( cellNumber < 4 && rowNo>0 ) rowNo-- ;
	else if( cellNumber > 6 || cellNumber < 4 )  return false ;

	if ( cellNumber == 3 || cellNumber == 6 && cellNumber == 9 ) {
		if ( cellNo<pTable.rows[rowNo].cells.length-1 ) cellNo++ ;
		else return false ;
	}
	else if ( cellNumber == 1 || cellNumber == 4 && cellNumber == 7) {
		if ( cellNo>0 ) cellNo-- ;
		else return false ;
	}

	var obj1 = pTable.rows[rowNo].cells[cellNo].childNodes ;
	for ( i=0; i<obj1.length; i++ ) {
		if ( obj1[i].tagName=='INPUT' && obj1[i].type == obj.type ) return obj1[i] ;
	}
}

function hide_window()
{
	if ( parent.frames.length>0 ) {  //window.name == 'zygl_detail'
		if ( parent.document.all.zygl.cols != '*,0' ){
			i = parent.document.all.zygl.cols.match('\\*,([0-9]*)') ;
			i[1] *= 1 ;
			if ( i[1]>10 ) i[1]-=i[1]/3 ;
			else i[1]=0 ;
			parent.document.all.zygl.cols = '*,'+i[1] ;
			setTimeout("hide_window()",1) ;
		}
	} else  window.close() ;
}

function MM_findObj(n, d) { //v4.0
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
		if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
		for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
		if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_dragLayer(objName,x,hL,hT,hW,hH,toFront,dropBack,cU,cD,cL,cR,targL,targT,tol,dropJS,et,dragJS) { //v3.0
	//Copyright 1998 Macromedia, Inc. All rights reserved.
	var i,j,aLayer,retVal,curDrag=null,NS=(navigator.appName=='Netscape'), curLeft, curTop;
	if (!document.all && !document.layers) return false;
	retVal = true; if(!NS && event) event.returnValue = true;
	if (MM_dragLayer.arguments.length > 1) {
		curDrag = MM_findObj(objName); if (!curDrag) return false;
		if (!document.allLayers) { document.allLayers = new Array();
		with (document) if (NS) { for (i=0; i<layers.length; i++) allLayers[i]=layers[i];
		for (i=0; i<allLayers.length; i++) if (allLayers[i].document && allLayers[i].document.layers)
		with (allLayers[i].document) for (j=0; j<layers.length; j++) allLayers[allLayers.length]=layers[j];
		} else for (i=0;i<all.length;i++) if (all[i].style&&all[i].style.position) allLayers[allLayers.length]=all[i];}
		curDrag.MM_dragOk=true; curDrag.MM_targL=targL; curDrag.MM_targT=targT;
		curDrag.MM_tol=Math.pow(tol,2); curDrag.MM_hLeft=hL; curDrag.MM_hTop=hT;
		curDrag.MM_hWidth=hW; curDrag.MM_hHeight=hH; curDrag.MM_toFront=toFront;
		curDrag.MM_dropBack=dropBack; curDrag.MM_dropJS=dropJS;
		curDrag.MM_everyTime=et; curDrag.MM_dragJS=dragJS;
		curDrag.MM_oldZ = (NS)?curDrag.zIndex:curDrag.style.zIndex;
		curLeft= (NS)?curDrag.left:curDrag.style.pixelLeft; curDrag.MM_startL = curLeft;
		curTop = (NS)?curDrag.top:curDrag.style.pixelTop; curDrag.MM_startT = curTop;
		curDrag.MM_bL=(cL<0)?null:curLeft-cL; curDrag.MM_bT=(cU<0)?null:curTop -cU;
		curDrag.MM_bR=(cR<0)?null:curLeft+cR; curDrag.MM_bB=(cD<0)?null:curTop +cD;
		curDrag.MM_LEFTRIGHT=0; curDrag.MM_UPDOWN=0; curDrag.MM_SNAPPED=false; //use in your JS!
		document.onmousedown = MM_dragLayer; document.onmouseup = MM_dragLayer;
		if (NS) document.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
	} else {
		var theEvent = ((NS)?objName.type:event.type);
		if (theEvent == 'mousedown') {
			var mouseX = (NS)?objName.pageX : event.clientX + document.body.scrollLeft;
			var mouseY = (NS)?objName.pageY : event.clientY + document.body.scrollTop;
			var maxDragZ=null; document.MM_maxZ = 0;
			for (i=0; i<document.allLayers.length; i++) { aLayer = document.allLayers[i];
			var aLayerZ = (NS)?aLayer.zIndex:aLayer.style.zIndex;
			if (aLayerZ > document.MM_maxZ) document.MM_maxZ = aLayerZ;
			var isVisible = (((NS)?aLayer.visibility:aLayer.style.visibility).indexOf('hid') == -1);
			if (aLayer.MM_dragOk != null && isVisible) with (aLayer) {
				var parentL=0; var parentT=0;
				if (!NS) { parentLayer = aLayer.parentElement;
				while (parentLayer != null && parentLayer.style.position) {
					parentL += parentLayer.offsetLeft; parentT += parentLayer.offsetTop;
					parentLayer = parentLayer.parentElement; } }
					var tmpX=mouseX-(((NS)?pageX:style.pixelLeft+parentL)+MM_hLeft);
					var tmpY=mouseY-(((NS)?pageY:style.pixelTop +parentT)+MM_hTop);
					var tmpW = MM_hWidth;  if (tmpW <= 0) tmpW += ((NS)?clip.width :offsetWidth);
					var tmpH = MM_hHeight; if (tmpH <= 0) tmpH += ((NS)?clip.height:offsetHeight);
					if ((0 <= tmpX && tmpX < tmpW && 0 <= tmpY && tmpY < tmpH) && (maxDragZ == null
					|| maxDragZ <= aLayerZ)) { curDrag = aLayer; maxDragZ = aLayerZ; } } }
					if (curDrag) {
						document.onmousemove = MM_dragLayer; if (NS) document.captureEvents(Event.MOUSEMOVE);
						curLeft = (NS)?curDrag.left:curDrag.style.pixelLeft;
						curTop = (NS)?curDrag.top:curDrag.style.pixelTop;
						MM_oldX = mouseX - curLeft; MM_oldY = mouseY - curTop;
						document.MM_curDrag = curDrag;  curDrag.MM_SNAPPED=false;
						if(curDrag.MM_toFront) {
							eval('curDrag.'+((NS)?'':'style.')+'zIndex=document.MM_maxZ+1');
							if (!curDrag.MM_dropBack) document.MM_maxZ++; }
							retVal = false; if(!NS) event.returnValue = false;
					} } else if (theEvent == 'mousemove') {
						if (document.MM_curDrag) with (document.MM_curDrag) {
							var mouseX = (NS)?objName.pageX : event.clientX + document.body.scrollLeft;
							var mouseY = (NS)?objName.pageY : event.clientY + document.body.scrollTop;
							newLeft = mouseX-MM_oldX; newTop  = mouseY-MM_oldY;
							if (MM_bL!=null) newLeft = Math.max(newLeft,MM_bL);
							if (MM_bR!=null) newLeft = Math.min(newLeft,MM_bR);
							if (MM_bT!=null) newTop  = Math.max(newTop ,MM_bT);
							if (MM_bB!=null) newTop  = Math.min(newTop ,MM_bB);
							MM_LEFTRIGHT = newLeft-MM_startL; MM_UPDOWN = newTop-MM_startT;
							if (NS) {left = newLeft; top = newTop;}
							else {style.pixelLeft = newLeft; style.pixelTop = newTop;}
							if (MM_dragJS) eval(MM_dragJS);
							retVal = false; if(!NS) event.returnValue = false;
						} } else if (theEvent == 'mouseup') {
							document.onmousemove = null;
							if (NS) document.releaseEvents(Event.MOUSEMOVE);
							if (NS) document.captureEvents(Event.MOUSEDOWN); //for mac NS
							if (document.MM_curDrag) with (document.MM_curDrag) {
								if (typeof MM_targL =='number' && typeof MM_targT == 'number' &&
								(Math.pow(MM_targL-((NS)?left:style.pixelLeft),2)+
								Math.pow(MM_targT-((NS)?top:style.pixelTop),2))<=MM_tol) {
									if (NS) {left = MM_targL; top = MM_targT;}
									else {style.pixelLeft = MM_targL; style.pixelTop = MM_targT;}
									MM_SNAPPED = true; MM_LEFTRIGHT = MM_startL-MM_targL; MM_UPDOWN = MM_startT-MM_targT; }
									if (MM_everyTime || MM_SNAPPED) eval(MM_dropJS);
									if(MM_dropBack) {if (NS) zIndex = MM_oldZ; else style.zIndex = MM_oldZ;}
									retVal = false; if(!NS) event.returnValue = false; }
									document.MM_curDrag = null;
						}
						if (NS) document.routeEvent(objName);
	} return retVal;
}


function changeBlockDisplay(ID)
{
	if ( document.all[ID].style.display == 'none' ) {
		document.all[ID].style.display = 'block' ;
	} else
	document.all[ID].style.display = 'none' ;
}

var switch_movement = 0;
function onKeyDownArrowsHandler(e) {
	e = e||window.event;
	var o = (e.srcElement||e.target);
	if (!o) return;
	if (o.tagName != "TEXTAREA" && o.tagName != "INPUT" && o.tagName != "SELECT") return;
	if ( o.tagName != "TEXTAREA" && ! o.keepEnter && e.keyCode == 13 ) {
		event.keyCode=9 ; return ;
	}
	if (navigator.userAgent.toLowerCase().indexOf('aplewebkit/') != -1) {
		if (e.ctrlKey || e.shiftKey || !e.altKey) return;
	} else {
		if ( ( ! e.ctrlKey || e.shiftKey || e.altKey ) && ! ( o.tagName != "TEXTAREA" &&( e.keyCode == 38 || e.keyCode == 40  ) )) return;
	}
	if ( !o.id ) return;

	var pos = o.id.split("_");
	//if ( pos[0] != "field" || typeof pos[2] == "undefined") return;
	if ( typeof pos[2] == "undefined") return;

	var x = pos[2], y=pos[1];

	// skip non existent fields
	for (i=0; i<10; i++)
	{
		if (switch_movement) {
			switch(e.keyCode) {
				case 38: x--; break; // up
				case 40: x++; break; // down
				case 37: y--; break; // left
				case 39: y++; break; // right
				default: return;
			}
		} else {
			switch(e.keyCode) {
				case 38: y--; break; // up
				case 40: y++; break; // down
				case 37: x--; break; // left
				case 39: x++; break; // right
				default: return;
			}
		}

		var id = pos[0] + "_" + y + "_" + x;
		var nO = document.getElementById(id);
		if (!nO) {
			var id = pos[0] + "_" + y + "_" + x + "_0";
			var nO = document.getElementById(id);
		}
		if (nO) break;
	}

	if (!nO) return;
	nO.focus();
	if (nO.tagName != 'SELECT') {
		nO.select();
	}
	e.returnValue = false;
}

function resourceHelp(resClass) {
	window.open('run_script.php?script_file_name=qaa.php&keys='+resClass,'resourceHelp','scrollbars,resizeable') ;
}

function showOnlineTopic(obj) {
	if ( typeof(obj)=='undefined' || typeof(obj.OnlineTopic)=='undefined' || obj.OnlineTopic == '' ){
		return hideOnlineTopic() ;
	}

	if ( event.type=='d' ) {
	} else {
		hideOnlineTopic() ;

		if ( pan1 = document.getElementById('OnlineTopicPanInnerBody') ) {
			pan1.innerHTML = obj.OnlineTopic ;
			//alert(pan1.clientHeight) ;
		}
		if ( pan = document.getElementById('OnlineTopicPanClosed') ) {
			if ( event.clientX < document.body.clientWidth/2 || document.body.clientWidth-event.clientX > 250 ) {
				pan.id = 'OnlineTopicPanLeft' ;
				moveLayer(pan,7) ;
			} else {
				pan.id = 'OnlineTopicPanRight' ;
				moveLayer(pan,9) ;
			}
		}
		if ( pan1 = document.getElementById('OnlineTopicPanInnerBody') ) {
			pan1.innerHTML = obj.OnlineTopic ;
			//alert(pan1.clientHeight) ;
		}
	}
}
function hideOnlineTopic(obj) {
	if ( (pan = document.getElementById('OnlineTopicPanLeft') ) || ( pan = document.getElementById('OnlineTopicPanRight') ) ) {
		pan.id = 'OnlineTopicPanClosed' ;
		moveLayer(pan,7,-500,-500) ;
		return true ;
	} else return false ;
}

function moveLayer(layer,conner,x,y) {
	if ( ! y ) y = event.clientY ;
	if ( ! x ) x = event.clientX ;

	y0 = y + document.body.scrollTop ;
	x0 = x + document.body.scrollLeft ;

	if ( conner >= 7 ) {
		y0 -= layer.clientHeight ;
	} else if ( conner >= 4 ) {
		y0 -= layer.clientHeight/2 ;
	}
	if ( conner % 3 == 0 ) {
		x0 -= layer.clientWidth ;
	} else if ( conner % 3 == 2 ) {
		x0 -= layer.clientWidth/2 ;
	}
	if ( y>0 ) {  //不是为了隐藏该层
		if ( y0<0 ) y0=0 ;
		if ( x0<0 ) x0=0 ;
	}

	layer.style.pixelTop = y0 ;
	layer.style.pixelLeft = x0 ;
}

function dynamicForm(action1,target1,name1,eles) {
	area = document.getElementById('dynamicDataPostForm') ;

	str = "<form action=\""+action1+"\" name=\""+name1+"\" method=post>" ;
	for ( i=0; i<eles.length; i++ ) {
		str += "<input type=hidden name=\""+eles[i][0]+"\" value=\""+eles[i][1]+"\">" ;
	}
	str += "</form>" ;
	area.innerHTML = str ;
	if ( target1 ) document.all[name1].target = target1 ;
}

function optionCardActive(obj)
{
	var idInfo = obj.sectionId.split(":") ;

	var secTable = document.getElementById(idInfo[0]+'Header') ;
	for ( i=1; i<secTable.cells.length-1; i++ ) {
		if ( secTable.cells[i] == obj ) {
			secTable.cells[i].className = secTable.activeStyle ;
			secTable.cells[i-1].className = secTable.activeIconStyle ;
		} else {
			if ( i%2==1 )
			secTable.cells[i].className = secTable.deactiveIconStyle ;
			else secTable.cells[i].className = secTable.deactiveStyle ;
		}
	}

	var mainTable = document.getElementById(idInfo[0]+'Board') ;
	for( i=0; i<mainTable.tBodies.length-1; i++ ) {
		if ( i == idInfo[1] ) {
			mainTable.tBodies[i].style.display = "block" ;
		}
		else {
			mainTable.tBodies[i].style.display = "none";
		}
	}
}

function getData ( obj,URL ) {
	//alert(URL) ;
	document.getElementById('geDataScript').src=URL ;
	//obj.innerHTML=URL ;
}

function reUrl(name,value,url,go) {
	if ( typeof(name)=='undefined' || name=='' ) return false;
	var enUrl = operation = '';
	switch (name.substr(0,1)) {
		case '-' : operation = '-'; name = name.substr(1); break;
		case '+' : operation = '+'; name = name.substr(1); break;
		default :  operation = '+'; break;
	}

	if ( typeof(url)== 'undefined' || url =='' || ! url  ) url=window.location.href;
	if ( url.indexOf('?')== -1 ) url+='?';

	//url = unescape(url);
	var urlArr = url.substr(url.indexOf('?')+1).split('&');
	var swap = new Array();

	if ( name.indexOf(',') != -1 ){
		name = name.split(',');
		value= value.split(',');
	}

	for (i=0;i<urlArr.length;i++){
		switch (operation) {
			case '+' :
			if ( typeof(name)=='string' ){
				if (urlArr[i].indexOf(name+'=')!=-1){
					urlArr[i] = name+'='+value;
					swap[0] = true;
				}
				if ( !swap[0] && i==urlArr.length-1) urlArr[urlArr.length]=name+'='+value
			} else {
				if (name.length != value.length) return false;
				for (j=0;j<name.length;j++){
					if (urlArr[i].indexOf(name[j]+'=')!=-1){
						urlArr[i]= name[j]+'='+value[j];
						swap[j]=true;
					}
				}
				if (i==urlArr.length-1) {
					for (k=0;k<name.length;k++){
						if  (!swap[k]) urlArr[urlArr.length++] = name[k]+'='+value[k];
					}
				}
			}
			break;
			case '-' :
			if ( typeof(name)=='string' ){
				if (urlArr[i].indexOf(name+'=')!=-1) urlArr.splice(i,1);
			} else {
				for (j=0;j<name.length;j++){
					if ( typeof(urlArr[i])=='undefined' ) break;
					if (urlArr[i].indexOf(name[j]+'=')!=-1) urlArr.splice(i,1);
				}
			}
			break;
		}
	}

	if (typeof(go)=='undefined' || go=='' || go==null){
		return url.substr(0,url.indexOf('?')+1)+urlArr.join('&');
	} else {
		url = url.substr(0,url.indexOf('?')+1)+urlArr.join('&');

		if ( typeof(go)=='number'){
			switch (go){
				case 0 : window.open(url,'_blank'); break;
				case 2 : window.open(url,'_parent');break;
				case 3 : window.open(url,'_top');	break;
				case 1 : window.open(url,'_self');  break;
			}
		} else {
			window.open(url,go);
		}
	}
}
var ___count=0;
function secondToTime(obj,second,wrap){

	if ( typeof(wrap) == 'undefined' || wrap==null || wrap=='undefined' )  wrap='';

	obj = document.getElementById(obj);
	second = second - ___count;

	if (second >= 0 ){
		sec = second%60
		min = parseInt(second/60%60);
		hou = parseInt((second/60/60)%24);
		day = parseInt((second/60/60/24));
		timeStr = day+'天'+hou+'小时'+wrap+min+'分'+sec+'秒';
	} else {
		timeStr = '交易结束';
	}
	obj.innerHTML = timeStr;
	___count++
}
function secondToTimeChange(obj,second,wrap){
	window.setInterval('secondToTime("'+obj+'",'+second+',"'+wrap+'")',1000);
}

function searchByGet(form,URL,window) {
	for (i=0; i<form.length; i++ ) {
		if ( form.elements[i].name && names.indexOf(form.elements[i].name)==-1 ) {
			names = names+','+form.elements[i].name ;
			values = values+','+inputValue_(form.elements[i].name) ;
		}
	}
	alert(names+values) ;
	reUrl(names,values,'',1) ;

}

/* URL 处理*/
function QueryString()
{
	var name,value,i;
	var str=location.href;
	var num=str.indexOf("?")
	str=str.substr(num+1);
	var arrtmp=str.split("&");
	for(i=0;i < arrtmp.length;i++){
		num=arrtmp[i].indexOf("=");
		if(num>0){
			name=arrtmp[i].substring(0,num);
			value=arrtmp[i].substr(num+1);
			this[name]=value;
		}
	}
}
var GERequestArr=new QueryString();

/* COOKIE */
function SetCookie(name,value,expires,path,domain,secure) 
{
	var expDays = expires*24*60*60*1000;
	var expDate = new Date();
	expDate.setTime(expDate.getTime()+expDays);
	var expString = ((expires==null) ? "" : (";expires="+expDate.toGMTString()))
	var pathString = ((path==null) ? "" : (";path="+path))
	var domainString = ((domain==null) ? "" : (";domain="+domain))
	var secureString = ((secure==true) ? ";secure" : "" )
	document.cookie = name + "=" + escape(value) + expString + pathString + domainString + secureString;
}

function GetCookie(name)
{
	var result = null;
	var myCookie = document.cookie + ";";
	var searchName = name + "=";
	var startOfCookie = myCookie.indexOf(searchName);
	var endOfCookie;
	if (startOfCookie != -1)
	{
		startOfCookie += searchName.length;
		endOfCookie = myCookie.indexOf(";",startOfCookie);
		result = decodeURIComponent(myCookie.substring(startOfCookie, endOfCookie));
		//result = myCookie.substring(startOfCookie, endOfCookie);
	}
	return result;
}

function ClearCookie(name)
{
	var ThreeDays=3*24*60*60*1000;
	var expDate = new Date();
	expDate.setTime(expDate.getTime()-ThreeDays);
	document.cookie=name+"=;expires="+expDate.toGMTString();
}

/* 利用cookie处理登录条 */
function logonBar()
{
	var userId = GetCookie('userId') ;
	var userName = GetCookie('userName') ;
	var userType = GetCookie('userType') ;
	//alert( document.cookie) ;
	var html = null ;
	if ( userId && userName && userType ) {
		html = '<div class="left_gray">' + userName+'， 中国家具网欢迎您。【<a href="" onClick="logoff()">退出</a>】 | <a href="myhome.php?method=management">我的账户</a></div><div class=\"right_gray\"><a onclick="pageRecommend();">介绍好友得积分</a> | <a onClick=\"window.external.AddFavorite(window.location,document.title);\" >收藏本站</a></div>' ;
	} else {
		html = '<div class="left_gray">登录名<input name=userName id=userName> 密码<input type=password id=password name=password> <input type=button id=logonButton onClick="logon(userName.value,password.value);">'
			+  ' <a onClick="showGetPassword()">找回密码</a> | <a onClick="showRegister()">注册得积分</a> </div><div class=\"right_gray\"><a>介绍好友得积分</a> | <a onClick=\"window.external.AddFavorite(window.location,document.title);\" >收藏本站</a</div>';
	}
	document.getElementById("logonBar").innerHTML = html ; //+ "<div class=\"right_gray\"><a>介绍好友得积分</a> | <a onClick=\"window.external.AddFavorite(window.location,document.title);\" >收藏本站</a></div>" ;
}

function logon(userName,password){
	document.getElementById('dynamicScript').src= "/dynamicScript.php?method=logon&userName="+encodeURIComponent(userName)+'&password='+encodeURIComponent(password) ;
}

function logoff(){
	ClearCookie('userId') ;
	ClearCookie('userName') ;
	ClearCookie('userType') ;
	logonBar() ;
}

function showRegister() {
	showFloatLayer('',458,500); 
	
	cDiv = document.getElementById("floatLayerContent") ;
	cDiv.style.textAlign = 'left' ;
	var innerHTML = '<form id=registerForm><div style="margin:36px 0px 8px 16px;font-size:18px;font-weight:bold">欢迎注册中国家具网</div>' ;
	innerHTML += '<hr class=line style="margin:4px 18px 4px 18px;"/>' ;
	innerHTML += '<div style="margin:8px;width:100%"><div class=regCapt>您的 Email：</div><div style="width:0px"><input name="email" dataType="Email" require="true" msg="请填写合法的电子邮件地址"></div></div>' ;
	innerHTML += '<div style="margin:8px"><div class=regCapt>请设置您的密码：</div><div><input type=password name="password" dataType="Require" msg="口令必须填写" ></div></div>' ;
	innerHTML += '<div style="margin:8px;"><div class=regCapt>再输入一次密码：</div><div><input type=password name="confirmPassword" dataType="Repeat" require="true" to="password" msg="两次输入的密码不一致" ></div></div>' ;
	innerHTML += '<hr class=line style="margin:4px 18px 4px 18px;"/>' ;
	innerHTML += '<div style="margin:8px"><div class=regCapt>您的姓名：</div><div><input name="userName" dataType="Require" msg="真实姓名必须填写"></div></div>' ;
	innerHTML += '<div style="margin:8px"><div class=regCapt>性别：</div><div><input type="radio" name="sex" value="男" checked/>男 <input type="radio" name="sex" value="女" />女</div></div>' ;
	innerHTML += '<div style="margin:8px"><div class=regCapt>身份：</div><div><input type="radio" name="userType" value="消费者" checked/>消费者 <input type="radio" name="userType" value="设计师" />设计师 </div></div>' ;
	innerHTML += '<div style="margin:8px"><div class=regCapt>地区：</div><div><input name=area dataType="Require" msg="所在城市必须填写"></div></div>' ;
	innerHTML += '<hr class=line style="margin:4px 18px 4px 18px;"/>' ;
	innerHTML += '<div style="margin:8px"><div class=regCapt>验证码：</div><div><input size=10 name=checkCode dataType="Require" msg="请输入验证码，看不清请点击验证码图片更换验证码。"> <img valign=absmiddle src="/checkCode.php"></div></div>' ;
	innerHTML += '<div style="margin:8px;margin-top:18px;text-align:center;width:100%"><input type=button value="同意服务条款，立即注册" onClick="if(Validator.Validate(this.form,1)) registerIt(this.form);"></div>' ;
	innerHTML += '<div style="margin:8px;margin-top:18px;;text-align:center;width:100%"> <a href="/reg.html">中国家具网服务及隐私保护协议</a> <a onClick="hideFloatLayer();">【放弃】</a></div>' ;
	innerHTML += '</form>' ;
	cDiv.innerHTML = innerHTML ;
	
}
function registerIt(form) {
	var url = '/dynamicScript.php?method='+encodeURIComponent("register") ;
	if ( form.email ) url += "&email="+encodeURIComponent(form.email.value) ;
	if ( form.password ) url += "&password="+encodeURIComponent(form.password.value) ;
	if ( form.sex ) url += "&sex="+encodeURIComponent(inputValue_(form.sex[0])) ;
	if ( form.userType[0] ) url += "&userType="+encodeURIComponent(inputValue_(form.userType[0])) ;
	if ( form.userName ) url += "&userName="+encodeURIComponent(form.userName.value) ;
	if ( form.area ) url += "&area="+encodeURIComponent(form.area.value) ;
	if ( form.checkCode ) url += "&checkCode="+encodeURIComponent(form.checkCode.value) ;
	
	//form.innerHTML += url ;
	document.getElementById('dynamicScript').src= url ;
}
/*展会预定门票ticket*/
function showTicket(id,title) {
	showFloatLayer('',458,500); 
	cDiv = document.getElementById("floatLayerContent") ;
	cDiv.style.textAlign = 'left' ;
	var innerHTML = '<form id=registerForm><div style="margin:36px 0px 8px 16px;font-size:18px;font-weight:bold">'+title+'预定门票</div>' ;
	innerHTML += '<hr class=line style="margin:4px 18px 4px 18px;"/>' ;
	innerHTML += '<div style="margin:8px;width:100%"><div class=regCapt>预定票数：</div><div style="width:0px"><input name="number" dataType="Require" msg="预定票数必须填写"><input name="exhibitionId" type="hidden" value='+id+'></div></div>' ;
	innerHTML += '<div style="margin:8px"><div class=regCapt>您的姓名：</div><div><input name="userName" dataType="Require" msg="真实姓名必须填写"></div></div>' ;
	innerHTML += '<div style="margin:8px"><div class=regCapt>联系电话：</div><div ><input name="phone" dataType="Require" require="true" msg="请填写您的联系电话"></div></div>' ;
	innerHTML += '<hr class=line style="margin:4px 18px 4px 18px;"/>' ;
	innerHTML += '<div style="margin:8px"><div class=regCapt>您的 Email：</div><div ><input name="email" dataType="Require" require="true" msg="请填写合法的电子邮件地址"></div></div>' ;
	innerHTML += '<div style="margin:8px"><div class=regCapt>联系地址：</div><div><input name=area dataType="Require" msg="您的联系地址必须填写"></div></div>' ;
	innerHTML += '<hr class=line style="margin:4px 18px 4px 18px;"/>' ;
	innerHTML += '<div style="margin:8px"><div class=regCapt>验证码：</div><div><input size=10 name=checkCode dataType="Require" msg="请输入验证码，看不清请点击验证码图片更换验证码。"> <img valign=absmiddle src="/checkCode.php"></div></div>' ;
	innerHTML += '<div style="margin:8px;margin-top:18px;text-align:center;width:100%"><input type=button value="确认填写，我要订票！" onClick="if(Validator.Validate(this.form,1)) getExhibitionTicket(this.form);"></div>' ;
	innerHTML += '<div style="margin:8px;margin-top:18px;;text-align:center;width:100%"> <a href="/">中国家具网竭诚为您服务</a> <a onClick="hideFloatLayer();">【放弃】</a></div>' ;
	innerHTML += '</form>' ;
	cDiv.innerHTML = innerHTML ;
	
}
/*产品大图*/
function largePicture(organization,id){
	showFloatLayer('',660,460); 
	cDiv = document.getElementById("floatLayerContent") ;
	cDiv.style.textAlign = 'center' ;
	var innerHTML = '<img src="http://www.cnjiaju.com/uploadFiles/'+organization+'/content_pictures.'+id+'.file.JPG" height="428px">' ;
	innerHTML += '<div style="margin:8px;margin-top:18px;;text-align:center;width:100%"> <a href="/">中国家具网竭诚为您服务</a> <a onClick="hideFloatLayer();">【关闭】</a></div>' ;
	cDiv.innerHTML = innerHTML ;
}
function getExhibitionTicket(form) {
	var url = '/dynamicScript.php?method='+encodeURIComponent("getExhibitionTicket") ;
	if ( form.exhibitionId ) url += "&exhibitionId="+encodeURIComponent(form.exhibitionId.value) ;	
	if ( form.number ) url += "&number="+encodeURIComponent(form.number.value) ;
	if ( form.userName ) url += "&userName="+encodeURIComponent(form.userName.value) ;
	if ( form.phone ) url += "&phone="+encodeURIComponent(form.phone.value) ;
	if ( form.email ) url += "&email="+encodeURIComponent(form.email.value) ;
	if ( form.area ) url += "&area="+encodeURIComponent(form.area.value) ;
	if ( form.checkCode ) url += "&checkCode="+encodeURIComponent(form.checkCode.value) ;
	
//	form.innerHTML += url ;
	document.getElementById('dynamicScript').src= url ;
}
/*展会我要参展*/
function partInExhibition(id,title) {
	showFloatLayer('',458,500); 
	cDiv = document.getElementById("floatLayerContent") ;
	cDiv.style.textAlign = 'left' ;
	var innerHTML = '<form id=registerForm><div style="margin:36px 0px 8px 16px;font-size:18px;font-weight:bold">我要参展：'+title+'</div>' ;
	innerHTML += '<hr class=line style="margin:4px 18px 4px 18px;"/>' ;
	innerHTML += '<div style="margin:8px;width:100%"><div class=regCapt>公司名称：</div><div style="width:0px"><input name="userName" dataType="Require" msg="公司名称必须填写"><input name="exhibitionId" type="hidden" value='+id+'></div></div>' ;
	innerHTML += '<div style="margin:8px"><div class=regCapt>经营范围：</div><div><input name="scope" dataType="Require" msg="经营范围必须填写"></div></div>' ;
	innerHTML += '<div style="margin:8px"><div class=regCapt>联系电话：</div><div ><input name="phone" dataType="Require" require="true" msg="请填写您公司的联系电话"></div></div>' ;
	innerHTML += '<hr class=line style="margin:4px 18px 4px 18px;"/>' ;
	innerHTML += '<div style="margin:8px"><div class=regCapt>公司Email：</div><div ><input name="email" dataType="Require" require="true" msg="请填写合法的电子邮件地址"></div></div>' ;
	innerHTML += '<div style="margin:8px"><div class=regCapt>联系地址：</div><div><input name=area dataType="Require" msg="公司的联系地址必须填写"></div></div>' ;
	innerHTML += '<hr class=line style="margin:4px 18px 4px 18px;"/>' ;
	innerHTML += '<div style="margin:8px"><div class=regCapt>验证码：</div><div><input size=10 name=checkCode dataType="Require" msg="请输入验证码，看不清请点击验证码图片更换验证码。"> <img valign=absmiddle src="/checkCode.php"></div></div>' ;
	innerHTML += '<div style="margin:8px;margin-top:18px;text-align:center;width:100%"><input type=button value="确认填写，我要参展！" onClick="if(Validator.Validate(this.form,1)) getExhibition(this.form);"></div>' ;
	innerHTML += '<div style="margin:8px;margin-top:18px;;text-align:center;width:100%"> <a href="/">中国家具网竭诚为您服务</a> <a onClick="hideFloatLayer();">【放弃】</a></div>' ;
	innerHTML += '</form>' ;
	cDiv.innerHTML = innerHTML ;
	
}

/*商户资质奖励*/
function showCertificate(title,file,message) {
	showFloatLayer('',550,650); 
	cDiv = document.getElementById("floatLayerContent") ;
	cDiv.style.textAlign = 'left' ;
	var innerHTML = '<form id=certificateForm><div style="margin:36px 0px 8px 16px;font-size:18px;font-weight:bold;text-align:center">'+title+'</div>' ;
	innerHTML += '<div style="margin:8px 60px 8px 60px;"><img src="'+file+'" border=0 width=430px height=570px></div>' ;
	innerHTML += '<div style="margin:8px 18px 8px 18px;width:90%">'+message+'</div>' ;
	innerHTML += '<div style="margin:8px;margin-top:18px;;text-align:center;width:100%"> <a href="/">中国家具网竭诚为您服务</a> <a onClick="hideFloatLayer();">【退出】</a></div>' ;
	innerHTML += '</form>' ;
	cDiv.innerHTML = innerHTML ;
	
}

/*管委会地图*/
function gwhFile(file){
	showFloatLayer('',609,549); 
	cDiv = document.getElementById("floatLayerContent") ;
	cDiv.style.textAlign = 'center' ;
//	 innerHTML = '<form id=certificateForm><div style="margin:36px 0px 8px 16px;font-size:18px;font-weight:bold;text-align:center">'+title+'</div>' ;
	var innerHTML = '<form id=certificateForm><div style="margin:20px;"><img src="/uploadFiles/'+file+'" border=0 width=569px height=489px></div>' ;
//	innerHTML += '<div style="margin:8px 18px 8px 18px;width:90%">'+message+'</div>' ;
	innerHTML += '<div style="margin:8px;margin-top:0px;;text-align:center;width:100%"> <a href="/">中国家具网-香河家具城竭诚为您服务</a> <a href="#" onClick="hideFloatLayer();" style="color:#ff3300">【退出】</a></div>' ;
	innerHTML += '</form>' ;
	cDiv.innerHTML = innerHTML ;	
	
}

function getExhibition(form) {
	var url = '/dynamicScript.php?method='+encodeURIComponent("getExhibition") ;
	if ( form.exhibitionId ) url += "&exhibitionId="+encodeURIComponent(form.exhibitionId.value) ;	
	if ( form.userName ) url += "&userName="+encodeURIComponent(form.userName.value) ;
	if ( form.scope ) url += "&scope="+encodeURIComponent(form.scope.value) ;
	if ( form.phone ) url += "&phone="+encodeURIComponent(form.phone.value) ;
	if ( form.email ) url += "&email="+encodeURIComponent(form.email.value) ;
	if ( form.area ) url += "&area="+encodeURIComponent(form.area.value) ;
	if ( form.checkCode ) url += "&checkCode="+encodeURIComponent(form.checkCode.value) ;
	
//	form.innerHTML += url ;
	document.getElementById('dynamicScript').src= url ;
}
/* 找回密码 */
function showGetPassword() {
	showFloatLayer('',400,228); 
	
	cDiv = document.getElementById("floatLayerContent") ;
	cDiv.style.textAlign = 'left' ;
	var innerHTML = '<form id=getPasswordForm ><div style="margin:8px;padding:8px;padding-top:18px;border-bottom:1px solid #999999;font-size:18px;font-weight:bolder">找回密码</div>' ;
	innerHTML += '<div style="width:100%;height:32px;line-height:32px"><font style="width:128px;text-align:right;float:left">您的 Email： </font><input name="email" dataType="Email" require="true" msg="请填写注册时使用的电子邮件地址"></div>' ;
	innerHTML += '<div style="width:100%;height:32px;line-height:32px"><font style="width:128px;text-align:right;float:left">验证码： </font><input size=10 name=checkCode dataType="Require" msg="请输入验证码，看不清请点击验证码图片更换验证码。"> <img valign=absmiddle src="/checkCode.php"></div>' ;
	innerHTML += '<div style="width:100%;text-align:center;margin-top:18px;line-height:px"><input type=button value="发送新口令" onClick="if(Validator.Validate(this.form,1)) getPassword(this.form);"></div>' ;
	innerHTML += '<div style="margin:8px;margin-top:18px;padding-left:72px"> <a href="/reg.html">中国家具网服务及隐私保护协议</a> <a onClick="hideFloatLayer();">【放弃】</a></div>' ;
	innerHTML += '</form>' ;
	cDiv.innerHTML = innerHTML ;
}
function getPassword(form) {
	var url = '/dynamicScript.php?method='+encodeURIComponent("getPassword") ;
	if ( form.email ) url += "&email="+encodeURIComponent(form.email.value) ;
	if ( form.checkCode ) url += "&checkCode="+encodeURIComponent(form.checkCode.value) ;
	
	//form.innerHTML += url ;
	document.getElementById('dynamicScript').src= url ;
}

/* 利用URL处理商品显示方式和排序控制 */
function productShowAndOrderBar()
{
	var userId = GetCookie('userId') ;
	var userName = GetCookie('userName') ;
	var userType = GetCookie('userType') ;
	var html = null ;
	if ( userId && userName && userType ) {
		html = "<div class=\"left_gray\">" + userName+"， 中国家具网欢迎您。</div>" ;
	} else {
		html = "<div class=\"left_gray\">登录名<input name=userName id=userName> 密码<input type=password id=password> <input type=button value=\"\"  id=logonButton onClick=\"\">"
			+  ' <a>找回密码</a> | <a onClick="showFloatLayer()">注册得积分</a> </div>';
	}
	document.getElementById("logonBar").innerHTML = html + "<div class=\"right_gray\"><a>介绍好友得积分</a> | <a onClick=\"window.external.AddFavorite(window.location,document.title);\" >收藏本站</a></div>" ;
}

function showCommentForm(messageId,messageType,count)
{ return;
	var userId = GetCookie('userId') ;
	var userName = GetCookie('userName') ;
	var userType = GetCookie('userType') ;
	//var html = '【<A href="/comments.php?c='+messageType+'_'+messageId+'">查看所有('+count+')条评论</A>】</div><div id=commentBody style="left_gray;width:100%;text-align:left""><form id="form"><textarea name="commentContent" rows="10" cols="60"></textarea><div style="float:center;width:100%"><input type="hidden" name=userId value="'+userId+'"><input type="hidden" name='+messageType+'Id value="'+messageId+'"><input type="hidden" name=messageType value="'+messageType+'">验证码：<input name="checkCode" style="font-size:12;padding:0px;font-weight:bold;font-family:Arial Black;width:48px;height:18px"><img src="checkCode.php" onclick="this.src=\'http://www.cnjiaju.com/checkCode.php\'" title="看不清请单击更换验证码" style="vertical-align:bottom">' ;
	var html = '【<A href="/comments.php?c='+messageType+'_'+messageId+'">查看所有('+count+')条评论</A>】</div><div id=commentBody style="left_gray;width:100%;text-align:left""><form id="form"><textarea name="commentContent" rows="10" cols="60"></textarea><div style="float:center;width:100%"><input type="hidden" name=userId value="'+userId+'"><input type="hidden" name='+messageType+'Id value="'+messageId+'"><input type="hidden" name=messageType value="'+messageType+'">验证码：<input name="checkCode" style="font-size:12;padding:0px;font-weight:bold;font-family:Arial Black;width:48px;height:18px"><img src="/checkCode.php" onclick="this.src=\'/checkCode.php\'" title="" 看不清请单击更换验证码 style="vertical-align:bottom">' ;

	if ( userId && userName && userType ) {
		html ='<div class="left_gray" id=commentTip style="margin-top:18px;width:100%;text-align:left;font-size:12px;font-weight:bold">网友评论: '+userName+'，欢迎你对本文章做出评价。' 
			+html+' <input type="button" name="Submit" value="提交" onClick="submitComment(this.form);" style="border:1px solid #666666; height:18px"></div></form></div>' ;
	} else {
		html ='<div class="left_gray" id=commentTip style="margin-top:18px;width:100%;text-align:left;font-size:12px;font-weight:bold">网友评论: 欢迎你对本文章做出评价。' 
			+html+' 登录名:<input name=userName id=userName style="width:68px;height:18px"> 密码:<input type=password name=password style="width:68px;height:18px"> <input type="checkbox" name="anonymous" value="1" onClick="if(this.checked) alert(\'登录后发表评论可以得到积分，能够兑换多种优惠卡，别错过哟！\')">匿名 <input type="button" name="Submit" value="提交" onClick="submitComment(this.form);" style="border:1px solid #666666; height:18px"></div></form></div>' ;
	}
	document.getElementById("commentForm").innerHTML = html  ;
}

function submitComment(form) 
{
		var url = '/dynamicScript.php?' ;
		url += "method="+encodeURIComponent("saveComment") ;
		if ( form.userId ) url += "&userId="+encodeURIComponent(form.userId.value) ;
		if ( form.userName ) url += "&userName="+encodeURIComponent(form.userName.value) ;
		if ( form.password ) url += "&password="+encodeURIComponent(form.password.value) ;
		url += "&checkCode="+encodeURIComponent(form.checkCode.value) ;
		if ( form.messageId ) url += "&messageId="+encodeURIComponent(form.messageId.value) ;
		if ( form.productId ) url += "&productId="+encodeURIComponent(form.productId.value) ;
		url += "&messageType="+encodeURIComponent(form.messageType.value) ;
		url += "&commentContent="+encodeURIComponent(form.commentContent.value) ;
		if ( form.anonymous ) url += "&anonymous="+encodeURIComponent(form.anonymous.checked?1:0) ;
		//form.commentContent.value = url ;
		document.getElementById('dynamicScript').src= url ;
}

function pageRecommend(){
	var clipBoardContent="";
	clipBoardContent += document.title;
	clipBoardContent += "\r\n";
	var url = window.location.href ;
	if ( url.indexOf('?') != -1 ) 
		url += '&MID='+ GetCookie('userId');
	else url += '?MID='+ GetCookie('userId');
	clipBoardContent += url ;
	window.clipboardData.setData("Text",clipBoardContent);
	alert("复制成功，请粘贴到您的QQ/MSN上推荐给您的好友。好友据此访问会给你加分哦！");
}
function friendlinkcopyW(){
	var clipBoardContent="";
	clipBoardContent += document.getElementById('friend1').value;
	clipBoardContent += "\r\n";
	window.clipboardData.setData("Text",clipBoardContent);
	alert("复制成功，请粘贴到您网站友情链接的文字链接处。");
}
function friendlinkcopyT(){
	var clipBoardContent="";
	clipBoardContent += document.getElementById('friend2').value;
	clipBoardContent += "\r\n";
	window.clipboardData.setData("Text",clipBoardContent);
	alert("复制成功，请粘贴到您网站友情链接的图片链接处。");
}
function pageRecommendUrl(){
	var url = window.location.href ;
	if ( url.indexOf('?') != -1 ) 
		url += '&MID='+ GetCookie('userId');
	else url += '?MID='+ GetCookie('userId');
	return url ;
}


// FloatLayer process
function showFloatLayer(method,width,height) {
	aDiv = document.getElementById("floatLayerFrame") ;
	aDiv.style.left = 0 ;
	aDiv.style.top = document.body.scrollTop; //0 ;
	aDiv.style.position = "absolute" ;
	aDiv.style.height = document.body.clientHeight ;
	aDiv.style.width = document.body.clientWidth ;
	aDiv.style.backgroundColor = "#003366";
	aDiv.style.filter = "alpha(opacity=66)"; aDiv.style.MozOpacity = "0.33";
	aDiv.style.display = "" ;
	
	bDiv = document.getElementById("floatLayerShadow") ;
	bDiv.style.height = height ;
	bDiv.style.width = width ;
	bDiv.style.top = document.body.scrollTop+(document.body.clientHeight-height)/2+12;
	bDiv.style.left = (document.body.clientWidth-width)/2+12;
	bDiv.style.backgroundColor = "#003366";
	bDiv.style.filter = "alpha(opacity=44)"; aDiv.style.MozOpacity = "0.33";
	bDiv.style.display = "" ;
	
	cDiv = document.getElementById("floatLayerContent") ;
	cDiv.style.top = document.body.scrollTop+(document.body.clientHeight-height)/2;
	cDiv.style.left = (document.body.clientWidth-width)/2 ;
	cDiv.style.height = height ;
	cDiv.style.width = width ;
	cDiv.style.padding = 6 ;
	cDiv.style.display = "" ;
	cDiv.innerHTML = '' ;
	
	window.attachEvent('onscroll',centerFloatLayer) ;
	if ( method ) document.getElementById('dynamicScript').src= '/dynamicScript.php?method='+method+'&div=floatLayerContent' ;
}

function centerFloatLayer() {
    //alert(document.body.scrollTop) ;
	aDiv = document.getElementById("floatLayerFrame") ;
	aDiv.style.top = document.body.scrollTop*1 ;
	aDiv = document.getElementById("floatLayerShadow") ;
	aDiv.style.top = document.body.scrollTop+(document.body.clientHeight-aDiv.clientHeight)/2+12 ;
	aDiv = document.getElementById("floatLayerContent") ;
	aDiv.style.top = document.body.scrollTop+(document.body.clientHeight-aDiv.clientHeight)/2;
}

function hideFloatLayer() {

	aDiv = document.getElementById("floatLayerFrame") ;
	aDiv.style.display="none" ;
	aDiv = document.getElementById("floatLayerShadow") ;
	aDiv.style.display="none" ;
	aDiv = document.getElementById("floatLayerContent") ;
	aDiv.style.display="none" ;
}

function changIdForCss (from,to) {
	if ( ! document.getElementById(from) ) return ;
	var hhh = document.getElementById(from).innerHTML ;
	document.getElementById(from).innerHTML='' ;
	document.getElementById(from).id=to ;
	document.getElementById(to).innerHTML=hhh ;
}

function changeTab(tab) {
	defa = document.getElementById(tab.defaultSrcTab) ;
	currTab = document.getElementById(defa.cuurentActiveTab);
	currBody = document.getElementById(currTab.body);
	
	if ( tab!=currTab ) {
		currTab.className = defa.deactiveStyle ;
		tab.className = defa.activeStyle ;
		currBody.style.display = 'none' ;
		document.getElementById(tab.body).style.display = '' ;
		defa.cuurentActiveTab=tab.id;
	}
}

/* 图库处理 */
function setPicShower1(list) {
	var pics = list.split(',') ;
	var str='' ;
	var i=0 ;
	for(;i<pics.length;i++) {
		var tpis = pics[i].split('|') ;
		if ( tpis[0]=='') continue ;
		if ( i==0 ) document.getElementById('shower').src = tpis[0] ;
		str = str + '<img class=icon src="'+tpis[0]+'" onclick="shower1Show(this)" order='+i+' tip="'+tpis[1]+'">' ;
	}
	document.getElementById('list').innerHTML = str ;
}
function shower1Show(obj) {
	document.getElementById('shower').src = obj.src ;	
//	document.getElementById('tip').innerHTML = obj.tip ;	
}
function shower1RollUp(obj,height) {
	obj = document.getElementById(obj) ;
	obj.scrollTop +=height  ;
}
function shower1RollDown(obj,height) {
	obj = document.getElementById(obj) ;
	obj.scrollTop -=height  ;
}

//促销卡处理相关
function showCouponCards(div,organization){
	//document.getElementById(div).innerHTML = "/dynamicScript.php?method=showCouponCards&div="+encodeURIComponent(div)+'&organization='+encodeURIComponent(organization) ;
	document.getElementById('dynamicScript').src= "/dynamicScript.php?method=showCouponCards&div="+encodeURIComponent(div)+'&organization='+encodeURIComponent(organization) ;
}

function showCouponCardsCatcher(div,cardId){
	//document.getElementById(div).innerHTML = "/dynamicScript.php?method=showCouponCardsCatcher&div="+encodeURIComponent(div)+'&card='+encodeURIComponent(cardId) ;
	document.getElementById('dynamicScript').src= "/dynamicScript.php?method=showCouponCardsCatcher&div="+encodeURIComponent(div)+'&card='+encodeURIComponent(cardId) ;
}

function catchCouponCard(div,cardId){
	//document.getElementById(div).innerHTML = "/dynamicScript.php?method=catchCouponCard&div="+encodeURIComponent(div)+'&card='+encodeURIComponent(cardId) ;
	document.getElementById('dynamicScript').src= "/dynamicScript.php?method=catchCouponCard&div="+encodeURIComponent(div)+'&card='+encodeURIComponent(cardId) ;
}

function showMsnContact(account,div) {
	var str = account==''?'':'<a target="_blank" href="msnim:chat?contact='+account+'"><img src="/images/msn.gif" align="absmiddle" border="0"  align="absmiddle"/></a>' ;
	document.getElementById(div).innerHTML=str ;
}
function showQQContact(account,div) {
	var str=account==''?'':'<A href="tencent://message/?uin='+account+'&Site=&Menu=yes" target=_blank><IMG src="http://wpa.qq.com/pa?p=1:'+account+':10" align=absMiddle border=0></A>' ;
	document.getElementById(div).innerHTML=str ;
}
function showWangWangContact(account,div) {
	var str=account==''?'':'<a target="_blank" href="http://amos.im.alisoft.com/msg.aw?v=2&uid='+account+'&site=cntaobao&s=1&charset=utf-8" ><img border="0" src="http://amos.im.alisoft.com/online.aw?v=2&uid='+account+'&site=cntaobao&s=1&charset=utf-8" alt="点击这里给我发消息" /></a>' ;
	document.getElementById(div).innerHTML=str ;
}
function showSkypeContact(account,div) {	
	var str=account==''?'':'<script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script><a href="skype:'+account+'?chat"><img src="http://mystatus.skype.com/smallclassic/'+account+'" style="border: none;" width="114" height="20" alt="My status" /></a>' ;
	document.getElementById(div).innerHTML=str ;
}
/* 跑马灯 */
function setMarquee (obj) {
	obj = document.getElementById(obj) ;
	objBody = obj.childNodes[0] ;
	objBody.innerHTML += objBody.innerHTML ;
	if ( obj.getAttribute('dirc') == 'flash' ) {
		var move= "runMarquee('"+obj.id+"')" ;
		var MyMar=setInterval(move,2000)
		obj.onmouseover=function() { clearInterval(MyMar) } ;
		obj.onmouseout=function() { clearInterval(MyMar) ; MyMar=setInterval(move,2000) }
	} else {
		var move= "runMarquee('"+obj.id+"')" ;
		var MyMar=setInterval(move,25) ;
		obj.onmouseover=function() { clearInterval(MyMar) } ;
		obj.onmouseout=function() { clearInterval(MyMar) ; MyMar=setInterval(move,25) }
	}
}
function runMarquee (obj) {
	obj = document.getElementById(obj) ;
	var clone = obj.childNodes[0].childNodes[1] ;
	
	if ( obj.getAttribute('dirc') == 'left' ) {
		obj.scrollLeft = obj.scrollLeft == clone.offsetLeft ? 0 : obj.scrollLeft+1 ;
	} else if ( obj.getAttribute('dirc') == 'top' ) {
		obj.scrollTop = obj.scrollTop == clone.offsetTop ? 0 : obj.scrollTop+1 ;
		if ( obj.scrollTop % obj.clientHeight == 0 ) {
			obj.onmouseover() ; window.setTimeout( obj.onmouseout , 1000) ;
		}
	} else if ( obj.getAttribute('dirc') == 'flash' ) {
		obj.scrollTop = obj.scrollTop >= clone.offsetTop ? 0 : (obj.scrollTop + obj.clientHeight) ;
	}
}

/* 上下双行选项卡 */
function changOPC (obj) {
	var PP=obj.parentNode.parentNode ;
	var P=obj.parentNode ;
	var currentOPC = document.getElementById(PP.getAttribute('currentOPC')) ;
	currentOPC.className = currentOPC.parentNode.getAttribute('closeStyle') ;
	document.getElementById(PP.getAttribute('currentOPC')+'Content').style.display='none' ;
	
	obj.className = P.getAttribute('openStyle') ; ;
	PP.setAttribute('currentOPC',obj.id) ;
	document.getElementById(obj.id+'Content').style.display='block' ;
}

/* 收藏 */
function saveFaverites(messageType,messageId)
{
	var userId = GetCookie('userId') ;

	var html = null ;
		document.getElementById('dynamicScript').src= "/dynamicScript.php?method=saveFaverites&messageId="+encodeURIComponent(messageId)+'&messageType='+encodeURIComponent(messageType)+'&content='+encodeURIComponent(document.title) ;
	if ( ! userId ) {
		window.external.AddFavorite(window.location,document.title) ;
	}
}

/* shower 图库 */
function showerSetPic(listPan,list,tips,links) {
	var pics = list.split(',') ;
	var tpis = tips.split(',') ;
	var links = links.split(',') ;
	var list = document.getElementById(listPan) ;
	var shower = document.getElementById(list.getAttribute('shower')) ;
	var tip = document.getElementById(list.getAttribute('tip')) ;
	shower.src = pics[0] ;
	shower.parentNode.href = links[0] ;
	tip.innerHTML = tpis[0] ;
	var i=0 ;
	var str='' ;
	for(;i<pics.length;i++) {
		 str = str + '<div class=icon><img class=iconImg src="'+pics[i]+'" link="'+links[i]+'" onclick="showerShow(this)" order='+i+' tip="'+(i+1)+'/'+pics.length+' '+tpis[i]+'" alt="'+tpis[i]+'"></div>' ;
	}
	list.innerHTML = str+"<div class=bottom></div>" ;
	list.setAttribute('lastImage',document.getElementById(listPan).childNodes[0].childNodes[0]) ;
	list.childNodes[0].className = "icon1" ;
	showerAutoRun(listPan) ;
}
function showerShow(obj) { 
	var list = obj.parentNode.parentNode ;
	showerChangeImage(list.getAttribute('lastImage'),obj)
}
function showerShowLast(listPan) { 
	var list = document.getElementById(listPan) ;
	var to = list.getAttribute('lastImage').parentNode.previousSibling.childNodes[0] ;// nextSibling
	if ( to ) showerChangeImage(list.getAttribute('lastImage'),to) ;		
	showerShowIamgeInList(to) ;
}
function showerShowNext(listPan) { 
	var list = document.getElementById(listPan) ;
	var to = list.getAttribute('lastImage').parentNode.nextSibling.childNodes[0] ;
	if ( ! to ) to= list.childNodes[0].childNodes[0] ;
	if ( to ) showerChangeImage(list.getAttribute('lastImage'),to) ;		
	showerShowIamgeInList(to) ;
}
function showerShowIamgeInList(obj) {
	var list = obj.parentNode.parentNode ;
	var halfList = list.clientHeight*0.9 ;
	if ( obj.parentNode.offsetTop > list.scrollTop*1+halfList ) {
		while(obj.parentNode.offsetTop > list.scrollTop*1 + halfList  ) showerRollUp(list.id) ;
	} else if ( obj.parentNode.offsetTop < list.scrollTop*1-halfList) {
		while ( obj.parentNode.offsetTop < list.scrollTop*1-halfList ) showerRollDown(list.id) ;		
	}
}
function showerChangeImage(from,to) {
	var list = to.parentNode.parentNode ;
	document.getElementById(list.getAttribute('shower')).src = to.src ;
	document.getElementById(list.getAttribute('shower')).parentNode.href = to.getAttribute('link') ;
	from.parentNode.className = "icon" ; 
	to.parentNode.className = "icon1" ; 
	list.setAttribute('lastImage',to)  ;	
	document.getElementById(list.getAttribute('tip')).innerHTML = to.tip ;		
}
function showerRollUp(obj) {
	obj = document.getElementById(obj) ;
	obj.scrollTop += obj.clientHeight  ;
}
function showerRollDown(obj) {
	obj = document.getElementById(obj) ;
	obj.scrollTop -= obj.clientHeight  ;
}
function showerAutoRun(obj) {
		var move= "showerShowNext('"+obj+"')" ;
		var showerAutoRun=setInterval(move,3000) ;
}

/*所属商城*/
var inputAssistantControl = null ;
function showAssistant(obj) {
	inputAssistantControl = obj ;
	aDiv = document.getElementById("inputAssistant") ;
	aDiv.style.left = aDiv.style.top = 0 ;
	aDiv.style.position = "absolute" ;
	aDiv.style.height = document.body.clientHeight ;
	aDiv.style.width = document.body.clientWidth ;
	aDiv.style.backgroundColor = "#003366";
	aDiv.style.filter = "alpha(opacity=66)"; aDiv.style.MozOpacity = "0.33";
	aDiv.style.display = "" ;
	bDiv = document.getElementById("inputAssistantContentBack") ;
	bDiv.style.top = (document.body.clientHeight-400)/2+12;
	bDiv.style.left = (document.body.clientWidth-400)/2+12;
	bDiv.style.filter = "alpha(opacity=66)"; aDiv.style.MozOpacity = "0.33";
	bDiv.style.display = "" ;
	cDiv = document.getElementById("inputAssistantContent") ;
	cDiv.style.top = (document.body.clientHeight-400)/2;
	cDiv.style.left = (document.body.clientWidth-400)/2 ;
	cDiv.style.padding = 6 ;
	cDiv.style.display = "" ;
	cDiv.innerHTML = '<span style=\"font-size:14px;font-weight:bold\">检索'+obj.caption+':</span><input id="IAsearch" name="IAsearch" type="text" value="'+'" maxlength="20" style="width:205px"/> <input type=button value=检索 onClick="getInputAssistantValue(\''+obj.name+'\',document.getElementById(\'IAsearch\').value)"><input type=button value=关闭 onClick="hideAssistant()"><div id=inputAssistentResults style="width:385px;height:355px;background-color:#ffffff;border:1px #333333 solid;margin-top:6px;font-size:12px;color:#666666;padding:3px;text-align:center;vertical-align: middle;overflow: scroll;">'+obj.tips+'</div>' ;
}

function hideAssistant(obj) {
	aDiv = document.getElementById("inputAssistant") ;
	aDiv.style.display="none" ;
	aDiv = document.getElementById("inputAssistantContentBack") ;
	aDiv.style.display="none" ;
	aDiv = document.getElementById("inputAssistantContent") ;
	aDiv.style.display="none" ;
}

function getInputAssistantValue(field,searchValue) {
	var arrUrl=window.location.href.split("/");
	var strPage=arrUrl[arrUrl.length-1].split("?");
	var strPage=window.location.href.split("?");

	var field=field.split("[");
	var field=field[field.length-1].split("]");

	document.getElementById('inputAssistentResults').innerHTML = 'dynamicScript.php?method='+inputAssistantControl.getAttribute('methodName')+'&inputAssistant=true&field='+field[0]+'&keyword='+searchValue ;
	document.getElementById('inputAssistantScript').src = 'dynamicScript.php?method='+inputAssistantControl.getAttribute('methodName')+'&inputAssistant=true&field='+field[0]+'&keyword='+searchValue ;
}

function setInputAssistantValue(valueObj) {
	inputAssistantControl.value = valueObj.innerText ;
	var i = document.getElementsByName(inputAssistantControl.valueInput) ;
	i[0].value = valueObj.value ;
	hideAssistant () ;
}

function lightThis ( obj ) {
	obj.className = obj.className + "-Light" ;
}
function unLightThis ( obj ) {
	var className = obj.className.split("-");
	obj.className = className[0] ;
}

/*首页1区选项卡*/
function nTabs(thisObj,Num){
if(thisObj.className == "active")return;
var tabObj = thisObj.parentNode.id;
var tabList = document.getElementById(tabObj).getElementsByTagName("li");
for(i=0; i <tabList.length-1; i++)
{
if (i == Num)
{
   thisObj.className = "active"; 
      document.getElementById(tabObj+"_Content"+i).style.display = "block";
}else{
   tabList[i].className = "normal"; 
   document.getElementById(tabObj+"_Content"+i).style.display = "none";
}
} 
}

/*管委会专栏投诉留言选项卡*/
function nTabsGwh(thisObj,Num){

if (Num == 2){document.getElementById('img1').src = "images/XH_img/XH_Adv.gif";
}else if(Num == 1) {document.getElementById('img1').src = "images/XH_img/XH_lod.gif";
}

if(thisObj.className == "active")return;
var tabObj = thisObj.parentNode.id;
var tabList = document.getElementById(tabObj).getElementsByTagName("li");
for(i=1; i <tabList.length; i++)
{
if (i == Num)
{
   thisObj.className = "active"; 
      document.getElementById(tabObj+"_Content"+i).style.display = "block";

}else{
   tabList[i].className = "normal"; 
   document.getElementById(tabObj+"_Content"+i).style.display = "none";
}
} 
}


