window.onresize = menu_center;

jsHover = function()
{
	var hEls = document.getElementById("globalNav").getElementsByTagName("LI");
	for (var i=0, len=hEls.length; i<len; i++) {
	  hEls[i].onmouseover=function() { this.className+=" jshover"; }
	  hEls[i].onmouseout=function() { this.className=this.className.replace(" jshover", ""); }
	}
}
  if (window.attachEvent && navigator.userAgent.indexOf("Opera")==-1) window.attachEvent("onload", jsHover);

var loc = document.location;
function getLoc(local)
{
var str = local.toString();
var search_pos = str.lastIndexOf('/');
return str.substring(0,search_pos);
}

var scr= getLoc(loc) + '/js/open.html';
function openImg(img)
{
var wn=window.open(scr+'?'+escape(img),'win','resizable,width=585,height=824,screenX=0,screenY=0,top=0,left=0');
wn.focus();
return false;
}

var menu_h;
function menu_center()
{
	var site_h = get_Height() - parseInt(document.getElementById("top").offsetHeight) - parseInt(document.getElementById("footer").offsetHeight);
	if(parseInt(document.getElementById("container").offsetHeight) < site_h)
		document.getElementById("container").style.height = site_h + "px";

	var menu_w = parseInt(document.getElementById("top").offsetWidth) - 3;
	if(window.innerWidth)
		menu_w = menu_w - 11;

	document.getElementById("globalnav").style.width = menu_w + "px";

	var menu_li_w = Math.round(menu_w/7);
	getElementsByClassName(document, "li", "b1")[0].style.width = 10 + "%";
	getElementsByClassName(document, "li", "b2")[0].style.width = 10 + "%";
	getElementsByClassName(document, "li", "b3")[0].style.width = 10 + "%";
	getElementsByClassName(document, "li", "b4")[0].style.width = 10 + "%";
	getElementsByClassName(document, "li", "b5")[0].style.width = 10 + "%";
	getElementsByClassName(document, "li", "b6")[0].style.width = 10 + "%";
	getElementsByClassName(document, "li", "b7")[0].style.width = 14 + "%";

	if(isNaN(menu_h))
	{
		menu_h = parseInt(document.getElementById("globalnav").offsetHeight);
	}
	getElementsByClassName(document, "li", "b1")[0].style.height = menu_h + "px";
	getElementsByClassName(document, "li", "b2")[0].style.height = menu_h + "px";
	getElementsByClassName(document, "li", "b3")[0].style.height = menu_h + "px";
	getElementsByClassName(document, "li", "b4")[0].style.height = menu_h + "px";
	getElementsByClassName(document, "li", "b5")[0].style.height = menu_h + "px";
	getElementsByClassName(document, "li", "b6")[0].style.height = menu_h + "px";
	getElementsByClassName(document, "li", "b7")[0].style.height = menu_h + "px";


	var logo_h = parseInt(document.getElementById("logo").offsetHeight);
	var left_img_h = parseInt(document.getElementById("left").offsetHeight);
	var contact_h = parseInt(document.getElementById("contact").offsetHeight);

	var container_left_h = parseInt(document.getElementById("container_left").offsetHeight);
	var getH = parseInt(get_Height());
	var newH = (getH - logo_h - left_img_h - container_left_h)/2;
	if(newH < 0) newH = 0;
		document.getElementById("container_left").style.paddingTop = newH + "px";

	if(navigator.appName == "Opera")
	{
		var opera_elem = getElementsByClassName(document, "td", "");
		for(i = 0;i < opera_elem.length; i++){ opera_elem[i].style.border = "#000000 1px solid";}
	}

}

function gotoHref1()
{
document.location.href="gal_privat_01.php";
}

function gotoHref2()
{
document.location.href="gal_privat_02.php";
}

function gotoHref3()
{
document.location.href="gal_privat_03.php";
}



function getElementsByClassName(oElm, strTagName, oClassNames){
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	var arrRegExpClassNames = new Array();
	if(typeof oClassNames == "object"){
		for(var i=0; i<oClassNames.length; i++){
			arrRegExpClassNames.push(new RegExp("(^|\\s)" + oClassNames[i].replace(/\-/g, "\\-") + "(\\s|$)"));
		}
	}
	else{
		arrRegExpClassNames.push(new RegExp("(^|\\s)" + oClassNames.replace(/\-/g, "\\-") + "(\\s|$)"));
	}
	var oElement;
	var bMatchesAll;
	for(var j=0; j<arrElements.length; j++){
		oElement = arrElements[j];
		bMatchesAll = true;
		for(var k=0; k<arrRegExpClassNames.length; k++){
			if(!arrRegExpClassNames[k].test(oElement.className)){
				bMatchesAll = false;
				break;
			}
		}
		if(bMatchesAll){
			arrReturnElements.push(oElement);
		}
	}
	return (arrReturnElements)
}

function get_Height()
{
if(document.body.clientHeight)
	return (document.body.clientHeight);//ie
else
	return innerHeight;//opera miozilla
}

function get_Width()
{
var w1, w2;
if(document.body.clientWidth)
	w1 = document.body.clientWidth;//ie
if(innerWidth)
	w2 = innerWidth;//opera miozilla
return (Math.min(w1, w2));
}

function wh()
{
   var width;
   if (document.body.offsetWidth) width = document.body.offsetWidth;
   else if (window.innerWidth) width = window.innerWidth  - 11;
   return width;
}