/********OPEN POPUP IN CENTER OF SCREEN********/
var version4 = (navigator.appVersion.charAt(0) == "4"); 
var popupHandle;
function closePopup() {
if(popupHandle != null && !popupHandle.closed) popupHandle.close();
}
function displayPopup(position,url,name,height,width,evnt) {
var properties = "toolbar = 0, location = 0, height = " + height;
properties = properties + ", width=" + width;
var leftprop, topprop, screenX, screenY, cursorX, cursorY, padAmt;
if(navigator.appName == "Microsoft Internet Explorer") {
screenY = document.body.offsetHeight;
screenX = window.screen.availWidth;
}
else {
screenY = window.outerHeight
screenX = window.outerWidth
}
if(position == 1)	{ // if POPUP not CENTER
cursorX = evnt.screenX;
cursorY = evnt.screenY;
padAmtX = 10;
padAmtY = 10;
if((cursorY + height + padAmtY) > screenY) {
// make sizes a negative number to move left/up
padAmtY = (-30) + (height * -1);
// if up or to left, make 30 as padding amount
}
if((cursorX + width + padAmtX) > screenX)	{
padAmtX = (-30) + (width * -1);	
// if up or to left, make 30 as padding amount
}
if(navigator.appName == "Microsoft Internet Explorer") {
leftprop = cursorX + padAmtX;
topprop = cursorY + padAmtY;
}
else {
leftprop = (cursorX - pageXOffset + padAmtX);
topprop = (cursorY - pageYOffset + padAmtY);
   }
}
else{
leftvar = (screenX - width) / 2;
rightvar = (screenY - height) / 2;
if(navigator.appName == "Microsoft Internet Explorer") {
leftprop = leftvar;
topprop = rightvar;
}
else {
leftprop = (leftvar - pageXOffset);
topprop = (rightvar - pageYOffset);
   }
}
if(evnt != null) {
properties = properties + ", left = " + leftprop;
properties = properties + ", top = " + topprop;
}
closePopup();
popupHandle = open(url,name,properties);
}

function open_close()
{
	window.close();
}
/**********************************/

/*********VALIDARE NEWSLETTER***********/
function validare_subscr()
{
	
	with(document.adaugaForm)
	{
	var s = "Camp obligatoriu: ";
	var w = new Array();	
	w[0] = "nume";
	w[1] = "prenume";
	w[2] = "email";
	

		for (i=0;i<w.length;i++)
		{		
			e = document.adaugaForm.elements[w[i]];
			val = e.value;
			if(val == "")
			{									
							
				alert(s + e.name);
				e.focus();
				return false;
			}	
			
		}
		return true;	
	}
}
/*********END VALIDARE NEWSLETTER***********/
/*----------------------------------------------------------------------------------------------------------------------------------------------------------*/

function set_active_tab(new_selected_tab)
{

    var last_selected_tab = last_tab;
    
    //var last_selected_tab_obj = $("tab_337");
    
    
    
    var available_children = last_selected_tab_obj.getElementsByTagName("td");
    alert(new_selected_tab);
    set_class_general(available_children[0],"tnsl");
    set_class_general(available_children[1],"tnsm");
    set_class_general(available_children[2],"tnsr");
    
    $("tab_content_"+last_selected_tab).style.display="none";
    $("tab_content_"+new_selected_tab).style.display="block";
	alert($("tab_content_"+new_selected_tab));
    
    var new_selected_tab_obj = $("tab_"+new_selected_tab);
    
    var available_children = new_selected_tab_obj.getElementsByTagName("td");
    
    set_class_general(available_children[0],"tsl");
    set_class_general(available_children[1],"tsm");
    set_class_general(available_children[2],"tsr");
    
    last_tab = new_selected_tab;
    
    return false;
    
}