function toggleSWF(swfdiv) {
	var swf = document.getElementById(swfdiv);
	if (swf.className == "hidden") {
		swf.className = "";
		MM_showHideLayers(swfdiv,'','show')
	} else {
		swf.className = "hidden";
		MM_showHideLayers(swfdiv,'','hide')
	}	
}

function MM_changeProp(objId,x,theProp,theValue) { //v9.0
  var obj = null; with (document){ if (getElementById)
  obj = getElementById(objId); }
  if (obj){
    if (theValue == true || theValue == false)
      eval("obj.style."+theProp+"="+theValue);
    else eval("obj.style."+theProp+"='"+theValue+"'");
  }
}

function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
		
function MM_showHideLayers() { //v9.0
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3)
	with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
	obj.visibility=v; }
}
		
function MM_setTextOfLayer(objId,x,newText) { //v9.0
	with (document) if (getElementById && ((obj=getElementById(objId))!=null))
	with (obj) innerHTML = unescape(newText);
}

function reswapImg() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function swapImg() { //v3.0
  var i,j=0,x,a=swapImg.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function LoadFlashBanner(folder)
{
	LoadSizedFlashBanner(folder, 'oled_shared/OceanBanner_xmlDataFile.swf', 255);
}

function LoadSizedFlashBanner(folder, bannerSWF, height)
{
	var flashvars = {xmlDataFile: folder + '/bannerdata.xml'};

	var flashparams =
		{
				wmode: "opaque",
				bgcolor: "#000000",
				scale : "noscale",
				salign : "t",
				allowFullScreen : "true",
				allowScriptAccess : "Always"
	};		
	
	var iOS = (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i));
	
	if (iOS || !EmbedFlash('FlashFeature', bannerSWF, '1000', height, '10.0.0', null, flashvars, flashparams, {}))
	{
		// flash was not embedded so add the non-flash banner instead
		var content = '<div id="jbanner" style="height:' + height + ';">\n';
		content += '<a href="#" id="prev"><img src="media/banner/prev.png" alt="Previous" /></a>\n';
		content += '<a href="#" id="next"><img src="media/banner/next.png" alt="Next" /></a>\n';
		content += '<ul>\n';
		
		for (var i = 0; i < OLED_NonFlashBannerData.length; i++)
		{
			content += GenerateFlashBannerSection(
					OLED_NonFlashBannerData[i].title,
					OLED_NonFlashBannerData[i].body,
					OLED_NonFlashBannerData[i].image,
					OLED_NonFlashBannerData[i].title,
					OLED_NonFlashBannerData[i].url);
		}
		
		content += '</ul>\n';
		content += '</div>\n';
		
		var feature = document.getElementById('FlashFeature');
		feature.innerHTML = content;
		
		jQuery('#jbanner ul').cycle
		({ 
		    fx:     'fade', 
			speed:  1000,
			sync: 1,
			random:    0,
			timeout: 6000, 
			next:   '#next', 
			prev:   '#prev', 
			pause: 1,
			width: 1000,
			height: height,
			manualTrump: false,
			cleartypeNoBg: true
		});
	}
}

function GenerateFlashBannerSection(heading, desc, image, alt, link)
{
	var content = '<li>\n';
	content += '	<h2>' + heading + '</h2>\n';
	content += '	<p>' + desc + '</p>\n';
	content += '	<a class="findoutmore" href="' + link + '"><img src="/media/banner/findoutmore.gif" alt="Find out more" /></a>\n';
	content += '	<div class="overlay">&nbsp;</div>\n';
	content += '	<img class="gradient" src="/media/banner/gradient.png" />\n';
	content += '	<img src="' + image + '" " alt="' + alt + '" />\n';
	content += '</li>\n';
	
	return content;
}

function LoadGalleryPageFlash(folder)
{
	// var flashparams = {bgcolor : "#000000", wmode : "transparent", salign : "t", allowFullScreen : "false", allowScriptAccess : "sameDomain"};
						
	// swfobject.switchOffAutoHideShow();
	// swfobject.embedSWF(folder + "/sildeshow.swf", "sildeshow", "900", "650", "9.0.0", flashparams);

	var params = {scale : "noscale", wmode : "transparent", salign : "t", allowFullScreen : "false", allowScriptAccess : "sameDomain"};
	var attributes = {id : "sildeshow"};
	var obj = folder + "/sildeshow.swf";
	var container = "sildeshow";
	var w = "900px";
	var h = "650px";
	var version = "9.0.0";
	var expressInstall = null;
	var flashvars = null;
	EmbedFlash(container, obj, w, h, version, expressInstall, flashvars, params, attributes);
}

function LoadNewsTicker(folder)
{
	var flashvars = {xmlDataFile: folder + '/news.xml'};
	var params = {scale : "noscale", wmode : "transparent", salign : "t", allowFullScreen : "false", allowScriptAccess : "sameDomain"};
	var attributes = {id : "news_ticker"};
	var obj = folder + '/ocean-ticker_' + folder + '.swf';
	var container = "news_ticker";
	var w = "660px";
	var h = "48px";
	var version = "9.0.0";
	var expressInstall = null;
	EmbedFlash(container, obj, w, h, version, expressInstall, flashvars, params, attributes);
}

function SetupHomepageDropups()
{
	/*	--	Toggle show/hide popups on product icons
	--------------------------------------------------------------	*/

	jQuery('.product_icons1').hover(
			function () {
				jQuery('#product_dropup1').show();
			},
			function () {
				jQuery('#product_dropup1').hide();
			}
		);

	jQuery('.product_icons2').hover(
		function () {
			jQuery('#product_dropup2').show();
		},
		function () {
			jQuery('#product_dropup2').hide();
		}
	);
	
	jQuery('.product_icons3').hover(
		function () {
			jQuery('#product_dropup3').show();
		},
		function () {
			jQuery('#product_dropup3').hide();
		}
	);
	
	jQuery('.product_icons4').hover(
		function () {
			jQuery('#product_dropup4').show();
		},
		function () {
			jQuery('#product_dropup4').hide();
		}
	);
	
/*	jQuery('.product_icons1').toggle(
		function () {
			jQuery('#product_dropup1').show();
			jQuery('#product_dropup2').hide();
			jQuery('#product_dropup3').hide();
			jQuery('#product_dropup4').hide();
		},
		function () {
			jQuery('#product_dropup1').hide();
		}
	);
	
	jQuery('.product_icons2').toggle(
		function () {
			jQuery('#product_dropup2').show();
			jQuery('#product_dropup1').hide();
			jQuery('#product_dropup3').hide();
			jQuery('#product_dropup4').hide();
		},
		function () {
			jQuery('#product_dropup2').hide();
		}
	);
	
	jQuery('.product_icons3').toggle(
		function () {
			jQuery('#product_dropup3').show();
			jQuery('#product_dropup1').hide();
			jQuery('#product_dropup2').hide();
			jQuery('#product_dropup4').hide();
		},
		function () {
			jQuery('#product_dropup3').hide();
		}
	);
	
	jQuery('.product_icons4').toggle(
		function () {
			jQuery('#product_dropup4').show();
			jQuery('#product_dropup1').hide();
			jQuery('#product_dropup2').hide();
			jQuery('#product_dropup3').hide();
		},
		function () {
			jQuery('#product_dropup4').hide();
		}
	);
*/
}


