// Hide instruction text for password field
function txt2pwd(obj, pwd){
	obj.style.visibility = "hidden";
	findElementById(pwd).focus();
}
// Display instruction text for password field
function pwd2txt(obj, txt){
	if(obj.value.length==0){
		findElementById(txt).style.visibility = "visible";
	}
}
// Display instruction text [str] if field is blank
// Clear instruction text if field is clicked
function resetField(obj,str){
	if(obj.value.length==0){
		obj.value=str;
		return;
	}
	if(obj.value==str){
		obj.value="";
	}
}

//Utility function to find element by id Cross Browser
function findElementById(id)
{
	return ( document.all+"" != "undefined" ? document.all[id] : document.getElementById(id) );
}

function displayValue(tagID,value){
	fieldObj=findElementById(tagID);
	fieldObj.style.display = value;
}

// Tab switcher
// container = ID of tab container, must be used if more than one tab module is used on page (optional usage if only one tab module is displayed on a page )
// tab = ID of tab (mandatory)
function showTab(tab, container){
	if(typeof(container)=='undefined') {
		container='';
	}
	var i=1;
	do{
		findElementById(container+"tab"+i).className = "tab";
		findElementById(container+"tab"+i+"content").style.display="none";
		i++;
	}
	while(findElementById(container+"tab"+i));
	findElementById(container+tab+"content").style.display="block";
	findElementById(container+tab).className = "activeTab";
}

