/*
Static Media Utilities - Create Media Selections function
Creates media selections based on arguments passed from parent page

*******************************************************************************
Please do not edit or copy, if you have questions contact David Pedowitz
*******************************************************************************

REVISION HISTORY

*/

var d = document;

function createSelections() {
//Initialize your variables you use later
	var selectionContent = "";
	var lyrId;
	var playPath;
	var classTitle;
	var aClass;
	var tempInt;
	
	//Get the arguments passed to the function
	var args = createSelections.arguments;
	
	//If the first argment is a path to an html or jsp file then the selection Content is not writen in a layer
	if (args[0].indexOf(".html") != -1 || args[0].indexOf(".jsp") != -1) {
		tempInt = 3;
		lyrId = null;
		playPath = args[0];
		classTitle = args[1];
		aClass = args[2];
	} else {
		tempInt = 4;
		lyrId = args[0];
		playPath = args[1];
		classTitle = args[2];
		aClass = args[3];
	}
	
	//Get the base of the href based on parameters passed to the script
	var query = location.search;
	
	if (query.indexOf("settings") != -1) {
		query = query.substring(0, query.indexOf("&"));
	}

	var base = playPath + query;

	//Loop through the arguments and dynamically create selections
	for(i=tempInt; i<args.length; i++) {					
		var title = (args[i].toLowerCase() == "real")?"Real Player":args[i].toLowerCase() == "windows"?"Windows Media Player":"QuickTime";									
		selectionContent += "<span class=\"" + classTitle + "\"><b>" + title + "</b></span><br>\n";
		selectionContent += "<a href=\"" + base + "&type=" + args[i] + "&speed=56000\" class=\"" + aClass + "\" onClick=\"setWBOLMediaCookie('" + args[i] + "', '56000')\">56k Modem (slow)</a><br>\n";
		selectionContent += "<a href=\"" + base + "&type=" + args[i] + "&speed=100000\" class=\"" + aClass + "\" onClick=\"setWBOLMediaCookie('" + args[i] + "', '100000')\">100k DSL (medium)</a><br>\n";
		selectionContent += "<a href=\"" + base + "&type=" + args[i] + "&speed=300000\" class=\"" + aClass + "\" onClick=\"setWBOLMediaCookie('" + args[i] + "', '300000')\">300k Cable Modem or faster (fast)</a><p>\n";
	}
	if (d.layers && lyrId != null) {
		d[lyrId].document.write(selectionContent)
	} else {
		d.write(selectionContent);
	}
}