
function openNewWindow(url)
{openNewWindow(url,480,120,'no','no');}
function openNewWindow(url,x,y,scrollbars,resizable)
{aPopUp=window.open('','VALLIST');aPopUp.close();aPopUp=self.window.open(url,'VALLIST','toolbar=no,location=no,directories=no,status=yes,scrollbars='+scrollbars+',resizable='+resizable+', copyhistory=no,width='+x+',height='+y+', screenX=0, screenY=0, left=0, top=0');self.aNoteWin=aPopUp;}
function openNewWindowNoClose(url,winTarget,x,y,scrollbars,resizable)
{window.open(url,winTarget,'toolbar=no,location=no,directories=no,status=yes,scrollbars='+scrollbars+',resizable='+resizable+', copyhistory=no,width='+x+',height='+y+', screenX=0, screenY=0, left=0, top=0');}
function openNewWindowFull(url,winTarget,x,y)
{window.open(url,winTarget,'menubar=yes,toolbar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,resizable=yes, copyhistory=no,width='+x+',height='+y+', screenX=0, screenY=0, left=0, top=0');}
function closeAndRefresh()
{window.opener.location.reload();window.close();}
function setAction(formName,action){form=document.forms[formName];form["F_ACTION"].value=action;}
function setField(formName,fieldName,fieldValue){document.forms[formName].elements[fieldName].value=fieldValue;}
function submitForm(formName,action){if(validate(action)){document.forms[formName].submit();}}
function setFieldAndSubmit(formName,fieldName,fieldValue){setField(formName,fieldName,fieldValue);submitForm(formName);}
function setAccept(formName){setField(formName,"F_ACCEPT_FORM","TRUE");}
function check(id,formName){form=document.forms[formName];currentSelected="currentSelected["+id+"].selected";form.elements[currentSelected].value=true;}
function confirmActionSubmit(formName,action,confirmAlert){if(confirm(confirmAlert)){actionSubmit(formName,action);}}
function actionSubmit(formName,action){setAction(formName,action);submitForm(formName,action);}
function acceptSubmit(formName){setAccept(formName);submitForm(formName,'');}
function acceptActionSubmit(formName,action){setAction(formName,action);setAccept(formName);submitForm(formName,action);}
function setAcceptSubmit(id,formName){check(id,formName);setAccept(formName);submitForm(formName,action);}
function checkAcceptSubmit(formName,action,id){check(id,formName);setAction(formName,action);setAccept(formName);submitForm(formName,action);}
function checkActionSubmit(formName,action,id){check(id,formName);setAction(formName,action);submitForm(formName,action);}
function setFieldActionSubmit(formName,fieldName,fieldValue,action){setField(formName,fieldName,fieldValue);setAction(formName,action);submitForm(formName,action);}
function submitActionForm(formName,action,id){var form=document.forms[formName];form.elements['id'].value=id;setAction(formName,action);submitForm(formName,action);}
function col(elem,ok){if(ok){elem.style.backgroundColor='#FFFFFF';return true;}else
elem.style.backgroundColor='#FFCC33';return false;}
function focusOnLoad(fieldName){if(document.forms[0]){with(document.forms[0]){if(fieldName!=''&&elements[fieldName]){elements[fieldName].focus();}else{for(var i=0;i<elements.length;i++){if(elements[i].type!='hidden'&&!elements[i].disabled&&!elements[i].readOnly){elements[i].focus();return true;}}}}}}
function doNothing(){return false;}
function disableLinks(obj){var links=obj?obj.getElementsByTagName('a'):document.getElementsByTagName('a');for(i in links){links[i].onclick=doNothing;}}
function disableInputs(obj){var fields=obj?obj.getElementsByTagName('input'):document.getElementsByTagName('input');for(i in fields){if(fields[i].type=='submit'||fields[i].type=='button'){fields[i].onclick=doNothing;}
fields[i].disabled=true;}}
function disableAllControls(obj){disableLinks(obj);disableInputs(obj);}
LIST_ANCHOR_NAME="list"
function goToRecordClick(formName){form=document.forms[formName];currentPage=form.elements['pagingFilter.pageNr'].value;currentSelected=form.elements['pagingFilter.itemsOnPage'].selectedIndex;itemsOnPage=form.elements['pagingFilter.itemsOnPage'][currentSelected].value;recordNumber=form.elements['goToRecord'].value;pageNumber=1;while((pageNumber*itemsOnPage)<recordNumber)
{pageNumber++;}
if((pageNumber-1)!=currentPage)
{pageNavigatorAction(formName,'pagingFilter.pageNr',pageNumber-1);}}
function sortByColumn(formName,column,order)
{form=document.forms[formName];form.elements['sortFilter.fieldName'].value=column;form.elements['sortFilter.sortOrder'].value=(order=='asc')?'true':'false';submitForm(formName);}
function sortByColumnJumpFirstPage(formName,column,order,formFieldName)
{form=document.forms[formName];form.elements['sortFilter.fieldName'].value=column;form.elements['sortFilter.sortOrder'].value=(order=='asc')?'true':'false';form.elements[formFieldName].value=0;document.forms[formName].action+='#'+LIST_ANCHOR_NAME
submitForm(formName);}
function pageNavigatorAction(formName,formFieldName,selectedPage)
{document.forms[formName].elements[formFieldName].value=selectedPage;document.forms[formName].action+='#'+LIST_ANCHOR_NAME
submitForm(formName);}
function setSelect(selectId,value)
{var sel=document.getElementById(selectId);for(var i=0;i<sel.length;i++){if(sel.options[i].value==value)
sel.selectedIndex=i;}}
function setAllPagingValues(sourceSelect){selectedValue=sourceSelect.value;var listForm=document.forms['listForm'];if(listForm!=null){listForm.reset();}
sourceSelect.value=selectedValue;var onPageCountSelects=document.getElementsByName("pagingFilter.itemsOnPage");if(onPageCountSelects.length>1){for(var i=1;i<onPageCountSelects.length;i++){onPageCountSelects[i].name="itemsOnPage"+i;}}
onPageCountSelects[0].value=selectedValue}
function switchElements(switcher,state,elementsTabName){var rozm=document.getElementsByName(elementsTabName).length;var disable=state;if($(switcher).checked){disable=!state;}
if(!rozm){rozm=1;}
for(i=0;i<rozm;i++){if(document.getElementsByName(elementsTabName).value){document.getElementsByName(elementsTabName).disabled=disable;}
else{document.getElementsByName(elementsTabName)[i].disabled=disable;}}}