// Elenco function agg. 20030723
//--------------------------------------------------------------------------------------------
//function apri(quale)
//function rec_apri_finestra_pagella(url_pag,arg,windowsname,dime,left,top)
//function apri_pop_methode(url_articolo)
//function apri_popup_methode(url_articolo)
//function apri_finestra(url_pag)
//function apri_finestra_son(url_pag,windowsname,dime,left,top)
//function popup_sede(url_articolo)
//function apriInviaPagina()
//function popup(url_articolo,windowname,larghezza,altezza,left,top)
//function openMCC()
//function openmagicgames()
//function openConsolazione()
//function openPLAYOFF()
//function openROLE()
//function openADIDAS()
//function comboOnChangeToURL(combo, urlToGo, parametroValoreCorrente, altriParametri)
//function ap(desktopURL,w,h)
//function GoToSchedaSquadraCalcio(combo)
//function GoToSchedaSquadraCalcioSerieB(combo)
//function invia()
//function altri_Link(selObj, restore)
//function archivio_Speciali(selObj, restore)
//function combo_Rubriche(selObj, restore)
//function combo_AltriSport(selObj, restore){
//function MM_jumpMenu(targ,selObj,restore)
//function validate(): per box cerca pilota
//function myTrim(s): per box cerca pilota
//function goTappa(s, b): per speciale beach volley, in base alla data di sistema apre la pagina relativa alla tappa in corso.
//function goTappaTV() : per speciale beach volley, solo per la programmzione tv
// function videoDSL
// function video56k
// function video56ks
// function videoDSLs
// function audio

//--------------------------------------------------------------------------------------------
function apri(quale){
if (window.name==''){
window.close()
opener.parent.location.href=quale
}else{
document.location.href=quale}
}

function rec_apri_finestra_pagella(url_pag,arg,windowsname,dime,left,top){
	var hWnd=window.open(url_pag+escape(arg),windowsname,"toolbar=no,width="+dime+",left="+left+",top="+top+",height=510,directories=no,location=no,status=yes,statusbar=yes,resizable=1,menubar=no,scrollbars=yes");
	if(!hWnd.opener)  hWnd.opener=self;
	if(hWnd.focus!=null)  hWnd.focus();
}

function apri_pop_methode(url_articolo) {
var urlApp = url_articolo;
if (url_articolo.indexOf(".xml") > -1) 	urlApp = url_articolo.substring(0, url_articolo.indexOf(".xml")) + ".shtml";
var hWnd = window.open(urlApp,"","toolbar=yes,width=500,height=600,resizable=1,menubar=no,scrollbars=yes");
if (!hWnd.opener) hWnd.opener = self;
if (hWnd.focus != null) hWnd.focus();
}

function apri_popup_methode(url_articolo) {
var pathToRemove = "/Gazzetta dello Sport";
var lenPathToRemove = pathToRemove.length;
if (url_articolo.indexOf(pathToRemove) > -1) url_articolo = url_articolo.substring(lenPathToRemove);
if (url_articolo.indexOf(".xml") > -1)  url_articolo = url_articolo.substring(0, url_articolo.indexOf(".xml")) + ".shtml";
var hWnd = window.open(url_articolo,"","toolbar=yes,width=600,height=600,resizable=1,menubar=no,scrollbars=yes");
if (!hWnd.opener) hWnd.opener = self;
if (hWnd.focus != null) hWnd.focus();
}

function apri_finestra(url_pag){
var hwnd;
if (navigator.appName.indexOf("Netscape") == -1)
{
var s;
s = "width="+(screen.availWidth-400)+", height="+(screen.availHeight-300)+", scrollbars=yes, toolbar=no, resizable=yes, menubar=no, status=yes, location=no";
s = s + ", left="+screen.availLeft+", top="+screen.availTop;
hwnd=window.open(url_pag,"IOLMutui",s);
}
else
hwnd=window.open(url_pag);
if(!hwnd.opener) hwnd.opener=self;
if(hwnd.focus!=null) hwnd.focus();
}

function apri_finestra_son(url_pag,windowsname,dime,left,top){
var hWnd=window.open(url_pag,windowsname,"toolbar=no,width="+dime+",left="+left+",top="+top+",height=585,directories=no,location=no,status=yes,statusbar=yes,resizable=1,menubar=no,scrollbars=yes");
if(!hWnd.opener) hWnd.opener=self;
if(hWnd.focus!=null) hWnd.focus();
}

