// JavaScript Document
var xmlHttp;
function GetXmlHttpObject(handler){ 
	var objXMLHttp=null;
	if (window.XMLHttpRequest){
		objXMLHttp=new XMLHttpRequest();
	}else if (window.ActiveXObject){
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	return objXMLHttp;
}

function stateChanged(){ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
		var str = xmlHttp.responseText;
		document.getElementById("suggestedService").innerHTML=str;
	}
}

function getCheckedValue(radioObj) {
	if(!radioObj)
		return 0;
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return 0;
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return 0;
}

function getService(question1,question2,question3,question4)
{

	var a = parseInt(getCheckedValue(question1));
	var b = parseInt(getCheckedValue(question2));
	var c = parseInt(getCheckedValue(question3));
	var d = parseInt(getCheckedValue(question4));
	
	var url = '../external/productselection.php';
		var parameters = 'a='+a;
		parameters = parameters + '&b='+b;
		parameters = parameters + '&c='+c;
		parameters = parameters + '&d='+d;

		xmlHttp = GetXmlHttpObject();
		if (xmlHttp==null)
		  {
		  alert ("Your browser does not support AJAX!");
		  return;
		 }
		
		xmlHttp.open("POST", url , true) ;
		xmlHttp.onreadystatechange=stateChanged;
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-length", parameters.length );
		xmlHttp.setRequestHeader("Connection", "close");
		xmlHttp.send(parameters); 
}

function getTotal(question1,question2,question3,question4)
{

var a = parseInt(getCheckedValue(question1));
var b = parseInt(getCheckedValue(question2));
var c = parseInt(getCheckedValue(question3));
var d = parseInt(getCheckedValue(question4));

if (a == 0 || b == 0 || c == 0 || d == 0)
{
	document.getElementById("suggestedService").innerHTML = "ERROR: Missing responses. Please select answers for all 4 questions above so that we can help you choose a service.";
	
}
else{
	var total = a+b+c+d;
	if (total < 10)
	{
		document.getElementById("suggestedService").innerHTML = "Given your responses, we recommend: <b>\"Evaluate\":</b><blockquote>Great for all levels of experience (including students and interns) across all industries. <br />Includes an extremely detailed, point-by-point professional road map identifying key weaknesses, important issues for future maintenance, a grade on whether employers will be interested in pursuing you as a interview-worthy candidate and free interviewing best practices handbook. <br />Correction mark-up / highlighting of documentation provided by ResumeGuru. <br />Requires minimal (if any) customer participation as part of the interview process.<br />One (1) day express turnaround time, two (2) day standard turnaround time. <br /><form target=\"paypal\" action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\"><input type=\"hidden\" name=\"cmd\" value=\"_s-xclick\"><input type=\"hidden\" name=\"hosted_button_id\" value=\"CHRGUGCCWWPGG\"><input type=\"hidden\" name=\"on0\" value=\"Option\"><br /><i>Choose from one of the following options:</i><br /><select name=\"os0\"><option value=\"Resume / Cover Letter, Express\">Resume / Cover Letter, Express $72.00</option><option value=\"Resume / Cover Letter, Standard\">Resume / Cover Letter, Standard $55.00</option><option value=\"Resume, Standard\">Resume, Standard $42.00</option><option value=\"Cover Letter, Standard\">Cover Letter, Standard $17.00</option></select><br /><input type=\"hidden\" name=\"currency_code\" value=\"USD\"><input type=\"image\" src=\"https://www.paypal.com/en_US/i/btn/btn_cart_SM.gif\" border=\"0\" name=\"submit\" alt=\"PayPal - The safer, easier way to pay online!\"><img alt=\"\" border=\"0\" src=\"https://www.paypal.com/en_US/i/scr/pixel.gif\" width=\"1\" height=\"1\"></blockquote>";
	} 
	else if (total < 25) 
	{
		document.getElementById("suggestedService").innerHTML = "Given your responses, we recommend: <b>\"Refresh\":</b><blockquote>Great for junior to mid-level career professionals across all industries. <br />A straight-forward rewrite and reformatting of document by ResumeGuru.<br />Focuses primarily on proper grammatical structure, writing style and information organization.<br />Accommodates up to 10 years of experience or 6 positions. <br />Includes in-depth point-by-point professional evaluation for future maintenance and free interviewing best practices handbook. <br />Requires minimal (if any) customer participation as part of the interview process. <br />One (1) day express turnaround time, two (2) day standard turnaround time.<br /><form target=\"paypal\" action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\"><input type=\"hidden\" name=\"cmd\" value=\"_s-xclick\"><input type=\"hidden\" name=\"hosted_button_id\" value=\"SXUGT3AUBCJBA\"><input type=\"hidden\" name=\"on0\" value=\"Option\"><br /><i>Choose from one of the following options:</i><br /><select name=\"os0\"><option value=\"Resume / Cover Letter, Express\">Resume / Cover Letter, Express $130.00</option><option value=\"Resume / Cover Letter, Standard\">Resume / Cover Letter, Standard $97.00</option><option value=\"Resume, Standard\">Resume, Standard $65.00</option><option value=\"Cover Letter, Standard\">Cover Letter, Standard $32.00</option></select><br /><input type=\"hidden\" name=\"currency_code\" value=\"USD\"><input type=\"image\" src=\"https://www.paypal.com/en_US/i/btn/btn_cart_SM.gif\" border=\"0\" name=\"submit\" alt=\"PayPal - The safer, easier way to pay online!\"><img alt=\"\" border=\"0\" src=\"https://www.paypal.com/en_US/i/scr/pixel.gif\" width=\"1\" height=\"1\"></blockquote>";
	} 
	
	else 
	{
		document.getElementById("suggestedService").innerHTML = "Given your responses, we recommend: <b>\"Renovate\":</b><blockquote><i>Our most popular service.</i> Great for mid-level to senior-level career professionals,  low-volume contractors and students. <br />An end-to-end, comprehensive document rewrite and reformatting by ResumeGuru that also includes proper grammatical restructuring, writing style correction, information organization and refocused candidate presentation.<br />Highlights results-oriented work experience. <br />Accommodates up to 10 years of experience or 6 positions. <br />Includes in-depth professional evaluation for future maintenance, free interviewing best practices handbook, and ResumeGuru's Guarantee of Quality. <br />Requires full customer engagement as part of the interview process. <br />Two (2) day express turnaround time, four (4) day standard turnaround time.<form target=\"paypal\" action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\"><input type=\"hidden\" name=\"cmd\" value=\"_s-xclick\"><input type=\"hidden\" name=\"hosted_button_id\" value=\"ED226BVS422RS\"><input type=\"hidden\" name=\"on0\" value=\"Option\"><br /><i>Choose from one of the following options:</i><br /><select name=\"os0\"><option value=\"Resume / Cover Letter, Express\">Resume / Cover Letter, Express $189.00</option><option value=\"Resume / Cover Letter, Standard\">Resume / Cover Letter, Standard $139.00</option><option value=\"Resume, Standard\">Resume, Standard $105.00</option><option value=\"Cover Letter, Standard\">Cover Letter, Standard $49.00</option></select><br /><input type=\"hidden\" name=\"currency_code\" value=\"USD\"><input type=\"image\" src=\"https://www.paypal.com/en_US/i/btn/btn_cart_SM.gif\" border=\"0\" name=\"submit\" alt=\"PayPal - The safer, easier way to pay online!\"><img alt=\"\" border=\"0\" src=\"https://www.paypal.com/en_US/i/scr/pixel.gif\" width=\"1\" height=\"1\"></blockquote>";
	} 
}
};

