// script name:       screenSize_openURL.js
// creation date:     jun 7, 2000
// creators name:     peter tokke
// ////////////////////////////////////////
// this script opens a new window with the size depending
// on the users screensize. A prefix is piped into the
// script telling [eng||swe].
// This script is made to be used for www.rollab.com site.
// !! Do not edit screensize calibration values below. !!

function screenSize_openURL(parm1) {
// variable list -- containing constants and variablenames who will be used
   var directoryPrefix = parm1;
   var directorySufix = '';
   var startfileApplication = '/rollab.htm';
   var directoryApplication = '';
   var newWindowPreperitiesLayout = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes'; 
   var newWindowPreperitiesSize = '';
   var newWindowPreperitiesPos = '';
   var newWindowPreperities = '';
   
   var width = screen.width;

// the resolution is determined here
   var res =(((!(640-width))*1)+((!(800-width))*2)+((!(1024-width))*3)+((!(1152-width))*4)+((!(1280-width))*5));

// check if the resolution is unknown by the web application, then set a default value 
   if(!(res)) {
      res = 5;
      alert('Our website is not optimized for your screensize. 1280x1024 will be used.');
   }

   switch(res)
   {
      case 1:                // the screenwidth is 640x480 pixels        
         directorySufix = '640';
         newWindowPreperitiesSize = 'width=630,height=400';
	     newWindowPreperitiesPos =  'left=0,top=0';
      break;

      case 2:                // the screenwidth is 800x600 pixels        
         directorySufix = '800';
         newWindowPreperitiesSize = 'width=790,height=517';
	     newWindowPreperitiesPos =  'left=0,top=0';
      break;

      case 3:                // the screenwidth is 1024x768 pixels                   
         directorySufix = '1024';
         newWindowPreperitiesSize = 'width=1015,height=685';
	     newWindowPreperitiesPos =  'left=0,top=0';
      break;

      case 4:                // the screenwidth is 1152x864 pixels                      
         directorySufix = '1152';
         newWindowPreperitiesSize = 'width=1142,height=781';
	     newWindowPreperitiesPos =  'left=0,top=0';
      break;

      case 5:                // the screenwidth is 1280x1024 pixels             
         directorySufix = '1280';
         newWindowPreperitiesSize = 'width=1269,height=941';
	     newWindowPreperitiesPos =  'left=0,top=0';
      break;
   }

// the preperities for the new window is putted together.
   newWindowPreperities = newWindowPreperitiesLayout+','+newWindowPreperitiesSize+','+newWindowPreperitiesPos;
   
// the url to the application version is putted together.    
   directoryApplication = directoryPrefix+directorySufix+startfileApplication;

// the new window containing the application, lanches here.
   theApplicationWindow=window.open(directoryApplication,'theApplicationWindow',newWindowPreperities);
}
