function newsletterSubmit(lng) { 
ob = document.getElementById('newsletter');
if (ob) {
	
email = ob.value;
if (email.length > 6 && email.length < 30) {

advAJAX.get({
    url: "ajax_newsletter.php",
    parameters : {
      "email" : email,
	  "lang"  : lng
    },
    onSuccess : function(obj) { 
		//document.getElementById("newsletterAlert").innerHTML = obj.responseText; 
		alert(obj.responseText);
	}
});
}
else {
	alert('Niepoprawny email.');
	ob.focus();
}
}
}



function getCode() {
var start = 65;
var limit = 25;
var rand1 = Math.random();
var charCode1 = start + Math.round(limit * rand1);
var rand2 = Math.random();
var charCode2 = start + Math.round(limit * rand2);
var rand3 = Math.random();
var charCode3 = start + Math.round(limit * rand3);
var rand4 = Math.random();
var charCode4 = start + Math.round(limit * rand4);
var rand5 = Math.random();
var charCode5 = start + Math.round(limit * rand5);
var rand6 = Math.random();
var charCode6 = start + Math.round(limit * rand6);
ob = document.getElementById('verCode');
ob.innerHTML = String.fromCharCode(charCode1, charCode2, charCode3, charCode4, charCode5, charCode6);

ob = document.getElementById('code2');
ob.value = String.fromCharCode(charCode1, charCode2, charCode3, charCode4, charCode5, charCode6);

}



function szukaj_submit() {

	ob = document.getElementById('szuk_form');
	if (ob.szukaj.value == '') ob.szukaj.focus();
	else if (ob.szukaj.value.length < 3) ob.szukaj.focus();
	else ob.submit();

}

function wyslij_kontakt(form) {

	if (form.firma.value=='') {
	
		form.firma.focus();
		return false;
	
	}
	else 
	if (form.nazwisko.value=='') {
	
		form.nazwisko.focus();
		return false;
	
	}
	else 
	if (form.email.value=='') {
	
		form.email.focus();
		return false;
	
	}
	else 
	if (form.temat.value=='') {
	
		form.temat.focus();
		return false;
	
	}
	else 
	if (form.tekst.value=='') {
	
		form.tekst.focus();
		return false;	
	}	
	else 
	if (form.code.value != form.code2.value) {	
		form.code.focus();
		return false;	
	}		
	else return true;	

}

function sprawdz_logowanie (form) {

	if (form.klient.value=='') {
	
		form.klient.focus();
		return false;
	
	}
	else 
	if (form.haslo.value=='') {
	
		form.haslo.focus();
		return false;
	
	}
	else return true;	

}

function popup_swieta() {
	t=(screen.height-356)/2;
	l=(screen.width-500)/2;
	window.open ('popup_swieta.php','ZYCZENIA','width=500,height=356,top='+t+',left='+l+',scrollbars=NO');
}

function show_gallery(id, jezyk) {
	window.open ('zoom_gallery.php?lang='+jezyk+'&id='+id,'GALERIA','width=5,height=5,top=10,left=10,scrollbars=YES');
}

//wyswietla zdjecie
function show_pic(id) {
	window.open ('zoom.php?id='+id,'PIC','width=5,height=5,top=10,left=10,scrollbars=YES');
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

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 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];}
}


