//************************************************************************************************
// dodanie strony do ulubionych
function ulubione()
{
	if (document.all) { window.external.AddFavorite(location.href, document.title); }
	else if (window.sidebar) { window.sidebar.addPanel(document.title, location.href, "") }
	else if (window.opera && window.print) { window.external.AddFavorite(url, name); }
	else { alert('Przepraszamy! Ta funkcja nie jest obsługiwana dla Twojej przeglądarki.');}

}

function change_values(obj) {
   if (obj.value == obj.defaultValue)
      obj.value = "";
   else if (obj.value == "")
      obj.value = obj.defaultValue;
}


//**********************************************************************************************************************
// animuje dany obiekt przy pomocy wybranego efektu scriptoculos
// id - identyfikator elementu, efekt - nazwa efektu, ktory ma zostac uzyty, czas - opoznienie
function animuj(id,efekt,czas)
{
	setTimeout("Effect."+efekt+"('"+id+"')",czas);
}

//**********************************************************************************************************************
// zwija lub rozwija dany element
// id - identyfikator obiektu, efekt - nazwa efektu podstawowego
function animuj2(id,efekt)
{
	var efekt2 = 'Fade'; 
	
	switch(efekt)
	{
		case 'Appear' : { efekt2 = 'Fade'; break; }
		case 'SlideDown' : { efekt2 = 'BlindUp'; break; }
	}
	if (document.getElementById(id).style.display == 'none') { animuj(id,efekt,10); Set_Cookie( 'menulewe_'+id,  1); }
	else { animuj(id,efekt2,10); Set_Cookie( 'menulewe_'+id,  0); }
}


function txthover(id)
{
	var elem = document.getElementById(id);

	oldname = elem.className;
	
	if (oldname.indexOf('_hover') < 0) { newname = oldname.concat('_hover'); }
	else { newname = oldname.replace('_hover',''); }	
	elem.className = newname;
}


function lewa_boxy(typ)
{
	head = document.getElementById('lewa_'+typ);
	box = document.getElementById('lewabox_'+typ);

	animuj2(box.id,'SlideDown',10);
	
	
	if(typ=='menulewa' || typ=='menulewa2') {

		if (box.style.display == 'none') 
		{ 
			head.className = '';
			//animuj(box.id,'SlideDown',10); 
			head.innerHTML='zwiń <img src="_c/up2.gif" align="absmiddle" alt="zwiń">';
		}
		else 
		{
			head.className = '';
			//animuj(box.id,'BlindUp',10); 
			head.innerHTML='zobacz wszystkie działy <img src="_c/down2.gif" align="absmiddle" alt="zobacz wszystkie działy" />';
		}
	
	}
}



function Set_Cookie( name, value, expires, path, domain, secure )
{
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );

/*
if the expires variable is set, make the correct
expires time, the current script below will set
it for x number of days, to make it for hours,
delete * 24, for minutes, delete * 60 * 24
*/
if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );

document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}
	


// this fixes an issue with the old method, ambiguous values
// with this test document.cookie.indexOf( name + "=" );
function Get_Cookie( check_name ) {
	// first we'll split this cookie up into name/value pairs
	// note: document.cookie only returns name=value, not the other components
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f

	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		// now we'll split apart each name=value pair
		a_temp_cookie = a_all_cookies[i].split( '=' );


		// and trim left/right whitespace while we're at it
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');

		// if the extracted name matches passed check_name
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			// we need to handle case where cookie has no value but exists (no = sign, that is):
			if ( a_temp_cookie.length > 1 )
			{
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
			// note that in cases where cookie is initialized but no value, null is returned
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}
				
// this deletes the cookie when called
function Delete_Cookie( name, path, domain ) {
if ( Get_Cookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}


					/***********************************************
					* Cool DHTML tooltip script II- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
					* This notice MUST stay intact for legal use
					* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
					***********************************************/

					var offsetfromcursorX=12 //Customize x offset of tooltip
					var offsetfromcursorY=10 //Customize y offset of tooltip

					var offsetdivfrompointerX=10 //Customize x offset of tooltip DIV relative to pointer image
					var offsetdivfrompointerY=20 //Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1).

				//	document.write('<div id="dhtmltooltip"></div>') //write out tooltip DIV
					//document.write('<img id="dhtmlpointer" src="_c/arrow2.png">') //write out pointer image

					var ie=document.all
					var ns6=document.getElementById && !document.all
					var enabletip=false
					if (ie||ns6)
					var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

					var pointerobj=document.all? document.all["dhtmlpointer"] : document.getElementById? document.getElementById("dhtmlpointer") : ""

					function ietruebody(){
					return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
					}

					function ddrivetip(thetext, thewidth, thecolor){
					if (ns6||ie){
					if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
					if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
					tipobj.innerHTML=thetext
					enabletip=true
					return false
					}
					}

					function positiontip(e){
					if (enabletip){
					var nondefaultpos=false
					var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
					var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
					//Find out how close the mouse is to the corner of the window
					var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20
					var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20

					var rightedge=ie&&!window.opera? winwidth-event.clientX-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX
					var bottomedge=ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY

					var leftedge=(offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000

					//if the horizontal distance isn't enough to accomodate the width of the context menu
					if (rightedge<tipobj.offsetWidth){
					//move the horizontal position of the menu to the left by it's width
					tipobj.style.left=curX-tipobj.offsetWidth+"px"
					nondefaultpos=true
					}
					else if (curX<leftedge)
					tipobj.style.left="5px"
					else{
					//position the horizontal position of the menu where the mouse is positioned
					tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px"
					pointerobj.style.left=curX+offsetfromcursorX+"px"
					}

					//same concept with the vertical position
					if (bottomedge<tipobj.offsetHeight){
					tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px"
					nondefaultpos=true
					}
					else{
					tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px"
					pointerobj.style.top=curY+offsetfromcursorY+"px"
					}
					tipobj.style.visibility="visible"
					if (!nondefaultpos)
					pointerobj.style.visibility="visible"
					else
					pointerobj.style.visibility="hidden"
					}
					}

					function hideddrivetip(){
					if (ns6||ie){
					enabletip=false
					tipobj.style.visibility="hidden"
					pointerobj.style.visibility="hidden"
					tipobj.style.left="-1000px"
					tipobj.style.backgroundColor=''
					tipobj.style.width=''
					}
					}

					document.onmousemove=positiontip


