var show='';
/*
function closeAuthordetails(){
	if(show==''){show=0;}
	$('.authorContent').toggle();
	if(show==0) {
		show=1;
		$('#linkHide').html(HideDetails);
	
		$('.hideAuthor').addClass('showAuthor');
		
	}else{
		show=0;
		$('#linkHide').html(ShowDetails);
		$('.hideAuthor').removeClass('showAuthor');
		$('.hideAuthor').addClass('hideAuthor');
	}
	return false;
}
*/
function getCourses(pageNo){
		$('#courseContainer').empty();
		$('#courseContainer').html('<p class="authorLoader">&nbsp;</p>');
		$.post(appUrl+"/app/modules/community/authorDetails.ajx.php",
		{ uid: uid, page: pageNo },
		function(data){
			data = data.replace(/\r/g, "\\r");
			data = data.replace(/\n/g, "\\n");
			data = data.replace(/&quot;/g, '\\"');
			var response = eval("(" + data + ")");
			var contacts = response.contacts;
			var numpad = response.numPad;
			var chkStr = '';
			if(contacts.length > 0){
				for(i = 0; i < contacts.length; i++){
					chkStr += '<div class=\'hr '+contacts[i].className+'\'><span><a href='+appUrl+'/courses/'+contacts[i].urlCode+'>'+contacts[i].name+'&nbsp;</a>('+contacts[i].lessonsCount+' lessons)</span> <br />'+contacts[i].description+' ...\n</div> ';
				}
				$("#courseContainer").html(chkStr);
			}
			if(numpad==null){
				numpad = '';
			}
			$("#courseNumpad").html(numpad);
			
		}
	);
return false;
}


function rateAuthor(id,rating){
	$.post(appUrl+"/app/modules/community/authorRating.ajx.php",
	  	{	id:  id,
			rating: rating
		} ,	function(data){
			if(data){
				//$("#rating"+id).width(data*1);
				$("#rating"+id).css("width",data*1+'%');
			}
			$("#ratingStar"+id).html("");
			$("#rate"+id).html("");
		}
	);
	return false;	
}

function sendContact(){
	$('.sendContactInvite').slideDown('slow');
	return false;
}
function cancelRequest(){
	$('.sendContactInvite').slideUp('slow');
}

function sendRequest(requestId) {
	$(".sendContactInvite").load(appUrl+'/app/modules/community/sendUserRequest.php',
		{	
			action: "send",
			requestTo: requestId,
			message: $("#message").val()
		},
		function (){
			$('#sendRequest').removeClass("loading"); 
		}
	);
}
function validate() {
	var txt = $("#txtSearch").val();
	var type = $("#userType").val();
	var loc = $("#userCountry").val();
	if(txt || type || loc) {
		return true;	
	} else {
		$("#txtSearch").addClass("txtmsgsError");
		return false;	
	}
}