//*** JS CORE FILE  ***//

// Show Big Image Window
function bigImage(id, width, height) {
	newwidth = width + 30;
	newheight = height + 50;
	
	var w = window.open("big.php?id="+id, "Big Image", "width=" + newwidth + ", height=" + newheight + ", scrollbars=yes");
	w.focus();
}

// Set Website Language
function setLanguage(lang) {
	document.location.href = "index.php?lang=" + lang;
}

// Clear Field Value
function clearfields(fld) {
	$(fld).value = "";	
}

// Submit Login Form
function login() {
	document.loginForm.submit();	
}

function goTop() {
	window.scrollTo(0, 0);	
}

function goBack() {
	history.back();	
}

// Menu
var menu = {
	menuOn: function(id, name) {
		$(id).src = "images/" + name + "_on.jpg";
		$(id).style.cursor = "pointer";
	},
	menuOff: function(id, name) {
		$(id).src = "images/" + name + "_off.jpg";
		$(id).style.cursor = "pointer";
	},
	menuClick: function(url) {
		document.location.href = url;
	},
	menuDefault: function(id, name) {
		$(id).src = "images/" + name + "_on.jpg";
		$(id).style.cursor = "pointer";
	}
}

// Scroll
var cursor = 0;
var viteza = 15;
var timeID;
var scrol = {
	sus: function(id) {
		cursor = (cursor - viteza)<0 ? 0 : (cursor-viteza);
		$(id).scrollTop = cursor;
		timeID = setTimeout("scrol.sus('"+id+"')", 60);
	},
	jos: function(id) {
		cursor += viteza;
		$(id).scrollTop = cursor;
		timeID = setTimeout("scrol.jos('"+id+"')", 60);
	},
	restart: function() {
		clearTimeout(timeID);	
	}
}

function showLocation(x, y) {
	var url = "setlocation.php?pozx=" + x + "&pozy=" + y;
	new Ajax.Request(url, {
		method: 'get',
		onSuccess: function(t) {
			$('location').innerHTML = t.responseText;
			//$('location').style.display = "block";
		}
	});
}

function showLocation2(x, y) {
	var url = "setlocation2.php?pozx=" + x + "&pozy=" + y;
	new Ajax.Request(url, {
		method: 'get',
		onSuccess: function(t) {
			$('location').innerHTML = t.responseText;
			//$('location').style.display = "block";
		}
	});
}
