function showTab(tab,tabButton) {
	// get this moment
	var ora = new Date().getTime();
	//transform in a string
	ora = ora+"";
	//get the less significative digits
	var lung = ora.substring(6,ora.length+1);
	//var randomnumber=Math.floor(Math.random()*1001);
	//get the div to open
	tabToOp = document.getElementById(tab);
	// set the opacity to 0
	setOpac1(tabToOp,0);
	// set the z index of the element equal to the date
	tabToOp.style.zIndex = lung;
	// set the embeddet op veriable to 0
	tabToOp.op = 0;
	//start the fading loop
	for (loop=0; loop<10; loop++)
	{ 
	   var timer = window.setTimeout(function(){augOpac(tabToOp);}, loop*15)
	}
	//mark the actual tab button
	markActualTab(tabButton);
}

function augOpac(what) {
	  what.op = what.op+10;
    if(document.all) /* se sto usando internet explorer*/
       what.style.filter = "alpha(opacity=" + what.op + ")";
    else
       what.style.opacity = what.op / 100;
			 
		// Start the video if tab4 is selected and the tab is fully visible
		
		//if(what.id == "tab4" && ytplayer && what.op == 100) {ytplayer.playVideo();}
}

function setOpac1(what,obscurity) {
    if(document.all) /* se sto usando internet explorer*/
       what.style.filter = "alpha(opacity=" + obscurity + ")";
    else
       what.style.opacity = obscurity / 100;
	
}


function markActualTab (actualTab) {
	var tabMenu = document.getElementById("tabMenu");
	var tabLabels = tabMenu.getElementsByTagName("strong");
	for (loop=0; loop< tabLabels.length; loop++)
	{
		tabLabels[loop].className = "";
		}
	tabLabels[actualTab-1].className = "selected";

			 // Pauses the video if tab4 is not selected
	/*if(tabLabels[3].className != "selected" && ytplayer) ytplayer.pauseVideo();
	if(tabLabels[3].className == "selected" && ytplayer) ytplayer.playVideo();*/
}


function initialTab(tabToShow) {
	//if (gup("tab") != 0) { tabToShow = gup("tab");}
	//if (tabToShow<1 || tabToShow > 4) {tabToShow = Math.floor((5-1)*Math.random()) + 1;}
	showTab("tab"+tabToShow, tabToShow ) ;
}
