var Tout;

function show(id,num){
for(i=0;i<num;i++)
   {
   if(document.getElementById("t"+i)){
     document.getElementById("t"+i).style.display="none";}
   }
if(Tout!="") clearTimeout(Tout); 
  document.getElementById(id).style.display="block";
}

function hide(id){
 if(Tout!="") clearTimeout(Tout); 
   Tout=setTimeout('document.getElementById("'+id+'").style.display="none"',300);
 }
 
function expand(id){
   element = document.getElementById(id);
   element.style.display =(element.style.display=="block")?"none":"block";
 }

function showActiveMenu(id)
 {
 if(document.getElementById(id))
   document.getElementById(id).style.display="block"; 
 }
 
function lang(lang)
{
 var current=window.location.href;
 var new_loc;
 if(/lang=/.test(current))
   new_loc=current.replace(/lang=\w*/,"lang="+lang);
 else if(/\?/.test(current))
   new_loc=current+"&lang="+lang;
 else 
   new_loc=current+"?lang="+lang;  
 window.location.replace(new_loc);
}

 
 
function showPic(pic,width,height)
{ 
sDesrc = "width=" + width + ", height=" + height +
		", status=no, toolbar=no, menubar=no, scrollbars=no";
win=window.open("Gallery", "displayWindow", sDesrc);
win.document.write("<html><style>body{padding:0px;margin:0px;}</style><body>");
win.document.write("<img src='uploads/picgallery/"+pic+"' width='"+width+"' height='"+height+"'><br>");
win.document.write("</body></html>");
} 

function showMenu(id)
 {
 if(element=document.getElementById(id))
   {
   if(element.style.display!="block") element.style.display="block";
   else element.style.display="none";
   }
 }
 
function showVideo(name, width, height, autostart, showcontrols, showstatusbar, showdisplay, autorewind)//path,
{
	autostart = autostart ? autostart : 'True'; 
	showcontrols = showcontrols ? showcontrols : 'True';
	showstatusbar = showstatusbar ? showstatusbar : 'False';
	showdisplay = showdisplay ? showdisplay : 'False';						
	autorewind = autorewind ? autorewind : 'True';
	height = parseInt(height) + 50;
	var html = '';
	
    html += '<object width="' + width + '" height="' + height + '" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95">\n';
    html += '<param name="Filename"      value="' + name + '">\n'; //+ path 
    html += '<param name="AutoStart"     value="' + autostart + '">\n';
    html += '<param name="ShowControls"  value="' + showcontrols + '">\n';
    html += '<param name="ShowStatusBar" value="' + showstatusbar + '">\n';
    html += '<param name="ShowDisplay"   value="' + showdisplay + '">\n';
    html += '<param name="AutoRewind"    value="' + autorewind + '">\n';

    html += '<embed type="application/x-mplayer2"\n'; 
    html += ' pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/"'; 
    html += ' width="'         + width + '"\n'; 
    html += ' height="'        + height + '"\n'; 
    html += ' src="'           + name + '"\n';//path + 
    html += ' filename="'      + name + '"\n';
    html += ' autostart="'     + autostart + '"\n';
    html += ' showcontrols="'  + showcontrols + '"\n';
    html += ' showstatusbar="' + showstatusbar + '"\n'; 
    html += ' showdisplay="'   + showdisplay + '"\n';
    html += ' autorewind="'    + autorewind + '">\n';
    html += '</embed>'; 
    html += '</object>\n';

	sDesrc = "width=" + width + ", height=" + height + ", status=no, toolbar=no, menubar=no, scrollbars=no";
	win = window.open("Video", "", sDesrc);
	win.document.write("<html>\n<style>\nbody{padding:0px;margin:0px;}</style>\n<body>\n");
	win.document.write(html);
	win.document.write("</body>\n</html>\n");
	win.document.close();
}

var send = function(link)
{
 	var dataToSend = document.getElementById('calendar_y').value + "." + document.getElementById('calendar_m').value;
 	var ajax = new httpAjaxRequest(); 
	if(ajax)
	{  

		ajax.prepareHash({date:dataToSend}); 
		ajax.open("GET", "ajax.php");
		ajax.send();
		ajax.getData();
		ajax.onreadystatechange = function()
		{ 
			data = ajax.getResult();
			document.getElementById("calendar_div").innerHTML = data.calendar; 
		}  
	}
 	else 
 	{
 		window.location = link + document.getElementById('calendar_y').value + "." + document.getElementById('calendar_m').value;
 	}
}












