var replace_url = '';
var product_base_url = '';
var genre_li_index = 1;
var series_li_index = 1;
var menu_li_index = 1;
var sub_menu_li_index = 1;
var sub_sub_menu_li_index = 1;
var horizontal_menu_index = null;
var horizontal_menu_move_mode = null;
var recommend_series_length = 1;
var liTagAttr = "name";

function init(context){
	// web context
	replace_url = context;
	product_base_url = replace_url + '/frontend/';
	/*
	$("div[@class='sidemenu03Top'] a").each(
		function(){ 
			//alert(this.innerHTML);
			
			// only genre can play js
			var ul = this.parentNode.parentNode;
			if(ul.className == 'categorysidemenu02'){
				if(this.className == 'focus'){
					jQuery(this).toggle(
						hideTreeNodes,
						showTreeNodes
					) 
				}else{
					jQuery(this).toggle(
						showTreeNodes,
						hideTreeNodes
					) 
				}
			}
		}
	);
	*/
}

function getSideUl(obj)
{
	var li = obj.parentNode;
	for(var i=0; i<li.childNodes.length; i++){
	
		var tag_name = li.childNodes[i].tagName;
		var child_node = li.childNodes[i];
		
		if(tag_name == 'UL')
		{
			return child_node;
		}
	}
	return null;
}

function hideTreeNodes(obj){

	var cur_obj;
	if(this.tagName != 'A'){
		cur_obj = obj;
	}else{
		cur_obj = this;
	}
	
	listSort(getSideUl(cur_obj));
	
	var li = cur_obj.parentNode;
	
	var mode = 'show';
	
	changeAllChild(li, mode);
	
	// hide other nodes
	var curr_node = cur_obj;
	$("div[@class='sidemenu03Top'] a").each(
		function(){ 
			if(this.className == 'focus' && this != cur_obj){
			
				var li = this.parentNode;
				var mode = 'hide';
				
				changeAllChild(li, 'hide');
				
				this.className = 'hover';
				this.parentNode.className = '';
				
				// sort
				//listSort(getSideUl(cur_obj));
			}
			return;
		}
	);
	cur_obj.className = 'focus';
	this.parentNode.className = 'categoryfocus';
	
	// do ajax
	getAllContents(cur_obj.lang);
	
	// move to first place
	replacePlace(cur_obj);
}


function showTreeNodes(obj){

	var cur_obj;
	if(this.tagName != 'A'){
		cur_obj = obj;
	}else{
		cur_obj = this;
	}
	
	listSort(getSideUl(cur_obj));

	var li = cur_obj.parentNode;
	
	var mode = 'show';
	
	changeAllChild(li, mode);
	
	// sort
	//listSort(li.parentNode);
	
	// hide other nodes
	var curr_node = cur_obj;
	$("div[@class='sidemenu03Top'] a").each(
		function(){ 
			if(this.className == 'focus' && this != cur_obj){
			
				var li = this.parentNode;
				var mode = 'hide';
				
				changeAllChild(li, 'hide');
				
				this.className = 'hover';
				this.parentNode.className = '';
				
				// sort
				//listSort(getSideUl(cur_obj));
			}
			return;
		}
	);
	cur_obj.className = 'focus';
	this.parentNode.className = 'categoryfocus';
	
	// do ajax
	getAllContents(cur_obj.lang);
	
	// move to first place
	replacePlace(cur_obj);
}

function changeAllChild(node, mode){

	var link = 'A';
	var ul = 'UL';
	var li = 'LI';
	var div = 'DIV';
	
	for(var i=0; i<node.childNodes.length; i++){
	
		var tag_name = node.childNodes[i].tagName;
		var child_node = node.childNodes[i];
		
		if(tag_name == link || tag_name == ul || tag_name == li){
			
			if(mode == 'hide'){
				if(child_node.className == 'focus')
					continue;
				$(child_node).hide();
			}else{
				$(child_node).show();
			}
		}else if(tag_name == div){
		
			node = node.childNodes[i];
			for(var i=0; i<node.childNodes.length; i++){
			
				var tag_name = node.childNodes[i].tagName;
				var child_node = node.childNodes[i];
				
				if(tag_name == link || tag_name == ul || tag_name == li){
				
					if(mode == 'hide'){
						$(child_node).hide();
					}else{
						$(child_node).show();
					}
				}
			}
		}
	}
}

function getAllContents(code){
	var param = 'code=' + code + '&';
	var action;
	var element;
	
	action = replace_url + '/frontend/product/replace.do';

	// job1: breadcrumb
	breadcrumb_param = param +  'mode=0';
	breadcrumb_element = 'div_product_breadcrumb';
	__doProductPostByAjax(breadcrumb_param, action, breadcrumb_element);
	
	// job2: genre free space html
	freespace_param = param +  'mode=1';
	freespace_element = 'div_html_content';
	__doProductPostByAjax(freespace_param, action, freespace_element);
	
	// job3: side bar
	sidebar_param = param +  'mode=2';
	sidebar_element = 'div_product_sidebar';
	__doProductPostByAjax(sidebar_param, action, sidebar_element);
	
	// job4: product name
	product_name_param = param +  'mode=4';
	product_name_element = 'div_product_name';
	
	__doProductPostByAjax(product_name_param, action, product_name_element);
	
	// job5: product query in footer-layout
	product_query_param = param +  'mode=6';
	product_query_element = 'div_product_query';
	
	__doProductPostByAjax(product_query_param, action, product_query_element);
}


/**
 * series/menu/menu1, when onclick, do ajax then show childNodes
 */
function showChildByAjax(obj, element){

	var li = obj.parentNode;
	var param = 'code=' + element + '&';
	var action;
	var element;
	
	element = 'div_menu_of_' + element;
	action = replace_url + '/frontend/product/replace.do';
	
	// job5: top page
	series_param = param +  'mode=5';
	series_element = 'div_html_content';
	__doProductPostByAjax(series_param, action, series_element, true);
	
	// job4: menu
	menu_param = param +  'mode=3';
	__doProductPostByAjax(menu_param, action, element);
	
	// job1: breadcrumb
	breadcrumb_param = param +  'mode=0';
	breadcrumb_element = 'div_product_breadcrumb';
	__doProductPostByAjax(breadcrumb_param, action, breadcrumb_element);

	// job3: side bar
	sidebar_param = param +  'mode=2';
	sidebar_element = 'div_product_sidebar';
	__doProductPostByAjax(sidebar_param, action, sidebar_element);
	
	// job5: prduct name
	product_name_param = param +  'mode=4';
	product_name_element = 'div_product_name';
	
	__doProductPostByAjax(product_name_param, action, product_name_element);
	
	
	// job5: product query in footer-layout
	product_query_param = param +  'mode=6';
	product_query_element = 'div_product_query';
	
	__doProductPostByAjax(product_query_param, action, product_query_element);
	
	// hide other nodes
	
	var parent_ul = li.parentNode.parentNode.parentNode;
	
	if(obj.className != 'focus'){
		hideSeriesMenu(parent_ul);
	}
	obj.className = 'focus';
	
	// move to first place
	replacePlace(obj);
}

