/********************************************************************************
Copyright (C) 1999 Thomas Brattli
This script is made by and copyrighted to Thomas Brattli at www.bratta.com
Visit for more great scripts. This may be used freely as long as this msg is intact!
I will also appriciate any links you could give me.
********************************************************************************/
//Default browsercheck, added to all scripts!
function checkBrowser(){
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
	return this
}
bw=new checkBrowser()
/********************************************************************************
Here's the pageobject, see www.bratta.com/dhtml for tutorial on how it works.
********************************************************************************/
function makePageObject(){
	this.x=0;
	this.x2=(bw.ns4 || bw.ns5)?innerWidth:document.body.offsetWidth-20;
	this.y=0;
	this.y2=(bw.ns4 || bw.ns5)?innerHeight:document.body.offsetHeight-4;
	this.x50=this.x2/2;
	this.y50=this.y2/2;
	this.x10=(this.x2*10)/100
	this.y10=(this.y2*10)/100
	this.x15=(this.x2*15)/100
	this.y15=(this.y2*15)/100
	return this;
}
/********************************************************************************
Making the objects, Cross-browser and makes a background function that will move the
object easely
********************************************************************************/
function makeObj(obj,nest){
	nest=(!nest) ? '':'document.'+nest+'.'
   	this.css=bw.dom? document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+"document.layers." +obj):0;
	this.setBackgnd=b_setBkgnd;
	return this
}
function b_setBkgnd(bkg){
	this.css.background="url("+bkg+")";
}
/********************************************************************************
Here we call the object constructor to make objects, then we move
them to a choosen place on the page.
********************************************************************************/
function pageInit(){
	//first me make a page object
	page=new makePageObject()

	//now we place them
	//The divs has a width and height of 100, so we divide that with 2 to place it at center
	
//	alert('onload');

	//Takes care of the resizing.
	window.onresize=resized;
}
function resized(){
	page2=new makePageObject()
	if(page2.x2!=page.x2 || page2.y2!=page.y2){
		location.reload() //If the width or height have changed we reload the page.
	}
}
var loadingImage = false;
myImages = new Array;


function LoadImage(imageName,imageFile)
{
  if (!myImages[imageName]) myImages[imageName] = new Image;
  if (myImages[imageName].src.indexOf(imageFile)<0)
  {
//  	alert("loading " + imageName);
    myImages[imageName].src = imageFile;
  }
}
function LoadBackground(imageName,imageFile)
{
//	alert('load background');
	//then we make the layer objects
	oBigPicture=new makeObj('bigPicture');
  if (!myImages[imageName]) myImages[imageName] = new Image;
  if (myImages[imageName].src.indexOf(imageFile)<0)
  {
    myImages[imageName].src = imageFile;
    oBigPicture.setBackgnd(myImages[imageName].src);
  }
//	alert('loaded background');
}
//	alert('hello');
LoadImage('detail','aerialShotDetail2.jpg');


//Calls the init function on pageload;
onload=pageInit;
