var button;
var button_class_name;

function button_down(id, size){
	
    button = document.getElementById(id);
    button.className = 'button_down_' + size;
    button_class_name = 'button_' + size;

    element = document.getElementById('fade');
    element.style.display='block';
    element.style.height = '1px';
    element.style.width = '1px';

    element = document.getElementById('light');
    element.style.display='block';
    element.style.height = '1px';
    element.style.width = '1px';

    lightBox();

    document.getElementById('replace').innerHTML = document.getElementById(id + '_page').innerHTML;


}

function init(){
    if (navigator.appName=="Microsoft Internet Explorer"&&parseFloat(navigator.appVersion)<7){
        document.getElementById('wrapper').style.width = '1000px';
    }
}

function lightBox()
{

    cont = adjust('fade', 545, 15, 1, 920, 40, 2);

    cont += adjust('light', 480, 20, 1, 348, 40, 2);

    if(cont){
        setTimeout(lightBox, 1);
    } else {

        button.className = button_class_name;
    }
}

function adjust(id, max_height, unit_height_long, unit_height_short, max_width, unit_width_long, unit_width_short){

    element = document.getElementById(id);
    //alert(element.style.height);
    var height = parseInt(element.style.height);

    var width = parseInt(element.style.width);

    var cont = 0;

    if(height < max_height){

        if((height + unit_height_long) > max_height ){
            unit = unit_height_short;
            
        } else {
            unit = unit_height_long;
        }
        //alert(element.style.top);

        //element.style.top = parseInt(element.style.top)- unit +'px';
        element.style.height = parseInt(element.style.height)+ (unit * 2) +'px';
        cont = 1;
    }

    if(width<max_width){

        if((width + unit_width_long) > max_width ){
            unit = unit_width_short;
           
        } else {
            unit = unit_width_long;
        }

        //element.style.left = parseInt(element.style.left) - unit +'px';
        element.style.width = parseInt(element.style.width)+ (unit * 2) +'px';
        cont = 1;
    }

    element = document.getElementById('wrapper');
    element.style.height = '605px';

    return cont;

}

