function setCookie (name,value,expire) 
{
	document.cookie = 
		name + 
		"=" + 
		escape(value) +
		((expire == null) ? "" : ("; EXPIRES=" + expire.toGMTString()))
}

function getCookie (name)
{
	search = name + "=" ;
	if (document.cookie.length > 0)
	{
		offset = document.cookie.indexOf(search) ;
		if (offset != -1)
		{
			offset += search.length ;
			end = document.cookie.indexOf(";", offset) ;
			if (end == -1)
				end = document.cookie.length ;
			return unescape(document.cookie.substring (offset,end))
		}
	}
	return ""
}

datareal = new String("") ;
datanetscape = new String("") ;
datamidi = new String("") ;

dataavreal = new Boolean(false) ;
dataavnetscape = new Boolean(false) ;
dataavmidi = new Boolean(false) ;

agreereal = new Boolean(false) ;
agreenetscape = new Boolean(false) ;
agreemidi = new Boolean(false) ;

function DecodeCookie (Code)
{
	agreemidi = (Code.indexOf("<midi>") != -1) ;
	agreenetscape = (Code.indexOf("<netscape>") != -1) ;
	agreereal = (Code.indexOf("<real>") != -1) ;
}

function DefaultSetUp ()
{
	numPlugins = navigator.plugins.length;
	agreenetscape = false ;
	agreemidi = false ;
	agreereal = false ;
	for (i = 0; i < numPlugins; i++)
	{
  		plugin = navigator.plugins[i];
  		if (plugin.name.substring(0,21)=="Netscape Media Player")
  		{
    			agreenetscape = true ;
  		}
  		if (plugin.name.substring(0,23)=="RealVideo Player plugin")
  		{
			agreereal = true ;
  		}
  		if ((plugin.name.indexOf("midi") != -1) ||
  		    (plugin.name.indexOf("Midi") != -1) ||
  		    (plugin.name.indexOf("MIDI") != -1))
  		{
    			agreemidi = true ;
  		}  		
	}
}

function SetSoundCookie ()
{
	value = ""
	if (agreemidi) value += "<midi>"
	if (agreenetscape) value += "<netscape>"
	if (agreereal) value += "<real>"
	timevar = new Date()
	timevar.setTime(timevar.getTime()+31536000)
	setCookie ("HCHSSoundManager",value,timevar)
}

function SoundInit ()
{

}

function SoundInitNetscape (source) 
{
	datanetscape = source ;
	dataavnetscape = true ;
}

function SoundInitReal (source) 
{
	datareal = source ;
	dataavreal = true ;
}

function SoundInitMidi (source) 
{
	datamidi = source ;
	dataavmidi = true ;
}

function WriteByHand (Upp) 
{
	document.write(Upp ? 'Use ' : ' use') ; 
	document.write(' the<IMG SRC="/Backgrounds/Back_Micro.jpeg" HSPACE=3 VSPACE=0 BORDER=0 HEIGHT=14 WIDTH=14>and<IMG SRC="/Backgrounds/Next_Micro.jpeg" HSPACE=3 VSPACE=0 BORDER=0 HEIGHT=14 WIDTH=14>buttons to look the slideshow!') ;
}

function openconfig () 
{
	window.open('/SlideShowInit.html','SoundManager','TOOLBAR=no,LOCATION=no,DIRECTORYS=no,STATUS=no,MENUBAR=no,WIDTH=600,HEIGHT=600')
}
	
function monitor ()
{
	look = getCookie ("HCHSSoundManager") ;
	if (oldlook != look) 
	{
		oldlook = look ;
		window.location.reload(false) ;
	}
	else
	{
		clrid = setTimeout('monitor()',5000) ;
	}
}
	

function SoundExecute ()
{
	whatis = getCookie ("HCHSSoundManager") ;
	oldlook = whatis ;
	if (whatis == null) 
	{
		if (dataavmidi || dataavnetscape || dataavreal)
		{
			document.write('<A HREF="javascript:window.location.reload(false)"><BLINK>Relaod</BLINK></A> after sound config or') ;
			WriteByHand (false) ;
			openconfig () ;
			clrid = setTimeout('monitor()',5000) ;
		}
		else
		{
			WriteByHand (true) ;		
		}
	}
	else
	{		
		DecodeCookie (whatis) ;
		if (dataavmidi && agreemidi)
		{
			document.write('<EMBED 	NAME=soundtrack SRC="' + datamidi + '" AUTOSTART=TRUE HIDDEN=TRUE>') ;
			document.write('Look and hear using the help of <A HREF="http://pubweb.bnl.gov./people/hoff/" TARGET="HCHS_UMP"><IMG NAME=logomidi, SRC="/Backgrounds/umplogo_Small.gif" HSPACE=5 VSPACE=0 ALT="Download" BORDER=0 HEIGHT=32 WIDTH=100></A>') ;
		}	
		else if (dataavnetscape && agreenetscape) 
		{
			document.write('<EMBED 	NAME=soundtrack SRC="' + datanetscape + '" AUTOSTART=TRUE HIDDEN=FALSE OPTIONS=TRUE VOLUME=TRUE SEEK=TRUE VSPACE=0 BORDER=0 HEIGHT=30 WIDTH=100%>') 	
		}
		else if (dataavreal && agreereal) 
		{
			document.write('<EMBED NAME=soundtrack SRC="' +  datareal + '" AUTOSTART=TRUE CONTROLS=INFOPANNEL NOLABELS=TRUE WIDTH=500 HEIGHT=32>') 
 		}
		else
		{
			if ((dataavmidi || dataavnetscape || dataavreal) &&
				 (agreemidi || agreenetscape || agreereal))				 
			{
				document.write('Sorry, only ') ;
				if (dataavmidi) 
				{
					document.write(' midi') ;
				}
				if (dataavnetscape)
				{
					if (dataavmidi)
					{
						if (dataavreal)
						{
							document.write(',') ;
						}
						else
						{
							document.write(' and') ;
						}
					}
					document.write(' netscape') ;
				}
				if (dataavreal)
				{
					if (dataavmidi || dataavnetscape)
					{
						document.write(' and') ;
					}
					document.write(' realaudio') ;
				}
				document.write(' data present! ') ;
			}
			WriteByHand (true) 
			clrid = setTimeout('monitor()',5000) ;
		}
	}
}

clrid =0 
wizard_status = new String(getCookie ("HCHS21Check")) ;
wizart_host = new String(window.location.hostname) ;

function monitor_wizart ()
{
	wizard_status = getCookie ("HCHS21Check") ;
	clrid = setTimeout('monitor_wizart()',5000) ;
}


function wizard ()
{
	clearTimeout(clrid)
	if (wizard_status != "visited")
	{
  		window.open('http://www.hchs.de/21cp.html','_blank',
	                    'TOOLBAR=no,LOCATION=no,DIRECTORYS=no,STATUS=no,MENUBAR=no,WIDTH=280,HEIGHT=350')
	}
	
}	


exitwz = true ;






