function frontimage(id)
{
    //alert(id);
    frontload('');
    //if(trans == false) {
        show = document.getElementById('main'+id);
        for(var i=0, len=frontp.length; i<len; ++i){
            if(i != id) {
                main = document.getElementById('main'+i);
                try{
                    if(main.style.display == "block") {
                        trans = true;
                        opacity(show,0,100,1,500);
                        opacity(main,100,0,1,500);
                        setTimeout("trans = false;",500)
                    }
                } catch(e){}
            }
	    }
	frontload('start');
	//}
}

function frontswitch()
{
    if(trans == false) {
        for(var i=0;i < frontp.length;i++) {
            main = document.getElementById('main'+frontp[i]);
            //try{
                if(main.style.display == "block") {
                    if(i >= frontp.length-1) {
                        show = document.getElementById('main'+frontp[0]);
                    } else {
                        show = document.getElementById('main'+frontp[i+1]);
                    }
                    trans = true;
                    opacity(show,0,100,1,500);
                    opacity(main,100,0,1,500);
                    setTimeout("trans = false;",500)
                }
            //} catch(e){}
        }
    }
}

function frontload(action)
{    
    if(action == 'start') {
        slide = window.setInterval("frontswitch()", 7000);
    } else {
        clearInterval(slide);
    }
}

function frontscroll(dir)
{    
    if(dir == 'down' || dir == 'up') {
        scroller = window.setInterval("setScroll('front_menu_scroll','"+dir+"',2)", 10);
    } else {
        clearInterval(scroller);
    }
}