// JavaScript Document
function invia ( selectedtype )
{
  document.newsletter.accetto.value = selectedtype ;
  document.newsletter.submit() ;
}

function Display(className, state)
{
	if (document.getElementsByTagName) { //check for obj
		 var nodes = document.getElementsByTagName("DIV");
		 for (var i = 0;i < nodes.length;i++) {
			var nodeObj = nodes.item(i);
			var attrMax = nodeObj.attributes.length
			for (var j = 0; j < attrMax; j++) {
				if (nodeObj.attributes.item(j).nodeName == 'class') {
					if (nodeObj.attributes.item(j).nodeValue == className) {
						vista = (state) ? 'block'	: 'none';
						nodeObj.style.display = vista;
					 }
				}
			 }
		}
	}
	var nodes = document.getElementsByTagName("SPAN");
		 
	var max = nodes.length
	for (var i = 0;i < max;i++) {
		var nodeObj = nodes.item(i);
		for (var j = 0; j < nodeObj.attributes.length; j++)  {
			if (nodeObj.attributes.item(j).nodeName == 'class') {
				if (nodeObj.attributes.item(j).nodeValue == className) {
					vista = (state) ? 'block'	: 'none';
					nodeObj.style.display = vista;
			 	}
			}
		}
	}
}

function sposta() {
//misura=document.getElementById("wrapper").offsetWidth;
misura=950;
finestra=document.body.clientWidth;

if (navigator.userAgent.indexOf("Safari")!= -1) {
finestra=screen.availWidth;
}

//finestra=document.body.offsetWidth;
//uguale
spaceO=(finestra - misura);
//spaceL=Math.floor(spaceO / 2);
spaceL=(spaceO / 2);
//scosta=(((misura / 2) + spaceL) - 9);
//alert (scosta);
if (navigator.userAgent.indexOf("MSIE")!= -1) {
document.write("<div id='wrapper'>");
}
/*else if ((navigator.userAgent.indexOf("Netscape")!= -1) && (navigator.userAgent.indexOf("Windows")!= -1)){
	scosta=(((misura / 2) + spaceL) - 8);
document.write("<div id='wrapper' style='left:" + scosta + "px;'>");
}
else if ((navigator.userAgent.indexOf("Netscape")!= -1) && (navigator.userAgent.indexOf("Mac")!= -1)){
	scosta=(((misura / 2) + spaceL) - 8);
document.write("<div id='wrapper' style='left:" + scosta + "px;'>");
}*/
else if ((navigator.userAgent.indexOf("Firefox")!= -1) && (navigator.userAgent.indexOf("Windows")!= -1)){
scosta=(((misura / 2) + spaceL) - 9);
document.write("<div id='wrapper' style='left:" + scosta + "px;'>");//fx pc
}

/*else if ((navigator.userAgent.indexOf("Gecko")!= -1) && (navigator.platform.indexOf("Win")!= -1)){
	scosta=(((misura / 2) + spaceL) - 8);
document.write("<div id='wrapper' style='left:" + scosta + "px;'>");//moz pc
} */
else {
//fx, safari, mac
scosta=(((misura / 2) + spaceL) - 8);
document.write("<div id='wrapper' style='left:" + scosta + "px;'>");
}

}

function spostaT() {
//misura=document.getElementById("wrapper").offsetWidth;
misura=950;
finestra=document.body.clientWidth;

if (navigator.userAgent.indexOf("Safari")!= -1) {
finestra=screen.availWidth;
}

//finestra=document.body.offsetWidth;
//uguale
spaceO=(finestra - misura);
//spaceL=Math.floor(spaceO / 2);
spaceL=(spaceO / 2);
//scosta=(spaceL - 9);
//alert (scosta);
if (navigator.userAgent.indexOf("MSIE")!= -1) {
//ie
document.write("<table width='950' border='0' cellspacing='0' bgcolor='#000000'>");
}
else if ((navigator.userAgent.indexOf("Firefox")!= -1) && (navigator.userAgent.indexOf("Windows")!= -1)){
scosta=(spaceL - 9);
//fx pc
document.write("<table width='950' border='0' cellspacing='0' bgcolor='#000000' style='position:absolute; left:" + scosta + "px;'>");
}
else {
//fx, safari, mac
scosta=(spaceL - 8);
document.write("<table width='950' border='0' cellspacing='0' bgcolor='#000000' style='position:absolute; left:" + scosta + "px;'>");
}
}


