//JavaScript Document

/// otwieranie okienka na srodki

function popUp(url, width, height) {
//	if(screen.height < height){
  //  	okienko = open(url,"displayWindow",'width=' + (width + 2) + ',height=' + screen.height + ',resizable=0,scrollbars=yes,menubar=no,top=0,left=0');
	//	okienko.moveTo(screen.width/2-width/2, 0)
//	}else{
   	okienko = open(url,"displayWindow",'width=' + (width - 10) + ',height=' + height + ',resizable=0,scrollbars=auto,menubar=no,top=0,left=0');		
		okienko.moveTo(screen.width/2-width/2, screen.height/2-height/2)
//	}//end if
	okienko.focus();
}//end OpenNewWind

function show(divID){
	if (document.getElementById(divID).style.display == 'inline'){
		document.getElementById(divID).style.display = 'none';
	}else{
		document.getElementById(divID).style.display = 'inline';
	}//end if
	return false;
}//end function

function show2(divID){

	//alert(document.getElementById("prev").innerHTML);
	
	if (document.getElementById('reklamacje').style.display == 'inline'){
		document.getElementById('reklamacje').style.display = 'none';
	}//end if
	
	
	
	var tt = document.getElementById("prev").innerHTML;
	
	if(document.getElementById("prev").innerHTML != divID){
	
	if (document.getElementById(tt).style.display == 'inline'){
		document.getElementById(tt).style.display = 'none';
	}//end if
	
	document.getElementById("prev").innerHTML = divID;	
	}//end if
	

	if (document.getElementById(divID).style.display == 'inline'){
		document.getElementById(divID).style.display = 'none';
	}else{
		document.getElementById(divID).style.display = 'inline';
	}//end if
	return false;
}//end function



function validate(f){
	
	//dane do wysylki
	
		
	if(!f.komentarz.value.length) {
	    document.getElementById("uwaga").innerHTML = "Wpisz komentarz";
		f.komentarz.focus()
		return false;
	}


		
	//	alert(imie_s);

	var imie_s = f.imie.value;
	imie_s = imie_s.toUpperCase();

	if(!f.imie.value.length) {
	    document.getElementById("uwaga").innerHTML = "Uzupełnij Nick";
		f.imie.focus()
		return false;
		
  	}else if(imie_s.indexOf("PASKUD") != -1){
		document.getElementById("uwaga").innerHTML = "Podana nazwa jest zarezerwowana!";
		f.imie.focus();
	   	return false;
	}else if(imie_s.indexOf("LUDEK") != -1){
		document.getElementById("uwaga").innerHTML = "Podana nazwa jest zarezerwowana!";
		f.imie.focus();
	   	return false;
	}else if(imie_s.indexOf("ADMIN") != -1){
		document.getElementById("uwaga").innerHTML = "Podana nazwa jest zarezerwowana!";
		f.imie.focus();
	   	return false;
	}else if(imie_s.indexOf("MODERATOR") != -1){
		document.getElementById("uwaga").innerHTML = "Podana nazwa jest zarezerwowana!";
		f.imie.focus();
	   	return false;
	}

		return true;
	
}//end validate

function sprawdz255(f, x) {
  if (f.value.length>x-1) {
   // alert("mozesz wpisac tylko "+x+" znakow");
   f.value = f.value.substr(0,x)
   //f.disabled=true;
  }
}

function zaznacz(f) {
    //f.focus();
    f.select();
	
	//f.value = f.value;
    //f.blur();
}//end zaznacz

