/*
menu a tendina
*/


function SwitchMenuon(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("menucentralenazioni").getElementsByTagName("span");
		if(el.style.display != "block"){
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="menu_int")
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}
	}
}

function SwitchMenuoff(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("menucentralenazioni").getElementsByTagName("span");
		if(el.style.display != "none"){
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="menu_int")
				ar[i].style.display = "none";
			}
			el.style.display = "none";
		}
	}
}


function SwitchMenuon2(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("menucentralenazioni").getElementsByTagName("span");
		if(el.style.visibility != "visible"){
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="menu_int")
				ar[i].style.visibility = "hidden";
			}
			el.style.visibility = "visible";
		}
	}
}

function SwitchMenuoff2(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("menucentralenazioni").getElementsByTagName("span");
		if(el.style.visibility != "hidden"){
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="menu_int")
				ar[i].style.visibility = "hidden";
			}
			el.style.visibility = "hidden";
		}
	}
}



function SwitchMenuonsopra(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("elementosopra").getElementsByTagName("div");
		if(el.style.visibility != "visible"){
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="menusopra")
				ar[i].style.visibility = "hidden";

			}
			el.style.visibility = "visible";
			el.style.position = "relative";
			el.style.width = "100%";
		}
	}
}

function SwitchMenuoffsopra(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("elementosopra").getElementsByTagName("div");
		if(el.style.visibility != "hidden"){
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="menusopra")
				ar[i].style.visibility = "hidden";
			}
			el.style.visibility = "hidden";
			el.style.position = "absolute";
						el.style.width = "100px";

		}
	}
}


function SwitchMenuonsotto(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("elementosotto").getElementsByTagName("span");
		if(el.style.visibility != "visible"){
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="aprisopra")
				ar[i].style.visibility = "hidden";

			}
			el.style.visibility = "visible";
			el.style.position = "relative";
		}
	}
}

function SwitchMenuoffsotto(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("elementosotto").getElementsByTagName("span");
		if(el.style.visibility != "hidden"){
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="aprisopra")
				ar[i].style.visibility = "hidden";
			}
			el.style.visibility = "hidden";
			el.style.position = "absolute";
		}
	}
}


function SwitchMenuoncont(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("principalecontenuti").getElementsByTagName("div");
		if(el.style.visibility != "visible"){
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="menu_cont")
				ar[i].style.visibility = "hidden";
			}
			el.style.visibility = "visible";
		}
		if(el.style.position != "relative"){
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="menu_cont")
				ar[i].style.position = "absolute";
			}
			el.style.position = "relative";
		}
	}
}

function SwitchMenuoffcont(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("principalecontenuti").getElementsByTagName("div");
		if(el.style.visibility  != "hidden"){
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="menu_cont")
				ar[i].style.visibility  = "hidden";
			}
			el.style.visibility  = "hidden";
		}
		if(el.style.position  != "absolute"){
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="menu_cont")
				ar[i].style.position = "absolute";
			}
			el.style.position  = "absolute";
		}
	}
}

function SwitchMenuonform(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("menucentralenazioni").getElementsByTagName("span");
		if(el.style.display != "block"){
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="menu_int")
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}
	}
}

function SwitchMenuoffform(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("menucentralenazioni").getElementsByTagName("span");
		if(el.style.display != "none"){
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="menu_int")
				ar[i].style.display = "none";
			}
			el.style.display = "none";
		}
	}
}



function SwitchMenuonT(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("menucentralenazioni").getElementsByTagName("span");
		
			/*for (var i=0; i<ar.length; i++){
				//if (ar[i].className=="titolomenu")
				ar.el.className = "titolomenuhover";
			}*/
			el.className = "titolomenuhover";
		
	}
}

function SwitchMenuoffT(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("menucentralenazioni").getElementsByTagName("span");
	
			/*for (var i=0; i<ar.length; i++){
				//if (ar[i].className=="titolomenuhover")
				
			}*/
			el.className = "titolomenuhover";
		
	}
}



/*
fine menu a tendina
*/


