
function add_adresat(intEmailId){
  //alert(document.getElementById("adresaci_id").value);
  	if (document.getElementById("adresaci_id").value != '') {
		
		
		document.getElementById("adresaci_id").value = document.getElementById("adresaci_maile").value;
		if(document.getElementById("adresaci_maile").value!='') document.getElementById("adresaci_id").value = document.getElementById("adresaci_id").value+";";
	}
	
	document.getElementById("adresaci_id").value = document.getElementById("adresaci_id").value+intEmailId; 
	if (document.getElementById("adresaci_id").value != '') {
		
	}
	//alert(document.getElementById("adresaci_id").value);
	
	advAJAX.post({
	    url: cnfg_url+"apps/ajax_php/addAddress.php",
	    parameters : {
	      "emails_id" : document.getElementById("adresaci_id").value
	    },
	    onLoading : function(obj){ 
			document.getElementById("adresaci").innerHTML='<br/><img style="float:left;margin-left:10px;" src="'+cnfg_url+'gfx/ajax-loader.gif"/><br/><br/>';
	    },
	    onComplete : function(obj) { 
	    },
	    onSuccess : function(obj) { 
			document.getElementById("adresaci").innerHTML = obj.responseText;
	    },
	    onError : function(obj) {
			
	   }
	});
}

function del_adresat(strEmail){
  //alert(document.getElementById("adresaci_id").value);
	//document.getElementById("adresaci_id").value = document.getElementById("adresaci_id").value+intEmailId+';'; 
	advAJAX.post({
	    url: cnfg_url+"apps/ajax_php/delAddress.php",
	    parameters : {
	       "del_email" : strEmail,
	      "emails" : document.getElementById("adresaci_maile").value
	    },
	    onLoading : function(obj){ 
			document.getElementById("adresaci").innerHTML='<br/><img style="float:left;margin-left:10px;" src="'+cnfg_url+'gfx/ajax-loader.gif"/><br/><br/>';
	    },
	    onComplete : function(obj) { 
	    },
	    onSuccess : function(obj) { 
			document.getElementById("adresaci").innerHTML = obj.responseText;
	    },
	    onError : function(obj) {
			
	   }
	});
}

function dodaj_do_newsletter(){
    var email = document.getElementById('email_id').value;
    advAJAX.post({
        url: cnfg_url+"ajax/newsletter/",
        parameters : {
          "email" : email
        },
        onLoading : function(obj){ 
            document.getElementById("newsletter_response").innerHTML='<br/><img style="float:left;margin-left:10px;" src="'+cnfg_url+'gfx/ajax-loader.gif"/><br/><br/>';
        },
        onComplete : function(obj) { 
        },
        onSuccess : function(obj) { 
            document.getElementById("newsletter_response").innerHTML = obj.responseText;
        },
        onError : function(obj) {
            //document.getElementById("category_tree").innerHTML = 'error';    
       }
    });
}

function move_category(direction,intCategoryId){
	
	advAJAX.post({
		url: cnfg_url+"admin/ajax/moveCategory/",
	    parameters : {
	      "direction" : direction,
	      "category_id" : intCategoryId
	    },
	    onLoading : function(obj){ 
			document.getElementById("category_tree").innerHTML='<br/><img style="float:left;margin-left:10px;" src="'+cnfg_url+'gfx/ajax-loader.gif"/><br/><br/>';
	    },
	    onComplete : function(obj) { 
	    },
	    onSuccess : function(obj) { 
			document.getElementById("category_tree").innerHTML = obj.responseText;
	    },
	    onError : function(obj) {
			document.getElementById("category_tree").innerHTML = 'error';	
	   }
	});
}

function move_photo(direction,intPhotoId,intGalleryId){
	//alert(intPhotoId + '--' + intGalleryId);
	advAJAX.post({
	    url: cnfg_url+"admin/ajax/movePhoto/",
	    parameters : {
	      "direction" : direction,
		  "gallery_id" : intGalleryId,
	      "photo_id" : intPhotoId
	    },
	    onLoading : function(obj){ 
			document.getElementById("photos").innerHTML='<br/><img style="float:left;margin-left:10px;" src="'+cnfg_url+'gfx/ajax-loader.gif"/><br/><br/>';
	    },
	    onComplete : function(obj) { 
	    },
	    onSuccess : function(obj) { 
			document.getElementById("photos").innerHTML = obj.responseText;
	    },
	    onError : function(obj) {
			
	   }
	});
}

