var NS4 = (navigator.appName.indexOf("Netscape")>=0 && parseFloat(navigator.appVersion) >= 4 && parseFloat(navigator.appVersion) < 5)? true : false;
var IE4 = (document.all)? true : false;
var NS6plus = (parseFloat(navigator.appVersion) >= 5 && navigator.appName.indexOf("Netscape")>=0 )? true: false;
var isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;
var IEmac = ((document.all) && (isMac)) ? true : false;
var IE4plus = (document.all) ? true : false;
var IE5 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 5.")!=-1)) ? true : false;
var IE6 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 6.")!=-1)) ? true : false;
var Opera7plus = ((document.all)&&(navigator.userAgent.indexOf("Opera 7")!=-1)) ? true : false;
var FF1 = (navigator.userAgent.indexOf("Firefox\/1")!=-1) ? true : false;
var Opera = (navigator.userAgent.indexOf("Opera")!=-1) ? true : false;
var Mozilla = (NS6plus && (navigator.userAgent.indexOf("Netscape") < 0));
var IsLocal = (location.href.indexOf("file://")>-1)? true : false;
var initPlayer = 0; 
var idI;

var oPres = 
{'SLIDES':[
{'SlideSeq': '1', 'Title': 'Anglo Swiss Resources – ASW: TSXV', 'ClipFile': '1.wmv', 'SlideFile': 'slide_1_1.png', 'TimePoint': 0},
{'SlideSeq': '2', 'Title': 'Introduction', 'ClipFile': '1.wmv', 'SlideFile': 'slide_2_6.png', 'TimePoint': 110000},
{'SlideSeq': '3', 'Title': 'Disclaimer', 'ClipFile': '1.wmv', 'SlideFile': 'slide_3_7.png', 'TimePoint': 157000},
{'SlideSeq': '4', 'Title': 'Overview', 'ClipFile': '1.wmv', 'SlideFile': 'slide_4_8.png', 'TimePoint': 165000},
{'SlideSeq': '5', 'Title': 'Kenville Gold Property, British Columbia', 'ClipFile': '1.wmv', 'SlideFile': 'slide_5_9.png', 'TimePoint': 220000},
{'SlideSeq': '6', 'Title': 'Silver King Sheer', 'ClipFile': '1.wmv', 'SlideFile': 'slide_6_10.png', 'TimePoint': 294000},
{'SlideSeq': '7', 'Title': 'NI 43-101 Resource Report', 'ClipFile': '1.wmv', 'SlideFile': 'slide_7_12.png', 'TimePoint': 518000},
{'SlideSeq': '8', 'Title': 'Kenville Land Package', 'ClipFile': '1.wmv', 'SlideFile': 'slide_8_13.png', 'TimePoint': 591000},
{'SlideSeq': '9', 'Title': 'Kenville Facts', 'ClipFile': '1.wmv', 'SlideFile': 'slide_9_14.png', 'TimePoint': 631000},
{'SlideSeq': '10', 'Title': 'History', 'ClipFile': '1.wmv', 'SlideFile': 'slide_10_15.png', 'TimePoint': 712000},
{'SlideSeq': '11', 'Title': '2007 – 2008 Drill Programs', 'ClipFile': '1.wmv', 'SlideFile': 'slide_11_16.png', 'TimePoint': 746000},
{'SlideSeq': '12', 'Title': 'Planned Exploration 2009 & Beyond', 'ClipFile': '1.wmv', 'SlideFile': 'slide_12_17.png', 'TimePoint': 779000},
{'SlideSeq': '13', 'Title': 'Inside Level 257', 'ClipFile': '1.wmv', 'SlideFile': 'slide_13_19.png', 'TimePoint': 809000},
{'SlideSeq': '14', 'Title': 'Inside Level 257', 'ClipFile': '1.wmv', 'SlideFile': 'slide_14_18.png', 'TimePoint': 817000},
{'SlideSeq': '15', 'Title': 'Inside Level 257', 'ClipFile': '1.wmv', 'SlideFile': 'slide_15_20.png', 'TimePoint': 829000},
{'SlideSeq': '16', 'Title': 'Map of Underground System', 'ClipFile': '1.wmv', 'SlideFile': 'slide_16_21.png', 'TimePoint': 850000},
{'SlideSeq': '17', 'Title': 'Copper River', 'ClipFile': '1.wmv', 'SlideFile': 'slide_17_22.png', 'TimePoint': 858000},
{'SlideSeq': '18', 'Title': 'Share Structure', 'ClipFile': '1.wmv', 'SlideFile': 'slide_18_23.png', 'TimePoint': 876000},
{'SlideSeq': '19', 'Title': 'Summary', 'ClipFile': '1.wmv', 'SlideFile': 'slide_19_24.png', 'TimePoint': 893000},
{'SlideSeq': '20', 'Title': 'Leadership', 'ClipFile': '1.wmv', 'SlideFile': 'slide_20_25.png', 'TimePoint': 925000}
]}
var currSlideSeq=1;
var currDivId = "nt1";

