function showmorecatlog(o, id){
	o.parentNode.style.display='none';
	$(id).style.display='';
	if($(id+'_more')){
		$(id+'_more').style.display = '';
	}
}
function closesidebar(t){
	if(t){
		$('content').style.width = '760px';
	}else{
		$('content').style.width = '100%';
	}
}

function togglediv(id, o, t, callback){
	if($(id).style.display=='none'){
		$(id).style.display = '';
		if(o!=null&&t!=null){
			o.innerText = '隐藏'+t;
		}
		if(callback!=null)callback(true);
	}else{
		$(id).style.display = 'none';
		
		if(o!=null&&t!=null){
			o.innerText = '显示'+t;
		}
		if(callback!=null)callback(false);
	}
	o.blur();
}

function loadliststyle(){
	var os = document.getElementsByTagName('li');
	for(var i=0;i<os.length;i++){
		if(os[i].className=='a-list'){
			os[i].onmouseover = function(){
				this.style.background = '#F0F0F0';
				this.style.width = parseInt(this.style.width)-2;
				this.style.height = parseInt(this.style.height)-2;
				this.style.border = '1px solid #CCC';
			}
			os[i].onmouseout = function(){
				this.style.background = '';
				this.style.border = '';
				this.style.width = parseInt(this.style.width)+2;
				this.style.height = parseInt(this.style.height)+2;
			}
		}
	}
}

function applyresult(id, ok){
	if(ok){
		alert('申请成功！');
	}
}

function toggledesc(o){
	if($('shopdesc').style.height!='auto'){
		$('shopdesc').style.height='auto';
		o.innerText = '收起简介';
	}else{
		$('shopdesc').style.height='55px';
		o.innerText = '展开简介';
	}
}

function resizeImg(id,size) {
	var theImages = $(id).getElementsByTagName('img');
	for (i=0; i<theImages.length; i++) {
		theImages[i].onload = function() {
			if (this.width > size) {
				this.style.width = size + 'px';
				if(this.parentNode.tagName.toLowerCase() != 'a') {
					var zoomDiv = document.createElement('div');
					this.parentNode.insertBefore(zoomDiv,this);
					zoomDiv.appendChild(this);
					zoomDiv.style.position = 'relative';
					zoomDiv.style.cursor = 'pointer';

					this.title = '点击图片，在新窗口显示原始尺寸';

					var zoom = document.createElement('img');
					zoom.src = 'image/zoom.gif';
					zoom.style.position = 'absolute';
					zoom.style.marginLeft = size -28 + 'px';
					zoom.style.marginTop = '5px';
					this.parentNode.insertBefore(zoom,this);

					zoomDiv.onmouseover = function() {
						zoom.src = 'image/zoom_h.gif';
					};
					zoomDiv.onmouseout = function() {
						zoom.src = 'image/zoom.gif';
					};
					zoomDiv.onclick = function() {
						window.open(this.childNodes[1].src);
					};
				}
			}
		}
	}
}