function hideSeriesMenu(ul){

	for(var n=0; n<ul.childNodes.length; n++){
			
		var tag_name = ul.childNodes[n].tagName;
		var child_node = ul.childNodes[n];
		
		if(tag_name == 'LI'){
		
			for(var i=0; i<child_node.childNodes.length; i++){
				
				var sub_tag_name = child_node.childNodes[i].tagName;
				var sub_child_node = child_node.childNodes[i];
			
				if(sub_tag_name == 'UL'){
				
					// look for LI
					for(var j=0; j<sub_child_node.childNodes.length; j++){
					
						var sub_sub_tag_name = sub_child_node.childNodes[j].tagName;
						var sub_sub_child_node = sub_child_node.childNodes[j];
						
						if(sub_sub_tag_name == 'LI'){
							
							// look for A
							var focus_flg = 'false';
							var need_hover_a;
							for(var m=0; m<sub_sub_child_node.childNodes.length; m++){
								
								var sub_sub_sub_tag_name = sub_sub_child_node.childNodes[m].tagName;
								var sub_sub_sub_child_node = sub_sub_child_node.childNodes[m];
								
								if(sub_sub_sub_tag_name == 'A' && sub_sub_sub_child_node.className == 'focus'){
									focus_flg = 'true';
									need_hover_a = sub_sub_sub_child_node;
								}
								
								if(focus_flg == 'true' && sub_sub_sub_tag_name == 'DIV'){
									for(var k=0; k<sub_sub_sub_child_node.childNodes.length; k++){
									
										if(sub_sub_sub_child_node.childNodes[k].tagName == 'UL'){
											$(sub_sub_sub_child_node.childNodes[k]).hide();
										}
									}
									
									need_hover_a.className = 'hover';
									
									continue;
								}
							
							}
							continue;
						}
					}
				}
			}
			continue;
		}
	}
}

/**
 * change menu menuList
 */
function changeMenuMenu(obj, code, itemId, dsp_format){
	
	if(showCurrentMenu(obj))
	{
		obj.className = 'focus';
		
		// show menu page
		changeMenuPage(code, itemId, dsp_format);
		
		// change horizontal menu
		changeSeriesMenu(itemId, 'false');
		
		// clear horizontal menu valiables
	 	horizontal_menu_index = null;
 		horizontal_menu_move_mode = null;
 		
 		// move to first place
		//replacePlace(obj);
	}
}

/**
 * change sub menu
 */
function changeMenuSub(obj, code, itemId, parentId, dsp_format){
	//alert('changeMenuSub');
	if(showCurrentMenu(obj))
	{
		obj.className = 'focus';
		
		// show menu page
		changeMenuPage(code, itemId, dsp_format);
		
		// change horizontal menu
		changeSeriesMenu(parentId, 'false', null, itemId);
		
		// clear horizontal menu valiables
	 	horizontal_menu_index = null;
 		horizontal_menu_move_mode = null;
 		
 		// move to first place
		//replacePlace(obj);
	}
}

/**
 * change sub SubMenu
 */
function changeMenuSubSub(obj, code, itemId, parentId, parent_parentId, dsp_format){
	//alert('changeMenuSubSub');
	//alert(obj.innerHTML);
	if(showCurrentMenu(obj))
	{
		//listSort(obj.parentNode.parentNode);
		
		obj.className = 'focus';
		
		// show menu page
		changeMenuPage(code, itemId, dsp_format);
		
		// change horizontal menu
		changeSeriesMenu(parent_parentId, 'false', null, parentId, itemId);
		
		// clear horizontal menu valiables
	 	horizontal_menu_index = null;
 		horizontal_menu_move_mode = null;
 		
 		// move to first place
		//replacePlace(obj);
	
	}
}

function showCurrentMenu(obj){
	//alert(obj);
	//alert(obj.innerHTML);
	//alert(obj.title);
	var li = obj.parentNode;
	
//	// hide
//	if(obj.className == 'focus'){
//	
//		//changeAllChild(li, 'hide');
//		
//		//obj.className = 'hover';
//		
//		return false;
//	}
//	// show
//	else{
	
		changeAllChild(li, 'show');
		//alert('changeAllChild go on');
		// hide other menu
		var parent_div = li.parentNode.parentNode;
		
		
		for(var i=0; i<parent_div.childNodes.length; i++){
			
			var tag_name = parent_div.childNodes[i].tagName;
			var child_node = parent_div.childNodes[i];
			
			if(tag_name == 'UL'){
			
				//listSort(child_node);
			
				for(var j=0; j<child_node.childNodes.length; j++){
			
					var sub_tag_name = child_node.childNodes[j].tagName;
					var sub_child_node = child_node.childNodes[j];
					
					if(sub_tag_name == 'LI'){
					
						var focus_flg = 'false';
						var need_hover_a;
							
						for(var m=0; m<sub_child_node.childNodes.length; m++){
			
							var sub_sub_tag_name = sub_child_node.childNodes[m].tagName;
							var sub_sub_child_node = sub_child_node.childNodes[m];
					
							if(sub_sub_tag_name == 'A' && sub_sub_child_node.className == 'focus'){
								//alert(sub_sub_child_node.innerHTML);
								if(obj.className != 'focus')
								{
									// hide sub menu
									hideChildMenuUl(sub_sub_child_node);
								
									focus_flg = 'true';
									need_hover_a = sub_sub_child_node;
								}
								if(obj == sub_sub_child_node && obj.className == 'focus')
								{
									// hide sub menu
									hideChildMenuUl(sub_sub_child_node);
									
								}
							}
							
							if(focus_flg == 'true' && sub_sub_tag_name == 'UL'){
								if(obj.className != 'focus')
								{
									$(sub_sub_child_node).hide();
								}
								
								continue;
							}
							if(focus_flg == 'true'){
								if(obj.className != 'focus')
								{
									need_hover_a.className = 'hover';
								}
							}
							
						}
						continue;
					}
				}
			}
		}
		return true;
	//}
}

