kontrahenci = new Array

function dodaj_kontrahenta(kid, kname, klogo, imgWidth, imgHeight){
	this.kid = kid
	this.kname = kname
	this.klogo = klogo
	this.imgWidth = imgWidth
	this.imgHeight = imgHeight
}

var popupWindow
function pokazMape(){
		popupWindow = window.open('mapa.html', 'Mapa', 'height=400, width=500, menubar=no, status=no, toolbar=no, scrollbars=no, screenX=100, screenY=0, left=100, top=0')
}

var popupWindow2
function drukujMape(){
		popupWindow2 = window.open('mapa_druk.html', 'Mapa2', 'height=400, width=450, menubar=no, status=no, toolbar=no, scrollbars=yes, screenX=100, screenY=0, left=100, top=0')
}

var popupWindow3
function drukujWdrozenia(){
		popupWindow3 = window.open('wdrozenia_wydruk.html', 'Wdrozenia', 'height=700, width=600, menubar=no, status=no, toolbar=no, scrollbars=yes, screenX=100, screenY=0, left=100, top=0')
}

var popupWindow4
function pokazPopup(){
		popupWindow4 = window.open('phare_popup.html', 'PHARE', 'height=300, width=300, menubar=no, status=no, toolbar=no, scrollbars=no, screenX=100, screenY=0, left=100, top=0')
}

function Trim(s) {
	if (s) {
		return s.replace(/ +$|^ +/g,'')
	} else {
		return ''
	}
}      

function verifyForm(form){
	var message = "";
	
	if (Trim(form.firma.value).length == 0) {
		message = message + '- pole \"Nazwa firmy\" jest puste!\n';
	}
	
	if (Trim(form.adres.value).length == 0) {
		message = message + '- pole \"Dokładny adres\" jest puste!\n';
	}
	if (Trim(form.telefon.value).length == 0) {
		message = message + '- pole \"Telefon\" jest puste!\n';
	}
	if (Trim(form.cperson.value).length == 0) {
		message = message + '- pole \"Imię i Nazwisko osoby, z którą należy się kontaktować\" jest puste!\n';
	}
	if (Trim(form.surfer.value).length == 0) {
		message = message + '- pole \"Nazwisko osoby wypełniającej kwestionariusz\" jest puste!\n';
	}
	
	if (message.length > 0){
		message2 = 'Przy wysyłaniu formularza wystąpiły następujące błędy:\n\n';
		message3 = 'Aby przesłać do nas formularz musisz poprawnie wypełnić powyższe pola';
		message2 = message2 + message + "\n";
		message2 = message2 + message3;
		
		alert(message2);	
		return false;
	} else {
		return true;
	}
}

function check_email(email) {
    invalid = " /:,;";
    if(email == "") { return false }
    for(i=0; i < invalid.length; i++) {
        bad = invalid.charAt(i);
        if (email.indexOf (bad, 0) != -1) { return false }
    }
    at = email.indexOf("@", 0);
    if( (at == -1) || (at == 0) ) { return false }
    if(email.indexOf("@", at+1) != -1) { return false }
    period = email.indexOf(".", at);
    if( (period == -1) || (period == at+1) ) { return false }
    if(period+3 > email.length == -1) { return false }
    return true;
}
var tresc = ''
function openWindow(plik, width, height){
	var popupwindow;
	plik = plik + '.html'
	popupwindow = window.open(plik, 'popup', 'toolbar=no, status=no, menubar=no, scrollbars=auto, width=' + width + ', height=' + height + ' , top=0, left=0');
	
}

var tresc = ''
function openImage(zdjecie, width, height){
	var popupwindow;
	tresc='<HTML>\n<HEAD>\n'
	tresc += '<TITLE>DJB</TITLE>\n'
	tresc += '</HEAD>\n<BODY bottommargin="0" leftmargin="0" topmargin="0" rightmargin="0">\n'
	tresc += '<center><a href="javascript:window.close();"><img src="' + zdjecie + '" border=0></a></center>\n'
	tresc +=' </BODY>\n</HTML>\n'
	popupwindow = window.open('','List', 'toolbar=no, status=no, menubar=no, scrollbars=no, width=' + width + ', height=' + height + ' , top=0, left=0');
	popupwindow.document.open();
	popupwindow.document.write(tresc);
	popupwindow.document.close();
}

var tresc = ''
function openImage2(zdjecie, width, height, scrollbars){
	var popupwindow;
	tresc='<HTML>\n<HEAD>\n'
	tresc += '<TITLE>DJB - Referencje</TITLE>\n'
	tresc += '</HEAD>\n<BODY bottommargin="0" leftmargin="0" topmargin="0" rightmargin="0">\n'
	tresc += '<center><a href="javascript:window.close();"><img src="' + zdjecie + '" border=0></a></center>\n'
	tresc +=' </BODY>\n</HTML>\n'
	popupwindow = window.open('','List', 'toolbar=no, status=no, menubar=no, scrollbars=' + scrollbars + ', width=' + width + ', height=' + height + ' , top=0, left=0');
	popupwindow.document.open();
	popupwindow.document.write(tresc);
	popupwindow.document.close();
}

// ============================= efekt rollover ================================
if (document.images) {
	var rosja = new Image();
	rosja.src = "images/flaga_rosyjska.jpg"
	var rosja_over = new Image();
	rosja_over.src = "images/flaga_rosyjska_over.jpg"
	
	var ukraina = new Image();
	ukraina.src = "images/flaga_ukrainska.jpg"
	var ukraina_over = new Image();
	ukraina_over.src = "images/flaga_ukrainska_over.jpg"
}
	
function MouseOn(imageName){
	if (document.images){
		document.images[imageName].src = eval(imageName + "_over.src");
	}
}
function MouseOff(imageName){
	if (document.images){
   		document.images[imageName].src = eval(imageName + ".src");
	}
}
//============================ efekt rollover - koniec ===========================

