
var aCache_Content_Box_News = new Array();
function ajax_index_box_news(nTab)
{
	$('#ajax_content_box_news').html('&nbsp;');
	$('a#tab_content_box_news_1').attr('class', 'off');
	$('a#tab_content_box_news_2').attr('class', 'off');
	$('a#tab_content_box_news_3').attr('class', 'off');
	$('a#tab_content_box_news_'+nTab).attr('class', 'on');

	if ( typeof(aCache_Content_Box_News[nTab]) == 'undefined' )
	{
		$('#ajax_content_box_news').html('<img src="/images/ajax_loading.gif">');

		$.ajax({
			type: 'GET',
			url: '/ajax/ajax_index_box_news.php',
			dataType: 'html',
			data: 'tab='+nTab,
			success: function (sMsg){
				$('#ajax_content_box_news').html(sMsg);
				aCache_Content_Box_News[nTab] = sMsg;
			},
			error: function (sMsg1, sMsg2){
				$('#ajax_content_box_news').html('系統查詢錯誤！');
			},
			complete: function (sMsg1, sMsg2){
			}
		});
	}
	else
	{
		$('#ajax_content_box_news').html(aCache_Content_Box_News[nTab]);
	}

	return false;
}

var aCache_Content_Box_1 = new Array();
function ajax_index_box_1(nTab)
{
	$('#ajax_content_box_1').html('&nbsp;');
	$('a#tab_content_box_1_1').attr('class', 'off');
	$('a#tab_content_box_1_2').attr('class', 'off');
	$('a#tab_content_box_1_3').attr('class', 'off');
	$('a#tab_content_box_1_'+nTab).attr('class', 'on');

	if ( typeof(aCache_Content_Box_1[nTab]) == 'undefined' )
	{
		$('#ajax_content_box_1').html('<img src="/images/ajax_loading.gif">');

		$.ajax({
			type: 'GET',
			url: '/ajax/ajax_index_box_1.php',
			dataType: 'html',
			data: 'tab='+nTab,
			success: function (sMsg){
				$('#ajax_content_box_1').html(sMsg);
				aCache_Content_Box_1[nTab] = sMsg;
			},
			error: function (sMsg1, sMsg2){
				$('#ajax_content_box_1').html('系統查詢錯誤！');
			},
			complete: function (sMsg1, sMsg2){
			}
		});
	}
	else
	{
		$('#ajax_content_box_1').html(aCache_Content_Box_1[nTab]);
	}

	return false;
}

var aCache_Content_Box_2 = new Array();
function ajax_index_box_2(nTab)
{
	$('#ajax_content_box_2').html('&nbsp;');
	$('a#tab_content_box_2_1').attr('class', 'off');
	$('a#tab_content_box_2_2').attr('class', 'off');
	$('a#tab_content_box_2_3').attr('class', 'off');
	$('a#tab_content_box_2_'+nTab).attr('class', 'on');

	if ( typeof(aCache_Content_Box_2[nTab]) == 'undefined' )
	{
		$('#ajax_content_box_2').html('<img src="/images/ajax_loading.gif">');

		$.ajax({
			type: 'GET',
			url: '/ajax/ajax_index_box_2.php',
			dataType: 'html',
			data: 'tab='+nTab,
			success: function (sMsg){
				$('#ajax_content_box_2').html(sMsg);
				aCache_Content_Box_2[nTab] = sMsg;
			},
			error: function (sMsg1, sMsg2){
				$('#ajax_content_box_2').html('系統查詢錯誤！');
			},
			complete: function (sMsg1, sMsg2){
			}
		});
	}
	else
	{
		$('#ajax_content_box_2').html(aCache_Content_Box_2[nTab]);
	}

	return false;
}

var aCache_Content_Box_3 = new Array();
function ajax_index_box_3(nTab)
{
	$('#ajax_content_box_3').html('&nbsp;');
	$('a#tab_content_box_3_1').attr('class', 'off');
	$('a#tab_content_box_3_2').attr('class', 'off');
	$('a#tab_content_box_3_3').attr('class', 'off');
	$('a#tab_content_box_3_'+nTab).attr('class', 'on');

	if ( typeof(aCache_Content_Box_3[nTab]) == 'undefined' )
	{
		$('#ajax_content_box_3').html('<img src="/images/ajax_loading.gif">');

		$.ajax({
			type: 'GET',
			url: '/ajax/ajax_index_box_3.php',
			dataType: 'html',
			data: 'tab='+nTab,
			success: function (sMsg){
				$('#ajax_content_box_3').html(sMsg);
				aCache_Content_Box_3[nTab] = sMsg;
			},
			error: function (sMsg1, sMsg2){
				$('#ajax_content_box_3').html('系統查詢錯誤！');
			},
			complete: function (sMsg1, sMsg2){
			}
		});
	}
	else
	{
		$('#ajax_content_box_3').html(aCache_Content_Box_3[nTab]);
	}

	return false;
}

var aCache_Content_Product = new Array();
function ajax_index_product(nTab)
{
	var nBox = 1;
	var nBox_Tab = nTab % 3;
	nBox_Tab = (nBox_Tab == 0) ? 3 : nBox_Tab;

	if ((nTab >= 1) && (nTab <= 3))		nBox = 1;
	else if ((nTab >= 4) && (nTab <= 6))	nBox = 2;
	else if ((nTab >= 7) && (nTab <= 9))	nBox = 3;
	else if ((nTab >= 10) && (nTab <= 12))	nBox = 4;
	else if ((nTab >= 13) && (nTab <= 15))	nBox = 5;
	else if ((nTab >= 16) && (nTab <= 18))	nBox = 6;

	$('#ajax_content_product_'+nBox).html('&nbsp;');
	$('a#tab_content_product_'+nBox+'_1').attr('class', 'off');
	$('a#tab_content_product_'+nBox+'_2').attr('class', 'off');
	$('a#tab_content_product_'+nBox+'_3').attr('class', 'off');
	$('a#tab_content_product_'+nBox+'_'+nBox_Tab).attr('class', 'on');

	if ( typeof(aCache_Content_Product[nTab]) == 'undefined' )
	{
		$('#ajax_content_product_'+nBox).html('<img src="/images/ajax_loading.gif">');

		$.ajax({
			type: 'GET',
			url: '/ajax/ajax_index_product.php',
			dataType: 'html',
			data: 'tab='+nTab,
			success: function (sMsg){
				$('#ajax_content_product_'+nBox).html(sMsg);
				aCache_Content_Product[nTab] = sMsg;
			},
			error: function (sMsg1, sMsg2){
				$('#ajax_content_product_'+nBox).html('系統查詢錯誤！');
			},
			complete: function (sMsg1, sMsg2){
			}
		});
	}
	else
	{
		$('#ajax_content_product_'+nBox).html(aCache_Content_Product[nTab]);
	}

	return false;
}

