
function getWojSelect(nr,where,txt){
    var woj = document.getElementById(where+'wojewodztwo');
    var jest = 0;
    for (i=0;i<woj.length;i++){
       if (woj.options[i].value==nr){
            jest = 1;
       }
    }
    if (jest==1){
        woj.value=nr;
        str = "&wojewodztwo="+nr;
        if (where=='p'){
            show_miejsce_piloci_mapa('minipilglowna_blockf_miejsce_region',str);    
        }else{
            show_miejsce_atrakcji_mapa('miniatrglowna_blockf_miejsce_region',str); 
        }        
    }else{
        alert(txt);
    }      
}
function zaznaczWoj(name,where){ 
    document.getElementById('img'+where).src  = '/cms/pix/polandguide/'+name+'.png';    
}
function odznaczWoj(where){
    if (where=='piloci'){
        document.getElementById('img'+where).src  = '/cms/pix/polandguide/mapa_piloci.png';           
    }else{
        document.getElementById('img'+where).src  = '/cms/pix/polandguide/mapa_atr.png';   
    }
}

function showCalIn(id,pilot,data,idSave){
    var str="&id="+id+"&pilot="+pilot+"&data="+data+"&idSave="+idSave;  
    mint.Request('/cms/_actions/AjaxFunctions.php?f=showCalIn'+str, 'txtCalendary');    
}
function zmien_width_div(){
    var dest_lewy = 63;
    var dest_prawy = 65;
    var obr = 963;
    if (screen.width < 1100){
        pozostaje = screen.width - obr;
        lewy = Math.ceil(pozostaje/2);
        prawy = (pozostaje - lewy)
        dest_lewy = lewy-8;
        dest_prawy = prawy-8;    
    }
    all = dest_lewy + dest_prawy + obr;
    document.getElementById('main').style.width = all+'px';    
    document.getElementById('img_left').style.width = dest_lewy+'px';
    document.getElementById('img_right').style.width = dest_prawy+'px'; 
}
function zwin_rozwin(id1,id2){
    var div1 = document.getElementById(id1);
    var div2 = document.getElementById(id2);
    if (div1.style.display == 'none'){
        div1.style.display = 'block';
        div2.style.display = 'none';        
    }else{
        div1.style.display = 'none';
        div2.style.display = 'block';           
    }
}

function ParentOpen(link){
    window.parent.location=link;
}
function WyczyscPole(name){
    document.getElementById(name).value = '';   
}
function getStrForm(form){
    var str = '';
    for (i=0;i<form.length;i++){
        str += '&'+form[i].name+'='+form[i].value;
    }
    return str;
}


function show_miejsce_piloci_wysz(div,form){
    var str=getStrForm(form);    
    mint.Request('/cms/_actions/AjaxFunctions.php?f=ShowMiejscePilociWysz'+str, div);
}
function show_miejsce_piloci_mapa(div,str){
    
    mint.Request('/cms/_actions/AjaxFunctions.php?f=ShowMiejscePilociWysz'+str+'&FormName=minipilglowna', div);
}
function show_jezyk_piloci_wysz(div,form){
    var str=getStrForm(form);
    mint.Request('/cms/_actions/AjaxFunctions.php?f=ShowJezykPilociWysz'+str, div);
}


function show_miejsce_atrakcji_wysz(div,form){
    var str=getStrForm(form);    
    mint.Request('/cms/_actions/AjaxFunctions.php?f=ShowMiejsceAtrakcjiWysz'+str, div);
}
function show_miejsce_atrakcji_mapa(div,str){  
    mint.Request('/cms/_actions/AjaxFunctions.php?f=ShowMiejsceAtrakcjiWysz'+str+'&FormName=miniatrglowna', div);
}
function show_jezyk_atrakcji_wysz(div,form){
    var str=getStrForm(form);
    mint.Request('/cms/_actions/AjaxFunctions.php?f=ShowJezykAtrakcjiWysz'+str, div);
}
function show_rodzaj_atrakcji_wysz(div,form){
    var str=getStrForm(form);    
    mint.Request('/cms/_actions/AjaxFunctions.php?f=ShowRodzajAtrakcjiWysz'+str, div);
}





