function addkosztprzesylki(){
  var zapytanie='./modules/mod_shopbin/main/ajaxpage.php?action=setcostsend&cost='+$('przesylka').value;
  //alert(zapytanie);
  advAJAX.get({ 
      url : zapytanie,
      onLoading : function(obj) {
        $('myalert').style.display = "block";
      },
      onSuccess : function(obj) { 
        
        var costall=$('costall').value;
        var costsend=$('przesylka').value;
        var sumaall=0.00;
        
        $('costsend').value=costsend;
        $('costsendshow').innerHTML=format(costsend,2)+' zł';
        
        sumaall=+costall+ +costsend;
        $('sumaall').value=format(sumaall,2);
        $('sumaallshow').innerHTML=format(sumaall,2)+' zł';
        
        $('myalert').style.display = "none";
      },
      onError : function(obj) {
        alert("Error.. ");
      }
  });
}



/**delfrombin(idInbin,msg)
 * usuwa element z kosza
 * @param idInbin
 * @param msg  
 * @param which okresla czy maly(0) czy duzy(1) koszyk 
 */ 
function delfrombin(idInbin,msg,which){
  if (confirm(msg)){
    if(which==0){
      var zapytanie = "./modules/mod_shopbin/main/ajaxpage.php?action=delfrombinsmall&idinbin="+idInbin;
    }else{
      var zapytanie = "./modules/mod_shopbin/main/ajaxpage.php?action=delfrombin&idinbin="+idInbin;
    }
     //alert(zapytanie);
     advAJAX.get({ 
          url : zapytanie,
          onLoading : function(obj) {
          },
          onSuccess : function(obj) {
            switch (obj.responseText){
              case 'no': 
                alert("Error");
                break;
              default:
                if(which==0){
                  $('smallshopbintable').innerHTML=obj.responseText;
                }else{
                  $('bigshopbintable').innerHTML=obj.responseText;
                  document.getElementById("rejestracja").style.display = "none";
                }  
            }
     },
     onError : function(obj) {
        alert("Error..");
        }
     });	
  }
  else{
  	return false;
  }
}


/**makeprojectadd()
 * dodaje i odejmuje koszt wykonania projektu jesli zaznaczone/odznaczone
 */ 
function makeprojectadd(){
  if($('makeproject').checked){
    $('makeprojectcostshow').innerHTML=$('makeprojectcost').value+' &euro;';
    $('costproject').value=$('makeprojectcost').value;
    $('sumaall').value=format(+$('sumaall').value + +$('makeprojectcost').value,2);
    $('sumaallshow').innerHTML=$('sumaall').value+' &euro;';
  }else{
    $('makeprojectcostshow').innerHTML='0.00 &euro;';
    $('costproject').value='0.00';
    $('sumaall').value=format(+$('sumaall').value - +$('makeprojectcost').value,2);
    $('sumaallshow').innerHTML=$('sumaall').value+' &euro;';
  }
}




/**pokazrejestracje()
 * decyduje co wyswietlic, czy frm osobowy czy okno logowania
 */ 
function pokazrejestracje(){
  if($('accountalready').checked){
    document.getElementById('rejestracja').style.display = 'none';  
    document.getElementById('logowanie').style.display = 'block';
  }else{
    document.getElementById('logowanie').style.display = 'none';
    document.getElementById('rejestracja').style.display = 'block';  
  }
}


/**ukryjall()
 * ukrywa wyswietlone elementy rejestracyjne
 */ 
function ukryjall(){
  if($('accountalready').checked){
    $('accountalready').value=1;//alert('1');
  }else{
    $('accountalready').value=0;//alert('0');
  }
    document.getElementById('rejestracja').style.display = 'none';  
    document.getElementById('logowanie').style.display = 'none';
}

