function getCenteredWindowFeatures(iw,ih) {
    var width = iw;
    var height = ih;
    var left = parseInt((screen.availWidth/2) - (width/2));
    var top = parseInt((screen.availHeight/2) - (height/2));
    var windowFeatures = "width=" + width + ",height=" + height + 
        ",left=" + left + ",top=" + top + 
        ",screenX=" + left + ",screenY=" + top;
    return windowFeatures;
}

function ZoomImage(bimg,dx,dy,title){
  dx = dx+10;
  dy = dy+10;
  wf = getCenteredWindowFeatures(dx,dy) 
  picWnd = window.open("imgzoom.html", "zoomWnd", "toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,"+wf+"");
  picWnd.window.focus();
  picWnd.document.write("<html><title>"+title+"</title><body onBlur=\"window.close()\" topmargin=\"2\" leftmargin=\"2\" marginheight=\"5\" marginwidth=\"0\"><div align=\"center\"><img src='"+bimg+"' align=\"absmiddle\"></div></body></html>");  
  picWnd.document.close();
  
  return false;
}

function ZoomGalleryImage(lnk,dx,dy){
  //dx = dx+40;
  //dy = dy+60;
  wf = getCenteredWindowFeatures(dx,dy) 
  picWnd = window.open(lnk, "zoomWnd", "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,"+wf+"");
  picWnd.window.focus();
}

//
function getPosition(obj) {
	var x=0, y=0;
	while(obj) {
	   x+=obj.offsetLeft;
	   y+=obj.offsetTop;
	   obj=obj.offsetParent;
	}//alert("x="+x+", y="+y);
	// 
	return {x: x, y:y};
}

//
function getWindowCenter() {
    var x = parseInt(screen.availWidth/2);
    var y = parseInt(screen.availHeight/2);
    //
    return {x: x, y:y};
}

//
function getScrollXY() {
  var x = 0, y = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    y = window.pageYOffset;
    x = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    y = document.body.scrollTop;
    x = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    y = document.documentElement.scrollTop;
    x = document.documentElement.scrollLeft;
  }
  //alert("x="+x+", y="+y);
  return {x: x, y: y};
}

//
function showBlock(obj,x,y,_action){
	if(_action=='show'){
		obj.style.left = x+'px';
		obj.style.top = y+'px';
		obj.style.display = 'block';
	} else {
		obj.style.display = 'none';
	}
}

//set correct Wrapper
function setWrapper(){
	if(screen.availWidth > 1024)		
		document.getElementById("Wrapper").id = "WrapperBig";
}