	window.onload = function() {	
		var iphoneFlag = 0;
		if ( navigator.userAgent && ( navigator.userAgent.match( /iPhone/i ) || navigator.userAgent.match( /iPod/i ) ) ) {
			//alert( "ok" );
			var alertBox = document.getElementById( "alertBox" );
			alertBox.innerHTML = "Our home page exists also <div style='margin:60px 0'>for iPhone, click the link:</div>";
			alertBox.innerHTML += "<div><a href='en/iphone/index.html'>iPhone web page</a></div>";
			alertBox.innerHTML += "<p class='info'>or <a href='javascript:closeIphoneBanner();'>close this banner</a></p>";
			alertBox.style.display = "block";
			
			var banner = document.getElementById( "banner" );
			banner.style.height = "1px";
			
			iphoneFlag = 1;
		}		
		
		loadShowRooms();
		
		setTimeout( function() {
			var banner = document.getElementById( "banner" );		
			if( iphoneFlag == 0 ) {
				var html = "";
				// load the swf:				
				html = '<object id="text-animation" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="828" height="155">';
				html +=	'<param name="movie" value="swf/banner_text.swf" />';
				html +=	'<param name="bgcolor" value="#000000" />';
				//banner.innerHTML +=	'	<!--[if !IE]>-->';
				html +=	'<object type="application/x-shockwave-flash" data="swf/banner_text.swf" width="828" height="155">';
				//banner.innerHTML +=	'	<param name="wmode" value="transparent" />';
				html +=	'<param name="bgcolor" value="#000000" />';
				html +=	'<param name="play" value="true">';
				//banner.innerHTML +=	'<!--<![endif]-->';
				html +=	'<p style="color:#000000;padding:1em;">You have an old version of Flash Player. <a href="http://www.adobe.com/go/getflash/" target="_top">Get the latest Flash player.</a></p>';
				//banner.innerHTML +=	'<!--[if !IE]>-->';
				html +=	'</object>';
				//banner.innerHTML +=	'<!--<![endif]-->';
				html += '</object>';
				
				banner.innerHTML = html;
			} else {
				// no SWF reader on iPhone/iPod
				// remove the progress bar:
				banner.innerHTML = "";
				
				//"Our home page exists also <div style='margin:60px 0'>for iPhone, click the link:</div>";
//				banner.innerHTML += "<div><a href='en/iphone/index.html'>iPhone web page</a></div>";
			}
			// load spotlight images:
			
			var spotlightImg = document.getElementById( "spotlight" );		
			//spotlightImg = new Image();
			spotlightImg.src = "/images/PulpMotion-AD-banner-small.jpg";
			spotlightImg.style.visibility = "visible";
			
		}, 400 );
		
	
	}
	
	function closeIphoneBanner() {
		var alertBox = document.getElementById( "alertBox" );
		alertBox.style.display = "none";
		var banner = document.getElementById( "banner" );
		banner.style.height = "155px";
		var html = "<div style='font-weight:bold;width:70%;text-align:center;font-size:42px; margin:0px auto;'";
		html += "<p style='padding-top:30px'>GET THE MOST</p>";
		html += "<p style='padding-bottom:30px'>OF YOUR DIGITAL LIFE</p>";		
		html += "</div>";
		banner.innerHTML += html;
	}
	
	function loadShowRooms() {
		var showRooms = new Array();
		showRooms.pulpAdvShowRoom = "images/screens/home_showroom_pulpadv.jpg";
		showRooms.bannerZestShowRoom = "images/screens/home_showroom_bz.jpg";
		showRooms.iDiveShowRoom = "images/screens/home_showroom_idive.jpg";
		showRooms.videopierShowRoom = "images/screens/home_showroom_videopier.jpg";
		for( id in showRooms ) {
			var img = document.getElementById(id);
			img.src = showRooms[id];
			img.className = "";
		}
	}


	/** Check if the mouse is really out of div */
	function checkEventMouse(e, classname) {
		var el;	 
		if (navigator.userAgent.indexOf("MSIE") != "-1") {
			el = window.event.toElement;	 
		} else if (e.relatedTarget != null) {
			el = (e.relatedTarget.tagName ? e.relatedTarget : e.relatedTarget.parentNode);
		}
	 
		if ( getContainerWith(el, "DIV", classname) == null ) {
	 		return true;	 
		} else {
			return false;
		}
	}
	 
	function getContainerWith(node, tagName, className) {
		while (node != null) {
			if ( node.tagName != null && node.tagName == tagName ) {
				if( node.className == className ) {
					return node;	 
				}
			}
			node = node.parentNode;
		}	 
		return null;
	}
	
	function showAPanel(tab, panel, e) {
		//if( !checkEventMouse(e, "pl-soft-selected") ) return;
	
		// get tab:
		var tabsAndCo = document.getElementById("landing-products");
		
		var elements = tabsAndCo.getElementsByTagName("div");
		for( var i=0;i<elements.length;i++ ) {
			if( elements[i].className == "pl-soft-selected" ) {
				elements[i].className = "pl-soft";
				// remove arrow
				var arrow = document.getElementById("arrow");
				if( arrow ) elements[i].removeChild(arrow);
			}
		}
		
		// highlight the selected tab
		var tab = document.getElementById(tab);
		tab.className = "pl-soft-selected";

		var arrow = document.createElement("div");
		arrow.id = "arrow";
		tab.appendChild(arrow);
		
		// show the good panel
		sp1.showPanel(panel);
	}
	
	function goToSoftHomePage(soft) {
		var url = null;
		switch( soft ) {
			case "pulpmotion":
				url ="snorkel.html";/*リンク01*/
			break;
			
			case "bannerzest":
				url ="kayak.html";/*リンク03*/
			break;
			
			case "idive" :
				url ="healing.html";/*リンク04*/
			break;
			
			case "videopier":
				url ="course_set.html";/*リンク05*/
			break;
			
			case "pulpmotionadvanced":
				url ="scuba.html";/*リンク02*/
			break;
		}	
		if( url ) window.location.href=url;
	}