function show_miejsce_atrakcji(div,val){
    mint.Request('/cms/_actions/AjaxFunctions.php?f=ShowMiejsceAtrakcji&wojewodztwo='+val, div);
}

function add_miejsce_atrakcji(div,val){
    mint.Request('/cms/_actions/AjaxFunctions.php?f=AddMiejsceAtrakcji&val='+val, div);
}

function show_miejsce_piloci(div,val){
    mint.Request('/cms/_actions/AjaxFunctions.php?f=ShowMiejscepiloci&wojewodztwo='+val, div);
}
function add_miejsce_piloci(div,val){
    mint.Request('/cms/_actions/AjaxFunctions.php?f=AddMiejscepiloci&val='+val, div);
}
function add_jezyk(div,val){
    if (val=='new'){
        mint.Request('/cms/_actions/AjaxFunctions.php?f=AddJezyk', div);
    }
}
function add_kolejny_jezyk(nr){
        mint.Request('/cms/_actions/AjaxFunctions.php?f=AddJezyk&nrwiersz='+nr, 'jezyk_new_'+nr);    
}

function NullDate(id){
    document.getElementById(id).value = '0001-01-01';
}
function pokazUkryjPozostale(nr){//atrakcje
    x = document.getElementById('atrakcje_opis_atrakcji').getElementsByTagName("div");
    for (i=0;i<x.length;i++){
        if (x[i].className == 'blockLang'){
            document.getElementById(x[i].id).style.display = 'none';
        }
    }
    document.getElementById("jezyk_v_"+nr).style.display = 'block';
    y = document.getElementById('atrakcje_opis_atrakcji').getElementsByTagName("input");
    for (j=0;j<y.length;j++){
        if (y[j].className == 'input_jezyk'){
            document.getElementById(y[j].id).style.backgroundColor = '#DDDDDD';
            document.getElementById(y[j].id).style.color = '#564845';
        }
    }
    document.getElementById("change_lang_"+nr).style.backgroundColor = '#C01C19';
    document.getElementById("change_lang_"+nr).style.color = '#ffffff';        
}
function pokazUkryjPozostale2(nr){//piloci
    x = document.getElementById('piloci_opis_piloci').getElementsByTagName("div");
    for (i=0;i<x.length;i++){
        if (x[i].className == 'blockLang'){
            document.getElementById(x[i].id).style.display = 'none';
        }
    }
    document.getElementById("jezyk_v_"+nr).style.display = 'block';
    y = document.getElementById('piloci_opis_piloci').getElementsByTagName("input");
    for (j=0;j<y.length;j++){
        if (y[j].className == 'input_jezyk'){
            document.getElementById(y[j].id).style.backgroundColor = '#DDDDDD';
            document.getElementById(y[j].id).style.color = '#564845';
        }
    }
    document.getElementById("change_lang_"+nr).style.backgroundColor = '#C01C19';
    document.getElementById("change_lang_"+nr).style.color = '#ffffff';        
}

var status=0; 
var win; 
var id; 
function plik() 
{ 
 if(status==0)  // wlączenie 
  {win=window.open('mag/pl.php','plik','height=200,width=400'); 
 win.focus(); 
   status=1; 
   } 
 if (status==1) // wlączenie powtórzeń 
   {  if ( win.closed ) 
       { status=3;} 
      id=window.setInterval("plik()",3000); 
     status=2; 
    } 
 if(status==2)  // sprawdzenie 
   {  if (win.closed) 
       { status=3;} 
    } 
 if (status==3)  // i efekt 
  { 
    alert("OKNO ZAMKNIĘTE"); 
      ststus=0; 
       window.clearInterval(id);} 
}  

function SendRequest(div,idform) {
    var req = mint.Request();
    req.OnSuccess = function() {
        $(div).innerHTML = this.responseText;
    }
    req.SendForm(idform);
} 

