	/************************************************
	*  Name              :  gnb.bottom.js
	*  Current Version   :  0.0.0.1
	*  Create by Date    :  2010-11-29
	*  Create by         :  ray.kim
	*  Last Update Date  :  2010-11-29
	*  Last Update By    :  ray.kim
	*  Description       :
	*************************************************/

	gnbBottom = {
		_html : '',
		_infoHost : 'http://info.pandora.tv/',
		_apiHost : 'http://interface.pandora.tv/',
		_eventHost : 'http://event.pandora.tv/',
		_bottomLang : null,
		_menuLang : null,
		_appLink : null,
		_menu : '',
		_code : '',
		_clientLang : 'ko',
		_codeLang : null,
		_setLang : function () {
			if(this.getCookie('clientLang')) this._clientLang = this.getCookie('clientLang');

			switch (this._clientLang) {
				case "ko" :
					this._bottomLang = ["판도라TV 소개", "<b>개인정보취급방침</b>", "청소년보호정책", "권리침해신고", "이용약관", "제휴문의", "광고문의", "도움말", "OPEN API"];
				break;
				case "cn" :
					this._bottomLang = ["潘多拉TV介绍", "信息保护协议", "侵权投诉", "使用协议", "提问合作", "广告", "帮助", "OPEN API"];
				break;
				case "jp" :
					this._bottomLang = ["パンドラTVの紹介", "個人情報保護規約", "権利侵害届出", "利用規約", "提携", "広告掲載", "ヘルプ", "OPEN API"];
				break;
				default :
					this._bottomLang = ["About Us", "Privacy Policy", "Copyright Notices", "User Agreement", "Partners", "Advertise with Us", "Help", "OPEN API"];
				break;
			}

			this._menuLang = ["한국어", "English", "日本語", "中文"];
			this._codeLang = ["ko", "en", "jp", "cn"];

			this._selectLang[this._clientLang] = ' class="select"';
		},

		_selectLang : function (Lang) {
			if (this._clientLang == Lang) {
				return this._selectLang[this._clientLang] = ' class="select"';
			} else {
				return "";
			}
		},

		setNation : function (Lang) {
			this.setCookie("clientLang", Lang, 30*60*60*60);
			location.reload();
		},

		/* set cookie value */
		setCookie : function (sName, sValue, expireSeconds) {
			var sDomain = ".pandora.tv";
			var todayDate = new Date();
			var ExpireTime = new Date(todayDate.getTime()+expireSeconds*1000);
			document.cookie = sName + "=" + sValue + ";" + ((expireSeconds) ? "expires=" + ExpireTime.toGMTString() + ";" : "") + "domain=" + sDomain + ";path=/;";
		},

		/* get cookie value */
		getCookie : function (sName) {
			var aCookie = document.cookie.split("; ");

			for (var i=0; i<aCookie.length; i++) {
				var aCrumb = aCookie[i].split("=");
				if (sName == aCrumb[0]) {
					return aCrumb[1];
				}
			}
			return null;
		},

		draw : function (target, width, langView) {
			this._setLang();

			if (this._clientLang == "ko") {
				this._bottomLink = [
					this._infoHost + '?m=pandoratv_introduce',
					this._infoHost + '?m=service_use_2',
					this._infoHost + '?m=service_use_4',
					this._infoHost + '?m=state_right',
					this._infoHost + '?m=service_use_1',
					this._infoHost + '?m=1by1#code1=Q08&code2=03',
					this._infoHost + '?m=1by1&cs1=1#code1=Q08&code2=01',
					this._infoHost + '?m=faq',
					this._apiHost
				];
			} else {
				this._bottomLink = [
					this._infoHost + '?m=pandoratv_introduce',
					this._infoHost + '?m=service_use_2',
					this._infoHost + '?m=state_right',
					this._infoHost + '?m=service_use_1',
					this._infoHost + '?m=1by1#code1=Q08&code2=02',
					this._infoHost + '?m=1by1&cs1=1#code1=Q08&code2=01',
					this._infoHost + '?m=faq',
					this._apiHost
				];
			}

			for (var i=0; i < this._bottomLang.length; i++) {
				this._menu += '<a href="' + this._bottomLink[i] + '">' + this._bottomLang[i] + '</a>';

				if(i != (this._bottomLang.length - 1)) this._menu+= '<span class="bar">&#124;</span>';
			}

			if(width > 0) twidth = 'style="width:' + width + 'px"';
			else twidth = "";

			var selectClass = "";
			for (var i=0; i < this._menuLang.length; i++) {
				if (this._clientLang == this._codeLang[i] )
					this._code+= '<span class="active">' + this._menuLang[i] + '</span>';
				else
					this._code+= '<a onclick="gnbBottom.setNation(\'' + this._codeLang[i] + '\');" class="btn">' + this._menuLang[i] + '</a>';

				if(i != (this._menuLang.length-1)) this._code+= '<span class="bar">&#124;</span>';
			}

			this._html+= '<div class="wrap_footer" ' + twidth + '>';
			this._html+= '	<span class="footer_logo">&nbsp;</span>';
			this._html+= '	<p class="menu">' + this._menu + '</p>';
			if(!langView) this._html+= '	<div class="nation">' + this._code + '</div>';
			this._html+= '	<address>Copyright &copy; <strong>PANDORATV</strong> Inc. All Rights Reserved</address>';
			this._html+= '</div>';

			try {
				$(target).update(this._html);
			}
			catch (e) {}
		}
	}