function edit_photo(intPhotoId,intGalleryId){

	advAJAX.post({
	    url: cnfg_url+"apps/ajax_php/editPhoto.php",
	    parameters : {
	      "gallery_id" : intGalleryId,
	      "photo_id" : intPhotoId
	    },
	    onLoading : function(obj){ 
			document.getElementById("edit_"+intPhotoId).innerHTML='<br/><img style="float:left;margin-left:10px;" src="'+cnfg_url+'gfx/ajax-loader.gif"/><br/><br/>';
	    },
	    onComplete : function(obj) { 
	    },
	    onSuccess : function(obj) { 
			document.getElementById("edit_"+intPhotoId).innerHTML = obj.responseText;
	    },
	    onError : function(obj) {
			
	   }
	});
}

function gallery_type(intGalleryType){
	advAJAX.post({
	    url: cnfg_url+"apps/ajax_php/galleryType.php",
	    parameters : {
		  "gallery_type" : intGalleryType
	    },
	    onLoading : function(obj){ 
			document.getElementById("gallery_type").innerHTML='<br/><img style="float:left;margin-left:10px;" src="'+cnfg_url+'gfx/ajax-loader.gif"/><br/><br/>';
	    },
	    onComplete : function(obj) { 
	    },
	    onSuccess : function(obj) { 
			document.getElementById("gallery_type").innerHTML = obj.responseText;
	    },
	    onError : function(obj) {
			
	   }
	});
}

function gallery_edit(intGalleryId){
	advAJAX.post({
	    url: cnfg_url+"apps/ajax_php/galleryEdit.php",
	    parameters : {
		  "gallery_id" : intGalleryId
	    },
	    onLoading : function(obj){ 
			document.getElementById("gallery_edit").innerHTML='<br/><img style="float:left;margin-left:10px;" src="'+cnfg_url+'gfx/ajax-loader.gif"/><br/><br/>';
	    },
	    onComplete : function(obj) { 
	    },
	    onSuccess : function(obj) { 
			document.getElementById("gallery_edit").innerHTML = obj.responseText;
	    },
	    onError : function(obj) {
			
	   }
	});
}



function zaznacz_all(){
    var ppts = document.getElementById('mailbox').getElementsByTagName('input');
    var zazbool=true;
    var i=0;
	/*
    if(document.getElementById('all').checked==false){
        zazbool=false;
    }*/
	for(i; i<ppts.length; i++) {
   		var pptsInput = ppts[i];
	 	//if(pptsInput.type=='checkbox' && pptsInput.id!='all') {
		  	pptsInput.checked=zazbool;
		//}
 	}
}

function zaznacz(strCo){
	
	if(strCo=='wszystkie') zaznacz_all();
	else return;
}




function ajax_usun_zaznaczone(){
    var checked='';
  	var i=0;
	
	ppts = document.getElementById('mailbox').getElementsByTagName('input');
	for(i; i<ppts.length; i++) {
   		var pptsInput = ppts[i];
	 	if(pptsInput.type=='checkbox' && pptsInput.checked==true) {
		  	checked=pptsInput.value+','+checked;
		}
 	}
	
	if (checked.length==0) {
		alert('Nie wybrano wiadomości');return;
	}	
	
	advAJAX.post({
	
		url: cnfg_url + "apps/php/kosz.php",
		parameters: {
			'zaznaczone': checked
		},
		onLoading: function(obj){
			document.getElementById("mailbox").innerHTML = '<br/><img style="float:left;margin-left:367px;" src="' + cnfg_url + 'pliki_adm/ajax-loader.gif"/><br/><br/>';
		},
		onComplete: function(obj){
		},
		onSuccess: function(obj){
			document.getElementById("mailbox").innerHTML = obj.responseText;
		},
		onError: function(obj){
		}
	});

}

function car_producer_name_edit(intProducerId,strNazwa){
    advAJAX.post({
        
        url: cnfg_url+"apps/ajax_php/carProducerNameEdit.php",
        
        parameters : {
          "producer_id" : intProducerId,
          "nazwa" : strNazwa
        },
        onLoading : function(obj){ 
            document.getElementById("producer_"+intProducerId).innerHTML='';
        },
        onComplete : function(obj) { 
        },
        onSuccess : function(obj) { 
            document.getElementById("producer_"+intProducerId).innerHTML = obj.responseText;
        },
        onError : function(obj) {
            
       }
    });
}

