
/**** preloader ****/

if (start) {
	var ima = new Array('colorbox/loading.gif', 'colorbox/border.png', 'colorbox/controls.png', 'colorbox/loading_background.png', 'colorbox/overlay.png');
	for(var i = 0; i < ima.length; ++i) {
		temp = ima[i];
		ima[i] = new Image();
		ima[i].src = base+'tpl/pl/szablon1/img/'+temp;
	}
}

$(document).ready(function() {

	var buff, temp, stop;

	/**** _target="blank" ****/
	buff = $('a').map(function() { return $(this); });
	jQuery.each(buff, function(index, value) {
		temp = value.attr('href');
		if (temp != undefined && (temp.substr(0, 7) == 'http://' || temp.substr(0, 8) == 'https://')) {
			stop = temp;
			temp = temp.replace(/http:\/\//, '');
			if (temp != stop) {
				temp = temp.split('/');
				if (temp[0] != window.location.host) value.attr('target', '_blank');
			}
		}
	});
	stop = false;

	/**** colorbox ****/
	$('a.colorbox').colorbox();


	/**** print ****/
	
	$('.drukuj').click(function(){
		$('#pri').html('<form method="post" action="pdf.php?'+Math.random()+'" id="pritn"><input type="hidden" name="printexe" id="printexe" value="pdf" /><textarea id="prit" cols="2" rows="2" name="html2pdf"></textarea></form>');
		$('#prit').attr('value', $(this).parent('p').parent('div').html());
		if ($(this).attr('alt') == 'drukuj') $('#printexe').attr('value', 'print');
		$("#pritn").submit();
	});


	/**** bannery ****/

	$('.s_banners img').hover(
		function(){
			var temp = $(this).attr('src');
			temp = temp.replace('.png', '_on.png');
			$(this).attr('src', temp);
		},
		function(){
			var temp = $(this).attr('src');
			temp = temp.replace('_on.png', '.png');
			$(this).attr('src', temp);
		}
	);

});

/***** linki do innych stron *****/

function href(url) {
	window.location.href = url;
}

