function validate() {
    valid = true;

    if ( document.mailform.title.value == "" )
    {
        alert ( "Proszę podać tytuł wiadomości" );
        valid = false;
        return valid;
    }
    
    if ( document.mailform.body.value == "" )
    {
        alert ( "Proszę wpisać treść wiadomości" );
        valid = false;
        return valid;
    }
    
    if ( document.mailform.author.value == "" )
    {
        alert ( "Proszę podać swoje imię i nazwisko" );
        valid = false;
        return valid; 
    }
    
    if ( document.mailform.email.value == "" )
    {
        alert ( "Proszę podać adres e-mail" );
        valid = false;
        return valid; 
    }

    return valid;
}


function tg(ind,id,max){
	var showdiv = document.getElementById('switch'+ind+'div'+id)

	for (i=1; i<=max; i++) {
		hidediv = document.getElementById('switch'+ind+'div'+ i)
		hidediv.style.display = 'none'
		}

		showdiv.style.display = 'block'
}

function pokaz(ref) {
	if (ref) document.getElementById(ref).style.display = 'block';	
}

function ukryj(ref) {
	if (ref) document.getElementById(ref).style.display = 'none';	
}

function nS(user,domain) {
         locationstring = "mailto:" + user + "@" + domain;
         window.location = locationstring;
} 

function hideFlash() {
	ukryj('fastFlash');
	pokaz('slowFlash');
}

function showFlash() {
	ukryj('slowFlash');
	pokaz('fastFlash');
}

function setUserDate(pole, wartosc, slownie) {	
	document.getElementById(pole).value=(wartosc);     
	document.getElementById(pole + '_label').value=(slownie);   
	document.getElementById('calendar_' + pole).style.display = 'none';	
}

function inputFocus(id, inpID, action) {
	if (action == true) {
	document.getElementById(id).style.border='1px solid #242424';
	document.getElementById(id).style.color='#242424';
	document.getElementById(inpID).style.color='#edc85d';
	}
	
	if (action == false) {
		document.getElementById(id).style.border='1px solid #9b9b9b';
		document.getElementById(id).style.color='#7a7a7a';
		document.getElementById(inpID).style.color='#ffffff';
	}
}

function contactFocus(inpID, action) {
	if (action == true) {
	document.getElementById(inpID).style.color='#242424';
	document.getElementById(inpID).style.border='1px solid #000000';
	}
	
	if (action == false) {
		document.getElementById(inpID).style.color='#7a7a7a';
		document.getElementById(inpID).style.border='1px solid #cccccc';
	}
}

function isNumeric(sText)

{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }

function docList(year, doc, id) {
	
	document.getElementById('prelo_'+id).style.display='block';
	document.getElementById('list_'+id).style.display='none';
	
	ajaxpage('ajax/docList.php?'+year+','+doc+','+id, id, '');
	
}