// Flash detection for Call-to-action teaser
function hasFlash(){
  var ver=6;
	if(navigator.appVersion.indexOf("MSIE")!=-1&&navigator.appVersion.indexOf("Windows")>-1) {
	  document.write('<script language="VBScript"\> \non error resume next \nhasFlash = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & '+ver+'))) \n</script\> \n');
		if(window.hasFlash!=null)
		  return window.hasFlash
	}
	if(navigator.mimeTypes&&navigator.mimeTypes["application/x-shockwave-flash"]&&navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) {
	  var desc=(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description;
		return parseInt(desc.charAt(desc.indexOf(".")-1))>=ver;
	}
	return false;
} // hasFlash


// replace the HTML Call-to-action box by a flash movie using the Vodafone corporate font
function replaceCTABox(){
	if (hasFlash()) {
		//get data from html-box
		var cta = findElementById('ctaLayer');
		var ctaMod = cta.parentNode;
		if (ctaMod!=null && cta!=null) {
			var h1,s,a,l,u,t; h1=s=a=l=u=t='';
			if (cta.getElementsByTagName("h1")[0]!=null) h1= encodeURI(cta.getElementsByTagName("h1")[0].innerHTML);
			if (cta.getElementsByTagName("p")[0]!=null) s = encodeURI(cta.getElementsByTagName("p")[0].innerHTML);
			var w = cta.offsetWidth;
        var h = cta.offsetHeight;
			var flashVars = "head="+h1+"&sub="+s+"&boxw="+w+"&boxh="+h;
			var a = cta.getElementsByTagName("a")[0];
			if (a!=null) {
		    	var l = encodeURI(a.innerHTML);
		    	var u = encodeURI(a["href"]);
		    	var t = a["target"];
          flashVars+="&link="+l+"&url="+u+"&target="+t;
			}
			// hide html-box
			cta.className="ctaLayer hide";
			// and place flash cta box
			var flashURL = "../resnew/swf/calltoactionbox.swf?"+flashVars;
			var ctaObjStr = "<object class='ctaLayer' type='application/x-shockwave-flash' data='"+flashURL+"' width='"+w+"' height='"+h+"' id='calltoactionbox'>"
			                +   "<param name='allowScriptAccess' value='sameDomain' />"
									    +   "<param name='movie' value='"+flashURL+"' />"
									    +   "<param name='quality' value='high' />"
									    + "</object>";
		  document.write(ctaObjStr);
		}
	}
} // replaceCTABox


// fold and unfold option sections on shopping cart page
function scFold(optId) {
  var optHeader = findElementById(optId);
	if (optHeader!=null) {
		var pattern = new RegExp("(^|\\s)"+optId+"(\\s|$)");
		var trList = document.getElementsByTagName('tr');
	  if (optHeader.className=="scOptShow") {
		  // hide options
			for (i=0; i<trList.length; i++) {
			  if (pattern.test(trList[i].className)) {
				  trList[i].className=optId+" hidden";
				}
			}
      optHeader.className="scOptHide";			
		} else {
		  // show options
			for (i=0; i<trList.length; i++) {
			  if (pattern.test(trList[i].className)) {
				  trList[i].className=optId;
				}
			}			
      optHeader.className="scOptShow";			
		}
	}
} // scFold


function hideLogin()
{
	try
	{
		var loginBox = findElementById("loginModule");
		if( loginBox )
			loginBox.style.visibility = "hidden";
	}
	catch( e )
	{
	}
}

SlideAutoInterval = function(){}
SlideAutoInterval.SlidingInterval = 20000; //default autoslider interval
SlideAutoInterval.CurrentTimer = null;
SlideAutoInterval.boxCounter = new Array(); //0;
SlideAutoInterval.direction = 1;
SlideAutoInterval.lockAtSlider = null;


SliderManager = function(){}
SliderManager.PIXELSTEP = 20;
SliderManager.SWAP_TIMEOUT = 50;
SliderManager.CurrentTimer = null;
SliderManager.CurrentSlideMainContent = new Array(); //null;
SliderManager.CurrentSlideBox = new Array(); //null;
SliderManager.MAINCONTENT = "MainContent";
SliderManager.SINGLECONTENT = "SingleContent";
SliderManager.BUTTONBOX = "ButtonBox"

SliderManager.SlideNext = function( slideBaseId, auto )
{
	if( SliderManager.CurrentSlideMainContent[slideBaseId] == null )
	{
		SliderManager.CurrentSlideBox[slideBaseId] = findElementById( slideBaseId );
		SliderManager.CurrentSlideMainContent[slideBaseId] = findElementById( slideBaseId + SliderManager.MAINCONTENT );
		var slideMainCurrentTop = SliderManager.CurrentSlideMainContent[slideBaseId].offsetTop;
		var slideMainCurrentHeight = SliderManager.CurrentSlideMainContent[slideBaseId].offsetHeight;
		var slideHeight = findElementById( slideBaseId + SliderManager.SINGLECONTENT ).offsetHeight;
		var newTop = slideMainCurrentTop-slideHeight;
		if( SlideAutoInterval.lockAtSlider==slideBaseId )
		{
			if(SlideAutoInterval.boxCounter[slideBaseId]==null || SlideAutoInterval.boxCounter[slideBaseId]=="undefined")
				SlideAutoInterval.boxCounter[slideBaseId]=0;
			
			SlideAutoInterval.boxCounter[slideBaseId]++;
			if(auto!=1)
			{
				clearTimeout(SlideAutoInterval.CurrentTimer);
				auto=0;
			}
		}
		if( newTop > 0-slideMainCurrentHeight )
			SliderManager.Slide( newTop, slideBaseId );
		else
			SliderManager.CurrentSlideMainContent[slideBaseId] = null;
	}
}

SliderManager.SlidePrev = function( slideBaseId, auto )
{
	if( SliderManager.CurrentSlideMainContent[slideBaseId] == null )
	{
		SliderManager.CurrentSlideBox[slideBaseId] = findElementById( slideBaseId );
		SliderManager.CurrentSlideMainContent[slideBaseId] = findElementById( slideBaseId + SliderManager.MAINCONTENT );
		var slideMainCurrentTop = SliderManager.CurrentSlideMainContent[slideBaseId].offsetTop;
		var slideMainCurrentHeight = SliderManager.CurrentSlideMainContent[slideBaseId].offsetHeight;
		var slideHeight = findElementById( slideBaseId + SliderManager.SINGLECONTENT ).offsetHeight;
		var newTop = slideMainCurrentTop+slideHeight;
		if( SlideAutoInterval.lockAtSlider==slideBaseId )
		{
			if(SlideAutoInterval.boxCounter[slideBaseId]==null || SlideAutoInterval.boxCounter[slideBaseId]=="undefined")
				SlideAutoInterval.boxCounter[slideBaseId]=0;
				
			SlideAutoInterval.boxCounter[slideBaseId]--;
			if(auto!=1)
			{
				clearTimeout(SlideAutoInterval.CurrentTimer);
				auto=0;
			}
		}
		if( slideMainCurrentTop < newTop && newTop <= 0 )
			SliderManager.Slide( newTop, slideBaseId );
		else
			SliderManager.CurrentSlideMainContent[slideBaseId] = null;
	}
}

SliderManager.Slide = function( stopTop, slideBaseId )
{
	var currentTop = SliderManager.CurrentSlideMainContent[slideBaseId].offsetTop;
	var newTop;
	if( currentTop > stopTop )
	{
		newTop = currentTop - SliderManager.PIXELSTEP;
		if( newTop < stopTop )
			newTop = stopTop;
	}	
	else
	{
		newTop = currentTop + SliderManager.PIXELSTEP;
		if( newTop > stopTop )
			newTop = stopTop;
	}
	
	
	if( newTop == 0 )
		SliderManager.CurrentSlideMainContent[slideBaseId].style.marginTop = "-1px";
	else
		SliderManager.CurrentSlideMainContent[slideBaseId].style.marginTop = newTop + "px";
	
	if( newTop != stopTop )
		window.setTimeout( "SliderManager.Slide(" + stopTop + ",'" + slideBaseId + "')", SliderManager.SWAP_TIMEOUT );
	else
		SliderManager.onEndSlide( slideBaseId );
}

SliderManager.onEndSlide = function( slideBaseId ) 
{
	var currentSlideBoxId = SliderManager.CurrentSlideBox[slideBaseId].id;
	var buttonBox = findElementById( currentSlideBoxId + SliderManager.BUTTONBOX );
	if( buttonBox )
	{
		if( SliderManager.CurrentSlideMainContent[slideBaseId].offsetTop == 0 || SliderManager.CurrentSlideMainContent[slideBaseId].offsetTop == -1 )
		{
			findElementById( currentSlideBoxId + "PrevButton" ).style.display = "none";
			if( SlideAutoInterval.lockAtSlider==slideBaseId )
				SlideAutoInterval.direction = 1;
		}
		else
			findElementById( currentSlideBoxId + "PrevButton" ).style.display = "block";
		
		var slideHeight = findElementById( currentSlideBoxId + SliderManager.SINGLECONTENT ).offsetHeight;
		if( SliderManager.CurrentSlideMainContent[slideBaseId].offsetTop - slideHeight + SliderManager.CurrentSlideMainContent[slideBaseId].offsetHeight == 0
			|| SliderManager.CurrentSlideMainContent[slideBaseId].offsetTop - slideHeight + SliderManager.CurrentSlideMainContent[slideBaseId].offsetHeight == -1  )
		{
			findElementById( currentSlideBoxId + "NextButton" ).style.display = "none";
			if( SlideAutoInterval.lockAtSlider==slideBaseId )
				SlideAutoInterval.direction = 0;
		}
		else
		{
			findElementById( currentSlideBoxId + "NextButton" ).style.display = "block";
		}
	}
	SliderManager.CurrentSlideMainContent[slideBaseId] = null;
	SlideAutoInterval.ExecuteFunct( currentSlideBoxId );
}

SliderManager.initSlider = function( slideBaseId, seconds )
{
	var sliderBox = findElementById( slideBaseId );
	var sliderContent = findElementById( slideBaseId + "MainContent" );
	if( sliderBox.offsetHeight == sliderContent.offsetHeight )
	{
		var buttonBox = findElementById( slideBaseId + SliderManager.BUTTONBOX );
		if( buttonBox )
			buttonBox.style.display = "none";
	}
	if(seconds==0)
		return false;
	if(seconds!=null && seconds!="" && seconds!="undefined"){
		SlideAutoInterval.SlidingInterval = (seconds*1000);
	}	
	
	//avvio temporizzatore
	SlideAutoInterval.ExecuteFunct( slideBaseId, slideBaseId );
	
}

SlideAutoInterval.ExecuteFunct = function( slideBaseId, roundSlider )
{
	if(SlideAutoInterval.lockAtSlider==null){
		SlideAutoInterval.lockAtSlider=roundSlider;
	}
	if(slideBaseId==SlideAutoInterval.lockAtSlider)
	{
		if(SlideAutoInterval.direction==0 && SlideAutoInterval.boxCounter[slideBaseId]==0)
			SlideAutoInterval.direction=1;
		switch(SlideAutoInterval.direction)
		{
			case 0:
				SlideAutoInterval.CurrentTimer = window.setTimeout( "SliderManager.SlidePrev('" + slideBaseId + "', 1)", SlideAutoInterval.SlidingInterval );
				break;
			case 1:
				SlideAutoInterval.CurrentTimer = window.setTimeout( "SliderManager.SlideNext('" + slideBaseId + "', 1)", SlideAutoInterval.SlidingInterval );
				break;
		}
	}
}


//----------------------
// search form functions
//----------------------

// search form HTML string
var sb = "";

// draw the search box
function drawSearchBox(formName,formURL)
{
	sb="<table width=\"435\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" background=\"/res/img/new_header/login_right_ground_cerca.gif\" style=\"background-repeat:no-repeat;\">"+
	    "<form name=\"" + formName + "\" target=\"_top\" method=\"POST\" action=\"" + formURL + "\" onSubmit=\"return validateSearchForm(this);\">"+ 
		"<tr valign=\"top\"><td height=\"35\" width=\"210\" >&nbsp;</td>"+
		"<td width=\"105\" align=\"left\"><img class=\"h_ten\" src=\"/res/img/new_header/login_cosa_cerchi.gif\" alt=\"Cosa cerchi?\"></td><td ><input type=\"text\"  name=\"criteria\" class=\"find\" style=\"margin-top:6px;\">&nbsp;&nbsp;</td>"+
		"<td width=\"120\"><!--a href=\"#\"--><input type=\"image\" onFocus=\"if(this.blur)this.blur()\" src=\"/res/img/new_header/btn_login_vai.gif\" border=\"0\" alt=\"Vai\" title=\"Vai\"/><!--/a-->&nbsp;<a href=\"javascript:hideSearchBox();\"><img src=\"/res/img/new_header/btn_login_chiudi.gif\" alt=\"Chiudi\"  border=\"0\"  title=\"Chiudi\"></a></td>"+
		"</tr></form></table>";
	if(!isNS4()) document.write(sb);
}

// draw the search box
function draw_139_SearchBox(formName,formURL)
{	
	sb="<table width=\"139\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" background=\"/res/img/new_header/new_loginbar/ricerca_139_back.gif\" style=\"background-repeat:no-repeat;\">"+
	    "<form name=\"" + formName + "\" target=\"_top\" method=\"POST\" action=\"" + formURL + "\" onsubmit=\"return validateSearchForm(this)\">"+ 
		"<tr valign=\"top\">"+
		"<td width=\"65\" height=\"35\" style=\"padding-top:6px;\"><input type=\"text\"  name=\"criteria\" style=\"width:60px;font-size:10px;margin-right:2px;margin-left:3px;\"></td>"+
		"<td width=\"74\" align=\"right\"><input type=\"image\" onFocus=\"if(this.blur)this.blur()\" src=\"/res/img/new_header/new_loginbar/btn_freccie_vai_139.gif\" border=\"0\" alt=\"Vai\" title=\"Vai\"/><a href=\"javascript:hideSearchBox();\" onfocus=\"this.blur();\"><img style=\"margin-left:3px;margin-right:6px;\" src=\"/res/img/new_header/new_loginbar/btn_chiudi_139.gif\" alt=\"Chiudi\"  border=\"0\"  title=\"Chiudi\"></a></td>"+
		"</tr></form></table>";
	if(!isNS4()) document.write(sb);	
}

// draw the search box
function draw_168_SearchBox(formName,formURL)
{	
	sb="<table width=\"168\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" background=\"/res/img/new_header/new_loginbar/ricerca_168_back.gif\" style=\"background-repeat:no-repeat;\">"+
	    "<form name=\"" + formName + "\" target=\"_top\" method=\"POST\" action=\"" + formURL + "\" onsubmit=\"return validateSearchForm(this)\">"+ 
		"<tr valign=\"top\">"+
		"<td width=\"76\" align=\"left\" height=\"35\" style=\"padding-top:6px;\"><input type=\"text\"  name=\"criteria\" style=\"width:70px;font-size:10px;margin-right:3px;margin-left:3px;\"></td>"+
		"<td width=\"92\" align=\"right\"><input type=\"image\" onFocus=\"if(this.blur)this.blur()\" src=\"/res/img/new_header/new_loginbar/btn_login_w_freccie.gif\" border=\"0\" alt=\"Vai\" title=\"Vai\"/><a href=\"javascript:hideSearchBox();\" onfocus=\"this.blur();\"><img style=\"margin-left:3px;margin-right:6px;\" src=\"/res/img/new_header/new_loginbar/btn_login_chiudi.gif\" alt=\"Chiudi\"  border=\"0\"  title=\"Chiudi\"></a></td>"+
		"</tr></form></table>";
	if(!isNS4()) document.write(sb);	
}



// hide the search box
function hideSearchBox()
{
        MM_showHideLayers('hdInnerRicercaOff','','show');
        MM_showHideLayers('hdInnerRicercaOn','','hide');
}

// show the search box
function showSearchBox()
{
        if (isNS4()) setTextOfLayerCouple(sb, "hdOuterRicerca", "hdInnerRicercaOn");
        MM_showHideLayers('hdInnerRicercaOff','','hide');
        MM_showHideLayers('hdInnerRicercaOn','','show');
}

function isStringValid(inputString, compareString)
{
        var length = inputString.length;
        var index;

        for (index = 0; index < length; index++)
        {
                if (compareString.indexOf(inputString.charAt(index), 0) < 0)
                {
                        return false;
                }
        }

        return true;
}

function submitValidateSearchForm(theForm)
{
        if (theForm.criteria.value.length == 0)
        {
                alert("Spiacente: ricerca non eseguibile.\n" + String.fromCharCode(201) + " necessario inserire una stringa di ricerca");
                theForm.criteria.focus();
                return false;
        }

        var graveChars = String.fromCharCode(249,224,232,233,242,236);
        var euroChar = String.fromCharCode(8364); // the euro char

        if (!isStringValid(theForm.criteria.value, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" + 
                                                    graveChars + "'+ -./&_\"" + euroChar))
        {
                alert("Spiacente: ricerca non eseguibile.\nHai utilizzato dei caratteri non validi nella tua ricerca");
                theForm.criteria.focus();
                return false;
        }
		theForm.submit()
        return true;
}

// search form validation
function validateSearchForm(theForm)
{
        if (theForm.criteria.value.length == 0)
        {
                alert("Spiacente: ricerca non eseguibile.\n" + String.fromCharCode(201) + " necessario inserire una stringa di ricerca");
                theForm.criteria.focus();
                return false;
        }

        var graveChars = String.fromCharCode(249,224,232,233,242,236);
        var euroChar = String.fromCharCode(8364); // the euro char

        if (!isStringValid(theForm.criteria.value, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" + 
                                                    graveChars + "'+ -./&_\"" + euroChar))
        {
                alert("Spiacente: ricerca non eseguibile.\nHai utilizzato dei caratteri non validi nella tua ricerca");
                theForm.criteria.focus();
                return false;
        }

        return true;
}

/**
 * FlashObject v1.3c: Flash detection and embed - http://blog.deconcept.com/flashobject/
 *
 * FlashObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * Modified by exhafa 07/2006.
 *
 */
 var clsId="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
 var tYpe ="application/x-shockwave-flash";
 var nAme ="movie";


 function setClsId(clId){
 	 this.clsId=clId; 
 }
 function setType(tYpe){
 	 this.tYpe=tYpe; 
 }
 function setName(nAme){
 	 this.nAme=nAme; 
 }
 
if(typeof com=="undefined"){var com=new Object();}
if(typeof com.deconcept=="undefined"){com.deconcept=new Object();}
if(typeof com.deconcept.util=="undefined"){com.deconcept.util=new Object();}
if(typeof com.deconcept.FlashObjectUtil=="undefined"){com.deconcept.FlashObjectUtil=new Object();}
com.deconcept.FlashObject=function(_1, id,w,h,_5,c,_7,_8,_9,_a,_b){
if(!document.createElement||!document.getElementById){return;}
this.DETECT_KEY=_b?_b:"detectflash";
this.skipDetect=com.deconcept.util.getRequestParameter(this.DETECT_KEY);
this.params=new Object();
this.variables=new Object();
this.attributes=new Array();
this.useExpressInstall=_7;
if(_1){this.setAttribute("swf",_1);}
if(id){this.setAttribute("id",id);}
if(w){this.setAttribute("width",w);}
if(h){this.setAttribute("height",h);}
if(_5){this.setAttribute("version",new com.deconcept.PlayerVersion(_5.toString().split(".")));}
this.installedVer=com.deconcept.FlashObjectUtil.getPlayerVersion(this.getAttribute("version"),_7);
if(c){this.addParam("bgcolor",c);}
var q=_8?_8:"high";
this.addParam("quality",q);
var _d=(_9)?_9:window.location;
this.setAttribute("xiRedirectUrl",_d);
this.setAttribute("redirectUrl","");
if(_a){this.setAttribute("redirectUrl",_a);}
};
com.deconcept.FlashObject.prototype={setAttribute:function(_e,_f){
this.attributes[_e]=_f;
},getAttribute:function(_10){
return this.attributes[_10];
},addParam:function(_11,_12){
this.params[_11]=_12;
},getParams:function(){
return this.params;
},addVariable:function(_13,_14){
this.variables[_13]=_14;
},getVariable:function(_15){
return this.variables[_15];
},getVariables:function(){
return this.variables;
},createParamTag:function(n,v){
var p=document.createElement("param");
p.setAttribute("name",n);
p.setAttribute("value",v);
return p;
},getVariablePairs:function(){
var _19=new Array();
var key;
var _1b=this.getVariables();
for(key in _1b){_19.push(key+"="+_1b[key]);}
return _19;
},getFlashHTML:function(){
var _1c="";
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
if(this.getAttribute("doExpressInstall")){
this.addVariable("MMplayerType","PlugIn");
}
_1c="<embed type=\""+tYpe+"\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
_1c+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
var _1d=this.getParams();
for(var key in _1d){_1c+=[key]+"=\""+_1d[key]+"\" ";}
var _1f=this.getVariablePairs().join("&");
if(_1f.length>0){_1c+="flashvars=\""+_1f+"\"";}
_1c+="/>";
}else{
if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");}
_1c="<object id=\""+this.getAttribute("id")+"\" classid=\""+clsId+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
_1c+="<param name=\""+nAme+"\" value=\""+this.getAttribute("swf")+"\" />";
var _20=this.getParams();
for(var key in _20){_1c+="<param name=\""+key+"\" value=\""+_20[key]+"\" />";}
var _22=this.getVariablePairs().join("&");
if(_22.length>0){_1c+="<param name=\"flashvars\" value=\""+_22+"\" />";
}_1c+="</object>";}
return _1c;
},write:function(_23){
	if(this.useExpressInstall){
		var _24=new com.deconcept.PlayerVersion([6,0,65]);
		if(this.installedVer.versionIsValid(_24)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){
			this.setAttribute("doExpressInstall",true);
			this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
			document.title=document.title.slice(0,47)+" - Flash Player Installation";
			this.addVariable("MMdoctitle",document.title);
		}
	}else{this.setAttribute("doExpressInstall",false);}
if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){
var n=(typeof _23=="string")?document.getElementById(_23):_23;
n.innerHTML=this.getFlashHTML();
}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}}};
com.deconcept.FlashObjectUtil.getPlayerVersion=function(_26,_27){
var _28=new com.deconcept.PlayerVersion(0,0,0);
if(navigator.plugins&&navigator.mimeTypes.length){
var x=navigator.plugins["Shockwave Flash"];
if(x&&x.description){_28=new com.deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}
}else{
try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
for(var i=3;axo!=null;i++){
axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
_28=new com.deconcept.PlayerVersion([i,0,0]);}}
catch(e){}
if(_26&&_28.major>_26.major){return _28;}
if(!_26||((_26.minor!=0||_26.rev!=0)&&_28.major==_26.major)||_28.major!=6||_27){
try{
_28=new com.deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
}catch(e){}}}
return _28;
};
com.deconcept.PlayerVersion=function(_2c){
this.major=parseInt(_2c[0])||0;
this.minor=parseInt(_2c[1])||0;
this.rev=parseInt(_2c[2])||0;
};
com.deconcept.PlayerVersion.prototype.versionIsValid=function(fv){
if(this.major<fv.major){return false;}
if(this.major>fv.major){return true;}
if(this.minor<fv.minor){return false;}
if(this.minor>fv.minor){return true;}
if(this.rev<fv.rev){return false;}
return true;
};
com.deconcept.util={getRequestParameter:function(_2e){
var q=document.location.search||document.location.href.hash;
if(q){var _30=q.indexOf(_2e+"=");
var _31=(q.indexOf("&",_30)>-1)?q.indexOf("&",_30):q.length;
if(q.length>1&&_30>-1){
return q.substring(q.indexOf("=",_30)+1,_31);}}return "";
},removeChildren:function(n){
while(n.hasChildNodes()){
n.removeChild(n.firstChild);}}};
if(Array.prototype.push==null){
Array.prototype.push=function(_33){
this[this.length]=_33;
return this.length;};}
var getQueryParamValue=com.deconcept.util.getRequestParameter;
var FlashObject=com.deconcept.FlashObject;

