var tartomany = "bonafini.hu";
var protokoll = "mailto";

function show_hide_layer(layerid) {
	if (layerid != "") {
		v = document.getElementById(layerid).style.visibility;
		if (v != "visible") v = "visible";
			else v = "hidden";
		document.getElementById(layerid).style.visibility = v;
	}
}

function hide_layer(layerid) {
	if (layerid != "") {
		cucc = eval("$(" + layerid + ");");
		cucc.fadeOut("normal");
	} // document.getElementById(layerid).style.visibility = "hidden";
}

function show_layer(layerid) {
	if (layerid != "") {
		cucc = eval("$(" + layerid + ")");
		cucc.fadeIn("normal");
	} // document.getElementById(layerid).style.visibility = "visible";
}


function open_close_layer(layerid) {
	if (layerid != "") {
		d = document.getElementById(layerid).style.display;
		if (d != "block") d = "block";
			else d = "none";
		document.getElementById(layerid).style.display = d;
	}
}

function close_layer(layerid) {
	document.getElementById(layerid).style.display = "none";
}

function open_layer(layerid) {
	document.getElementById(layerid).style.display = "block";
}


function level_kuldes(hova) {
	window.location = protokoll + ":" + hova + "@" + tartomany + "?subject=Informacio kerese";
}

function RightClicker() {
   return false;
}


function getPageSize() {
	var xScroll, yScroll;
	var xScrollPos = document.body.scrollLeft;
	var yScrollPos = document.body.scrollTop;
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}
	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight, xScrollPos, yScrollPos);
	return arrayPageSize;
};


function open_image(src, w, h) {
	var arrPageSizes = getPageSize();
	posx = Math.abs(Math.round((arrPageSizes[2]-w)/2));
	// posy = Math.abs(dy + Math.round((arrPageSizes[3]-h)/2));
	posy = arrPageSizes[5] + Math.abs(Math.round(arrPageSizes[3]/2 - h/2));
	out = '<div id="overlaycontainer" style="left: ' + posx + 'px; top: ' + posy + 'px; width: ' + (w+2) + 'px; text-align: center; ">'; // height: ' + (h+20) + 'px;
	out += '<img src="' + src + '" width="' + w + '" height="' + h + '" border="1" alt="" /></div>';
	$('body').append('<div id="whiteoverlay" style="display: none; position: absolute; top: 0; left: 0; z-index: 90; width: 100%; height: 100%;"></div>');
	$('body').append(out);
	
	$('#whiteoverlay').css({
		backgroundColor:	'#ffffff',
		opacity:			0.8,
		width:				arrPageSizes[0],
		height:				arrPageSizes[1]
	}).fadeIn("slow", function() {
		$('#overlaycontainer').fadeIn("slow");
		
	});
	
	$('#whiteoverlay').click(function() {
		$('#overlaycontainer').remove();
		$('#whiteoverlay').remove();
	});
	
	$('#overlaycontainer').click(function() {
		$('#overlaycontainer').remove();
		$('#whiteoverlay').remove();
	});
}

// document.oncontextmenu = RightClicker;
