/**
This page was created by Örjan Wallén in May 2004. wallen@wallenmedia.se
**/

function resizeOuterTo(w,h)
 { if (parseInt(navigator.appVersion)>3)
  { if (navigator.appName=="Netscape")
   {
    top.outerWidth=w;
    top.outerHeight=h;
   }
   else top.resizeTo(w,h);
  }
 }

 

function changeSource (nameIs) { 
	if ((navigator.userAgent.indexOf("IE") > -1) && (navigator.platform == "Win32")) {
		document.MediaPlayer1.autoStart = true; 
		document.MediaPlayer1.Filename = 'asx/' + nameIs + '.asx'; 
	} else {
		document.MediaPlayer1.SetAutoStart(true);
		document.MediaPlayer1.SetFileName('asx/' + nameIs + '.asx');
	}
}
/**
function seekToMarker(iWhichMarker){
    if ((navigator.userAgent.indexOf("IE") > -1) && (navigator.platform == "Win32")) {
	// This is an error handler.  If the user tries to scan to a marker which doesn't
	//     exist, the player will pop an error message.  By using this code, we
	//     can create a custom error message.
	if (iWhichMarker <= document.MediaPlayer1.MarkerCount) {
		// This resets the current marker in the file.
		document.MediaPlayer1.CurrentMarker = iWhichMarker;
	} else {  
		alert("This Marker doesn't exist.");
	}
    } else {
	if (iWhichMarker <= document.MediaPlayer1.GetMarkerCount()) {
		document.MediaPlayer1.SetCurrentMarker(iWhichMarker);
	} else {
		alert("This Marker doesn't exist.");
	}

    }
}**/

function initMarkers(){
	var oPlayer = document.getElementById("MediaPlayer1");	
		var theMedia = oPlayer.currentMedia ;	
		oSelect = document.getElementById('select');	
		oOption = document.createElement('option');
		oSelect.appendChild(oOption);
		oOption.text = "SELECT A CHAPTER";
		oOption.value = 0;				
		for(i=1; i<= theMedia.MarkerCount; i++){
				oOption = document.createElement('option');
				oSelect.appendChild(oOption);
				oOption.text = theMedia.getMarkerName(i);
				oOption.value = i;				
		}
}

function testMarkerAvailable(status){
// Called by OpenStateChange
	if (!markers_available){
		var oPlayer = document.getElementById("MediaPlayer1");	
		var theControls = oPlayer.controls;
		var theMedia = oPlayer.currentMedia;
		if(oPlayer.currentMedia != null && theMedia.markerCount != 0){			
			activateNavigation();
			markers_available = true;
		}
	}
}

function gotoMarker(ix){
	if(ix != 0){
		var oPlayer = document.getElementById("MediaPlayer1");
		oPlayer.controls.currentMarker = ix;
		oPlayer.controls.play();
	}
}

function setChapter(ix){
	var oPlayer = document.getElementById("MediaPlayer1");
	theMarker = oPlayer.controls.currentMarker;
	oSelect = document.getElementById('select');	
	oSelect.selectedIndex = ix;
}

function seekToMarker(marker){
	if(navigator.appName == "Netscape"){
		if (document.MediaPlayer1.GetMarkerCount() < marker){return;}
		document.MediaPlayer1.SetCurrentMarker(marker);
		
	}
	else {
		if (document.MediaPlayer1.MarkerCount < marker){return;}
		document.MediaPlayer1.CurrentMarker = marker;
		document.MediaPlayer1.Play();
	}
}
var crossFadeDuration = 1.0;
var Picture = new Array(antalSlides);
for(i=0; i < antalSlides + 1; i++){
	Picture[i] = new Image();
	Picture[i].src = "pp/s" + i + ".jpg";	
}

var showHot = false;
var iss;
var jss = i;
var pss = antalSlides;

// function control(how){
// if (showHot){
// if (how=="H") jss = 1;
// if (how=="E") jss = pss;
// if (how=="B") jss = jss - 1;
// if (how=="F") jss++;
// if (jss > pss) jss = 1;
// if (jss < 1) jss = pss;
// if (document.all){
// document.images.BildSpel.style.filter="blendTrans";
// document.images.BildSpel.filters.blendTrans.Duration = crossFadeDuration;
// document.images.BildSpel.filters.blendTrans.Apply();}
// document.images.BildSpel.src = Picture[jss].src;
// if (document.getElementById) document.getElementById("captionBox").innerHTML= "Bild " + jss + " av " + antalSlides;
// if (document.all) document.images.BildSpel.filters.blendTrans.Play();
// }}

rom_startA=new Image();
rom_startA.src="sb/start.gif";
rom_startB=new Image();
rom_startB.src="sb/starth.gif";
rom_startC=new Image();
rom_startC.src="sb/startp.gif";

function OnDSScriptCommandEvt (bstrType, bstrParam){
	if (bstrType.toLowerCase() == "text") {
		var sCommand;
		sCommand = "document.contentNav.document.writeln(\"<SPAN ID=content>"
		sCommand = sCommand + bstrParam;
		sCommand = sCommand + "\");document.contentNav.document.close(); ";
		timerID = setTimeout(sCommand,0);
	} else if (bstrType.toLowerCase() == "swapimage") {
		timerID = setTimeout("document.dynImage.src = imgArr[" + bstrParam + "].src",0);
	}
}

function loader(){
	if ((navigator.userAgent.indexOf('IE') > -1) && (navigator.platform == "Win32")) {
		bControl = true;
	} else {
		var plugIn = document.MediaPlayer1;
		bControl = false;
		document.appObs.setByProxyDSScriptCommandObserver(plugIn,true);	
	}

}
 if ( navigator.appName == "Netscape" ) 
    {navigator.plugins.refresh();
     document.write("\x3C" + "applet MAYSCRIPT Code=NPDS.npDSEvtObsProxy.class" )
     document.writeln(" width=1 height=1 name=appObs\x3E \x3C/applet\x3E")
}

