function swapRatingBox()
{
	var theDiv = null;
	
	theDiv = document.getElementById('divRating');
		
	if(theDiv != null)
	{

		if(theDiv.style.visibility == 'visible')
		{
			theDiv.style.visibility = 'hidden';
			theDiv.style.height = '0px';
			theDiv.style.padding = '0px';
			theDiv.style.paddingBottom = '0px';
		}
		else
		{
			theDiv.style.visibility = 'visible';
			theDiv.style.height = '215px';
			theDiv.style.padding = '10px';
			theDiv.style.paddingBottom = '0px';
		}
	}
}	

function setCommentStars(numStars)
{			
	var strHtml = '';
	
	for(var i=1; i <= 5; i++)
	{
		if(i <= eval(numStars))
			strHtml = strHtml + '<img onClick="setCommentStars(\'' + i + '\')" class="clickable_star" src="includes/templates/lama/images/star_filled.gif" alt="">';
		else
			strHtml = strHtml + '<img onClick="setCommentStars(\'' + i + '\')" class="clickable_star" src="includes/templates/lama/images/star_empty.gif" alt="">';
	}
	
	document.getElementById('comment_stars').innerHTML = strHtml;	
	document.getElementById('comment_rating').value = numStars;
}

function submitRating(){		
	if(check_form('comment'))
	{			
		processComment();
	}
}

function processComment()
{	
	var doc = null, action_url = 'process_comment.html?', params = '', theForm = null;
			
	swapRatingBox();
		
	//create HTTP Request Object
	if (typeof window.ActiveXObject != 'undefined' ) 
		xmlReq = new ActiveXObject("Microsoft.XMLHTTP"); 		
	else 
		xmlReq = new XMLHttpRequest();
		
	//read parameters
		
	theForm = document.getElementById('commentForm');
		
	params += 'first_name=' + document.getElementById('first_name').value;	
	params += '&email_address=' + document.getElementById('email_address').value;
	params += '&comment_text=' + document.getElementById('comment_text').value;
	params += '&comment_rating=' + document.getElementById('comment_rating').value;
	params += '&languages_id=' + document.getElementById('languages_id').value;
	params += '&products_id=' + document.getElementById('products_id').value;
	
	if(document.getElementById('remember_me_yes') != null)
		if(document.getElementById('remember_me_yes').checked)
			params += '&remember_me=1';
	else
		params += '&remember_me=0';
	
	xmlReq.open("GET",action_url + params,true);
	xmlReq.send(null);
		
	displayThankYou();	
}
