var baseURL = "/wwwapps";
/*---------------------+
| sendQuoteRequest
- Initiates the JS App.
- calls AJAX request for the quote
*/
function submitQuickQuote(workingProductID, numFrontColours, numBackColours){
	var url = baseURL + '/quickQuote.ami';
	var elements;
	var param;
	//Create the the param with by looping through the elements
	elements = new Form.getElements('quickQuote');
	var param = Form.serialize('quickQuote');
	param += "?&numFrontColours=" + numFrontColours + "&numBackColours=" + numBackColours + "&workingProductID=" + workingProductID;
//	alert(url + param);
	var myAjax = new Ajax.Request( url, {method: 'post', postBody: param, onSuccess: loadData, onFailure: showMessage} );
}

/*---------------------+
| Load Data
- loads the quote data into the holder div
*/
function loadData(originalRequest){
	var quote = originalRequest.responseText;
	$('quoteResults').style.display = "block";
	$('quoteResults').getElementsByTagName('span')[0].innerHTML = quote;
}

/*---------------------+
| show Message
+ ---------------------
- shows message box, scrolls to it
- decides if error or success
- if error with xml pastes default message
- if error with submission pastes ordered list
- if success just pastes success message.
*/
function showMessage(message, type, notXML){
	//alert("showMessage");
	$('quoteResults').style.display = "block";
	window.scrollTo(0, 200);
	$('quoteResults').className = type + "Message";
	if(!notXML && type == "errorMessage"){
		$('quoteResults').getElementsByTagName('span')[0].innerHTML = "<p>There was a problem communicating with the server, if problem continues contact us!</p>";
	}
	else{
		$('quoteResults').getElementsByTagName('span')[0].innerHTML = message.responseText;
	}
}

function pageShift(){
	return;
}