function popup_sede(url_articolo) {
var hWnd = window.open(url_articolo,"","toolbar=no,width=350,height=370,directories=no,status=no,statusbar=no,resizable=1,menubar=no,scrollbars=yes");
if (!hWnd.opener) hWnd.opener = self;
if (hWnd.focus != null) hWnd.focus();
}

function apriInviaPagina() {
var miourl=window.location.href;
var miourl_s=miourl.split("&");
var loc="";
for (i in miourl_s)
loc+=miourl_s[i]+"!*";
loc=loc.substr(0,loc.length-2)
tit = document.title
prop = "menubar=no,status=no,titlebar=no,toolbar=no,width=450,height=450,scrollbars=yes"
window.open("http://www.corriere.it/cf/tellafriend/formGol.cfm?rr="+loc+"&tit="+tit, "InviaPagina", prop);
}

function popup(url_articolo,windowname,larghezza,altezza,left,top) {
var hWnd = window.open(url_articolo,windowname,"toolbar=no,width=" + larghezza + ",height=" + altezza + ",left=" + left + ",top=" + top + ",directories=no,status=no,statusbar=no,resizable=1,menubar=no,scrollbars=yes");
if (!hWnd.opener) hWnd.opener = self;
if (hWnd.focus != null) hWnd.focus();
}

function openMCC() {
remote = window.open("http://www.mymagiccup.it/home/noserverl.html","MAGICCUPMONDIALI","width=750,height=580,location=no,toolbar=no,directories=no,status=no,scrollbars=no,resize=no,menubar=no");
remote.moveTo(((screen.availWidth-750)/2),((screen.availHeight-560)/2));
}
function openmagicgames() {
remote = window.open("http://www.gazzetta.it/gazzetta/common/area_gazzetta/giochi02-03/giochi02-03.htm","MAGICGAMES","width=750,height=600,location=no,toolbar=no,directories=no,status=no,scrollbars=yes,resize=yes,menubar=no");
remote.moveTo(((screen.availWidth-750)/2),((screen.availHeight-560)/2));
}

function openConsolazione() {
remote = window.open("http://www.magiccup.it/home/page.jhtml","MagicCup","width=750,height=580,location=no,toolbar=no,directories=no,status=no,scrollbars=yes,resize=no,menubar=no");
remote.moveTo(((screen.availWidth-750)/2),((screen.availHeight-560)/2));
}

function openPLAYOFF() {
remote = window.open("http://playoff.magiccup.it","G11","width=750,height=580,location=no,toolbar=no,directories=no,status=no,scrollbars=yes,resize=no,menubar=no");
remote.moveTo(((screen.availWidth-750)/2),((screen.availHeight-560)/2));
}

function openROLE() {
remote = window.open("http://www.roleplaygames.it/magic_games/mcc/default.htm","G11","width=750,height=580,location=no,toolbar=no,directories=no,status=no,scrollbars=no,resize=no,menubar=no");
remote.moveTo(((screen.availWidth-750)/2),((screen.availHeight-560)/2));
}

function openADIDAS() {
remote = window.open("http://www.roleplaygames.it/magic_games/mcel/default.htm","Adidas","width=750,height=580,location=no,toolbar=no,directories=no,status=no,scrollbars=no,resize=no,menubar=no");
remote.moveTo(((screen.availWidth-750)/2),((screen.availHeight-560)/2));
}

function comboOnChangeToURL(combo, urlToGo, parametroValoreCorrente, altriParametri)
{
if (combo.options[combo.selectedIndex].value!="null")
{
window.location.href = urlToGo + "?" + altriParametri + 
parametroValoreCorrente + escape(combo.options[combo.selectedIndex].value);
}
}

function ap(desktopURL,w,h){
desktop = window.open(desktopURL, "new","toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes"+",width="+w+",height="+h );
if (desktop.opener == null) desktop.opener = window;
}

function GoToSchedaSquadraCalcio(combo) {
if (combo.options[combo.selectedIndex].value!="null") { 
window.location.href = combo.options[combo.selectedIndex].value;
}
}

function GoToSchedaSquadraCalcioSerieB(combo){
if ((combo.options[combo.selectedIndex].value!="null") && (combo.options[combo.selectedIndex].value!="-1"))
{ 
window.location.href = "/gazzetta/scalcio/ricerca_index.jhtml?PageToLoad=SchedaSquadra&AnnoCorrente=" + document.elencoSquadreSerieB.annoCorrente.value + "&IdSquadra=" + escape(combo.options[combo.selectedIndex].value);
}
else
if (combo.options[combo.selectedIndex].value=="-1")
window.location.href = "/gazzetta/scalcio/ricerca_index.jhtml?PageToLoad=SquadreEGiocatori&serie=B";
}

