// JavaScript Document
function validateForm(){
	CheckFormInput();	

	if( $("input[name='filename_required']").length && $("#filename").val().length == 0)
	{
		if ( $("#textSubmission").length ) 
			errors += required($("#textSubmission"));
		else
		{
			errors += required($("#filename"));
			$("#filename").parent().css("background-color","#E48028")
		}
	}
	
	if( $("input[name='pubName_required']").length )
	{
		if ( $("#pubName option:selected").length == 0 )
		{
			$("#pubName").css("background-color","#E48028");
			$("#pubName").css("color","#FFFFFF");
			errors = errors + 'Error.';
		}
		else
		{
			$("#pubName").css("background-color","");
			$("#pubName").css("color","#000000");
			errors = errors + '';
		}
	}

	if ( errors ){
		alert(msg + "Please fill out all the required fields. \n\n The required fields will be highlighted for you.");
		window.location='#top';
		return false;
	}
	else{
		$("input[name='filename_required']").remove();
		return true;
	}
}

function validateADForm(){
	CheckFormInput();	
	msg = '';
	errors += required($("#pubIssue1"));
	errors += required($("#adSize1"));
	errors += required($("#adRate1"));
	errors += required($("#adProcess1"));

	// is the Ad Rate a number?
	//var testVar = parseInt($("adRate1")).toString();
	var testVar2 = parseInt($("adRate1"));
	//alert(typeof testVar + " = testVar Int, " + typeof testVar2 + " = testVar2, " + testVar + " " + (testVar2 < 0) + " " + (testVar == "NaN"));
	if (testVar2 < 0){
		//alert(testVar);
		submitform.adRate1.value = '';
		errors += required($("#adRate1"));
		msg="Please enter a number for the ad rate.\n";
	}

	if ( errors ){
		alert(msg + "Please fill out all the required fields. \n\n The required fields will be highlighted for you.");
		window.location='#top';
		return false;
	}
	else{
		return true;
	}
}

