/**
  * @package iPublikuj:CMS
  * @copyright	Copyright (C) 2007. All rights reserved.
  * @license http://www.studio81.cz
  * @author Adam Kadlec http://www.studio81.cz
*/

/**
 * iPublikuj 2.0 Hlavni javascriptove funkce
 *
 * @author		Adam Kadlec http://www.studio81.cz
 * @package		iPublikuj:CMS
 * @since		2.0
 * @version  	1.0
 */

/**
 * Funkce pro dialogove okno tisk stranky
 */
function goprn() {
	window.print();
}

/**
 * Funkce k odesilani formulare
 */
function submitbutton(pressbutton)
{
	submitform(pressbutton);
}
function submitform(pressbutton)
{

	if (pressbutton != "") {
		document.pageForm.task.value=pressbutton;
	}

	try {
		document.pageForm.onsubmit();
	}
	catch(e){}
	
	document.pageForm.submit();
}

function storeCaret(textEl) {
   if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}

function CloseOpenAllFields ( allFields, count_all, openFields, count_open )
{
	for (i=0; i<count_all; i++)  {
		var obj = document.getElementById('cat'+allFields[i]);

		obj.style.display = 'none';
	}
	for (i=0; i<count_open; i++)  {
		var obj = document.getElementById('cat'+openFields[i]);

		obj.style.display = 'block';
	}
}
