function selectCheckboxes(what,pref){
  for(i=0;i<what.elements.length;i++){
    if(what.elements[i].type == "checkbox" && what.elements[i].name.substring(0,pref.length) == pref){
    	if(what.elements[i].checked)
    	what.elements[i].checked = '';
    	else
    	what.elements[i].checked = 'checked';
    }
  }
}

function show(co) {
var obiekt = document.getElementById(co);
if (obiekt.style.display == 'block') {
obiekt.style.display = 'none';
} else {
obiekt.style.display = 'block';
}
} 

function hide(co) {
var obiekt = document.getElementById(co);
obiekt.style.display = 'none';
} 

function maxLength1(o,v,m){
	if(o.value.length>m){
	  document.getElementById(v).innerHTML=
	    ((o.value=o.value.substr(0,m)).length);
    }
    else{
    document.getElementById(v).innerHTML=o.value.length;
    }
}

/**
 * Dodatkowe rzeczy od na luzie  by jach
 */

function setPartner(path) {
    var href = '/na-luzie/horoskopy/'+path+'/partner/'+$('#partner_first').val()+'/'+$('#partner_second').val()+'/';
    window.location = href;
    return;
}

function setHoroscopeUrl(path, select_id) {
    var href = '/na-luzie/horoskopy/'+path+'/'+$('#'+select_id).val();
    window.location = href;
    return;
}

function showBiorythm(url_date, url_first, url_second) {
    //na-luzie/biorytm/data/2010-05-05/pierwsza/1980-3-27/druga/2007-4-19/
    var href = '/na-luzie/biorytm/'+url_date+'/'+$('#biorythm_date').val()+'/'+url_first+'/'+$('#biorythm_year_first').val()+'-'+$('#biorythm_month_first').val()+'-'+$('#biorythm_day_first').val()+'/';

    if ($('#biorythm_year_second').val() != undefined && url_second != undefined) {
        href = href +url_second+'/'+$('#biorythm_year_second').val()+'-'+$('#biorythm_month_second').val()+'-'+$('#biorythm_day_second').val()+'/';
    }
        
    window.location = href;
    return;
}
function showHoroscopeTab(id) {

    $('#horoscope_id_'+id+'_sel').parent().children().removeClass('sel');
    $('#horoscope_id_'+id+'_sel').addClass('sel');
    $('#horoscope_tabs').children().hide();
    $('#horoscope_id_'+id+'').show();

}

function showHoroscopeForId(id) {
    $('#signDesc'+id+'').parent().children().hide();
    $('#signDesc'+id+'').show();
    $('#signLinks'+id+'').show();
}

function showNamesListForSex(id) {
    $('#namesListing_'+id+'').parent().children().hide();
    $('#namesListing_'+id+'').show();
    $('#namesListingShow_'+id).parent().children().removeClass('sel');
    $('#namesListingShow_'+id).addClass('sel');
}

function showContestGallery(id) {
    if ($('#contestGallery'+id).css('display') == 'block') {
        $('#contestGallery'+id).css('display', 'none')
        $('#contestGalleryButton'+id).html('rozwiń')
    } else {
        $('#contestGallery'+id).css('display', 'block')
        $('#contestGalleryButton'+id).html('zwiń')
    }
}