/**
 * hide child UL 
 */
function hideChildMenuUl(node, mode)
{
	var li = node.parentNode;
	
	for(var i=0; i<li.childNodes.length; i++){
			
		var tag_name = li.childNodes[i].tagName;
		var child_node = li.childNodes[i];
		
		if(tag_name == 'UL'){
		
			for(var j=0; j<child_node.childNodes.length; j++){
		
				var sub_tag_name = child_node.childNodes[j].tagName;
				var sub_child_node = child_node.childNodes[j];
				
				if(sub_tag_name == 'LI'){
				
					var focus_flg = 'false';
					var need_hover_a;
						
					for(var m=0; m<sub_child_node.childNodes.length; m++){
		
						var sub_sub_tag_name = sub_child_node.childNodes[m].tagName;
						var sub_sub_child_node = sub_child_node.childNodes[m];
				
						if((sub_sub_tag_name == 'A' && sub_sub_child_node.className == 'focus')
							||(mode != undefined && mode == 'hiorizMode')){
							
							// event by series hioriz menu
							if(mode != undefined && mode == 'hiorizMode'){
								// hide parent ul
								$(sub_sub_child_node.parentNode.parentNode).hide();
							}
							
							// hide sub menu
							hideChildMenuUl(sub_sub_child_node, mode);
						
							focus_flg = 'true';
							need_hover_a = sub_sub_child_node;
						}
						
						if(focus_flg == 'true' && sub_sub_tag_name == 'UL'){
							$(sub_sub_child_node).hide();
							continue;
						}
						if(focus_flg == 'true'){
							need_hover_a.className = 'hover';
						}
						
					}
					continue;
				}
			}
		}
	}
}


/**
 *
 */
function changeMenuPage(code, itemId, dsp_format){

	var mode;
	var param = 'code=' + code + '&';
	var base_action = replace_url + '/frontend/product/replace.do';
	var action;
	var element = 'seriesContent';
	
	// job1: breadcrumb
	breadcrumb_param = param + '&mode=0&itemId=' + itemId;
	breadcrumb_element = 'div_product_breadcrumb';
	__doProductPostByAjax(breadcrumb_param, base_action, breadcrumb_element);
	
	// download page
	if(dsp_format == 5){
		var download_param = param + 'dsp_format=' + dsp_format; 
		action = replace_url + '/frontend/series/download.do';
		
		__doProductPostByAjax(download_param, action, element);
	}
	
	// products page
	else if(dsp_format == 6){
		var products_param = param + 'dsp_format=' + dsp_format; 
		action = replace_url + '/frontend/series/products.do';
		
		__doProductPostByAjax(products_param, action, element);
	}
	
	// showMenu page
	else{
		var show_menu_param = param + 'itemId=' + itemId;
		action = replace_url + '/frontend/series/showMenuPage.do';
		
		__doProductPostByAjax(show_menu_param, action, element);
	}
	
		
	// job5: prduct name
	param += 'itemId=' + itemId + '&';
	var menu_title_param = param +  'mode=4';
	var menu_title_element = 'div_product_name';
	__doProductPostByAjax(menu_title_param, base_action, menu_title_element);
}


/**
 * change menu menuList
 */
function changeSubMenuMenu(obj){
	var li = obj.parentNode;
	
	// hide
	if(obj.className == 'focus'){
	
		changeAllChild(li, 'hide');
		
		obj.className = 'hover';
	}
	// show
	else{
	
		changeAllChild(li, 'show');
		
		// hide other nodes
		var parent_li = li.parentNode.parentNode;
		var focus_flg = 'false';
		var need_hover_a;
						
		for(var i=0; i<parent_li.childNodes.length; i++){
		
			var tag_name = parent_li.childNodes[i].tagName;
			var child_node = parent_li.childNodes[i];
			
			if(tag_name == 'UL'){
				
				for(var j=0; j<child_node.childNodes.length; j++){
				
					var sub_tag_name = child_node.childNodes[j].tagName;
					var sub_child_node = child_node.childNodes[j];
					
					if(sub_tag_name == 'LI'){
						var focus_flg = 'false';
						var need_hover_a;
						
						for(var m=0; m<sub_child_node.childNodes.length; m++){
			
							var sub_sub_tag_name = sub_child_node.childNodes[m].tagName;
							var sub_sub_child_node = sub_child_node.childNodes[m];
					
							if(sub_sub_tag_name == 'A' && sub_sub_child_node.className == 'focus'){
								focus_flg = 'true';
								need_hover_a = sub_sub_child_node;
							}
							
							if(focus_flg == 'true' && sub_sub_tag_name == 'UL'){
								$(sub_sub_child_node).hide();
								continue;
							}
							if(focus_flg == 'true'){
								need_hover_a.className = 'hover';
							}
							
						}
						continue;
					}
				}
			}
		}
		
		obj.className = 'focus';
	}
}

function showSubSubMenuPage(obj){

	obj.className = 'focus';
}

/**
 * do ajax reflash
 */
function __doProductPostByAjax(params, action, element, top_mode){
	$.ajax({
		type: "post",
		url: action,        
		dataType:"html",
		data: params,
		success: function(data, textStatus){
			
//			document.title="hello,title";
			
			if(top_mode != undefined && top_mode == true)
			{
				var content = data.toString();
				
				if(checkTopPageValidate(content))
				{	
					$("#"+element).html(data);
					document.title = $("#htmlTitle").val();
					//change htmltitle for ajax		
				}
				else
				{
					if($('#series_top_err') != undefined)
					{
						$('#series_top_err').submit();
					}
					// redirect err page
					//window.location.href = product_base_url + "series/error.do";
				}
			}
			else
			{
				$("#"+element).html(data);	
				document.title = $("#htmlTitle").val();
			}
		}
	});
}

function checkTopPageValidate(content)
{
   	var re = /id="pageFound"/i; 
   	var result = content.match(re); 
   	
   	if(result == undefined || result == null)
   	{
   		return true;
   	}
	else
	{
		return false;
	}
}

/**
 * show common oshiwase
 */
function showOshiWase(){
	
	$('#div_oshiwasei').show();

}

/**
 * show series of sub genre in GenrePage
 */