// hide_autocomplete: 
// just call the function AFTER all the 'input' elements of the page (not when page is loaded but when is DOMready).
// all 'input' elements with css class 'disableAutocomplete' will hide the browser suggestions list.
function hide_autocomplete() {
	if (document.getElementsByTagName) {
		// find all 'input' elements of the page
		var inputElements = document.getElementsByTagName("input");
		for (i=0;i<inputElements.length; i++) {
			if (inputElements[i].className && (inputElements[i].className.indexOf("disableAutocomplete") != -1)) {
				// if css class equals 'disableAutocomplete', input element hides the browser suggestions list.
				inputElements[i].setAttribute("autocomplete","off");
			}
		}
	}
}
// getcookie
function getCookie(name) {
	var sPos = document.cookie.indexOf(name + "=");
	var len = sPos + name.length + 1;
	if((!sPos) && (name != document.cookie.substring(0, name.length))){return null;}
	if(sPos == -1){return null;}
	var ePos = document.cookie.indexOf(';', len);
	if(ePos == -1) ePos = document.cookie.length;
	return unescape(document.cookie.substring(len, ePos));
}
// setcookie
function setCookie(name, value, expires, path, domain, secure){
	var today = new Date();
	if(expires){expires = expires * 1000 * 3600 * 24;}
	document.cookie = name+'='+escape(value) +
		((expires) ? ';expires=' + new Date(today.getTime() + expires).toGMTString() : '') +
		((path) ? ';path=' + path : '') +
		((domain) ? ';domain=' + domain : '') +
		((secure) ? ';secure' : '');
}

