
	var msg = 'Confirm Your Vote';
	function karmaVote(points, postId,userIp,posterIp,start,extension) {
		karmaVote(points, postId,userIp,posterIp, null,start,extension)
    }

//${I18n.getMessage("Karma.confirmVote")} msg /start/extension
	function karmaVote(points, postId,userIp,posterIp, partner,start,extension) {
		if (points == 0) {
			return;
		}
        if(posterIp == userIp)
        {
            alert("You are using the same machine as the author of the post!");
        }
        else
        {
            if (confirm(msg)) {
				var location = "/karma/insert/"+start+"/" + postId + "/" + points + extension;
				if(partner != null)
					location = location + "?PARTNER="+partner;
				document.location = location;
            }
        }
    }
    //start/extension
    
    function karmaVoteAjax(points, postId,isPostFromSameIp, start,extension) {
		if (points == 0) {
			return;
		}
        if(isPostFromSameIp == 'true')
        {
            alert("You are using the same machine as the author of the post!");
        }
        else
        {
            if (confirm(msg)) {
				var location = "/karma/insertAjax/"+start+"/" + postId + "/" + points + extension;
				AjaxRequest.get(
               {
                'url':location,
                'onSuccess':function(req){ document.getElementById("ratings_"+postId).innerHTML=req.responseText;}

               }
   );
              }
        }
    }
	function karmaVoteAjax(postId,isPostFromSameIp, start,extension ,logged,postLikeCount,topicLikeCount,topicLike) {
		
      
		if(isPostFromSameIp == 'true')
        {
            alert("You are using the same machine as the author of the post!");
        }
		else if(logged=="false"){
		 alert("You are not current logged In ,Please logged in for like this ");
		}
        else
        {
          
				var location = "/karma/insertAjax/"+start+"/" + postId + extension+"?topicLike="+topicLike;
				
				AjaxRequest.get(
               {
                'url':location,
                'onSuccess':function(req){ 
				 
				 if(topicLike==0)
				 {
				   document.getElementById("like_"+postId).innerHTML =req.responseText.split("~")[0];
				   document.getElementById("topicLikeId").innerHTML = req.responseText.split("~")[1];
				   document.getElementById('loadingGif').style.display = 'none';
				  }
				 else if(topicLike==1)
				 {
				    document.getElementById("topicLikeId").innerHTML =req.responseText;
					
					}
				}

               }
   );
             
        }
    }
    
    //msg  ${I18n.getMessage("Karma.rateMessage")}
	function karmaPointsCombo(postId)
	{
		document.write('<select name="karma" onchange="karmaVote(this,' + postId + ')">');
		document.write('	<option value="">Rate</option>');
		document.write('	<option value="1">1</option>');
		document.write('	<option value="2">2</option>');
		document.write('	<option value="3">3</option>');
		document.write('	<option value="4">4</option>');
		document.write('	<option value="5">5</option>');
		document.write('</select>');
	}
	

