function equalHeights(strObj){
    var numHeight = 0;
    $(strObj).each(function(){
        if($(this).height() > numHeight){
            numHeight = $(this).height();
        }
    });
    $(strObj).each(function(){
        $(strObj).height(numHeight);
    });
}

// return the value of the radio button that is checked
// return an empty string if none are checked, or
// there are no radio buttons
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

$(document).ready(function(){
    if (!$('#mycarousel').has("li")) {
        $('#mycarousel').remove();
        $('div[class^="jcarousel"]').remove();
    }
    if (!($('#mycarousel li').html())){
        $('#mycarousel').remove();
        $('div[class^="jcarousel"]').remove();
        $('.product-info').css({
            'padding-top':'15px'
        });
    }
    if ( ($('#mycarousel').has("li")) || ($('#mycarousel li').html()) ){
        jQuery('#mycarousel').jcarousel({
            vertical: false,
            scroll: 1
        });
	
    }


   $("#promotions_rotator").easySlider({
        prevText: '&nbsp;',
        nextText: '&nbsp;',
        auto: true,
        speed: 800,
        pause: 1500,
        continuous: true
   });

   

  
});
$(window).load(function(){
  

	
    $('#rotator').cycle({
        fx: 'fade',
	pager:  '#pagi',
        next:   '#next2',
        prev:   '#prev2'

    });

    

  /*
    $('#promotions_rotator').cycle({
        fx: 'cover',
        speed: 100,
	next:   '#promotions_rotator #next',
        prev:   '#promotions_rotator #prev'
    });
    */


    /*do boks promocje */
    //$('#promotions_rotator').show();


	
    if($('#div_id_main_page #cartForm').html() != undefined){
	$('#content div.right_side').each(function(){
	$(this).addClass('display-none'); 
	});
	}
	
	if($('#div_id_main_page #cartForm').html() != undefined){
	$('#content div.mid_side').each(function(){
	$(this).addClass('no-right-side'); 
	});
	}
	
	 $("div.select").change(function () {
          var str = "";
          $("select option:selected").each(function () {
                str += $(this).text() + " ";
              });
          $("div").text(str);
        })
        .trigger('change');
	
	if(document.getElementById('ship_post')!=undefined) {
    if(document.getElementById('ship_post').style.display == 'none')
		{
			document.getElementById('total_price_brutto_copy').innerHTML = '<strong>' + (parseFloat(document.getElementById('total_price_brutto_dynsrc').value.replace(',','.').replace(new RegExp('&nbsp;','g'),'')) + parseFloat(document.getElementById('hlpg_wys_koszt_' + getCheckedValue(document.getElementsByName('wysylka[0]')).toString()).value)).number_format() + '</strong>';
		}
		else
		{
			document.getElementById('total_price_brutto_copy').innerHTML = '<strong>' + (parseFloat(document.getElementById('total_price_brutto_dynsrc').value.replace(',','.').replace(new RegExp('&nbsp;','g'),'')) + parseFloat(document.getElementById('hlp_wys_koszt_' + getCheckedValue(document.getElementsByName('wysylka[1]')).toString()).value)).number_format() + ' </strong>';
		}
	}
	
});
	
