function storeFBInfoInDB(theRating, theComments, theActiveTab) {

    var httpRequest = getHttpRequest();
    if (httpRequest) {
        var url = '/shared/code/supportwebservs.asmx/storeFeedbackData?theLocation=' + escape(document.location);
        url += '&theRating=' + theRating;
        url += '&theComments=' + theComments;
        url += '&theActiveTab=' + theActiveTab;
        url += '&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( position ) {
	
	var rating = -1;
	var txtCom = '';
	var txtTab = '';
	if ( typeof ActivDiv == 'undefined') ActivDiv = "";
	
	if ( position == 'left' )
	{
		if ( $( 'fbl_very' ).checked )
		{
			rating = $( 'fbl_very' ).value;
			$( 'fbl_very' ).checked = false;
		}
		else
		{
			if ( $( 'fbl_avg' ).checked )
			{
				rating = $( 'fbl_avg' ).value;
				$( 'fbl_avg' ).checked = false;
			}
			else
			{
				if ( $( 'fbl_not' ).checked )
				{
					rating = $( 'fbl_not' ).value;
					$( 'fbl_not' ).checked = false;
				}
			}
		}
		txtCom = $( 'fbl_txt' ).value; 
		if ( rating != -1 ) $( 'fbl_txt' ).value = '';
	}
	else if ( position == 'bottom' )
	{
		if ( $( 'fbb_very' ).checked )
		{
			rating = $( 'fbb_very' ).value;
			$( 'fbb_very' ).checked = false;
		}
		else
		{
			if ( $( 'fbb_avg' ).checked )
			{
				rating = $( 'fbb_avg' ).value;
				$( 'fbb_avg' ).checked = false;
			}
			else
			{
				if ( $( 'fbb_not' ).checked )
				{
					rating = $( 'fbb_not' ).value;
					$( 'fbb_not' ).checked = false;
				}
			}
		}
		txtCom = $( 'fbb_txt' ).value;
		if ( rating != -1 ) $( 'fbb_txt' ).value = '';
	}

	if ( rating != -1 )
	{	// Retrieve the current active tab (if any)
		if ( $( 'activeTab' ) ) txtTab = $( 'activeTab' ).value;
		if (ActivDiv != "") txtTab = ActivDiv;
	//	alert(txtTab);
		// Store the feedback on the database
		storeFBInfoInDB( rating, txtCom, txtTab );
		
		// Hide the feedback in order to avoid multiple submits 
		if ( $( 'feedbackBox' ) ) {	$( 'feedbackBox' ).style.display = 'none'; }
		if ( $( 'feedbackBottomBox' ) ) {$( 'feedbackBottomBox' ).style.display = 'none';}
		
	}
	else alert( "Please select an option" );

	return false;
}


function clearFBtextbox( txtTheFeedback ) 
{
	var oFBComments = document.getElementById( txtTheFeedback )
	if ( oFBComments.value.replace(/^\s+|\s+$/g, '') == '' )  // just TRIM the string to see if it is empty
		oFBComments.value = '';
}


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;
			}
		}
	}
}







/* -------------------------- OLD CODE -------------------------- */
/*

function showFeedbackForm( lng ){

	var theForm;
	var rating = -1;
	
	if ( document.feedbackform ) {
		// Verify if the user has selected something (left-feedback window)
		theForm = document.feedbackform;
		for( i = 0; i < 3; i++ ) {
			if ( theForm.feedback[i].checked ) {
				rating = theForm.feedback[i].value;
				theForm.feedback[i].checked = false;
			}
		}
	}
	
	if ( ( rating == -1 ) && ( document.feedbackformbottom ) ) {
		// Verify if the user has selected something (bottom-feedback window)
		theForm = document.feedbackformbottom;
		for( i = 0; i < 3; i++ ) {
			if ( theForm.feedback[i].checked ) {
				rating = theForm.feedback[i].value;
				theForm.feedback[i].checked = false;
			}
		}
	}

	if ( rating != -1 ) {
		var oFB 		  = document.getElementById( 'ifrmFb' );

		// oFB.src 		  = '/feedback/fb_form.asp?l=' + lng + '&rating=' + rating;
		oFB.src 		  = '/feedback/fb_form.asp?l=' + lng + '&rating=' + rating + '&url=' + escape( document.location );
		
		var activeTab 	  = document.getElementById( 'activeTab' );
		if ( activeTab ) 
			oFB.src += ( '&tab=' + activeTab.value );
		oFB.style.display = 'block';
	}
	else {
		alert( "Please select an option" );
	}
}

function sendFB(){
	// -- Submit the form -- 
	document.getElementById( 'fbForm' ).submit();
	// -- Hide the popup -- 
	parent.document.getElementById( 'ifrmFb' ).style.display = 'none';
}
*/

/* ---------------------------------------------------------------------------------- */
/*
function getiFrameInnerDocHeight( doc ) {

	var theHeight;
	
	if ( doc.height ) 
		theHeight = doc.height
	else if ( doc.body ) {
		var scrollH = doc.body.scrollHeight ? doc.body.scrollHeight : 0;
  		var offsetH = doc.body.offsetHeight ? doc.body.offsetHeight : 0;
    	theHeight = Math.max( scrollH, offsetH );
	}
	
	return theHeight;
}


function setIframeHeight( iframeName ) {

  var iframeWin = window.frames[iframeName];
  var iframeEl	= document.getElementById ? document.getElementById(iframeName) : document.all ? document.all[iframeName] : null;
  
  if ( iframeEl && iframeWin ) {
    iframeEl.style.height = getiFrameInnerDocHeight( iframeWin.document ) + "px";
  }
}


function centerObject( oId ) {

	var obj 		= document.getElementById( oId );
	var objWidth 	= obj.offsetWidth ? obj.offsetWidth : obj.style.width ? parseInt( obj.style.width ) : 0;
	var objHeight	= obj.offsetHeight ? obj.offsetHeight : obj.style.height ? parseInt( obj.style.height ) : 0;
	
	var x = ( getViewportWidth() - objWidth ) / 2;		 
	x = x >= 0 ? x : 0;
	var y = ( ( getViewportHeight() - objHeight ) / 2 ); 
	y = y >= 0 ? y : 0;
	
	obj.style.left = x + getScrollXY()[0] + "px";
	obj.style.top  = y + getScrollXY()[1] + "px"	
}	


function getViewportWidth() {

	return 	document.documentElement.clientWidth ? document.documentElement.clientWidth : 
		document.body.clientWidth ? document.body.clientWidth : window.innerWidth - 18;
	
};


function getViewportHeight() {

	return document.documentElement.clientHeight ? document.documentElement.clientHeight : 
		document.body.clientHeight ? document.body.clientHeight : window.innerHeight - 18;
};


function getScrollXY() {
	var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) 
	{	//Netscape compliant
    	scrOfY = window.pageYOffset;					
    	scrOfX = window.pageXOffset; } 
    else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) 
	{ 	//DOM compliant
		scrOfY = document.body.scrollTop;				
		scrOfX = document.body.scrollLeft; } 
	else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) 
	{	//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;	
		scrOfX = document.documentElement.scrollLeft;
	}
	return [ scrOfX, scrOfY ];
}

function SetActivDIV(name){
	ActivDiv = name;
	}

*/
/* ---------------------------------------------------------------------------------- */