function _check_mobile()
{
	var changeURL = function(){
	  	if(document.getElementById('hrefMobile'))
	  		document.getElementById('hrefMobile').href = 'index-mobile.php';
		delete changeURL;
	  }
	  
  	if (document.addEventListener){
		document.addEventListener("DOMContentLoaded", changeURL, false);
	} else {
		document.attachEvent("onDOMContentLoaded", changeURL);
	}
	
	var ua = navigator.userAgent.toLowerCase();
	var platform = navigator.platform.toLowerCase();
	var UA = ua.match(/(opera|ie|firefox|chrome|version)[\s\/:]([\w\d\.]+)?.*?(safari|version[\s\/:]([\w\d\.]+)|$)/) || [null, 'unknown', 0];
  	var mode = UA[1] == 'ie' && document.documentMode;
	
  	var Browser = {
		extend: Function.prototype.extend,
  		name: (UA[1] == 'version') ? UA[3] : UA[1],
  		version: mode || parseFloat((UA[1] == 'opera' && UA[4]) ? UA[4] : UA[2]),
  		Platform: {
  			name: ua.match(/ip(?:ad|od|hone)/) ? 'ios' : (ua.match(/(?:webos|android|bada|symbian|palm|blackberry)/) || platform.match(/mac|win|linux/) || ['other'])[0]
  		},
  		Features: {
  			xpath: !!(document.evaluate),
  			air: !!(window.runtime),
  			query: !!(document.querySelector),
  			json: !!(window.JSON)
  		},
  		Plugins: {}
  	};

  	var page = parseInt(window.location.hash.substring(2, window.location.hash.length-1));
  	page = page?'#'+page:'';
  	
  	if(Browser.Platform.name == 'android' || Browser.Platform.name == 'ios'){
  		window.location = "index-mobile.html"+page;
  	} 
  	// if(Browser.Platform.name == 'webos' || Browser.Platform.name == 'bada' || Browser.Platform.name == 'symbian' || Browser.Platform.name == 'palm' || Browser.Platform.name == 'blackberry') 
  		// window.location = dir+assetsFolder+"/seo/page1.html";
}

function _load_mobile_contents()
{
	//載入底部div
	$("#bottom").load('subcontents/bottom-mobile.php');
}



function _load_web_contents()
{
	//載入頂部div
	$("#header").load('subcontents/header.html');
	//載入底部div
	$("#bottom").load('subcontents/bottom.php', null, function(){
		_menus_hover();
	});
}

function _menus_hover(){
	$(".bm-link").hover(
		function(){
			$newsrc = $(this).children('img').attr('src')
						.replace('01','012')
						.replace('02','022')
						.replace('03','032')
						.replace('04','042')
						.replace('05','052')
						.replace('06','062')
						.replace('07','072');
			$(this).children('img').attr('src', $newsrc);
		},
		function(){
			$newsrc = $(this).children('img').attr('src')
						.replace('012','01')
						.replace('022','02')
						.replace('032','03')
						.replace('042','04')
						.replace('052','05')
						.replace('062','06')
						.replace('072','07');
			$(this).children('img').attr('src', $newsrc);
		}
	);
} 
