function PagingIncPagPerPage(GUID, GUIDList)
{
 window.document.getElementById("PagPerPage"+GUID).value = parseInt(window.document.getElementById("PagPerPageList"+GUIDList).value) + 1;
 PaggingGo();
 return false;
}// end of function PagingIncPagPerPage

function PagingDecPagPerPage(GUID, GUIDList)
{
 if(parseInt(window.document.getElementById("PagPerPageList"+GUID).value) > 1)
 {
  window.document.getElementById("PagPerPage"+GUID).value = parseInt(window.document.getElementById("PagPerPageList"+GUIDList).value) - 1;
  PaggingGo();
 }
 return false;
}// end of function PagingDecPagPerPage

function PagingIncPage(GUID, GUIDList)
{
 if(parseInt(window.document.getElementById("PagCurrPageList"+GUIDList).value) < parseInt(window.document.getElementById("PagConstMaxPage"+GUIDList).innerHTML))
 {
  window.document.getElementById("PagCurrPage"+GUID).value = parseInt(window.document.getElementById("PagCurrPageList"+GUIDList).value) + 1;
  PaggingGo();
 }
 return false;
}// end of function PagingIncPage

function PagingDecPage(GUID, GUIDList)
{
 if(parseInt(window.document.getElementById("PagCurrPageList"+GUIDList).value) > 1)
 {
  window.document.getElementById("PagCurrPage"+GUID).value = parseInt(window.document.getElementById("PagCurrPageList"+GUIDList).value) - 1;
  PaggingGo();
 }
 return false;
}// end of function PagingDecPage

function changePerPage(GUID, GUIDList)
{
 window.document.getElementById("PagPerPage"+GUID).value = parseInt(window.document.getElementById("PagPerPageList"+GUIDList).value);
 PaggingGo();
}//end of function changePerPage()

function changeCurrPage(GUID, GUIDList)
{
 window.document.getElementById("PagCurrPage"+GUID).value = parseInt(window.document.getElementById("PagCurrPageList"+GUIDList).value);
 PaggingGo();
}//end of function changeCurrPage()

function goToCurrPage(GUID, page)
{
 window.document.getElementById("PagCurrPage"+GUID).value = page;
 PaggingGo(); 
 return false;
}// end of function goToCurrPage(GUID)

function PaggingGo(nosend)
{
 var PaggingValues = "";
 for(i=0;i <= arrPaggingGuid.length-1;i++)
 {
  PaggingValues += window.document.getElementById( "Pag" + arrPaggingGuid[i] ).value + ":";
  PaggingValues += window.document.getElementById( "PagPerPage" + arrPaggingGuid[i] ).value + ":";
  PaggingValues += window.document.getElementById( "PagCurrPage" + arrPaggingGuid[i] ).value + ";";
 }// end of for
 window.document.getElementById("PaggingValues").value = PaggingValues;
 window.document.getElementById("formPag"+GuidPaggingForm).PaggingValues.value = PaggingValues;
 if(!nosend)window.document.getElementById("formPag"+GuidPaggingForm).submit();
}// end of function PaggingGo

function GetPaggingString()
{
 var PaggingValues = "";
 if(typeof(arrPaggingGuid) != "undefined")
 {
  for(i=0;i <= arrPaggingGuid.length-1;i++)
  {
   PaggingValues += window.document.getElementById( "Pag" + arrPaggingGuid[i] ).value + ":";
   PaggingValues += window.document.getElementById( "PagPerPage" + arrPaggingGuid[i] ).value + ":";
   PaggingValues += window.document.getElementById( "PagCurrPage" + arrPaggingGuid[i] ).value + ";";
  }// end of for
 }
 return "PaggingValues=" + PaggingValues;
}

function GetPaggingStringValue()
{
 var PaggingValues = "";
 if(typeof(arrPaggingGuid) != "undefined")
 {
  for(i=0;i <= arrPaggingGuid.length-1;i++)
  {
   PaggingValues += window.document.getElementById( "Pag" + arrPaggingGuid[i] ).value + ":";
   PaggingValues += window.document.getElementById( "PagPerPage" + arrPaggingGuid[i] ).value + ":";
   PaggingValues += window.document.getElementById( "PagCurrPage" + arrPaggingGuid[i] ).value + ";";
  }// end of for
 }
 return PaggingValues;
}

function AnchorWithPagging(href)
{
 window.document.location.href = href + "&" +GetPaggingString();
}

