var missingfields = '';

function validatePortfolioAnalysis(){
	var ok = 1;
	if(document.getElementById('name')){
		if(document.getElementById('name').value == ''){
			missingfields += "<div style='margin-bottom:5px;margin-left:15px;'>Please enter your name</div>\n";
		}
	}
	if(document.getElementById('title')){
		if(document.getElementById('title').value == ''){
			missingfields += "<div style='margin-bottom:5px;margin-left:15px;'>Please enter your title</div>\n";
		}
	}
	
	if(document.getElementById('company')){
		if(document.getElementById('company').value == ''){
			missingfields += "<div style='margin-bottom:5px;margin-left:15px;'>Please enter your company</div>\n";
		}
	}
	if(document.getElementById('email')){
		if(document.getElementById('email').value == ''){
			missingfields += "<div style='margin-bottom:5px;margin-left:15px;'>Please enter valid email address</div>\n";
		}
	}
	if(document.getElementById('city')){
		if(document.getElementById('city').value == ''){
			missingfields += "<div style='margin-bottom:5px;margin-left:15px;'>Please enter your city</div>\n";
		}
	}
	
	if(document.getElementById('state')){
		if(document.getElementById('state').options[document.getElementById('state').selectedIndex].value == ''){
			missingfields += "<div style='margin-bottom:5px;margin-left:15px;'>Please enter </div>\n";
		}
	}
	if(document.getElementById('zip')){
		if(document.getElementById('zip').value == ''){
			missingfields += "<div style='margin-bottom:5px;margin-left:15px;'>Please enter your zipcode</div>\n";
		}
	}
	if(document.getElementById('phone')){
		if(document.getElementById('phone').value == ''){
			missingfields += "<div style='margin-bottom:5px;margin-left:15px;'>Please enter your phone number</div>\n";
		}
	}
	if(document.getElementById('number_of_assets')){
		if(document.getElementById('number_of_assets').value == ''){
			missingfields += "<div style='margin-bottom:5px;margin-left:15px;'>Please enter the approximate # of assets</div>\n";
		}
	}
	if(document.getElementById('age_range')){
		if(document.getElementById('age_range').value == ''){
			missingfields += "<div style='margin-bottom:5px;margin-left:15px;'>Please enter age range of IT equipment</div>\n";
		}
	}
	
	//return true;
	
	if(missingfields && missingfields != ''){
		missingfields = "<h4>Please complete all fields</h4>" + missingfields;
		displayMissingFields();
		missingfields = "";
		return false;
	} else {
		//submitportform();
		return true;
	}
}

function displayMissingFields(){
	var ok = 0;
	if( !missingfields || missingfields == '' ){
		return 0;
	}
	jQuery.prompt(missingfields,{
		prefix:'ahqa',
      	buttons:{},

	});
	missingfields = '';
	return 0
}

function submitportform(){
	document.portform.submit();
	return false;
}


function validateCaseStudy(){
	var ok = 1;
	if(document.getElementById('name')){
		if(document.getElementById('name').value == ''){
			missingfields += "<div style='margin-bottom:5px;margin-left:15px;'>Please enter your name</div>\n";
		}
	}
	if(document.getElementById('title')){
		if(document.getElementById('title').value == ''){
			missingfields += "<div style='margin-bottom:5px;margin-left:15px;'>Please enter your title</div>\n";
		}
	}
	
	if(document.getElementById('company')){
		if(document.getElementById('company').value == ''){
			missingfields += "<div style='margin-bottom:5px;margin-left:15px;'>Please enter your company</div>\n";
		}
	}
	if(document.getElementById('email')){
		if(document.getElementById('email').value == ''){
			missingfields += "<div style='margin-bottom:5px;margin-left:15px;'>Please enter valid email address</div>\n";
		}
	}

		
	//return true;
	
	if(missingfields && missingfields != ''){
		missingfields = "<h4>Please complete all fields</h4>" + missingfields;
		displayMissingFields();
		missingfields = "";
		return false;
	} else {
		//submitportform();
		return true;
	}
}

function submitanalysisform(){
	document.analysisform.submit();
	return false;
}

