function folder(divid1, imgid1, is_sub) {
	divid=document.getElementById(divid1);
	imgid=document.getElementById(imgid1);
	if(divid.style.display=="none") {
		divid.style.display="";
		if(is_sub==true)
			imgid.src="/houmoo-portal/images/houmoo/leftlabel_icon_a.jpg";
		else 
			imgid.src="/houmoo-portal/images/houmoo/leftlabel_icon_b.jpg";
	}
	else {
		divid.style.display="none";
		if(is_sub==true)
			imgid.src="/houmoo-portal/images/houmoo/leftlabel_icon_b.jpg";
		else
			imgid.src="/houmoo-portal/images/houmoo/leftlabel_icon_a.jpg";
	}
}

function showDetailTools() {
	document.getElementById('DetailTools').style.display ='block';
}
function hiddenDetailTools() {
	document.getElementById('DetailTools').style.display ='none';
}
function showcatestorelist() {
	document.getElementById('catestorelist').style.display ='block';
}
function hiddencatestorelist() {
	document.getElementById('catestorelist').style.display ='none';
}
function showfanglist() {
	document.getElementById('fanglist').style.display ='block';
}
function hiddenfanglist() {
	document.getElementById('fanglist').style.display ='none';
}

function setFocus(url) {
	  
		if(url != undefined && url != ""){
			
			var content = document.getElementById("iframeContent");
			//alert(content);
			content.innerHTML='<iframe name="frame_content" src="' + url 
				+ '" id="frame_content"	width="100%" scrolling="no" frameborder="0"  marginwidth="0" marginheight="0" allowtransparency="true" onload="this.height=window.frames[this.name].document.body.scrollHeight;"></iframe>';
			//var iframe = document.getElementById("frame_content");
			//iframe.src=url;
		
	}	
}

String.prototype.Trim = function()
{
        return this.replace(/(^\s*)|(\s*$)/g, "");
}

function truncate(str,displayLength) {	
	if (str==null||str.Trim().length==0)
	{		
		return "";
	}
	if (displayLength<=0)
	{		
		return "";
	}	
    var strLength = str.length;
    if (strLength <= displayLength)
    {	
	    return str;
    }
    else {	
        return str.substring(0,displayLength)+"...";
    }
}

function truncate2(str,displayLength) {	
	if (str==null||str.Trim().length==0)
	{		
		return "";
	}
	if (displayLength<=0)
	{		
		return "";
	}	
    var strLength = str.length;
    if (strLength <= displayLength)
    {	
	    return str;
    }
    else {	
        return str.substring(0,displayLength);
    }
}


function DrawImage(ImgD){ 
  var flag=false;
  var image=new Image();
  image.src=ImgD.src;
  if(image.width>0 && image.height>0){
  flag=true;
  if(image.width/image.height>= 180/110){
  if(image.width>180){
  ImgD.width=180;
  ImgD.height=(image.height*110)/image.width;
  }else{
  ImgD.width=image.width;
  ImgD.height=image.height;
  }
  /*ImgD.alt="bigpic" */
  }
  else{
  if(image.height>110){
  ImgD.height=110;
  ImgD.width=(image.width*110)/image.height;
  }else{
  ImgD.width=image.width;
  ImgD.height=image.height;
  }
  /*ImgD.alt="bigpic" */
  }
  }
}