function invia() {
if (document.lista_nazioni.nazioni.options[document.lista_nazioni.nazioni.selectedIndex].value != "") {
window.open(document.lista_nazioni.nazioni.options[document.lista_nazioni.nazioni.selectedIndex].value,'esmgazzetta','menubar=no,status=no,titlebar=no,toolbar=no,width=600,height=500,scrollbars=yes')
}
}

function altri_Link(selObj, restore){
if (selObj.options[selObj.selectedIndex].value == "#")
alert("Selezionare uno speciale");
else
{
desktop = window.open(selObj.options[selObj.selectedIndex].value, "_speciale","toolbar=yes,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes");
if (desktop.opener == null) desktop.opener = window;
}
if (restore) selObj.selectedIndex=0;
}

function archivio_Speciali(selObj, restore){
if (selObj.options[selObj.selectedIndex].value == "#")
alert("Selezionare uno speciale");
else
{
desktop = window.open(selObj.options[selObj.selectedIndex].value, "_speciale","toolbar=yes,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes");
if (desktop.opener == null) desktop.opener = window;
}
if (restore) selObj.selectedIndex=0;
}

function combo_Rubriche(selObj, restore){
if (selObj.options[selObj.selectedIndex].value == "#")
alert("Voce non attiva");
else
{
desktop = window.open(selObj.options[selObj.selectedIndex].value, "_speciale","toolbar=yes,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes");
if (desktop.opener == null) desktop.opener = window;
}
if (restore) selObj.selectedIndex=0;
}

