function displayStatusMsg(msgStr) {

  status=msgStr;

  // document.MM_returnValue = true;

}



function ShowHide(elem, id)

{

  elem = document.getElementById(elem);

  if(elem != null)

  {

    if(elem.innerHTML == '[+]')

    {

      new Effect.BlindDown(id);

      new Effect.Appear(id);

      elem.innerHTML = '[&ndash;]';

      elem.title = "zwiń";

    }

    else

    {

      new Effect.BlindUp(id);

      new Effect.Fade(id);

      elem.innerHTML = '[+]';

      elem.title = "rozwiń";

    }

  }

}





function ajax_simple_updater( strUrl, strPlaceholder, strParams )

{

    var url = strUrl;

    var pars = strParams;

    var myAjax = new advAJAX.Updater(

    strPlaceholder,

    url,

        {

            method: 'get',

            parameters: pars,

            evalScripts: true

        }        

    )

}





function loadMarkets( cityId )

{

     advAJAX.get

    (

        {

            url: "/?module=Newsletter&action=LoadMarkets",

            parameters:

            {

                "cityId": cityId

            },

            onSuccess: function( obj )

            {

                document.getElementById( 'marketsDiv' ).innerHTML = obj.responseText;

            },

            onError: function( obj )

            {

                document.getElementById( 'marketsDiv' ).innerHTML = 'Wystąpił błąd, ponów.';

            }

        }

    );

  

}

function addProduct()

{

    len = document.getElementById( 'products' ).options.length;

	i = document.getElementById('allProducts').selectedIndex;

	document.getElementById( 'products' ).options[len] = new Option( document.getElementById( 'allProducts' ).options[ i ].text, document.getElementById('allProducts').value );

	document.getElementById( 'productSet[]' ).value = getProducts();

}

function delProduct()

{

    i = document.getElementById('products').selectedIndex;

	document.getElementById( 'products' ).options[i] = null;

    document.getElementById( 'productSet[]' ).value = getProducts();

}



function getProducts()

{

	len = document.getElementById( 'products' ).options.length;

	

	for ( i=0; i<len; i++ )

	{

		document.getElementById( 'products' ).options[i].selected = true;

	}

	

}



function loadNewspaper( newspaperId )

{

     advAJAX.get

    (

        {

            url: "/index.php?module=Gallery&action=LoadNewspaper",

            parameters:

            {

                "newspaperId": newspaperId

            },

            onSuccess: function( obj )

            {

                document.getElementById( 'newspaperDiv' ).innerHTML = obj.responseText;

            },

            onError: function( obj )

            {

                document.getElementById( 'newspaperDiv' ).innerHTML = 'Wystąpił błąd, ponów.';

            }

        }

    );

  

}

function loadMarketsForNewspaper( cityId )

{

     advAJAX.get

    (

        {

            url: "/?module=Gallery&action=LoadMarkets",

            parameters:

            {

                "cityId": cityId

            },

            onSuccess: function( obj )

            {

                document.getElementById( 'marketsDiv' ).innerHTML = obj.responseText;

            },

            onError: function( obj )

            {

                document.getElementById( 'marketsDiv' ).innerHTML = 'Wystąpił błąd, ponów.';

            }

        }

    );

  

}



function showHideDiv ( div )

{



    if (document.getElementById(div).style.display == 'none') 

	{

		document.getElementById(div).style.display = 'block';

	}

	else 

	{

		document.getElementById(div).style.display = 'none';

	}

}



var popbackground="white" //specify backcolor or background image for pop window

var windowtitle="Aktualna gazetka"  //pop window title



function detectexist(obj){

return (typeof obj !="undefined")

}



