

function initFixIE() {
	fixEl1 = document.getElementById("main-cell");
	fixEl2 = document.getElementById("main-left-cell");
	fixEl3 = document.getElementById("main-right-cell");
	
	window.onresize = fixIE;
}

function fixIE() {
	fixEl1.style.display = "none";
	fixEl1.style.display = "";
	
	fixEl2.style.display = "none";
	fixEl2.style.display = "";
	
	fixEl3.style.display = "none";
	fixEl3.style.display = "";
}


function showRectImage(linkElem, width, height) {
  var x = (screen.width/2)-(width/2);
  if (x < 0) x=0;

  var y = (screen.height/2)-(height/2);
  if (y < 0) y=0;

  var settings="width="+width+",height="+height
			+",top="+y+",left="+x
			+",screenY="+y+",screenX="+x
			+",resizable=1,status=0,scrollbars=0";

  var win=window.open(linkElem.href, new Date().getTime(), settings);
  win.focus()
}

function initNewsletterForm() {
	newsletterEmailInput = document.getElementById('newsletter-email');
	newsletterEmailInput.onfocus = activateNewsletterForm;
	newsletterEmailInput.value = "wpisz adres e-mail";
	newsletterEmailInput.className = "inactive";
	
	var link = newsletterEmailInput.parentNode.getElementsByTagName('a')[0];
	link.onclick = function () {
		if (newsletterEmailInput.className) {
			newsletterEmailInput.value = "";
		}
		document.getElementById('news-form').submit();
		return false;
	}
}

function activateNewsletterForm() {
	newsletterEmailInput.className = "";
	newsletterEmailInput.value = "";
}

function nsFormInit() {
	nsForm = document.getElementById('ns-form');
	nsForm.onsubmit = function () {
		nsForm.action = "/newsletter_submit";
	}
}


function openPhoto(index) {

	var width = 750;
	var height = 585;
	
	var x=Math.round(screen.availWidth/2 - width/2)
	var y=Math.round(screen.availHeight/2 - height/2)
	if (x<0) x=0
	if (y<0) y=0
	var winSettings="width="+width+ ",height="+height+ ",resizable=1,status=1,scrollbars=0,location=0,left="+x+ ",top="+y

	winName = "JoganaturaPhoto";
	
	var photoURL = "zdjecie?index=" + index;
	
	win=window.open(photoURL,winName,winSettings);
	win.focus();
}