function showSeries(code){
//	location.href=product_base_url+"series/top.do?code="+code;
	
	$('#series_code').val(code);
	$('#frm_series_top').submit();

//	var param = 'code=' + element + '&';
//	var action;
//	var element;
//	
//	element = 'div_menu_of_' + element;
//	action = replace_url + '/frontend/product/replace.do';
//	// job4: menu
//	menu_param = param +  'mode=3';
//	__doProductPostByAjax(menu_param, action, element);
//	
//	// job1: breadcrumb
//	breadcrumb_param = param +  'mode=0';
//	breadcrumb_element = 'div_product_breadcrumb';
//	__doProductPostByAjax(breadcrumb_param, action, breadcrumb_element);
//	
//	// job5: prduct name
//	series_param = param +  'mode=5';
//	series_element = 'div_html_content';
//	
//	__doProductPostByAjax(series_param, action, series_element);
//	
//	// job3: side bar
//	sidebar_param = param +  'mode=2';
//	sidebar_element = 'div_product_sidebar';
//	__doProductPostByAjax(sidebar_param, action, sidebar_element);
//	
//	// job5: prduct name
//	product_name_param = param +  'mode=4';
//	product_name_element = 'div_product_name';
//	
//	__doProductPostByAjax(product_name_param, action, product_name_element);
//	
//	// job5: product query in footer-layout
//	product_query_param = param +  'mode=6';
//	product_query_element = 'div_product_query';
//	
//	__doProductPostByAjax(product_query_param, action, product_query_element);
}

/**
 * MainMenu and SeriesMenu Union
 */
function changeSeriesMenu(pageId, change_main_menu_flg, index, childId, child_childId){
	
	jQuery('.ffff').removeClass('focus');
	//jQuery('.focus').removeClass('focus');
	
	$('#'+pageId).parent().addClass('focus');
	
	// before and next btn change
	var scope = $("a[@name='vmenu']").size() - 1;
	
	if (index == undefined || index == null){
		// foucs class
		index = Number($('#'+pageId).attr('lang'));
		
		if(index == 0){
			$('#menu_before').hide(); 
			$('#menu_next').show(); 
		}else if(index == scope){
			$('#menu_before').show();
			$('#menu_next').hide(); 
		}else{
			$('#menu_before').show();
			$('#menu_next').show(); 
		}
	}else{
		if(index == 0){
			$('#menu_before').hide(); 
			$('#menu_next').show(); 
		}else if(index == scope){
			$('#menu_before').show();
			$('#menu_next').hide(); 
		}else{
			$('#menu_before').show();
			$('#menu_next').show(); 
		}
	}
	
	// change main menu
	if(change_main_menu_flg == 'true'){
		
		var itemId;
		
		// current horizon top subMenu
		if(pageId == 0 && childId != undefined)
		{
			itemId = childId;
		}
		else 
		{
			// Top Page
			if(pageId == 0)
			{
				// sort menu
				$("ul[@class='categorysidemenu04']").each(
					function(){ 
						listSort(this);
					}
				);
			}
			
			itemId = pageId;
		}
		
		// remove class
		$("ul[@class='categorysidemenu04'] a").each(
			function(){ 
				if(this.className == 'focus'){
					this.className = '';
					
					// hide main menu`s sub menu
					hideChildMenuUl(this, 'hiorizMode');
				}
			}
		);
		
		// foucs menu
		$("a[@lang='item_"+itemId+"']").each(
			function(){ 
				if(this.className != 'focus'){
					
					this.className = 'focus';
					
					// show main menu`s sub menu
					changeAllChild(this.parentNode, 'show');
					
					// move to first place
					//replacePlace(this);
				}
			}
		);
		// show main menu`s sub subMenu
		if(childId != undefined)
		{
			$("a[@lang='sub_link_"+childId+"']").each(
				function(){ 
					// show main menu`s sub menu
					changeAllChild(this.parentNode, 'show');
				}
			);
		}
		
		// focus sub menu
		if(pageId != 0 && childId != undefined)
		{
			// show sub menuList
			$("ul[@lang='sub_item_"+pageId+"']").each(
				function(){ 
					$(this).show();
				}
			);
			
			// focus current sub menu
			$("a[@lang='sub_link_"+childId+"']").each(
				function(){ 
					this.className = 'focus';
				}
			);
		}
		
		
	}
	// change horizon submenu
	changeHorizonSubMenu(pageId, childId, child_childId);

}

// series page
function changeHorizonSubMenu(itemId, childId, child_childId){

	// top menu
	if(itemId == 0 || itemId == undefined || itemId == null)
	{
		// show top
		$('#horizon_sub_menu_0').show();
	}
	else
	{
		// show current
		$('#horizon_sub_menu_'+itemId).show();
	}
	
	// hide other
	$("div[@lang='horizon_sub_menu']").each(
		function(){
			if(itemId == 0 || itemId == undefined || itemId == null)
			{
				if(this.id != 'horizon_sub_menu_0')
				{
					$(this).hide();
				}
			}
			else
			{
				if(this.id != 'horizon_sub_menu_'+itemId)
				{
					$(this).hide();
				}
			}
		}
	);
	
	if(childId != undefined && childId != null)
	{
		// focus current sub menu
		$("a[@lang='a_horizon_sub_menu_" + itemId + "']").each(
			function(){
			
				if(this.id != 'a_horizon_sub_menu_' + childId)
				{
					this.className = '';
				}
				else
				{
					this.className = 'text_bold';
				}
			}
		);
	}
	
	// remove all sub menu focus
	else if(childId == undefined && child_childId == undefined)
	{
		$("ul[@class='seriesBottomMenuTop clearfix'] > li > a").each(
			function(){
				if(this.className == 'text_bold')
				{
					this.className = '';
				}
			}
		);
	}
}


function changeMenuByNavi(mode, index){
	var curr_title;
	//alert(mode);
	horizontal_menu_move_mode = mode; 
	
	// before
	if(mode == 'before'){
		$("li[@class='ffff focus'] > a").each(
			function(){ 
				
				var before_index;
				if(index != undefined)
				{
					before_index = index - 1;
				}
				else
				{
					before_index = Number(this.lang) - 1;
				}
				//alert(before_index);
				
				curr_title = this[liTagAttr];
				//alert(curr_title);
				//alert(curr_title);
				
				do
				{
					horizontal_menu_index = before_index;
					curr_title = foucsValiateSeriesMenu(before_index);
					before_index--;
				}while(curr_title == 'nostatus')
			}
		);
	}
	// next
	else{
		var max = $("a[@name='vmenu']").size() - 1;
		
		$("li[@class='ffff focus'] > a").each(
			function(){ 
				
				var next_index;
				if(index != undefined)
				{
					next_index = index + 1;
				}
				else
				{
					next_index = Number(this.lang) + 1;
				}
				//alert(next_index);
				curr_title = this.title;
				
				//alert(curr_title);
				
				do
				{
					if(next_index > max)
					{
						next_index = 0;
					}
					horizontal_menu_index = next_index;
					curr_title = foucsValiateSeriesMenu(next_index);
					
					if((max == next_index && curr_title == 'nostatus') || next_index == 0)
					{
						// top event
						if(jQuery.browser["msie"])
						{
							$('#0').fireEvent("onclick");
						}
						else
						{
							$('#0').click();
						}
						
						var href = $('#0').attr('href');
						if(href != undefined && href != null && href != '' && href != '#' && href != 'javascript:void(0);')
						{
							doMenuGet(href);
							break;
						}
						else{
							next_index = 0;
						}
					}
					
					next_index++;
				}while(curr_title == 'nostatus')
			}
		);
	}
	horizontal_menu_index = null;
 	horizontal_menu_move_mode = null;
}

