function favorite() {

    var tytul = 'Salus International Sp. z o.o.';
    var adres = 'http://www.salusint.com.pl';

    //FireFox
    if (window.sidebar) {

        window.sidebar.addPanel(tytul, adres, "");

    //IE
    }  if (window.external) {

        window.external.AddFavorite(adres, tytul);

    //Opera
    }  if (window.opera && window.print) {

        var a = document.createElement('a');
        a.setAttribute('href', adres);
        a.setAttribute('title', tytul);
        a.setAttribute('rel','sidebar');
        a.click();
    }
}

function setHomePage()
{
 if (document.all)
    {
        document.body.style.behavior='url(#default#homepage)';
		document.body.setHomePage('http://www.salusint.com.pl');
 
    }
    else if (window.sidebar)
    {
    if(window.netscape)
    {
         try
   {  
            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
         }  
         catch(e)  
         {  
			 alert("Akcja zabroniona. Aby ja odblokować wpisz w tym celu about:config w wierszu adresu i kliknij dwukrotnie wpis signed.applets.codebase_principal_support, aby ustawić go na true");  
         }
    } 
    var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
    prefs.setCharPref('browser.startup.homepage','http://www.salusint.com.pl');
 }
}

var ie=document.all;
var nn6=document.getElementById&&!document.all; 

function Pokaz(warstwa){
	if (nn6){
		document.getElementById(warstwa).style.visibility = "visible"; 
		document.getElementById(warstwa).style.display = "block";	
	} else {
		document.all[warstwa].style.visibility = "visible"; 
		document.all[warstwa].style.display = "block";
	}
}

function Zaslon(warstwa){
	if (nn6){
		document.getElementById(warstwa).style.visibility = "hidden"; 
		document.getElementById(warstwa).style.display = "none";		
	} else {
		document.all[warstwa].style.visibility = "hidden"; 
		document.all[warstwa].style.display = "none";
	}
}




function deleteRowOnTable() {
     var tblBody = document.getElementById('tblInnerHTML');
	 if (tblBody.rows.length > 4){
		 tblBody.deleteRow( -1 );
		 tblBody.deleteRow( -1 );
	}
}


function addRowInnerHTML(num)
{

	var tblId = 'tblInnerHTML';
	var tblBody = document.getElementById(tblId).tBodies[0];

	var nextRow = document.getElementById(tblId).tBodies[0].rows.length;

	var iteration = nextRow + 1;
	if (num == null) { 
		num = nextRow;
	} else {
		iteration = num + 1;
	}

	//alert(iteration);

	var newRow = tblBody.insertRow(num);
	
	var newCell0 = newRow.insertCell(0);
	newCell0.innerHTML = 'Numer faktury: ';
	var newCell1 = newRow.insertCell(1);
	var txtInp = document.createElement('input');
	txtInp.setAttribute('type', 'text');
	txtInp.setAttribute('name', 'nr_faktury'+iteration);
	txtInp.setAttribute('size', '12');
	txtInp.setAttribute('maxlength', '10');
	txtInp.setAttribute('class', 'txt required');
	txtInp.setAttribute('value', ''); // iteration included for debug purposes
	newCell1.appendChild(txtInp);
	var newCell2 = newRow.insertCell(2);
	newCell2.innerHTML = 'Data faktury:';
	var newCell3 = newRow.insertCell(3);
	var txtInp = document.createElement('input');
	txtInp.setAttribute('type', 'text');
	txtInp.setAttribute('name', 'data_faktury'+iteration);
	txtInp.setAttribute('size', '12');
	txtInp.setAttribute('maxlength', '10');
	txtInp.setAttribute('class', 'txt required data_faktury');
	txtInp.setAttribute('value', ''); // iteration included for debug purposes
		
//	txtInp.onclick = function () {datepicker(this)}; // TODO tutaj trzeba chyba cos zrobic
	newCell3.appendChild(txtInp);		
	var newCell4 = newRow.insertCell(4);
	newCell4.innerHTML = '';
	var newCell5 = newRow.insertCell(5);
	newCell5.innerHTML = '';
	var newCell6 = newRow.insertCell(6);
	newCell6.innerHTML = '';

	var newRow1 = tblBody.insertRow(-1);
	var newCell0 = newRow1.insertCell(0);
	newCell0.innerHTML = 'Nazwa towaru: ';
	var newCell1 = newRow1.insertCell(1);
	var txtInp = document.createElement('input');
	txtInp.setAttribute('type', 'text');
	txtInp.setAttribute('name', 'nazwa_towaru'+iteration);
	txtInp.setAttribute('size', '12');
	txtInp.setAttribute('class', 'txt required');
	txtInp.setAttribute('value', ''); // iteration included for debug purposes
	newCell1.appendChild(txtInp);
	var newCell2 = newRow1.insertCell(2);
	newCell2.innerHTML = 'Seria:';		
	var newCell3 = newRow1.insertCell(3);
	var txtInp = document.createElement('input');
	txtInp.setAttribute('type', 'text');
	txtInp.setAttribute('name', 'seria'+iteration);
	txtInp.setAttribute('size', '10');
	txtInp.setAttribute('class', 'txt required');
	txtInp.setAttribute('value', ''); // iteration included for debug purposes
	newCell3.appendChild(txtInp);		
	var newCell4 = newRow1.insertCell(4);
	newCell4.innerHTML = 'Ilość:';
	var newCell5 = newRow1.insertCell(5);
	var txtInp = document.createElement('input');
	txtInp.setAttribute('type', 'text');
	txtInp.setAttribute('name', 'ilosc'+iteration);
	txtInp.setAttribute('size', '3');
	txtInp.setAttribute('class', 'txtshort required number');
	txtInp.setAttribute('value', ''); // iteration included for debug purposes
	newCell5.appendChild(txtInp);
	
	var newCell6 = newRow1.insertCell(6);
	newCell6.innerHTML = '';

	$('.data_faktury').datepicker({
		clickInput:true,
		yearRange: '-15:+0', 
		dateFormat: 'yy-mm-dd'
	});

}