// JavaScript Document
<!--
$(document).ready(function() {
	var product_item_tabpage = $('.product_item').children('.tabpage');
	
	$(product_item_tabpage.children('.content')).animate({opacity:"0"}, 0);
	
	var product_item_tabpage_content_height = 0;
	var befor_show_tab_content = '';
	/*for(i = 0; i < $(product_item_tabpage.children('.content')).length; i++){
		if($(product_item_tabpage.children('.content').get(i)).height() > product_item_tabpage_content_height){
			product_item_tabpage_content_height = $(product_item_tabpage.children('.content').get(i)).height();
		}
	}*/
	//product_item_tabpage.children('.content').height(product_item_tabpage_content_height);
	$(product_item_tabpage.children('.content')).css({"top":$('.tabs').height() + 9 + "px"});
	$(product_item_tabpage.children('.tabs').children('li')).mouseenter(function(){$(this).addClass('selected');});
	$(product_item_tabpage.children('.tabs').children('li')).mouseleave(function(){
		if(befor_show_tab_content != '#' + $(this).attr('target_id')){
			$(this).removeClass('selected');
		}
	});
	$(product_item_tabpage.children('.tabs').children('li')).click(function(){
		if(befor_show_tab_content != '#' + $(this).attr('target_id')){
			$(product_item_tabpage.children('.tabs').children('li')).removeClass('selected');
			$(this).addClass('selected');
			
			$(befor_show_tab_content).css({"z-index":"2"});
			$(befor_show_tab_content).stop().animate({opacity:"0"}, 300, function(){$(this).css({"display":"none"});});
			
			for(i = 0; i < $(product_item_tabpage.children('.content')).length; i++){
				if('#' + $(product_item_tabpage.children('.content').get(i)).attr('id') != befor_show_tab_content){
					$(product_item_tabpage.children('.content').get(i)).css({"z-index":"1"});
				}
			}
			
			$('#' + $(this).attr('target_id')).stop().animate({opacity:"0"}, 0, function(){
				$(this).css({"z-index":"3"});
				$(this).css({"display":"block"});
				$(this).stop().animate({opacity:"1"}, 300);
				befor_show_tab_content = '#' + $(this).attr('id');
				//alert(befor_show_tab_content);
				product_item_tabpage.height($(product_item_tabpage.children('.tabs')).height() + $(this).height() + 9);
				//product_item_tabpage.stop().animate({height:($(product_item_tabpage.children('.tabs')).height() + $(this).height() + 9)}, 1000);
			});
		}
	});
	product_item_tabpage.children('.content').css({"z-index":"1", "display":"none"});
	product_item_tabpage.children('.content').stop().animate({opacity:"0"}, 0);
	$(product_item_tabpage.children('.content').get(0)).css({"z-index":"3", "display":"block"});
	$(product_item_tabpage.children('.content').get(0)).stop().animate({opacity:"1"}, 0);
	befor_show_tab_content = '#' + $(product_item_tabpage.children('.content').get(0)).attr('id');
	
	product_item_tabpage.height($(product_item_tabpage.children('.tabs')).height() + $(befor_show_tab_content).height() + 9);
	
	
	//-------------------------
	var befor_app_show_tab_content = '';
	var app_item_tabpage = $('.app_item').children('.tabpage');
	$(app_item_tabpage.children('.content')).animate({opacity:"0"}, 0);
	
	$(app_item_tabpage.children('.content')).css({"top":$('.tabs').height() + 9 + "px"});
	$(app_item_tabpage.children('.tabs').children('li')).mouseenter(function(){$(this).addClass('selected');});
	$(app_item_tabpage.children('.tabs').children('li')).mouseleave(function(){
		if(befor_app_show_tab_content != '#' + $(this).attr('target_id')){
			$(this).removeClass('selected');
		}
	});
	$(app_item_tabpage.children('.tabs').children('li')).click(function(){
		if(befor_app_show_tab_content != '#' + $(this).attr('target_id')){
			$(app_item_tabpage.children('.tabs').children('li')).removeClass('selected');
			$(this).addClass('selected');
			
			$(befor_app_show_tab_content).css({"z-index":"2"});
			$(befor_app_show_tab_content).stop().animate({opacity:"0"}, 300, function(){$(this).css({"display":"none"});});
			
			for(i = 0; i < $(app_item_tabpage.children('.content')).length; i++){
				if('#' + $(app_item_tabpage.children('.content').get(i)).attr('id') != befor_app_show_tab_content){
					$(app_item_tabpage.children('.content').get(i)).css({"z-index":"1"});
				}
			}
			
			$('#' + $(this).attr('target_id')).stop().animate({opacity:"0"}, 0, function(){
				$(this).css({"z-index":"3"});
				$(this).css({"display":"block"});
				$(this).stop().animate({opacity:"1"}, 300);
				befor_app_show_tab_content = '#' + $(this).attr('id');
				//alert(befor_app_show_tab_content);
				app_item_tabpage.height($(app_item_tabpage.children('.tabs')).height() + $(this).height() + 20);
				//app_item_tabpage.stop().animate({height:($(app_item_tabpage.children('.tabs')).height() + $(this).height() + 9)}, 1000);
			});
		}
	});
	app_item_tabpage.children('.content').css({"z-index":"1", "display":"none"});
	app_item_tabpage.children('.content').stop().animate({opacity:"0"}, 0);
	$(app_item_tabpage.children('.content').get(0)).css({"z-index":"3", "display":"block"});
	$(app_item_tabpage.children('.content').get(0)).stop().animate({opacity:"1"}, 0);
	befor_app_show_tab_content = '#' + $(app_item_tabpage.children('.content').get(0)).attr('id');
	
	app_item_tabpage.height($(app_item_tabpage.children('.tabs')).height() + $(befor_app_show_tab_content).height() + 20);
})
$(window).load(function(){
	
});