// deletecookie (non utilizzata, il cookie scade da solo)
function deleteCookie(name, path, domain){if(getCookie(name)){setCookie(name, '', -30, path, domain);}}


// ChangePinManager per la gestione dell'inserimento del Numero Seriale SIM 
		
ChangePinManager = function(){};

/*PARAMS*/		
ChangePinManager.MIN_NUMBER_LENGTH = 19; // minimo numero di caratteri del PIN
ChangePinManager.MAX_NUMBER_LENGTH = 19; // massimo numero di caratteri del PIN
		
/* Funzione per controllo Numero Seriale SIM durante la digitazione */
ChangePinManager.CheckPin = function( txtField )
{
	var text = txtField.value;
	var newText = "";
	for( var i=0; i<text.length; i++ )
	{
		if( !isNaN( text.charAt(i) ) )
			newText += text.charAt(i);
	}
	if( newText.length > ChangePinManager.MAX_NUMBER_LENGTH )
		newText= newText.substr( 0, ChangePinManager.MAX_NUMBER_LENGTH );
	txtField.value = newText;
}

ChangePinManager.CheckPinForm = function( frm ) {
	/* da configurare con l'id del text field del Numero Seriale SIM */
	if( frm.SIM_n.value == "" || frm.SIM_n.value.length < ChangePinManager.MIN_NUMBER_LENGTH )
	{
		alert( "Il Numero Seriale SIM deve essere numerico e di " + ChangePinManager.MIN_NUMBER_LENGTH + " caratteri" );
		frm.SIM_n.focus();
		return false;
	}
	return true;
}

