$(document).ready(function(){
	
	try {
		$(document).pngFix();
	} catch(e) { }
	$("#nav li").hover(function() {
		$(this).children('.lm').addClass('lmh');
		$(this).children('.rm').addClass('rmh');
	}, function() {
		if(!$(this).children('a').hasClass('selected')) {
		$(this).children('.lm').removeClass('lmh');
		$(this).children('.rm').removeClass('rmh');
		}
	});
  	if(typeof($.Lightbox) != 'undefined')
	$.Lightbox.construct({
		opacity: 0.4,
		show_linkback:	false,
		show_info:	true,
		show_extended_info: true,
		download_link: false,
		text: {
			image:		'Zdjęcie',
			close:	'Zamknij',
			closeInfo: 'Zamknij obrazek',
			download: 'Zapisz zdjęcie',
			of: 'z'
		},
		files: {
			images: {
				prev: base_url+'img/lightbox/prev.png',
				next: base_url+'img/lightbox/next.png'
			}
		}
	});
	
	if($('.admin').length != 0) {
		if($('ul.zakladki_menu li a').length > 0)
		$('ul.zakladki_menu li a').hover(function(){
				$(this).effect("highlight", {color: '#175B88'}, 500);
		});
	function sendtoclipboard(s,el)	{
		if( window.clipboardData && clipboardData.setData )	{
			clipboardData.setData("text", s);
		} else {
			ffcopy(el);
		}
	}
	var options = { offsetLeft: 0, offsetTop:23, minWidth:100, arrowSrc: base_url+'img/admin/punktor3.gif', onClick: function(e, menuItem){  
  	    
  	}, onOpen: function(e, item) {
	}};
  	$('.menu').menu(options);
	$('.menu1').hover(function(){
		//$(this).css('background', 'url('+base_url+'img/admin/cms_menu_e.png)');
		$(this).css('color', '#a00');
		$(this).css('background-color', '#fff');
	});
	$('.menu1').mouseout(function(){
		$(this).css('background', 'none');
		$(this).css('color', '#000');
		$(this).css('background-color', 'transparent');
	});
	$(".delete").click(function(){
		if(confirm("Czy na pewno chcesz to zrobić?")) {
			$.post($(this).attr('href'));
			$(this).parent().parent().hide();
		}
		return false;
	});
	var last_tr_bg = '';
	var last_tr_col = '';
	$(".admin tr.highlight").hover(function(){
		last_tr_bg = $(this).css('background-color');
		last_tr_col = $(this).css('color');
		$(this).css('background-color', '#B0FF66');
		$(this).css('color', '#000');
	});
	$(".admin tr.highlight").mouseout(function(){
		if(last_tr_bg == '') return;
		$(this).css('background-color', last_tr_bg);
		$(this).css('color', last_tr_col);
	});
	} //admin
});
/** jQuery **/

function modeluj_okno_dialogowe(string)
{
	if($("#okno_dialogowe")) {
		$("#okno_dialogowe").append(string);
	}
}
function hide_okno_dialogowe()
{
	if($("#okno_dialogowe").hide("slow"))
		return true;
}
function show_message(msg)
{
	if($("#dialog_msg").length == '') {
		$("body").append("<div id='dialog_msg' style=' '></div>");
	}
	$("#dialog_msg").html(msg);
	$("#dialog_msg").show(1000);
	$("#dialog_msg").click(function(){
		$("#dialog_msg").fadeOut(1500);
	});
	//setTimeout('$("#dialog_msg").hide(600)', 2500);
}

function modeluj_okno_dialogowe(string)
{
	if($("#okno_dialogowe")) {
		$("#okno_dialogowe").append(string);
	}
}
function show_message(string) {
	if($("#okno_dialogowe")) {
		$("#okno_dialogowe span").append(string);
		$("#okno_dialogowe").show(700);
		$("#okno_dialogowe").animate({
				fontSize: '16px',
				width: '450px',
				height: '100%',
				marginTop: '70px'
				
		}, 600);
		//$("#okno_dialogowe").css('margin-top', '70px');
	}
}
function hide_okno_dialogowe()
{
	if($("#okno_dialogowe").hide("slow"))
		return true;
}
var togo1 = true;
function toggle_info(id, ref)
{
	var sel = ".info_det"+id;
	$(".informacje_detale").hide(400);
	if($(sel).css('display') == 'none')
	$(sel).toggle('slow');
	if(togo1 == false) {
		$(ref).children('img').attr('src', base_url+'img/oglo_wiecej.png');
		togo1 = true;
	} else { 
		$(ref).children('img').attr('src', base_url+'img/oglo_mniej.png');
		togo1 = false;
	}
}
/** end jQuery **/


