﻿
// Set active css class name for provided element id
function SetActive(id) {
	var elt = document.getElementById(id);
	if (elt) elt.className = "active";
}

// Shows hidden html element and hides previously shown element
var toogleShowPreviousElement = null;

function toogleShow(id) {
	var elt = document.getElementById(id);
	if (elt != toogleShowPreviousElement) {
		if (elt) elt.style.display = "";
		if (toogleShowPreviousElement) toogleShowPreviousElement.style.display = "none";
		toogleShowPreviousElement = elt;
	}
}

// Shows/hides html element
function toogleShow2(id) {
	var elt = document.getElementById(id);
	if (elt) elt.style.display = (elt.style.display == "none") ? "" : "none";
}


// Add to favorites
function AddToFavorites(url, title) {
	if (window.sidebar) {
		// Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url, "");
	} else if (window.external) {
		// IE Favorite
		window.external.AddFavorite(url, title);
	}
}

// Opens url in popup window
function ShowPopup(url) {
	
	var params = "WIDTH=790,HEIGHT=500,scrollbars=yes,status=no,menubar=no,location=no,toolbar=no,resizable=no";
	window.open(url, "Bonitete", params).focus();
}

function popup(ime, url, w, h) {
	
	var x = (screen.availWidth - w - 10) / 2;
	var y = (screen.availHeight - h - 30) / 2;
	options = 'directories=no,hotkeys=no,menubar=no,resizable=no,scrollbars=yes,status=no,titlebar=no,toolbar=no,width=' + w + ',height=' + h;
	if (navigator.appName.indexOf("Microsoft") >= 0) {
		options += ',left=' + x + ',top=' + y;
	}
	else {
		options += ',screenX=' + x + ',screenY=' + y;
	}

	window.open(url, ime, options);
}
