function setTopMenuCSS(i)
{
	var m="menu"+i;
	var curMenu=document.getElementById(m);
	curMenu.className="curLink";
}


function setLeftMenuCSS(i)
{
	var m="LM"+i;
	var curMenu=document.getElementById(m);
	curMenu.className="curLink";
}


function resetImg(img,w,h)
{
		var srcImage = new Image();
		srcImage.src=img.src;
		var srcW=srcImage.width;  
		var srcH=srcImage.height;
		if(srcW>w){img.width=w;}
			
		if(srcH>h){img.height=h;}
			
			/**
	if(img.readyState=="complete")
	{
		if(srcImage.offsetWidth>w)
	//	if(srcImage.width>w)
		 	img.width=w+'px';
		if(srcImage.offsetHeight>w)
	//	if(srcImage.height>w)
		 	img.height=h+'px';
		
	}
			**/
}



function chkdiv(divid){
	var chkid=document.getElementById(divid);
	if(chkid != null)
		return true;
	else 
		return false; 
}

function hiddenDiv(strDivID){
	var arrDivID=new Array();
	arrDivID=strDivID.split(',');
	var tempDiv=null;
	for(var i=0;i<=arrDivID.length;i++){
		if(chkdiv(arrDivID[i])){
			tempDiv=document.getElementById(arrDivID[i]);
			tempDiv.style.display="none";
		}
	}
}

function showDiv(strDivID){
	var arrDivID=new Array();
	arrDivID=strDivID.split(',');
	var tempDiv=null;
	for(var i=0;i<=arrDivID.length;i++){
		if(chkdiv(arrDivID[i])){
			tempDiv=document.getElementById(arrDivID[i]);
			tempDiv.style.display="";
		}
	}
}

function setDivClass(strDivID,className){
	var arrDivID=new Array();
	arrDivID=strDivID.split(',');
	var tempDiv=null;
	for(var i=0;i<=arrDivID.length;i++){
		if(chkdiv(arrDivID[i])){
			tempDiv=document.getElementById(arrDivID[i]);
			tempDiv.className=className;
		}
	}
}

function changeMenuStyle(showDivID,hiddenDivID,menuID,otherMenuID,thisStyle,otherStyle){
	hiddenDiv(hiddenDivID);
	showDiv(showDivID);
	setDivClass(otherMenuID,otherStyle);
	setDivClass(menuID,thisStyle);
}
/****/

function byId(domid)
{
        return document.getElementById(domid);
}
/*
* dom就是图片标签的ID号
* url最好是绝对地址eg:http://www.www.com/ww.gif
*new size
*/
function setCommPhoto(dom,url)
{
	/**
        byId(dom).src = url;
        imgPreloader = new Image();
        imgPreloader.onload=function(){
                byId(dom).src = url;
        }
        imgPreloader.src = url;
	**/
}

function loadFinishPicByObj(img,url,isLimited,w,h)
{
	var imgPreloader=new Image();
	imgPreloader.src=url;
	imgPreloader.onload=function(){
		img.src=url;
		if(isLimited==true || isLimited==1){
			/**
			**/
			if(imgPreloader.width>w){
				img.width=w;
			}else{img.width=imgPreloader.width}
			if(imgPreloader.height>h){
				img.height=h
			}else{img.height=imgPreloader.height}
		}
	}
}


function loadFinishPicByID(imgID,url,isLimited,w,h)
{
	var imgPreloader=new Image();
	imgPreloader.src=url;
	imgPreloader.onload=function(){
	//	byId(imgID).src=imgPreloader.src;
		byId(imgID).src=url;
		if(isLimited==true || isLimited==1){
			if(imgPreloader.width>w){
				byId(imgID).width=w;
			}else{byId(imgID).width=imgPreloader.width}
			if(imgPreloader.height>h){
				byId(imgID).height=h
			}else{byId(imgID).height=imgPreloader.height}
		}
	}
}

function resetListPicSize(img,w,h)
{
	img.className='border';
	if(img.width>w){
		img.width=w;
	}
	if(img.height>h){
		img.height=h
	}
}

	function InitCommLeftHeight()
	{
	//	var rightHeight=parseInt(document.getElementById('commRight').style.height);
	//	var rightHeight=parseInt(document.getElementById('commRight').currentStyle.height);
		var scrollHeight=parseInt(document.body.scrollHeight)-50;
	//	var rightHeight=parseInt(document.body.clientHeight);
		var rightHeight=parseInt(document.getElementById('commRight').offsetHeight);
		
//	alert(rightHeight+' === '+scrollHeight);
/*
		if(rightHeight<600)
		{
			document.getElementById('commLeft').style.height='600px';
		}else{
			document.getElementById('commLeft').style.height=rightHeight+'px';
		}
*/
		
		if(rightHeight>scrollHeight)
		{
			document.getElementById('commLeft').style.height=rightHeight<700?'600px':rightHeight+'px';
		}else{
			document.getElementById('commLeft').style.height=scrollHeight<700?'600px':scrollHeight+'px';//scrollHeight+'px';
		}
	}
