function MM_preloadImages() {
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function toggleWebinars()
{
    var div = document.getElementById('moreWebinars');
    var a = document.getElementById('aToggleWebinars');
    if(div.style.display == 'none'){
        div.style.display = 'block';
        a.innerHTML = 'Hide webinars';
        return false;
    } else {
        div.style.display = 'none';
        a.innerHTML = 'Show all webinars';
        return false;
    }
}

function togglePodcasts()
{
    var div = document.getElementById('morePodcasts');
    var a = document.getElementById('aTogglePodcasts');
    if(div.style.display == 'none'){
        div.style.display = 'block';
        a.innerHTML = 'Hide podcasts';
        return false;
    } else {
        div.style.display = 'none';
        a.innerHTML = 'Show all podcasts';
        return false;
    }
}

function toggleDiv(whichDiv,anchorText)
{
    var div = document.getElementById(whichDiv);
    var a = document.getElementById(anchorText);
    if(div.style.display == 'none'){
        div.style.display = 'block';
        a.innerHTML = 'Hide';
        return true;
    } else {
        div.style.display = 'none';
        a.innerHTML = 'Show';
        return true;
    }
}

function windowFrame(windowName,frameWidth,frameHeight,url) {
    var w = frameWidth;
    var h = frameHeight;
    var winl = (screen.width-w)/2;
    var wint = (screen.height-h)/2;
    if (winl < 0) winl = 0;
    if (wint < 0) wint = 0;
    var windowprops = "height=" + h + ",width=" + w + ",top=" + wint + ",left=" + winl + ",location=no," + "scrollbars=yes,menubars=no,toolbars=no,resizable=yes,status=no";
    fw=window.open(url + "&name=" + windowName ,'',windowprops);     
    fw.focus();
}

function windowFrameWithoutName(frameWidth,frameHeight,url) {
    var w = frameWidth;
    var h = frameHeight;
    var winl = (screen.width-w)/2;
    var wint = (screen.height-h)/2;
    if (winl < 0) winl = 0;
    if (wint < 0) wint = 0;
    var windowprops = "height=" + h + ",width=" + w + ",top=" + wint + ",left=" + winl + ",location=no," + "scrollbars=yes,menubars=no,toolbars=no,resizable=yes,status=no";
    fw=window.open(url,'',windowprops);     
    fw.focus();
}

function windowFrameWithBrowserControls(windowName,frameWidth,frameHeight,url) {
  fw=window.open(url + "&name=" + windowName, windowName,"status=0,toolbar=0,menubar=1,scrollbars=1,resizable=1,location=0,directories=0,left=0,top=0,width=" + frameWidth + ",height=" + frameHeight);     
  fw.focus();
}

function windowReference(windowName,url) {
   fw=window.open(url + "&name=" + windowName , windowName,"toolbar=1,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=yes,left=0,top=0,width=850,height=600");     
   fw.moveTo((screen.Width-780)/2,(screen.Height-500)/2 );
   fw.focus();
}

function windowScrollable(windowName,frameWidth,frameHeight,url, centered){
  fw=window.open(url, windowName,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=no,left=0,top=0,width=" + frameWidth + ",height=" + frameHeight);     
  if(centered==true){
    fw.moveTo((screen.Width-780)/2,(screen.Height-500)/2 );
  }
  fw.focus();
}

function windowNonResizable(windowName,frameWidth,frameHeight,url, centered){
  fw=window.open(url + "&name=" + windowName, windowName,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=no,left=0,top=0,width=" + frameWidth + ",height=" + frameHeight);     
  if(centered==true){
    fw.moveTo((screen.Width-frameWidth)/2,(screen.Height-frameHeight)/2 );
  }
  fw.focus();
}

function resizeToHTML(){
  alert(document.getElementById('table').offsetHeight);
}

function switchMenu(obj, switcher) {
    var el = document.getElementById(obj);
    var sw = document.getElementById(switcher);
    
    if ( el.style.display != 'none' ) {
        el.style.display = 'none';
        sw.innerHTML = 'Show';
    }
    else {
        el.style.display = '';
        sw.innerHTML = 'Hide';
    }
}

function closeAndReloadParent(parentURL) {
  if ( top.opener != null && top.opener.closed == false ) {
    top.opener.location.href = parentURL;    
    top.opener.focus();
  } else {
    newwin = window.open(parentURL);
    newwin.focus();
  }
  window.close();
}

function reloadParentOpener(parentURL) {  
  if ( top.opener != null && top.opener.closed == false ) { 
    top.opener.location.href = parentURL;        
  } else {
    newwin = window.open(parentURL);
  }
}

function reloadParent(parentURL) {  
    parent.location.href = parentURL;        
}

function closeAndRedirectParent(redirectURL) {
  if ( top.opener != null && top.opener.closed == false ) {
    top.opener.location.href = redirectURL;    
    top.opener.focus();
  } else {
    newwin = window.open(redirectURL);
    newwin.focus();
  }
  window.close();
}

