
// # Website Public Function #############################################################################

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function intitialMenuAction() {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	/* ???????? ??? effect ?????????? ???????? */
	/*
	var list = $$('#idDesignMenu2 li');
	var timer = 0;
	var slidefxs = [];
	var colorfxs = [];
	list.each(function(el, i){
		el.setStyle('margin-left', '-180px');
		timer += 150;
		slidefxs[i] = new Fx.Style(el, 'margin-left', {
			duration: 400,
			transition: Fx.Transitions.backOut,
			wait: false
		});
		slidefxs[i].start.delay(timer, slidefxs[i], 0);
	});
	list.each(function(element) {
		var myfx = new Fx.Styles(element, {duration:200, wait:false});
		element.addEvent('mouseenter', function(){
			myfx.start({
				'padding-left': 15
			});
		});
		element.addEvent('mouseleave', function(){
			myfx.start({
				'padding-left': 5
			});
		});
	});
	*/

	/* ????????? Member Dock ???? 
	if($('idMemberCartAlert')) {
		$('idMemberCartAlert').setStyle('left', '-258');
		$('idMemberCartAlert').setStyle('top', '100');
		$('idMemberCartAlert').setStyle('display', '');
		$('idMemberCart').setStyle('left', '-590');
		$('idMemberCart').setStyle('top', '150');
		$('idMemberCart').setStyle('display', '');
		window.addEvent('scroll', function(){ Cart_setPosition() } ).addEvent('resize', function(){ Cart_setPosition() } );
		Cart_setPosition();
	}
	*/
}

