//Created 3/11/02 Kenneth Fly http://hsc.usf.edu/~kfly
//This function is used to center absolutely positioned layers
//on the browsers screen. This allows the developer to set up
//a look for a webpage using layers then to center those layers
//on a screen. This is most helpful for websites completely built
//using layers and absolute positioning. The function requires
//the browserdetect function found on browserdetect.js file.
//The function requires two variables. 
//sizebeforeneedadjustment- the number of pixels of the width 
//of the content to be centered
//layernames- a comma delimited string that is a list of the names 
//of the layers that are part of the content to be centered on the 
//screen.
//The function does not return any values.
function centerlayersonscreen(sizebeforeneedadjustment,layernames){
 var browsertype;
 var adjustmentamount;
 var layersnamesarray;
 var count;
 browsertype=browserdetect();
 layersnamesarray=layernames.split(",");
 if(browsertype==1){
  if(document.body.clientWidth>sizebeforeneedadjustment){
   adjustmentamount=((document.body.clientWidth-sizebeforeneedadjustment)/2);
   for(count=0;count<layersnamesarray.length;count++){
    document.all[layersnamesarray[count]].style.left=parseInt(document.all[layersnamesarray[count]].style.left)+adjustmentamount;
   }
  }
 }
 if(browsertype==2){
  if(window.innerWidth>sizebeforeneedadjustment){
   adjustmentamount=((window.innerWidth-sizebeforeneedadjustment)/2);
   for(count=0;count<layersnamesarray.length;count++){
    document.getElementById(layersnamesarray[count]).style.left=parseInt(document.getElementById(layersnamesarray[count]).style.left)+adjustmentamount;
   }
  }
 }
 if(browsertype==3){
  if(window.innerWidth>sizebeforeneedadjustment){
   adjustmentamount=((window.innerWidth-sizebeforeneedadjustment)/2);
   for(count=0;count<layersnamesarray.length;count++){
    document.layers[layersnamesarray[count]].left=document.layers[layersnamesarray[count]].left+adjustmentamount;
   }
  }
 }
}
