﻿	var Base="";

function isObject(a) {
	if (typeof a == 'object') {
		return (true);
	} else {
		return (false);
	}
}
	
	// 首頁頁面, 調整長度
	function initSidearea(x) {

	var menu=document.getElementById("Side");
		// var demo=document.getElementById("DemoArea").offsetHeight;
		var demo=0;
		if (x==0) {
			var  ban=5;
		} else {
			var ban=document.getElementById("BannerArea").offsetHeight;
		}
		var news=document.getElementById("NewsArea")
		var newHeight=demo+ban+news.offsetHeight;;
		var browser=navigator.appVersion;
		
		//if (browser.indexOf("MSIE") == -1) 
		//	newHeight-= 4;
			
		if  (newHeight > menu.offsetHeight) {
			menu.style.height=newHeight;
		} else {
			newHeight=menu.offsetHeight;
			//if (browser.indexOf("MSIE") == -1) 
			//	newHeight-= 4;
			news.style.height=newHeight;
		}
		
	}

	// 次頁頁面, 調整長度
	function init(x) {
		
		var menu=document.getElementById("Side");
		var home=document.getElementById("NewsArea");
		
		// x=0  沒有廣告Banner
		if (x==0) {
			var ban=0;
		} else {
			var ban=document.getElementById("BannerArea").offsetHeight;
		}
		
		var newHeight=home.offsetHeight+ban;
		var browser=navigator.appVersion;
		
		//if (browser.indexOf("MSIE") == -1) 
		//	newHeight-= 4;

		if (newHeight>menu.offsetHeight) {
			menu.style.height=newHeight;
		} else {
			newHeight=menu.offsetHeight - ban;
			//if (browser.indexOf("MSIE") == -1) 
			//	newHeight-= 4;
			home.style.height=newHeight ;
		}

		
		
	}

	// 購物頁面, 調整長度
	function shopinit(x) {
		
		var menu=document.getElementById("Shop");
		
		var home=document.getElementById("NewsArea");
		
		// x=0  沒有廣告Banner
		if (x==0) {
			var ban=0;
		} else {
			var ban=document.getElementById("BannerArea").offsetHeight;
		}
		var newHeight=home.offsetHeight+ban;
		var browser=navigator.appVersion;
		
		//if (browser.indexOf("MSIE") == -1) 
		//	newHeight-= 4;

		if (newHeight>menu.offsetHeight) {
			menu.style.height=newHeight;
		} else {
			newHeight=menu.offsetHeight - ban;
			//if (browser.indexOf("MSIE") == -1) 
			//	newHeight-= 4;
			home.style.height=newHeight ;
		}
	}

	function ShopinitDetail(x) {
		
		var menu=document.getElementById("Shop");
		var home=document.getElementById("HomeDetail");
		
		// x=0  沒有廣告Banner
		
		if (x==0) {
			var ban=0;
		} else {
			var ban=document.getElementById("BannerArea").offsetHeight;
		}
		var newHeight=home.offsetHeight+ban;
		var browser=navigator.appVersion;
		
		//if (browser.indexOf("MSIE") == -1) 
		//	newHeight-= 4;

		if (newHeight>menu.offsetHeight) {
			menu.style.height=newHeight;
		} else {
			newHeight=menu.offsetHeight - ban;
			//if (browser.indexOf("MSIE") == -1) 
			//	newHeight-= 4;
			home.style.height=newHeight;
		}
	}
	
	
	// Detail 頁面, 調整長度
	function initDetail(x) {
		
		var menu=document.getElementById("Side");
		var home=document.getElementById("HomeDetail");
		
		// x=0  沒有廣告Banner
		
		if (x==0) {
			var ban=0;
		} else {
			var ban=document.getElementById("BannerArea").offsetHeight;
		}
		var newHeight=home.offsetHeight+ban;
		var browser=navigator.appVersion;
		
		//if (browser.indexOf("MSIE") == -1) 
		//	newHeight-= 4;

		if (newHeight>menu.offsetHeight) {
			menu.style.height=newHeight;
		} else {
			newHeight=menu.offsetHeight - ban;
			//if (browser.indexOf("MSIE") == -1) 
			//	newHeight-= 4;
			home.style.height=newHeight;
		}

		
		
	}


	// 轉址 for Flash Menu
	
	function go(Item) {
		switch (Item){
			case "Home" :
				location.href=Base + "/default.asp";
				break;
			case "News" :
				location.href=Base + "/News.asp";
				break;
			case "About" :
				location.href=Base + "/Aboutus.asp";
				break;
			case "Board" :
				location.href=Base + "/Board.asp";
				break;
			case "Post" :
				location.href=Base + "/BoardPost.asp";
				break;
			case "Products" :
				location.href=Base + "/Products.asp";
				break;
			case "Album" :
				location.href=Base + "/Album.asp";
				break;
			case "Support" :
				location.href=Base + "/support.asp";
				break;
			case "Product_1" :
				location.href=Base + "/Shop.asp?c=0";
				break;
			case "Product_2" :
				location.href=Base + "/newsdetail.asp?id=27";
				break;
			case "Product_3" :
				window.open("http://www.masdar.com.tw");
				//location.href=Base + "/support.asp";
				break;
			case "Product_4" :
				//window.open("http://www.masdar.com.tw/Brand.asp");
				location.href=Base + "/theProducts.asp?c=110";
				break;
			case "Product_5" :
				window.open("http://www.masdar.com.tw/Brand.asp");
				break;
			case "Product_6" :
				location.href=Base + "/newsdetail.asp?id=19";
				break;
			default :
				//alert (Item);
				break;
		}
	}
	
	function search(txt) {
		location.href=Base + "/searchresult.asp?s=" + txt
	}
	
	// Tag Hit
	function gotag(tag) {
		location.href=Base + "/gotag.asp?t="+tag;
	}
	

