function change(prog) {

	var containerTab = document.getElementById("tab_top"); 
	var lnk = containerTab.getElementsByTagName("li"); 
	for (var i = 0; i < lnk.length; i++) { 
		lnk[i].className='';
	}
	var containerCnt = document.getElementById("cnttab"); 
	var elm = containerCnt.getElementsByTagName("div"); 
	for (var i = 0; i < elm.length; i++) { 
		elm[i].style.display='none';
	}
	document.getElementById('tab'+prog).className='on';
	document.getElementById('cnt'+prog).style.display='block';
}
function openTab(viz) {
	document.getElementById('cnt'+viz).style.display='block';
	document.getElementById('open'+viz).style.display='none';
	document.getElementById('close'+viz).style.display='block';
}
function closeTab(viz) {
	document.getElementById('cnt'+viz).style.display='none'; 
	document.getElementById('open'+viz).style.display='block';
	document.getElementById('close'+viz).style.display='none';
}

function acronimo(tst,tgt){
	tgt.style.position = "relative";
	tgt.innerHTML += '<span id="cont"><span class="top"></span><span class="removal">'+tst+'</span><span class="btt"></span></span>';	
	tgt.onmouseout = function (){		
		var d = document.getElementById("cont"); 
		if (d!=null)
		{
			this.style.position = "";
			this.removeChild(d);
		}
	}				
}


function SendToaFriends()
{
	location.href="mailto:?body=" +escape(document.location) + "&subject=Alice Adsl";
}
function cngimg(az,srcMiddle, dimmWMiddle, dimmHMiddle, srcMax, dimmWMax, dimmHMax) {
	//alert(srcMiddle);
		var placehd = document.getElementById('placehd');
		placehd.src = srcMiddle;
		placehd.width = dimmWMiddle;
		placehd.heigth = dimmHMiddle;	
		//Controllo che esista l'immagine Max
		if (dimmWMax!='')
			az.onclick = function (){
				window.open(srcMax , '', 'width='+dimmWMax+',height='+dimmHMax);
			}
	}

//Aggiunge un contenuto al bookmark
/*function AddBookmark(url, title)
{
	if (navigator.appName=="Netscape") 
	{
		alert("Funzione non disponibile")		
	}
	else if (parseInt(navigator.appVersion)>3) {
		window.external.AddFavorite('http://adsl.alice.it' + url, title)
	}
}
*/
/* Modified to support Opera */
function AddBookmark(url, title){
	if (window.sidebar) // firefox
		window.sidebar.addPanel(title, url, "");
	else if(window.opera && window.print){ // opera
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	} 
	else if(document.all)// ie
		window.external.AddFavorite(url, title);
}

var urlInvia='/sendtoafriend/popup_invia.html?linkdainviare='+escape(document.URL);

function inviaFormPopup(urlPopup){
	window.open(urlPopup,'mailpost','toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=300,height=350');
}

//Seleziona il tab di apertura di una scheda
function SelOpenTab()
{
	var item = displayItem('tab');
	if (item!='')
		change(item);
}

function PageQuery(q) 
{
	if(q.length > 1) this.q = q.substring(1, q.length);
	else this.q = null;
	this.keyValuePairs = new Array();
	if(q) 
	{
		for(var i=0; i < this.q.split("&").length; i++) 
		{
			this.keyValuePairs[i] = this.q.split("&")[i];
		}
	}
	this.getKeyValuePairs = function() { return this.keyValuePairs; }
	this.getValue = function(s) {
	for(var j=0; j < this.keyValuePairs.length; j++) 
	{
		if(this.keyValuePairs[j].split("=")[0] == s)
			return this.keyValuePairs[j].split("=")[1];
	}
	return false;
}

this.getParameters = function() 
{
	var a = new Array(this.getLength());
	for(var j=0; j < this.keyValuePairs.length; j++) 
	{
		a[j] = this.keyValuePairs[j].split("=")[0];
	}
	return a;
}

this.getLength = function() { return this.keyValuePairs.length; } 
}
function queryString(key)
{
	var page = new PageQuery(window.location.search); 
	return unescape(page.getValue(key)); 
}
function displayItem(key)
{
	if(queryString(key)=='false') 
	{		
		return "";
	}
	else
	{	
		return queryString(key);
	}
}

//Box switch su assistenza
function ChangeTab(tabMostra, tabNascondi) {
	var tab1 = document.getElementById("box295tab"+tabMostra);
	var tab2 = document.getElementById("box295tab"+tabNascondi);
	var cnt1 = document.getElementById("cnt295ass"+tabMostra);
	var cnt2 = document.getElementById("cnt295ass"+tabNascondi);
	cnt1.style.display = "";
	cnt2.style.display = "none";
	tab1.className = "tabActive";
	tab2.className = "tabDisactive";
}
function SwitchTab(el) {
	var swi = document.getElementById("switchAss"+el);
	var swiCnt = document.getElementById("switch"+el);
	for (i=1; i<4; i++) {
		if (el==i) {
			swi.style.display = "none";
			swiCnt.style.display = "";
		} else {
			document.getElementById("switchAss"+i).style.display = "";
			document.getElementById("switch"+i).style.display = "none";
		}
	}
}

//Procedura usata per aprire le faq
function OpenFaq()
{	
	var positionSharp = location.href.indexOf("#");

	//Controlla se è arrivato un codice con #	
	if (positionSharp != -1)
	{	
		//Controllo che non sia l'ultimo carattere
		if ((positionSharp+1) !=location.href.length)
		{
			//Non è in ultima posizione
			var faqId = location.href.split("#");			
			apri(faqId[1]);
		}
    }		
    else
	{

		var positionId = location.href.indexOf("id=");

		//Controlla se è arrivato un codice con id=	
		if (positionId != -1)
		{	
			var faqId = location.href.split("id=");			
			apri(faqId[1]);
 		}
	}	
}

function show_pack()
   {
	document.getElementById('packalice').style.display='block';
	document.getElementById('cardalice').style.display='none';
	}
function show_charge()
   {
	document.getElementById('packalice').style.display='none';
	document.getElementById('cardalice').style.display='block';
	}

function apri(prog){
		if (document.getElementById(prog).style.display == ''){
		document.getElementById(prog).style.display='block';}
		else {
		document.getElementById(prog).style.display='';
		}
}


function insertFlashObject(qs,movie,emptyPar,width,height) 
{
	var objStr= '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'" id="videoPlayer" align="middle" >\n'+
	'<param name="allowScriptAccess" value="always" />\n'+
	'<param name="allowFullScreen" value="false" />\n'+
	'<param name="movie" value="'+movie+'" />\n'+
	'<param name="quality" value="high" />\n'+        
	'<param name="wmode" value="transparent" />\n'+        
	'<embed src="'+movie+'" quality="high" width="'+width+'" height="'+height+'" name="videoPlayer" align="middle" allowScriptAccess="always" allowFullScreen="false" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n'+
	'</object>';
	document.write(objStr);
}

function OpenPopup(url, width, height) {
    // pops up a window containing url optionally named target, optionally having features
    var theWindow = window.open(url, 'Popup', 'resizable=yes,location=0,statusbar=0,menubar=0,width=' + width + ',height=' + height + ',scrollbars=yes');
    theWindow.focus();
    return theWindow;
}
