function open_pict(id,inwidth,inheight)
{

     pict_width=inwidth;
     pict_height=inheight;

     url="show_picture.php?id="+id;
     width=(screen.width/2)-220;
     info="width=440,height=329,top=200,left="+width;

     width=(screen.width/2)-pict_width/2;
     height=(screen.height/2)-pict_height/2-20;
     info="width="+pict_width+",height="+pict_height+",top="+height+",left="+width;
     window.open(url,id,info);
}

function open_mapa()
{
     var str_buffer = new String ("<html><head></head><body topmargin='0' leftmargin='0'><img src='data/images/maparegion.jpg' onclick='window.close();' style='cursor: pointer;'></body></body>");

	var vWmapa = window.open("", "Mapa", "width=800,height=533,status=no,resizable=yes,top=100,left=100");
	var mapa_doc = vWmapa.document;
	mapa_doc.write (str_buffer);
	mapa_doc.close();
}



function fnGetObject(sId) {
	if (document.all) 
		return document.all(sId)
	else if (document.getElementById) 
		return document.getElementById(sId)
	else if (document.layers) 
		return document.layers[sId]
	else
		return false;
}

function change_display() {
    for (var i=0; i < change_display.arguments.length; i++)
    {
        var elemID = change_display.arguments[i];
        var oDiv = fnGetObject(elemID);   
        oDiv.style.display = (oDiv.style.display=='none')?('inline'):('none');
    }
} 




function set_day_class(i,ii,module_id)
{
     document.getElementById(module_id+'den'+i).className='den-hover';
     document.getElementById(module_id+'mesiac'+ii).className='mesiac-hover';
}
          
function set_day_class_off(i,ii,module_id)
{
     document.getElementById(module_id+'den'+i).className='den';
     document.getElementById(module_id+'mesiac'+ii).className='mesiac';
}








function open_order(id,lng)
{

     pict_width=400;
     pict_height=350;

     url="objednavka.php?apartman_id="+id+"&lng="+lng;

     width=(screen.width/2)-pict_width/2;
     height=(screen.height/2)-pict_height/2-20;
     info="width="+pict_width+",height="+pict_height+",top="+height+",left="+width;
     window.open(url,id,info);
}


function open_obsadenost(lng,id)
{

     pict_width=900;
     pict_height=300;

     url="iframe_obsadenost2.php?year=1&apartman_id="+id+"&lng="+lng;

     width=(screen.width/2)-pict_width/2;
     height=(screen.height/2)-pict_height/2-20;
     info="width="+pict_width+",height="+pict_height+",top="+height+",left="+width;
     window.open(url,id,info);
}





















     var formatDate = function (formatDate, formatString) {
     	if(formatDate instanceof Date) {
     		var months = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
     		var yyyy = formatDate.getFullYear();
     		var yy = yyyy.toString().substring(2);
     		var m = formatDate.getMonth()+1;
     		var mm = m < 10 ? "0" + m : m;
     		var mmm = months[m];
     		var d = formatDate.getDate();
     		var dd = d < 10 ? "0" + d : d;
     		
     		var h = formatDate.getHours();
     		var hh = h < 10 ? "0" + h : h;
     		var n = formatDate.getMinutes();
     		var nn = n < 10 ? "0" + n : n;
     		var s = formatDate.getSeconds();
     		var ss = s < 10 ? "0" + s : s;
     
     		formatString = formatString.replace(/yyyy/i, yyyy);
     		formatString = formatString.replace(/yy/i, yy);
     		formatString = formatString.replace(/mmm/i, mmm);
     		formatString = formatString.replace(/mm/i, mm);
     		formatString = formatString.replace(/m/i, m);
     		formatString = formatString.replace(/dd/i, dd);
     		formatString = formatString.replace(/d/i, d);
     		formatString = formatString.replace(/hh/i, hh);
     		formatString = formatString.replace(/h/i, h);
     		formatString = formatString.replace(/nn/i, nn);
     		formatString = formatString.replace(/n/i, n);
     		formatString = formatString.replace(/ss/i, ss);
     		formatString = formatString.replace(/s/i, s);
     
     		return formatString;
     	} else {
     		return "";
     	}
     }
     
     function date_day_plusminus(d_input,type)
     {
     
          d=d_input.value.split('.');
          date1=new Date();
          date1.setFullYear(d[2],(d[1]-1),d[0]);
          
          if(type=='+')
               date1.setDate(date1.getDate()+1);
          else
               date1.setDate(date1.getDate()-1);
     
     
          return formatDate(date1,'dd.mm.yyyy');
     }

