
var gallery = document.getElementById('gallery');
	if (gallery) {
		gallery.style.left = "0px";
		gallery.style.position  = "relative";
	}
function scrolling(step, direction) {
	if (!gallery.style.left) { 
		gallery = document.getElementById('gallery');
		gallery.style.left = "0px";
		gallery.style.position  = "relative";
	}
	var left = parseInt(gallery.style.left);
	if (direction==1 && ( left-document.body.clientWidth+gallery.clientWidth)>=0) {
		left -= step;
	}
	if(direction!=1 && left<0) {
		left += step;
	}
	gallery.style.left = left+"px";	
}
var csroll_interval;
function startscroll(direction){
	csroll_interval=setInterval("scrolling(50, '"+direction+"')", 50);
}
function stopscroll(){
	clearInterval(csroll_interval);
}

function popup(pic_big, pic_descr, pic_name, pic_year, pic_author, pic_implement, pic_size, width, height, pic_mega_big){
	if (!document.getElementById("popup")) {
		var elem = document.createElement("div");
		document.body.appendChild(elem);
		elem.setAttribute("id", "popup");
	} else {
		elem = document.getElementById("popup");
	}
	var frame = window.frames["frame_"];
	if (!frame) {
		var frame = document.getElementById("frame_");
	}
	var doc = frame.contentWindow;
	if (!doc) {
		var doc = frame.document;
	} else {
		doc = doc.document;	
	}
	//elem = document.body.lastChild;
	elem.style.width     = "1px";
	elem.style.height    = "1px";
	elem.style.position  = "absolute";
	elem.style.overflov  = "visible";
	elem.style.top       = "200px";
	elem.style.left      = "200px";
	elem.style.zIndex    = 13;
	elem.style.background= "#F2F2F2";
	elem.innerHTML       = doc.body.innerHTML;
	document.getElementById("pic_name").innerHTML = pic_name;
	document.getElementById("pic_author").innerHTML = pic_author;
	document.getElementById("pic_implement").innerHTML = pic_implement;
	document.getElementById("pic_size").innerHTML = pic_size;
	document.getElementById("pic_year").innerHTML = pic_year;
	pic = document.getElementById("full_size_picture");
	pic.width = width;
	pic.height = height;
	pic.src = pic_big;
	var view_source = document.getElementById("view_source");
	view_source.href = "javascript:"+"var a = open_('/view.php?pic="+pic_mega_big+"');";
	view_source.onClick = "open_('/view.php?pic="+pic_mega_big+"');";
	//view_source.setAttribute("onClick", "window.open('"+"/pics/mega_big/"+pic_mega_big+"');");
	//alert(view_source.getAttribute("onClick"));
	//alert(view_source.onClick);
	/*var val = '';
	for(iterator in pic) {
		val += iterator + " (<font color=red>" + typeof(iterator) + "</font>)"+ pic[iterator] +"<br>\n";
	}
	elem.innerHTML += val;*/
}
function popdown(){
	document.body.removeChild(document.body.lastChild);
}

center_gallery(); 
function center_gallery() {
	gallery = document.getElementById('gallery');
	if (gallery && wether_center_gallery) {
		gallery.style.position  = "relative";
		gallery.style.left = (document.body.clientWidth - gallery.clientWidth)/2 + "px";
		//alert(gallery.style.left);
	}
}
function open_(loc){
	var my = window.open(loc, "my", "ststus=no, menubar=no, resizable=yes, scrollbars=yes");
	my.moveTo(0, 0);
	my.resizeTo(screen.width, screen.height);
	return false;
}
