function get(id) { if (document.getElementById(id)) { return document.getElementById(id); } return false; } function changeValue(check,checkValue,insertValue) { if (get(check)) { if(get(check).value==checkValue) { get(check).value=insertValue; } return true; } return false; } function replace(check,checkValue,insertValue) { if (get(check)) { get(check).value=get(check).value.replace(checkValue,insertValue); return true; } return false; } function change(id,action,insertValue) { if (get(id)) { switch (action) { case 'action': get(id).action=insertValue; break; case 'style.background': get(id).style.background=insertValue; break; case 'style.border': get(id).style.border=insertValue; break; case 'checked': get(id).checked=insertValue; break; case 'disabled': get(id).disabled=insertValue; break; case 'html': get(id).innerHTML=insertValue; break; default: get(id).value=insertValue; break; } return true; } return false; } function style(id,action,insertValue,checkValue) { if (get(id)) { if(checkValue==0) { switch (action) { case 'display': get(id).style.display=insertValue; break; } return true; } else { switch (action) { case 'display': get(id).style.display==checkValue?style(id,action,insertValue,0):style(id,action,checkValue,0); break; } return true; } } return false; } function checkAll(name) { var i=0; if(!name) { name='check'; } if(get(name + '_all').checked==true) { while(change(name + '_' + i++,'checked',true)); } else { while(change(name + '_' + i++,'checked',false)); } } function hide(id,str,type) { if(type==1) { if(get(id).value==str) get(id).value=''; } else { if(get(id).value=='') get(id).value=str; } } function is_ip_required(input, ip_input, domains) { var ns_name=input.value; oip_input=document.getElementById(ip_input); for (var i=0; i < domains.length; i++) { var r=new RegExp('(^|\\.)'+domains[i]+' *$', 'i'); if (r.test(ns_name)) { oip_input.style.display='block'; if (!oip_input.value) { oip_input.value='Wprowad¼ adres IP'; } return; } } oip_input.value=''; oip_input.style.display='none'; }