$(document).ready(function() {
		
			

			var _this=jQuery(this);
			var hover = _this.find(".maps_hover");
			_this.find("area").each(function(){
				var area=jQuery(this);
				
						
				
			area.qtip({
				content:area.attr("title"),
				position:{target:"mouse",adjust:{mouse:true,x:0,y:15,screen:true},
				corner:{target:"bottomMiddle",tooltip:"topMiddle"}
				},
				show:{effect:function(){this.css({marginTop:-10,opacity:0,display:"block"});this.stop(true,true).animate({opacity:"1",marginTop:0},100)}},hide:{effect:function(){this.stop(true,true).animate({opacity:0,marginTop:10},100,function(){jQuery(this).hide()})}}});

				
				area.attr("title","").attr("alt","");
				
				area.hover(function(){
					hover[0].className="maps_hover "+this.className;
					hover.stop(true,true).fadeIn(100)
				},
				function() {
					hover.hide()[0].className="hover";
				});
					
					
				});

		
		
			
	function premium_scroll_initCallback(carousel) {
			jQuery('#premium_scroll-next').bind('click', function() {
				carousel.next();
				return false;
			});
		
			jQuery('#premium_scroll-prev').bind('click', function() {
				carousel.prev();
				return false;
			});
					
			// Disable autoscrolling if the user clicks the prev or next button.
			carousel.buttonNext.bind('click', function() {
				carousel.startAuto(0);
			});
		
			carousel.buttonPrev.bind('click', function() {
				carousel.startAuto(0);
			});
		
			// Pause autoscrolling if the user moves with the cursor over the clip.
			carousel.clip.hover(function() {
				carousel.stopAuto();
			}, function() {
				carousel.startAuto();
			});

		};
		
		$('#premium_scroll').jcarousel({
			auto: 3,
        	wrap: 'last',
			scroll: 1,			
			initCallback: premium_scroll_initCallback,
			// This tells jCarousel NOT to autobuild prev/next buttons
			buttonNextHTML: null,
			buttonPrevHTML: null
		});
		
	
  var $tabs = $('#box_content_kat_zakladki').tabs();
  $tabs.tabs('select', 0);
  $("#box_content_kat_zakladki").tabs({
			ajaxOptions: {
				error: function(xhr, status, index, anchor) {
					$(anchor.hash).html("Błąd ładowania zawartości. Jeżeli problem się powtarza powiadom administratora strony o problemie");
				}
			}
		});





  var $tabs_katalog_ogloszenia = $('#box_content_katalog_ogloszenia_zakladki').tabs();
  $tabs_katalog_ogloszenia.tabs('select', 0);
  $("#box_content_katalog_ogloszenia_zakladki").tabs({
			ajaxOptions: {
				error: function(xhr, status, index, anchor) {
					$(anchor.hash).html("Błąd ładowania zawartości. Jeżeli problem się powtarza powiadom administratora strony o problemie");
				}
			}
		});
		
		
		
	$(".phone_mask").mask("+99 9999999?999999",{placeholder:" "}); 
	
	
	//
	$("#send_mail_ads").colorbox({iframe:true, width:"450px", height:"200px"});
	
	
	$(".widget_help_right").hover(function(){
	$(".widget_help_right").stop(true, false).animate({right:"0"},"medium");
	},function(){
		$(".widget_help_right").stop(true, false).animate({right:"-205"},"medium");
	},500);  
	
	
});




function porownaj_wybrane(co_porownac) {
	params  = 'width='+screen.width;
	params += ', height='+screen.height;
	params += ', top=0, left=0'
	params += ', menubar=no, scrollbars=yes';
	url = '/porownaj_'+co_porownac+'.php';
	newwin=window.open(url,'windowname4', params);
	if (window.focus) {newwin.focus()}
	return false;
}

function zapamietane_oferty() {
	params  = 'width=730px';
	params += ', height='+screen.height;
	params += ', top=0, left=0'
	params += ', menubar=no, scrollbars=yes';
	url = '/zapamietane_oferty.php';
	newwin=window.open(url,'windowname4', params);
	if (window.focus) {newwin.focus()}
	return false;
}

myCallback = xajax.callback.create(100, 10000);
myCallback.onRequest = function()
{
	//xajax. $('loadingMsg').style.display = 'block';
	xajax. $('loadingMsgBox').style.display = 'block';
};
myCallback.onComplete = function()
{
	//xajax. $('loadingMsg').style.display = 'none';
	xajax. $('loadingMsgBox').style.display = 'none';
};


function drukuj(adr) {
	window.open(adr,
	"mywindow","location=1,status=1,scrollbars=1,width=730,height=600");

}


function openHelp(B, A) {
        var C = /^c\d+$/;
        param = "";
        tid = 0;
        if (!B) {
            B = 0;
            param = "?mm=1"
        }
        more_param = "";
        if (A) {
            more_param = "&statsec=300&statlnk=2"
        }
        if (C.test(B)) {
            tid = B.substring(1, B.length)
        }
        if (B == 0 && tid == 0) {
            helpwindow = window.open("/help.php" + param + more_param, "anew", config = "height=400,width=450,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,directories=no,status=no")
        } else {
            if (tid > 0) {
                helpwindow = window.open("/help.php?tid=" + tid + more_param, "anew", config = "height=400,width=450,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,directories=no,status=no")
            } else {
                helpwindow = window.open("/help_item.php?item=" + B + more_param, "anew", config = "height=400,width=450,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,directories=no,status=no")
            }
        }
        if (!helpwindow.closed) {
            helpwindow.focus()
        }
    }