function foucsValiateSeriesMenu(index)
{
	var title;
	$("a[@lang='" + index + "']").each(
		function(){ 
			if(this.id != null && this.id != '')
			{
				if(this[liTagAttr] != 'nostatus')
				{
					//alert(this.innerHTML);
					//alert($(this).attr('onclick'));
					if(jQuery.browser["msie"])
					{
						this.fireEvent("onclick");
					}
					else
					{
						$(this).click();
					}
					
					var href = $(this).attr('href');
					if(href != undefined && href != null && href != '' && href != '#' && href != 'javascript:void(0);')
					{
						doMenuGet(href);
					}
				}
				title = this[liTagAttr];
			} 
		}
	);
	//alert(title);
	return title;
}

function changeValidateSubPage(obj, pageId, index, childId)
{
	if(obj.parentNode.className == 'focus' || obj.parentNode.className == 'ffff focus' )
	{
		return;
	}
	
	var aStyle = "a[@lang='sub_link_" + childId + "']";
	
	var sub_menu;
	var find_flg = 'false';
	$(aStyle).each(
		function(){ 
			
			if(find_flg == 'true')
			{
				return;
			}
			else if(this[liTagAttr] == pageId)
			{
				if(jQuery.browser["msie"])
				{
					this.fireEvent("onclick");
				}
				else
				{
					$(this).click();
				}
				
				find_flg = 'true';
				return;
			}
			else if(this[liTagAttr] == pageId + '_nostatus')
			{
				sub_menu = this;
				
				//listSort(getSideUl(sub_menu));
			
				if(find_flg == 'true')
				{
					return;
				}
				
				var li = this.parentNode;
				for(var i=0; i<li.childNodes.length; i++){
	
					var tag_name = li.childNodes[i].tagName;
					var child_node = li.childNodes[i];
				
					if(find_flg == 'true')
					{
						break;
					}
				
					if(tag_name == 'UL'){
						
						for(var j=0; j<child_node.childNodes.length; j++){
						
							var sub_tag_name = child_node.childNodes[j].tagName;
							var sub_child_node = child_node.childNodes[j];
							
							if(sub_tag_name == 'LI'){
								
								if(find_flg == 'true')
								{
									break;
								}
								
								for(var m=0; m<sub_child_node.childNodes.length; m++){
					
									var sub_sub_tag_name = sub_child_node.childNodes[m].tagName;
									var sub_sub_child_node = sub_child_node.childNodes[m];
							
									if(sub_sub_tag_name == 'A'){
										if(sub_sub_child_node[liTagAttr] == pageId){
							
											//alert(sub_sub_child_node.innerHTML);
											//alert(sub_menu.innerHTML);
											//alert($(sub_sub_child_node).attr('onclick'));
											if(sub_menu != undefined)
											{
												showCurrentMenu(sub_menu);
											}
											
											//if(jQuery.browser["msie"])
											//{
											//	sub_sub_child_node.fireEvent("onclick");
											//}
											//else
											//{
											//	$(sub_sub_child_node).click();
											//}
											
											find_flg = 'true';
											sub_menu.className = 'focus';
											//sub_sub_child_node.className = 'focus';
											
											// move to first place
											//replacePlace(sub_menu);
											
											// move to first place
											//replacePlace(sub_sub_child_node);
											
											break;
										}
									}
								}
							}
						}
					}
				}
			}
		}
	);
	
	obj.className = 'text_bold';
	
	// change horizon submenu
	changeHorizonSubMenu(pageId, childId);
}

function changeValidatePage(obj, pageId, index)
{
	if(obj.parentNode.className == 'focus' || obj.parentNode.className == 'ffff focus' )
	{
		return;
	}
	
	var nextUltyle = "div[@id='horizon_sub_menu_" + pageId + "'] > ul > li > a";

	var find_flg = 'false';
	$(nextUltyle).each(
		function(){
			if(find_flg == 'true')
			{
				return;
			}
			
			else if(this[liTagAttr] == pageId)
			{
				if(jQuery.browser["msie"])
				{
					this.fireEvent("onclick");
				}
				else
				{
					$(this).click();
				}	
				
				find_flg = 'true';
				return;
			}
			else
			{
				var index = 1;
				$("a[@lang='item_" + pageId + "']").each(
					function(){
						
						if(index != 1)
						{
							return;
						}
						else
						{
							if(jQuery.browser["msie"])
							{
								this.fireEvent("onclick");
							}
							else
							{
								$(this).click();
							}

							find_flg = 'true';
							return;
						}
					}
				);
				
				
			}
		}
	);
	
	// show div, and show validate subMenu
	if(find_flg == 'true')
	{
		//$('#horizon_sub_menu_' + pageId).show();
	}
	
	jQuery('.ffff').removeClass('focus');
	$(obj).parent().addClass('focus');
	
	// change horizon submenu
	changeHorizonSubMenu(pageId);
	
	// before and next btn change
	var scope = $("a[@name='vmenu']").size() - 1;
	if (index == undefined || index == null){
		// foucs class
		index = Number($('#'+pageId).attr('lang'));
		
		if(index == 0){
			$('#menu_before').hide(); 
			$('#menu_next').show(); 
		}else if(index == scope){
			$('#menu_before').show();
			$('#menu_next').hide(); 
		}else{
			$('#menu_before').show();
			$('#menu_next').show(); 
		}
	}else{
		if(index == 0){
			$('#menu_before').hide(); 
			$('#menu_next').show(); 
		}else if(index == scope){
			$('#menu_before').show();
			$('#menu_next').hide(); 
		}else{
			$('#menu_before').show();
			$('#menu_next').show(); 
		}
	}
	
	// side menu: remove class
	$("ul[@class='categorysidemenu04'] a").each(
		function(){ 
			if(this.className == 'focus'){
				this.className = '';
				
				// hide main menu`s sub menu
				hideChildMenuUl(this, 'hiorizMode');
			}
		}
	);
	
	// side menu: foucs menu
	$("a[@lang='item_"+pageId+"']").each(
		function(){ 
			if(this.className != 'focus'){
				
				this.className = 'focus';
				
				// show main menu`s sub menu
				changeAllChild(this.parentNode, 'show');
				
				// move to first place
				//replacePlace(this);
			}
		}
	);
}


