
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;

	iw = width;
	ih = height;
	
	width = width + 20;
	
	if ((SW < width) && (SW > 0))
	{
		width = SW;
	}

	if ((SH < height) && (SH > 0))
	{
		height = Math.round(SH * 0.9);
	}
	
	var top = 5;
	//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=yes,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='' style='display:block;' />");
	my_window.document.writeln("<\/body><\/html>");
	my_window.document.close();
	
	return false;
}
//---------------------------------------------------------------

