var bktf = 0 ;
function rogi_srt_gl()
{
	$('#logowanie').corner();
	$('#top_menu').corner();
}
function notoaniaDrukuj(typ,kat)
{
	var dane = '';
	
	if(typ == 'ALL') { dane = typ;}
	else
	{
		for(i = 0; notowaniaLL > i ; i++)
		{
			if(document.getElementById('notC_'+i) && document.getElementById('notC_'+i).checked == true )
				{dane += document.getElementById('notC_'+i).value+";";}
		}
	}
	
	window.open ("drukuj_notowanie.php?kat="+kat+"&dane="+dane,"mywindow","location=1,status=1,scrollbars=1,width=500,height=500"); 
}
function sondaG()
{
	document.getElementById('form_operacja').value = 'fsonda';
	document.getElementById('form_sonda').action = '';
	document.getElementById('form_sonda').submit();
}
function wyszukaj()
{
	document.getElementById('form_wyszukiwania').action = "index.php?strona=wyszukiwarka";
	document.getElementById('form_wyszukiwania').submit();
}
function wyszukiwarka_np(lp)
{
	document.getElementById('wyszukiwarka_npg').action = "index.php?strona=wyszukiwarka&p="+lp;
	document.getElementById('wyszukiwarka_npg').submit();
}
function plan3D(id)
{
	$("#tresc_3d").load("ajax.php?typ=plan3d&id="+id);
}
function ktf(id)
{
	if(bktf!= '')
		{document.getElementById('ktf_'+bktf).style.display='none';}
		
	bktf = id;
	document.getElementById('ktf_'+bktf).style.display='';		
}
function ktfp(page,kat)
{
	$("#contentKF").load("ajax.php?typ=katalog_firm&page="+page+"&kat="+kat);	
}
function notowaniaWK(id)
{
	$("#NotowaniSWA").load("ajax.php?typ=notowaniKat&kat="+id);	
}
function notowaniaWKS()
{
	var dane = document.getElementById("prodkutNsrch").value ;
	if(dane != '')
	{$("#NotowaniSWA").load("ajax.php?typ=notowaniaSzukaj&txt="+dane);}	
}
function validacjaTYP(cel,typ)
{
	if($(cel))
	{ 
		var vartosc = $(cel).value;
		
		if(typ=='select')
		{
			if(vartosc=='' || vartosc=='0')
			{
				$(cel).style.backgroundColor="#FFD9D9";
				return false;
			}
			else
			{
				$(cel).style.backgroundColor="#ECFFEC";
				return true;
			}	
		}

		if(typ=='tekst')
		{
			if(vartosc=='')
			{
				$(cel).style.backgroundColor="#FFD9D9";
				return false;
			}
			else
			{
				$(cel).style.backgroundColor="#ECFFEC";
				return true;
			}	
		}
		if(typ=='email')
		{
			if(vartosc=='')
			{
				$(cel).style.backgroundColor="#FFD9D9";
				return false;
			}
			else
			{
				if(vartosc.indexOf('@')>-1 && vartosc.indexOf('.')>-1)
				{
					$(cel).style.backgroundColor="#ECFFEC";
					return true;		
				}
				else
				{
					$(cel).style.backgroundColor="#FFD9D9";
					return false;
				}
			}	
		}
		if(typ=='liczba')
		{
			if(vartosc=='')
			{
				$(cel).style.backgroundColor="#FFD9D9";
				return false;
			}
			else
			{
				vartosc = parseFloat(vartosc );
				if(isNaN(vartosc))
				{
					$(cel).style.backgroundColor="#FFD9D9";
					return false;	
				}
				else
				{
					$(cel).style.backgroundColor="#ECFFEC";
					return true;	
				}
			}	
		}
	}
}
function JS_kontakt_form_send()
{
	var blad = '';	
	
	if(validacjaTYP('nazwa_firmy','tekst')!=true)
		{blad+="-"+SLOWNIK_BLAD+" '"+$('nazwa_firmyT').innerHTML+"' \r\n";}
	if(validacjaTYP('rodzaj_zapytania','tekst')!=true)
		{blad+="-"+SLOWNIK_BLAD+" '"+$('rodzaj_zapytaniaT').innerHTML+"' \r\n";}
	if(validacjaTYP('adres','tekst')!=true)
		{blad+="-"+SLOWNIK_BLAD+" '"+$('adresT').innerHTML+"' \r\n";}
	if(validacjaTYP('nip','tekst')!=true)
		{blad+="-"+SLOWNIK_BLAD+" '"+$('nipT').innerHTML+"' \r\n";}
	if(validacjaTYP('imie_nazwisko','tekst')!=true)
		{blad+="-"+SLOWNIK_BLAD+" '"+$('imie_nazwiskoT').innerHTML+"' \r\n";}
	if(validacjaTYP('emails','email')!=true)
		{blad+="-"+SLOWNIK_BLAD+" '"+$('emailT').innerHTML+"' \r\n";}
	if(validacjaTYP('telefon','tekst')!=true)
		{blad+="-"+SLOWNIK_BLAD+" '"+$('telefonT').innerHTML+"' \r\n";}
	if(validacjaTYP('tresc','tekst')!=true)
		{blad+="-"+SLOWNIK_BLAD+" '"+$('trescT').innerHTML+"' \r\n";}
	
	if(blad=='')
	{
		$('operacja').value = 'wysylka';
		$('form_kontaktowy').action = '';
		$('form_kontaktowy').submit();
	}
	else
		{alert(blad);}
}