

/*
	Preload menu rollovers etc
*/
function PreLoad()
{
	var a=new Array("HOME","SOLUTIONS","PRODUCTS","SERVICES","ALLIANCES","SUPPORT","CONTACTUS","ABOUTUS","HELP");
	var img=new Array();
	
	for(var i=0;i<a.length;i++)
	{
		img[i]=new Image();
		img[i].src="../img/menu/"+a[i]+"_over.gif";
	}
}

/*
	Insert flash banner
*/
function InsertFlashBanner(swf)
{
	
	var n=getFlashVersion();
	if(n>3 || n==-1)
	{
		// insert flash banner
	
		document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0\" width=\"289\" height=\"131\" id=OBJECT2>");
		document.write("<param name=movie value=\""+swf+"\">");
		document.write("<param name=quality value=high>");
		document.write("<embed src=\""+swf+"\" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"289\" height=\"131\">");
		document.write("</embed>");
		document.write("</object>");
	

	}
	else
	{
		// insert link to macromedia download
		document.write("<a href=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" target=\"__blank\"><img src=\"../img/get_flashplayer"+".gif\" hspace=\"24\" align=\"left\" border=\"0\"></a> This site requires the Macromedia Flash player for optimal viewing.<br>Click on the icon to download it for FREE");
	}

}

function InsertFlashBannerResize(swf)
{
	
	var n=getFlashVersion();
	if(n>3 || n==-1)
	{
		// insert flash banner
		e = canResizeFlash();
		document.write('<object name="movie" data="' +swf + '" width="100%" height="100%" type="application/x-shockwave-flash">');
		document.write("<param name=movie value=\""+swf+"\">");
		document.write('<param name="FlashVars" value="allowResize='+e+'" />');
		document.write('Flash Movie With Resizing Content');
		document.write('</object>');

	}
	else
	{
		// insert link to macromedia download
		document.write("<a href=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" target=\"__blank\"><img src=\"../img/get_flashplayer"+".gif\" hspace=\"24\" align=\"left\" border=\"0\"></a> This site requires the Macromedia Flash player for optimal viewing.<br>Click on the icon to download it for FREE");
	}

}


/*
	Sub-menu rollovers
*/
function subon(id){document.images[id].src="../img/1bk.gif";}
function suboff(id){document.images[id].src="../img/1bk.gif"}

/*
	Main-menu rollovers
*/
function mainon(id){document.images["mmnu"+id].src="../img/menu/"+id+"_over.gif";}
function mainoff(id){document.images["mmnu"+id].src="../img/menu/"+id+".gif"}


function MouseOver(imgName) {
	if(document.images) {
		if (imgName.src.indexOf("-on") ==-1){
			// get the image type
			suffixType = imgName.src.substring(imgName.src.lastIndexOf("."),imgName.src.length);
			// swap to new image
			if (imgName.src.indexOf("-over") == -1) {
				imgName.src = imgName.src.substring(0,(imgName.src.indexOf(suffixType))) + "-over" + suffixType;
			}
		}
	}
}

function MouseOut(imgName) {
	if(document.images) {
		// get the image type
		suffixType = imgName.src.substring(imgName.src.lastIndexOf("."),imgName.src.length);
		
		// swap image back to original
		if (imgName.src.indexOf("-over") != -1) {
			imgName.src = imgName.src.substring(0,(imgName.src.indexOf("-over"))) + suffixType;
		}
	}
}





/*
	Print page
*/
function printPage()
{
	if(is_ie4up)
	{
		document.execCommand("print");
	}
}




/*
	Browser detection code based on the script from www.mozilla.org but cut down
*/

var agt=navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);

var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
            && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
            && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var is_nav2 = (is_nav && (is_major == 2));
var is_nav3 = (is_nav && (is_major == 3));
var is_nav4 = (is_nav && (is_major == 4));
var is_nav4up = (is_nav && (is_major >= 4));
var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) ||
                      (agt.indexOf("; nav") != -1)) );
var is_nav6 = (is_nav && (is_major == 5));
var is_nav6up = (is_nav && (is_major >= 5));
var is_gecko = (agt.indexOf('gecko') != -1);
var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_ie3    = (is_ie && (is_major < 4));
var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
var is_ie4up  = (is_ie && (is_major >= 4));
var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);







/*
	Flash Version Detector  v1.1.1
	http://www.dithered.com/javascript/flash_detect/index.html
	code by Chris Nott (chris@dithered.com)
	
	Return values:-
		 0 = flash not detected
		-1 = cannot determine version
*/