function product_producer_name_edit(intProducerId,strNazwa){
    advAJAX.post({
        
        url: cnfg_url+"apps/ajax_php/productProducerNameEdit.php",
        
        parameters : {
          "producer_id" : intProducerId,
          "nazwa" : strNazwa
        },
        onLoading : function(obj){ 
            document.getElementById("producer_"+intProducerId).innerHTML='';
        },
        onComplete : function(obj) { 
        },
        onSuccess : function(obj) { 
            document.getElementById("producer_"+intProducerId).innerHTML = obj.responseText;
        },
        onError : function(obj) {
            
       }
    });
}
function product_producer_type_name_edit(intProducerTypeId,intProducerId,strNazwa){
    advAJAX.post({
        
        url: cnfg_url+"apps/ajax_php/productProducerTypeNameEdit.php",
        
        parameters : {
          "producer_id" : intProducerId,
          "producer_type_id" : intProducerTypeId,
          "nazwa" : strNazwa
        },
        onLoading : function(obj){ 
            document.getElementById("producer_type_"+intProducerTypeId).innerHTML='';
        },
        onComplete : function(obj) { 
        },
        onSuccess : function(obj) { 
            document.getElementById("producer_type_"+intProducerTypeId).innerHTML = obj.responseText;
        },
        onError : function(obj) {
            
       }
    });
}

function atrybuty(product_id){
	
	var lista = document.getElementById("att");
	
	var tab = new Array();
	var j = 0;
	
	for (var i=0; i<lista.options.length; i++) {
		if (lista.options[i].selected) {
			tab[j] = lista.options[i].value;
			j++;
		}
	}
	
	idiki = tab.join(':');
	
	
	advAJAX.post({
	    url: cnfg_url+"apps/ajax_php/attributes.php",
	    
		parameters : {
		  "id" : idiki,
		  "product_id" : product_id
	    },
	    onLoading : function(obj){ 
			document.getElementById("atrybuty").innerHTML='<br/><img style="float:left;margin-left:10px;" src="'+cnfg_url+'gfx/ajax-loader.gif"/><br/><br/>';
	    },
	    onComplete : function(obj) { 
	    },
	    onSuccess : function(obj) { 
			document.getElementById("atrybuty").innerHTML = obj.responseText;
	    },
	    onError : function(obj) {
			
	   }
	});
}

function delivery_forms(intAreaId){
	
	advAJAX.post({
		url: cnfg_url+"admin/ajax/deliveryForms/",
	    parameters : {
	      "area_id" : intAreaId
	    },
	    onLoading : function(obj){ 
			document.getElementById("delivery_form").innerHTML='<br/><img style="float:left;margin-left:10px;" src="'+cnfg_url+'gfx/ajax-loader.gif"/><br/><br/>';
	    },
	    onComplete : function(obj) { 
	    },
	    onSuccess : function(obj) { 
			document.getElementById("delivery_form").innerHTML = obj.responseText;
	    },
	    onError : function(obj) {
			document.getElementById("delivery_form").innerHTML = 'error';	
	   }
	});
}

function newsletterPreview(){
    
    var content = document.getElementById("newsletterContentId").innerHTML;
    
    $(document).ready(function(){
        $(".dark").show();
    });
    
    advAJAX.post({
        url: cnfg_url+"admin/ajax/newsletterPreview/",
        parameters : {
          "content" : content
        },
        onLoading : function(obj){ 
            document.getElementById("popup").innerHTML='<br/><img style="float:left;margin-left:10px;" src="'+cnfg_url+'gfx/ajax-loader.gif"/><br/><br/>';
        },
        onComplete : function(obj) { 
        },
        onSuccess : function(obj) { 
            document.getElementById("popup").innerHTML = obj.responseText;
        },
        onError : function(obj) {
            document.getElementById("popup").innerHTML = 'error';    
       }
    });

}

function generate_costs(intCountryId){
	
	advAJAX.post({
		url: cnfg_url+"ajax/generateCosts/",
	    parameters : {
	      "country_id" : intCountryId
	    },
	    onLoading : function(obj){ 
			//document.getElementById("shipping_costs").innerHTML='<br/><img style="float:left;margin-left:10px;" src="'+cnfg_url+'gfx/ajax-loader.gif"/><br/><br/>';
	    },
	    onComplete : function(obj) { 
	    },
	    onSuccess : function(obj) { 
			document.getElementById("shipping_costs").innerHTML = obj.responseText;
	    },
	    onError : function(obj) {
			
	   }
	});
}

