menupagenum = 123
document.observe("dom:loaded", function() {
    ttt();
}

);



Event.observe(window, 'load', function() {
    ttt();
});

Event.observe(window, 'resize', function() {
    ttt();
});
var loaded = false
var menupagenum = "123"


var doch = 700
var docw = 0
var bgimgw = 0
var bgimgh = 0


var topheight = 98
var bottomheight = 24 + 26
function ttt() {
    doPageLayout()
    localLayout()
}

function doPageLayout() {
    calcLocalHeight()
    docw = getdocwidth()//$(document.body).getWidth()
    $("hlder").hide()
    var minwidth = 942
    if (docw < minwidth) docw = 942;
    //docw = docw -19;// right black strip space;
    if (bgimgh == 0) Event.observe('mainpic', 'load', function(event) {

        bgimgw = $("mainpic").width
        bgimgh = $("mainpic").height
        //alert (bgimgw + " " +  bgimgh)
        $('mainpic').stopObserving('load');
        setbgimage();
        //$("mainpic").width=docw

        /*
        new Effect.Opacity('mainpic', { 
        duration: 1.0,
		
		from: 0, 
        to: 1
        });
        */
    }
	)
    else
        setbgimage();
    ;

    //$("mainpic").width=docw;
    //new Effect.Opacity('mainpic', { from: 0, to: 0 });
    $("mainpic").src = mbgimage.src
    //$("mainpic").setStyle({width: docw})

    //  var docw=document.body.getWidth()


    $('bgholder').makeClipping()
    $('bgholder').style.width = (docw) + 'px';
    $('bgholder').style.height = doch + 'px';

    //.setHeight(100);
    //setStyle({width: docw, height: '768px'});
    $('topstrip').absolutize();
    $('topstrip').setStyle({ height: '63px', backgroundColor: '#5b5b5b' });
    $('topstrip').style.width = (docw) + 'px';
    $('topstrip').setOpacity(0.85)

    $('topstrip2').absolutize();
    $('topstrip2').setStyle({ top: '63px', height: '34px', backgroundColor: '#171717' });
    $('topstrip2').style.width = (docw) + 'px';
    $('topstrip2').setOpacity(0.95)


    $('logoholder').absolutize();
    $('logoholder').clonePosition('topstrip', { setWidth: false, setHeight: false, offsetLeft: 5, offsetTop: 25 });

    //swfobject.embedSWF("menu.swf", "topmenu", "500", "98", "9.0.0", "expressInstall.swf");
/*    var att = { data: "menu.swf", width: "500", height: "98" };
    var par = { flashvars: "mnu=" + mnujs, wmode: "transparent" };
    var id = "topmenuHolder";
    var myObject = swfobject.createSWF(att, par, id);
    */
    $('topmenu').absolutize();
    //$('topmenu').clonePosition('topstrip',{setWidth:false,setHeight:false,offsetLeft: 5, offsetTop: 25});
    $('topmenu').style.left = (docw - 645) + "px"
    $('topmenu').style.top = "67px"





    $('bottommenu2bg').absolutize();
    $('bottommenu2bg').setStyle({ height: bottomheight + 'px', backgroundColor: '#000000' });
    $('bottommenu2bg').style.width = (docw) + 'px';
    $('bottommenu2bg').style.top = (doch - bottomheight) + 'px';
    $('bottommenu2bg').setOpacity(0.75)


    $('bottommenu2').absolutize();
    $('bottommenu2').clonePosition('bottommenu2bg');
    $('bottommenu2').setStyle({ backgroundColor: 'transparent', direction: 'rtl' });
    $('bottommenu2').setOpacity(1)

    /*  $('arava').absolutize(); 
    $('arava').style.width=19+"px"
    $('arava').style.left=(docw)+"px"
    $('arava').style.top=(doch-130)+"px"
    $('powered_by_tetitu').absolutize(); 
    $('powered_by_tetitu').clonePosition('arava',{setWidth:true,setHeight:false, offsetTop: -111});
    */
    //$('powered_by_tetitu').style.left=(docw-500)+"px"


    var dimensions = $('bgholder').getDimensions();

}
function setbgimage() {
    var w = $(document.body).offsetWidth
    var h = getdocheight()

    if (h == 0) h = doch
    if (h < doch) h = doch;
    //alert(getdocwidth())


    $("mainpic").width = getdocwidth()
    $("mainpic").height = bgimgh / bgimgw * w
    if (h > $("mainpic").height) {
        $("mainpic").width = bgimgw / bgimgh * h
        $("mainpic").height = h
    }

}
function getdocheight() {
    var r
    if (window.innerHeight && window.scrollMaxY) {
        r = (window.innerHeight + window.scrollMaxY);
    } else if (document.body.scrollHeight > document.body.offsetHeight) {
        // all but Explorer Mac
        r = (document.body.scrollHeight);
    } else {
        // Explorer Mac...would also work in Explorer 6 Strict, Mozilla
        // and Safari
        r = (document.body.offsetHeight);
    }

    if (r < document.viewport.getHeight()) r = document.viewport.getHeight()
    return r
}
function getdocwidth() {
    var r
    if (window.innerEidth && window.scrollMaxX) {
        r = (window.innerWidth + window.scrollMaxX);
    } else if (document.body.scrollWidth > document.body.offsetWidth) {
        // all but Explorer Mac
        r = (document.body.scrollWidth);
    } else {
        // Explorer Mac...would also work in Explorer 6 Strict, Mozilla
        // and Safari
        r = (document.body.offsetWidth);
    }

    if (r < document.viewport.getWidth()) r = document.viewport.getWidth()
    return r
}




