jQuery(document).ready(function(){ 									
	jQuery(document).pngFix();
	
	jQuery("a.fancyboxv").fancybox({
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true,
		'overlayOpacity':	0.7,
		'overlayColor'	: 	"#AAAAAA",
		'titlePosition'	: 	"inside",
		'titleShow'		: 	false,
		'showNavArrows'	: 	true,
		'autoScale'		: 	true,
		'titleFormat'	:	function(title, currentArray, currentIndex, currentOpts) {
		    return '<span id="fancybox-title-inside"><font style="color:#001A6F">'+title+'</font><br/>film ' +  (currentIndex + 1) + ' / ' + currentArray.length + '</span>';
		}
	});
	
	jQuery("a.fancyboxi").fancybox({
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true,
		'overlayOpacity':	0.7,
		'overlayColor'	: 	"#AAAAAA",
		'titlePosition'	: 	"inside",
		'titleShow'		: 	true,
		'showNavArrows'	: 	true,
		'autoScale'		: 	true,
		'titleFormat'	:	function(title, currentArray, currentIndex, currentOpts) {
		    return '<span id="fancybox-title-inside"><font style="color:#001A6F">'+title+'</font><br/>zdjÍcie ' +  (currentIndex + 1) + ' / ' + currentArray.length + '</span>';
		}
	});
	
	jQuery('.inactive_top_menu').mouseover(function () {
	  jQuery(this).find(".inactive_top_menu_ins").show();
    });

	jQuery('.inactive_top_menu').mouseout(function () {
	  jQuery(this).find(".inactive_top_menu_ins").hide();
    });
    
    
    // WEBMACHINIST.PL //
    var zwijacze = jQuery('.zwijacz');
    
    zwijacze.each(function() {
    	jQuery(this).click(function() {
		  jQuery(this).parent().children('.wskazowki_box_bottom').toggle();
		  jQuery(this).parent().parent().children('.wskazowki_content_fill').toggle();
		  
		  if (jQuery(this).parent().children('.wskazowki_box_bottom').css('display') == 'none') {
		  	jQuery(this).children().text('zwiń');
		  	jQuery(this).css('background-image', 'url("/images/zwin_arrow.jpg")');
		  	
		  } else {
		  	jQuery(this).children().text('rozwiń');
		  	jQuery(this).css('background-image', 'url("/images/rozwin_arrow.jpg")');
		  }
		});
  	});
    
    
});


function confirmSubmit(infotext)
{
  var agree=confirm(infotext);
  if (agree){
    return true ;
  } else {
    return false ;
  }
}

// general submit form function
function submitForm(_formName, _actionName, _actionValue)
{ 	
  	var actionName = document.getElementById(_actionName) ;
  	
  	if(actionName == null)
  	{
  		alert("Error: you have to define hidden action variable") ;
  		return ;
	}
  	actionName.value = _actionValue ;
  	document.forms[_formName].submit();

}

function submitenter(myfield,e)
{
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;
	
	if (keycode == 13)
	{
	   myfield.form.submit();
	   return false;
	}
	else
	   return true;
}

function showhide(id) 
{
	if(document.getElementById(id).style.display=='none')
	{
		document.getElementById(id).style.display='block';
	}
	else
		document.getElementById(id).style.display='none';
}

function openpopup(url)
{
	window.open(url,'popUpWindow','height=1000,width=1200,left=0,top=0,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=no')
}

function addtofavorite(adres,opis)
{
	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(opis, adres,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( adres, opis); }
	else if(window.opera && window.print) { // Opera Hotlist
		return true; }
}

function TakeMonth(date)
{
	jQuery.ajax
	({	
		type: "POST",
		url: "/takemonth.php",	        
		data: "date="+date,
		success: function(msg)
		{		
			jQuery('#contentContainer').html(msg);
		}		
	});
}
