var dir = 1;
maxTop = 970;
minTop = 266;

var dir2 = 1;
maxTop2 = 490;
minTop2 = 385;

window.onresize = buildDivUADOnResize;

function buildDivUAD(){

	/*document.write('<div id="UADdiv" style="z-index: 1000; display: none; width: 30px; height: 30px; position: absolute; top: 400px; left: 320px ">');
	document.write('<img src="img/newIcona.gif" width="30" height="30">');
	document.write('</div>');

	document.getElementById('UADdiv').style.left = calcolaLeft(739) + 'px';
	document.getElementById('UADdiv').style.display = '';*/


	document.write('<div id="UADdiv2" style="z-index: 1000; display: none; width: 30px; height: 30px; position: absolute; top: 385px; left: 220px ">');
	document.write('<img src="img/newIcona.gif" width="30" height="30">');
	document.write('</div>');

	document.getElementById('UADdiv2').style.left = calcolaLeft(220) + 'px';
	document.getElementById('UADdiv2').style.display = '';

}

function buildDivUADOnResize(){

	/*document.getElementById('UADdiv').style.left = calcolaLeft(739) + 'px';
	document.getElementById('UADdiv').style.display = '';*/

	document.getElementById('UADdiv2').style.left = calcolaLeft(220) + 'px';
	document.getElementById('UADdiv2').style.display = '';

}

    function calcolaLeft(intLeft){

            if(navigator.appName.indexOf("Netscape")!=-1){
                    if(window.innerWidth < 980)
                            return intLeft;
                    else
                            return ((window.innerWidth - 980)/2) + intLeft;
            }
            else{
                    if(window.innerWidth < 980)
                            return intLeft;
                    else
                            return ((document.body.offsetWidth - 980)/2) + intLeft;

            }
    }

function runUAD(){

	//DIV 1
	/*actualTop = document.getElementById('UADdiv').style.top.substr(0,document.getElementById('UADdiv').style.top.indexOf('p'));
	if(dir == 1)
		newTop = parseInt(actualTop) + 5;
	else if (dir == 2)
		newTop = parseInt(actualTop) - 5;

	if(dir == 1 && (newTop >= maxTop)){
		dir = 2;
	}else if(dir == 2 && (newTop <= minTop)){
		dir = 1;
	}*/

        //DIV 2
	actualTop2 = document.getElementById('UADdiv2').style.top.substr(0,document.getElementById('UADdiv2').style.top.indexOf('p'));
	if(dir2 == 1)
		newTop2 = parseInt(actualTop2) + 5;
	else if (dir2 == 2)
		newTop2 = parseInt(actualTop2) - 5;

	if(dir2 == 1 && (newTop2 >= maxTop2)){
		dir2 = 2;
	}else if(dir2 == 2 && (newTop2 <= minTop2)){
		dir2 = 1;
	}

	//document.getElementById('UADdiv').style.top = newTop + 'px';
	document.getElementById('UADdiv2').style.top = newTop2 + 'px';

	setTimeout('runUAD()', 70);

}