function wystawProdukt(){
	
    var winW = 400, winH = 300;
    if (document.body && document.body.offsetWidth) {
     winW = document.body.offsetWidth;
     winH = document.body.offsetHeight;
    }
    if (document.compatMode=='CSS1Compat' &&
        document.documentElement &&
        document.documentElement.offsetWidth ) {
     winW = document.documentElement.offsetWidth;
     winH = document.documentElement.offsetHeight;
    }
    if (window.innerWidth && window.innerHeight) {
     winW = window.innerWidth;
     winH = window.innerHeight;
    }
    
	advAJAX.post({
		url: cnfg_url+"ajax/wystawProdukt/",
	    parameters : {
	      "windowHeight":winH
	    },
	    onLoading : function(obj){ 
			//document.getElementById("shipping_costs").innerHTML='<br/><img style="float:left;margin-left:10px;" src="'+cnfg_url+'gfx/ajax-loader.gif"/><br/><br/>';
	    },
	    onComplete : function(obj) { 
	    },
	    onSuccess : function(obj) { 
			document.getElementById("dark_bg").innerHTML = obj.responseText;
			
			$('#zamknij').click(function() {
				$("div.dark_bg").hide();
				$("div.popup").hide();
			});
            $('#auction').click(function() {
                $("#minimum_price").toggle();
            });
	    },
	    onError : function(obj) {
			
	   }
	});
}

function dodajProdukt(){
    
    var winW = 400, winH = 300;
    if (document.body && document.body.offsetWidth) {
     winW = document.body.offsetWidth;
     winH = document.body.offsetHeight;
    }
    if (document.compatMode=='CSS1Compat' &&
        document.documentElement &&
        document.documentElement.offsetWidth ) {
     winW = document.documentElement.offsetWidth;
     winH = document.documentElement.offsetHeight;
    }
    if (window.innerWidth && window.innerHeight) {
     winW = window.innerWidth;
     winH = window.innerHeight;
    }
    
    var is_array = function (value) {
        return value && typeof value === 'object' && typeof value.length === 'number' &&typeof value.splice === 'function' && !(value.propertyIsEnumerable('length'));
    }
    var attr = document.getElementsByName('attribute');
    var arrAttr = new Array();
    
    for(var i=0;i<attr.length;i++){
        var attrId = attr[i].id.substr(10,1);
        var index = attr[i].id.substr(13,1);
        //alert(attrId+" "+index+" "+attr[i].value);
        if(is_array(arrAttr[attrId])) arrAttr[attrId][index] = attr[i].value;
        else{
            arrAttr[attrId] = new Array();
            arrAttr[attrId][index] = attr[i].value;
        }
    }
    
	advAJAX.post({
		url: cnfg_url+"ajax/dodajProdukt/",
	    
		parameters : {
			"name": document.getElementById("name").value,
			"category_id": document.getElementById("category_id").value,
			"currency": document.getElementById("currency").value,
			"error" : document.getElementById("error").value,
			"description": document.getElementById("description").value,
			"price": document.getElementById("price").value,
			"quantity": document.getElementById("quantity").value,
            "auction": document.getElementById("auction").value,
            "min_price": document.getElementById("min_price").value,
			"cost_kraj_prosty": document.getElementById("cost_kraj_prosty").value,
			"cost_kraj_grupa": document.getElementById("cost_kraj_grupa").value,
			"cost_zagranica_prosty": document.getElementById("cost_zagranica_prosty").value,
			"cost_zagranica_grupa": document.getElementById("cost_zagranica_grupa").value,
            'attribute[]' : arrAttr,
            "windowHeight":winH
	    },
	    onLoading : function(obj){ 
			//document.getElementById("shipping_costs").innerHTML='<br/><img style="float:left;margin-left:10px;" src="'+cnfg_url+'gfx/ajax-loader.gif"/><br/><br/>';
	    },
	    onComplete : function(obj) { 
	    },
	    onSuccess : function(obj) { 
			document.getElementById("dark_bg").innerHTML = obj.responseText;
			
			$('#zamknij').click(function() {
				$("div.dark_bg").hide();
				$("div.popup").hide();
			});
            $('#auction').click(function() {
                $("#minimum_price").toggle();
            });
	    },
	    onError : function(obj) {
			
	   }
	});
}

