// JavaScript Document

/*==========================================================================================*/

/* Add To Bookmark */

function BookmarkPage()
{
	if(document.all)
	{
		window.external.AddFavorite(location.href,document.title);
	}
	else if(window.sidebar)
	{
		window.sidebar.addPanel(document.title,location.href,'');
	}
}
/*==========================================================================================*/

/* ViewHide */

var view=1;

function MarkPicture(id)
{
	if(view!=id)
	{
		document.getElementById('btn'+id).style.display = 'block'; 
		document.getElementById('btn'+view).style.display ='none';
		document.getElementById('link_btn'+id).className ='PictureTop_selected';
		document.getElementById('link_btn'+view).className ='PictureTop_off';
		document.getElementById('cont'+id).style.display = 'block'; 
		document.getElementById('cont'+view).style.display ='none';
		view = id;
	}
	else
	{
		document.getElementById('btn'+view).style.display = 'block'; 
		document.getElementById('link_btn'+view).className ='PictureTop_selected';
		document.getElementById('cont'+view).style.display = 'block'; 
	}
}
/*==========================================================================================*/

/* ViewHideBigMap */

function ViewHideBigMap()
{
	if(document.getElementById('transp').style.display == 'none')
	{	document.getElementById('transp').style.display = 'block'; }
	else
	{	document.getElementById('transp').style.display = 'none';}
}

/*==========================================================================================*/

/* ViewLightBox */

var current = false;
function ViewHideLightBox(obj)
{
    current = $(obj);

	if(obj)
	{	document.getElementById('transp').style.display = 'block'; }
	else
	{	document.getElementById('transp').style.display = 'none';}

	document.getElementById('curr_pict').style.background = 'url('
        + current.next().attr('href') +') center center no-repeat'; 
}
/*==========================================================================================*/


function GoToPhoto( DIRECTION ) {

	if ( DIRECTION == 'Prev'  ) {
        if (current.parent().prev().children('.picture').length > 0)
            current.parent().prev().children('.picture').click();
	} else if ( DIRECTION == 'Next' ) {
        if (current.parent().next().children('.picture').length > 0)
            current.parent().next().children('.picture').click();
    }
}



function fixHeights() {
	
	alert('ho');
	
}



function windowAddFunction(onEvent,f) {

	if (onEvent == 'onload') {

		var prev = window.onload;

		window.onload = function() {

				if(prev)prev(); f(); 

			}

	}	

	if (onEvent == 'onresize') {

		var prev = window.onresize;

		window.onresize = function() {

			if(prev)prev(); f(); 

		}

	}

}



var initHeight = null;
var alreadyResized = false;
//minContheight = 890;
//backImgHeight = 1236;

function getWindowSize() {
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	return [ myWidth, myHeight ];
}

function getScrollOffset() {
	var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
	}
	return [scrOfX,scrOfY ];
}

function fixSiteHeight() {

	contentHeight = document.getElementById('siteBody').offsetHeight;
	windowHeight = document.documentElement.offsetHeight;
	
	if (contentHeight > windowHeight) {
		document.getElementById('siteBodyO').className = 'main_divOut';
		document.getElementById('siteBody').className = 'main_divInner';
	} else {
		document.getElementById('siteBodyO').className = 'main_divOutA';
		document.getElementById('siteBody').className = 'main_divInnerA';
	}
	
}

/*
windowAddFunction('onload',fixSiteHeight);
windowAddFunction('onresize',fixSiteHeight);
*/
