/*
 * wl.js - GridNetworks Javascript library supporting "white
 * label" download and Gridcast Connector installation.  
 *
 *	The purpose of this library is to construct and manage the hidden
 *    DHTML "dialog" box that presents a customer-brandable download
 *    experience for the GridCast Connector installer.  It relies on an 
 *    open-source (BSD license) Javascript library developed
 *    by Yahoo called "popup.js."  The latter library requires NO
 *    customization and is fairly complex.  It should be modified only 
 *    by those with extensive Javascript knowledge and experience.  
 *
 *	This library is designed to be customized to your needs, however.
 *    For example, if you customize and change the size or aspect ratio
 *    of the download "dialog box", you would need to reflect those
 *    changes in the init() function, which defines the 
 *	height and width of the hidden modal dialog box.  
 * 
 *
 *	This file should be included in the <head> section of any page
 *    which defines a <div> for the "downloadmodal" dialog box, 
 *    and this include needs to happen after the "popup.js" and 
 *    is included in the <head> section.
 *
 *    On pages which then proceed to *play* media after facilitating
 *    the white-label download, customers should then include 
 *    media-play-wmv.js, which provides a variety of functions to 
 *    actually play embedded and standalone versions of Windows Media,
 *    with checks for installation of the GridCast Connector.  
 *
 *
 */

/* Creates the download overlay panel onDOMReady
 * This is dependent upon the Yahoo BSD-licensed popup.js which 
 * accompanies this package
 */
function init() {
	//init panel

	downloadPanel = new YAHOO.widget.Panel("downloadmodal",  
		{ 
		  fixedcenter:true, 
		  close:true, 
		  draggable:false, 
		  zindex:4,
		  modal:true,
		  visible:false,
		  underlay:"none",
		  height:"330px",
		  width:"500px"		  
		} 
	);
	//render it over the body
	downloadPanel.render(document.body);

}

YAHOO.util.Event.onDOMReady(init);


/*********
 * Install Utility functions
 */


/*  Function for returning a query string variable by name; this is 
 *  useful in tying together verification of Connector installation and 
 *  then sending the viewer back to a content page to view the original 
 *  media asset they requested.
 */
function getQueryVariable(variable) 
{ 
	var query = window.location.search.substring(1); 
	var vars = query.split("&"); 
	for (var i=0;i<vars.length;i++) 
	{ 
	  var pair = vars[i].split("=");
	  if (pair[0] == variable) 
		{ 
			return decodeURIComponent(pair[1]);
		}
	}
	return null;
}

/*
 * Function which toggles the "white label" downloadmodal dialog box
 * between two sets of content -- the GridNetworks Terms and 
 * Conditions, or the customer's normal download content.  
 *
 */

function toggleTou() {
	var tou = document.getElementById('tou');
	var dl = document.getElementById('dl-content');
	if (tou.style.display == 'none') {
		tou.style.display = '';
		dl.style.display = 'none';
	} else {
		tou.style.display = 'none';
		dl.style.display = '';
	}
}




