// 
//   MAIN.JS
//   2007 SensualCindy.nl
//

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function getRefToDiv(divID,oDoc) {
    if( document.getElementById ) { // modern DOM browsers
        return document.getElementById(divID); 
	}
    if( document.all ) { // not so modern DOM browsers
        return document.all[divID]; 
	}
    if( !oDoc ) { 
		oDoc = document; 
	}
    if( document.layers ) { // old nestcape 4 crappy browsers
        if( oDoc.layers[divID] ) { 
			return oDoc.layers[divID]; 
		} else {
            //repeatedly run through all child layers
            for( var x = 0, y; !y && x < oDoc.layers.length; x++ ) {
                //on success, return that layer, else return nothing
                y = getRefToDiv(divID,oDoc.layers[x].document); 
			}
			return y; 
		} 
	}
    return false;
}

function windowWidth()
{
  var myWidth = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
  } else {
    if( document.documentElement &&
        ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
      //IE 6+ in 'standards compliant mode'
      myWidth = document.documentElement.clientWidth;
    } else {
      if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
      }
    }
  }
  return myWidth;
}

function windowHeight()
{
  var myHeight = 0;
  if( typeof( window.innerHeight ) == 'number' ) {
    //Non-IE
    myHeight = window.innerHeight;
  } else {
    if( document.documentElement &&
        ( document.documentElement.clientHeight || document.documentElement.clientHeight ) ) {
      //IE 6+ in 'standards compliant mode'
      myHeight = document.documentElement.clientHeight;
    } else {
      if( document.body && ( document.body.clientHeight || document.body.clientHeight ) ) {
        //IE 4 compatible
        myHeight = document.body.clientHeight;
      }
    }
  }
  return myHeight;
}

function contentBottom() 
{
	var content = getRefToDiv( "content" );
	return ( content.offsetHeight + content.offsetTop );
}

function getSiteInfoHeight()
{
	var info = getRefToDiv( "siteInfo" );
	return info.offsetHeight;
}

function getMenuBottom()
{	
	var menu = getRefToDiv( "navBar" );
	return ( menu.offsetHeight + menu.offsetTop );
}

function positionSiteInfo()
{
	var siteInfo = getRefToDiv( "siteInfo" );
	var style = siteInfo;
	if( siteInfo.style ) { // Internet Explorer
		style = siteInfo.style; 
		vis = 'visible';
	} else { // Netscape e.o
		vis = 'show';
	}	
	var cBottom = contentBottom();
	var mBottom = getMenuBottom();
	var siHeight = getSiteInfoHeight();
	var bottom;
	bottom = ( cBottom > mBottom ) ? cBottom : mBottom;
	var wHeight = windowHeight();
	var top = 450;
	if ( ( bottom + siHeight ) > wHeight ) {
		top = bottom;
	} else {
		top = wHeight - ( siHeight + 3 ); /* 37 */
	}
	style.position = 'absolute';
	style.top = top + 'px';
	style.visibility = vis;
}

function positionContent()
{
	var content = getRefToDiv( "content" );
	var	top = content.offsetTop + getSiteInfoHeight() + 4 /*38*/;	
	if( content.style ) { // Internet Explorer, FF
		content = content.style; 
	}
	var cHeight = windowHeight() - top;
	content.height = cHeight + "px";
}

function positionAll()
{
	positionContent();
	positionSiteInfo();
}

function fireAfterLoad(){	
	if ( $('notice') != null ) {
		Effect.Pulsate('notice');
	}
}


function handleOnLoad()
{
	positionAll();
	window.onResize = positionAll;
	intPID = setTimeout( fireAfterLoad, 2000 );
}