function edytujProdukt(idProduktu){
    var winW = 400, winH = 300;
    if (document.body && document.body.offsetWidth) {
     winW = document.body.offsetWidth;
     winH = document.body.offsetHeight;
    }
    if (document.compatMode=='CSS1Compat' &&
        document.documentElement &&
        document.documentElement.offsetWidth ) {
     winW = document.documentElement.offsetWidth;
     winH = document.documentElement.offsetHeight;
    }
    if (window.innerWidth && window.innerHeight) {
     winW = window.innerWidth;
     winH = window.innerHeight;
    }
    
    var errorVal='';
    if(document.getElementById("error")) errorVal = document.getElementById("error").value;
    advAJAX.post({ 
        url: cnfg_url+"ajax/edytujProdukt/idProduktu/"+idProduktu,
        parameters : {
            "error": errorVal,
            "windowHeight":winH
        },
        onLoading : function(obj){ 
            //document.getElementById("shipping_costs").innerHTML='<br/><img style="float:left;margin-left:10px;" src="'+cnfg_url+'gfx/ajax-loader.gif"/><br/><br/>';
        },
        onComplete : function(obj) { 
        },
        onSuccess : function(obj) { 
            document.getElementById("dark_bg").innerHTML = obj.responseText;
            
            $('#zamknij').click(function() {
                $("div.dark_bg").hide();
                $("div.popup").hide();
            });
            $('#auction').click(function() {
                $("#minimum_price").toggle();
            });
        },
        onError : function(obj) {
            
       }
    });
}

function szczegolyZamowienia(order_id,artist_id){
	
    advAJAX.post({
    	
        url: cnfg_url+"ajax/szczegolyZamowienia/order/"+order_id,
        parameters : {
            order_id : order_id,
            artist_id : artist_id
        },
        
        onLoading : function(obj){ 
            //document.getElementById("shipping_costs").innerHTML='<br/><img style="float:left;margin-left:10px;" src="'+cnfg_url+'gfx/ajax-loader.gif"/><br/><br/>';
        },
        
        onComplete : function(obj) { 
        },
        onSuccess : function(obj) { 
            document.getElementById("dark_bg").innerHTML = obj.responseText;
            
            $('#zamknij').click(function() {
                $("div.dark_bg").hide();
                $("div.popup").hide();
            });
        },
        onError : function(obj) {
            
       }
    });
}

function szczegolyWiadomosci(id){
	
    advAJAX.post({
    	
        url: cnfg_url+"ajax/szczegolyWiadomosci/",
        parameters : {
            id : id
        },
        
        onLoading : function(obj){ 
            //document.getElementById("shipping_costs").innerHTML='<br/><img style="float:left;margin-left:10px;" src="'+cnfg_url+'gfx/ajax-loader.gif"/><br/><br/>';
        },
        
        onComplete : function(obj) { 
        },
        onSuccess : function(obj) { 
            document.getElementById("dark_bg").innerHTML = obj.responseText;
            
            $('#zamknij').click(function() {
                $("div.dark_bg").hide();
                $("div.popup").hide();
            });
        },
        onError : function(obj) {
            
       }
    });
}

function powiadomOWysylce(order_id,artist_id){
	
    advAJAX.post({
    	
        url: cnfg_url+"ajax/powiadomOWysylce/",
        parameters : {
            order_id : order_id,
            artist_id : artist_id
        },
        
        onLoading : function(obj){ 
            //document.getElementById("shipping_costs").innerHTML='<br/><img style="float:left;margin-left:10px;" src="'+cnfg_url+'gfx/ajax-loader.gif"/><br/><br/>';
        },
        
        onComplete : function(obj) { 
        },
        onSuccess : function(obj) { 
            document.getElementById("dark_bg").innerHTML = obj.responseText;
            
            $('#zamknij').click(function() {
                $("div.dark_bg").hide();
                $("div.popup").hide();
            });
        },
        onError : function(obj) {
            
       }
    });
}

