
function bookmarksite(title, url) {
	if (document.all)
		window.external.AddFavorite(url, title);
	else if (window.sidebar)
		window.sidebar.addPanel(title, url, "")
}
//---------------------------------------------------------------

function confirmSubmit() {
	var agree = confirm("Are you sure?");
	if (agree) return true ; else return false ;
}
//---------------------------------------------------------------

/*
	Removes the spaces from begin of string and from end.
	It means, if string is "  string   " it makes "string"
	Params:
		str string [string witch need to check]
*/
function trimString (str) {

	while (str.charAt(0) == ' ')
		str = str.substring(1);
	while (str.charAt(str.length - 1) == ' ')
		str = str.substring(0, str.length - 1);

	return str;
}
//---------------------------------------------------------------

/*
	Opens popup window, whitch is centered in screen
	Param:
		url string (link to the file you want to open)
		width int (window width)
		height int (window height)
*/
function OpenImagePopup(url,width,height) {
	var rnd = (Math.round((Math.random()*999)+1));

	var SH = screen.height;
	var SW = screen.width;

	if (SW < width)
	{
		newW = Math.round(SW * 0.95);
		dif = (newW * 100) / width;
		newH = Math.round((height * dif) / 100);
		height = newH;
		width = newW;
	}

	if (SH < height)
	{
		newH = Math.round(SH * 0.95);
		dif = (newH * 100) / height;
		newW = Math.round((width * dif) / 100);
		height = newH;
		width = newW;
	}

	var top = (screen.height) ? (screen.height-height)/2 : 0;
	var left = (screen.width) ? (screen.width-width)/2 : 0;

	iw = width;
	ih = height;
	my_window = window.open("", "w"+rnd, "top="+top+",left="+left+",width="+width+",height="+height+",buttons=no,scrollbars=no,location=no,menubar=no,resizable=no,status=no,directories=no,toolbar=no");
	my_window.document.writeln("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" "+"\"http://www.w3.org/TR/html4/strict.dtd\">");
	my_window.document.writeln("<html><head><title>Picture preview</title>");
	my_window.document.writeln("<meta http-equiv=\"Content-Script-Type\" ","content=\"text/javascript\"><\/head>");
	my_window.document.writeln("<body style='margin:0px;padding:0px;'>")
	my_window.document.writeln("<img src='" + url + "' onclick='window.close();' border='0' width='" + iw + "' height='" + ih + "' alt='' />");
	my_window.document.writeln("<\/body><\/html>");
	my_window.document.close();
}
//---------------------------------------------------------------

function showSubMenu(id_no)
{
	var id = "sub_" + id_no;
	if (document.getElementById(id))
	{
		document.getElementById(id).style.display = 'block';
	}
}
//---------------------------------------------------------------

function hideSubMenu(id_no)
{
	var id = "sub_" + id_no;
	if (document.getElementById(id))
	{
		document.getElementById(id).style.display = "none";
	}
}
//---------------------------------------------------------------

