/* ****************************************************
Since : 2007-12-01
**************************************************** */

/* Definition of ...
=================================
1: category top

=================================*/

/* 1: category top
=================================*/
$(document).ready(function(){
	var imgMaxHeight=0;
	var ddMaxHeight=0;
	var temp=4;
	var wrapId=0;
	$targetObj = $('#contents .subsection');
	
	$targetObj.each(function(){//loop subsection
		$dlObj=$('dl', $(this));
		dlNum=$dlObj.length;
		count=Math.ceil(dlNum/4);
		for(j=0;j<count;j++){//loop dl
			if((j+1)==count){
				if(dlNum%4!=0)
					temp=dlNum%4;
			}
			for(k=0;k<temp;k++){
				if(imgMaxHeight < $('img', $dlObj[4*j+k]).height())
					imgMaxHeight = $('img', $dlObj[4*j+k]).height();
				if(ddMaxHeight < $('dd', $dlObj[4*j+k]).height())
					ddMaxHeight = $('dd', $dlObj[4*j+k]).height();
			}
			$($dlObj[4*j]).before('<div class="dlWrapper" id="wrap'+wrapId+'">');
			for(k=0;k<temp;k++){
				imgLeftPos = (163-$('img', $dlObj[4*j+k]).attr('width'))/2;
				$('dt img', $dlObj[4*j+k]).css({'position':'absolute','left':imgLeftPos});
				$('dt', $dlObj[4*j+k]).css('height', imgMaxHeight+'px');
				ddProperty = env.ua.ver.match(/MSIE 6/i)?'height':'min-height';
				
				$('dd', $dlObj[4*j+k]).css(ddProperty, ddMaxHeight+'px');
				$('dd a', $dlObj[4*j+k]).blur();
				$($dlObj[4*j+k]).appendTo("#wrap"+wrapId);
			}
			wrapId++;
			imgMaxHeight=0;
			ddMaxHeight=0;
			temp=4;
		}
	});
});