function zaplacBonem(zaplac){

    var order_id = document.getElementById('orderId').value;
    var voucher_code = document.getElementById('voucher_code').value;
    if(zaplac=="tak") var zaplacono = "tak";else var zaplacono="nie";
    advAJAX.post({    
        url: cnfg_url+"ajax/zaplacBonem/",
        parameters : {
            order_id : order_id,
            voucher_code : voucher_code,
            zaplacono : zaplacono
        },
        
        onLoading : function(obj){ 
            //document.getElementById("shipping_costs").innerHTML='<br/><img style="float:left;margin-left:10px;" src="'+cnfg_url+'gfx/ajax-loader.gif"/><br/><br/>';
        },
        onComplete : function(obj) { 
        },
        onSuccess : function(obj) { 
            document.getElementById("dark_bg").innerHTML = obj.responseText;
            $('#zamknij').click(function() {
                $("div.dark_bg").hide();
                $("div.popup").hide();
                if(zaplac) window.location.reload();
            });
            $('#zaplac').click(function() {
                $("div.dark_bg").hide();
                $("div.popup").hide();
                zaplacBonem("tak");
            });
        },
        onError : function(obj) {
            alert("Błąd przy przetwarzaniu skryptu");
       }
    });
}

function dodajDoAukcji(idProduktu,idArtysty){
    var errorVal='';
    var auctionId='0';
    var priceMinVal='';
    var ile='-1';
    
    if(document.getElementById("error")) errorVal = document.getElementById("error").value;
    if(document.getElementById("auctionId")) auctionId = document.getElementById("auctionId").value;
    if(document.getElementById("price_min_id")) priceMinVal = document.getElementById("price_min_id").value;
    if(document.getElementById("ile")) ile = document.getElementById("ile").value;
    
    advAJAX.post({
        url: cnfg_url+"ajax/dodajDoAukcji/idProduktu/"+idProduktu+"/idArtysty/"+idArtysty,
        parameters : {
            error : errorVal,
            auction_id : auctionId,
            price_min : priceMinVal,
            ile : ile
        },
        onLoading : function(obj){ 
            //document.getElementById("shipping_costs").innerHTML='<br/><img style="float:left;margin-left:10px;" src="'+cnfg_url+'gfx/ajax-loader.gif"/><br/><br/>';
        },
        onComplete : function(obj) { 
        },
        onSuccess : function(obj) { 
            document.getElementById("dark_bg").innerHTML = obj.responseText;
            $('#zamknij').click(function() {
                $("div.dark_bg").hide();
                $("div.popup").hide();
                if(document.getElementById("ile")) document.getElementById("ile").value = -1;
                if(document.getElementById("success")) window.location=cnfg_url+"user/galeria/";
            });
        },
        onError : function(obj) {
            
       }
    });
}

function showCatAttributes(){
    advAJAX.post({
        url: cnfg_url+"ajax/atrybutyProduktu",
        parameters : {
            catId : document.getElementById("category_id").value
        },
        onLoading : function(obj){ 
            //document.getElementById("shipping_costs").innerHTML='<br/><img style="float:left;margin-left:10px;" src="'+cnfg_url+'gfx/ajax-loader.gif"/><br/><br/>';
        },
        onComplete : function(obj) { 
        },
        onSuccess : function(obj) { 
            document.getElementById("prodCatAttr").innerHTML = obj.responseText;
        },
        onError : function(obj) {
            
       }
    });
}

function kup_podobny(prodId){
    
    advAJAX.post({
        
        url: cnfg_url+"ajax/kupPodobny/",
        parameters : {
            "product_id":prodId
        },
        
        onLoading : function(obj){ 
            //document.getElementById("shipping_costs").innerHTML='<br/><img style="float:left;margin-left:10px;" src="'+cnfg_url+'gfx/ajax-loader.gif"/><br/><br/>';
        },
        
        onComplete : function(obj) { 
        },
        onSuccess : function(obj) { 
            document.getElementById("dark_bg").innerHTML = obj.responseText;
            
            $('#zamknij').click(function() {
                $("div.dark_bg").hide();
                $("div.popup").hide();
            });
        },
        onError : function(obj) {
            
       }
    });
    
}

function generujKodBonu(){
    
    advAJAX.post({
        
        url: cnfg_url+"admin/ajax/generateVoucherCode/",
        
        onLoading : function(obj){ 
            //document.getElementById("shipping_costs").innerHTML='<br/><img style="float:left;margin-left:10px;" src="'+cnfg_url+'gfx/ajax-loader.gif"/><br/><br/>';
        },
        
        onComplete : function(obj) { 
        },
        onSuccess : function(obj) { 
            document.getElementById("codeInput").value = obj.responseText;
        },
        onError : function(obj) {
            
       }
    });
    
}
