/****************************************************************************************/
/*																						*/
/*	Accordent Link Menu v2.00															*/
/*	=========================															*/
/*																						*/
/*	Last Edited: 4/4/2007																*/
/*	Please send all comments & bug reports to: support@accordent.com					*/
/*																						*/
/****************************************************************************************/

var openThumbPage = false;
var isPRO = true;
var DEBUG = false;

function openThumbWindow() {
	if (openThumbPage.window){
		openThumbPage.focus();
	} else {
		openThumbPage=window.open('thumbs.htm','thumbpage','scrollbars=yes,resizable=yes,width=900,height=190');
		openThumbPage.focus();
	}
}

function exit(){
	top.window.close();
}

function closeThumbWindow() {
	if (openThumbPage.window){
		openThumbPage.window.close();
	}
}

function isPlayerReal(){
	try{
		var realvid = false;
		var vidLayerContent = new String(top.video.document.getElementById("videoLayer").innerHTML);
		var realMediaObject = /(videorn)/i;
		if(realMediaObject.test(vidLayerContent))
			realvid = true
			return realvid;
	} catch(e) {}
}

function isBrowserFF() {
	var ff = false;
	var ua = navigator.userAgent.toLowerCase();
	if (ua.indexOf('firefox') > -1)
		ff = true;
	return ff;
}

function hasP25() {
	var P25 = false;
	var plugin = navigator.mimeTypes && navigator.mimeTypes["application/x-ms-wmp"];
	var FFcheck = navigator.userAgent.indexOf("Firefox");
	if (plugin && FFcheck != -1)
		P25 = true;
	return P25;
}

function isBrowserIeWin() {
	var iewin = false;
	var ua = navigator.userAgent.toLowerCase();
	if ((ua.indexOf('ie') > -1) & (ua.indexOf('win') > -1))
		iewin = true;
	return iewin;
}

function isBrowserIe() {
	var ie = false;
	var ua = navigator.userAgent.toLowerCase();
	if (ua.indexOf('ie') > -1)
		ie = true;
	return ie;
}

function isWin() {
	var win = false;
	var ua = navigator.userAgent.toLowerCase();
	if (ua.indexOf('win') > -1)
		win = true;
	//if(win){alert('is win');}else{alert('is NOT win');}
	return win;
}

function metaCheck() {
	var titleMeta   = pres_heading;
	var speakerMeta = pres_speaker;
	var dateMeta    = pres_date;
	var descMeta    = pres_description;
	
	if (titleMeta == '')
		document.getElementById('r2Title').style.display = 'none';
	if (speakerMeta == '')
		document.getElementById('r2Speaker').style.display = 'none';
	if (dateMeta == '')
		document.getElementById('r2Date').style.display = 'none';
	if (descMeta == '')
		document.getElementById('r2Description').style.display = 'none';
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function Lvl_openWin(u,n,w,h,l,t,c,f) {
  var x=((screen.width-w)/2);if(c==1){l=x;t=(screen.height-h)/2;}if(c==2){l=x}
	f+=',top='+t+',left='+l;LvlWin=window.open(u,n,f);LvlWin.focus();
}

function RefreshPage() {
	try {
			document.location.reload();
	} catch(e) {}
}

function RefreshTimer() {
	try {
			var timersec = pres_prepub_refresh;
			var chkNoTag = timersec.indexOf("<@");
			if (timersec != '' & chkNoTag < 0) {
				var timerms = timersec * 1000;
				if (timerms > 0) {
					setTimeout("RefreshPage()", timerms);
				}
			}
	} catch(e) {}
}

function vidFull(){
	try{
		if (top.window.video) {
			top.window.video.full_screen();
		}
	} catch(e) {
		alert("error");
		var err = e;
	}
}

function callPopUp() { 
  if (window.top.video)	window.top.video.openThumbWindow();
}	

function lg_slide() {
	Lvl_openWin('lg_slide_m.htm','_lgslide','1024','768','0','0','1','resizable=yes,width=1024,height=768');
	return document.MM_returnValue;
}
function Lvl_openWin(u,n,w,h,l,t,c,f) {
  var x=((screen.width-w)/2);if(c==1){l=x;t=(screen.height-h)/2;}if(c==2){l=x}
	f+=',top='+t+',left='+l;lgwin=window.open(u,n,f);lgwin.focus();
}

var CurrentSlideNumber = "r1";

function _largeslideCall() { 
	try{
		if(Slide.curslideimg && Slide.curslideimg != ''){
			lg_slide();
		}
	} catch(e) {
		alert("This feature is not ready, please try again in a few seconds");
	}
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function launchCheck() {
	var onDemand = pres_ondemand;
	var chaptersEnabled = 'visible';     //  < @chaptersEnabled@ >
	var thumbnailsEnabled = 'visible';   //  < @thumbnailsEnabled@ >
	var largeSlidesEnabled = 'visible';  //  < @largeSlidesEnabled@ >
	var WinSafari = navigator.userAgent.indexOf("Safari");
	var customBG = pres_background_img;
	var chkNoCustomBGTag = customBG.indexOf("<@");
	var customlogo = pres_logo_img;
	var chkNoCustomLogo = customlogo.indexOf("<@");
	
	try{
		var showThumbs = true;
		var showZoomSlide = true;
		
		if ((!isBrowserIe() && !isPlayerReal() && !hasP25()) || chaptersEnabled == 'hidden' || onDemand == 'hidden' || thumbnailsEnabled == 'hidden' || !isWin() || WinSafari > -1)
		// On Demand and Thumbnails features check
			var showThumbs = false;
		if (largeSlidesEnabled != 'visible' || !isBrowserIeWin())
		// hide zoom slide from non-windows os and non-ie browsers
			var showZoomSlide = false;
			
		if (!showThumbs)
			document.getElementById('thumbs').style.display = 'none';
		if (!showZoomSlide)
			document.getElementById('zoomSlide').style.display = 'none';
		if (!showThumbs && !showZoomSlide)
			document.getElementById('slideGroup').style.display = 'none';
		
		if (!isBrowserIeWin()) {
			if(!hasP25()) document.getElementById('zoomVid').style.display = 'none';
		}
		
		if (customlogo != '' & chkNoCustomLogo < 1) {
			document.getElementById('logoImage').src = customlogo;
		}
		else {
			document.getElementById('logoImage').src = 'logo.gif';
		}
		if (top.window.name != 'presMode') {
			document.getElementById('closeLayer').style.display = 'none';
			document.getElementById('bgOuter').style.border = 'none';
		}
		
		if(chkNoCustomBGTag > -1)
			return;
		else if(customBG != '')
			document.getElementById("bgOuter").style.backgroundImage = "url("+pres_background_img+")";
		
		// find and load the latest slide from an ongoing live presentation
		envDOMPathToSlide   = 'top.region1.slideimage';
		envDOMPathToLgSlide = '_lgslide.lg';
		envParamSlideSource = 'src';
		getLatestSlide();

	} catch(e) {}
}

