<?php header("Content-Type: text/javascript");
include('../common_db.php');
include('../functions.php');
dbconnect($host, $username, $password);
$strings = loadStrings($lang, 'ASF');
?>
function addCondition() {
var dst = document.getElementById('dst');
var src = document.getElementById('src');
var copy = src.cloneNode(true);
var count = parseInt(document.getElementById('count').getAttribute('value'));
copy.id = 'p' + (count + 1);
copy.childNodes[1].setAttribute('name', 'lvalue' + (count));
copy.childNodes[3].setAttribute('name', 'operator' + (count));
copy.childNodes[5].setAttribute('name', 'rvalue' + (count));
var remspan = document.createElement('span');
remspan.setAttribute('class', 'll');
remspan.onclick = removeNode;
remspan.appendChild(document.createTextNode(' [<?php echo($strings['ASF_REMOVE']); ?>]'));
copy.appendChild(remspan);
dst.appendChild(copy);
document.getElementById('count').setAttribute('value', count + 1);
}
function removeNode() {
this.parentNode.parentNode.removeChild(this.parentNode);
var count = parseInt(document.getElementById('count').getAttribute('value'));
document.getElementById('count').setAttribute('value', count - 1);
}