function SetAllCheckBoxes(FormName, FieldName, CheckValue)
{
if(!document.forms[FormName])
return;
var objCheckBoxes = document.forms[FormName].elements[FieldName];
if(!objCheckBoxes)
return;
var countCheckBoxes = objCheckBoxes.length;
if(!countCheckBoxes)
objCheckBoxes.checked = CheckValue;
else
// set the check value for all check boxes
for(var i = 0; i < countCheckBoxes; i++)
objCheckBoxes[i].checked = CheckValue;
}
// -->



function my_hide_div(itm)
{
	if ( ! itm ) return;
	
	itm.style.display = "none";
}

function my_show_div(itm)
{
	if ( ! itm ) return;
	
	itm.style.display = "";
}

function ShowHide(id1, id2)
{
	if (id1 != '') toggleview(id1);
	if (id2 != '') toggleview(id2);
}
	
/*-------------------------------------------------------------------------*/
// Get element by id
/*-------------------------------------------------------------------------*/

function my_getbyid(id)
{
	itm = null;
	
	if (document.getElementById)
	{
		itm = document.getElementById(id);
	}
	else if (document.all)
	{
		itm = document.all[id];
	}
	else if (document.layers)
	{
		itm = document.layers[id];
	}
	
	return itm;
}

function toggleview(id)
{
	if ( ! id ) return;
	
	if ( itm = my_getbyid(id) )
	{
		if (itm.style.display == "none")
		{
			my_show_div(itm);
		}
		else
		{
			my_hide_div(itm);
		}
	}
}




function ingrandimento(foto,w,h)
	{
	
	var pw = Math.floor((screen.width-w)/2);
	var ph = Math.floor((screen.height-h)/2);
	
	i1 = new Image;
	i1.src = foto;
	html = '<HTML>\n<HEAD>\n<TITLE>:: PianetaVacanze.it - Ingrandimento Foto ::</TITLE>\n</HEAD>\n<CENTER><BODY LEFTMARGIN=0 MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0 BGCOLOR="#243F30">\n<A href="javascript:self.close();"><IMG SRC="'+foto+'" BORDER=0 alt="Clicca per chiudere la finestra" NAME=imageTest" width="' + w + '" height="' + h + '"></A></CENTER>\n</BODY>\n</HTML>';
	popupImage = window.open('','_blank',"top="+ph+",left="+pw+",width="+w+",height="+h,'toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=0');
	popupImage.document.open();
	popupImage.document.write(html);
	popupImage.document.close()
	};
	


// Preload Immagini

function PreloadImmagini()

{ 

  var args = PreloadImmagini.arguments;

  document.imageArray = new Array(args.length);

  for(var i=0; i<args.length; i++)

  {

    document.imageArray[i] = new Image;

    document.imageArray[i].src = args[i];

  }

}








//carica le immagini del Menu









// Rollover Immagini



function switchImage(imgName, imgSrc) 

{

  if (document.images)

  {

    if (imgSrc != "none")

    {

      document.images[imgName].src = imgSrc;

    }

  }

}



//Pop up di Login e Logout

function login(){
w = 300;
h = 300;
		var pw = Math.floor((screen.width-w)/2);
	    var ph = Math.floor((screen.height-h)/2);

			mywin=window.open('http://www.milazzonline.it/demo/script/mol_login.php',"login","top="+ph+",left="+pw+",width="+w+",height="+h);
			mywin.focus();

			

		}


function logout(){
w = 3;
h = 3;
		var pw = Math.floor((screen.width-w)/2);
	    var ph = Math.floor((screen.height-h)/2);

			mywin=window.open('http://www.milazzonline.it/demo/script/mol_logout.php',"logout","top="+ph+",left="+pw+",width="+w+",height="+h);
			window.self.focus();

			

		}
		
function logout2(url){
w = 300;
h = 300;
		var pw = Math.floor((screen.width-w)/2);
	    var ph = Math.floor((screen.height-h)/2);

			mywin=window.open(url,"logout","top="+ph+",left="+pw+",width="+w+",height="+h);

			

		}


//Pop up Generica



function pop_up(url,w,h,barre){

		var pw = Math.floor((screen.width-w)/2);
	    var ph = Math.floor((screen.height-h)/2);

			mywin=window.open(url,"popup","scrollbars="+barre+",top="+ph+",left="+pw+",width="+w+",height="+h);

			

		}


