
var PASSWORD_LENGTH=6
var runningInGecko=(navigator.product=='Gecko')
var runningInMSIE=(document.all!=null)
function getCssClass(obj){try{return obj.className;}catch(error){return'';}}
function setCssClass(obj,cls){try{obj.className=cls;return true;}catch(error){return false;}}
function setClass(obj,cls){return setCssClass(obj,cls);}
function hasCssClass(obj,cls){var all_classes=' '+getCssClass(obj)+' ';return(all_classes.indexOf(' '+cls+' ')!=-1);}
function addCssClass(obj,cls){if(!hasCssClass(obj,cls)){new_class=getCssClass(obj)+' '+cls;setCssClass(obj,new_class);}}
function replaceCssClass(obj,oldcls,newcls){if(hasCssClass(obj,oldcls)){new_class=getCssClass(obj).replace(oldcls,newcls);setCssClass(obj,new_class);}}
function validEmail(email){if(email=='')return true;reEmail=new RegExp("^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+[.][a-zA-Z]{2,7}$");return reEmail.test(email);}
function validDomainName(domain_name){if(domain_name=='')return true;reDomainName=new RegExp("^[a-zA-Z0-9._-]+[.][a-zA-Z]{2,7}$");return reDomainName.test(domain_name);}
function validUsername(username){if(username=='')return false;reLogin=new RegExp("^[a-zA-Z0-9_.-]{4,48}$");return reLogin.test(username);}
function validPasswd(passwd){if(passwd=='******')return true;if(passwd=='')return false;if(passwd.length<PASSWORD_LENGTH)return false;return true;}
function validUserPasswdPair(username,passwd){if(!validUsername(username))return false;if(!validPasswd(passwd))return false;if(passwd.toUpperCase()==username.toUpperCase())return false;if(passwd.search(username)!=-1)return false;return true;}
function validInteger(integer){if(integer=='')return true;reInteger=new RegExp("^[+-]?[0-9]+$");return reInteger.test(integer);}
function validPhone(phone){if(phone=='')return true;rePhone=new RegExp("^[+]?[0-9 ]{9,}$");return rePhone.test(phone);}
function validPhoneStrict(phone){rePhoneStrict=new RegExp("^420[0-9]{9}$");return rePhoneStrict.test(phone);}
function validICO(ico){if(ico=='')return true;reICO=new RegExp("^[0-9]{8}$");return reICO.test(ico);}
function validBankCode(code){reBC=new RegExp("^[0-9]{4}$");return reBC.test(code);}
function validBankAcount(code){reBA=new RegExp("^[0-9-]{4,34}$");return reBA.test(code);}
function valid_tax_no(tax_no){if(tax_no==''){return true;}
re_tax_no=new RegExp("^([a-zA-Z]{2}|[0-9]{3}-)[0-9]{8,10}$");return re_tax_no.test(tax_no);}
function validDIC(dic){return valid_tax_no(dic);}
function validPSC(psc){if(psc=='')return true;rePSC=new RegExp("^[0-9]{5}$");return rePSC.test(psc);}
function validZip(psc){return validPSC(psc);}
function validIpList(ip){if(ip=='')return false;reIpList=new RegExp("^([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}(/[0-9]{1,2})?(, )?)+$");return reIpList.test(ip);}
function openLink(url){linkWin=window.open(url,'linx','');}
var PicWinOpened=false;function previewImg(src,w,h,description){if(PicWinOpened){PicWin.close();PicWinOpened=false;}
winw=w+20;winh=h+30;PicWin=window.open('','picturedetail','width='+winw+',height='+winh+',resizable=no,location=no,status=no,scrollbars=no');with(PicWin){document.open();document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');document.write('<html xmlns="http://www.w3.org/1999/xhtml">');document.write('<head><title>'+description+'</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>');document.write('<body style="margin: 10px 0 0 0; padding: 0px; background-color: black; text-align:center; font-family: verdana,sans-serif; font-size: 11px;">');document.write('<a href="javascript: window.close();" title="Zavřít okno"><img src="'+src+'" alt="Zavřít okno" width="'+w+'" height="'+h+'" border="0" /></a>');document.write('<div style="color: white">'+description+'</div>');document.write('</body></html>');document.close();focus();};PicWinOpened=true;return false;};function getObject(objectName){try{if(document.all){obj=eval("document.all['"+objectName+"']");return obj;}else if(document.getElementById){return document.getElementById(objectName);}else{return false;}}catch(error){alert("Object find error: "+error);return false;}}
function debugObject(dbgObject){try{var debugLog="["+dbgObject.name+"]\n";var objectTitle="ID: "+dbgObject.id+", Name: "+dbgObject.name;}catch(error){var debugLog="[undefined]\n";var objectTitle="[undefined]\n";}
for(property in dbgObject){try{debugLog+='\t.'+property;debugLog+=' = '+eval('dbgObject.'+property)+"\n";}catch(error){debugLog+='\t.'+property+" = ???\n";}}
debugWin=window.open('','debug');with(debugWin){document.open();document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');document.write('<html xmlns="http://www.w3.org/1999/xhtml">');document.write('<head><title>Výpis objektu</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>');document.write('<body>\n');document.write('<h1>Výpis objektu - '+objectTitle+'</h1>');document.write('<pre>'+debugLog+'</pre>');document.write('</body>\n</html>\n');document.close();focus();}
return debugLog;}
function debugObjectByName(dbgObjectName){dbgObject=getObject(dbgObjectName);if(dbgObject){return debugObject(dbgObject);}else{return false;}}
function openWindowEx(url,window_name,width,height,left,top){win=open(url,window_name,'left='+left+',top='+top+',width='+width+',height='+height+',menubar=no,status=no,scrollbars=yes');win.focus();return true;}
function slGetObjectOffset(object){var result=new Object();result.offsetLeft=0;result.offsetTop=0;if(runningInMSIE){result.offsetLeft=object.offsetLeft;result.offsetTop=object.offsetTop;try{parentObject=object.offsetParent;while(parentObject){result.offsetLeft+=parentObject.offsetLeft;result.offsetTop+=parentObject.offsetTop;parentObject=parentObject.offsetParent;}}catch(error){alert("Error: "+error);}}else{result.offsetLeft=object.offsetLeft;result.offsetTop=object.offsetTop;}
return result;}
function slInputIsMultiple(input_object){return input_object.length&&input_object.item;}
function slMultipleInputIsChecked(input_object){try{input_object_length=input_object.length;for(item_counter=0;item_counter<input_object_length;item_counter++){if(input_object[item_counter].checked){return true;}}}catch(error){}
return false;}
function slMultipleInputGetValue(input_object){try{for(item_counter=0;item_counter<input_object.length;item_counter++){if(input_object[item_counter].checked){return input_object[item_counter].value;}}}catch(error){}
return null;}
function slMultipleInputSetValue(input_object,input_value){try{for(item_counter=0;item_counter<input_object.length;item_counter++){if(input_object[item_counter].value==input_value){input_object[item_counter].checked=true;return true;}}}catch(error){}
return false;}
function addLeadingZero(i){if(i.length==1){return'0'+i;}else{return i;}}