/* Funzione per effettuare il submit della form eseguendo il controllo della stessa */
ChangePinManager.SubmitForm = function( frm ) {
	if( ChangePinManager.CheckPinForm( frm ) )
		frm.submit();
}

// calendar layer
// default settins
var A_TCALDEF = {
	'months' : ['Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre'],
	'yearscroll': true, // show year scroller
	'weekstart': 1, // first day of week: 0-Su or 1-Mo
	'centyear'  : 70, // 2 digit years less than 'centyear' are in 20xx, othewise in 19xx.
	'imgpath' : 'http://www.vodafone.it/resnew/img/' // directory with calendar images
}

// date parsing function
function f_tcalParseDate (s_date) {

	var re_date = /^\s*(\d{1,2})\-(\d{1,2})\-(\d{2,4})\s*$/;
	if (!re_date.exec(s_date))
		return alert ("Invalid date: '" + s_date + "'.\nAccepted format is dd-mm-yyyy.")
	var n_day = Number(RegExp.$1),
		n_month = Number(RegExp.$2),
		n_year = Number(RegExp.$3);

	if (n_year < 100)
		n_year += (n_year < this.a_tpl.centyear ? 2000 : 1900);
	if (n_month < 1 || n_month > 12)
		return alert ("Invalid month value: '" + n_month + "'.\nAllowed range is 01-12.");
	var d_numdays = new Date(n_year, n_month, 0);
	if (n_day > d_numdays.getDate())
		return alert("Invalid day of month value: '" + n_day + "'.\nAllowed range for selected month is 01 - " + d_numdays.getDate() + ".");

	return new Date (n_year, n_month - 1, n_day);
}
// date generating function
function f_tcalGenerDate (d_date) {
	return (
		(d_date.getDate() < 10 ? '0' : '') + d_date.getDate() + "-"
		+ (d_date.getMonth() < 9 ? '0' : '') + (d_date.getMonth() + 1) + "-"
		+ d_date.getFullYear()
	);
}