function jkpopimage(imgpath, popwidth, popheight, textdescription){



function getpos(){

leftpos=(detectexist(window.screenLeft))? screenLeft+document.body.clientWidth/2-popwidth/2 : detectexist(window.screenX)? screenX+innerWidth/2-popwidth/2 : 0

toppos=(detectexist(window.screenTop))? screenTop+document.body.clientHeight/2-popheight/2 : detectexist(window.screenY)? screenY+innerHeight/2-popheight/2 : 0

if (window.opera){

leftpos-=screenLeft

toppos-=screenTop

}

}



getpos()

var winattributes='width='+popwidth+',height='+popheight+',resizable=yes ,scrollbars=yes, left='+leftpos+',top='+toppos

var bodyattribute=(popbackground.indexOf(".")!=-1)? 'background="'+popbackground+'"' : 'bgcolor="'+popbackground+'"' 

if (typeof jkpopwin=="undefined" || jkpopwin.closed)

jkpopwin=window.open("","",winattributes)

else{

//getpos() //uncomment these 2 lines if you wish subsequent popups to be centered too

//jkpopwin.moveTo(leftpos, toppos)

jkpopwin.resizeTo(popwidth, popheight+30)

}



imgwidth	= parseInt (popwidth) - 30 ;

imgheight 	= parseInt (popheight) - 30 ;	 



jkpopwin.document.open()

jkpopwin.document.write('<html><title>'+windowtitle+'</title><body '+bodyattribute+' ><img src="'+imgpath+'" onclick="javascript:window.close()" style="margin-bottom: 0.5em; cursor:pointer;" ' + "width=" +imgwidth + "height="+ imgheight + '><br />'+textdescription+'</body></html>')

jkpopwin.document.close()

jkpopwin.focus()

}





function changeSerachCriteriaAtJobOffers( jobOffersCategoryId , provinceId , cityId )

{

     advAJAX.get

    (

        {

            url: "/?module=Text&action=ChangeJobOffersCategory",

            parameters:

            {

                "jobOffersCategoryId": jobOffersCategoryId,

                "provinceId": provinceId,

                "cityId": cityId

            },

            onSuccess: function( obj )

            {

                document.getElementById( 'ajax_offer_location' ).innerHTML = obj.responseText;

            },

            onError: function( obj )

            {

                document.getElementById( 'ajax_offer_location' ).innerHTML = 'ERROR: wrong AJAX responce';

            }

        }

    );

  

}








/* ------------------------ GMAPS ---------------------------------------- */


function Gload_front(lat, lng, zoom) 
{ 
	if (GBrowserIsCompatible()) { 
    	var map = new GMap2(document.getElementById("map"),
								{ //size:new GSize(310,270),
					     			size:new GSize(550,404),
								     draggableCursor:"move",
								     draggingCursor:"crosshair"
								} 
							);   

    	map.enableScrollWheelZoom(); 
		map.addControl(new GLargeMapControl());
		map.addControl(new GScaleControl());
		map.addControl(new GOverviewMapControl());
      	map.setCenter(new GLatLng(lat, lng), zoom); 

   
		map.hideControls();  
		GEvent.addListener(map, "mouseover", function(){map.showControls();});  
		GEvent.addListener(map, "mouseout", function(){map.hideControls();});  
       

		var markerExists = true;
		point_lat	=	parseFloat (document.getElementById("lat").value);
		point_lng	=	parseFloat (document.getElementById("lng").value);
		var point = new GLatLng(point_lat, point_lng);
		
		
 		var icon = new GIcon();  				
		icon.image = "./images/frontend/stokrotka_big.gif";							 
        icon.iconAnchor=new GPoint(12,12);
        icon.infoWindowAnchor = new GPoint(12,12);

		name	=	document.getElementById("hid_name").value;
		address	=	document.getElementById("hid_address").value;
		
		/*----- wylaczam godziny bo przy malej mapce sie nie miesci------------*/
		/*openHoures	=	document.getElementById("hid_openHoures").value;*/
		        
        var info = '<strong>' + name + '</strong>' ;
        if (address != ''){
        	info = info + '<br/>' + address ;
        }
        /*if (openHoures != ''){
        	info = info + '<br/>' + openHoures ;
        }
*/
        	
		var marker = createMarker (point, info, icon)

        map.addOverlay(marker);

	}
}

function createMarker(point, number , icon) 
{  
	var marker = new GMarker(point,icon);  
	GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml(number);
	});
	return marker;
	
	
}


function GUload(lat, lng, zoom, marker) 
{ 
    if (GBrowserIsCompatible()) 
	{ 
    	var map = new GMap2(document.getElementById("map")); 
		map.addControl(new GLargeMapControl());
		map.addControl(new GScaleControl());
		map.addControl(new GMapTypeControl());
		map.addControl(new GOverviewMapControl());
      	map.setCenter(new GLatLng(lat, lng), zoom);
		
		if (marker)
		{
			var point = new GLatLng(lat, lng);  
			var marker = new GMarker(point); 
			map.addOverlay(marker);
		}
    } 
}