/* CONFIG BLOCK FOR POP-UP SUPPRESSION 
  TO DISABLE POP_UPS, UNCOMMENT THE FOLLOWING TWO LINES
*/
var noArrivalPopFlag = true; // Disables entering pops.
//var noExitingPopFlag = true; // Disables exiting pops. 


/* Window onload functions go here. */
function loadEvents() {
  
  SI.ClearChildren.initialize();
  // Suppress popups when mbid exists in the 
  // query string. 
  if (queryString("mbid") == "") {
    SubscriptionPopups.arrival();
    SubscriptionPopups.exiting();
  } else {
    // Not really needed, but just in case somewhere else someone
    // tries to turn on the popups. 
    noExitingPop = noArrivalPopFlag = true;
  }
  subscriptions.assign();
  //feedmanager.assign();
  if (typeof(stylemanager) !='undefined') { stylemanager.setStyles(); }
  
}

/* Window onunload functions go here. 
 * Make sure you pass the event object (e) to the handler object's method, otherwise
 * Firefox won't see the event object. 
 */
function unloadEvents(e) {
  SubscriptionPopups.checkExiting(e); // checks changes in address
}

/* Document click functions go here. 
 * Same deal as above. Make sure to pass event object to hander object's method. 
 */
function clickEvents(e) {
  SubscriptionPopups.checkExiting(e); /* checks clicks */ 
}

/* toggle visibility of a an element. 
 * Pass in the div id and it toggles the display from visible to not visible. 
 */
function toggle( targetId ){
  if (document.getElementById){
    target = document.getElementById( targetId );
    if (target.style.display == "none"){
      target.style.display = "";
    } else {
      target.style.display = "none";
    }
  }
}


/*toggle visibility of search tab in yrail*/
function toggleSearchTab(tab_no)
{
    var sForm = document.getElementById("searchForm");
	if (tab_no == "tab_2"){
        sForm.sectionChoice.value="";
		document.getElementById("tab_2").className="selected"; 
        document.getElementById("tab_1").className="";
        document.getElementById("tab_2").innerHTML="Search Entire Site";  
        document.getElementById("tab_1").innerHTML="<a href='javascript:void(null);' onclick='toggleSearchTab( \"tab_1\");'>Search this Section</a>";  
     }
     if (tab_no == "tab_1"){
        sForm.sectionChoice.value=g_searchSection;        
     	document.getElementById("tab_1").className="selected"; 
        document.getElementById("tab_2").className="";
        document.getElementById("tab_1").innerHTML="Search this Section";  
        document.getElementById("tab_2").innerHTML="<a href='javascript:void(null);' onclick='toggleSearchTab( \"tab_2\");'>Search Entire Site</a>";  
     }
}


/* toggle visibility of a an element. Added for RSS feeds pages 
 * Pass in the div id and it toggles the display from visible to not visible. 
 */
function toggles( targetId, parentId ){
  if (document.getElementById){
    target = document.getElementById( targetId );
    parentID = document.getElementById( parentId );
    if (target.style.display == "none"){
      target.style.display = "";
       parentID.className = "collapse"
    } else {
      target.style.display = "none";
	  parentID.className = "expand"

    }
  }
}


/* toggle visibility of menu list element used in "domino browse more". 
 * Pass in the div id and it toggles the display from visible to not visible. 
 */
function togglemenu( targetId ){
  if (document.getElementById){
    target = document.getElementById( targetId );
    if (target.className == "collapsed"){
      target.className = "expand";
    } else {
      target.className = "collapsed";
    }
  }
}

/* draw copyright text in the footer */
function drawFooterCopyright(divId) {
var mydate=new Date();
var year=mydate.getYear();
if (year < 1000) year+=1900;
document.getElementById(divId).innerHTML = "Copyright &copy; "+year+" Cond&#233;Net. All rights reserved.<br/>";
}

/* Calls to event manager to attach functions to events. */
addEvent(window, "load", loadEvents);
addEvent(window, "unload", unloadEvents);

// Would like to use event manager for this, but when using onclick to pop windows,
// it will still follow the href. 
//addEvent(document, "click", clickEvents);
document.onclick=clickEvents;


