function open_window(link,w,h) //opens new window
{
	var win = "width="+w+",height="+h+",menubar=no,location=no,resizable=yes,scrollbars=yes";
	newWin = window.open(link,'newWin',win);
	newWin.focus();
}

function confirmDelete() //unsubscription confirmation
{
	temp = window.confirm('{/literal}{$smarty.const.QUESTION_UNSUBSCRIBE}{literal}');
	if (temp) //delete
	{
		window.location="index.php?killuser=yes";
	}
}
	
function toggleResult(id)
{
	var grupa = document.getElementById('grupa_'+id);

	if (grupa && grupa.style.display == 'none')
		grupa.style.display = 'block';
	else
		grupa.style.display = 'none';
}

function logout()
{
	$.ajax({
	     url: 'surse/ajax/logout.php',
	     success: function(response) {
	     	alert(response + 'Ati iesit din cont');
	     },
	     error: function(xhr) {
	        alert(xhr + 'Eroare la delogare!');
	     }
	 });
	 submit();
}

/* TabStrip */
function TabStrip(id, tabsCount)
{
	this.selected = id;
	this.tabsCount = tabsCount;
	this.renderTabs(this.selected);
}

TabStrip.prototype.renderTabs = function(selected)
{
	for(var i=0; i < this.tabsCount; i++)
	{
		if(i == selected)
			this.setActive(i);
		else
			this.setInactive(i);
	}
}

TabStrip.prototype.setActive = function(id)
{
	findObj('TabStrip_'+id).style.display = '';
	findObj('TabStripHeader_'+id).className = 'TabStripActive';
	//setCookie('TabStrip_activeTab', id);
}

TabStrip.prototype.setInactive = function(id)
{
	findObj('TabStrip_'+id).style.display = 'none';
	findObj('TabStripHeader_'+id).className = 'TabStripInactive';
}

TabStrip.prototype.showTab = function(id)
{
	this.renderTabs(id);
}

