function trace(m)
{ if(window.console){window.console.log(m)} }
var PAGE = new Array(0,0) ;
var PAGE_DATA = {
type : "content" ,
image : null ,
imageSize : null ,
imageRatio : 0 ,
overflow : "auto" ,
contentDiv : null ,
contentLeft : null,
contentRight : null
};
var PAGE_LIMIT = new Array(1000,1000) ;
var MAIN_CONTAINER = new Array(0,0);
var CONTENT = new Array(0,0);
var CONTENT_OFFSET = 136 ;
// HEIGHT LIMITS [min,max]
var MAIN_CONTAINER_LIMIT = new Array(710,710) ;
var MAIN_CONTENT_LIMIT = new Array( MAIN_CONTAINER_LIMIT[0]-CONTENT_OFFSET , MAIN_CONTAINER_LIMIT[1]-CONTENT_OFFSET ) ;
$(document).ready(function(){
//$("#debug2").html( CONTENT_OFFSET+" | "+MAIN_CONTAINER_LIMIT[0]+","+MAIN_CONTAINER_LIMIT[1]+"
"+MAIN_CONTENT_LIMIT[0]+","+MAIN_CONTENT_LIMIT[1] ) ;
if( $("#main-content img.full").length )
{
PAGE_DATA.type ="image" ;
PAGE_DATA.image = $("#main-content img.full") ;
PAGE_DATA.imageSize = [1200,746]; //[$("#main-content img.full").width(),$("#main-content img.full").height()];
PAGE_DATA.imageRatio = PAGE_DATA.imageSize[0]/PAGE_DATA.imageSize[1] ;
PAGE_DATA.overflow = "hidden" ;
}
else if( $("#main-content div.inner-content").length )
{
PAGE_DATA.type ="content" ;
PAGE_DATA.contentDiv = $("#main-content div.inner-content") ;
PAGE_DATA.overflow = "hidden" ;
}
else if( $("#main-content div").length )
{
PAGE_DATA.type ="content" ;
PAGE_DATA.contentDiv = $("#main-content div") ;
if( $("#main-content div div.content-left").length )
{ PAGE_DATA.contentLeft = $("#main-content div div.content-left") ; }
if( $("#main-content div div.content-right").length )
{ PAGE_DATA.contentRight = $("#main-content div div.content-right") ; }
PAGE_DATA.overflow = "hidden" ;
}
$("#main-content").css({overflow:PAGE_DATA.overflow}) ;
//setMpWidth() ;
pageReSize();
$(window).resize( function(){
//setMpWidth() ;
pageReSize()
});
});
function pageReSize()
{
// Calculations
var tmpSize = new Array(10,10) ;
PAGE[0] = Math.round($(window).width());
PAGE[1] = Math.round($(window).height());
MAIN_CONTAINER[0] = PAGE[0]-50 ; //Math.round($("#main-container").width());
MAIN_CONTAINER[1] = PAGE[1]-50 ; //Math.round($("#main-container").height());
if( MAIN_CONTAINER[0] width = limitInf
{
MAIN_CONTAINER[0] = PAGE_LIMIT[0] ;
}
else if( MAIN_CONTAINER[0]>PAGE_LIMIT[1] ) // Width > limitSup => widtw = limitSup
{
MAIN_CONTAINER[0] = PAGE_LIMIT[1] ;
}
CONTENT[0] = Math.round( MAIN_CONTAINER[0]-219 );
var h1 = MAIN_CONTAINER[1] ;
if( h1 Height = limitInf
{
h1=MAIN_CONTAINER_LIMIT[0];
}
else if(h1>MAIN_CONTAINER_LIMIT[1]) // Height > limitSup => Height = limitSup
{
h1=MAIN_CONTAINER_LIMIT[1];
}
var h2 = MAIN_CONTAINER[1]-CONTENT_OFFSET ;
if( h2MAIN_CONTENT_LIMIT[1])
{
h2=MAIN_CONTENT_LIMIT[1];
}
// Apply calculations
// Resize Main Container
$("#main-container").css({
width:MAIN_CONTAINER[0] ,
height:h1
});
$("#left-bar").css({
height:h2
})
// Resize Top Header
$("#page-header").css({ width:MAIN_CONTAINER[0] })
var menu_w = MAIN_CONTAINER[0]-( $("#logo").width()+20 );
var menuCell_w = Math.round(menu_w/4);
$("#info-top").css({ width:menu_w });
$("#top-menu-table").css({ width:menu_w+15 }) ;
$("#top-menu-table tr td").css({ width:menuCell_w })
// Resize Menu Elements
$.each( $("#top-menu-table tr td a .menu-text") ,function (id,el){
var h = $(el).height() ;
var offsetTop = 0 ;
if( h<40 )
{
// set offset top for the text
offsetTop = 20-( Math.round(h/2) ) ;
$(el).css({marginTop:offsetTop})
}
} )
// Resize Main Content
$("#main-content").css({
width:CONTENT[0],
height:h2
})
if( PAGE_DATA.type=="image" )
{
tmpSize = resizeElem( PAGE_DATA.imageSize , new Array(false,h2) ) ;
if( tmpSize[0] h2 )
{
offTop = -1*( Math.round( (Math.abs( tmpSize[1]-h2 ) ) / 2 ) ) ;
}*/
PAGE_DATA.image.css({
marginTop : offTop ,
width : tmpSize[0] ,
height : tmpSize[1]
})
$("#main-gal").css({
width : CONTENT[0] ,
height : h2 ,
overflow:"hidden"
});
}
else if( PAGE_DATA.contentDiv )
{
var rightw = CONTENT[0]-( 199 ) ;
if(PAGE_DATA.contentRight)
{
PAGE_DATA.contentRight.css({width:rightw,height:h2}) ;
// resize inner image if any
if( $("#inner-gal img").length )
{
var pw = 757;
var ph = 468;
tmpSize = resizeElem( new Array(pw,ph) , new Array(rightw-10,false) ) ;
if( tmpSize[1]>h2-180 )
{ tmpSize = resizeElem( tmpSize , new Array(false,h2-180) ) ; }
$("#inner-gal img").css({width:tmpSize[0],height:400}) ;
$("#inner-gal").css({width:tmpSize[0],height:400}) ;
var thumbs = $("#inner-gal-thumbs") ;
if( thumbs.length )
{
pw = rightw-10 ;
ph = 120 ;
thumbs.css({ marginTop:10 , width:pw , height:ph })
// Resize thumbs if any
//var thbSize = new Array(104,55) ;
//var newThbWidth = Math.floor( (pw-25)/7 ) ;
//var newThbSize = resizeElem( thbSize , new Array( newThbWidth , false ) ) ;
var newThbSize = new Array(92,76);
$("#inner-gal-thumbs a img").css({ width:newThbSize[0] , height:newThbSize[1] }) ;
}
}
}
if(PAGE_DATA.contentLeft)
{ PAGE_DATA.contentLeft.css({height:h2}) ; }
if( PAGE_DATA.contentDiv.attr("class")=="inner-content" )
{
PAGE_DATA.contentDiv.css({ width:CONTENT[0] , height:h2 })
if( $("img.location").length )
{
tmpSize = resizeElem( new Array(955,545) , new Array(CONTENT[0]-20,false) ) ;
var nh = h2-60
//$("#debug").html( tmpSize[0] + " " +tmpSize[1]+" ["+h2+" -> "+nh+"]" )
if( tmpSize[1]>(nh) )
{ tmpSize = resizeElem( tmpSize , new Array(false,nh) ) ; }
$("img.location").css({width:tmpSize[0],height:tmpSize[1]})
}
}
}
if( $("div.map-link").length )
{
$("#left-text-container").css({
height : h2- 115
})
}
else
{
$("#left-text-container").css({
height : h2- 85
})
}
}
function resizeElem( oldSize , newSize )
{
var ratio = oldSize[0]/oldSize[1]
var pw = 0 ;
var ph = 0 ;
if( newSize[0] && !newSize[1] ) // resize by Width
{
pw = newSize[0]
ph = Math.round( pw / ratio ) ;
}
else if( !newSize[0] && newSize[1] ) // resize by height
{
ph = newSize[1] ;
pw = Math.round( ph * ratio );
}
return new Array(pw,ph) ;
}
function setMpWidth()
{
var mp = $("#main-content");
var w = $(window).width() - $("#tleft-bar").width();
if( w <100 )
{ w=100 }
else if(w > 1000)
{ w = 1000 ; }
mp.children("img").attr("width" , w ) ;
}