// implementation
function tcal (a_cfg, a_tpl) {

	// apply default template if not specified
	if (!a_tpl)
		a_tpl = A_TCALDEF;

	// register in global collections
	if (!window.A_TCALS)
		window.A_TCALS = [];
	if (!window.A_TCALSIDX)
		window.A_TCALSIDX = [];
	
	this.s_id = a_cfg.id ? a_cfg.id : A_TCALS.length;
	window.A_TCALS[this.s_id] = this;
	window.A_TCALSIDX[window.A_TCALSIDX.length] = this;
	
	// assign methods
	this.f_show = f_tcalShow;
	this.f_hide = f_tcalHide;
	this.f_toggle = f_tcalToggle;
	this.f_update = f_tcalUpdate;
	this.f_relDate = f_tcalRelDate;
	this.f_parseDate = f_tcalParseDate;
	this.f_generDate = f_tcalGenerDate;
	
	// create calendar icon
	this.s_iconId = 'tcalico_' + this.s_id;
	this.e_icon = f_getElement(this.s_iconId);
	if (!this.e_icon) {
		document.write('<img src="' + a_tpl.imgpath + 'cal.jpg" id="' + this.s_iconId + '" onclick="A_TCALS[\'' + this.s_id + '\'].f_toggle()" class="tcalIcon" alt="Apri Calendario" />');
		this.e_icon = f_getElement(this.s_iconId);
	}
	// save received parameters
	this.a_cfg = a_cfg;
	this.a_tpl = a_tpl;
	
	if (document.addEventListener)
		window.addEventListener('scroll', f_tcalHideAll, false);
	if (window.attachEvent)
		window.attachEvent('onscroll', f_tcalHideAll);
}

