var win;

function getWindowCenter(_iX,_iY){
 var iWinX=(screen.width - _iX)/2;
 var iWinY=(screen.height - _iY)/2;
 return('top='+iWinY+',left='+iWinX);
}

function createWindowName(_sUrl){
 var _iLastSlash=_sUrl.lastIndexOf('/');
 var _iLastSlashMin=_sUrl.substring(0,(_iLastSlash-1)).lastIndexOf('/');
 return(_sUrl.substr(_iLastSlash,_sUrl.length).indexOf('.')>0)?('file_'+escape(_sUrl.substring(_iLastSlash+1,_sUrl.lastIndexOf('.')))):('file_'+ escape(_sUrl.substring((_iLastSlashMin+1),_iLastSlash)));
}

function createWindow(_sUrl,_sName,_sParams){
 win=window.open(_sUrl,_sName,_sParams);
 win.focus();
}

function w(_sUrl,_sType){
 var _sParams,_sName,_sWinPos,_iX,_iY;
 switch(_sType){
  case'ia':
   _iX=665;
   _iY=630;
   _sParams='height='+_iY+',width='+_iX+',scrollbars=1,location=0;toolbars=0,resizable=1,status=1';
   _sName='form';
   break;
  case'html':
   _iX=800;
   _iY=600;
   _sParams='height='+_iY+',width='+_iX+',scrollbars=1,location=0;toolbars=0,resizable=1,status=1';
   _sName='form';
   break;
  case'form':
   _iX=645;
   _iY=440;
   _sParams='height='+_iY+',width='+_iX+',scrollbars=1,location=0;toolbars=0,resizable=0,status=1';
   _sName='form';
   break;
  case'note':
   _iX=660;
   _iY=500;
   _sParams='height='+_iY+',width='+_iX+',scrollbars=1,location=0;toolbars=0,resizable=0,status=1'; 
   _sName=createWindowName(_sUrl);
   break;
  case'print':
   _iX=640;
   _iY=550;
   _sParams='height='+_iY+',width='+_iX+',scrollbars=1,location=0;toolbars=0,menubar=1,resizable=0,status=1'; 
   _sName='print';
   break;
  case'table':
  case'large':
   _iX=900;
   _iY=600;
   _sParams='height='+_iY+',width='+_iX+',scrollbars=1,location=0,toolbars=1,resizable=1,status=1';
   _sName=createWindowName(_sUrl);
   break;
  case'xls':
  case'pdf':
   _iX=600;
   _iY=500;
   _sParams='height='+_iY+',width='+_iX+',scrollbars=1,location=0,toolbars=1,resizable=1,status=1';
   _sName='file';
   break;
 };
 _sWinPos=getWindowCenter(_iX,_iY);
 _sParams+=','+_sWinPos;
 createWindow(_sUrl,_sName,_sParams);
}

function parentNav(_sUrl){if(window.opener != null){window.opener.location=_sUrl;window.opener.focus();}}

function printPage(){window.print();}

function recommendPage(){window.location='mailto:?subject='+aCommons['recommend_subject']+'&body='+aCommons['recommend_body']+': '+document.title+": "+document.location;}

var aCommons=[];
// printbasket
aCommons['printbasket_page_added']='The following page was added to the print basket';
aCommons['printbasket_empty_basket']='Your printbasket is currently empty.';
aCommons['printbasket_link_print']='Print';
aCommons['printbasket_link_delete']='Delete';
aCommons['printbasket_link_title_print']='Print this page';
aCommons['printbasket_link_title_delete']='Delete this page from your printbasket';
aCommons['printbasket_link_title_opens_new']='opens in a new window';
aCommons['printbasket_link_title_opens_main']='opens in the main window';
aCommons['printbasket_link_title_linkto']='Link to';
// recommend page
aCommons['recommend_subject']='adidas-Salomon 2005 Annual Report';
aCommons['recommend_body']='I thought this link might interest you';


// bookmark function

function bookMark(){
 if(window.external){
  window.external.AddFavorite(location.href,document.title);
 }else{
  alert("PC users:\n\tClick 'Ctrl + D' to add this page to your bookmarks.\n\tOpera users: 'Ctrl + T'\n\nMacintosh users: \n\tClick 'Apple + D' to add this page to your bookmarks.\n\tOpera users: 'Apple + T'");
 }
} 
