function changeProduct(rowId, id) {
	var action;
        var oldActiveRow;
        
	action = "changeProduct";
        oldActiveRow = activeRow;
        activeRow = rowId;

        advAJAX.post({
		url: "/ajax.php",
		parameters : {
			action : action,
                        id : id
		  },
		retry: 1,
		retryDelay: 2000,
		timeout: 6000,
		onSuccess : function(obj) {
                    var dataArr = JSON.parse(obj.responseText);
//                    clearRows(activeRow);
                    cleaning = setInterval("clearRows("+activeRow+")", 2000);
                    if(document.getElementById("input_"+oldActiveRow) != null) document.getElementById("input_"+oldActiveRow).innerHTML = "";
                    changeBorder("hover_"+oldActiveRow, 0, oldActiveRow);
//                    $("#hover_"+oldActiveRow).hide('fast');
//                    debugger;
                    
                    if(document.getElementById("input_"+oldActiveRow) == null && document.getElementById("input_"+rowId) != null) {
                        document.getElementById("input_"+rowId).innerHTML = dataArr["inputValue"];
                        if(document.getElementById("input_"+rowId).innerHTML != "") {
                          if(window.navigator.appName === "Microsoft Internet Explorer") {
                              document.getElementById("bild_"+rowId).style.display="";
                              document.getElementById("desc_"+rowId).style.display="";
                          } else {
                              jQuery("#bild_"+rowId).show('normal');
                              jQuery("#desc_"+rowId).show('normal');
                          }
                        }
                    } else if(document.getElementById("input_"+rowId) != null && document.getElementById("input_"+oldActiveRow).innerHTML == "") {
                        document.getElementById("input_"+rowId).innerHTML = dataArr["inputValue"];
                        if(document.getElementById("input_"+rowId).innerHTML != "") {
                          if(window.navigator.appName === "Microsoft Internet Explorer") {
                              document.getElementById("bild_"+rowId).style.display="";
                              document.getElementById("desc_"+rowId).style.display="";
                          } else {
                              jQuery("#bild_"+rowId).show('normal');
                              jQuery("#desc_"+rowId).show('normal');
                          }
                        }
                    }
                }
	});
}

function refreshSmallWebcam() {
	var action = "refreshSmallWebcam";

        advAJAX.post({
		url: "/ajax.php",
		parameters : {
			action : action
		  },
		retry: 1,
		retryDelay: 2000,
		timeout: 6000,
		onSuccess : function(obj) {
                    var dataArr = JSON.parse(obj.responseText);
                    
                    if(document.getElementById("webcam_small_image") != null) document.getElementById("webcam_small_image").src='/images/cam/currentCamImg.jpg?timestamp='+Math.random();
                    if(document.getElementById("webcam_small_title") != null) document.getElementById("webcam_small_title").innerHTML = dataArr.data;
                    if(document.getElementById("webcam_image") != null) document.getElementById("webcam_image").src='/images/cam/currentCamImg.jpg?timestamp='+Math.random();
                }
	});
}

function sendMail() {
    var action;
    var adress;

    adress = document.getElementById('orderToMail').value;
    action = "sendMail";


    advAJAX.post({
            url: "/ajax.php",
            parameters : {
                    action : action,
                    adress : adress
              },
            retry: 1,
            retryDelay: 2000,
            timeout: 6000,
            onSuccess : function(obj) {
                document.getElementById('sendEmail').innerHTML = changeInfo(1, adress);
            }
    });
}