function getFlashVersion()
{

	var flashVersion_DONTKNOW = -1;
	
	var dontKnow = false;
	
	var agent = navigator.userAgent.toLowerCase(); 
	flashVersion = flashVersion_DONTKNOW;	

	// NS3+ and Opera3+ (support plugin array):  check for Flash plugin in plugin array
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		var flashPlugin = navigator.plugins['Shockwave Flash'];
		if (typeof flashPlugin == 'object') { 
			if (flashPlugin.description.indexOf('6.') != -1) flashVersion = 6;
			else if (flashPlugin.description.indexOf('5.') != -1) flashVersion = 5;
			else if (flashPlugin.description.indexOf('4.') != -1) flashVersion = 4;
			else if (flashPlugin.description.indexOf('3.') != -1) flashVersion = 3;
		}
	}

	// IE4+ on Win32:  attempt to create an ActiveX object using VBScript
	else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win")!=-1 && agent.indexOf("16bit")==-1) {
		document.write('<scr' + 'ipt language="VBScript"\> \n');
		document.write('on error resume next \n');
		document.write('if IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6")) then flashVersion = 6 \n');
		document.write('if flashVersion < 6 and IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5")) then flashVersion = 5 \n');
		document.write('if flashVersion < 5 and IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4")) then flashVersion = 4 \n');
		document.write('if flashVersion < 4 and IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3")) then flashVersion = 3 \n');	
		document.write('</scr' + 'ipt\> \n'); 
	}
		
	// WebTV 2.5 supports flash 3
	else if (agent.indexOf("webtv/2.5") != -1) flashVersion = 3;

	// older WebTV supports flash 2
	else if (agent.indexOf("webtv") != -1) flashVersion = 2;

	// Can't detect in all other cases
	else {
		flashVersion = flashVersion_DONTKNOW;
		dontKnow = true;
	}

	return flashVersion;
}






// Zoom window for images
function openZoomWindow(s,w,h)
{
	var sUrl="../misc/zoom.asp?image="+escape(s)+"&w="+w+"&h="+h;
	var ww=w+20;
	var wh=h+20;
	
	var x=(screen.width-ww)/2;
	var y=(screen.height-wh)/2;
//	if (s!='../img/products/ws_overview1.gif'){	
		window.open(sUrl,"","menubar=no,location=no,resizable=yes,scrollbars=no,toolbar=no,status=no,width="+ww+",height="+wh+",left="+x+",top="+y);
//	}
}



// Window for flash presentations
function openFlashWindow(id,s,w,h,sTitle)
{
	var sUrl="../misc/flash.asp?movie="+escape(s)+"&title="+escape(sTitle)+"&h="+h+"&w="+w;
	var x=(screen.width-w)/2;
	var y=(screen.height-h)/2;
	window.open(sUrl,id,"menubar=no,location=no,resizable=no,scrollbars=no,toolbar=no,status=no,width="+w+",height="+h+",left="+x+",top="+y);
}

/* 
Methods for resizing the flash stage at runtime.

setFlashWidth(divid, newW)
divid: id of the div containing the flash movie.
newW: new width for flash movie

setFlashWidth(divid, newH)
divid: id of the div containing the flash movie.
newH: new height for flash movie

setFlashSize(divid, newW, newH)
divid: id of the div containing the flash movie.
newW: new width for flash movie
newH: new height for flash movie

canResizeFlash()
returns true if browser supports resizing flash, false if not. 
*/
function setFlashWidth(divid, newW){
	document.getElementById(divid).style.width = newW+"px";
}
function setFlashHeight(divid, newH){
	document.getElementById(divid).style.height = newH+"px";		
}
function setFlashSize(divid, newW, newH){
	setFlashWidth(divid, newW);
	setFlashHeight(divid, newH);
}
function canResizeFlash(){
	var ua = navigator.userAgent.toLowerCase();
	var opera = ua.indexOf("opera");
	if( document.getElementById ){
		if(opera == -1) return true;
		else if(parseInt(ua.substr(opera+6, 1)) >= 7) return true;
	}
	return false;
}

//-- Andy 21Nov04 for Starting Demo pages... should we move this to a lib???
function popup_window( url, id, width, height )
{
   //extract the url parameters if any, and pass them to the called html
   var tempvar=document.location.toString(); // fetch the URL string
   var passedparams = tempvar.lastIndexOf("?");
   if(passedparams > -1)
      url += tempvar.substring(passedparams);
  popup = window.open(url, id, 'toolbar=no,scrollbars=no,location=no,statusbar=no,menubar=no,resizable=no,width=' + width + ',height=' + height + '' );
  popup.focus();
}


