//============================================
//
// baseEvent.js
// Last Update 2011-11-09
//
//* $(function(){}); --- Code to carry out after an HTML road
//		-Global navi location
//		-#contentsArea width Adjust
//		-Location Area
//		-@contentsArea first-child
//		-sectionWrap (TypeA2, TypeA3)
//		-globalMenu
//		-searchArea
//		-collapeList Tree Action
//		-menuList (chapter top page)
//		-Table Adjust
//		-See More Colums
//		-Execution Custom Method and Plugins
//
//* (function($){})(jQuery);
//		-Custom jQuery Function
//				-$._isIE
//				-$._getMaxWidth
//		-Original Methods
//				-containerResize
//				-popWindow
//				-setFocus
//				-paramAdjust
//				-sortTable
//				-fadeToggle
//		-Plugins
//				-autoHeight
//				-slideScroll
//				-columns
//				-cookie
//
//============================================

$(function(){
	
	// Global navi location
	//-------------------------------------------------------
	(function(){
		var navActive = location.pathname.split('/', 2)[1];
		var here = ['product','applications','develop','support','buy','company'];//The First Hierarchy names
		for(var i=0; i<here.length; i++){
			if(navActive == here[i]){
				var $lis = $('#nav > ul > li');
				$lis.eq(i).find('a').addClass('here');
			}
		}
	})();
	
	
	// #contentsArea width Adjust
	//-------------------------------------------------------
	(function(){
		var $t = $('#contentsArea');
		if($t.length && $('.moreColumns').length){
			$t.css('width',$t.width());
		}
	})();
	
	
	// Location Area
	//-------------------------------------------------------
	(function(){
		//breadCrumb
		$('#breadCrumb > li:last-child').addClass('last');
		$('#breadCrumb > li').each(function(){
			var $c = $(this);
			if($c.offset().top > 170){
				$(this).addClass('over');
			}
		});
		
		//Add Text Change Button
		var tc = '<div id="textChange">';
				tc+= '	<ul>';
				tc+= '		<li id="text_s">Small</li>';
				tc+= '		<li id="text_m">Medium</li>';
				tc+= '		<li id="text_l">Large</li>';
				tc+= '	</ul>';
				tc+= '</div>';
		$('#pageTitle > ul#pageAction').before(tc);
		
		//Adjust vertical-align
		//$('ul#pageAction,#textChange').each(function(){
		//	$(this).css('margin-top',($('#pageTitle').height() - $(this).height())/2);
		//});
		
		//Text Size Change
		var $t = {
			target: $('#textChange'),
			size	: $.cookie('tsize'),
			btn		: $.cookie('onBtn')
		}
		if($t.size){
			setFontSize($t.size);
			$('#'+$t.size).addClass('on');
		}else{
			$('#text_s').addClass('on');
		}
		
		$t.target.find('li').each(function(c){
			var $e = $(this);
			$e.click(function(){
				$t.target.find('.on').removeClass('on');
				$e.addClass('on');
				$t.size = $e.attr('id');// get [on] element
				$.cookie('tsize',$t.size,{expires:7,path:'/'});
				setFontSize($t.size);
				$('.searchLineup .columnBox, .halfBox, .column2Block01 .columnBox, .column2Block02 .columnBox').autoHeight({column:2});
				$('.column3Block01 .columnBox').autoHeight({column:3});
				$('.column3Block02 .columnBox').autoHeight({column:3});
				$('.column4Block01 .columnBox').autoHeight({column:4});
				$('.column4Block02 .columnBox').autoHeight({column:4});
				$('.column5Block01 .columnBox').autoHeight({column:5});
				$('.column5Block02 .columnBox').autoHeight({column:5});
				$('#footer').containerResize();
			});
		});
	})();
	
	function setFontSize(size){
		var eachSize = function (sw, swH2, swH3, swH4){
			var $sw = $('#sectionWrap');
			$sw.css('font-size', sw);
			$sw.find('h2').css('font-size', swH2);
			$sw.find('h3').css('font-size', swH3);
			$sw.find('h4').css('font-size', swH4);
		}
		
		switch(size){
			case 'text_s': eachSize('11px','16px','14px','12px');	break;
			case 'text_m': eachSize('13px','18px','16px','14px');	break;
			case 'text_l': eachSize('15px','20px','18px','16px');	break;
			default: break;
		}
	}
	
	
	// @contentsArea first-child
	//-------------------------------------------------------
	$('.RLsection > *:first-child, #contentsArea > *:first-child').each(function(){
		if(parseInt($(this).css('margin-top')) > 0){
			$(this).css('margin-top','0');
		}
	});
	
	
	// sectionWrap (TypeA2, TypeA3)
	//-------------------------------------------------------
	(function(){
		var $sw = $('#sectionWrap');
		if($sw.css('backgroundImage').indexOf('bg_section_01') != -1){
			if($('#rightSection.typeA2').length){
				$sw.addClass('bgTypeA2');
			}
			if($('#rightSection.typeA3').length){
				$sw.addClass('bgTypeA3');
			}
		}
	})();	
	
	
	// globalMenu
	//-------------------------------------------------------
	(function(){
		var lis = $('#nav > ul > li');
		var chap = $('#level2 > div');
		lis.each(function(e){
			var target=$(this);
			var a = 'active';
			var l2 = chap.eq(e);
			target.hover(function(event){
				lis.find('a').removeClass(a);
				target.find('a').addClass(a);
				if(l2.hasClass(a)){l2.show();}
				l2.stop(true,true).slideDown('fast');
				l2.find('.row').autoHeight();
				chap.removeClass(a);
			},function(){
				l2.hover(function(){
					l2.show();
					target.find('a').addClass(a);
				},function(){
					target.find('a').removeClass(a);
					l2.hide();
					l2.addClass(a);
				});
				l2.stop(true,true).hide();
				target.find('a').removeClass(a);
			});
		});
		
		// level2 layout adjust
		if($('#level2').length){
			var j = '#level2 .chapterBox > .row';
			$(j+':first-child').addClass('first');
			$(j+'> ul > li:first-child').addClass('noBg');
			$(j+'> ul > li > a').addClass('linkTitle');
		}
		
			
		$('.chapterBox').each(function(e){
			var t = $(this);
			t.addClass('clearfix');
			var row = t.find('.row').length;
			if(row == 4) t.parent().css('left','5px');
			if($.browser.msie && parseInt($.browser.version)==6){
				switch(row){
					case 1 : t.width(240);break;
					case 2 : t.width(480);break;
					case 3 : t.width(715);break;
					case 4 : t.width(945);break;
					default : t.width('auto');
				}
			}
		});
	})();
	
	
	// searchArea
	//-------------------------------------------------------
	$('#searchArea').hover(function(){
		$('#advance').fadeIn('fast');
	},function(){
		$('#advance').fadeOut('fast');
	});
	
	
	//collapeList Tree Action
	//-------------------------------------------------------
	$('.collapeList .tree li a').each(function(){
		var $t = $(this);
		$t.click(function(){
			var $tP = $t.parent();
			if($tP.hasClass('active')){
				$tP.removeClass('active');
				$tP.find('.active').removeClass('active');
			}else{
				$tP.addClass('active')
				$tP.find('ul').eq(0).addClass('active');
			}
		});
	});
	
	
	// menuList (chapter top page)
	//-------------------------------------------------------
	if($('#menuList .root a').hasClass('here')){
		$('ul.L1').attr('id','chapTop');
	}
	
	
	// Table Adjust
	//-------------------------------------------------------
	$("table.searchResultsTable").each(function(){
		$(this).find("tr:even").addClass("evenRow1");
		$(this).find("tr td:first-child,tr th:first-child").addClass("pl15");
		$(this).find("tr td:first-child,tr th:first-child").css("border-left","none");
	});
	
	$("table.tableBlock01").each(function(){
		$(this).find("tr td:first-child,tr th:first-child").css("border-left","none");
	});
	
	$("table.stripeEven").each(function(){
		$(this).find("tbody tr:even").addClass("evenRow1");
	});

	$("table.stripeOdd").each(function(){
		$(this).find("tbody tr:odd").addClass("oddRow1");
	});
	
	$('#keywordResult ul:odd').addClass('oddList');
	
	//compare
	$("#partNumResult,#parametricResult,#ecommerceResult,#equivDetails").each(function(){
		$(this).find("tr td:nth-child(2)").css("border-left","none");
		$(this).find("tr td:nth-child(2)").css("padding-left","0");
	});
	
	//productListTable
	$("table.productListTable tbody").each(function(){
		$(this).find("tr:even").addClass('even');
		$(this).find("tr:odd").addClass('odd');
		$(this).find("tr:odd td:first-child,tr:odd th:first-child").css('border-left','#888 solid 1px');
		$(this).find("tr:nth-child(4n)").addClass("oddSet");
		$(this).find("tr:nth-child(4n-1)").addClass("oddSet");
	});
	
	
	// ColumnBox Width
	//-------------------------------------------------------
	(function(){
		if(!$('.columnBox')){return};
		$('.columnBox').each(function(){
			var $t = $(this);
			var columns = $t.parent().attr('class').substr(6,1); // columnXBlock01
			if(!typeof(columns) == 'number'){return;}
			var outer = parseInt($t.css('margin-left')) + parseInt($t.css('border-left-width')) + parseInt($t.css('border-right-width'));
			if(!outer){outer = parseInt($t.css('margin-left'));}
			$t.width(($t.parent().width()/columns) - outer);
		});
	})();
	
	// See More Colums
	//-------------------------------------------------------
	var expans = {
		w 				: $(window),
		wW 				: $(window).width(),
		wr 				: $("#allWrap"),
		wrW 			: parseInt($("#allWrap").css('width')),
		r 				: $('#rightSection'),
		rW 				: parseInt($('#rightSection').css('width')),
		ca 				: $('#contentsArea'),
		caW 			: $('#contentsArea').width(),
		t 				: $('#parametricResult'),
		tW 				: $('#parametricResult').width(),
		mSwitch 	: $('.moreColumns'),
		mSwitchCh : $('.moreColumns').children('a').eq(0),
		diff 			: 0
	}
	
	expans.mSwitch.toggle(function(){
		expans.mSwitchCh.text("See Less Columns");
		expans.mSwitchCh.toggleClass('active');
		expans.t.find('.hide').each(function(){
			$(this).attr('class','more');
		});
		// width
		expans.tW = $._getMaxWidth();
		expans.rW = parseInt($('#rightSection').css('width'));
		expans.diff = (expans.tW - expans.rW);
		if(expans.diff>0){
			expans.wr.containerResize();
			expans.t.css('width','100%');
		}
	},function(){
		expans.mSwitchCh.text("See More Columns");
		expans.mSwitchCh.toggleClass('active');
		expans.t.find('.more').each(function(){
			$(this).attr('class','hide');
		});
		expans.t.css('width',(expans.tW - expans.diff));
		expans.tW = $._getMaxWidth();//hide width
		expans.rW = $('#rightSection').width();//more width
		expans.wrW = $("#allWrap").width();//more width
		expans.diff = (expans.rW - expans.tW);
		if(expans.diff > 0){
			expans.wr.css('width',(expans.wrW - expans.diff));
			expans.r.css('width',(expans.rW - expans.diff));
		}
			
	});
	
	
	// Execution Custom Method and Plugins
	//-------------------------------------------------------
	$('#footer').containerResize();
	$('#regionSelect').popWindow('#regionSelectButton');
	$('.faqRelevant').fadeToggle('a');
	$('.moreParam').fadeToggle('a');
	$('.searchLineup .columnBox, .halfBox, .column2Block01 .columnBox, .column2Block02 .columnBox').autoHeight({column:2});
	$('.column2Block02 .columnBox').autoHeight({column:2});
	$('.column3Block01 .columnBox').autoHeight({column:3});
	$('.column3Block02 .columnBox').autoHeight({column:3});
	$('.column4Block01 .columnBox').autoHeight({column:4});
	$('.column4Block02 .columnBox').autoHeight({column:4});
	$('.column5Block01 .columnBox').autoHeight({column:5});
	$('.column5Block02 .columnBox').autoHeight({column:5});
	$('.searchResultsTable,.sortTable').sortTable();
	$("a[href*='#']").slideScroll();
	$(".faqRelevant ul").columns(3, true);
	$("ul.listColumn5, ol.listColumn5").columns(5, true);
	$("ul.listColumn4, ol.listColumn4").columns(4, true);
	$("ul.listColumn3, ol.listColumn3").columns(3, true);
	$("ul.listColumn2, ol.listColumn2").columns(2, true);
	$('#q1').setFocus('#q2');
	$('#searchArea .textField').setFocus('#searchAreaForm #btn');
	$('#selector #moreParam').paramAdjust();
	
	
	// When a search keyword is long
	//  [This start after practice of containerResize()]
	//-------------------------------------------------------
	$('.resultBar').each(function(){
		var $t = $(this);
		var $match = $('.match',$t);
		var $config = $('.resultConfig',$t);
		var $configW = $config.width();
		if($config.css('width')== 'auto'){
			if($._isIE(7) || $._isIE(6)){
				$configW = 0;
				var widths = [];
				$config.children().each(function(){
					widths.push($(this).outerWidth());
				});
				for(var i=0; i<widths.length; i++){
					$configW += widths[i];
				}
				$config.css('width',$configW);
			}
		}
		if(($match.width() + $configW) > $t.width()){
			$match.addClass('pb05');
		}
		// When containerResilt() is carried out
		if($config.css('position')=='absolute' && $match.position().left + $match.width() > $config.position().left){
			$config.css('top',$config.position().top + 25+'px');
			$t.css('height', $t.height()+25+'px');
		}
	});
	
});





