// JavaScript Document

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 or higher.
	{
	for(var i=0; i<document.images.length; i++)
		{
		var img = document.images[i]
		var imgName = img.src.toUpperCase()
			if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
				{
				var imgID = (img.id) ? "id='" + img.id + "' " : ""
				var imgClass = (img.className) ? "class='" + img.className + "' " : ""
				var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
				var imgStyle = "display:inline-block;" + img.style.cssText 
				if (img.align == "left") imgStyle = "float:left;" + imgStyle
				if (img.align == "right") imgStyle = "float:right;" + imgStyle
				if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle               
				var strNewHTML = "<span " + imgID + imgClass + imgTitle
				+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
				+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
				+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
				img.outerHTML = strNewHTML
				i = i-1
			}
		}
	}
//window.attachEvent("onload", correctPNG);

function ShowTree(id){
	var menu = 'TABLE' + id;
	var folder = 'FOLDER' + id;
	var node = 'NODE' + id;
	if(document.all(menu) != null){
		if(document.all(menu).style.display == 'none'){
			for(i=1;i<10;i++){
			if(document.all('TABLE'+i)!= null)
			document.all('TABLE'+i).style.display = 'none';
			}
			document.all(menu).style.display = '';
			//document.images[node].src = '/img/node_minus.gif';
		}
		else{
			document.all(menu).style.display = 'none';
			//document.images[node].src = '/img/node_plus.gif';
		}
	}
}

function showfot(id) {
document.getElementById('fot1').style.display='none';
document.getElementById('fot2').style.display='none';
document.getElementById('fot3').style.display='none';
document.getElementById('fot4').style.display='none';
document.getElementById('fot5').style.display='none';
document.getElementById('fot6').style.display='none';
document.getElementById('fot'+id).style.display='block';
}

function popwin(url,w,h) {
k = url.indexOf(".jpg");
tmp = url.substring(k-15,k);
m = tmp.indexOf("/");
if(m==-1){
buf1 = tmp.substring(0,3);buf2 = tmp.substring(4,8);buf3 = tmp.substring(9,13);buf4 = tmp.substring(14,15);
id=buf1+buf2+buf3+buf4;title=buf1+"-"+buf2+"-"+buf3+"-"+buf4;
}else{
buf1 = tmp.substring(2,5);buf2 = tmp.substring(6,10);buf3 = tmp.substring(11,15);
id=buf1+buf2+buf3;title=buf1+"-"+buf2+"-"+buf3;
}
opwin = window.open("",id,"width="+w+",height="+h+",top=260,left=196,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no")
opwin.document.write("<HTML><head><title>"+title+"</title></head><BODY style=\"margin:0\">");
opwin.document.write("<div align=\"center\">");
opwin.document.write("<img src=..//%22%22+url+%22/%22>");
opwin.document.write("</div>")
opwin.document.write("</BODY></HTML>");
opwin.document.close();
}

//---OPERA FOTO-----
function popupon(layername,URL)//---foto operi-----
        {
        popupimg.name = URL;
        popupimg.src= URL;
        valtop=document.body.scrollTop;
        valheight=Math.abs(document.body.clientWidth/2-600/2+14);
        if(valtop<166){valtop=166;}
        document.getElementById(layername).style.visibility = "visible";
        document.getElementById(layername).style.top=valtop+14+document.body.clientHeight/2-220;
        document.getElementById(layername).style.left=valheight;
        document.getElementById(layername).focus();
        }
function popupon2(layername,URL)//---foto anketi-----
        {
        popupimg.name = URL;
        popupimg.src = URL;
        valtop=document.body.scrollTop;
        valheight=Math.abs(document.body.clientWidth/2-280/2+14);
        if(valtop<166){valtop=166;}
        document.getElementById(layername).style.visibility = "visible";
        document.getElementById(layername).style.top=valtop+14+document.body.clientHeight/2-220;
        document.getElementById(layername).style.left=valheight;
        document.getElementById(layername).focus();
        }
function popupon3(layername,URL)//---foto galereia-----
        {
        popupimg.name = URL;
        popupimg.src= URL;
        valtop=document.body.scrollTop;
        valheight=Math.abs(document.body.clientWidth/2-740/2+14);
        if(valtop<166){valtop=166;}
        document.getElementById(layername).style.visibility = "visible";
        document.getElementById(layername).style.top=valtop+14+document.body.clientHeight/2-250;
        document.getElementById(layername).style.left=valheight;
        document.getElementById(layername).focus();
        }
function popupoff(layername)
        {
        layername.style.height=0;
        layername.style.width=0;
        layername.style.visibility = "hidden";
        }
//----END OPERA FOTO------

//----OPENING FLASH BILETI-----
function popflash() {
        flashwin=window.open("popflash.htm","Bileti","status=yes,toolbar=no,menubar=no,resizable=yes,scrollbars=no,width=900,height=580");
        flashwin.focus();
}
function popflash2(lang) {
	if(lang=="RU"){
        flashwin=window.open("http://www.nationalopera.md/popflash_ru.htm","Bileti","status=yes,toolbar=no,menubar=no,resizable=yes,scrollbars=no,width=900,height=580");
        flashwin.focus();}
	if(lang=="MD"){
        flashwin=window.open("http://www.nationalopera.md/popflash_md.htm","Bileti","status=yes,toolbar=no,menubar=no,resizable=yes,scrollbars=no,width=900,height=580");
        flashwin.focus();}
	if(lang=="EN"){
        flashwin=window.open("http://www.nationalopera.md/popflash_en.htm","Bileti","status=yes,toolbar=no,menubar=no,resizable=yes,scrollbars=no,width=900,height=580");
        flashwin.focus();}
}
//----END OPENING FLASH BILETI-----

//----ACTIVATING FLASH-----
function flash(flash_content){
	document.write(flash_content);
	}
//----ACTIVATING FLASH-----

var last_shcal='calendar_1';
function shcal(id){
	obj = document.getElementById(id);
	document.getElementById(last_shcal).style.display = 'none';
	obj.style.display = '';
	last_shcal = obj.id;
}

function $(id){
	return document.getElementById(id);
}

//var menuactsrc = 0;
function menuact(obj, act){
	var imgsrc = 'images_main/design/menu_act.gif';
	var imgsrc2 = 'images_main/design/menu_act2.gif';
	if(act){
		if(menuactsrc)menuactsrc.src = imgsrc;
		obj.src = imgsrc2;
	}else{
		obj.src = imgsrc;
		if(menuactsrc)menuactsrc.src = imgsrc2;
	}
}

var lnkajax;
function calact(obj){//alert(obj);
	if(!lnkajax){lnkajax = obj.parentNode;}
	lnkajax.className = '';
	obj.parentNode.className = 'lnkajax';
	lnkajax = obj.parentNode;
}



