function storeFBInfoInDB(theLocation, theRating, theComments, theActiveTab, theModel) {

    var httpRequest = getHttpRequest();
    if (httpRequest) {

		var url = '/shared/code/supportwebservs.asmx/storeFeedbackData?theLocation=' + theLocation;
		url += '&theRating=' + theRating;
		url += '&theComments=' + theComments;
		url += '&theActiveTab=' + theActiveTab;
		url += '&theModel=' + theModel;
		
		httpRequest.open( 'GET', url, true );
		httpRequest.onreadystatechange = function () {
											if ( httpRequest.readyState == 4  ) {
												if ( httpRequest.status == 200  ) {
													try {
														var txt = httpRequest.responseXML.getElementsByTagName( 'boolean' )[0].childNodes[0].nodeValue;
														// The value returned is a 'true' or 'false' string
													}
													catch ( e ) {}
												}
											}
										 }
		httpRequest.send( null );
	}

}


function sendFeedback(txtModel) {

	var rates = $('feedback').options;
	var rating = rates [rates .selectedIndex].value;
	txtCom = $( 'fbl_txt' ).value; 
		
	if (rating != -1) {

	    // Store the feedback on the database
	    storeFBInfoInDB(escape(document.location), rating, txtCom, '', txtModel);

	    $('fbl_txt').value = '';
		
		// Hide the feedback in order to avoid multiple submits 
		if ($$( '.vsp-feedback-box' ) ) {	$$( '.vsp-feedback-box' ).setStyle('display','none');}
	}
	else alert( "Please select an option" );

	return false;
}


function getHttpRequest() 
{
	try {
		return new XMLHttpRequest(); }
	catch ( tryMicrosoft ) {
		try {
			return new ActiveXObject( "Msxml2.XMLHTTP" ); }	
		catch ( otherMicrosoft ) {
			try {
				return new ActiveXObject( "Microsoft.XMLHTTP" ); }
			catch ( failed ) {
				return false;
			}
		}
	}
}
