/*------------------------------
 News visible unVisible
------------------------------*/
function fadeIn_toggle() {
	$('#news-area, #news-contents, .news-title, #news-close' ).fadeIn( 'normal');
}
function fadeOut_toggle() {
	$('#news-area, #news-contents, .news-title, #news-close' ).fadeOut( 'normal');
}


function fadeOut_toggle_setTime() {
	/*if (location.href == "http://setoseikei.co.jp/") { // トップページアクセス時のサブドメイン（www）の判定
		location.replace("http://www.setoseikei.co.jp/");
	}*/
	setTimeout(function() {
	gMapLoad(); // Google Mapロード
		$( '#news-area' ).fadeOut( 'fast',function() {
					$('#mask-index, #news-contents, .news-title, #news-close' ).fadeOut( 'fast');
   });
	}, 3000 );
}




/*------------------------------
 Flash Movie Control
------------------------------*/
function selectScene(scene) {
	swfTarget("externalInterface").setScene(scene);
}

function swfTarget(str) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[str];
	} else {
		return document[str];
	}
}


/*------------------------------
 Url Check
------------------------------*/

function checkURL() {
 var pmtURL = "http://www.setoseikei.co.jp/about/about.html";  /* ライブアップ時に要変更 */

	if(document.referrer != pmtURL) return;
		var s = location.search.substring(1);
		if(s == "") {
			fadeOut_toggle_setTime();
			setActiveStyleSheet('Home');
		} else if (s == "news") {
			fadeIn_toggle();
			setActiveStyleSheet('News');
			
			setTimeout(function() {
				gMapLoad(); // Google Mapロード
				$( selectScene(1))
			}, 1500 );
		}
}

function checkURL2() {
 var pmtURL = "http://www.setoseikei.co.jp/brand/brand.html";  /* ライブアップ時に要変更 */

	if(document.referrer != pmtURL) return;
		var s = location.search.substring(1);
		if(s == "") {
			fadeOut_toggle_setTime();
			setActiveStyleSheet('Home');
		} else if (s == "news") {
			fadeIn_toggle();
			setActiveStyleSheet('News');
			
			setTimeout(function() {
				gMapLoad(); // Google Mapロード
				$( selectScene(1))
			}, 1500 );
		}
}

function checkURL3() {
 var pmtURL = "http://www.setoseikei.co.jp/brand/sshome.html";  /* ライブアップ時に要変更 */

	if(document.referrer != pmtURL) return;
		var s = location.search.substring(1);
		if(s == "") {
			fadeOut_toggle_setTime();
			setActiveStyleSheet('Home');
		} else if (s == "news") {
			fadeIn_toggle();
			setActiveStyleSheet('News');
			
			setTimeout(function() {
				gMapLoad(); // Google Mapロード
				$( selectScene(1))
			}, 1500 );
		}
}



var myRef = document.referrer;
if (myRef == "http://www.setoseikei.co.jp/index.html") {  /* ライブアップ時に要変更 */
	fadeOut_toggle_setTime();
} else if (myRef == "http://www.setoseikei.co.jp/about/about.html") {  /* ライブアップ時に要変更 */
	checkURL();
} else if (myRef == "http://www.setoseikei.co.jp/brand/brand.html") {  /* ライブアップ時に要変更 */
	checkURL2();
} else if (myRef == "http://www.setoseikei.co.jp/brand/sshome.html") {  /* ライブアップ時に要変更 */
	checkURL3();
} else {
	fadeOut_toggle_setTime();
}




/*------------------------------
 Google Map
------------------------------*/

var icon = Array();
icon = new GIcon();
icon.image = "about/images/ss_icn.png";
icon.iconSize = new GSize(18, 25);
icon.iconAnchor = new GPoint(10, 15);

function gMapLoad() {
	if (GBrowserIsCompatible()) {
		var map = new GMap2(document.getElementById("map"));
		map.setCenter(new GLatLng(35.673504,139.704495), 17);
		map.setMapType(G_SATELLITE_MAP);
	
		function createMarker(point,html) {
			var marker = new GMarker(point,icon);
 		return marker;
		}

		var point = new GLatLng(35.673504,139.704495);
		var marker = createMarker(point);
		map.addOverlay(marker);
 }
}



/*------------------------------
 Window Open
------------------------------*/
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


