function open_win (path)
{
	open_custom(path,500,400);
}


function open_image_link_win(path)
{
	open_custom(path,504,500);
}

function open_image_link_win_big(path)
{
	open_custom(path,504,843);
}

function open_wysiwyg_win ( path )
{
	open_custom(path,800,700);
}

function open_wysiwyg_named_win (name, path)
{
	open_custom_named_win(name,path,800,700);
}

function open_filesmanager_win ( path )
{
	open_custom(path,600,450);
}

function open_link_win (path)
{
	open_custom(path,317,165);
}

function open_text_win ( path )
{
	open_custom(path,470,102);
}

function open_wysiwig_win_frontend ( path )
{
	open_custom(path,487,456);
}

function open_image(store,item)
{
	open_custom_with_location('/site/image/store' + store + '/item' + item,980,480,20,20);
}

function open_custom( path,width,height) 
{
	window.open(path, 'aWindow',' width=' + width + ', height=' + height + ', menubar=no, location=no, resizable=yes, hotkeys=no, directories=no, scrollbars=yes, toolbar=no, titlebar=no, status=no'); 
}

function open_custom_named_win(name,path,width,height) 
{
	window.open(path, name,' width=' + width + ', height=' + height + ', menubar=no, location=no, resizable=yes, hotkeys=no, directories=no, scrollbars=yes, toolbar=no, titlebar=no, status=no'); 
}

function open_custom_with_location( path,width,height,left,right) 
{
	window.open(path, 'aWindow',' width=' + width + ', height=' + height + ',  left=' + left + ', right=' + right + ',menubar=no, location=no, resizable=yes, hotkeys=no, directories=no, scrollbars=yes, toolbar=no, titlebar=no, status=no'); 
}

function open_win_update_field(destination_field,source_field)
{
	document.getElementById(destination_field).value = window.opener.document.getElementById(source_field).innerHTML;
}

function close_win_update_field(source_field,destination_field)
{
	window.opener.document.getElementById(destination_field).innerHTML = document.getElementById(source_field).value;
	self.close();
}

function replace_caption_text(source_field,destination_field)
{
	if (document.getElementById(destination_field).innerHTML == '' && document.getElementById(source_field))
	{
		document.getElementById(destination_field).innerHTML = document.getElementById(source_field).innerHTML;
	}
}

function set_edited_field()
{
document.getElementById('edited').innerHTML = '1';
}


function go_to_page(path,timeout)
{
	setTimeout('location = "' + path + '"',timeout);
}

function close_win()
{
	setTimeout("closeAndReload()",2000);
}

function closeAndReload()
{
	window.opener.location = getURLWithoutQueryString();
	self.close();
}

function getURLWithoutQueryString()
{
  var url = window.opener.location.href;
  var qparts = url.split("?");

  if (qparts.length == 0)
  {
    return url;
  }
  else
  {
    return qparts[0];
  }
}


      function center_image(ids){



       for(i=0;i<ids.length;i++){

       image_height = document.getElementById('image_'+ids[i]).height;
       image_width = document.getElementById('image_'+ids[i]).width;
       actual_left = (image_width/2)-26;
       actual_top = (image_height/2)-25;
       document.getElementById('video_button_'+ids[i]).style.top = actual_top+'px';
       document.getElementById('video_button_'+ids[i]).style.left = actual_left+'px';		
	
       }
	



      }

