/* author: [EGOiST].[TeaM | TSRh].[ego1st.cjb.net] */
/* Creation date: 12.04.2008 */

// Ширина окна браузера
function sv_get_window_width() 
{
  var width = document.body.clientWidth;
  if (typeof(width)=="number") return width;
  else return 0;
}

// Получить все свойства объекта
function sv_dump(obj, obj_name) 
{
  var result = ""
  for (var i in obj)
    result += obj_name + "." + i + " = " + obj[i] + " ";
  return result;
}

function getObject(obj) { 
    var theObj 
    if (document.layers) { 
        if (typeof obj == "string") { 
            return document.layers[obj]
        } else { 
            return obj 
        } 
    } 
    if (document.all) { 
        if (typeof obj == "string") { 
		   if(document.all(obj)!=null) return document.all(obj);
		   else return null;
        } else { 
            return obj; 
        } 
    } 
    if (document.getElementById) { 
        if (typeof obj == "string") { 
            return document.getElementById(obj) 
        } else { 
            return obj 
        } 
    } 
    return null 
} 

// Отображение объекта
function show(obj) { 
  var theObj = getObject(obj);
  if (typeof theObj.style.visibility != "undefined") 
                                       theObj.style.visibility = "visible" 
  if (typeof theObj.style.display != "undefined") theObj.style.display = "block" 	
}

// Функция для скрытия объектов
function hide(obj)
{ 
  var theObj = getObject(obj) 
  if (typeof theObj.style.visibility != "undefined") 
                                       theObj.style.visibility = "hidden"
  if (typeof theObj.style.display != "undefined") theObj.style.display = "none" 		 
} 

var popup_img;
function show_image(img_url) {
  if (popup_img && !popup_img.closed)
  {
    popup_img.close(); 
  }	
  popup_img = window.open('/shared/img_popup.php?img='+img_url,'Image','width=500,height=400,scrollbars=no,toolbar=no,location=no,status=no,resizable=yes,screenX=120,screenY=100');
}

var popup_user_page;
function show_visitka(id_author) {

  if (popup_user_page && !popup_user_page.closed)
  {
    popup_user_page.close(); 
  }	
  popup_user_page = window.open('/forum/info.php?id_author='+id_author,'visitka','width=850,height=450,scrollbars=yes,toolbar=no,location=no,status=no,resizable=yes,screenX=120,screenY=100');
}

function open_in_parent(url, close) {
  if (close)
  {
    window.close();
  }
  opener.location.replace(url);
  //popup_user_page = parent.open('/forum/info.php?id_author='+id_author,'visitka','width=850,height=450,scrollbars=yes,toolbar=no,location=no,status=no,resizable=yes,screenX=120,screenY=100');
}

function open_in_new(url) {
  window.close();
  window.open(url);
  //popup_user_page = parent.open('/forum/info.php?id_author='+id_author,'visitka','width=850,height=450,scrollbars=yes,toolbar=no,location=no,status=no,resizable=yes,screenX=120,screenY=100');
}

function enterform() {
  show("enterform");
}