// is it windows or mac

var iswindows = (navigator.userAgent.toLowerCase().indexOf("win") > 0) ? 1:0

// Style sheet platform check

if ((navigator.userAgent.indexOf("Mac") != -1))
    document.write("<link rel='stylesheet' href='m.css' type='text/css'>")
if (navigator.userAgent.indexOf('Win') != -1){
    if (navigator.appName.indexOf('Netscape') != -1) {
        document.write("<link rel='stylesheet' href='n.css' type='text/css'>")
        }
   else {
        document.write("<link rel='stylesheet' href='i.css' type='text/css'>")
        }
    }


// Page Scroll

var y = 0;
var destination = 0;
function jump(destination) {
		step = 5;
		dest = destination;
		if (y<dest) {
			while (y<dest) {
				step += (step / 400);
				y += step;
				self.scroll(0,y);
			}
			self.scroll(0,dest);
			y = dest;
		}
}

//open a centered window with menus

function NewWindow(mypage,myname,w,h,scroll,pos){
	if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math	.floor(Math.random()*((screen.height-h)-75)):100;
	}
	if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;
	}
	else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20;}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win=open(mypage,myname,settings);
	win.opener=self;
	if(win.focus){win.focus();
	}
}

//open a window for bank and news

function NewBankWindow(mypage,myname,w,h,scroll,pos){
	if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math	.floor(Math.random()*((screen.height-h)-75)):100;
	}
	if(pos=="center"){LeftPosition=(screen.width)?((screen.width-w)-15)/2:100;TopPosition=(screen.height)?((screen.height-h)-50)/2:100;
	}
	else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20;}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win=open(mypage,myname,settings);
	win.opener=self;
	if(win.focus){win.focus();
	}
}

function NewShopWindow(mypage,myname,w,h,scroll,pos){
	if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math	.floor(Math.random()*((screen.height-h)-75)):100;
	}
	if(pos=="center"){LeftPosition=(screen.width)?((screen.width-w)-20)/2:100;TopPosition=(screen.height)?((screen.height-h)-50)/2:100;
	}
	else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20;}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,location=no,directories=no,status=yes,menubar=no,toolbar=no,resizable=no';
	win=open(mypage,myname,settings);
	win.opener=self;
	if(win.focus){win.focus();
	}
}


//open a centered window with menus

function NewWindowNormal(mypage,myname,w,h,scroll,pos){
	if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math	.floor(Math.random()*((screen.height-h)-75)):100;
	}
	if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;
	}
	else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20;}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,location=yes,directories=no,status=yes,menubar=yes,toolbar=yes,resizable=no';
	win=open(mypage,myname,settings);
	win.opener=self;
	if(win.focus){win.focus();
	}
}

var movieName = "city";

function thisMovie(movieName) {
  // IE and Netscape refer to the movie object differently.
  // This function returns the appropriate syntax depending on the browser.
  if (navigator.appName.indexOf ("Microsoft") !=-1) {
    return window[movieName]
  } else {
    return document[movieName]
  }
}

// Checks if movie is completely loaded.
// Returns true if yes, false if no.
function movieIsLoaded (theMovie) {
  // First make sure the movie's defined.
// alert(typeof(theMovie)+" iswindows is "+iswindows);
  if (typeof(theMovie) != "undefined") {
    // If it is, check how much of it is loaded.
    return theMovie.PercentLoaded() == 100;
  } else {
    // If the movie isn't defined, it's not loaded.
    return false;
  }
  
}

function playmovie() {
  if (iswindows) {
	  if (movieIsLoaded(thisMovie(movieName)))  {
	    thisMovie(movieName).Play();
	  }
  }
}

