/*
Static Media Utilities - Check Query String function (Play page)
Checks query string for appropriate parameters and values (values passed as arguments from parent page)

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

REVISION HISTORY

12-18-01 Added parameters for 500k media
12-27-01 Removed quicktime2 type from switch

*/

function checkQuery(redirect) {
	var query = location.search;
	
	//Get the video ID from the query string
	var vidId = query.substring(query.lastIndexOf("id=")+3, query.indexOf("&"));

	//Get the type from the query string
	var type = query.substring(query.indexOf("&type=")+6, query.indexOf("&speed"));

	//Get the speed from the query string
	var speed = query.substring(query.indexOf("speed=")+6, query.length);
	
	//get the arguments
	var queryArgs = checkQuery.arguments;
	
	var queryLength = queryArgs.length;
	
	//if query string is empty redirect to sneak page
	if (query == "") {
		location.replace(redirect);
	}
	
	//verify that the query string has the correct parameters
	if (query.indexOf("id") != -1 && query.indexOf("type") != -1 && query.indexOf("speed") != -1) {
		//do nothing
	} else {
		location.replace(redirect);
	}
	
	//verify that the query is valid if not send them to sneak
	for (i = 1; i < queryArgs.length; i++) {
		if(vidId != queryArgs[i]) {
			queryLength--
		}
	}
	if (queryLength == 1) {
		location.replace(redirect)
	}
	switch(type) {
		case "real": 
			break;
		case "windows":
			break;
		case "quicktime":
			break;
		default:
			location.replace(redirect);
	}
	
	switch(speed) {
		case "56000": 
			break;
		case "100000":
			break;
		case "300000":
			break;
		case "500000":
			break;
		default:
			location.replace(redirect);
	}
}