﻿// JScript File
var firstTitle = "";
var firstAudioTitle = "";
var firstImageTitle = "";
function selTab(tab, div, nr) {
    for (var i = 1; i <= 3; i ++){
    
		if (i == nr){
		    try {
			    document.getElementById(tab+""+i).className = "tabOn";
			    document.getElementById(div+""+i).style.display = "block";
			}   catch(e) {}
		} else {
		    try {
			    document.getElementById(tab+""+i).className = "tabOff";	
			    document.getElementById(div+""+i).style.display = "none";
			}   catch(e) {}
		}
		
	}
		if (nr == 1){
		    try {
			    document.getElementById("td"+div+""+3).className = "tdSep";
			    document.getElementById("td"+div+""+2).className = "";
			    setTitle(firstTitle);
			}   catch(e) {}    
		}
		if (nr == 3){
		    try {
			    document.getElementById("td"+div+""+2).className = "tdSep";
			    document.getElementById("td"+div+""+3).className = "";
			}   catch(e) {}    
		}
		if (nr == 2){
		    try {
			    document.getElementById("td"+div+""+2).className = "";
			    document.getElementById("td"+div+""+3).className = "";
			    setAudioTitle(firstAudioTitle);
			}   catch(e) {}    
		}		
	
}


function mailpage() {
    var doctitle = document.title;
    var mail_str = "mailto:?subject=Uite o pagina interesanta: " + doctitle;
	mail_str += "&body=M-am gandit ca te intereseaza asta: " + doctitle + ". ";
	mail_str += "Poti sa o vezi la: " + location.href; 
	location.href = mail_str;
	}    
	
function thisMovie(movieName) {
	    if(navigator.appName.indexOf("Microsoft") != -1) {
		    return window.document[movieName];
	    } else {
		    return document[movieName];
	    }
    }
    

function NewWindow(mypage,myname,w,h,scroll,pos)
    {
    if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
    if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2-50:100;}
    else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
    settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
    win=window.open(mypage,myname,settings);
    }     
    
function PopupPic(sPicURL) { 
    window.open("/utils/popup.html?"+sPicURL, "", "resizable=1,HEIGHT=200,WIDTH=200");
    //NewWindow("/utils/popup.html?"+sPicURL, "image", 250, 250, 0, "left");
    }

function checkSiblings(chkstatus, catid)
    {
    for(var i=0; i < CatArr.length; i++)
        {
        if(CatArr[i].parentid == catid)
            {
            var obj = document.getElementById(CatArr[i].chkid);
            obj.checked = chkstatus;
            
            if(CatArr[i].isleaf == 0)
                checkSiblings(chkstatus, CatArr[i].catid);
            }
        }
    }