function changePage(obj, pageId, index, childId)
{	//alert(obj);alert(pageId);alert(index);alert(childId);alert(obj.className);
	if(obj.parentNode != undefined && (obj.parentNode.className == 'focus' || obj.parentNode.className == 'ffff focus' ))
	{
		return;
	}
	
	var itemId;
	// click sub menu, and sub menu focus
	if(childId != undefined && childId != null)
	{
		itemId = childId;
	}
	else
	{	
		//alert($('#'+pageId).attr('class'));
		// click menu
		if($('#'+pageId).parent().attr('class') == 'ffff focus')
		{
			return;
		}
	
		itemId = pageId;
	}
	
	var action = replace_url + "/frontend/product/replace.do";
	
	// job1: breadcrumb
	breadcrumb_param = "itemId=" + itemId + "&code=" + $("#code").val() + '&mode=0';
	breadcrumb_element = 'div_product_breadcrumb';
	__doProductPostByAjax(breadcrumb_param, action, breadcrumb_element);
	
	// job5: title
	product_name_param = "itemId=" + itemId + "&code=" + $("#code").val() + '&mode=4';
	product_name_element = 'div_product_name';
	
	__doProductPostByAjax(product_name_param, action, product_name_element);
	
	// job6: product query in footer-layout
	product_query_param = "itemId=" + pageId + "&code=" + $("#code").val() + '&mode=6';
	product_query_element = 'div_product_query';
	
	__doProductPostByAjax(product_query_param, action, product_query_element);
	
	action = replace_url + '/frontend/series/showMenuPage.do';
	$.post(action+"?itemId="+itemId+"&code="+$("#code").val(),
						function(txt){
							//change htmltitle for ajax
							jQuery('#seriesContent').html(txt);
				});	//alert('changeSeriesMenu');			
	changeSeriesMenu(pageId, 'true', index, childId);
}

function goDownload(obj, pageId, index, childId){

	if(obj.parentNode.className == 'focus' || obj.parentNode.className == 'ffff focus' )
	{
		return;
	}

	var itemId;
	// click sub menu, and sub menu focus
	if(childId != undefined && childId != null)
	{
		itemId = childId;
	}
	else
	{	
		// click menu
		if($('#'+pageId).parent().attr('class') == 'ffff focus')
		{
			return;
		}
	
		itemId = pageId;
	}
	
	var action = replace_url + "/frontend/product/replace.do";
	
	// job1: breadcrumb
	breadcrumb_param = "itemId=" + itemId + "&code=" + $("#code").val() + '&mode=0';
	breadcrumb_element = 'div_product_breadcrumb';
	__doProductPostByAjax(breadcrumb_param, action, breadcrumb_element);
	
	// job5: title
	product_name_param = "itemId=" + pageId + "&code=" + $("#code").val() + '&mode=4';
	product_name_element = 'div_product_name';
	
	__doProductPostByAjax(product_name_param, action, product_name_element);
	
	// job6: product query in footer-layout
	product_query_param = "itemId=" + pageId + "&code=" + $("#code").val() + '&mode=6';
	product_query_element = 'div_product_query';
	
	__doProductPostByAjax(product_query_param, action, product_query_element);
	
	action = replace_url + '/frontend/series/download.do';
	$.post(action+"?code="+$("#code").val(),
						function(txt){
							jQuery('#seriesContent').html(txt);
				});
	changeSeriesMenu(pageId, 'true', index, childId);
}

function showProducts(obj, pageId, index, childId){

	if(obj.parentNode.className == 'focus' || obj.parentNode.className == 'ffff focus' )
	{
		return;
	}

	var itemId;
	// click sub menu, and sub menu focus
	if(childId != undefined && childId != null)
	{
		itemId = childId;
	}
	else
	{	
		// click menu
		if($('#'+pageId).parent().attr('class') == 'ffff focus')
		{
			return;
		}
	
		itemId = pageId;
	}
	
	var action = replace_url + "/frontend/product/replace.do";
	
	// job1: breadcrumb
	breadcrumb_param = "itemId=" + itemId + "&code=" + $("#code").val() + '&mode=0';
	breadcrumb_element = 'div_product_breadcrumb';
	__doProductPostByAjax(breadcrumb_param, action, breadcrumb_element);
	
	// job5: title
	product_name_param = "itemId=" + pageId + "&code=" + $("#code").val() + '&mode=4';
	product_name_element = 'div_product_name';
	
	__doProductPostByAjax(product_name_param, action, product_name_element);
	
	// job6: product query in footer-layout
	product_query_param = "itemId=" + pageId + "&code=" + $("#code").val() + '&mode=6';
	product_query_element = 'div_product_query';
	
	__doProductPostByAjax(product_query_param, action, product_query_element);
	
	action = replace_url + '/frontend/series/products.do';
	$.post(action+"?code="+$("#code").val(),
						function(txt){
							jQuery('#seriesContent').html(txt);
							document.title = $("#htmlTitle").val();
				});
	changeSeriesMenu(pageId, 'true', index, childId);
}
// series page

// Product Detail
function showBreadcrumbAndTitle(productCode, code)
{
	var param = 'productCode=' + productCode + '&';
	var action = replace_url + '/frontend/product/replace.do';
	
	// job1: breadcrumb
	breadcrumb_param = param +  'mode=0';
	breadcrumb_element = 'div_product_breadcrumb';
	__doProductPostByAjax(breadcrumb_param, action, breadcrumb_element);
	
	// job5: title
	product_name_param = param +  'code=' + code + '&mode=4';
	product_name_element = 'div_product_name';
	
	__doProductPostByAjax(product_name_param, action, product_name_element);
	
	// job5: product query in footer-layout
	product_query_param = param +  'code=' + code + '&mode=6';
	product_query_element = 'div_product_query';
	
	__doProductPostByAjax(product_query_param, action, product_query_element);
}

