/*
 *  Validates that the video to be uploaded is in one of the appropriate formats.
 *  supportedFormats: The supported formats.
 */
function ValidateVideoUploadForm(supportedFormats)
{



var finaltags="";

for (i = 0; i < document.Form1.QT.length; i++)
	
	if(document.Form1.QT[i].checked ==true){
	//alert(document.Form1.QT[i].value);
	finaltags=finaltags + document.Form1.QT[i].value + ","
	}

	 
 	pushback =document.getElementById("hdnPassbackQueryParameters");
     //alert(pushback.value);
	var error = document.getElementById("lblError");
 
	var EMAIL = document.getElementById("UE");
	var USER = document.getElementById("UN");
	
	 var TITLE= document.getElementById("txtVideoName");
	 var DESC= document.getElementById("txtDescription");
	 var TAGS =document.getElementById("txtTags");
	
	if(USER !=null && USER.value == 0)
	{
		alert('Please enter your name');
		document.Form1.UN.focus();
		return false;
	}	
	
	if(EMAIL !=null && EMAIL.value == 0)
	{
		alert('Please enter your email address');
				document.Form1.UE.focus();
		return false;
	}	 
	
	if(TITLE !=null && TITLE.value == 0)
	{
		alert('Please enter Video name');
				document.Form1.txtVideoName.focus();
		return false;
	}
	
		if(DESC !=null && DESC.value == 0)
	{
		alert('You must enter a description for this video.\nPlease note that descriptions can be no longer\n that 1000 characters.');
				document.Form1.txtDescription.focus();
		return false;
	}
	
	
	
	
	
	var FilePath = document.getElementById("FileUploadedVideo");
	if(FilePath.value == 0)
	{
		alert('Please select a Video to upload');
				document.Form1.FileUploadedVideo.focus();
		return false;
	}
	
	
	if(finaltags=="")	{
		alert('Please select at least one Quick Tag for this video.');
		//document.Form1.QT1.focus();
		return false;
	}
	
	//alert(finaltags);
	
	var Terms = document.getElementById("cbTerms");
	if(!Terms.checked)
	{
		alert('Please indicate your acceptance of the Terms of Use by checking the box');
		document.Form1.cbTerms.focus();
		return false;
	}
	fileExtension = FilePath.value.split(".");
	//alert(supportedFormats.indexOf(fileExtension[fileExtension.length - 1]));
	if(supportedFormats.indexOf(fileExtension[fileExtension.length - 1].toLowerCase()) < 1)
	{
		alert('Design World Online Videos supports the following video formats:\n'+ supportedFormats);
		return false
	}
	
	
	//return false  // remove this to get it to work again
	error.innerHTML = "<h1>Video uploading, Please wait...<img src=http://www.renewableenergywatch.tv/images/rel_interstitial_loading.gif></h1>";

 
		pushback.value ='UE='+ EMAIL.value +'&UN='+ USER.value;
	
 

	 pushback.value ='UE='+ EMAIL.value +'&UN='+ USER.value+'&VT='+escape(TITLE.value)+'&VD='+escape(DESC.value)+'&TAGS='+escape(TAGS.value)+'&QTS='+escape(finaltags);
	
	
	 
	 
	 //alert(EMAIL.value + ' ' + USER.value);
   //alert(pushback.value);
//	  return false
}

 
function IsBrowserIE()
{
	return navigator.appName.indexOf("Microsoft") != -1;
}



