function _go($url) 
{
	window.location=$url;
}


function callAjax(method, value, value2, target)
{
	// alert(method+" "+value+" "+value2+" "+target);
    if(encodeURIComponent) 
	{
      var req = new AjaxRequest();
      var params = "method=" + method + "&value=" + encodeURIComponent(value) + "&value2=" + encodeURIComponent(value2) + "&target=" + target;
      req.setMethod("POST");
      req.loadXMLDoc('../phpajax/ajaxValidateForm.php', params);
    }
}

$(document).ready(function() {

  setTimeout(function() { 
	        $('div.error_message').slideUp(); 
	    }, 5000); 
  setTimeout(function() { 
	        $('div.positive_message').slideUp(); 
	    }, 5000); 

  $("#tabela_stanow").tablesorter(); 

/*
			function beforeCall(form, options){
				alert("?");
                return true;
            }
            
            // Called once the server replies to the ajax form validation request
            function ajaxValidationCallback(status, form, json, options){
                if (status === true) {
                    alert("the form is valid!");
                    // uncomment these lines to submit the form to form.action
                    // form.validationEngine('detach');
                    // form.submit();
                    // or you may use AJAX again to submit the data
                }
            }
            
            jQuery(document).ready(function(){
                jQuery("#formularz_rejestracji").validationEngine({
					ajaxFormValidation: true,
                    onAjaxFormComplete: ajaxValidationCallback,
                });
            });

$(".fmrInput").tooltip({
		position: "center right",
		offset: [40, -240],
		effect: "fade",
		opacity: 0.7
	});
*/

}); 

function showprof($box)
{
	if (($box.name == "all") && ($box.checked == true))
	{
		document.getElementById("pzg").checked = true;
		document.getElementById("uts").checked = true;
		document.getElementById("utk").checked = true;
		document.getElementById("usm").checked = true;
		document.getElementById("upd").checked = true;
		document.getElementById("upr").checked = true;
		document.getElementById("sto").checked = true;
		document.getElementById("uob").checked = true;
		document.getElementById("ugr").checked = true;
	}

	if (($box.name == "all") && ($box.checked == false))
	{
		document.getElementById("pzg").checked = false;
		document.getElementById("uts").checked = false;
		document.getElementById("utk").checked = false;
		document.getElementById("usm").checked = false;
		document.getElementById("upd").checked = false;
		document.getElementById("upr").checked = false;
		document.getElementById("sto").checked = false;
		document.getElementById("uob").checked = false;
		document.getElementById("ugr").checked = false;
	}

	if (($box.name != "all") && ($box.checked == false))
	{
		document.getElementById("all").checked = false;
	}
	
  document.getElementById("profile_cnt").innerHTML = "<div style='width: 688px; margin-top: 125px; height: 150px; text-align: center;'><img src='images/gif/loading.gif' width='16' border='0'/></div>";

	$.ajax({
		url: "/scr/profile.php", 
		type: "POST", 
		data: "all="+document.getElementById("all").checked+"&pzg="+document.getElementById("pzg").checked+"&uts="+document.getElementById("uts").checked+"&utk="+document.getElementById("utk").checked+"&usm="+document.getElementById("usm").checked+"&upd="+document.getElementById("upd").checked+"&upr="+document.getElementById("upr").checked+"&sto="+document.getElementById("sto").checked+"&uob="+document.getElementById("uob").checked+"&ugr="+document.getElementById("ugr").checked+"&rnd=" + Math.random(), success: function (data, textStatus) 
			{ 
			 document.getElementById("profile_cnt").innerHTML = data;
			 $("#profile_cnt").fadeIn(200);
			}
		});
};

$(document).ready(function() {
		$( "#tabs" ).tabs({
			cookie: {
				// store cookie for a day, without, it would be a session cookie
				expires: 1
			}
		});
		$( "#tabsM" ).tabs({
			cookie: {
				// store cookie for a day, without, it would be a session cookie
				expires: 1
			}
		});
		$( "#tabsProd" ).tabs({
			cookie: {
				// store cookie for a day, without, it would be a session cookie
				expires: 1
			}
		});
});

$(document).ready(function() {
		$('#kragum-home-slider').nivoSlider({
                pauseTime:5000,
                pauseOnHover:false,
                boxCols: 12,
                boxRows: 4,
				directionNav: false,
				controlNav: false,
				captionOpacity: 0.8
            });		
		
		function megaHoverOver(){
		$(this).find(".sub").stop().fadeTo('fast', 1).show();
			
		//Calculate width of all ul's
		(function($) { 
			jQuery.fn.calcSubWidth = function() {
				rowWidth = 0;
				//Calculate row
				$(this).find("ul").each(function() {					
					rowWidth += $(this).width(); 
				});	
			};
		})(jQuery); 
		
		if ( $(this).find(".row").length > 0 ) { //If row exists...
			var biggestRow = 0;	
			//Calculate each row
			$(this).find(".row").each(function() {							   
				$(this).calcSubWidth();
				//Find biggest row
				if(rowWidth > biggestRow) {
					biggestRow = rowWidth;
				}
			});
			//Set width
			$(this).find(".sub").css({'width' :biggestRow});
			$(this).find(".row:last").css({'margin':'0'});
			
		} else { //If row does not exist...
			
			$(this).calcSubWidth();
			//Set Width
			$(this).find(".sub").css({'width' : rowWidth});
			
		}
	}
	
	function megaHoverOut(){ 
	  $(this).find(".sub").stop().fadeTo('fast', 0, function() {
		  $(this).hide(); 
	  });
	}
 
	var config = {    
		 sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)    
		 interval: 50, // number = milliseconds for onMouseOver polling interval    
		 over: megaHoverOver, // function = onMouseOver callback (REQUIRED)    
		 timeout: 250, // number = milliseconds delay before onMouseOut    
		 out: megaHoverOut // function = onMouseOut callback (REQUIRED)    
	};
 
	$("ul#topnav li .sub").css({'opacity':'0'});
	$("ul#topnav li").hoverIntent(config);
 
});
