var $myjQuery = jQuery.noConflict();

$myjQuery(document).ready(function(){
    $myjQuery(".rejestracja").colorbox(
    {
        iframe:true,
        innerWidth:360,
        innerHeight:580,
        preloading:true,
        overlayClose:false,
        scrolling:false       
    });
    $myjQuery(".logowanie").colorbox(
    {
        iframe:true,
        innerWidth:350,
        innerHeight:230,
        preloading:true,
        overlayClose:false,
        scrolling:false,
        onClosed:function(){ parent.window.location.reload(); }
    });
    $myjQuery(".logowanieKoszyk").colorbox(
    {
        iframe:true,
        title:'Formularz logowania',
        innerWidth:350,
        innerHeight:230,
        preloading:true,
        overlayClose:false,
        scrolling:false,
        onClosed:function(){ $myjQuery('#formularzKoszyk').submit(); }
    });
    $myjQuery(".regulamin").colorbox(
    {
        iframe:true,
        innerWidth:550,
        innerHeight:600,
        preloading:true,
        overlayClose:false,
        scrolling:true,
        onClosed:function(){ $myjQuery(".rejestracja").colorbox({open:true}); }
    });
});

function przelicz(){
   var tempCena = new Array();
   $myjQuery('div.ksiazka').each(function(){
           var sztuki = $myjQuery(this).children('#divsztuk').children('#sztuk').val();
           if (sztuki <= 0 || isNaN(parseFloat(sztuki)) || sztuki != Math.round(sztuki)) {
               sztuki = 1;
               $myjQuery(this).children('#divsztuk').children('#sztuk').val(sztuki)
           }
           var cena = $myjQuery(this).children('#divcena').children('#cena').html();
      if ($myjQuery(this).children('#zapowiedz').attr('id') != 'zapowiedz') {
           var tempSplit = cena.split(' ');
           tempCena.push((tempSplit[0] * sztuki)*10);
       }
   });
   $myjQuery('#suma').html(tempCena.sum()/10+' zł');
}