function count(obj, IDCount, strAlert, len1) {
	len = obj.value.length;
	if (len>len1)
	{
	 alert(strAlert);
	 obj.value = obj.value.substring(0, len1);
	 len = len1;
	}
	document.getElementById(IDCount).value = len;
}// counter for  textarea count of chars


function getSelectValueById(IdSelect)
{
	return document.getElementById(IdSelect).options[document.getElementById(IdSelect).selectedIndex].value;
}// end of function getSelectValue(oSelect)

function GenerateDirectory(oChbAutoUpdate, oInptName, nameInptDirectory)
{
	var re;
	TmpName = oInptName.value;
	TmpName = TmpName.toLowerCase();
	CharsOld = "ěščřžýáíéůúťďňóабвгдежзийклмнопрстуфцчшщыэüöä";
	CharsNew = "escrzyaieuutdnoabvgdezzijklmnoprstufccswyeuoa";
	lenInput = TmpName.length;
	Output = "";
	for(i=0; i<lenInput; i++)
	{
		c = TmpName.charAt(i);
		k = CharsOld.indexOf(c);
		if (k==-1) z=c;
  		else  z=CharsNew.charAt(k);
  		//c2=TmpName.charAt(i+1);
	  	if (c=='ё')  { z='jo'; }
  	   	else if (c=='ю')  { z='ju'; }
  	  	else if (c=='я')  { z='ja'; }
  	  	else if (c=='ß')  { z='ss'; }
 		Output = Output+z;
	}
    re = /[^A-Za-z0-9]/g;        //Create regular expression pattern.
	Output = Output.replace(re, "-");
	if(document.getElementById(oChbAutoUpdate).checked)document.getElementById(nameInptDirectory).value = Output;
}// end of function GenerateDirectory(oInptName, nameInptDirectory)

function GenerateDirectoryArticle(oChbAutoUpdate, oInptName, nameInptDirectory, nameChkBCategory)
{
	var re, TmpName;
	TmpName = "";
	// get categories
	Categories = document.getElementsByName(nameChkBCategory);
	for(ii=0; ii<Categories.length; ii++)
	{
		if(Categories[ii].checked)
		{
			spanName = Categories[ii].parentNode.getElementsByTagName("SPAN");
			strName = spanName[0].innerHTML;
			TmpName = TmpName+strName+"-";
			break;
		}// end if
	}// end for
	// get article name
	TmpName = TmpName+oInptName.value;
	TmpName = TmpName.toLowerCase();
	CharsOld = "ěščřžýáíéůúťďňóабвгдежзийклмнопрстуфцчшщыэüöä";
	CharsNew = "escrzyaieuutdnoabvgdezzijklmnoprstufccswyeuoa";
	lenInput = TmpName.length;
	Output = "";
	for(i=0; i<lenInput; i++)
	{
		c = TmpName.charAt(i);
		k = CharsOld.indexOf(c);
		if (k==-1) z=c;
  		else  z=CharsNew.charAt(k);
  		//c2=TmpName.charAt(i+1);
	  	if (c=='ё')  { z='jo'; }
  	   	else if (c=='ю')  { z='ju'; }
  	  	else if (c=='я')  { z='ja'; }
  	  	else if (c=='ß')  { z='ss'; }
 		Output = Output+z;
	}
    re = /[^A-Za-z0-9]/g;        //Create regular expression pattern.
	Output = Output.replace(re, "-");
	if(document.getElementById(oChbAutoUpdate).checked)document.getElementById(nameInptDirectory).value = Output;
}// end of function GenerateDirectoryArticle(oInptName, nameInptDirectory)

/* Function for forms module*/
var len = 0;
function count(obj, IDCount, strAlert, len1) {
	len = obj.value.length;
	if (len>len1)
	{
	 alert(strAlert);
	 obj.value = obj.value.substring(0, len1);
	 len = len1;
	}
	if(IDCount && document.getElementById(IDCount))document.getElementById(IDCount).innerHTML = len;
}

function checkCountOfSelected(oSelect, cntMax, strAlert)
{
	cntSelected = 0;
	for(i=0;i<oSelect.options.length;i++)
		if(oSelect.options[i].selected)cntSelected++;
	if(cntSelected>cntMax)alert(strAlert);
}

function checkCountOfChecked(oCheckbox, cntMax, onlyOne)
{
	CntSelected = 0;
	Checkboxes = document.getElementsByName(oCheckbox.name);
	for(i=0;i<Checkboxes.length;i++)if(Checkboxes[i].checked)CntSelected++;
	if(CntSelected > cntMax)oCheckbox.checked = false;
}
