// Log user in
	function checkLogin(u,p,r) {
		$.ajax({type: "POST",
						 url: "/ajax.php",
						data: "ajax=checkLogin&user_name="+escape(u)+"&user_pwd="+escape(p)+"&remember="+r,
				 success: function(status) {
					 					if(status == 'invalid') {
											alert('The information you have entered is not valid.');
										}
										else if(status == 'not_verified') {
											alert('You have not verified your account. Please check your e-mail for your account activation link.  If you did not receive it, please click on find codes below.');
										}
										else {
											window.location.reload();
										}
					 				}});
		return false;
	}

// Rate a review
	function rateReview(id,r) {
		$.ajax({type: "POST",
						 url: "/ajax.php",
						data: "ajax=rateReview&id="+id+"&r="+r,
				 success: function(status) {
					 					$('#helpful_'+id).hide().html(status).fadeIn();
					 				}});
	}
	
// Delete Comments
function deleteComment(comment_id,u) {
	if(confirm('Are you sure that you want to delete this comment?  This action cannot be undone!')) {
		$.ajax({
			type: "GET",
		 	url: "/ajax.php",
		 	data: "ajax=deleteComment&comment_id="+comment_id+"&u="+u,
		 	success: function(status) {$('#comment_'+comment_id).hide()}});
	}
}

function showDescription(d) {
	$('#description_'+d).slideToggle();
	$('#description_'+d+'_icon').toggleClass('toggle_expand');
	$('#description_'+d+'_icon').toggleClass('toggle_collapse');
}

// Toggle Section
function toggle(id){
	$("#toggle_"+id).slideToggle("slow");
	obj = document.getElementById('arrow_'+id);
	var src = $('#arrow_'+id).attr("src");
	if(src == '/images/collapse.gif') {
		obj.src = '/images/expand.gif';
	} else {
		obj.src = '/images/collapse.gif';
	}
}

function textCounter(field,maxlimit) {
	obj = document.getElementById(field);
	if (obj.value.length > maxlimit) // if too long...trim it!
		obj.value = obj.value.substring(0, maxlimit);
	else 
		document.getElementById(field+'_remaining').innerHTML = maxlimit - obj.value.length;
}	