
function windowOnload() {
 
 // from parameters: page = setContent();
 //                  content = changeContent();
 // input da validacion -> ?page&content,
 // e se ok, cambia resultado
 
 if (page.length > 0) {
     setContent(page);
 }
}


function setContent(url) {
    if (typeof timeout != 'undefined') clearTimeout(timeout);
    e1 = cbeGetElementById('header').cbe;
    e1.slideTo(0,0,1000,"menuClosed('" + url + "')");
}
function menuClosed(url) {
    loadIntoDiv("content_inn", url); 
    e1 = cbeGetElementById('header').cbe;
    e1.slideTo(0,-390,1000);
    timeout = setTimeout("beginFotoSlideShow()", 1000);
    if (content.length > 0) {
        changeContent(content);
    }
}

function changeContent(textid) {
    if (typeof timeout != 'undefined') clearTimeout(timeout);
    copyToDiv('text_' + textid, 'textbox');
    findDOM('fotoslideshow').innerHTML = findDOM('photo_' + textid).innerHTML;
    beginFotoSlideShow();
}

function beginFotoSlideShow() {
    images = document.getElementById("fotoslideshow").getElementsByTagName("img");
    amount = 0.95;
    fadeInImage(0, images.length, 0);
}

function fadeInImage(i, max, amount) {
    if (amount < 1) {
        amount += 0.05;
        var ieamount = amount * 100;
        images[i].style.opacity = amount;
        images[i].style.filter="alpha(opacity=" + ieamount + ")";
        timeout = setTimeout('fadeInImage(' + i + ', ' + max + ', ' + amount + ')', 75);
    } else {
        amount = 0;
        i += 1;
        if (i >= max) {
            i = 1;
            for (j=1; j < max; j++) {
                images[j].style.opacity = 0;
                images[i].style.filter="alpha(opacity=0)";
            }
        }
        timeout = setTimeout('fadeInImage(' + i + ', ' + max + ', ' + amount + ')', 4000);		
    }
}

function send() {
    var form = document.contacto;
    alert(form.elements['nome']);
}
