$(document).ready(function() {
	
	
	$(".ttip").tooltip({  
	    position: ['center', 'right'], 
	    offset: [-30, 0],  
	    effect: 'toggle', 
	    opacity: 0.8 
	});
	
//	$(".hasTooltip").tooltip({
//
//	    opacity: 0.8
//	});

	$(".hasTooltip").tooltip({
//	   position: ['top', 'center'],
//	   relative:true,
//	    opacity: 0.8
	});

	

	//box more
	$(".box .more").click(function(){
		$(this).slideUp("fast", function(){
			
			$("#" + this.id + "Content").slideDown("fast");
		});
		
	});
	$(".box .up").click(function(){
		$(this).nextAll("div").slideToggle("fast");

	});
	$(".box .close").click(function(){
		$(this).parent().slideUp("fast");

	});
	
	$(".box .up").add(".box .close").css("cursor","pointer");
	
	$(".rmCompetitor").live("click", function(){
		$(this).parent().remove();
	});
	
	/***************/
	/*formularze na stronie firmy*/
	$(".form").next("a").click(function(){
		$(this).prev(".form").slideDown("fast");
		$(this).slideUp("fast");
	});
	
	$(".errorSummary").closest(".form").next("a").hide();
	$(".errorSummary").closest(".form").show();
	/**************/
	
	/******************/
	/*	Komentarze flagi */
	$(".commentFlag a").click(function(){
		var el = $(this);
		$.ajax({
		   type: "POST",
		   url: "/Companies/ACommentFlag",
		   data: ({ id: $(this).attr("rel") }),
		   success: function(result){
				el.parent().html(result);
				
				
			   }
		 });
	});
	
	/******************/
	/******************/
	
	
	/***Aktywacja maila***/
	$("#reactivateMail").click(function(){
		$.ajax({
		   type: "POST",
		   url: "/Companies/AActivate",
		   data: ({ id: $(this).attr("rel") }),
		   success: function(result){
				$("#ajaxResp").html(result);
				$("#ajaxResp").show().fadeOut("slow");
				
			   }
		 });
	});
	
	
	$("#addOffice").click(function(){
		$("input").not(".submitButton").val("");
		$("select").val(0);
		
	});

}); 
 


function rating(){
	$.ajax({
		   type: "POST",
		   url: "/Companies/rating",
		   data: ({ ratingVal:$(this).val(), fid:$("#fid").html() }),
		   success: function(result){
				$("#stars").html(result);
			    
			   }
		 });
	
	
	$(".cancel").css("display","none");
}