function combo_AltriSport(selObj, restore){
if (selObj.options[selObj.selectedIndex].value == "#")
alert("Voce non attiva");
else
{
desktop = window.open(selObj.options[selObj.selectedIndex].value, "_speciale","toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
if (desktop.opener == null) desktop.opener = window;
}
if (restore) selObj.selectedIndex=0;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}

function validate()
{
if (myTrim(document.formRicerca.cognome.value) == "")
{
alert("Specificare almeno l'iniziale del cognome!!");
return false;
}
return true;
}

function myTrim(s)
{
var s2 = "";
var s3 = "";
var i = 0;
for (i = s.length - 1; i >= 0; i--)
if ((s.substring(i,i+1) != " ") || (s2.length > 0))
s2 += s.substring(i,i+1);
for (i = s2.length - 1; i >= 0; i--)
s3 += s2.substring(i,i+1);
return s3;
}


function goTappa(nomePagina, isClassifiche) 
{
	var now = new Date();
	var day = "0" + now.getDate();
	var month = "0" + (now.getMonth() + 1);

	// nowStr formato yyyymmdd
	var nowStr = now.getYear() + month.substring(month.length - 2, month.length) + day.substring(day.length - 2,  day.length);
	
	var tappa = "";

	if (isClassifiche)
	{
		if (nowStr < "20030628")								tappa = "latina";
		if (nowStr >= "20030628" && nowStr < "20030705")		tappa = "senigallia";
		if (nowStr >= "20030705" && nowStr < "20030712")		tappa = "lido";
		if (nowStr >= "20030712" && nowStr < "20030719")		tappa = "rimini";
		if (nowStr >= "20030719" && nowStr < "20030726")		tappa = "anzio";
		if (nowStr >= "20030726" && nowStr < "20030802")		tappa = "vasto";
		if (nowStr >= "20030802" && nowStr < "20030809")		tappa = "alba";
		if (nowStr >= "20030809" && nowStr < "20030823")		tappa = "cagliari";
		if (nowStr >= "20030823" && nowStr < "20030913")		tappa = "jesolo";
		if (nowStr >= "20030913")								tappa = "olbia";
	}
	else
	{
		if (nowStr < "20030626")								tappa = "latina";
		if (nowStr >= "20030626" && nowStr < "20030704")		tappa = "senigallia";
		if (nowStr >= "20030704" && nowStr < "20030711")		tappa = "lido";
		if (nowStr >= "20030711" && nowStr < "20030718")		tappa = "rimini";
		if (nowStr >= "20030718" && nowStr < "20030725")		tappa = "anzio";
		if (nowStr >= "20030725" && nowStr < "20030801")		tappa = "vasto";
		if (nowStr >= "20030801" && nowStr < "20030808")		tappa = "alba";
		if (nowStr >= "20030808" && nowStr < "20030822")		tappa = "cagliari";
		if (nowStr >= "20030822" && nowStr < "20030913")		tappa = "jesolo";
		if (nowStr >= "20030913")								tappa = "olbia";
	}

	document.location.replace("/Speciali/Beach Volley/2003/" + tappa + "/" + nomePagina + ".shtml");
}

function goTappaTV() 
{
	var now = new Date();
	var day = "0" + now.getDate();
	var month = "0" + (now.getMonth() + 1);

	// nowStr formato yyyymmdd
	var nowStr = now.getYear() + month.substring(month.length - 2, month.length) + day.substring(day.length - 2,  day.length);
	
	var nomePagina = "";

	if (nowStr < "20030626")								nomePagina = "1atappa";
	if (nowStr >= "20030626" && nowStr < "20030704")		nomePagina = "2atappa";
	if (nowStr >= "20030704" && nowStr < "20030711")		nomePagina = "3atappa";
	if (nowStr >= "20030711" && nowStr < "20030718")		nomePagina = "4atappa";
	if (nowStr >= "20030718" && nowStr < "20030725")		nomePagina = "5atappa";
	if (nowStr >= "20030725" && nowStr < "20030801")		nomePagina = "6atappa";
	if (nowStr >= "20030801" && nowStr < "20030808")		nomePagina = "7atappa";
	if (nowStr >= "20030808" && nowStr < "20030822")		nomePagina = "8atappa";
	if (nowStr >= "20030822" && nowStr < "20030913")		nomePagina = "9atappa";
	if (nowStr >= "20030913")								nomePagina = "10atappa";

	document.location.replace("/Speciali/Beach Volley/2003/tv/" + nomePagina + ".shtml");
}

function videoDSL(percorso) {
var pathToRemove = "/Gazzetta dello Sport";
var lenPathToRemove = pathToRemove.length;
if (percorso.indexOf(pathToRemove) > -1) percorso = percorso.substring(lenPathToRemove);
window.open('/gazzetta/common/area_gazzetta/multimedia/multimedia-vDSL.shtml?'+percorso,'GazzettaIT','height=470,width=380,toolbar=no,menubar=no,status=no,directories=no,location=no,resizable=no,scrollbars=no')
}

function video56k(percorso) {
var pathToRemove = "/Gazzetta dello Sport";
var lenPathToRemove = pathToRemove.length;
if (percorso.indexOf(pathToRemove) > -1) percorso = percorso.substring(lenPathToRemove);
window.open('/gazzetta/common/area_gazzetta/multimedia/multimedia-v56k.shtml?'+percorso,'GazzettaIT','height=360,width=320,toolbar=no,menubar=no,status=no,directories=no,location=no,resizable=no,scrollbars=no')
}

function videoDSLs(percorso) {
var pathToRemove = "/Gazzetta dello Sport";
var lenPathToRemove = pathToRemove.length;
if (percorso.indexOf(pathToRemove) > -1) percorso = percorso.substring(lenPathToRemove);
window.open('/gazzetta/common/area_gazzetta/multimedia/multimedia-vDSLs.shtml?'+percorso,'GazzettaIT','height=450,width=380,toolbar=no,menubar=no,status=no,directories=no,location=no,resizable=no,scrollbars=no')
}

function video56ks(percorso) {
var pathToRemove = "/Gazzetta dello Sport";
var lenPathToRemove = pathToRemove.length;
if (percorso.indexOf(pathToRemove) > -1) percorso = percorso.substring(lenPathToRemove);
window.open('/gazzetta/common/area_gazzetta/multimedia/multimedia-v56ks.shtml?'+percorso,'GazzettaIT','height=340,width=320,toolbar=no,menubar=no,status=no,directories=no,location=no,resizable=no,scrollbars=no')
}

function audio(percorso) {
var pathToRemove = "/Gazzetta dello Sport";
var lenPathToRemove = pathToRemove.length;
if (percorso.indexOf(pathToRemove) > -1) percorso = percorso.substring(lenPathToRemove);
window.open('/gazzetta/common/area_gazzetta/multimedia/multimedia-audio.shtml?'+percorso,'GazzettaIT','height=300,width=320,toolbar=no,menubar=no,status=no,directories=no,location=no,resizable=no,scrollbars=no')
}
