function addEvent(o,t,fn){
	if( o.attachEvent ){
       		o['e'+t+fn] = fn;
	        o[t+fn] = function(){o['e'+t+fn](window.event);};
	        o.attachEvent('on'+t, o[t+fn]);
	}else{
       		o.addEventListener(t,fn,false);
	}
}



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);

 if(win){win.focus();}
 return(win);

}

function w(_sUrl,_sType){
	
 var _sParams,_sName,_sWinPos,_iX,_iY;
 switch(_sType){
  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'video': 
   _iX=450;
   _iY=350;
   _sParams='height='+_iY+',width='+_iX+',scrollbars=1,location=0;toolbars=0,resizable=0,status=1';
   _sName=createWindowName(_sUrl);
   break;
  case'slideshow': 
   _iX=750;
   _iY=410;
   _sParams='height='+_iY+',width='+_iX+',scrollbars=1,location=0;toolbars=0,resizable=0,status=1';
   _sName=createWindowName(_sUrl);
   break;
  case'webcast':
   _iX=750;
   _iY=550;
   _sParams='height='+_iY+',width='+_iX+',scrollbars=1,location=0;toolbars=0,resizable=0,status=1';
   _sName=createWindowName(_sUrl);
   break;
  case'colors':
   _iX=600;
   _iY=400;
   _sParams='height='+_iY+',width='+_iX+',scrollbars=1,location=0;toolbars=0,resizable=0,status=1';
   _sName=createWindowName(_sUrl);
   break;
  case'form':
   _iX=645;
   _iY=440;
   _sParams='height='+_iY+',width='+_iX+',scrollbars=no,location=0;toolbars=0,resizable=0,status=1';
   _sName='form';
   break;
  case'filter_rules':
  case'text':
  case'note':
   _iX=640;
   _iY=500;
   _sParams='height='+_iY+',width='+_iX+',scrollbars=1,location=0;toolbars=0,resizable=0,status=1'; 
   _sName=createWindowName(_sUrl);
   break;
  case'relatedlinks':
   _iX=600;
   _iY=200;
   _sParams='height='+_iY+',width='+_iX+',scrollbars=1,location=0;toolbars=0,resizable=0,status=1'; 
   _sName='relatedlinks';
   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=924;
   _iY=600;
   _sParams='height='+_iY+',width='+_iX+',scrollbars=1,location=0,toolbars=1,resizable=1,status=1';
   _sName=createWindowName(_sUrl);
   break;
  case'word':
  case'xls':
  case'pdf':
   _iX=600;
   _iY=500;
   _sParams='height='+_iY+',width='+_iX+',scrollbars=1,location=0,toolbars=1,menubar=1,resizable=1,status=1';
   _sName='file';
   break;
 };

 _sWinPos=getWindowCenter(_iX,_iY);

 _sParams+=','+_sWinPos;

 return(createWindow(_sUrl,_sName,_sParams));

}


var newWin = null; 
function popUp(strURL, strType, strHeight, strWidth) { 
 if (newWin != null && !newWin.closed) 
   newWin.close(); 
 var strOptions=""; 
 if (strType=="console") 
   strOptions="resizable,height="+ 
     strHeight+",width="+strWidth; 
 if (strType=="fixed") 
   strOptions="status,height="+ 
     strHeight+",width="+strWidth; 
 if (strType=="fixedscroll") 
   strOptions="status,scrollbars,height="+ 
     strHeight+",width="+strWidth; 
 if (strType=="elastic") 
   strOptions="toolbar,menubar,scrollbars,"+ 
     "resizable,location,height="+ 
     strHeight+",width="+strWidth; 
 newWin = window.open(strURL, 'newWin', strOptions); 
 newWin.focus(); 
}




