/*
Static Media Utilities - Check Query String function (Settings 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

*/

function checkQuery(redirect) {
	//get the arguments
	var queryArgs = checkQuery.arguments;

	var query = location.search;
	
	var tempInt = queryArgs.length;
	
	//if query string is empty redirect to start page
	if (query == "") {
		location.replace(redirect);
	}
	
	//Get the video ID from the query string
	if (query.indexOf("&") != -1) {
		var end = query.indexOf("&");
	} else {
		var end = query.length;
	}
	var vidId = query.substring(query.indexOf("=")+1, end);
	
	//verify that the query is valid if not send them to sneak
	for (i = 1; i < queryArgs.length; i++) {
		if(vidId != queryArgs[i]) {
			tempInt--
		}
	}
	//If none of the arguments passed to the function match the vidId redirect user back to start page
	if (tempInt == 1) {
		location.replace(redirect)
	}
}
