
var allURLbase='/sales/streams/'
var ieCodebase=allURLbase+'streetnoagent7.cab';
var npJARbase=allURLbase+'streetnoagent7.jar';
var ieVersion='0501,0088,7,1';
var npVersion='0501.0088.5.1';
var np3Codebase=allURLbase+'plugin.html';

var width=640;
var height=480;
var caption='Mentor';

var ieOnExit;
var npOnExit;

var currentURL=document.URL;
var currentDir="";
while(currentURL.indexOf("/")>-1)
	{
	nextpart=currentURL.substring(0, currentURL.indexOf("/")+1);
	currentURL=currentURL.substring(currentURL.indexOf("/")+1, currentURL.length);
	currentDir=currentDir+nextpart;
	}

function IExplorerTag(stream) {
	  document.writeln('<html><body background="../../../bg.gif">');
	  document.writeln('<OBJECT classid=clsid:0B72CCA4-5F11-11D0-9CB5-0000C0EC9FDB');
	  document.writeln('codebase='+ieCodebase+'#Version='+ieVersion);
	  document.writeln('width='+width+' height='+height+'>');
	  document.writeln('<param name=src value='+stream+'>');
	  document.writeln('<param name=url  value="'+location.href+'">');
	  document.writeln('<param name=window value="full-screen">');
	  document.writeln('<param name=caption value='+caption+'>');
	  document.writeln('<param name=onexit value="'+ieOnExit+'">');
	  document.writeln('</OBJECT>');
	  document.writeln('</body></html>');
	  return;
	}

function NetscapeTag(stream) {
	  document.writeln('<EMBED width='+ width +' height=' +height);
	  document.writeln('type=application/street-stream stream="'+stream+'"');
	  document.writeln('url="'+location.href+'"');
	  document.writeln('pluginspage="'+np3Codebase+'"');
	  document.writeln('window="full-screen" caption='+caption+' onexit='+npOnExit+'>');
	  return;
	}

	

function NetscapeLoadPlugin(){
	if (parseInt(navigator.appVersion)<4)  //check for version<4
		{
		self.location.href=np3Codebase;
		return 0;
		}
	document.write('<p>Stand by as your browser prompts you through the automatic installation process. Please note the following:<ol><li>A Java Security dialog box will appear. Click the <b>Grant</b> button.<li>When the installation is complete, click this link to <a href="javascript:window.location.reload()">view the presentation.</a></li></ol></p>');
			
	//try to smartupdate
	if (netscape.softupdate)
		{
		trigger = netscape.softupdate.Trigger;
		document.cookie="MentorPlug=MentorPlugis201"; //avoid install-loop when smartupdating
		trigger.StartSoftwareUpdate(npJARbase, trigger.FORCE_MODE)
		//document.cookie="go_back_twice=1";
		return 0;
		}
	 else
	     {
		//alert("SmartUpdate could not be started; please install manually.");
		window.status="Manual Install";
		self.location.href=np3Codebase;
		return 0;
		}

	}


function NetscapeCheckPlugin()
{
  navigator.plugins.refresh(true);
  found=-1;
  for (i=0; i<navigator.plugins.length-1; i++)
  		if (navigator.plugins[i].name.indexOf("Street Technologies")!=-1)      
			{
			found=i;
      			break;
			}

  if (found==-1 && document.cookie.indexOf("MentorPlugis201")==-1)
	{
		if (confirm("You have not downloaded the 7thStreet Plugin.  Would you like to download it now?"))
			{
			NetscapeLoadPlugin();
			return 0;
			}
  	}
  else {
	szDescrip=navigator.plugins[i].description;
	nVersionBeg=szDescrip.indexOf("Version ");
	if (nVersionBeg==-1)
		curVersion="0300.0000.0.0";
	 else
		curVersion=szDescrip.substring(nVersionBeg+8, szDescrip.length);

    if (curVersion<npVersion && document.cookie.indexOf("MentorPlugis201")==-1 ) {
    	if (confirm("You have an older version of the 7thStreet Plugin. Would you like to download the latest one?"))
    	    {
            document.cookie="MentorPlug=MentorPlugis201"; //avoid install-loop when smartupdating
            NetscapeLoadPlugin();
	   	  return 0;
            }
    }
  }
return 1;
}

function Launch(stream,back_pages)
	{
	
	if (document.cookie.indexOf("go_back_twice=1")!=-1)
		{
		document.cookie="go_back_twice=0"
		back_pages++;
		}
	
	if (arguments.length >=3)
		{
		ieOnExit=arguments[2];
		npOnExit = ieOnExit;
		}
	else
		{
		ieOnExit=allURLbase+'back'+back_pages+'.html';
		npOnExit='javascript:history.go(-'+back_pages+')';
		}
	
	//alert(nponexit);
	
	window.focus();
	UserAgent = navigator.userAgent.toLowerCase() 
	if ((UserAgent.indexOf("mac_") != -1) ||(UserAgent.indexOf("macintosh") != -1))
		{
		absCodebase=allURLbase+'plugmac.html';
		document.writeln('<p>If the instuction does not play, please Install');
		document.writeln('<a href="'+absCodebase+'">the plugin</a></p>');
		NetscapeTag(stream);
		return 1;
		}
	if (navigator.appName=="Netscape")
	 	{
		
		 if (NetscapeCheckPlugin())
		 	{
			NetscapeTag(stream);
			return 1;
			}
		}
	 else
	 	{
		setTimeout('IExplorerTag("'+stream+'")', 500);
		return 1;
		}
}