-1) {
var pos = temp.indexOf("", e_pos);
scripts.push(temp.substring(pos_e + 1, e_pos));
temp = temp.substring(0, pos) + temp.substring(e_pos_e + 1);
}
for (var i = 0; i < scripts.length; i++) {
try {
eval(scripts[i]);
console.log(scripts[i]);
} catch (err) {
console.error('Error loading javascript from AJAX response: ' + err.message);
console.log(scripts[i]);
}
}
}
this.runAJAX = function(urlstring) {
if (this.failed) {
this.onFail();
} else {
this.createURLString(urlstring);
if (this.element) {
this.elementObj = document.getElementById(this.element);
}
if (this.xmlhttp) {
var self = this;
if (this.method == "GET") {
totalurlstring = this.requestFile + this.queryStringSeparator + this.URLString;
this.xmlhttp.open(this.method, totalurlstring, true);
} else {
url = this.requestFile;
urlArray = url.split("?");
url = urlArray[0];
params = urlArray[1];
this.xmlhttp.open("POST", url, true);
try {
this.xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
if (!isChrome()) {
this.xmlhttp.setRequestHeader("Connection", "close");
}
this.xmlhttp.setRequestHeader("Content-length", params.length);
this.xmlhttp.send(params);
} catch (e) { }
}
this.xmlhttp.onreadystatechange = function() {
switch (self.xmlhttp.readyState) {
case 1:
self.onLoading();
break;
case 2:
self.onLoaded();
break;
case 3:
self.onInteractive();
break;
case 4:
self.response = self.xmlhttp.responseText;
self.responseXML = self.xmlhttp.responseXML;
self.responseStatus[0] = self.xmlhttp.status;
self.responseStatus[1] = self.xmlhttp.statusText;
if (self.execute) {
self.runResponse();
}
if (self.elementObj) {
elemNodeName = self.elementObj.nodeName;
elemNodeName.toLowerCase();
if (elemNodeName == "INPUT"
|| elemNodeName == "SELECT"
|| elemNodeName == "OPTION"
|| elemNodeName == "TEXTAREA") {
self.elementObj.value = self.response;
} else {
self.elementObj.innerHTML = self.response;
}
}
if (self.responseStatus[0] == "200") {
self.onCompletion();
} else {
self.onError();
}
self.URLString = "";
break;
}
};
// this.xmlhttp.send(this.URLString);
}
}
};
this.reset();
this.createAJAX();
}
function gotoAjaxURL(url, usercontent, execute) {
myAJAX = new sack();
if (execute == true){
myAJAX.execute = true;
}
myAJAX.method = "POST";
myAJAX.requestFile = url;
myAJAX.element = usercontent;
myAJAX.runAJAX();
}
function runAjaxURL(url, usercontent) {
var myAJAX;
myAJAX = new sack();
myAJAX.method = "POST";
myAJAX.requestFile = url;
myAJAX.element = usercontent;
myAJAX.elementObj = usercontent;
myAJAX.runAJAX();
}
function returnAjaxURL(url, userElement) {
var myAJAX;
myAJAX.method = "POST";
myAJAX = new sack();
myAJAX.requestFile = url;
myAJAX.elementObj = userElement;
myAJAX.runAJAX();
}
var ajaxBox_offsetX = 0;
var ajaxBox_offsetY = 0;
var ajax_list_externalFile = 'https://www.moletai.lt//remote.php?ru=Kr0pOtYan2&m=62&'; // Path to external file
var minimumLettersBeforeLookup = 2; // Number of letters entered before a lookup is performed.
var ajax_list_objects = new Array();
var ajax_list_cachedLists = new Array();
var ajax_list_activeInput = false;
var ajax_list_activeItem;
var ajax_list_optionDivFirstItem = false;
var ajax_list_currentLetters = new Array();
var ajax_optionDiv = false;
var ajax_optionDiv_iframe = false;
var ajax_list_MSIE = false;
if(navigator.userAgent.indexOf('MSIE')>=0 && navigator.userAgent.indexOf('Opera')<0)ajax_list_MSIE=true;
var currentListIndex = 0;
function ajax_getTopPos(inputObj)
{
var returnValue = inputObj.offsetTop;
while((inputObj = inputObj.offsetParent) != null){
returnValue += inputObj.offsetTop;
}
return returnValue;
}
function ajax_list_cancelEvent()
{
return false;
}
function ajax_getLeftPos(inputObj)
{
var returnValue = inputObj.offsetLeft;
while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetLeft;
return returnValue;
}
function ajax_option_setValue(e,inputObj)
{
if(!inputObj)inputObj=this;
var tmpValue = inputObj.innerHTML;
if(ajax_list_MSIE)tmpValue = inputObj.innerText;else tmpValue = inputObj.textContent;
if(!tmpValue)tmpValue = inputObj.innerHTML;
ajax_list_activeInput.value = tmpValue;
elementName = ajax_list_activeInput.name;
trueElementArray = elementName.split("__");
trueElementName = trueElementArray[0];
document.getElementById(trueElementName).value = inputObj.id;
if(document.getElementById(ajax_list_activeInput.name + '_hidden')) {document.getElementById(ajax_list_activeInput.name + '_hidden').value = inputObj.id;}
ajax_options_hide();
}
function ajax_options_hide()
{
if(ajax_optionDiv)ajax_optionDiv.style.display='none';
if(ajax_optionDiv_iframe)ajax_optionDiv_iframe.style.display='none';
}
function ajax_options_rollOverActiveItem(item,fromKeyBoard)
{
if(ajax_list_activeItem)ajax_list_activeItem.className='optionDiv';
item.className='optionDivSelected';
ajax_list_activeItem = item;
if(fromKeyBoard){
if(ajax_list_activeItem.offsetTop>ajax_optionDiv.offsetHeight){
ajax_optionDiv.scrollTop = ajax_list_activeItem.offsetTop - ajax_optionDiv.offsetHeight + ajax_list_activeItem.offsetHeight + 2 ;
}
if(ajax_list_activeItem.offsetTop
Valyti ';}
if (res == "-1") {mv.innerHTML = mv.innerHTML + elvalue;}
}
function ShowControl(evalue, elid) {
cs = myGetElementById(elid);
if (evalue > 1) {
cs.style.display="block";
} else {
cs.style.display="none";
}
}
function IsNumeric(sText) {
var ValidChars = "0123456789.";
var IsNumber=true;
var Char;
for (i = 0; i < sText.length && IsNumber == true; i++) {
Char = sText.charAt(i);
if (ValidChars.indexOf(Char) == -1) {
IsNumber = false;
}
}
return IsNumber;
}
function myParseDate(dvalue) {
var tvalue;
var pvalue;
var rvalue;
if ((dvalue.length > 10) || (dvalue.length < 8)) {return -1;}
var x = '.';
tvalue = dvalue.replace(x, '-');
tvalue = tvalue.replace(x, '-');
tvalue = tvalue.replace(x, '-');
pvalue = tvalue.split("-");
if ((pvalue[0].length < 4) || (pvalue[0].length > 4) || (pvalue[0] == null) || (IsNumeric(pvalue[0]) != true)) {return -1;}
if ((pvalue[1].length < 1) || (pvalue[1].length > 2) || (pvalue[1] == null) || (IsNumeric(pvalue[1]) != true)) {return -1;}
if ((pvalue[2].length < 1) || (pvalue[2].length > 2) || (pvalue[1] == null) || (IsNumeric(pvalue[2]) != true)) {return -1;}
rvalue = pvalue[0]*365*24*60*60+pvalue[1]*31*24*60*60+pvalue[2]*24*60*60;
return rvalue;
}
function myParseTime(dvalue) {
var tvalue;
var pvalue;
var rvalue;
if ((dvalue.length > 8) || (dvalue.length < 5)) {return -1;}
var x = "/./";
tvalue = dvalue.replace(x, ':');
pvalue = tvalue.split(":");
if ((pvalue[0].length < 1) || (pvalue[0].length > 2) || (pvalue[0] == null) || (IsNumeric(pvalue[0]) != true)) {return -1;}
if ((pvalue[1].length < 1) || (pvalue[1].length > 2) || (pvalue[1] == null) || (IsNumeric(pvalue[1]) != true)) {return -1;}
if ((pvalue[2].length < 1) || (pvalue[2].length > 2) || (pvalue[1] == null) || (IsNumeric(pvalue[2]) != true)) {return -1;}
rvalue = pvalue[0]*60*60+pvalue[1]*60+pvalue[2];
return rvalue;
}
function myParseDateTime(dvalue) {
var tvalue;
var pvalue;
var rvalue = -1;
if ((dvalue.length > 19) || (dvalue.length < 14)) {return -1;}
pvalue = dvalue.split(" ");
var a = pvalue[0];
var b = pvalue[1];
var vdate = myParseDate(a);
var vtime = myParseTime(b);
if ((vdate != -1) && (vtime != -1)) {
rvalue = vdate + vtime;
}
return Math.round(rvalue);
}
function checkParentDocument(id) {
getDBItemById('SITE_NAME__DOCS', id, 'EXPIRE_DATE', 'PARENT_EXPIRE_DATE');
getDBItemById('SITE_NAME__DOCS', id, 'CONTROL_TYPE', 'PARENT_CONTROL_TYPE');
getDBItemById('SITE_NAME__DOCS', id, 'STATUS_ID', 'PARENT_STATUS_ID');
}
function myCheckIsLowerDateTime(dvalue, evalue) {
var a;
var b;
a = myParseDateTime(dvalue);
b = myParseDateTime(evalue);
if (a == -1) {return -1;}
if (b == -1) {return -1;}
if (a < b) {return 1;}
if (a== b) {return 0;}
if (a > b) {return -1;}
}
function myCheckDateTime(dvalue) {
var today=new Date();
var Y=today.getFullYear();
var M=today.getMonth() + 1;
var D=today.getDate();
var h=today.getHours();
var m=today.getMinutes();
var s=today.getSeconds();
var r=0;
var a;
var b;
var tvalue;
tvalue = Y + "-" + M + "-" + D + " " + h + ":" + m + ":" + s;
a = myParseDateTime(dvalue);
b = myParseDateTime(tvalue);
if (a == -1) {return -1;}
if (a < b) {return -1;}
if (a== b) {return 0;}
if (a > b) {return 1;}
}
function myGetElementById(id) {
var obj = document.getElementById(id);
if (obj == null) {
obj = document.all[id];
}
return obj;
}
function myOnkeydown(event, str, elid){
var ev=new xEvent(event);
if (ev.keyCode == 13) {
showHint(str, elid);
}
}
function ShowHideObject(ID_ON, ID_OFF, status) {
var x = myGetElementById(ID_ON);
var y = myGetElementById(ID_OFF);
if (status == 1) {
if(x) {
x.style.display="block";
}
if(y) {
y.style.display="none";
}
}
if (status == 0) {
if(x) {
x.style.display="none";
}
if(y) {
y.style.display="block";
}
}
}
function SetObjValue(OID) {
var x = myGetElementById(OID);
x.value = Svalue;
}
function openHintBox(VAR, VALUE, NAME) {
gotoAjaxURL('https://www.moletai.lt//remote.php?ru=Kr0pOtYan2&m=62&VAR='+VAR+'&VALUE='+VALUE, NAME);
}
function openDateTimePicker(url, name) {
var myDate = myGetElementById(name).value;
gotoAjaxURL('https://www.moletai.lt//remote.php?ru=Kr0pOtYan2&m=56&div='+name+'&date='+myDate, 'DIV_'+name);
}
function openDatePicker(url, name) {
var myDate = myGetElementById(name).value;
gotoAjaxURL('https://www.moletai.lt//remote.php?ru=Kr0pOtYan2&m=55&div='+name+'&date='+myDate, 'DIV_'+name);
}
function pickDate(name, value) {
var myName = 'DIV_'+name;
clearDiv(myName);
myGetElementById(name).value = value;
}
function changeDate(url, name, value) {
gotoAjaxURL('https://www.moletai.lt//remote.php?ru=Kr0pOtYan2&m=55&&div='+name+'&date='+value, 'DIV_'+name);
myGetElementById(name).value = value;
}
function changeDateTime(url, name, value) {
gotoAjaxURL('https://www.moletai.lt//remote.php?ru=Kr0pOtYan2&m=56&div='+name+'&date='+value, 'DIV_'+name);
myGetElementById(name).value = value;
}
function selectContactType(ctype, url, div) {
if (ctype != '') {
gotoAjaxURL(url+'type='+ctype, div);
}
}
function multiVariableAdd(var1, var2, url) {
var input_var1 = 'INPUT_'+var1;
var input_var2 = 'INPUT_'+var2;
var var1_value = myGetElementById(input_var1).value;
var var2_value = myGetElementById(input_var2).value;
var ajaxurl = url+'&action=add&var='+var1+'&var2='+var2+'&'+var1+'='+var1_value+'&'+var2+'='+var2_value;
var div = var1+'_SHOW';
gotoAjaxURL(ajaxurl, div);
}
function personContactCreate(var1, url) {
var CODE = var1+'[CODE]';
var FNAME = var1+'[FNAME]';
var LNAME = var1+'[LNAME]';
var ADDRESS = var1+'[ADDRESS]';
var EMAIL = var1+'[EMAIL]';
var PHONE_FULL = var1+'[PHONE_FULL]';
var CODE_VALUE = myGetElementById(CODE).value;
var FNAME_VALUE = myGetElementById(FNAME).value;
var LNAME_VALUE = myGetElementById(LNAME).value;
var ADDRESS_VALUE = myGetElementById(ADDRESS).value;
var EMAIL_VALUE = myGetElementById(EMAIL).value;
var PHONE_FULL_VALUE = myGetElementById(PHONE_FULL).value;
var ajaxurl = url+'&'+CODE+'='+CODE_VALUE+'&'+FNAME+'='+FNAME_VALUE+'&'+LNAME+'='+LNAME_VALUE+'&'+FNAME+'='+FNAME_VALUE+'&'+LNAME+'='+LNAME_VALUE+'&'+ADDRESS+'='+ADDRESS_VALUE+'&'+EMAIL+'='+EMAIL_VALUE+'&'+PHONE_FULL+'='+PHONE_FULL_VALUE;
var div = var1+'_SHOW';
gotoAjaxURL(ajaxurl, div);
}
function enterpriseContactCreate(var1, url) {
var CODE = var1+'[CODE]';
var FNAME = var1+'[FNAME]';
var LNAME = var1+'[LNAME]';
var ADDRESS = var1+'[ADDRESS]';
var EMAIL = var1+'[EMAIL]';
var PHONE_FULL = var1+'[PHONE_FULL]';
var ENTERPRISE = var1+'[ENTERPRISE]';
var CODE_VALUE = myGetElementById(CODE).value;
var FNAME_VALUE = myGetElementById(FNAME).value;
var LNAME_VALUE = myGetElementById(LNAME).value;
var ADDRESS_VALUE = myGetElementById(ADDRESS).value;
var EMAIL_VALUE = myGetElementById(EMAIL).value;
var PHONE_FULL_VALUE = myGetElementById(PHONE_FULL).value;
var ENTERPRISE_VALUE = myGetElementById(ENTERPRISE).value;
var ajaxurl = url+'&'+CODE+'='+CODE_VALUE+'&'+FNAME+'='+FNAME_VALUE+'&'+LNAME+'='+LNAME_VALUE+'&'+FNAME+'='+FNAME_VALUE+'&'+LNAME+'='+LNAME_VALUE+'&'+ADDRESS+'='+ADDRESS_VALUE+'&'+EMAIL+'='+EMAIL_VALUE+'&'+PHONE_FULL+'='+PHONE_FULL_VALUE+'&'+ENTERPRISE+'='+ENTERPRISE_VALUE;
var div = var1+'_SHOW';
gotoAjaxURL(ajaxurl, div);
}
function autoResize(id){
var newheight;
var newwidth;
if(document.getElementById){
newheight=document.getElementById(id).contentWindow.document .body.scrollHeight;
newwidth=document.getElementById(id).contentWindow.document .body.scrollWidth;
}
document.getElementById(id).height= (newheight) + "px";
document.getElementById(id).width= (newwidth) + "px";
}
function changeFieldValue(elid, val) {
if (val != '') {
myGetElementById(elid).value = val;
}
}
function webCheckComment() {
if (document.webform.TEXT_DATA.value.length < 5) {alert("Per trumpas komentaro tekstas.");return false;}
document.webform.submit();
return true;
}
function webCheckCreatePetition() {
var DOCOK = '';
if (document.webform.DOCFILE1.value == '') {DOCOK = '';}
if (document.webform.DOCFILE1.value != '') {DOCOK = '1';}
if (DOCOK == '') {alert("Būtina prisegti bent vieną bylą.");return false;}
if (document.webform.DOC_DATA.value.length < 10) {alert("Per trumpa peticijos antraštė.");return false;}
if (document.webform.DOC_NOTES.value.length < 20) {alert("Per trumpas peticijos aprašymas.");return false;}
document.webform.submit();
return true;
}
function webCheckCreateEPetition() {
var DOCOK = '';
if (document.webform.mainDocument.value == '') {DOCOK = '';}
if (document.webform.mainDocument.value != '') {DOCOK = '1';}
if (DOCOK == '') {alert("Būtina prisegti bent vieną bylą.");return false;}
if (document.webform.documentTitle.value.length < 10) {alert("Per trumpa peticijos antraštė.");return false;}
if (document.webform.authorAddress.value.length < 2) {alert("Būtina nurodyti adresą.");return false;}
if (document.webform.DOC_NOTES.value.length < 10) {alert("Per trumpas peticijos aprašymas.");return false;}
var EXPIRE_DATE;
if (document.webform.EXPIRE_DATE){EXPIRE_DATE = document.webform.EXPIRE_DATE.value;}
var saveurl = 'https://www.moletai.lt//remote.php?ru=Kr0pOtYan2&m=57&DOC_NOTES='+document.webform.DOC_NOTES.value+'&EXPIRE_DATE='+EXPIRE_DATE;
gotoAjaxURL(saveurl, 'tmp');
document.webform.submit();
return true;
}
function webCheckCreateUnsignedPetition() {
var DOCOK = '';
if (document.webform.DOCFILE1.value == '') {DOCOK = '';}
if (document.webform.DOCFILE1.value != '') {DOCOK = '1';}
if (DOCOK == '') {alert("Neprisegtas failas.");return false;}
if (document.webform.documentTitle.value.length < 10) {alert("Per trumpa peticijos antraštė.");return false;}
if (document.webform.DOC_NOTES.value.length < 10) {alert("Per trumpas peticijos aprašymas.");return false;}
var EXPIRE_DATE = ' ';
if (document.webform.EXPIRE_DATE) {
EXPIRE_DATE = document.webform.EXPIRE_DATE.value;
}
if (EXPIRE_DATE == '') {
alert("Per trumpas peticijos aprašymas.");return false;
}
document.webform.submit();
return true;
}
function webCheckCreateProblem() {
getHnitSilverLightId();
if (document.webform.SCENARIO_ID.selectedIndex == 0) {alert("Nepasirinktas problemos tipas.");return false;}
if (document.webform.DOC_DATA.value.length < 5) {alert("Per trumpas problemos tekstas.");return false;}
if (document.webform.EMAIL) {
if (document.webform.EMAIL.value.length < 5) {alert("Per trumpas el. pašto adresas.");return false;}
}
if (document.webform.PHONE_FULL) {
if (document.webform.PHONE_FULL.value.length < 3) {alert("Per trumpas telefono numeris.");return false;}
}
document.webform.submit();
}
function FileUpload(myform, myaction, myframe, checkaction, checkname) {
var old_m;
sname = 'SPAN'+checkname;
myGetElementById(sname).innerHTML = ' ';
myForm = myGetElementById(myform);
oldmethod = myForm.method;
oldaction = myForm.action;
oldtarget = myForm.target;
myForm.method = "post";
myForm.action = myaction;
myForm.target = myframe;
sname = 'SPAN'+checkname;
eval('document.'+myform+'.submit();');
myForm.method = oldmethod;
myForm.action = oldaction;
myForm.target = oldtarget;
checkFileUpload(checkaction, sname, checkname);
}
function checkContentResult(myUrl, myDiv, mySearch) {
var stopRefresh = false;
myContent = myGetElementById(myDiv).innerHTML;
searchIndex = myContent.indexOf(mySearch);
if (searchIndex > 0 && searchIndex < 100){
stopRefresh = true;
}
if (stopRefresh == false){
gotoAjaxURL(myUrl+'&'+Math.random(), myDiv, true);
setTimeout(function(){
checkContentResult(myUrl, myDiv, mySearch);
}, 2000);
}
}
function checkFileUpload(checkaction, sname, checkname) {
lname = sname+'_LOADING';
if (myGetElementById('Submit1')){
myGetElementById('Submit1').disabled = true;
}
var stopRefresh = false;
if (myGetElementById('WP_FILES['+checkname+'][name]')) {
stopRefresh = true;
myGetElementById(lname).innerHTML = '';
if (myGetElementById('Submit1')){
myGetElementById('Submit1').disabled = false;
}
}
if (myGetElementById('NO_FILES')) {
stopRefresh = true;
myGetElementById(lname).innerHTML = '';
if (myGetElementById('Submit1')){
myGetElementById('Submit1').disabled = false;
}
}
if (stopRefresh == false) {
myGetElementById(lname).innerHTML = ' Įkeliamas failas..';
gotoAjaxURL(checkaction, sname);
myGetElementById(lname).innerHTML = ' Įkeliamas failas..';
setTimeout(function(){
myGetElementById(lname).innerHTML = ' Įkeliamas failas..';
checkFileUpload(checkaction,sname,checkname);
}, 2000);
myGetElementById(lname).innerHTML = ' Įkeliamas failas..';
}
}
function radioValue(radioButton)
{
for (x = 0; x <= radioButton.length; x++)
{
if (radioButton[x].checked == true) return radioButton[x].value;
}
// if it didnt find anything, return the .value (behaviour of single radio btn)
return -1;
}
function webCheckDocumentSearchForm() {
if (document.webform.JOURNAL_ID.selectedIndex == 0) {alert("Nepasirinkta dokumentų rūšis.");return false;}
document.webform.submit();
}
function getHnitSilverLightId() {
if (myGetElementById('USEHNITSILVERLIGHT')) {
var myField = ''; var myUrl = ''; var myId = '';var response = '';
if (myGetElementById('mapField')) {myField = myGetElementById('mapField').value;}
if (myGetElementById('mapUrl')) {myUrl = myGetElementById('mapUrl').value;}
if (myGetElementById('mapId').value) {myId = myGetElementById('mapId').value};
if ((myField != '') && (myId != '') && (myUrl != '')) {
gotoAjaxURL(myUrl, myId);
response = myGetElementById(myId).innerHTML;
if (response == '') {
return false;
}
var pos = response.indexOf("}<");
if (pos == -1) {
jsonResponse = response;
} else {
var tmp = response.split('}<');
jsonResponse = tmp[0]+"}";
}
var parsedJSON = eval('('+jsonResponse+')');
try {
var res = parsedJSON.features[0].attributes.GlobalID;
myGetElementById(myField).value = res;
}
catch(err) {
myGetElementById(myField).value = '';
}
}
}
}
function isChrome() {
return (navigator.userAgent.toLowerCase().indexOf('chrome') > -1);
}
function previewWindowSet() {
$(function() {
$('body').on('click', 'a.preview_window', function() {
var url = this.href;
// show a spinner or something via css
var dialog = $('
').appendTo('body');
// open the dialog
dialog.dialog({
// add a close listener to prevent adding multiple divs to the document
close: function(event, ui) {
// remove div with all data and events
$(this).remove();
},
modal: true,
width: 1200,
height: 800
}).addClass("web_dialog");
// load remote content
dialog.load(url,false,function(responseText, textStatus, XMLHttpRequest) {
// remove the loading class
dialog.removeClass('loading');
}
);
//prevent the browser to follow the link
return false;
});
});
console.log('seted as');
}