﻿// File JScript

var popUp = null;

function startList() {
	StartMenu("menu_left");
	StartMenu("menu_right");
	if (typeof compactMenu=="function") {
		compactMenu('lista',true,'&plusmn; ');
	}
	if (typeof moveIt=="function") {
	    document.getElementById('splashScreen').style.visibility = 'visible';
		moveIt();
	}
}

function doPopup(url,nome,w,h) {
    l = (screen.width - w) / 2;
    t = (screen.height - h) / 2;
    popUp = window.open(url, nome, 'width=' + w + ',height=' + h + ',left=' + l + ',top=' + t + ',toolbar=0,status=0,scrollbars=yes,resizable=0');
    popUp.name = nome;
}

function ClosePopup() {
    if (!typeof (popwin) == 'undefined')
        popwin.close();
    //typeof(W)=='undefined'
}
    
function SetControlValue(controlID1, controlID2, controlID3, value1, value2, value3) {
    document.forms[0].elements[controlID1].value = value1;
    document.forms[0].elements[controlID2].value = value2;
    document.forms[0].elements[controlID3].value = value3;
    popUp.close();
}

function SetControlValue2(ctrlname, value) {
    document.forms[0].elements[ctrlname].value = value;
}

function scroll_left(name) {
	document.getElementById(name).start();
	document.getElementById(name).direction="left";
}

function scroll_right(name) {
	document.getElementById(name).start();
	document.getElementById(name).direction="right";
}

function scroll_stop(name) {
	document.getElementById(name).stop();
}

function blendimage(divid, imageid, imagefile, millisec) { 
    var speed = Math.round(millisec / 100);
    var timer = 0; 
    
    document.getElementById(divid).style.visibility = "visible";
    
    //set the current image as background 
    //document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")"; 
     
    //make image transparent 
    changeOpac(0, imageid); 
     
    //make new image 
    document.getElementById(imageid).src = imagefile; 

    //fade in image 
    for(i = 0; i <= 100; i++) { 
        setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed)); 
        timer++; 
    }
}

function ChangeImage(imageid, imageid2) {
    var imgfile = document.getElementById(imageid2).src;
    document.getElementById(imageid).src =  imgfile.substring(0,imgfile.indexOf('_small'))+'.jpg';
}

function backImage(divid, imagefile) {
    document.getElementById(divid).style.backgroundImage = "url(" + imagefile + ")"; 
}

function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
}

function hideFoto() {
	document.getElementById('divfoto').style.visibility = "hidden";
}
		
function StartMenu(nomemenu) {
	if (document.all&&document.getElementById) {
		divobj = document.getElementById(nomemenu);
		if (!(divobj==null)) {
			navRoot = divobj.childNodes[0];
			for (i=0; i<navRoot.childNodes.length; i++) {
				node = navRoot.childNodes[i];
				if (node.nodeName=="LI") {
					node.onmouseover=function() {
						this.className+=" over";
					}
					node.onmouseout=function() {
						this.className=this.className.replace(" over", "");
					}
				}
			}
		}
	}
}

	
	function showToolTip(e,text){
		if(document.all)e = event;
		
		var obj = document.getElementById('bubble_tooltip');
		var obj2 = document.getElementById('bubble_tooltip_content');
		obj2.innerHTML = text;
		obj.style.display = 'block';
		var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
		var leftPos = e.clientX - 100;
		if(leftPos<0)leftPos = 0;
		obj.style.left = leftPos + 'px';
		obj.style.top = e.clientY - obj.offsetHeight -1 + st + 'px';
	}	
	
	function hideToolTip()
	{
		document.getElementById('bubble_tooltip').style.display = 'none';
}

function SetControlImgValue(ctrlname, value) {
    document.forms[0].elements[ctrlname].value = value;
}

function changePic(ctrlname, ctrlname2, ctrlname3, pic1, pic2) {
    img = document.getElementById(ctrlname);
    imgbig = document.getElementById(ctrlname2);
    hidecurimg = document.getElementById(ctrlname3);
    //var pic = ((img.src.match(pic1) != null) ? pic2 : pic1);
    if (img.src.match(pic1) != null) {
        pic = pic2;
        hidecurimg.value = "2";
    }
    else {
        pic = pic1
        hidecurimg.value = "1";
    }
    img.src = pic; imgbig.src = pic.replace("_small.jpg", "_big.jpg");
}

window.onload=startList;

