window.onerror = null;

// slideshow params
if (typeof(tmrSlideShow) != 'undefined') clearTimeout(tmrSlideShow);
var slideShowOn = false;
var SLIDE_DELAY = 10000;
var slideShowFiles = new Array();

// browser detection
var ns4 = (document.layers);
var ie4 = (document.all && !document.getElementById);
var ie5 = (document.all && document.getElementById);
var ns6 = (!document.all && document.getElementById);

function getElm(id) {
	// Netscape 4
	if(ns4){
		return document.layers[id];
	}
	// Explorer 4
	else if(ie4){
		return document.all[id];
	}
	// W3C - Explorer 5+ and Netscape 6+
	else if(ie5 || ns6){
		return document.getElementById(id);
	}
}

function getContentWidth() {
	var elm = getElm('mainDisplay');
	var rc;
	rc = elm.offsetWidth;
	return rc;
}

function getContentHeight() {
	var elm = getElm('mainDisplay');
	var rc;
	rc = elm.offsetHeight;
	return rc;
}

function initDisplayWin() {
	var w = 150;
	var h = 150;
	var x = (screen.availWidth - w) / 2;
	var y = (screen.availHeight - h) / 2;
	window.resizeTo(w, h);
	window.moveTo(x, y);
}

function resizeMe() {
	getElm('loading').style.display = 'none';
	window.focus();
	var w = getContentWidth() + 30;
	var h = getContentHeight() + 70;
	var x = (screen.availWidth - w) / 2;
	var y = (screen.availHeight - h) / 2;
	window.resizeTo(w, h);
	window.moveTo(x, y);
	var w = getContentWidth() + 30;
	var h = getContentHeight() + 70;
	var x = (screen.availWidth - w) / 2;
	var y = (screen.availHeight - h) / 2;
	window.resizeTo(w, h);
	window.moveTo(x, y);
	if (slideShowOn == true) tmrSlideShow = setTimeout('nextSlide()', SLIDE_DELAY);
}

function voteForWork(workId) {
	rc = confirm('רק הצבעה אחת מתאפשרת. האם את/ה בטוח/ה?');
	return rc;
}

function artwork(PageToLoad,Names,w,h,s) {
		window.open(PageToLoad,Names,'width=' + w + ',height=' + h + ',toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars='+ s + ',resizable=no');
}

function slideShow(file1, file2, file3) {
	slideShowFiles[0] = file1;
	slideShowFiles[1] = file2;
	slideShowFiles[2] = file3;
	currSlide = 1;
	slideShowOn = true;
}

function nextSlide() {
	document.images['slide'].src = slideShowFiles[currSlide];
	currSlide++;
	if (currSlide == 3) currSlide = 0;
	tmrSlideShow = setTimeout('nextSlide()', SLIDE_DELAY);
}