// product detail
function changeLanguage(productCode,languageKbn){

	$.post(product_base_url + "series/productModel.do?productCode="+productCode+"&code="+$("#code").val()+"&languageKbn="+languageKbn,
		function(txt){
			jQuery('#seriesContent').html(txt);
			document.title = $("#htmlTitle").val();
			
			$("img[@name='langImg']").each(
				function(){
					var currentImg = $(this).attr("src")
					if(currentImg.indexOf("in")>0){
						var leftFileName = currentImg.substr(0,currentImg.indexOf("in")-1);
						var rightFileName = currentImg.substr(currentImg.indexOf("in")+2,4);
						$(this).attr("src",leftFileName+rightFileName);
					}
				});
			
			var imgUrl = replace_url+"/css/images/btn_lang_"+languageKbn+"_in.gif";
			
			// update by jiangt 2008/10/04
			
			//$("#lang"+languageKbn).attr("src",imgUrl);
			
			$("img[@lang='lang" + languageKbn + "']").each(
			function(){
				$(this).attr("src",imgUrl);
			});
			// update by jiangt 2008/10/04
	});
}

function hideAllMenuAndSubMenuAndSubSubMenu(obj)
{
	var li = obj.parentNode;
					
	for(var i=0; i<li.childNodes.length; i++){

	var tag_name = li.childNodes[i].tagName;
	var child_node = li.childNodes[i];
		if(tag_name == 'UL'){
		
			for(var j=0; j<child_node.childNodes.length; j++){
					
				var sub_tag_name = child_node.childNodes[j].tagName;
				var sub_child_node = child_node.childNodes[j];
				
				if(sub_tag_name == 'LI'){
					
					for(var m=0; m<sub_child_node.childNodes.length; m++){
		
						var sub_sub_tag_name = sub_child_node.childNodes[m].tagName;
						var sub_sub_child_node = sub_child_node.childNodes[m];
				
						if(sub_sub_tag_name == 'A'){
							sub_sub_child_node.className = 'hover';
						}
						else if(sub_sub_tag_name == 'UL')
						{
							for(var n=0; n<sub_sub_child_node.childNodes.length; n++){
						
								var sub_sub_sub_tag_name = sub_sub_child_node.childNodes[n].tagName;
								var sub_sub_sub_child_node = sub_sub_child_node.childNodes[n];
						
								if(sub_sub_sub_tag_name == 'LI'){
								
									for(var k=0; k<sub_sub_sub_child_node.childNodes.length; k++){
						
										var lst_tag_name = sub_sub_sub_child_node.childNodes[k].tagName;
										var lst_node = sub_sub_sub_child_node.childNodes[k];
								
										if(lst_tag_name == 'A'){
											lst_node.className = 'hover';
										}
									}
								}
							}
							$(sub_sub_child_node).hide();
						}
					}
				}
			}

			$(child_node).hide();
		}
	}
}


// menu event, show validation sub menu or subsubmenu
function showValidateSub(obj, currentItemtId)
{
	//listSort(getSideUl(obj));

	// current subMenu, hover all sub subSubMenu
	if(obj.className == 'focus')
	{
		hideAllMenuAndSubMenuAndSubSubMenu(obj);
	}
	
	// sub menu
	var sub_menu;
	var nextUltyle = "ul[@class='categorysidemenu05']";

	var find_flg = 'false';
	$(nextUltyle + ' > li > a').each(
		function(){
			if(find_flg == 'true')
			{
				return;
			}
			else if(this[liTagAttr] == currentItemtId){
				
				//alert(this.innerHTML);
				showCurrentMenu(obj);
				
				if(jQuery.browser["msie"])
				{
					//alert(this.innerHTML);
					//alert($(this).attr('onclick'));
					this.fireEvent("onclick");
					//this.fireEvent("onclick");
					
					// move to first place
					//replacePlace(this);
					
//					$("a[@lang='item_" + currentItemtId + "']").each(
//					function(){
//						replacePlace(this);
//					});
				}
				else
				{
					$(this).click();
					
					// move to first place
					//replacePlace(this);
					
//					$("a[@lang='item_" + currentItemtId + "']").each(
//					function(){
//						replacePlace(this);
//					});
				}

				find_flg = 'true';
				return;
			}
			else if(this[liTagAttr] == currentItemtId + '_nostatus')
			{
				sub_menu = this;
			
				if(find_flg == 'true')
				{
					return;
				}
				
				var li = this.parentNode;
				for(var i=0; i<li.childNodes.length; i++){
	
					var tag_name = li.childNodes[i].tagName;
					var child_node = li.childNodes[i];
				
					if(find_flg == 'true')
					{
						break;
					}
				
					if(tag_name == 'UL'){
						
						//listSort(child_node);
			
						for(var j=0; j<child_node.childNodes.length; j++){
						
							var sub_tag_name = child_node.childNodes[j].tagName;
							var sub_child_node = child_node.childNodes[j];
							
							if(find_flg == 'true')
							{
								break;
							}
							
							if(sub_tag_name == 'LI'){
								
								for(var m=0; m<sub_child_node.childNodes.length; m++){
					
									var sub_sub_tag_name = sub_child_node.childNodes[m].tagName;
									var sub_sub_child_node = sub_child_node.childNodes[m];
							
									if(sub_sub_tag_name == 'A'){
									
										if(sub_sub_child_node[liTagAttr] == currentItemtId){
							
											//alert(sub_sub_child_node.innerHTML);
											//alert(sub_menu.innerHTML);
											//alert(obj.innerHTML);
											
											if(sub_menu != undefined)
											{
												//showCurrentMenu(sub_menu);
											}//alert('showCurrentMenu go on 1');
											showCurrentMenu(obj);
											//alert('showCurrentMenu go on 2');
											//alert();
											//alert($(sub_sub_child_node).attr('onclick'));
											if(jQuery.browser["msie"])
											{
												sub_sub_child_node.fireEvent("onclick");
											}
											else
											{
												$(sub_sub_child_node).click();
											}	

											find_flg = 'true';
											//sub_sub_child_node.className = 'focus';
											
											// move to first place
											//replacePlace(sub_sub_child_node);
											
											// move to first place
											//replacePlace(sub_menu);
											
											// move to first place
											//replacePlace(obj);
											
											break;
										}
									}
								}
								continue;
							}
						}
					}
				}
			}
		}
	);
	
	// find correct subMenu or subSubMenu finally
	if(find_flg == 'true')
	{
		if(sub_menu != undefined)
		{
			//sub_menu.className = 'focus';
		}
		obj.className = 'focus';
		
		// clear horizontal valiables
	 	horizontal_menu_index = null;
 		horizontal_menu_move_mode = null;
	}
	else
	{
		// horizontal menu event
		//if(horizontal_menu_index != null && horizontal_menu_move_mode != null)
		//{
		//	changeMenuByNavi(horizontal_menu_move_mode, horizontal_menu_index);
		//}
	}
	
	changeSeriesMenu(currentItemtId, 'false');
}

