function MM_openBrWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}

function MM_reloadPage(init) {
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function enter(url,title,w,h) {
    window.open(url,title,'toolbar=no,location=0,directories=no,menubar=0,resizable=0,scrollbars=no,status=no,width='+w+',height='+h+'');
}
function twAller(_url,_cadre,_target) {
  if (_cadre) {
    parent._cadre.location.href = _url;
  } else if (_target) {
    _target = window.open(_url,_target);
  } else {
    window.location.href = _url;
  }
}
function twPopUp(_url,_nom,_larg,_haut,_defil) {
var op_scroll  = _defil;
var op_wid  = _larg;
var op_heigh = _haut;
var op_tool  = 0;
var op_loc_box  = 0
var op_dir  = 0;
var op_stat  = 0;
var op_menu  = 0;
var op_resize  = 0;                
var options = "toolbar="+ op_tool +",location="+ op_loc_box +",directories=" 
+ op_dir +",status="+ op_stat +",menubar="+ op_menu +",scrollbars="  
+ op_scroll +",resizable="  + op_resize +",width=" + op_wid +",height="+ op_heigh;
var wNom = window.open(_url, _nom, options);
if(_nom.focus){_nom.focus();}
}

function _gel(id){
return document.getElementById(id);
}
// -->
function hasAncestor(element,ancestor){
var el=ref(element);
var an=ref(ancestor);
while(el!=document&&el!=null){
if(el==an)return true;
el=el.parentNode;
}
return false;
}
var addListener=function(){
if(window.addEventListener){
return function(el,type,fn){
el.addEventListener(type,fn,false);
};
}
else if(window.attachEvent){
return function(el,type,fn){
var f=function(){
fn.call(el,window.event);
};
if(!el._listeners)el._listeners={};
if(!el._listeners[type])el._listeners[type]={};
el._listeners[type][fn]=f;
el.attachEvent('on'+type,f);
};
}
else{
return function(el,type,fn){
el['on'+type]=fn;
}
}
}();
var removeListener=function(el,type,func){
if(el.removeEventListener){
el.removeEventListener(type,func,false);
}else if(el.detachEvent&&el._listeners
&&el._listeners[type]&&el._listeners[type][func]){
el.detachEvent('on'+type,el._listeners[type][func]);
}
};
function ref(instance_or_id){
return(typeof(instance_or_id)=="string")?document.getElementById(instance_or_id):instance_or_id;
}

function stopPropagation(e)
{
if(!e)var e=window.event;
e.cancelBubble=true;
if(e.stopPropagation)e.stopPropagation();
}

function openPopup(url,name,height,width,opt_show_scrollbars){
var scrollbar_param=opt_show_scrollbars?",scrollbars=1":"";
var newwindow=window.open(url,name,'height='+height+',width='+width+scrollbar_param);
if(newwindow&&!newwindow.opener){newwindow.opener=window;}
if(window.focus){newwindow.focus()}
return false;
}

function openLoginBox(event,setPositionManually){
if(event){
stopPropagation(event);
}
var loginBox=document.getElementById('loginBoxZ');
if(!setPositionManually){
loginBox.style.left='auto';
loginBox.style.right='0px';
loginBox.style.top='33px';
}
toggleDisplay('loginBoxZ');
_hbLink('LogIn','UtilityLinks');

return false;
}


function toggleDisplay(divName) {
 var tempDiv = ref(divName);
 if (!tempDiv) {
 return false;
 }
 if ((tempDiv.style.display == "block") || (tempDiv.style.display == "" && tempDiv.className.indexOf("hid") == 0)) {
 tempDiv.style.display = "none";
 return false;
 } else if ((tempDiv.style.display == "none") || (tempDiv.className.indexOf("hid") != 0)) {
 tempDiv.style.display = "block";
 return true;
 }
}

function _hbLink (a,b) { return false; }

function closeLoginPicker(){
var loginBox=_gel('loginBoxZ');
if(loginBox){
if(loginBox.style.display!='none')
loginBox.style.display='none';
}
}
addListener(document,'click',function(e){
var element=e.target||e.srcElement;
if(!hasAncestor(element,'loginBoxZ')&&element.className.indexOf('loginBoxZ')==-1){
closeLoginPicker();
}
});
function OpenWindow(sUrl, sWinName, dWidth, dHeight, bShowScroll, winResize)
{   	   
   var winl = (screen.width - dWidth) / 2;
   var wint = (screen.height - dHeight) / 2;
   var winprops = 'height=' + dHeight + ',width=' + dWidth + ',top=' + wint + ',left=' + winl + ',scrollbars=' + bShowScroll + ', resizable=' + winResize;
   var win = window.open(sUrl, sWinName, winprops);   
   if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