function f_tcalShow (d_date) {

	// find input field
	if (!this.a_cfg.controlname)
		throw("TC: control name is not specified");
	if (this.a_cfg.formname) {
		var e_form = document.forms[this.a_cfg.formname];
		if (!e_form)
			throw("TC: form '" + this.a_cfg.formname + "' can not be found");
		this.e_input = e_form.elements[this.a_cfg.controlname];
	}
	else
		this.e_input = f_getElement(this.a_cfg.controlname);

	if (!this.e_input || !this.e_input.tagName || this.e_input.tagName != 'INPUT')
		throw("TC: element '" + this.a_cfg.controlname + "' does not exist in "
			+ (this.a_cfg.formname ? "form '" + this.a_cfg.controlname + "'" : 'this document'));

	// dynamically create HTML elements if needed
	this.e_div = f_getElement('tcal');
	if (!this.e_div) {
		this.e_div = document.createElement("DIV");
		this.e_div.id = 'tcal';
		document.body.appendChild(this.e_div);
	}
	
	this.e_iframe =  f_getElement('tcalIF')
	if (b_ieFix && !this.e_iframe) {
		this.e_iframe = document.createElement("IFRAME");
		this.e_iframe.style.filter = 'alpha(opacity=0)';
		this.e_iframe.id = 'tcalIF';
		this.e_iframe.src = this.a_tpl.imgpath + 'pixel.gif';
		document.body.appendChild(this.e_iframe);
	}
	
	// hide all calendars
	f_tcalHideAll();

	// generate HTML and show calendar
	this.e_icon = f_getElement(this.s_iconId);
	if (!this.f_update())
		return;

	this.e_div.style.visibility = 'visible';
	if (this.e_iframe)
		this.e_iframe.style.visibility = 'visible';

	// change icon and status
	this.e_icon.src = this.a_tpl.imgpath + 'iconCloseCal.gif';
	this.e_icon.title = 'Chiudi Calendario';
	this.b_visible = true;
}

function f_tcalHide (n_date) {
	if (n_date)
		this.e_input.value = this.f_generDate(new Date(n_date));

	// no action if not visible
	if (!this.b_visible)
		return;

	// hide elements
	if (this.e_iframe)
		this.e_iframe.style.visibility = 'hidden';
	this.e_div.style.visibility = 'hidden';
	
	// change icon and status
	this.e_icon = f_getElement(this.s_iconId);
	this.e_icon.src = this.a_tpl.imgpath + 'cal.jpg';
	this.e_icon.title = 'Apri Calendario';
	this.b_visible = false;
}

function f_tcalToggle () {
	return this.b_visible ? this.f_hide() : this.f_show();
}

function f_tcalUpdate (d_date) {

	var d_client = new Date();
	d_client.setHours(0);
	d_client.setMinutes(0);
	d_client.setSeconds(0);
	d_client.setMilliseconds(0);
	
	var d_today = this.a_cfg.today ? this.f_parseDate(this.a_cfg.today) : d_client;
	var d_selected = this.e_input.value == ''
		? (this.a_cfg.selected ? this.f_parseDate(this.a_cfg.selected) : d_today)
		: this.f_parseDate(this.e_input.value);

	// figure out date to display
	if (!d_date)
		// selected by default
		d_date = d_selected;
	else if (typeof(d_date) == 'number')
		// get from number
		d_date = new Date(d_date);
	else if (typeof(d_date) == 'string')
		// parse from string
		this.f_parseDate(d_date);
		
	if (!d_date) return false;

	// first date to display
	var d_firstday = new Date(d_date);
	d_firstday.setDate(1);
	d_firstday.setDate(1 - (7 + d_firstday.getDay() - this.a_tpl.weekstart) % 7);
	
	var a_class, s_html = '<table class="ctrl" border="0" cellspacing="0" cellpadding="0"><tbody><tr>'
		+ (this.a_tpl.yearscroll ? '<td' + this.f_relDate(d_date, -1, 'y') + ' title="Previous Year"><img src="' + this.a_tpl.imgpath + 'prev_year.gif" /></td>' : '')
		+ '<td' + this.f_relDate(d_date, -1) + ' title="Mese Precedente"><a href="#1"><img src="' + this.a_tpl.imgpath + 'prev_mon.gif" /></a></td><th>'
		+ this.a_tpl.months[d_date.getMonth()] + ' ' + d_date.getFullYear()
			+ '</th><td' + this.f_relDate(d_date, 1) + ' title="Mese Successivo"><a href="#1"><img src="' + this.a_tpl.imgpath + 'next_mon.gif" /></a></td>'
		+ (this.a_tpl.yearscroll ? '<td' + this.f_relDate(d_date, 1, 'y') + ' title="Next Year"><img src="' + this.a_tpl.imgpath + 'next_year.gif" /></td></td>' : '')
		+ '</tr></tbody></table><table border="0" cellspacing="0" cellpadding="0"><tbody>';

	

	// print calendar table
	var d_current = new Date(d_firstday);
	while (d_current.getMonth() == d_date.getMonth() ||
		d_current.getMonth() == d_firstday.getMonth()) {
	
		// print row heder
		s_html +='<tr>';
		for (var n_wday = 0; n_wday < 7; n_wday++) {

			a_class = [];
			// other month
			if (d_current.getMonth() != d_date.getMonth())
				a_class[a_class.length] = 'othermonth';
			// weekend
			if (d_current.getDay() == 0 || d_current.getDay() == 6)
				a_class[a_class.length] = 'weekend';
			// today
			if (d_current.valueOf() == d_today.valueOf())
				a_class[a_class.length] = 'today';
			// selected
			if (d_current.valueOf() == d_selected.valueOf())
				a_class[a_class.length] = 'selected';

			s_html += '<td onclick="A_TCALS[\'' + this.s_id + '\'].f_hide(' + d_current.valueOf() + ')"' + (a_class.length ? ' class="' + a_class.join(' ') + '"><a href="#1">' : '><a href="#1">') + d_current.getDate() +'</a></td>'
			d_current.setDate(d_current.getDate() + 1);
		}
		// print row footer
		s_html +='</tr>';
	}
	s_html +='</tbody></table>';
	
	// update HTML, positions and sizes
	this.e_div.innerHTML = s_html;

	var n_width  = this.e_div.offsetWidth;
	var n_height = this.e_div.offsetHeight;
	var n_top  = f_getPosition (this.e_icon, 'Top') + this.e_icon.offsetHeight;
	var n_left = f_getPosition (this.e_icon, 'Left') - n_width + this.e_icon.offsetWidth;
	if (n_left < 0) n_left = 0;
	
	this.e_div.style.left = n_left + 'px';
	this.e_div.style.top  = n_top + 'px';


	if (this.e_iframe) {
		this.e_iframe.style.left = n_left + 'px';
		this.e_iframe.style.top  = n_top + 'px';
		this.e_iframe.style.width = (n_width + 6) + 'px';
		this.e_iframe.style.height = (n_height + 6) +'px';
	}
	return true;
}

