function import_JS(src){ var scriptElem = document.createElement("script"); scriptElem.setAttribute("src",src); scriptElem.setAttribute("type","text/javascript"); document.getElementsByTagName("head")[0].appendChild(scriptElem); } function import_JSNoCache(src){ var ms = new Date().getTime().toString(); var seed = "&d=" + ms; import_JS(src + seed); } function get_values_elements(form1, name1) { var elem = eval("form1."+name1); var value = 0; var a = []; var k = 0; if(elem!=null) { if(elem.disabled == true){ return a;} if(elem.length>0 && elem.type!='select-multiple' && elem.type != "select-one") { k = 0; for (i=0; i < elem.length; i++) { if(elem[i].checked) { a[k]= elem[i].value ; k++;} } } else a[0] = elem.value; if(elem.length>0 && elem.type!='select-multiple') { k = 0; for (i=0; i < elem.length; i++) { if(elem[i].checked) { a[k]= elem[i].value ; k++;} } return a; } } else { var elem = document.getElementsByName(name1+'[]'); if(elem.length>0 ) { k = 0; for (i=0; i < elem.length; i++) { if(elem[i].checked) { a[k]= elem[i].value ; k++;} } return a; }; } return a; } function in_array(value, array) { for(var i = 0; i < array.length; i++) { if(array[i] == value) return true; } return false; } function get_element_values(form1, name1) { var elem = eval("form1."+name1); var value = 0; if(elem!=null) { if(elem.length>0 && elem.type != "select-one") { for (i=0; i < elem.length; i++) if(elem[i].checked) value= elem[i].value ; } else value = elem.value; } return value; } function disabledChilds(doc, value) { for (var j = 0; j < doc.childNodes.length; j++) { elem = doc.childNodes[j]; if(elem.name!=null) { elem.disabled = value; } disabledChilds(elem, value); } } function get_notepad(object_id) { var req=new JsHttpRequest(); req.onreadystatechange=function() { if(req.readyState==4) { if(req.responseJS.notepad=='1')document.getElementById("notepad_object"+object_id).className = "npselect"; if(req.responseJS.notepad=='0')document.getElementById("notepad_object"+object_id).className = "npnoselect"; } } req.open(null,"https://vladimirstroy33.ru/index.php?option=com_ncatalogues&controller=ajax&task=getNotepad&object_type=26&object_id="+object_id,false); req.send({'object_id':object_id, 'object_type':'26','controller':'ajax', 'option':'com_ncatalogues', 'task':'getNotepad' }); } function add_to_notepad(object_id) { var req=new JsHttpRequest(); if(document.getElementById("notepad_object"+object_id).className == "npselect") document.getElementById("notepad_object"+object_id).className = "npnoselect"; if(document.getElementById("notepad_object"+object_id).className == "npnoselect") document.getElementById("notepad_object"+object_id).className = "npselect"; req.onreadystatechange=function() { if(req.readyState==4) { if(req.responseJS.notepad=='1')document.getElementById("notepad_object"+object_id).className = "npselect"; if(req.responseJS.notepad=='0')document.getElementById("notepad_object"+object_id).className = "npnoselect"; } } req.open(null,"https://vladimirstroy33.ru/index.php?option=com_ncatalogues&controller=ajax&task=addToNotepad&object_type=26&object_id="+object_id,false); req.send({'object_id':object_id, 'object_type':'26','controller':'ajax', 'option':'com_ncatalogues', 'task':'addToNotepad' }); } function notepadMOut(object_id) { if(njQuery("#notepad_object"+object_id).hasClass("npnoselectfocus") ) njQuery("#notepad_object"+object_id).removeClass("npnoselectfocus") ; } function notepadMOver(object_id) { njQuery("#notepad_object"+object_id).addClass("npnoselectfocus") ; } function previewImage(fieldname, id, water) { var req=new JsHttpRequest(); req.onreadystatechange=function(){ if(req.readyState==4) { document.getElementById('mainimage'+fieldname).innerHTML = req.responseText; } } req.open(null,"index.php?option=com_ncatalogues&controller=image&task=previewImage",true); req.send({'fieldname':fieldname, 'id':id, 'water':water}); }