﻿function switch_style(css_title)
{
  var i, link_tag ;
  for (i = 0, link_tag = document.getElementsByTagName("link");i < link_tag.length ; i++ ) 
  {
        if ((link_tag[i].rel.indexOf("stylesheet") != -1) && link_tag[i].title) {
            link_tag[i].disabled = true;
          
            if (link_tag[i].title == css_title) {
                link_tag[i].disabled = false ;
            }
        }
        //set_cookie( style_cookie_name, css_title,
        //style_cookie_duration );
  }
}

function swapMode(newMode, showAlert)
{       
    var oldMode = getMode();
    if(oldMode != newMode)
    {
        setMode(newMode);
        
        if(showAlert)
        {
            switch(newMode)
            {
                case 'PDF':
                    //alert('Switched to PDF mode');
                    switch_style('pdf');
                    break;
                case 'EMAG':
                    //alert('Switched to eMag mode');
                    switch_style('ezine');
                    break;
            }
        }
    }
}