function f_getPosition (e_elemRef, s_coord) {
	var n_pos = 0, n_offset,
		e_elem = e_elemRef;

	while (e_elem) {
		n_offset = e_elem["offset" + s_coord];
		n_pos += n_offset;
		e_elem = e_elem.offsetParent;
	}
	// margin correction in some browsers
	if (b_ieMac)
		n_pos += parseInt(document.body[s_coord.toLowerCase() + 'Margin']);
	else if (b_safari)
		n_pos -= n_offset;
	
	e_elem = e_elemRef;
	while (e_elem != document.body) {
		n_offset = e_elem["scroll" + s_coord];
		if (n_offset && e_elem.style.overflow == 'scroll')
			n_pos -= n_offset;
		e_elem = e_elem.parentNode;
	}
	return n_pos;
}

function f_tcalRelDate (d_date, d_diff, s_units) {
	var s_units = (s_units == 'y' ? 'FullYear' : 'Month');
	var d_result = new Date(d_date);
	d_result['set' + s_units](d_date['get' + s_units]() + d_diff);
	if (d_result.getDate() != d_date.getDate())
		d_result.setDate(0);
	return ' onclick="A_TCALS[\'' + this.s_id + '\'].f_update(' + d_result.valueOf() + ')"';
}

function f_tcalHideAll () {
	for (var i = 0; i < window.A_TCALSIDX.length; i++)
		window.A_TCALSIDX[i].f_hide();
}	

f_getElement = document.all ?
	function (s_id) { return document.all[s_id] } :
	function (s_id) { return document.getElementById(s_id) };
	
// global variables
var s_userAgent = navigator.userAgent.toLowerCase(),
	re_webkit = /WebKit\/(\d+)/i;
var b_mac = s_userAgent.indexOf('mac') != -1,
	b_ie5 = s_userAgent.indexOf('msie 5') != -1,
	b_ie6 = s_userAgent.indexOf('msie 6') != -1 && s_userAgent.indexOf('opera') == -1;
var b_ieFix = b_ie5 || b_ie6,
	b_ieMac  = b_mac && b_ie5,
	b_safari = b_mac && re_webkit.exec(s_userAgent) && Number(RegExp.$1) < 500;


var eviAttivo = 1;
     
function showEvi(id)
 {
       
	/*document.getElementById('evi' + eviAttivo).style.display = 'none';
	document.getElementById('evi' + id).style.display = 'block';

	document.getElementById('contenuto-evi' + eviAttivo).style.display = 'none';
	document.getElementById('contenuto-evi' + id).style.display = 'block';	


	eviAttivo = id; */
	
	hideTile(id);
	
 }
 
 function hideTile(tab)
 {
	 var i=1;
	 for (i=1;i<=6;i++)
	 {
	  if (i == tab)
	  {
       document.getElementById('t'+i).src = '../images/secondo-menu/tile-'+ i +'-on.gif';
	   document.getElementById('evi' + i).style.display = 'block';
	   document.getElementById('contenuto-evi' + i).style.display = 'block';
      }
	  else
	  {
       document.getElementById('t'+i).src = '../images/secondo-menu/tile-'+ i +'-off.gif';
	document.getElementById('evi' + i).style.display = 'none';	   
	   document.getElementById('contenuto-evi' + i).style.display = 'none';
	  } 
	 } 
 }
 

 
 function hideEvi()
 {
 	document.getElementById('evi1').style.display = 'none';
	document.getElementById('evi2').style.display = 'none';
	document.getElementById('evi3').style.display = 'none';
 	document.getElementById('evi4').style.display = 'none';
	document.getElementById('evi5').style.display = 'none';
	document.getElementById('evi6').style.display = 'none';		
	showEvi(1);
	/*imgFirst.src="images/sfoglia_on.gif"; 
	eviAttivo =1; */
 }

		

		
