//########  Print Window  ########
function printWindow(){
  window.print();
}
function createPrintlink() {
	thelink = document.getElementById("print-page");
	if (thelink) {
		thelink.onclick = function () { printWindow();};
	}
}


//######## Target=_blank Links (rel=external) ########
function externalLinks() {
	if (document.getElementsByTagName) {
		var anchors = document.getElementsByTagName( "a" );
		for (var i = 0; i < anchors.length; i++) {
			var anchor = anchors[i];
			if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
				anchor.target = "_blank";
			}
		}
	}
} 

// INSERT FLASH //
function insertFlash(base_url, movie, width, height) {
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + width + '" height="' + height + '">');
      document.write('<param name="movie" value="' + base_url + '/_flash/' + movie + '.swf" />');
	  document.write('<param name="wmode" value="transparent" />');
      document.write('<param name="quality" value="best" />');
      document.write('<embed src="' + base_url + '/_flash/' + movie + '.swf"  quality="best" swLiveConnect="true" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '" wmode="transparent" />');
	document.write('</object>');
}


// - - - - - - - - - - - - - - - - - - - - - - - -  //
// - - - - - - -  FOR TABBED PAGES - - - - - -     //
// - - - - - - - - - - - - - - - - - - - - - - -  //

function showtab(which) {
	activetab(which);
	activepanel(which);
}
function activetab(which) {
	alltabs_off();
	idref = "t_" + which;
	if (document.getElementById(idref)) { document.getElementById(idref).className = 'active'; }
	
}
function activepanel(which) {
	allpanels_off();
	if (document.getElementById(which)) { document.getElementById(which).style.display = 'block'; }
}
function alltabs_off() {
	if (document.getElementById('t_tab1')) { document.getElementById('t_tab1').className = 'off'; }
	if (document.getElementById('t_tab2')) { document.getElementById('t_tab2').className = 'off'; }
	if (document.getElementById('t_tab3')) { document.getElementById('t_tab3').className = 'off'; }
	if (document.getElementById('t_tab4')) { document.getElementById('t_tab4').className = 'off'; }
	if (document.getElementById('t_tab5')) { document.getElementById('t_tab5').className = 'off'; }
	if (document.getElementById('t_tab6')) { document.getElementById('t_tab6').className = 'off'; }
}

function allpanels_off() {
	if (document.getElementById('tab1')) { document.getElementById('tab1').style.display = 'none'; }
	if (document.getElementById('tab2')) { document.getElementById('tab2').style.display = 'none'; }
	if (document.getElementById('tab3')) { document.getElementById('tab3').style.display = 'none'; }
	if (document.getElementById('tab4')) { document.getElementById('tab4').style.display = 'none'; }
	if (document.getElementById('tab5')) { document.getElementById('tab5').style.display = 'none'; }
	if (document.getElementById('tab6')) { document.getElementById('tab6').style.display = 'none'; }
}

/* set up the active tabs */
function initTabs(t1, t2, t3, t4, t5) {
	var tabArray= new Array();
		tabArray["pagetop"]="tab1";
		tabArray[t1]="tab1";
		tabArray[t2]="tab2";
		tabArray[t3]="tab3";
		tabArray[t4]="tab4";
		tabArray[t5]="tab5";
		hashAnchor = self.document.location.hash.substring(1);
	
		if (hashAnchor != "") {
			thistab = tabArray[hashAnchor];
		} else {
			thistab = "tab1";
		}
		showtab(thistab);
		window.scroll(0,0);
}

function popItaliano() {
	msg  = "Il sito internet sarà disponibile alla fine de gennaio.";
	alert(msg);
}


// DO STUFF ONLOAD
window.onload=function(){
 createPrintlink();
 externalLinks();
}