function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function GetContent() {

   document.getElementById("sSite").value = document.getElementById("content").innerHTML
   //document.write('<input type="hidden" name="sSite" value="'+html+'">');
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
	eval(targ + ".location='" + selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}


function PokazZwin(id){
	var div = document.getElementById(id);

	if(div.style.display == 'none'){
		div.style.display = 'block';
	}else{
		div.style.display = 'none';
	}
}

var timeout = 250;
var timeoutObjectReferences = Array ();


function toggleCombo  (comboListDivId)
{
	//var comboListDivId = 'comboList';
	if ( document.getElementById ( comboListDivId ).style.display == 'none' )
	{
		showLayer ( comboListDivId );
	}
	else
	{
		hideLayer ( comboListDivId );
	}
}

function showLayer ( layerId )
{
	var onMouseOverEvent = 'clearTimeout( timeoutObjectReferences [\'' + layerId + '\'] )';
	var onMouseOutEvent = 'hideLayer(\'' + layerId + '\')';

	var objectReference = document.getElementById ( layerId );

	clearTimeout(timeoutObjectReferences [ layerId ] );

	objectReference.style.display = '';

	objectReference.onmouseout = function ()
	{
		//eval ( onMouseOutEvent );
	};

	document.onclick = function ()
	{
		eval ( onMouseOutEvent );
	};
	objectReference.onmouseover = function ()
	{
		eval ( onMouseOverEvent );
	};
}

function hideLayer ( layerId )
{
	timeoutObjectReferences [ layerId ] = setTimeout ( "document.getElementById ( '" + layerId + "' ).style.display = 'none'", timeout );
}

function ustawHidden(hidden,value,select,tekst,LayerToHide){
	document.getElementById (LayerToHide).style.display = 'none';
	document.getElementById(hidden).value=value;
	document.getElementById(select).innerHTML=tekst;
}

function drukuj(id,typ){
	displayWindow('drukuj.php?id='+id+'&typ='+typ,670,600);
}

function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height + 'resizable=no,scrollbars=no,menubar=no' );
}

function SendNewsletter(value)
{
 if (value == 0) document.getElementById('opcjanews').value='off';
 else document.getElementById('opcjanews').value='on';

 document.newsletter.submit();
}



//DODAJ DO ULUBIONYCH
function addToBookmarks( sTitle, sHref )
	{
	//Wersja skryptu 1.0
	//Modyfikacji dokonał: Krzysztof Samelko
	//Data: 2008-05-12

	if( window.sidebar && window.sidebar.addPanel )
		{
		//Gecko (Netscape 6 etc.) - add to Sidebar
		window.sidebar.addPanel( sTitle, sHref, '' );
		}
	else if( window.external && ( navigator.platform == 'Win32' || ( window.ScriptEngine && ScriptEngine().indexOf('InScript') + 1 ) ) )
		{
		//IE Win32 or iCab - checking for AddFavorite produces errors for no
		//good reason, so I use a platform and browser detect.
		//adds the current page page as a favourite; if this is unwanted,
		//simply write the desired page in here instead of 'location.href'
		window.external.AddFavorite( window.location.href, document.title );
		}
	else if( window.opera && window.print )
		{

		//window.open('js/opera_dodaj_do_ulubionych.php','','width=150,height=50');
		//Opera 6+ - add as sidebar panel to Hotlist
		return true;
		}
	else if( document.layers )
		{
		//NS4 & Escape - tell them how to add a bookmark quickly (adds current page,
		//not target page)
		window.alert( 'Proszę kilknąć Ctrl+D aby dodać strone do ulubionych' );
		}
	else
		{
		//other browsers - tell them to add a bookmark (adds current page, not target page)
		window.alert( 'Proszę użyć menu przeglądarki by utworzyć dodać strone do ulubionych' );
		}
	return false;
	}
//DODAJ DO ULUBIONYCH

function navHover() {

	var lis = document.getElementById("navmenu").getElementsByTagName("LI");
	for (var i=0; i<lis.length; i++) {
		lis[i].onmouseover=function() {
			this.className+=" iehover";
		}
		lis[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" iehover\\b"), "");
		}
	}
}

function PokazZdjecieRef(id) {
    //symulacja kliknięcia na linka z podpiętym thickboxem
    $("#refer"+id).click();
}

$(document).ready(function(){
    if($.browser.msie) navHover();
    $('.onhover').hover(
        function(){ $(this).addClass('hover')},
        function(){ $(this).removeClass('hover')}
    );

    $('#rozwin').toggle(
        function() {
            $('#lista_instalacji').slideDown();
            $(this).html(Translator.zwin+' <img src="/template/img/zwin.jpg" alt=""/>');
        },
        function() {
            $('#lista_instalacji').slideUp();
            $(this).html(Translator.rozwin+' <img src="/template/img/rozwin.jpg" alt=""/>');
        }
    );

});