function pokaz(idDiv){
	document.getElementById(idDiv).style.display='block';
}

function ukryj(idDiv){
	document.getElementById(idDiv).style.display='none';
}

function pokaz_ukryj(idDiv){

	if (document.getElementById(idDiv).style.display == 'block') {

		document.getElementById(idDiv).style.display = 'none';
	}
	
	else{

		document.getElementById(idDiv).style.display = 'block';
	}
}

function colorize(id){
	document.getElementById(id).style.background="#de5900";
	document.getElementById(id).style.color="#ffffff";
}

function uncolorize(id){
	document.getElementById(id).style.background="#ffffff";
	document.getElementById(id).style.color="#6f6b62";
}

function getElementsByClassName(cn){
  var arr = new Array(); 
  var els = document.getElementsByTagName("*");
  var exp= new RegExp("^(.* )?"+cn+"( .*)?$", "g");
  for (var i = 0; i < els.length; i++ ){
    if (exp.test(els[i].className)){
      arr.push(els[i]);
    }
  }
  return arr;
}
function showHideRows(classNameHide,classNameShow){
    
    arrRowsHide = getElementsByClassName(classNameHide);
    arrRowsShow = getElementsByClassName(classNameShow);
    arrLangBoxes = getElementsByClassName('lang_box');
    
    var tabCount=0;
    tabCount = arrRowsHide.length;
    for(var i=0;i<arrRowsHide.length;i++){
        arrRowsHide[i].style.display = 'none';
    }
    for(var i=0;i<arrRowsShow.length;i++){
        arrRowsShow[i].style.display = "";
    }
    for(var i=0;i<arrLangBoxes.length;i++){
        arrLangBoxes[i].className = 'lang_box_hidden';
    }
}


function checkAgeTo(value){
    for(var i=18;i<=99;i++){
        document.getElementById('age_to_'+i).style.display="";
    }
    for(var i=18;i<=value;i++){
        document.getElementById('age_to_'+i).style.display="none";
    }
    if(value>=document.getElementById('select_age_to').value){
        var plus_one = parseInt(value)+1;
        document.getElementById('select_age_to').value=plus_one;
    }    
}

function countHPtoKW(hpID,kwID){

    var hpValue = document.getElementById(hpID).value;
    var kwValue;
    
    kwValue = Math.floor(hpValue*0.746);

    document.getElementById(kwID).value = kwValue;
}

function changeValue(id){
    if(document.getElementById(id).value == 1) document.getElementById(id).value=2;
    else if(document.getElementById(id).value == 2) document.getElementById(id).value=1;
}
function disableFormFields(){
    document.getElementById('searchCatId').selectedIndex=0;
    document.getElementById('searchArtistId').selectedIndex=0;
    document.getElementById('searchPriceFId').value='';
    document.getElementById('searchPriceTId').value='';
}

function odpowiedz(strTresc){
	document.getElementById("theme").value = strTresc;
}

function wstaw_wartosc(obj){
    if(obj.value != 1 ) obj.value=0;
    
}

function msg_options(){
    $('#message_options').toggle();
}

function check_all_messages(){
    var arrCheckbox = document.getElementsByTagName('input');
    var j=0;
    for(var i=0;i<arrCheckbox.length;i++){
        if(arrCheckbox[i].type=='checkbox'){
            arrCheckbox[i].checked='checked';
            j++;
        }
    }
    $('#message_options').toggle();
    alert("Zaznaczono "+j+" wiadomości");
}
function uncheck_all_messages(){
    var arrCheckbox = document.getElementsByTagName('input');
    var j=0;
    for(var i=0;i<arrCheckbox.length;i++){
        if(arrCheckbox[i].type=='checkbox'){
            arrCheckbox[i].checked='';
            j++;
        }
    }
    $('#message_options').toggle();
    alert("Odznaczono wszystkie wiadomości");
}
function check_readed_messages(){
    var arrCheckbox = document.getElementsByTagName('input');
    var j=0;
    for(var i=0;i<arrCheckbox.length;i++){
        arrCheckbox[i].checked='';
        if(arrCheckbox[i].type=='checkbox' && arrCheckbox[i].value=='1'){
            arrCheckbox[i].checked='checked';
            j++;
        }
    }
    $('#message_options').toggle();
    alert("Zaznaczono "+j+" wiadomości");
}
function check_unreaded_messages(){
    var arrCheckbox = document.getElementsByTagName('input');
    var j=0;
    for(var i=0;i<arrCheckbox.length;i++){
        arrCheckbox[i].checked='';
        if(arrCheckbox[i].type=='checkbox' && arrCheckbox[i].value=='0'){
            arrCheckbox[i].checked='checked';
            j++;
        }
    }
    $('#message_options').toggle();
    alert("Zaznaczono "+j+" wiadomości");
}