(function($){
	
	//**********************************
	// Custom jQuery Function
	//**********************************
	
	//----------------------------------
	// IE Version Distinction
	//
	// IE6 : $._isIE(6)
	// IE7 : $._isIE(7)
	// IE8 : $._isIE(8)
	// IE9 : $._isIE(9)
	// IE  : $._isIE()
	//----------------------------------
	$._isIE = function(){
		var version = arguments.length >= 1 ? parseInt(arguments[0]) : '';
		switch (version){
			case 6:
				return !$.support.opacity && 
					!$.support.style && 
						typeof document.documentElement.style.maxHeight == "undefined" ;
				break;
			case 7:
				return !$.support.opacity &&
					!$.support.style &&
						typeof document.documentElement.style.maxHeight != "undefined" ;
				break;
			case 8:
				return !$.support.opacity && $.support.style;
				break;
			case 9:
				return !$.support.noCloneEvent && $.support.opacity;
			default :
				return !$.support.opacity;
		}
		return false;
	};
	
	$._getMaxWidth = function(options){
		var op = $.extend({
			act : $('table')
		},options || {});
	
		var maxValue = 0;
		if(op.act.length >= 1){
			op.act.each(function(){
				if(maxValue < $(this).outerWidth()){
					maxValue = $(this).outerWidth();
				}
			});
			return maxValue;
		}else{
			return maxValue;
		}
	};
	
	
	//**********************************
	// Original Methods
	//**********************************
	$.fn.extend({
	
		// Container Resize
		//----------------------------------
		containerResize : function(){
			var bwObj = {
				w				: $(window),
				wW			: $(window).width(),
				wr			: $("#allWrap"),
				wrW			: parseInt($("#allWrap").css('width')),
				s				: $('#sectionWrap'),
				sW			: $('#sectionWrap').outerWidth(),
				r				: $('#rightSection'),
				rW			: parseInt($('#rightSection').css('width')),
				l				: $('#leftSection'),
				lW			: parseInt($('#leftSection').css('width')),
				t				: $('table'),
				tW			: $('table').width(),
				ca			: $('#contentsArea'),
				caW			: $('#contentsArea').innerWidth(),
				mC			: $('.moreColumns'),
				common	: function(){$('#header,#nav,#location,#footer').addClass('ml00');},
				posFix	: function(){
										$('.resultConfig, .searchBar .searchHelp, .searchResultsNavi > .pagebtnRow').each(function(){
											$t = $(this);
											// Set Element Width for IE6,7
											if($._isIE(6) || $._isIE(7)){
												if($t.attr('class') == 'resultConfig' && !$t.attr('style')){
													var widths = [];
													var total = 0;
													$t.children().each(function(){
														widths.push($(this).outerWidth());
													});
													for(var i=0; i<widths.length; i++){
														total += widths[i];
													}
													$t.css('width',total);
												}
											}
											//if($t.css('left')){
												$t.css({'position' : 'absolute',
																'left' : $t.position().left,
																'float' : 'none'
												});
											//}
										});
									}
			}
			
			// get max width table
			bwObj.tW = $._getMaxWidth();
			
			if(bwObj.lW < bwObj.rW && $(bwObj.r).length){
				if(bwObj.tW > bwObj.rW){
					if(bwObj.wW > bwObj.wrW && !bwObj.wr.attr('style')){
						var diffA = (bwObj.wW - bwObj.wrW)/2;
						bwObj.wr.css({'margin-left' : diffA,
													'text-align' : 'left'
												});
					}
					bwObj.posFix();
					bwObj.common();
					var diff = bwObj.tW - bwObj.rW;
					if(bwObj.ca.length && !bwObj.mC.length){
						var caPadding = bwObj.caW - bwObj.ca.width()+2;
						if(!$._isIE(6)){bwObj.ca.width(bwObj.caW + diff);}
						bwObj.wr.width(bwObj.wrW + diff + caPadding);
						bwObj.r.width(bwObj.rW + diff + caPadding);
					}else{
						bwObj.wr.width(bwObj.wrW + diff);
						bwObj.r.width(bwObj.rW + diff);
					}
				}
			}else if(bwObj.s.length){
				if(bwObj.s.css('width')=='auto' && $._isIE(6)){bwObj.sW = 986;}// for IE6
				if(bwObj.tW > bwObj.sW){
					var diffOut = bwObj.wW - bwObj.wrW;
					var diffIn = bwObj.tW - bwObj.sW;
					var $tab = $('#tab-level1');
					if(bwObj.wW < bwObj.wrW){
						bwObj.posFix();
						bwObj.common();
					}else{
						if(diffOut < diffIn){
							bwObj.posFix();
							bwObj.wr.css({'margin-left' : diffOut/2,
														'text-align' : 'left'
							});
							bwObj.common();
						}else if(!$tab.attr('style')){
							$tab.css('padding-left',(diffIn/2)+12);
							bwObj.wr.css('background-image','none');
						}else{
							var $tabPad = parseInt($tab.css('padding-left'));
							$tab.css('padding-left',$tabPad+(diffIn/2));
							bwObj.wr.css('background-image','none');
						}
					}
					bwObj.wr.css('width',bwObj.wrW + diffIn);
					bwObj.s.css('width',bwObj.sW + diffIn);
				}
			}
			
			// Adjust fixWidth List Elements
			$('ul[class*="fixW"] > li','#sectionWrap').each(function(){
				var $t = $(this);
				if($t.attr('style')){
					$t.attr('style','');
				}
				if($t.contents().length >1){
					$t.wrapInner('<span></span>');
				}
				if(($t.children().width() - parseInt($t.css('width'))) > 0){
					$t.css('width',$t.children().width());
				}
			});
		},
		
		
		// for regionSelect
		//----------------------------------
		popWindow : function(btn){
			var $t = $(this);
			var $p = $t.parent();
			if(!$t.hasClass('active')){
				$t.css('display','none');
			}
			$(btn).click(function(){return false});
			$(btn).mousedown(function(){
				if($t.hasClass('active')){
					$p.removeClass('active');
					$t.removeClass('active');
					$t.fadeOut(function(){$t.removeClass('active')});
				}else{
					$p.addClass('active');
					$t.addClass('active');
					$t.fadeIn(function(){$t.addClass('active')});
				}
			});
			$('body').click(function(){
				if($t.hasClass('active')){
					$p.removeClass('active');
					$t.removeClass('active');
					$t.fadeOut(function(){$t.removeClass('active')});
				}
			})
		},
		
		
		// searchArea | searchBar
		//----------------------------------
		setFocus : function(btn){
			var $t = $(this);
			var $defPhrase = $t.attr('value');
			var message = 'No keyword was entered. Please enter your keyword again.';
			// Focus Action
			$t.focus(function(){
				if(!$t.attr('value').length || $t.attr('value') == $defPhrase){
					$t.attr('value','');
				}else return true;
			});
			// Blur Action
			$t.blur(function(){
				if(!$t.attr('value').length){
					$t.attr('value',$defPhrase);
				}else return true;
			});
			// Search Button Action
			$(btn).click(function(){
				if(!$t.attr('value').length || $t.attr('value') == $defPhrase){
					alert(message);
					return false;
				}else return true;
			});
		},
		
		
		// Add Parameter
		//----------------------------------
		paramAdjust : function(){
			$(this).find('a').each(function(){
				var $t = $(this);
				$t.toggle(function(){
					$t.text("See Less Parameter");
					$t.toggleClass('active');
					$('#selectorUnit .hide').fadeIn()
																	.attr('class','paramBox more');
				},function(){
					$t.text("See More Parameter");
					$t.toggleClass('active');
					$('#selectorUnit .more').fadeOut()
																	.attr('class','paramBox hide');
				});
			});
		},
		
		
		// Sort Table
		//----------------------------------
		sortTable : function(){
			$(this).find('.btn').each(function(){
			var $t = $(this);
				$t.click(function(){
					if($t.hasClass('sortUp') || $t.hasClass('sortDown')){
						if($t.hasClass('sortUp')){
							$t.removeClass('sortUp');
							$t.addClass('sortDown');
						}else{
							$t.removeClass('sortDown');
							$t.addClass('sortUp');
						}
					}else{
						$('#selectorResult').find('.sortDown').removeClass('sortDown');
						$('#selectorResult').find('.sortUp').removeClass('sortUp');
						$t.addClass('sortDown');
					}
				});
			});
		},
		
		
		// FAQ Relevant Product Action
		//----------------------------------
		fadeToggle : function(target){
			$(this).find(target).each(function(){
				var $t = $(this);
				var $p = $t.parent();
				$t.toggle(function(){
					$p.toggleClass('active');
					$p.next().eq(0).fadeIn();
				},function(){
						$p.toggleClass('active');
						$p.next().eq(0).fadeOut('fast');
					});
			});
		}
		
		
		// tab
		//----------------------------------
		/*
		switch_tab : function(tabName, divName, effectArea){
			var $t = $(this);
			
			$t.find(tabName).eq(0).addClass('tab-active');
			$t.find(divName).eq(0).addClass('tab-active');
			tempL = $t.find(tabName).size();
			for(var i=0; i<tempL; ++i){
				$t.find(tabName).eq(i).attr('num', i);
				$t.find(divName).eq(i).each(function(){
					if(!$(this).hasClass('tab-active')){
						$(this).css('display','none');
					}
				});
			}
			$('#rightSection').switch_tab('.tab-btn','.tc','.tab_content')
			
			$t.find(tabName).bind('mousedown',function(e){
				var tempVal=$(this).attr('num');
				var temptarget = $t.find(effectArea)
				temptarget.find('.tab-active').css('display','none')
				$t.find('.tab-active').removeClass('tab-active')
				$(this).addClass('tab-active')
				temptarget.find(divName).eq(tempVal).addClass('tab-active').fadeIn()
				})
		},*/
		
		

		
	
	});//END $.fn.extend
	
	
//**********************************
// Plugins
//**********************************
/*---------------------------------------------------------------
jquery-auto-height.js

Copyright (c) 2010 Tomohiro Okuwaki (http://www.tinybeans.net/blog/)
Licensed under MIT Lisence:
http://www.opensource.org/licenses/mit-license.php
http://sourceforge.jp/projects/opensource/wiki/licenses%2FMIT_license

Since:   2010-04-19
Update:  2010-07-02
version: 0.03
Comment: 

jQuery 1.2 later
 ----------------------------------------------------------------*/
$.fn.autoHeight = function(options){
	var op = $.extend({
		column  : 0,
		clear   : 1,
		height  : 'min-height', // or [height]
		reset   : 'reset', // height reset
		descend : function descend (a,b){ return b-a; }
	},options || {});
	
	var self = $(this);
	var n = 0,
		hMax,
		hList = new Array(),
		hListLine = new Array();
		hListLine[n] = 0;
		
	// get elements height
	self.each(function(i){
		if (op.reset == 'reset'){
			//$(this).removeAttr('style');
			$(this).css(op.height,'0');
			if($._isIE(6)){$(this).css('height','0');}
		}
		var h = $(this).innerHeight();
		hList[i] = h;
		if (op.column > 1){
			if (h > hListLine[n]){
				hListLine[n] = h;
			}
			if ((i > 0) && (((i+1) % op.column) == 0)){
				n++;
				hListLine[n] = 0;
			};
		}
	});
	

	hList = hList.sort(op.descend);
	hMax = hList[0];
	
	var browser = $.browser.version;
	if (op.column > 1){
		for (var j=0; j<hListLine.length; j++){
			for (var k=0; k<op.column; k++){
				if (browser == '6.0'){
					self.eq(j*op.column+k).height(hListLine[j]);
					if (k == 0 && op.clear != 0) self.eq(j*op.column+k).css('clear','both');
				} else {
					self.eq(j*op.column+k).css(op.height,hListLine[j]);
					if (k == 0 && op.clear != 0) self.eq(j*op.column+k).css('clear','both');
				}
			}
		}
	} else {
		if (browser == '6.0'){
			self.height(hMax);
		} else {
			self.css(op.height,hMax);
		}
	}
	
};



/*---------------------------------------------------------------
jQuery.slideScroll.js

jQuery required (tested on version 1.2.6)
encoding UTF-8

Copyright (c) 2008 nori (norimania@gmail.com)
http://moto-mono.net
Licensed under the MIT

$Update: 2008-12-24 20:00
$Date: 2008-12-22 23:30
 ----------------------------------------------------------------*/
$.fn.slideScroll = function(options){
	
	var c = $.extend({
		interval: 20,
		easing: 0.6, // 0.4 ~ 2.0 
		comeLink: false
	},options);
	var d = document;
	
	var timer;
	var pos;
	
	function currentPoint(){
		var current = {
			x: d.body.scrollLeft || d.documentElement.scrollLeft,
			y: d.body.scrollTop || d.documentElement.scrollTop
		}
		return current;
	}
	
	function setPoint(){
		var h = d.documentElement.clientHeight;
		var w = d.documentElement.clientWidth;
		var maxH = d.documentElement.scrollHeight;
		var maxW = d.documentElement.scrollWidth;
		
		pos.top = ((maxH-h)<pos.top && pos.top<maxH) ? maxH-h : pos.top;
		pos.left = ((maxW-w)<pos.left && pos.left<maxW) ? maxW-w : pos.left;
	}
	
	function nextPoint(){
		var x = currentPoint().x;
		var y = currentPoint().y;
		var sx = Math.ceil((x - pos.left)/(5*c.easing));
		var sy = Math.ceil((y - pos.top)/(5*c.easing));
		var next = {
			x: x - sx,
			y: y - sy,
			ax: sx,
			ay: sy
		}
		return next;
	}
	
	function scroll(){
		timer = setInterval(function(){
			nextPoint();
			
			if(Math.abs(nextPoint().ax)<1 && Math.abs(nextPoint().ay)<1){
				clearInterval(timer);
				window.scroll(pos.left,pos.top);
			}
			window.scroll(nextPoint().x,nextPoint().y);
		},c.interval);
	}
	
	function comeLink(){
		if(location.hash){
			if($(location.hash) && $(location.hash).length>0){
				pos = $(location.hash).offset();
				setPoint();
				window.scroll(0,0);
				if($.browser.msie){
					setTimeout(function(){
						scroll();
					},50);
				}else{
					scroll();
				}
			}
		}
	}
	if(c.comeLink) comeLink();
	
	$(this).each(function(){
		if(this.hash && $(this.hash).length>0 
			&& this.href.match(new RegExp(location.href.split("#")[0]))){
			var hash = this.hash;
			$(this).click(function(){
				pos = $(hash).offset();
				clearInterval(timer);
				setPoint();
				scroll();
				return false;
			});
		}
	});
};



/*---------------------------------------------------------------
// Splits a single list into a number of lists, which can be styled into a multicolumn list.
//
// usage $("#my_list_id").columns(n);
// - Splits the list with id "my_list_id" into n columns.
//
// The lists will be nested inside an unordered list whose id is the same as the original list's.
// Note that the original list will be deleted.
//
// Parameters:
// numberOfColumns: the number of columns to split the list into.
// padIncompleteColumns: If set to true, and the source list does not contain enough items to 
//                       completely fill the last column, the plugin will pad that column with
//                       <li>&nbsp;</li>.
 ----------------------------------------------------------------*/
jQuery.fn.columns = function(numberOfColumns, padIncompleteColumns){
	return this.each(function (){
		var $this = jQuery(this);
		//var targetId = $this.attr("id");
		var targetClass = $this.attr("class");
		$this.attr("class", targetClass + "_src");
		var container = "<ul class=\"" + targetClass + "\"></ul>";
		
		$this.after(container);
		target = $this.next();
		// Create some sublists in the new list. We'll need as many as we have columns.
		createSubLists(target, numberOfColumns);
		// Move the contents of the old list into the new ones.
		splitList(jQuery("li", $this), jQuery("ul", target), numberOfColumns, padIncompleteColumns);
		// Apply styles to alternating columns.
		applyStyle(jQuery("ul", target), "even", "odd");
		// Remove the old list from the DOM.
		$this.remove();
	});
	
	function createSubLists(container, numberOfSublists){
		for (i = 0; i < numberOfSublists; i++)
			container.append("<ul></ul>");
	}
	
	function splitList(source, target, numberOfColumns, padIncompleteColumns){
		column = 0;
		counter = 0;
		// Determine how many items we need to stuff in each column to reach the full number.
		itemsPerColumn = Math.ceil(source.length / numberOfColumns);
		
		source.each(function (i){
			// Select the columns and put the list item in the current one.
			target[column].appendChild(this);
			counter++;
			if (counter == itemsPerColumn){
				// We've filled one column, move to the next.
				column ++;
				counter = 0;
			}
		});
		
		// If we can't fill up the columns, add more items.
		/*if (counter != 0 && padIncompleteColumns)
			while (counter < itemsPerColumn){
				jQuery(target[column]).append("<li>&nbsp;</li>");
				counter++;
			}*/
	}
	
	// Applies the even style to even numbered columns, and the odd style to odd numbered columns.
	function applyStyle(columns, even, odd){
		columns.each(function (i){
			// We're using i+1 because the index is 0 based, so the 1st column is 0, etc.
			// If we don't do this, then the odd/even columns would be inverted (eg. column index 2 is actually the third visible column).
			jQuery(this).addClass(((i+1) % 2) == 0
				? even
				: odd);
		});
	}
}



/*---------------------------------------------------------------
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * Create a cookie with the given name and value and other optional parameters.
 *
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * @desc Create a cookie with all available options.
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.
 * @example $.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * @param String name The name of the cookie.
 * @param String value The value of the cookie.
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * @type undefined
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */


/**
 * Get the value of a cookie with the given name.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
---------------------------------------------------------------*/
jQuery.cookie = function(name, value, options){
	if (typeof value != 'undefined'){ // name and value given, set cookie
			options = options || {};
			if (value === null){
					value = '';
					options.expires = -1;
			}
			var expires = '';
			if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)){
					var date;
					if (typeof options.expires == 'number'){
							date = new Date();
							date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
					} else {
							date = options.expires;
					}
					expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
			}
			// CAUTION: Needed to parenthesize options.path and options.domain
			// in the following expressions, otherwise they evaluate to undefined
			// in the packed version for some reason...
			var path = options.path ? '; path=' + (options.path) : '';
			var domain = options.domain ? '; domain=' + (options.domain) : '';
			var secure = options.secure ? '; secure' : '';
			document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
	} else { // only name given, get cookie
			var cookieValue = null;
			if (document.cookie && document.cookie != ''){
					var cookies = document.cookie.split(';');
					for (var i = 0; i < cookies.length; i++){
							var cookie = jQuery.trim(cookies[i]);
							// Does this cookie string begin with the name we want?
							if (cookie.substring(0, name.length + 1) == (name + '=')){
									cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
									break;
							}
					}
			}
			return cookieValue;
	}
};


})(jQuery);


// for Debug
//============================
if (!('console' in window)){
		window.console = {};
		window.console.log = function(str){
				return str;
		};
}
//============================