function FullScreen(){
this.moveTo(0,0);
resizeTo(screen.availWidth,screen.availHeight);
}


function EvenFullerScreen(theURL,winName,features){
window.open(theURL,winName,features);
}


function disclaimer(){
if ((navigator.platform.indexOf("Win")!= -1)){
document.write("<img src='img/testo_DPC.gif' width='400' height='500' />");
} else {
document.write("<img src='img/testo_D.gif' width='400' height='500' />");	
}
}

function setCookie(name, value, path, domain, secure) { 
         var curCookie = name + "=" + escape(value) + 
                ((path) ? "; path=" + path : "") + 
                ((domain) ? "; domain=" + domain : "") + 
                ((secure) ? "; secure" : ""); 
         document.cookie = curCookie; 
}

function getScrollXY() {
	var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		scrOfY = window.pageYOffset; scrOfX = window.pageXOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		scrOfY = document.body.scrollTop; scrOfX = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		scrOfY = document.documentElement.scrollTop; scrOfX = document.documentElement.scrollLeft;
	}


	
	setCookie("cookie", scrOfY, false, false, false); 
	

}

function check(){
	s = document.URL;
	f = s.split("?");
	//alert (f[0]);
if (document.referrer.indexOf(f[0]) != 0) {
	//alert ("svuoto") ;
	setCookie("cookie", "0", false, false, false);
	}
}


//Get cookie routine by Shelley Powers 
function get_cookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
	  //alert ("trovato");
    offset = document.cookie.indexOf(search)
    // if cookie exists
    if (offset != -1) { 
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset);
      // set index of end of cookie value
      if (end == -1) end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
  //alert (returnvalue);
}

function imagoLBOFF() {
if (navigator.platform.indexOf("Win")!= -1){
document.write("<img src='img/l_off_black.gif' width='21' height='19' />");
} else {
document.write("<img src='img/ml_off_black.gif' width='21' height='19' />");
}
}

function imagoRBOFF() {
if (navigator.platform.indexOf("Win")!= -1){
document.write("<img src='img/r_off_black.gif' width='21' height='19' />");
} else {
document.write("<img src='img/mr_off_black.gif' width='21' height='19' />");
}
}
function imagoLWOFF() {
if (navigator.platform.indexOf("Win")!= -1){
document.write("<img src='img/l_off_white.gif' width='21' height='19' />");
} else {
document.write("<img src='img/ml_off_white.gif' width='21' height='19' />");
}
}

function imagoRWOFF() {
if (navigator.platform.indexOf("Win")!= -1){
document.write("<img src='img/r_off_white.gif' width='21' height='19' />");
} else {
document.write("<img src='img/mr_off_white.gif' width='21' height='19' />");
}
}
function imagoLBON() {
if (navigator.platform.indexOf("Win")!= -1){
document.write("<img src='img/l_black.gif' width='21' height='19' border='0'/>");
} else {
document.write("<img src='img/ml_black.gif' width='21' height='19' border='0' />");
}
}

function imagoRBON() {
if (navigator.platform.indexOf("Win")!= -1){
document.write("<img src='img/r_black.gif' width='21' height='19' border='0' />");
} else {
document.write("<img src='img/mr_black.gif' width='21' height='19' border='0' />");
}
}
function imagoLWON() {
if (navigator.platform.indexOf("Win")!= -1){
document.write("<img src='img/l_white.gif' width='21' height='19' border='0' />");
} else {
document.write("<img src='img/ml_white.gif' width='21' height='19' border='0' />");
}
}

function imagoRWON() {
if (navigator.platform.indexOf("Win")!= -1){
document.write("<img src='img/r_white.gif' width='21' height='19' border='0' />");
} else {
document.write("<img src='img/mr_white.gif' width='21' height='19' border='0' />");
}
}