var allProductNum=0;var rightHeight=0;

function initSort(){for(var i=0;i<arrProductNum.length;i++){allProductNum+=arrProductNum[i]};if($("productMenuSort")){var a=$("productMenuSort").getElementsByTagName("div");for(var i=0;i<a.length;i++){if(a[i].id!=""){a[i].onclick=chgSort;if(a[i].getElementsByTagName("a").length>0){a[i].innerHTML=a[i].getElementsByTagName("a")[0].innerHTML}}}$("navTitle").innerHTML=a[thisSort].innerHTML;a=null}}

function initType(){var a=$("listType");a.innerHTML="";var b=new Array("a","b","c");var c;for(var i=1;i<4;i++){if(i==listType){c="1"}else{c="0' onclick='chgType("+i+")"};a.innerHTML+="<img src='/style/space.gif' class='"+b[i-1]+c+"' />"}if($("bottomPage"))$("bottomPage").innerHTML=$("listNav").innerHTML.replace(/id=/g,"name=");a=null}

function chgType(a){if(listType!=a){listType=a;initType();chgPage(1)}return false}

function chgPage(a,b){var c;switch(listType){case 1:c="img-"+thisSort+"-"+a+".xml";break;case 2:c="imgtext-"+thisSort+"-"+a+".xml";break;case 3:c="text.xml";break}getBodyLocal("/iframe/"+c,"get",null,"if(err==''){execChgPage(result,"+a+")}",1,true);if(b)return false}

function execChgPage(a,b){var c;switch(listType){case 1:c="listImg";break;case 2:c="";break;case 3:c="";break}$("productList").setAttribute("class",c);$("productList").setAttribute("className",c);var d=a.getElementsByTagName("topContent")[0];var e;if(isIE){e=d.xml}else{e=serializeXml(d)}e=e.replace("<topContent>","");e=e.replace("</topContent>","");$('productList').innerHTML=e;if(listType!=3){var f,pageNum,num;if(thisSort==0){num=allProductNum}else{num=arrProductNum[thisSort-1]};if(listType==1){pageNum=20}else{pageNum=15}f=parseInt(num/pageNum);if(num%pageNum>0)f++;$("pageList0").innerHTML="当前产品列表第 <span class='curPage'>"+b+"</span>/"+f+" 页";$("productPage").innerHTML="";if(f>1){if(b<f){$("productPage").innerHTML+="<div><a onfocus='this.blur()' href='javascript:chgPage("+(b+1)+");'>下一页</a></div>"};for(var i=f;i>0;i--){if(b==i){$("productPage").innerHTML+="<div class='thispage'>"+i+"</div>"}else{$("productPage").innerHTML+="<div><a href='javascript:chgPage("+i+");' onfocus='this.blur()'>"+i+"</a></div>"}}if(b>1){$("productPage").innerHTML+="<div><a onfocus='this.blur()' href='javascript:chgPage("+(b-1)+");'>上一页</a></div>"}}$('productList').innerHTML=e+="<div id='bottomPage' class='nav'></div>";$("bottomPage").innerHTML=$("listNav").innerHTML}else{$("pageList0").innerHTML="";$("productPage").innerHTML=""}d=null;setProductHeight();setHeight(b);if(listType==3)chgSort(thisSort);initA()}

function setHeight(a){if($("bottomPage"))$("bottomPage").innerHTML=$("listNav").innerHTML.replace(/id=/g,"name=");if(rightHeight==0){rightHeight=$("rightBody").offsetHeight;loginStr()};if(!a)a=1;var b=20;var c=211;var d=5;if(listType==2){b=15;c=113;d=15}var e;var f=0;if(thisSort>0){f=arrProductNum[thisSort-1]}else{f=allProductNum}var g;if(listType==3){g=(allProductNum+1)*27}else{e=parseInt(f/b);if(f%b>0)e++;if(a<=e){if(a==e){f=f%b;if(f>0){if(listType==1){d=parseInt(f/4);if((f%4)>0)d++}else{d=f}}}}g=d*c+27}$("productList").style.height=g+"px";if($("bottomBG"))$("bottomBG").style.height=(g-27)+"px";g+=96;g+=($("productGG").offsetHeight+$("buyStep").offsetHeight);var h=g>rightHeight?g:rightHeight;$("list").style.height=$("rightBody").style.height=$("mainBody").style.height=h+"px";$("productBody").style.height=(h-67-($("productGG").offsetHeight+$("buyStep").offsetHeight))+"px";if($("productPage")){var j=$("productPage").getElementsByTagName("a");for(var i=0;i<j.length;i++){j[i].onmouseover=chgPageOver;j[i].onmouseout=chgPageOut}j=null}}

function chgSort(e){
	if(isNaN(e)){
		e=e||window.event;
		var a=e.target||e.srcElement;
		var b=parseInt(a.id.replace("pm",""));
		a=null
	}else{
		var b=e
	};
	thisSort=b;
	$("productGG").onclick=function(){
		window.location=productGG[thisSort][0]};
		$("productGG").getElementsByTagName("img")[0].src=productGG[thisSort][1];
		$("navTitle").innerHTML=$("productMenuSort").getElementsByTagName("div")[thisSort].innerHTML;
		var d="";
		var f=$("productList");
		for(var i=0;i<7;i++){
			d="";
			if(i==b){d="this"};
			$("pm"+i).setAttribute("className",d);
			$("pm"+i).setAttribute("class",d)
		}
		switch(listType){
			case 3:
				var c=new Array($("class1"),$("class2"),$("class3"),$("class4"),$("class5"),$("class6"));
				for(var i=0;i<c.length;i++){
					f.removeChild(c[i])
				};
				if(b>0)f.appendChild(c[b-1]);
				for(var i=0;i<7;i++){
					if(i!=b-1&&i<6){f.appendChild(c[i])}
				}
				c=null;
			break;
			default:
				chgPage(1)
		}
		f=null;
		return false
	}

function setProductHeight(){if(listType==1){$("productList").setAttribute("class","listImg");$("productList").setAttribute("className","listImg")}else if(listType==3){for(var i=1;i<6;i++){var h=arrProductNum[i-1]*26-1;var a=h;if(h>100){a=parseInt((h-100)/2);if($("name"+i))$("name"+i).style.paddingTop=a+"px";a=h-a}if($("name"+i))$("name"+i).style.height=a+"px"}}}

function chgPageOver(e){e=e||window.event;var a=e.target||e.srcElement;a.setAttribute("class","over");a.setAttribute("className","over");a=null}

function chgPageOut(e){e=e||window.event;var a=e.target||e.srcElement;a.setAttribute("class","");a.setAttribute("className","");a=null}