var Cart_scrollTimer;
var Cart_newTop = 100;
var Cart_lastTop = 100;
var Cart_isDoing = false;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function Cart_setPosition() {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	if(Cart_newTop!=Window.getScrollTop()+100) {
		Cart_newTop=Window.getScrollTop()+100;
		Cart_scrollTimer = setTimeout("Cart_setPositionDo()",500);
	}
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function Cart_setPositionDo() {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	if(Cart_isDoing) {
		Cart_scrollTimer = setTimeout("Cart_setPositionDo()",500);
	} else {
		if(Cart_lastTop!=Cart_newTop) {
			Cart_isDoing = true;
			var myfx = new Fx.Styles($('idMemberCartAlert'), {duration:1000, wait:true});
			myfx.start({ 
					'top': Cart_newTop
			}).chain(function(){
				Cart_isDoing = false;
			});
			var myfx1 = new Fx.Styles($('idMemberCart'), {duration:1000, wait:true});
			myfx1.start({ 
					'top': Cart_newTop+50
			});
			Cart_lastTop = Cart_newTop;
		}
	}
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function showMainReleaseContent(page) { 	
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	/* ?????????????????????? */
	addShowLoading('areaMainReleaseData', 'showMainReleaseLoading');
	var fileName = '../lib/site-content.php?JS_Action=MainRelease&JS_MainReleasePage='+page;
	new ajax(fileName , { method: 'get', update: 'showContentMainRelease'}).request();
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function showNews2Content(page)  { 	
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	addShowLoading('areaNews2', 'showMainReleaseLoading');
	var fileName = '../home/index-content.php?JS_Action=news2&JS_MainReleasePage='+page+'';
	new ajax(fileName , { method: 'get', update: 'areaNews2'}).request();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function showNews5Content(page)  { 	
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	addShowLoading('areaNews5', 'showMainReleaseLoading');
	var fileName = '../home/index-content.php?JS_Action=news5&JS_MainReleasePage='+page+'';
	new ajax(fileName , { method: 'get', update: 'areaNews5'}).request();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function showNews6Content(page)  { 	
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	addShowLoading('areaNews6', 'showMainReleaseLoading');
	var fileName = '../home/index-content.php?JS_Action=news6&JS_MainReleasePage='+page+'';
	new ajax(fileName , { method: 'get', update: 'areaNews6'}).request();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function showNews7Content(page)  { 	
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	addShowLoading('areaNews7', 'showMainReleaseLoading');
	var fileName = '../home/index-content.php?JS_Action=news7&JS_MainReleasePage='+page+'';
	new ajax(fileName , { method: 'get', update: 'areaNews7'}).request();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function showNews8Content(page)  { 	
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	addShowLoading('areaNews8', 'showMainReleaseLoading');
	var fileName = '../home/index-content.php?JS_Action=news8&JS_MainReleasePage='+page+'';
	new ajax(fileName , { method: 'get', update: 'areaNews8'}).request();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function showNews15Content(page)  { 	
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	addShowLoading('areaNews15', 'showMainReleaseLoading');
	var fileName = '../home/index-content.php?JS_Action=news15&JS_MainReleasePage='+page+'';
	new ajax(fileName , { method: 'get', update: 'areaNews15'}).request();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function showNews16Content(page)  { 	
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	addShowLoading('areaNews16', 'showMainReleaseLoading');
	var fileName = '../home/index-content.php?JS_Action=news16&JS_MainReleasePage='+page+'';
	new ajax(fileName , { method: 'get', update: 'areaNews16'}).request();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function showNews4Content(page)  { 	
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	addShowLoading('areaNews4', 'showMainReleaseLoading');
	var fileName = '../home/index-content.php?JS_Action=news4&JS_MainReleasePage='+page+'';
	new ajax(fileName , { method: 'get', update: 'areaNews4'}).request();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function showNews11Content(page)  { 	
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	addShowLoading('areaNews11', 'showMainReleaseLoading');
	var fileName = '../home/index-content.php?JS_Action=news11&JS_MainReleasePage='+page+'';
	new ajax(fileName , { method: 'get', update: 'areaNews11'}).request();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function showNews20Content(page)  { 	
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	addShowLoading('areaNews20', 'showMainReleaseLoading');
	var fileName = '../home/index-content.php?JS_Action=news20&JS_MainReleasePage='+page+'';
	new ajax(fileName , { method: 'get', update: 'areaNews20'}).request();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function showNews18Content(page)  { 	
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	addShowLoading('areaNews18', 'showMainReleaseLoading');
	var fileName = '../home/index-content.php?JS_Action=news18&JS_MainReleasePage='+page+'';
	new ajax(fileName , { method: 'get', update: 'areaNews18'}).request();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function showNews19Content(page)  { 	
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	addShowLoading('areaNews19', 'showMainReleaseLoading');
	var fileName = '../home/index-content.php?JS_Action=news19&JS_MainReleasePage='+page+'';
	new ajax(fileName , { method: 'get', update: 'areaNews19'}).request();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function showNews28Content(page)  { 	
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	addShowLoading('areaNews28', 'showMainReleaseLoading');
	var fileName = '../home/index-content.php?JS_Action=news28&JS_MainReleasePage='+page+'';
	new ajax(fileName , { method: 'get', update: 'areaNews28'}).request();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function showNews29Content(page)  { 	
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	addShowLoading('areaNews29', 'showMainReleaseLoading');
	var fileName = '../home/index-content.php?JS_Action=news29&JS_MainReleasePage='+page+'';
	new ajax(fileName , { method: 'get', update: 'areaNews29'}).request();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function showNews30Content(page)  { 	
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	addShowLoading('areaNews30', 'showMainReleaseLoading');
	var fileName = '../home/index-content.php?JS_Action=news30&JS_MainReleasePage='+page+'';
	new ajax(fileName , { method: 'get', update: 'areaNews30'}).request();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function showNews32Content(page)  { 	
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	addShowLoading('menutabs1', 'showMainReleaseLoading');
	var fileName = '../home/index-content.php?JS_Action=news32&JS_MainReleasePage='+page+'';
	new ajax(fileName , { method: 'get', update: 'menutabs1'}).request();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function showNews33Content(page)  { 	
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	addShowLoading('menutabs2', 'showMainReleaseLoading');
	var fileName = '../home/index-content.php?JS_Action=news33&JS_MainReleasePage='+page+'';
	new ajax(fileName , { method: 'get', update: 'menutabs2'}).request();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function showNews34Content(page)  { 	
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	addShowLoading('menutabs3', 'showMainReleaseLoading');
	var fileName = '../home/index-content.php?JS_Action=news34&JS_MainReleasePage='+page+'';
	new ajax(fileName , { method: 'get', update: 'menutabs3'}).request();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function showNews35Content(page)  { 	
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	addShowLoading('country1', 'showMainReleaseLoading');
	var fileName = '../home/index-content.php?JS_Action=news35&JS_MainReleasePage='+page+'';
	new ajax(fileName , { method: 'get', update: 'country1'}).request();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

function showNews36Content(page)  { 	
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	addShowLoading('country2', 'showMainReleaseLoading');
	var fileName = '../home/index-content.php?JS_Action=news36&JS_MainReleasePage='+page+'';
	new ajax(fileName , { method: 'get', update: 'country2'}).request();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

function showNews44Content(page)  { 	
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	addShowLoading('areaNews44', 'showMainReleaseLoading');
	var fileName = '../home/index-content.php?JS_Action=news44&JS_MainReleasePage='+page+'';
	new ajax(fileName , { method: 'get', update: 'areaNews44'}).request();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function showNews45Content(page)  { 	
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	addShowLoading('areaNewsen1', 'showMainReleaseLoading');
	var fileName = '../../th/home/index-content.php?JS_Action=news45&JS_MainReleasePage='+page+'';
	new ajax(fileName , { method: 'get', update: 'areaNewsen1'}).request();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function showNews46Content(page)  { 	
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	addShowLoading('areaNewsen2', 'showMainReleaseLoading');
	var fileName = '../../th/home/index-content.php?JS_Action=news46&JS_MainReleasePage='+page+'';
	new ajax(fileName , { method: 'get', update: 'areaNewsen2'}).request();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function showNews47Content(page)  { 	
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	addShowLoading('areaNews47', 'showMainReleaseLoading');
	var fileName = '../../th/home/index-content.php?JS_Action=news47&JS_MainReleasePage='+page+'';
	new ajax(fileName , { method: 'get', update: 'areaNews47'}).request();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

function addShowLoading(div1 , div2) {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
		$(''+div1).innerHTML=$(''+div2).innerHTML;
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function changeSheets() {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	/* ???????? ??????? ?????? font */
	if(document.styleSheets) {
		var js_vars = 'JS_Action=switchcss';
		new ajax("../lib/index-fontsize-content.php",{ method: 'get', postBody: js_vars, onComplete: function(responseText) {
			if(responseText.trim()=='OK') {
				if(document.styleSheets[2].disabled) {
					document.styleSheets[2].disabled=false;
					document.styleSheets[3].disabled=true;
					$('idBtFont').src = '../images/object/font1.gif';
				} else {
					document.styleSheets[2].disabled=true;
					document.styleSheets[3].disabled=false;
					$('idBtFont').src = '../images/object/font2.gif';
				}
			}
		}
		}).request();
	}
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function changeSheetsIndex() {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	/* ???????? ??????? ?????? font ????????? */
	if(document.styleSheets) {
		var js_vars = 'JS_Action=switchcss';
		new ajax("lib/index-fontsize-content.php",{ method: 'get', postBody: js_vars, onComplete: function(responseText) {
			if(responseText.trim()=='OK') {
				if(document.styleSheets[2].disabled) {
					document.styleSheets[2].disabled=false;
					document.styleSheets[3].disabled=true;
					$('idBtFont').src = 'images/object/font1.gif';
				} else {
					document.styleSheets[2].disabled=true;
					document.styleSheets[3].disabled=false;
					$('idBtFont').src = 'images/object/font2.gif';
				}
			}
		}
		}).request();
	}
}

var isSavingCart = false;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function Cart_KeepIndex(myObject,mySaveVar) {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	// TODO : ????? ?????????????? ???? ????????? ?????? Timer ??????????? effect ??? Stack Array ??????????
	Cart_ElementEffect(myObject.id);
	document.selection.empty();
	if(!isSavingCart) {
		isSavingCart=true;
		new ajax("lib/index-keep-cart.php",{ method: 'get', postBody: mySaveVar, onComplete: function(responseText) {
			if(responseText.trim()=='OK') {
				Cart_AlertEffect();
			}
		}
		}).request();
	} 
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function Cart_Keep(myObject,mySaveVar) {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	// TODO : ????? ?????????????? ???? ????????? ?????? Timer ??????????? effect ??? Stack Array ??????????
	Cart_ElementEffect(myObject.id);
	document.selection.empty();
	if(!isSavingCart) {
		isSavingCart=true;
		new ajax("../lib/index-keep-cart.php",{ method: 'get', postBody: mySaveVar, onComplete: function(responseText) {
			if(responseText.trim()=='OK') {
				Cart_AlertEffect();
			}
		}
		}).request();
	} 
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function Cart_ElementEffect(myID) {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	$(myID).setStyle('background-color', '#FFF');
	var myfx = new Fx.Styles($(myID), {duration:500, wait:true});
	myfx.start({ 
		'background-color': '#F99'  , 'opacity': .2
	}).chain(function(){
		this.start({
			'background-color': '#FFF' , 'opacity': 1
		});
	});
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function Cart_AlertEffectHint() {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	// TODO : Edit for easy to read
	$('idMemberCartAlert').className = "dock_alert1";
	var myfx = new Fx.Styles($('idMemberCartAlert'), {duration:500, transition: Fx.Transitions.Expo.easeOut, wait:true});
	myfx.start({ 
			'left': '-50'
	}).chain(function(){
		this.start.delay(1000, this, {
			'left': '-258'
		});
	}).chain(function(){
		isSavingCart=false;
	});
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function Cart_AlertEffect() {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	$('idMemberCartAlert').className = "dock_alert2";
	var myfx = new Fx.Styles($('idMemberCartAlert'), {duration:500, transition: Fx.Transitions.Expo.easeOut, wait:true});
	myfx.start({ 
			'left': '-50'
	}).chain(function(){
		this.start.delay(500, this, {
			'left': '-258'
		});
	}).chain(function(){
		isSavingCart=false;
	});
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function Cart_ToggleEffect() {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	if($('idMemberCart').getStyle('left')=='-590px' || $('idMemberCart').getStyle('left')=='-590') { // On
		toggleSelectOnPage('Off');
		var myfx = new Fx.Styles($('idMemberCart'), {duration:1000, transition: Fx.Transitions.Expo.easeOut, wait:true});
		myfx.start({ 
				'left': '-10'
		});
	} else { // Off
		var myfx = new Fx.Styles($('idMemberCart'), {duration:1000, transition: Fx.Transitions.Expo.easeOut, wait:true});
		myfx.start({ 
				'left': '-590'
		}).chain(function(){
				toggleSelectOnPage('On');
		});
	}
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function toggleSelectOnPage(isOnOff) {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	var myElements = $ES("select");
	if(isOnOff=='On') {
		myElements.each(function(el){ 
			el.style.visibility = '';
		});
	} else {
		myElements.each(function(el){ 
			el.style.visibility = 'hidden';
		});
	}
}

