$(document).ready(function (){changeNa1Padding();});

function changeNa1Padding() {
	$pageW = getPageSize(); $pageW = parseInt($pageW[0]);
	$docW  = parseInt($("#h_table").width());
	$docW += 16;//scroller widht

	//alert($pageW+" : "+$docW);
	if($pageW < $docW){

		$overFlow = $docW - $pageW;
		$min_left = 5;
		$min_right = 2;

		$(".nav1-level-1").css("width","auto");
		$("#m_table").css("width","auto");
		$(".nav1-level-1 .c1 .L").css("width","3000px");/* !!! */

		$CTN = true;
		while($CTN){
			$CTN = false;

	 		$(".nav1-level-1 .c1 .layer2").each(function(i){
	 			if($overFlow>0){$CTN=true;}

				if($CTN){
					$pl = parseInt($(this).css("padding-left"));
					$pr = parseInt($(this).css("padding-right"));

					if($pl<=$min_left && $pr<=$min_right){
						$CTN=false;
					}
					if($pl>$min_left && $CTN){
						$pl--;
						$(this).css("padding-left",$pl);
						$overFlow--;
						if($overFlow<=0){$CTN=false;}
					}
					if($pr>$min_right && $CTN){
						$pr--;
						$(this).css("padding-right",$pr);
						$overFlow--;
						if($overFlow<=0){$CTN=false;}
					}
				}

			});
		}//eof while
	}
}

function getPageSize(){
	var de = document.documentElement;
	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
	var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
	arrayPageSize = [w,h];
	return arrayPageSize;
}
