var topbar = {
	toggle_combo : function() {
		var bttn = document.getElementById('topbar_combo_button');
		var menu = document.getElementById('topbar_combo_menu');
		if (menu.style.display === 'block') {
			bttn.className = undefined;
			menu.style.display = 'none';
		} else {
			bttn.className = 'active';
			menu.style.display = 'block';
		}
	},
	mouseover_button : function() {
		document.getElementById('topbar_combo_button').className = 'active';
	},
	mouseout_button : function() {
		if (document.getElementById('topbar_combo_menu').style.display === 'none') {
			document.getElementById('topbar_combo_button').className = undefined;
		}
	},
	toggle_login : function() {
		var menu = document.getElementById('topbar_login_extend');
		var bttn = document.getElementById('topbar_login_button');
		if (menu.style.display === 'block') {
			bttn.className = 'topbar_button';
			menu.style.display = 'none';
		} else {
			bttn.className = 'topbar_button active';
			menu.style.display = 'block';
			document.getElementById('topbar_f_login_name').focus();
		}
	},
	mouseover_login : function() {
		document.getElementById('topbar_login_button').className = 'topbar_button active';
	},
	mouseout_login : function() {
		if (document.getElementById('topbar_login_extend').style.display === 'none') {
			document.getElementById('topbar_login_button').className = 'topbar_button';
		}
	},
	mouseover_bttn : function(bttn_id) {
		document.getElementById(bttn_id).className = 'topbar_button active';
	},
	mouseout_bttn : function(bttn_id) {
		document.getElementById(bttn_id).className = 'topbar_button';
	},
	helper_add_event : function(obj, event_type, fn) {
		if (obj !== undefined) {
			if (obj.addEventListener !== undefined) {
				obj.addEventListener(event_type, fn, false);
			} else if (obj.attachEvent !== undefined) {
				obj.attachEvent('on' + event_type, fn);
			}
		}
	}
};
// Make menu collapse when click outside
topbar.helper_add_event(document.body, 'click', function(e){
	var target = (e.target)? e.target : e.srcElement;
	if (target === document.getElementById('topbar_f_login_name') || 
		target === document.getElementById('topbar_f_password') ||
		target === document.getElementById('topbar_f_remember') ||
		target === document.getElementById('topbar_f_remember_label')) {
		return;
	}
	if (target !== document.getElementById('topbar_combo_button') && 
		document.getElementById('topbar_combo_menu').style.display === 'block') {
		topbar.toggle_combo();
	} else if (target !== document.getElementById('topbar_login_button') && 
		document.getElementById('topbar_login_extend') && 
		document.getElementById('topbar_login_extend').style.display === 'block') {
		topbar.toggle_login();
	}
});
document.write("<style type=\"text/css\" media=\"screen\">");
document.write("body { padding-top: 26px; }");
document.write("#topbar { position: absolute; top: 0px; left: 0px; width: 100%; font-size: 11px; font-family: \"Lucida Grande\", Tahoma, sans-serif; background: #e5e5e5 url(topbarbg.png) repeat-x top left; color: #000; }");
document.write("#topbar a { color: #3a3333; }");
document.write("#topbar img { border: 0px; }");
document.write("#topbar div, #topbar ul, #topbar li { margin: 0px; padding: 0px; }");
document.write("#topbar #topbar_menu { position: relative; border: 1px solid #ccc; margin: 0px; height: 26px; padding: 0px 10px; z-index: 90; }");
document.write("#topbar #topbar_combo_wrap { border-left: 1px solid #ccc; border-right: 1px solid #ccc; float: left; }");
document.write("#topbar #topbar_combo_wrap .active { background-color: #fff; }");
document.write("#topbar #topbar_combo_button { background: #e5e5e5; background: transparent; padding: 5px 5px 0px 5px; float: left; display: block; line-height: 21px; z-index: 99; cursor: pointer; }");
document.write("#topbar #topbar_combo_menu { width: 220px; background: #fff; border-width: 1px; border-style: solid; border-color: #ccc #333 #333 #333; position: absolute; top: 25px; left: 10px; padding: 5px; z-index: 98; }");
document.write("#topbar #topbar_combo_menu a { text-decoration: none; color: #3B5998; }");
document.write("#topbar #topbar_combo_menu a:hover { text-decoration: underline; }");
document.write("#topbar #topbar_combo_menu li.topbar_combo_menu_separator { height: 1px; line-height: 1px; font-size: 1px; background-color: #ccc; margin: 5px 0px; }");
document.write("#topbar #topbar_quick_icon { float: left; margin-left: 10px; }");
document.write("#topbar #topbar_quick_icon a { text-decoration: none; }");
document.write("#topbar #topbar_quick_icon .topbar_quick_icon_elem { float: left; line-height: 26px; margin-left: 5px; }");
document.write("#topbar #topbar_combo_right { float: right; }");
document.write("#topbar #topbar_combo_right a { text-decoration: none; }");
document.write("#topbar .topbar_button { cursor: pointer; line-height: 26px; padding: 0px 10px; }");
document.write("#topbar #topbar_login_wrap { float: right; border-left: 1px solid #ccc; border-right: 1px solid #ccc; z-index: 10; }");
document.write("#topbar #topbar_login_wrap .active { background-color: #fff; }");
document.write("#topbar #topbar_login_extend { position: absolute; right: 10px; top: 26px; padding: 5px; border-width: 1px; border-style: solid; border-color: #ccc #333 #333 #333; background: #fff; }");
document.write("#topbar #topbar_login_extend form { font-size: 10px; }");
document.write("#topbar #topbar_login_extend .form_row label { display: block; }");
document.write("#topbar #topbar_login_extend .row_submit { text-align: right; padding-top: 3px; }");
document.write("#topbar #topbar_login_extend .row_submit input { border: 2px solid #666; background: #e5e5e5; padding: 1px 2px; font-weight: normal; font-size: 10px; }");
document.write("#topbar #topbar_login_extend #topbar_f_login_name { border: 1px solid #666; width: 100px; padding: 2px; background: #e5e5e5; }");
document.write("#topbar #topbar_login_extend #topbar_f_password { border: 1px solid #666; width: 100px; padding: 2px; background: #e5e5e5; }");
document.write("#topbar #topbar_login_extend #topbar_f_remember_label { display: inline; }");
document.write("#topbar #topbar_signup_wrap { float: right; border-left: 1px solid #ccc; }");
document.write("#topbar #topbar_signup_wrap .active { background-color: #fff; }");
document.write("#topbar #topbar_signout_wrap { float: right; border-left: 1px solid #ccc; border-right: 1px solid #ccc; }");
document.write("#topbar #topbar_signout_wrap .active { background-color: #fff; }");
document.write("#topbar #topbar_user_wrap { float: right; border-left: 1px solid #ccc; }");
document.write("#topbar #topbar_user_wrap .active { background-color: #fff; }");
document.write("#topbar #topbar_user_wrap img.avatar { width: 20px; height: 20px; vertical-align: middle; padding: 0px 4px; border: 0px; margin: 0px; }");
document.write("#topbar #topbar_combo_menu_head { line-height: 20px; padding: 0px 0px 2px 0px; list-style-type: none; margin: 0px 0px 5px 0px; border-bottom: 1px solid #ccc; }");
document.write("#topbar #topbar_combo_menu_head div { float: left; display: block; margin-right: 5px; background-image: url('icons/topbar.jpg'); background-repeat: no-repeat; width: 16px; height: 16px; }");
document.write("#topbar #topbar_combo_menu_detail ul.column { float: left; width: 100px; }");
document.write("#topbar ul li.topbar_combo_menu_entry { line-height: 20px; padding: 0px 0px 2px 0px; list-style-type: none; margin: 0px; clear: left; background: none; }");
document.write("#topbar ul li.topbar_combo_menu_entry div { float: left; display: block; width: 16px; height: 16px; background-image: url('icons/topbar.jpg'); background-repeat: no-repeat; margin-right: 5px; }");
document.write("#topbar #topbar_middle { float: left; margin-left: 10px; }");
document.write("#topbar #topbar_middle_wrap { line-height: 26px; }");
document.write("#topbar #topbar_combo_button .home { background-position: -122px 0px; background-image: url('icons/topbar.jpg'); background-repeat: no-repeat; margin-right: 5px; width: 16px; height: 16px; float: left; }");
document.write("#topbar #topbar_combo_menu #topbar_combo_menu_head .home { background-position: -64px -16px; }");
document.write("#topbar ul li.topbar_combo_menu_entry div.news { background-position: -160px -16px; }");
document.write("#topbar ul li.topbar_combo_menu_entry div.travel { background-position: -90px 0px; }");
document.write("#topbar ul li.topbar_combo_menu_entry div.movie { background-position: -31px 0px; width: 14px; }");
document.write("#topbar ul li.topbar_combo_menu_entry div.women { background-position: -45px 0px; }");
document.write("#topbar ul li.topbar_combo_menu_entry div.gossip { background-position: -106px 0px; }");
document.write("#topbar ul li.topbar_combo_menu_entry div.sport { background-position: -154px 0px; }");
document.write("#topbar ul li.topbar_combo_menu_entry div.tech { background-position: -16px 0px; }");
document.write("#topbar ul li.topbar_combo_menu_entry div.game { background-position: -80px -16px; }");
document.write("#topbar ul li.topbar_combo_menu_entry div.car { background-position: -128px -16px; }");
document.write("#topbar ul li.topbar_combo_menu_entry div.horo { background-position: -48px -16px; }");
document.write("#topbar ul li.topbar_combo_menu_entry div.tv { background-position: -60px 0px; }");
document.write("#topbar ul li.topbar_combo_menu_entry div.links { background-position: 0px -16px; }");
document.write("#topbar ul li.topbar_combo_menu_entry div.video { background-position: -75px 0px; width: 15px; }");
document.write("#topbar ul li.topbar_combo_menu_entry div.talk { background-position: -138px 0px; }");
document.write("#topbar ul li.topbar_combo_menu_entry div.market { background-position: -16px -16px; }");
document.write("#topbar ul li.topbar_combo_menu_entry div.album { background-position: 0px 0px; }");
document.write("#topbar ul li.topbar_combo_menu_entry div.club { background-position: -112px -16px; }");
document.write("#topbar ul li.topbar_combo_menu_entry div.blog { background-position: -144px -16px; }");
document.write("#topbar ul li.topbar_combo_menu_entry div.job { background-position: -32px -16px; }");
document.write("#topbar ul li.topbar_combo_menu_entry div.picpost { background-position: -170px 0px; }");
document.write("#topbar ul li.topbar_combo_menu_entry div.glitter { background-position: -96px -16px; }");
document.write("#topbar ul li.topbar_combo_menu_entry div.mymobile { background-position: -186px 0px; }");
document.write("#topbar ul li.topbar_combo_menu_entry div.music { background-position: -176px -16px; }");
document.write("</style>");
document.write("<div id=\"topbar\">");
document.write("	<div id=\"topbar_menu\">");
document.write("		<div id=\"topbar_combo_wrap\">");
document.write("			<div id=\"topbar_combo_button\" onclick=\"topbar.toggle_combo()\" onmouseover=\"topbar.mouseover_button()\" onmouseout=\"topbar.mouseout_button()\"><div class=\"home\"></div>MThai Menu");
document.write("			</div>");
document.write("			<div id=\"topbar_combo_menu\" style=\"display: none\">");
document.write("				<div id=\"topbar_combo_menu_head\">");
document.write("					<a href=\"http://www.mthai.com\">");
document.write("						<div class=\"home\"></div>");
document.write("						หน้าแรก MThai");
document.write("					</a>");
document.write("				</div>");
document.write("				<div id=\"topbar_combo_menu_detail\">");
document.write("					<ul class=\"column\">");
document.write("						<li class=\"topbar_combo_menu_entry\">");
document.write("							<a href=\"http://talk.mthai.com/section/news\">");
document.write("								<div class=\"news\"></div>");
document.write("								ข่าว");
document.write("							</a>");
document.write("						</li>");
document.write("						<li class=\"topbar_combo_menu_entry\">");
document.write("							<a href=\"http://travel.mthai.com\">");
document.write("								<div class=\"travel\"></div>");
document.write("								กิน / เที่ยว");
document.write("							</a>");
document.write("						</li>");
document.write("						<li class=\"topbar_combo_menu_entry\">");
document.write("							<a href=\"http://movie.mthai.com\">");
document.write("								<div class=\"movie\"></div>");
document.write("								ภาพยนตร์");
document.write("							</a>");
document.write("						</li>");
document.write("						<li class=\"topbar_combo_menu_entry\">");
document.write("							<a href=\"http://women.mthai.com\">");
document.write("								<div class=\"women\"></div>");
document.write("								ผู้หญิง");
document.write("							</a>");
document.write("						</li>");
document.write("						<li class=\"topbar_combo_menu_entry\">");
document.write("							<a href=\"http://gossipstar.mthai.com\">");
document.write("								<div class=\"gossip\"></div>");
document.write("								ซุบซิบดารา");
document.write("							</a>");
document.write("						</li>");
document.write("						<li class=\"topbar_combo_menu_entry\">");
document.write("							<a href=\"http://sport.mthai.com\">");
document.write("								<div class=\"sport\"></div>");
document.write("								กีฬา");
document.write("							</a>");
document.write("						</li>");
document.write("						<li class=\"topbar_combo_menu_entry\">");
document.write("							<a href=\"http://tech.mthai.com\">");
document.write("								<div class=\"tech\"></div>");
document.write("								เทคโนโลยี");
document.write("							</a>");
document.write("						</li>");
document.write("						<li class=\"topbar_combo_menu_entry\">");
document.write("							<a href=\"http://game.mthai.com\">");
document.write("								<div class=\"game\"></div>");
document.write("								เกมส์");
document.write("							</a>");
document.write("						</li>");
document.write("						<li class=\"topbar_combo_menu_entry\">");
document.write("							<a href=\"http://car.mthai.com\">");
document.write("								<div class=\"car\"></div>");
document.write("								รถยนต์");
document.write("							</a>");
document.write("						</li>");
document.write("						<li class=\"topbar_combo_menu_entry\">");
document.write("							<a href=\"http://horoscope.mthai.com\">");
document.write("								<div class=\"horo\"></div>");
document.write("								ดูดวง");
document.write("							</a>");
document.write("						</li>");
document.write("						<li class=\"topbar_combo_menu_entry\">");
document.write("							<a href=\"http://tv.mthai.com\">");
document.write("								<div class=\"tv\"></div>");
document.write("								ดูทีวี");
document.write("							</a>");
document.write("						</li>");
document.write("						<li class=\"topbar_combo_menu_entry\">");
document.write("							<a href=\"http://www.mthai.com/#link_dir\">");
document.write("								<div class=\"links\"></div>");
document.write("								รวมลิงก์");
document.write("							</a>");
document.write("						</li>");
document.write("					</ul>");
document.write("					<ul class=\"column\">");
document.write("						<li class=\"topbar_combo_menu_entry\">");
document.write("							<a href=\"http://video.mthai.com\">");
document.write("								<div class=\"video\"></div>");
document.write("								วีดีโอคลิป");
document.write("							</a>");
document.write("						</li>");
document.write("						<li class=\"topbar_combo_menu_entry\">");
document.write("							<a href=\"http://talk.mthai.com\">");
document.write("								<div class=\"talk\"></div>");
document.write("								เว็บบอร์ด");
document.write("							</a>");
document.write("						</li>");
document.write("						<li class=\"topbar_combo_menu_entry\">");
document.write("							<a href=\"http://market.mthai.com\">");
document.write("								<div class=\"market\"></div>");
document.write("								ซื้อ / ขาย");
document.write("							</a>");
document.write("						</li>");
document.write("						<li class=\"topbar_combo_menu_entry\">");
document.write("							<a href=\"http://album.mthai.com\">");
document.write("								<div class=\"album\"></div>");
document.write("								อัลบั้มรูป");
document.write("							</a>");
document.write("						</li>");
document.write("						<li class=\"topbar_combo_menu_entry\">");
document.write("							<a href=\"http://club.mthai.com\">");
document.write("								<div class=\"club\"></div>");
document.write("								คลับ");
document.write("							</a>");
document.write("						</li>");
document.write("						<li class=\"topbar_combo_menu_entry\">");
document.write("							<a href=\"http://blog.mthai.com\">");
document.write("								<div class=\"blog\"></div>");
document.write("								บล็อก");
document.write("							</a>");
document.write("						</li>");
document.write("						<li class=\"topbar_combo_menu_entry\">");
document.write("							<a href=\"http://mthai.jobjob.co.th\" rel=\"nofollow\">");
document.write("								<div class=\"job\"></div>");
document.write("								หางาน");
document.write("							</a>");
document.write("						</li>");
document.write("						<li class=\"topbar_combo_menu_entry\">");
document.write("							<a href=\"http://picpost.mthai.com\">");
document.write("								<div class=\"picpost\"></div>");
document.write("								พิคโพสต์");
document.write("							</a>");
document.write("						</li>");
document.write("						<li class=\"topbar_combo_menu_entry\">");
document.write("							<a href=\"http://glitter.mthai.com\">");
document.write("								<div class=\"glitter\"></div>");
document.write("								กลิตเตอร์");
document.write("							</a>");
document.write("						</li>");
document.write("						<li class=\"topbar_combo_menu_entry\">");
document.write("							<a href=\"http://evo.mthai.com/mymobile\">");
document.write("								<div class=\"mymobile\"></div>");
document.write("								แต่งมือถือ");
document.write("							</a>");
document.write("						</li>");
document.write("						<li class=\"topbar_combo_menu_entry\">");
document.write("							<a href=\"http://music.mthai.com\">");
document.write("								<div class=\"music\"></div>");
document.write("								ฟังเพลงออนไลน์");
document.write("							</a>");
document.write("						</li>");
document.write("					</ul>");
document.write("					<div style=\"clear: left\"></div>");
document.write("				</div>");
document.write("			</div>");
document.write("		</div>");
document.write("		<!--");
document.write("		<div id=\"topbar_quick_icon\">");
document.write("			<div class=\"topbar_quick_icon_elem topbar_button\">");
document.write("				<a href=\"#\" id=\"topbar_quick_icon_1\" title=\"Icon 1\">icon1</a>");
document.write("			</div>");
document.write("			<div class=\"topbar_quick_icon_elem topbar_button\">");
document.write("				<a href=\"#\" id=\"topbar_quick_icon_2\" title=\"Icon 2\">icon2</a>");
document.write("			</div>");
document.write("			<div class=\"topbar_quick_icon_elem topbar_button\">");
document.write("				<a href=\"#\" id=\"topbar_quick_icon_3\" title=\"Icon 3\">icon3</a>");
document.write("			</div>");
document.write("		</div>");
document.write("		-->");
document.write("		<div id=\"topbar_middle\">");
document.write("			<div id=\"topbar_middle_wrap\">");
document.write("				<!-- Lorem ipsum dolor sit amet, consectetuer adipiscing elit. -->");
document.write("			</div>");
document.write("		</div>");
document.write("		<div id=\"topbar_combo_right\">");
document.write("									<div id=\"topbar_login_wrap\">");
document.write("				<div id=\"topbar_login_button\" class=\"topbar_button\" onclick=\"topbar.toggle_login()\" onmouseover=\"topbar.mouseover_login()\" onmouseout=\"topbar.mouseout_login()\">");
document.write("					ล็อกอิน");
document.write("				</div>");
document.write("				<div id=\"topbar_login_extend\" style=\"display: none\">");
document.write("					<form action=\"http://www.mthai.com/account/login\" method=\"post\" accept-charset=\"utf-8\">");
document.write("						<input type=\"hidden\" name=\"ref\" value=\"\">");
document.write("						<div class=\"form_row\">");
document.write("							<label for=\"topbar_f_login_name\">Login:</label>");
document.write("							<input type=\"text\" name=\"login_name\" value=\"\" id=\"topbar_f_login_name\">");
document.write("						</div>");
document.write("						<div class=\"form_row\">");
document.write("							<label for=\"topbar_f_password\">Password:</label>");
document.write("							<input type=\"password\" name=\"password\" value=\"\" id=\"topbar_f_password\">");
document.write("						</div>");
document.write("						<div class=\"form_row\">");
document.write("							<input type=\"checkbox\" name=\"remember\" value=\"1\" id=\"topbar_f_remember\">");
document.write("							<label for=\"topbar_f_remember\" id=\"topbar_f_remember_label\">Remember</label>");
document.write("						</div>");
document.write("						<div class=\"form_row row_submit\">");
document.write("							<input type=\"submit\" name=\"submit_bttn\" value=\"Login\" id=\"topbar_f_submit_bttn\">");
document.write("						</div>");
document.write("					</form>");
document.write("				</div>");
document.write("			</div>");
document.write("			<div id=\"topbar_signup_wrap\">");
document.write("				<div id=\"topbar_signup_button\" class=\"topbar_button\" onmouseover=\"topbar.mouseover_bttn('topbar_signup_button')\" onmouseout=\"topbar.mouseout_bttn('topbar_signup_button')\">");
document.write("					<a href=\"http://www.mthai.com/register/register.php?lv=1\" title=\"สมัครสมาชิก\">สมัครสมาชิก</a>");
document.write("				</div>");
document.write("			</div>");
document.write("					</div>");
document.write("	</div>");
document.write("</div>");
document.write("");