function TabSelected(sel) { 
	tmpC=(parent.tabs.document.getElementById('tabNavigation').children.length -1)
	
	for (var i = 0; i < tmpC; i++) { 
		style2=parent.tabs.document.getElementById('tabNavigation').children[i]		
		if (i==sel) { 
			style2.className="selectedTab"
		} else { 
			style2.className=""	
		}
		
	} 

} 

function ChangeTab() {	
	var argv = ChangeTab.arguments;
	var argc = argv.length;
	for (var i = 0; i < argc; i++) {		
		style1=parent.tabcontent.document.getElementById(argv[i]).style
			
		if (i==0) { 
			style1.display="block"			
		} else { 
			style1.display="none"			
		} 
		if (argv[i]=='outline') { 
			parent.tabs.document.getElementById('tabNavBar').innerHTML="<div id='tabNavBar' style='background: #6D6FF9;border-top: line-height: 20px;text-align:right;padding: 0 0 0 0;color: #FFF;font-weight: bold;'>&nbsp;</div>"
		} else { 
			parent.tabs.document.getElementById('tabNavBar').innerHTML="<div id='tabNavBar' style='background: #6D6FF9;border-top: line-height: 20px;text-align:right;padding: 0 0 0 0;color: #FFF;font-weight: bold;'>Time Point</div>"
		} 
	}	
	return false; 	
}

function GoFullScreen() { 	
	if (parent.frames['player'].document.MediaPlayer.playState == 2 || parent.frames['player'].document.MediaPlayer.playState == 3) {		
		parent.frames['player'].document.MediaPlayer.fullscreen = 'true';	
	} 
} 

function BuildPlayer(asxFile, StartTime) {
	if (StartTime>=500) StartTime = StartTime - 500;

	var sMediaURL=asxFile;  

	var sHTML1	= ''; 
	var sHTML2	= '';
	var sHTML3	= '';
	var sOut	= ''; 
	var sWMP 	= ''; 
	
	sWMP = sWMP + '<OBJECT WIDTH="280" HEIGHT="275" ID="MediaPlayer" NAME="MediaPlayer" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">'
	sWMP = sWMP + '<PARAM VALUE="' + sMediaURL + '" NAME="URL">'
	sWMP = sWMP + '<PARAM VALUE="slidearea" NAME="DefaultFrame">'
	sWMP = sWMP + '<PARAM VALUE="1" NAME="stretchToFit">'
	sWMP = sWMP + '<PARAM VALUE="1" NAME="ShowStatusBar">'
	sWMP = sWMP + '<EMBED SRC="' + sMediaURL + '" WIDTH="280" HEIGHT="275" stretchToFit="1" DEFAULTFRAME="slidearea" AUTOSIZE="0" TYPE="application/x-mplayer2" PLUGINSPAGE="http://www.microsoft.com/windows/windowsmedia/download/AllDownloads.aspx" ID="MediaPlayer" NAME="MediaPlayer" SHOWSTATUSBAR="1">'
	sWMP = sWMP + '</EMBED>'
	sWMP = sWMP + '</OBJECT>'	
	
	if (screen.width <= 800) {
		var w="100%"; 
	} else {
		var w="100%"; 
	}	
					
	sHTML1 = "<link rel='stylesheet' type='text/css' href='default.css'>"  
	sHTML1 += "<body style='background-color:#f4f4f4;' topmargin='0' bottommargin='0' leftmargin='0' rightmargin='0'><div><table border='0' style='border: 1px solid Silver;' align='center' bgcolor='#ffffff' cellpadding='0' width='100%' height='92%'><tr><td align='center'>" 
	sHTML2 += "<div style='text-align:right;position:absolute;left:260;top:290'><a href='#' onClick='javascript:parent.GoFullScreen();return false;'><img src='fullscreen.jpg' border='0' alt='View Video Full-Screen'/></a></div>"
	sHTML2 += "</td></tr></table>"	
	
	sHTML3 += "<SCRIPT LANGUAGE=\"JavaScript\" FOR=\"MediaPlayer\" EVENT=\"ScriptCommand( scType, Param )\">"	
	sHTML3 += "if (scType==\"IP\") { "
	sHTML3 += "parent.frames['slidearea'].document.slide.src = Param;"
	sHTML3 += "parseparam=Param.split('_');" 
	sHTML3 += "nextSlide=parseparam[1];"
	sHTML3 += "parent.SetCurrentSlide(nextSlide);"
	sHTML3 += "}" 
		
	sHTML3 += "if (scType==\"IPEND\") { "
	sHTML3 += "f=Param.split('&');" 
	sHTML3 += "s=f[0].split('=');" 
	sHTML3 += "nextSlide=s[1];"
	sHTML3 += "c=f[1].split('=');"
	sHTML3 += "nextClip=c[1];"
	sHTML3 += "if (nextSlide=='END') { return false; } else { parent.frames['player'].document.MediaPlayer.Controls.fileName = nextClip;parent.SetCurrentSlide(nextSlide);}"
	sHTML3 += "}"
	
	sHTML3 += "if (scType==\"URL\") { " 
	sHTML3 += "return false;"
	sHTML3 += "}"

	sHTML3 += "<\/SCRIPT>"	
	
	sHTML3 += "<SCRIPT LANGUAGE=\"JavaScript\" FOR=\"MediaPlayer\" EVENT=\"Buffering(Start)\">"	
	sHTML3 += "/*if (true == Start){ "
	sHTML3 += "parent.idI = window.setInterval(\"parent.UpdateDP()\", 1000);parent.tabcontent.document.getElementById('outline').style.display='none';parent.thumbs.document.getElementById('thumbs').style.display='none';"
	sHTML3 += "}"
	sHTML3 += "else{"
	sHTML3 += "window.clearInterval(parent.idI);"
	sHTML3 += "}*/"
	sHTML3 += "<\/SCRIPT>"		
	
	if (initPlayer==0 || FF1==true) { 
		window.frames['player'].document.open("text/html");
		sOut=sHTML1 + sWMP + sHTML2 + sHTML3; 
		window.frames['player'].document.write(sOut);
		window.frames['player'].document.close();	
		initPlayer=1;
	
	} else {  
		StartTime=Math.round(StartTime/1000);
		parent.frames['player'].document.MediaPlayer.Controls.CurrentPosition=StartTime;
		parent.frames['player'].document.MediaPlayer.Controls.Play();	
	}
	
	return false;
}