function showValidateSubSub(obj, code, parent_parentid, parent_id, dspFormat)
{
//	if(obj.className == 'focus')
//	{
//		return;
//	}

	var find_flg = 'false';
	
	for(var i=0; i<obj.parentNode.childNodes.length; i++){

		var tag_name = obj.parentNode.childNodes[i].tagName;
		var child_node = obj.parentNode.childNodes[i];
	
		if(find_flg == 'true')
		{
			break;
		}
	
		if(tag_name == 'UL'){
	
			//listSort(getSideUl(child_node));
	
			for(var j=0; j<child_node.childNodes.length; j++){
			
				var sub_tag_name = child_node.childNodes[j].tagName;
				var sub_child_node = child_node.childNodes[j];
				
				if(sub_tag_name == 'LI'){
					
					for(var m=0; m<sub_child_node.childNodes.length; m++){
		
						var sub_sub_tag_name = sub_child_node.childNodes[m].tagName;
						var sub_sub_child_node = sub_child_node.childNodes[m];
				
						if(find_flg == 'true')
						{
							break;
						}			
				
						if(sub_sub_tag_name == 'A'){
							if(sub_sub_child_node[liTagAttr] == parent_parentid){
				
								//alert(sub_sub_child_node.innerHTML);
								showCurrentMenu(obj);
								
								//var item_id = sub_sub_child_node.lang.replace(/sub_link_/,'');
								
								//changeMenuSubSub(sub_sub_child_node, code, item_id, parent_id, parent_parentid, dspFormat);
								
								find_flg = 'true';
								obj.className = 'focus';
								//sub_sub_child_node.className = 'focus';
								
								// move to first place
								//replacePlace(sub_sub_child_node);
								
								// move to first place
								//replacePlace(obj);
								
								// clear horizontal valiables
							 	horizontal_menu_index = null;
						 		horizontal_menu_move_mode = null;
								break;
							}
						}
					}
					continue;
				}
			}
		}
	}
	// change horizontal menu
	changeSeriesMenu(parent_parentid, 'false', null, parent_id);
}



// return all li of ul
function getText(hoo) {
	var A= [], next, T, pa, i;
	
	if (!hoo) return A;
	
	else if (hoo.hasChildNodes() && hoo.tagName == 'UL'){
		pa = hoo.childNodes, i= 0;
		while (pa[i]){
			next= pa[i++];
			
			if(next.nodeName == 'LI')
			{
				A=A.concat(next);
			}
			else
			{
				continue;
			}
		}
	}
	return A;
}

// move current li to first place of menu
function replacePlace(obj)
{
	var old_lang = $(obj.parentNode).attr('lang');
	// sort
	listSort(obj.parentNode.parentNode);
	
	var firstBrother = findFirstBrother(obj);
	
	// has not been first
	if(firstBrother != obj.parentNode)
	{
		// insert
		$(getSelf(obj)).insertBefore(firstBrother);
		$(obj.parentNode).attr('lang', old_lang);
	}
}

// find first li
function findFirstBrother(obj)
{
	var ul;
	if(obj.nodeName == 'A')
	{
		ul = obj.parentNode.parentNode;
	}
	else if(obj.nodeName == 'LI')
	{
		ul = obj.parentNode;
	}
	
	for(var i=0; i<ul.childNodes.length; i++){

		var tag_name = ul.childNodes[i].tagName;
		var child_node = ul.childNodes[i];
		
		if(tag_name == 'LI')
		{
			return child_node;
			break;
		}
	}
}

// get self li
function getSelf(obj)
{
	return obj.parentNode;
}

// sort ul
function listSort(obj){
	
	if(obj == null || obj == undefined)
		return;
	
	if(obj.nodeName != 'UL') return;
	
	A = getText(obj);
	
	A.sort(function(a,b){
		var v1, v2;
		v1 = Number(a.lang);
		v2 = Number(b.lang);
		
		if(v1 == v2) return 0;
		return v1 > v2? 1 : -1;
	})

	
	for (var i=A.length - 1; i>=0; i--)
	{
		hoo = A[i];
		//alert(hoo.innerHTML);
		if(hoo && hoo.nodeName == 'LI')
		{
			obj.insertBefore(hoo,obj.firstChild);
		}
	}
}

// init sort menu
function initMenu()
{
	$("li[@"+liTagAttr+"='focus']").each(
		function(){
			// find first brother
			var firstBrother = findFirstBrother(this);
			
			// has not been first
			if(firstBrother != this)
			{
				// insert
				$(this).insertBefore(firstBrother);
			}
		}
	);
	
	$('#prodcut_menu').show();
	
	// before and next btn change
	var max = $("a[@name='vmenu']").size() - 1;
	var index;
	$("li[@class='ffff focus'] > a").each(
		function(){
			index = this.lang;
		}
	);

	if (index != undefined && index != null){
		if(index == 0){
			$('#menu_before').hide(); 
			$('#menu_next').show(); 
		}else if(index == max){
			$('#menu_before').show();
			$('#menu_next').hide(); 
		}else{
			$('#menu_before').show();
			$('#menu_next').show(); 
		}
	}
}

function focusMenu(li)
{
	$('#'+li).attr(liTagAttr, 'focus');
}

function doMenuGet(href)
{
	if(href == undefined || href == null || href == '')
		return;
	$('#frm_doMenuGet').attr('action', href);
	$('#frm_doMenuGet').submit();
}


function afterLoadAct(){
	jQuery(function($) {
		if(productDocs.length>2 || grossaryList.length>2 || recommend_series_length>0){
	  		$("#kanrenInfo").css("visibility","visible");
	  	}
	  	if(recommend_series_length>0 && grossaryList.length<=2){
	  		$("#recommend_series_id").removeClass("recommendBox02");
	  	}
	  	if(recommend_series_length<1 && grossaryList.length<=2 && productDocs.length>2){
//	  		$("#__productDocs").removeClass("seriesOsusumeSkill");
			$("#__productDocs").css("margin","0px");
	  	}
	}); 
}

$(document).ready(function(){
	$("#file_kbn").attr("disabled","");
	$("#fileSuffix").attr("disabled","");
	$("#selectAllBtn").show();
	$("#downloadBtn").css("visibility","visible");
	$("#seriesKatashikiBtn").show();
	$("#brotherBtn").show();
})


