// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

var is_open=false

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

function AssignPosition(d,obj_offset) {
  coords=findPos($(obj_offset))
  d.style.left = coords[0]+"px"
  d.style.top = coords[1]+"px"
}
function HideContent(d) {
  if(d.length < 1) { return; }
  document.getElementById(d).style.display = "none";
  is_open=false;
}
function ShowContent(d,obj_offset) {
  if (is_open) return
  is_open=true
  if(d.length < 1) { return; }
  var dd = document.getElementById(d);
  AssignPosition(dd,obj_offset);
  dd.style.display = "block";
}

display_window = function(str_title,str_url,i_width,i_height){
        agodos_win = new Window('agodos_window_id', {className:'darkX',title: str_title, width:i_width, height:i_height, resizable:false,closable:true,maximizable:false,minimizable:false,url:str_url});                         
        agodos_win.setDestroyOnClose(); 
        agodos_win.showCenter(true);       
    };