function UpdateDP(){ 
	x  = parent.tabcontent.document.getElementById("loading");
	if (parent.frames['player'].document.MediaPlayer.Network.downloadProgress==100) { 
		parent.ChangeTab('outline','keywords','search');
		parent.TabSelected(0);	
		parent.tabcontent.document.getElementById('loading').style.display="none";
		parent.thumbs.document.getElementById('thumbs').style.display="block";
		x.innerHTML="Donwload Complete." 
	} else { 
		//x.innerHTML = "<img src='loading.gif' />Download progress: " + parent.frames['player'].document.MediaPlayer.Network.downloadProgress + " percent complete";
		x.innerHTML = "Downloading media...  Progress: " + parent.frames['player'].document.MediaPlayer.Network.downloadProgress + " % complete";
	} 
}

var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos) {
	if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
	else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=yes,toolbar=no,resizable=yes';
	win=window.open(mypage,myname,settings);
}

function SetCurrentSlide(sSeq){
	for (i=0;i<parent.oPres.SLIDES.length;i++) { 
		elem = parent.tabcontent.document.getElementById('row_' + parent.oPres.SLIDES[i].SlideSeq);
		elem1 = parent.thumbs.document.getElementById('trow_' + parent.oPres.SLIDES[i].SlideSeq);
		elem2 = parent.thumbs.document.getElementById('trow_' + parent.oPres.SLIDES[i].SlideSeq + 'a');
		elem3 = parent.thumbs.document.getElementById('trow_' + parent.oPres.SLIDES[i].SlideSeq + 'b');
		if (sSeq == parent.oPres.SLIDES[i].SlideSeq) { 			
			elem.className = 'current';
			elem1.className = 'current';
			elem2.className = 'current';
			elem3.className = 'current';			
			currSlideSeq=sSeq; 
		}  else { 
			elem.className = '';
			elem1.className = '';
			elem2.className = '';
			elem3.className = '';
		} 

	} 	
	parent.togDiv('nt' + currSlideSeq);
	
}
function togDiv(id) {
	if(currDivId) setDisplay(currDivId, "none");
	if(id) setDisplay(id, "block");
	currDivId = id;
}

function setDisplay(id,value) {
	var el = parent.tabcontent.document.getElementById(id);
	el.style.display = value;
}