﻿function lightTab(idName,ttlNum,idx,onClass,offClass){
	
	for(j=1;j<=ttlNum;j++){
		id(idName+'_tab_'+j).className=offClass;	
	}
	id(idName+'_tab_'+idx).className=onClass;
	
	for(i=1;i<=ttlNum;i++){
		id(idName+'_cnt_'+i).style.display="none";
	}
	id(idName+'_cnt_'+idx).style.display="block";
}

function id(id){
	return document.getElementById(id);
}

function ZDZ(ImgD,size){
	var size=size;
	var margin;
	var image=new Image();
	image.src=ImgD.src;
			 
	if(image.width>0 && image.height>0 && (image.width>size || image.height>size))
	{
			 
	     if(image.width>image.height)
			 {
	          ImgD.width=size;
						ImgD.height=(image.height*size)/image.width;
			 }
			 
			if(image.width<image.height)
			{
				ImgD.height=size;
				ImgD.width=(image.width*size)/image.height;
			 }
			 
			 if(image.width==image.height)    
			 {
			   ImgD.height=size;
				 ImgD.height=size;
			 }
  }
	
	margin=(size-ImgD.height)/2;
	ImgD.style.margin=margin+"px 0px";
}

function lightMenu(idname){
	id(idname).className="fonton";
	id(idname).crt="true";
}

function overEffect(){
	for(var i=1;i<=9;i++){
		id('menu'+i).onmouseover	=	function(){
			this.className	=	'fonton';
		}
		id('menu'+i).onmouseout	=	function(){
			if(this.crt=='false')
			this.className	=	'fontoff';
		}
	}
	
}

function LimitImgSize(a,b,c){
	if(a!=null){
		oWidth=a.offsetWidth*1;
		oHeight=a.offsetHeight*1;
		if(oWidth>b||oHeight>c){
			oRate=parseInt(100*oWidth/oHeight)/100;
			nRate=parseInt(100*b/c)/100;
			if(oRate<=nRate){if(oHeight>c)a.height=c}
			else{if(oWidth>b)a.width=b}
		};
		var d=parseInt((c-a.height)/2);
		a.style.margin=d+"px 0px"}
};