﻿// JScript File
var presentationSessionFormatID;
var isLoaded = false;
var qryEventKey = "ip_ek";
var addOnQuerystring = "";
var qryPresentationSessionRecordingID = "c_psrid";



//function pres(EventKey)
//{
//	window.open("session_purchase.asp?" + qryEventKey + "=" + EventKey, "presentation_control", "width=780,height=560,scrollbars=yes,resizable=no,status=no");
//}

//-----------------------------------------------------------------------//
// Get size of the screen, returns an Object with the following properties:
// x
// y
// width
// height
// innerHeight
// innerWidth
//-----------------------------------------------------------------------//

function getScreenSize()
{
	var oScreen = new Object();
	
	switch(screen.width)
	{
		case 800:
			oScreen.width = 720;
			oScreen.height = 540;
			oScreen.x = 40;
			oScreen.y = 0;
			break;
		case 1024:
			oScreen.width = 944;
			oScreen.height = 708;
			oScreen.x = 40;
			oScreen.y = 0;
			break;
		case 1280:
			oScreen.width = 1269;
			oScreen.height = 964;
			oScreen.x = 0;
			oScreen.y = 0;
			break;
		default:		
			oScreen.height = screen.height - 60;
			oScreen.width = oScreen.height * 1.33;			
			oScreen.x = 0;
			oScreen.y = 0;
			break;
	}
	
	oScreen.innerWidth = 0;
	oScreen.innerHeight = 0;
	    
	  if( typeof( window.innerWidth ) == 'number' ) {
	    //Non-IE
	    oScreen.innerWidth = window.innerWidth;
	    oScreen.innerHeight = window.innerHeight;
	  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	    //IE 6+ in 'standards compliant mode'
	    oScreen.innerWidth = document.documentElement.clientWidth;
	    oScreen.innerHeight = document.documentElement.clientHeight;
	  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	    //IE 4 compatible
	    oScreen.innerWidth = document.body.clientWidth;
	    oScreen.innerHeight = document.body.clientHeight;
	  }
	
	
	return oScreen;
}

//-----------------------------------------------------------------------//
// Open a Presentation window, redirects to login.asp
//-----------------------------------------------------------------------//

function openPresWindow(EventKey)
{	
	var lScreen;
	lScreen = getScreenSize();

	window.open("http://" + serverWeb + pathControl  + "login.asp?" + qryEventKey + "=" + EventKey, "presenterwindow", "width=" + lScreen.width + ",height=" + lScreen.height + ",top=" + lScreen.y + ",left=" + lScreen.x + ",titlebar=no,scrollbars=auto,resizable=yes,status=yes");
}

//only used by launch.asp
//function openViewerWindow(EventKey)
//{
//	var lScreen;
//	lScreen = getScreenSize();
//	appWin = window.open(getViewerURL(EventKey), "viewerwindow", "width=" + lScreen.width + ",height=" + lScreen.height + ",top=" + lScreen.y + ",left=" + lScreen.x + ",titlebar=no,scrollbars=auto,resizable=yes,status=no");
//}

//only called by openViewerWindow(...) function above
//set up addOnQueryString
//function getViewerURL(EventKey)
//{
//	<%
//	if request.querystring("ScreenName") <> "" and request.querystring("Email") <> "" then
//		addOnQuerystring = "&ScreenName=" & request.querystring("ScreenName") & "&Email=" & request.querystring("Email")
//	end if
//	
//	if request.querystring("UserEventPassword") <> "" then
//		addOnQuerystring = addOnQuerystring & "&UserEventPassword=" & request.querystring("UserEventPassword")
//	end if
//	%>
//	
//	var viewerURL = "http://" + serverApp + pathAudience + "login.asp?" + qryEventKey + "=" + EventKey + "&time=" + Math.random() * 100000 + "<% =addOnQuerystring %>";	
//	return viewerURL;
//}




//-----------------------------------------------------------------------//
// Open and login to a demo presentation
//-----------------------------------------------------------------------//

function openDemoWindow(EventKey, ScreenName, Email)
{
	var lScreen;
	lScreen = getScreenSize();
	
	window.open("http://" + serverWeb + pathAudience +  "login.asp?" + qryEventKey + "=" + EventKey + "&ScreenName=" + ScreenName + "&Email=" + Email + "&time=" + Math.random() * 100000 + addOnQuerystring , "viewerwindow", "width=" + lScreen.width + ",height=" + lScreen.height + ",top=" + lScreen.y + ",left=" + lScreen.x + ",titlebar=no,scrollbars=auto,resizable=yes,status=no");
}

//-----------------------------------------------------------------------//
// Plays a Recording, given a RecordingID
//-----------------------------------------------------------------------//

function playRecording(recID)
{
	var lScreen;
	lScreen = getScreenSize();

	window.open("http://" + serverWeb + pathRecording + "default.asp?" + qryPresentationSessionRecordingID + "=" + recID, "recordingwindow", "width=" + lScreen.width + ",height=" + lScreen.height + ",top=" + lScreen.y + ",left=" + lScreen.x + ",titlebar=no,scrollbars=auto,resizable=yes,status=no");
}

//function InstallPlugin()
//{
//	MM_openBrWindow("http://wip.webdialogs.com/browser/plugin.asp?brand=InstantPresenter&locale=","_install", "width=760,height=400");
//}

//function InstallPlugin_new()
//{
//	MM_openBrWindow("http://" + serverWeb + "/component_download.asp?start=true","_install", "width=760,height=450,status=1");
//}

//function OpenVideoPluginWindow()
//{
//	MM_openBrWindow("http://" + serverWeb + "/AccountManager/Other/VideoComponentDownload.aspx?start=true","_install", "width=760,height=450,status=1");
//}

//function openContentUpload(encEventID)
//{
//	var contentURL = "http://" + serverWeb  + pathControl + "/presentation_upload.asp?" + qryEventID + "=" + encEventID;
//	
//	if (window.showModalDialog) // ie
//	{
//		window.showModalDialog(contentURL, self, "width=400,height=200,status=1,toolbars=0");
//	}
//	else
//	{
//		MM_openBrWindow(contentURL, "_upload", "modal,width=400,height=200,status=1");
//	}
//}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_preloadImages() { //v3.0
  var d=document; 
  if(d.images)
  { 
  	if(!d.MM_p) d.MM_p=new Array();
    	var i,j=d.MM_p.length, a=MM_preloadImages.arguments; 
    	for(i=0; i < a.length; i++){
    		if (a[i].indexOf("#")!=0)
    		{ 
    			d.MM_p[j]=new Image; 
    			d.MM_p[j++].src=a[i];
    		}
    	}
  }
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; 
  for(i=0; a && i < a.length && (x=a[i]) && x.oSrc;i++)
  {
  	x.src=x.oSrc;
  }
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  
  if(!d) d=document; 
  if((p=n.indexOf("?"))>0 && parent.frames.length) 
  {
    d=parent.frames[n.substring(p+1)].document; 
    n=n.substring(0,p);
  }
  if(!(x=d[n]) && d.all) x=d.all[n]; 
  for(i=0;!x && i < d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x && d.layers && i < d.layers.length; i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function doRequired(obj)
{
    if (obj.value == "Required Field")
    {
        obj.value = "";
        obj.style.color = "black";
    }
}