
function initialize(){
    if (window.parent.scrollspeed!=0){
        speed=window.parent.scrollspeed
        scrollwindow()
    }
}

function scrollwindow(){
    direction = window.parent.direction;
    if (direction==0) {
        window.scrollBy(0,speed*(-1))
    }else{
        window.scrollBy(0,speed)
    }
}

function runScroller() {
    setInterval("initialize()",5)
}

function scroll(dir,isOn) {
    direction = dir
    scrollspeed = (isOn==1) ? 8 : 0
}

function page(src) {
	var frame = document.getElementById("mainframe")
	var title = document["title"]
	frame.src = "main.php?src=" + src;
	title.src = 'img/sections/' + src + '.gif';
}

function zamknij() {
	document.getElementById('divIMG').style.display = "none";
}

function schowajobr() {
	document.getElementById('powiekszenie').src = '../img/cp.gif';
	document.getElementById('divIMG').style.left = '-4000px';
	zapasscroll = -1;
}

function aktypoz() {
	 if (document.body && document.body.scrollTop)
		return document.body.scrollTop;
	 if (document.documentElement && document.documentElement.scrollTop)
		return document.documentElement.scrollTop;
	 if (window.pageYOffset)
		return window.pageYOffset;
	 return 0;
}

function obr(jaki) {
	var obj = document.getElementById('divIMG');
	obj.style.left = '0px';
	document.getElementById('powiekszenie').src = jaki;
	if (document.all&&document.documentElement.clientHeight) {
	   obj.style.height= document.documentElement.clientHeight+'px';
	}
	zapasscroll = aktypoz();
	obj.style.top = zapasscroll+'px';
}

function checkEmail(strValue) {
    var objRegExp = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
    return objRegExp.test(strValue);
}

function submitMailing() {
    var mailingForm = document.getElementById("mailingForm");
    var strValue = mailingForm.mail.value;
    if ( checkEmail(strValue) ) mailingForm.submit(); else alert('ENTER A PROPER E-MAIL ADDRESS!');
    return false;
}

function checkGuestbookForm() {
	var form = document.getElementById("guestbook_entry");
	if ( form.validate.value != "" ) return false;
	return true;
}

