var fotowin = null;

function foto(id, width, height){
	fotowin = window.open("", "foto", "width =" +width +",height =" +height +",location=no,menubar=no,directories=no,toolbar=no,scrollbars=no,resizable=no,status=no");
	fotowin.document.write("<html><body leftmargin=\"0\" topmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\" marginwidth=\"0\"><img src=\"./mma_bin.php?src=mid&amp;id=" + id + "\"/></boby></html>");
	document.body.onfocus = closeFotoWin;
}

function foto_cnt(id, width, height){
	fotowin = window.open("", "foto", "width =" +width +",height =" +height +",location=no,menubar=no,directories=no,toolbar=no,scrollbars=no,resizable=no,status=no");
	fotowin.document.write("<html><body leftmargin=\"0\" topmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\" marginwidth=\"0\"><img src=\"./cnt_bin.php?id=" + id + "\"/></boby></html>");
	document.body.onfocus = closeFotoWin;
}

function foto_list(i, a){
	fotowin = window.open("", "foto", "width =" + a[i][1] +",height =" + a[i][2] +",location=no,menubar=no,directories=no,toolbar=no,scrollbars=no,resizable=no,status=no");
	fotowin.document.write("<html><head><title>foto</title><script type=\"text/javascript\">var i="+i+"; var a="+stringizeArray(a)+"</script></head><body leftmargin=\"0\" topmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\" marginwidth=\"0\"><div style=\"text-align:center\"><span style=\"cursor:pointer;margin:3px;color:blue;\" onclick=\"if (i<=0) {i=a.length-1} else {i--};window.resizeTo(a[i][1],a[i][2]); document.getElementById('desc').innerHTML=a[i][4]; document.getElementById('img').src='/mma_bin.php?src=mid&amp;id='+a[i][0]+''\">nazaj</span> | <span style=\"cursor:pointer;margin:3px;color:blue;\" onclick=\"if (i>=a.length-1) {i=0} else {i++}; window.resizeTo(a[i][1],a[i][2]); document.getElementById('desc').innerHTML=a[i][4]; document.getElementById('img').src='/mma_bin.php?src=mid&amp;id='+a[i][0]+''\">naprej</span></div><img id=\"img\" src=\"/mma_bin.php?src=mid&amp;id=" + a[i][0] + "\"/><br clear=\"all\"><div id=\"desc\" style=\"color: #333333; font-size:60%; margin-left :10px; margin-right :10px; margin-top :5px; font-family: Arial;\"  align=\"justify\">"+ a[i][4] +"</div></body></html>");
	fotowin.document.close();
	document.body.onfocus = closeFotoWin;
}

// create a string from an array to be used inside escaped javascript code
function stringizeArray(a) {
	var len = a.length;
	var s = "[";
	for (var i = 0; i < len; i++) {
		s += "[";
		var len2 = a[i].length;
		for (var j = 0; j < len2; j++) {
			if (j == 3 || j == 4) {
				s += "'";
			}
			s += a[i][j];
			if (j == 3 || j == 4) {
				s += "'";
			}
			if (j < (len2 - 1)) {
				s += ",";
			}
		}
		s += "]";
		if (i < (len - 1)) {
			s += ",";
		}
	}
	s += "]";
	return s;
}

function foto_addr(id, width, height){
	fotowin = window.open("", "foto", "width =" +width +",height =" +height +",location=no,menubar=no,directories=no,toolbar=no,scrollbars=no,resizable=no,status=no");
	fotowin.document.write("<html><body leftmargin=\"0\" topmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\" marginwidth=\"0\"><img src=\"./addr_bin.php?src=mid&amp;id=" + id + "\"/></boby></html>");
	document.body.onfocus = closeFotoWin;
}

function closeFotoWin() {
	if(fotowin != null && !(fotowin.closed)) {
		fotowin.close();
	}
}

/* rollover script */
/* Note: Changes target class to modify its looks */

/* mouse over */
function switchclass_over(which, className) {
	which.className=className+'On';
}

/* mouse out */
function switchclass_out(which, className) {
	which.className=className;
}

/* mouseover images */
function changeImages() {
	if (document.images) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = eval(changeImages.arguments[i+1] + ".src");
		}
	}
}
function switchOver(num)
{
	document['image'+num].src = eval("image" + num + "over.src");
}
function switchOff(num)
{
	document['image'+num].src = eval("image" + num + "off.src");
}