function hideDivs()
{

somedivs = new Array('Overview','Features','Options','Download','Demo','Pricing','PricingQS','PricingUK','PricingUS','tabOverview','tabOptions','tabFeatures','tabDownload','tabDemo','tabPricing'); //input div id's here
n = somedivs.length;
for (i=0; i<n; i++) {
e = somedivs[i];
try {
	document.getElementById(e).style.display = "none";
} catch (e)
{ } 	
}

}

function showDiv(d,t)
{
document.getElementById(d).style.display = "block"; //div to appear
document.getElementById(t).style.display = "block"; //div to appear
//try {
//	lmovie = document.getElementById('movie');
//	//lmovie.stop();
//	lmovie.gotoFrame(0);
//	lmovie.play();
//} catch (e) {
//}
}

/*
	Insert logo as Flash or GIF image
*/
function InsertLogo(bg)
{
	var n=getFlashVersion();
	if(n>3 || n==-1)
	{
		// insert flash logo
		document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"  codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0\" width=\"74\" height=\"74\">");
		document.write("<param name=movie value=\"/flash/logo"+bg+".swf\">");
		document.write("<param name=quality value=high>");
		document.write("<embed src=\"../flash/logo"+bg+".swf\" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"74\" height=\"74\">");
		document.write("</embed>");
		document.write("</object>");

	}
	else
	{
		// insert logo graphic
		document.write("<img src=\"../img/logo"+bg+".gif\" width=\"72\" height=\"73\">");
	}
}

function InsertCustomers(bg)
{
	var n=getFlashVersion();
	if(n>3 || n==-1)
	{
		// insert flash logo
		document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"  codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0\" width=\"182\" height=\"84\">");
		document.write("<param name=movie value=\"../flash/"+bg+".swf\">");
		document.write("<param name=quality value=high>");
		document.write("<PARAM NAME='menu' VALUE='false'>");
		document.write("<PARAM NAME='bgcolor' VALUE='#000000'>");
		document.write("<embed src=\"../flash/"+bg+".swf\" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"182\" height=\"84\" BGCOLOR=\"#00000\">");
		document.write("</embed>");
		document.write("</object>");


	}
	else
	{
		// insert logo graphic
		document.write("<img src=\"../img/"+bg+".gif\" width=\"72\" height=\"73\">");
	}
}

function printProducts(){
	try {
		var x = document.all.tags("DIV");
		for (i = 0; i < x.length; i++) 
		{
			if (x(i).id == "content"){
				x(i).style.overflow = "visible";
				x(i).style.display = "block";			
			} else if (x(i).style.display == "block"){
				if (x(i).id=='Overview'){
					x(i).style.overflow = "visible";
					x(i).style.display = "block";			
				} else if (x(i).id=='Options'){
					x(i).style.overflow = "visible";
					x(i).style.display = "block";			
				} else if (x(i).id=='Features'){
					x(i).style.overflow = "visible";
					x(i).style.display = "block";			
				} else if (x(i).id=='content'){
					x(i).style.overflow = "visible";
					x(i).style.display = "block";			
				} else if (x(i).id=='PricingUK'){
					x(i).style.overflow = "visible";
					x(i).style.display = "block";			
				} else if (x(i).id=='PricingUS'){
					x(i).style.overflow = "visible";
					x(i).style.display = "block";			
				} else {
					x(i).style.overflow = "hidden";
					x(i).style.display = "none";			
				}
			} else {
				x(i).style.overflow = "hidden";
				x(i).style.display = "none";			
			}

		}
	} catch(e) {
	}
}

function returnPrintProducts(){
	var divname;
	var tabname;
	try {
		var x = document.all.tags("DIV");
		for (i = 0; i < x.length; i++) 
		{
			if (x(i).style.display == "block"){
				divname=x(i).id;
			}

		}

		for (i = 0; i < x.length; i++) 
		{
			x(i).style.overflow = "visible";
			x(i).style.display = "block";			

		}


	} catch(e) {
	}
	hideDivs();

	tabname=divname;
	if (divname=='PricingUK'){
		tabname='Pricing';
	}
	if (divname=='PricingUS'){
		tabname='Pricing';
	}

	showDiv(divname,'tab' + tabname);

}
