function popupImg(img, title) {
   window.open('showpic.php?src='+img+'&title='+title, 'popupwindowname', 'width=800,height=600,status=no,menubar=no,location=no,toolbar=no');
}

function verifyemail_check(str) { 
		// przepuszcza adres mailowy
        if(!str.match(/^[\w]{1}[\w\.\-_]*@[\w]{1}[\w\-_\.]*\.[\w]{2,6}$/i)) {  //sam adres
			if (str.match(/<[\w]{1}[\w\.\-_]*@[\w]{1}[\w\-_\.]*\.[\w]{2,6}>$/i))  //nazwa i adres
				return true;
			else
		 		return false; 
        } else { 
            return true;
        }
} 

function isBlank(val){
	if(val==null){return true;}
	for(var i=0;i<val.length;i++) {
		if ((val.charAt(i)!=' ')&&(val.charAt(i)!="\t")&&(val.charAt(i)!="\n")&&(val.charAt(i)!="\r")){return false;}
		}
	return true;
}

function verifyContactForm (f) {
    var good=true;
    var s_alert="";

    if (!verifyemail_check(f.elements['email'].value)) {
        good=false;
        s_alert+="Niepoprawny adres e-mail.\r\n";
    }

    if (isBlank(f.elements['content'].value)) {
        good=false;
        s_alert+="Wpisz treść wiadomości.\r\n";
    }

    if (!good)
        alert(s_alert);
    return good;
}

