function initWindow()
{
	window.resizeTo(800,700);
}

function switchBackground( obj, strFileName )
{
  obj.style.backgroundImage = "url(" + strFileName + ")";
}

function initBackground()
{
  function rndnumber( intLimit )
  {
    var randnum = -1;
	 randnum = Math.floor(Math.random()*intLimit);
    return randnum;
  }

  var obj = document.getElementById("innerContainer");
  var num = rndnumber(4) + 1;
  obj.style.backgroundImage = "url( ./i/background" + num + ".jpg)";
  obj.style.backgroundRepeat = "no-repeat";
  obj.style.backgroundPosition = "400px 300px";
}

// cross-browser addEventListener function
function addEvent( objElement, strEventType, objCallback )
{
	if (objElement.addEventListener)
	{ 
	    objElement.addEventListener(strEventType, objCallback, true); 
	    return true; 
	} 
	else if (objElement.attachEvent)
	{
	    strEventType = "on" + strEventType;
	    var blnSuccess = objElement.attachEvent(strEventType, objCallback); 
	    return blnSuccess; 
	} 
	else 
	{
	    strEventType = "on" + strEventType;
	    eval("var objOldCallback = objElement." + strEventType );
	    if ( typeof objOldCallback != 'function' ) {
	        eval("objElement." + strEventType + " = objCallback");
	    }
	    else {
	        eval("objElement." + strEventType + " = function() { objOldCallback(); objCallback(); }")
	    }
	    return true;
	} 
}

addEvent( window, 'load', initBackground );
