selgros = {
	curent : null,
	menu : function(){
	
		if (window.attachEvent)
			sfHover();
		k = 0;
		if(document.getElementById("menu")){
			men = document.getElementById("menu");
			for(i=0;i< men.childNodes.length; i++){
				if(men.childNodes[i].nodeType == 1 && men.childNodes[i].tagName == "LI"){
					link = men.childNodes[i].firstChild;					
					while(link.nodeType != 1 && link.tagName != "A"){
						link = link.nextSibling;						
					}
					submenu = null;
					submenu = link.nextSibling;					
					while(submenu && submenu.nodeType != 1 && submenu.tagName != "UL"){
						submenu = submenu.nextSibling;
					}
					if(submenu && submenu.tagName == "UL"){
						link.onclick = function(){
							submenu = this.nextSibling;
							while(submenu && submenu.nodeType != 1 && submenu.tagName != "UL"){
								submenu = submenu.nextSibling;
							}
							if(selgros.curent != null){
								selgros.curent.style.display = "none";
							}
							if(selgros.curent != submenu){
								selgros.curent = submenu;
								selgros.curent.style.display = "block";
							}else{
								selgros.curent = null;
							}
							this.blur();
							return false;
						}
						if (menuActiv == k){
							submenu.style.display = "block";
							selgros.curent = submenu;							
						}
						k++;
					}
				}
			}
		}
		selgros.proceseazaImagini();
	},
	
	proceseazaImagini : function(){		    	    
		//sursa = document.getElementById("main");		
		imagini = document.getElementsByTagName("IMG");	
		
		for(i=0; i< imagini.length; i++){
			media = imagini[i].src.indexOf("/images/media");			
			th = imagini[i].src.indexOf("/th_");
			if(media > 0 && th > 0 && th > media){
				if(imagini[i].align){
					//imagini[i].className = "imagine" + imagini[i].align;
				}
				imagini[i].onclick = function(){
					selgros.deschide(this.src.replace('th_',''));
				}
				imagini[i].style.cursor = "pointer";
			}
		}
	},
	
	deschide : function (imagine){
		win = window.open( "", "_blank", "resizable=0,HEIGHT=100,WIDTH=100"); 
		obiect = new Image();
		obiect.src = imagine;
		obiect.onload = function(){
				latime = document.all?win.document.body.clientWidth:win.window.innerWidth; 
				inaltime = document.all?win.document.body.clientHeight:win.window.innerHeight;
				win.document.write("<html><head style=\"margin: 0; padding: 0;\"></head><body style=\"margin: 0; padding: 0;\"><img src=\""+imagine+"\" alt=\"Click pentru a inchide poza\" onclick=\"window.close()\" /></body></html>");
				win.resizeBy((obiect.width - latime), (obiect.height - inaltime));
				win.focus();
		}
	}
}
sfHover = function() {
	/*var sfEls = document.getElementById("menuHome").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" menuHover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" menuHover"), "");
		}
	}*/
	/*var sfEls = document.getElementById("menu").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" menuHover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" menuHover"), "");
		}
	}*/
}
//onload = selgros.menu

function showhide(id){ 
    if (document.getElementById){ 
        obj = document.getElementById(id); 
        if (obj.style.display == "none"){ 
            obj.style.display = ""; 
        } else { 
            obj.style.display = "none"; 
        } 
    } 
} 
function hide(id){
    if (document.getElementById){ 
        obj = document.getElementById(id);
        obj.style.display = "none";
    }
}

function open_apply_job(location,job){
    window.location = "index.php?task=page&page=job_apply&location="+location+"&job="+escape(job);
}

function open_job(job_page){
    window.open( "index.php?task=popup_page&page="+job_page, "_blank", "scrollbars=1,resizable=0,HEIGHT=450,WIDTH=470");
}

function turvirtual(intrare){
	window.open("vr/" + intrare, "_blank", "resizable=1,HEIGHT=460,WIDTH=500");
}