
function showSubMenu (xa, xb, xc) {
    try {
        if (a.href.indexOf(xa) != -1) {
            var dobj = document.getElementById(xb);
            if (dobj.tagName == "DIV") {
               dobj.className= xc;
            } 
        }	
    }
    catch (e) {
     //   alert(e)
    }
}

for ( i = 0; i < document.links.length; i += 1) {
     
	var a = document.links[i];
    var wloc = new String(window.location.toString())

   
    wloc = ((wloc.indexOf("?") != -1) && (a.href.indexOf("?") == -1) ? wloc.substring(0,wloc.indexOf("?")) : wloc);
    
	if ((a.href == wloc) && (a.id.substring(0,5) == "rnav_")) {
		a.setAttribute("id","rcurrent")
	}
	
    if ((a.id.substring(0,4) == "nav_") || (a.id.substring(0,5) == "rnav_"))  {
    
        // straight_sunrooms_patio_rooms menu group
        wloc=wloc.replace( "aluminum_sunroom_easy_solid_straight",  "straight_sunrooms_patio_rooms" );
        wloc=wloc.replace( "aluminum_sunroom_easy_glass_straight",  "straight_sunrooms_patio_rooms" );
        wloc=wloc.replace( "wood_sunroom_elegant_straight",  "straight_sunrooms_patio_rooms" );
        wloc=wloc.replace( "vinyl_sunroom_ultra_solid_straight",  "straight_sunrooms_patio_rooms" );
        wloc=wloc.replace( "vinyl_sunroom_ultra_glass_straight",  "straight_sunrooms_patio_rooms" );
      
        // curved_sunrooms_solariums menu group
        wloc=wloc.replace( "aluminum_sunroom_easy_curved",  "curved_sunrooms_solariums" );
        wloc=wloc.replace( "wood_sunroom_elegant_curved",  "curved_sunrooms_solariums" );
        
        // cathedral_sunrooms_patio_enclosures menu group
        wloc=wloc.replace( "aluminum_sunroom_easy_solid_cathedral",  "cathedral_sunrooms_patio_enclosures" );
        wloc=wloc.replace( "aluminum_sunroom_easy_glass_cathedral",  "cathedral_sunrooms_patio_enclosures" );
        wloc=wloc.replace( "wood_sunroom_elegant_cathedral",  "cathedral_sunrooms_patio_enclosures" );
        wloc=wloc.replace( "vinyl_sunroom_ultra_solid_cathedral",  "cathedral_sunrooms_patio_enclosures" );
        wloc=wloc.replace( "vinyl_sunroom_ultra_glass_cathedral",  "cathedral_sunrooms_patio_enclosures" );
        
        // conservatory_sunrooms menu group
        wloc=wloc.replace("aluminum_conservatory_easy_victorian", "conservatories");
        wloc=wloc.replace("aluminum_conservatory_easy_georgian", "conservatories");
        wloc=wloc.replace("wood_conservatory_elegant_victorian", "conservatories");
        wloc=wloc.replace("wood_conservatory_elegant_georgian", "conservatories");
        wloc=wloc.replace("vinyl_conservatory_ultra_victorian", "conservatories");
        wloc=wloc.replace("vinyl_conservatory_ultra_georgian", "conservatories");
        
        // why a sunroom menu group
        wloc=wloc.replace( "why_a_sunroom",  "why_a_sunroom" );
        wloc=wloc.replace( "sunroom-plans",  "why_a_sunroom" );
        wloc=wloc.replace( "sunroom_in_123",  "why_a_sunroom" );
        wloc=wloc.replace( "sunroom_vs_ordinary_construction",  "why_a_sunroom" );
        wloc=wloc.replace( "testimonials",  "why_a_sunroom" );
        wloc=wloc.replace( "accreditations",  "why_a_sunroom" );
        wloc=wloc.replace( "energy_star",  "why_a_sunroom" );
        
        // glass menu group
        wloc=wloc.replace( "how_conservaglass_works",  "Default" );
        wloc=wloc.replace( "sunroom_glass_features",  "Default" );
        wloc=wloc.replace( "comparisons",  "Default" );
        
        // windows why windows menu group
        wloc=wloc.replace( "19_more_reasons_for_our_windows",  "why_our_windows" );
        wloc=wloc.replace( "windows_warranty",  "why_our_windows" );
        wloc=wloc.replace( "windows_better_price",  "why_our_windows" );
        wloc=wloc.replace( "reduce_energy_costs",  "why_our_windows" );
        wloc=wloc.replace( "window_safety_security",  "why_our_windows" );
                
        // windows glass menu group
        wloc=wloc.replace( "window_construction",  "glass" );
        wloc=wloc.replace( "window_efficiency",  "glass" );
        wloc=wloc.replace( "window_cert",  "glass" );
        wloc=wloc.replace( "window_features",  "glass" );
        wloc=wloc.replace( "windows_performance",  "glass" );

        
        var xi=0;
        
        for (xi=0; xi <= NPArray.length-1; xi++) {
            wloc=wloc.replace(NPArray[xi],"news_and_press");
        }
        
        xi=0;
        
        for (xi=0; xi <= JCArray.length-1; xi++) {
            wloc=wloc.replace(JCArray[xi],"jobs");
        }
        
    }
      
	if ((a.href == wloc) && (a.id.substring(0,4) == "nav_")) {
		a.setAttribute("id","current")

		showSubMenu ("straight_sunrooms_patio_rooms", "straight_showmenu", "leftmenutrick_on");
		showSubMenu ("curved_sunrooms_solariums", "curved_showmenu", "leftmenutrick_on");
		showSubMenu ("cathedral_sunrooms_patio_enclosures", "cathedral_showmenu", "leftmenutrick_on");
		showSubMenu ("conservatories","conservatory_showmenu","leftmenutrick_on");
		showSubMenu ("/Glass/Default","glass_showmenu","leftmenutrick_on");
		showSubMenu ("why_a_sunroom","whysunroom_showmenu","leftmenutrick_on");
		showSubMenu ("/Windows/glass","wglass_showmenu","leftmenutrick_on");
		showSubMenu ("/Windows/why_our_windows","wwhywindows_showmenu","leftmenutrick_on");
		
	}
	
	//Pergolas Main HighLight (alias current hlink for pergolas after normal highlight logic is complete)
    if ((a.id.substring(0,4) == "nav_") || (a.id.substring(0,5) == "rnav_"))  {	
            xi=0;
            for (xi=0; xi <= PPArray.length-1; xi++) {
                wloc=wloc.replace("/Pergolas/" + PPArray[xi],"/Pergolas/Default");
            }   
            if ((a.href == wloc) && (a.id.substring(0,4) == "nav_")) {
	            a.setAttribute("id","current")
            }             
    }	
    
	//Windows Main HighLight (alias current hlink for Windows after normal highlight logic is complete)
    if ((a.id.substring(0,4) == "nav_") || (a.id.substring(0,5) == "rnav_"))  {	
            xi=0;
            for (xi=0; xi <= WPArray.length-1; xi++) {
                wloc=wloc.replace("/Windows/" + WPArray[xi],"/Windows/Default");
            }   
            if ((a.href == wloc) && (a.id.substring(0,4) == "nav_")) {
	            a.setAttribute("id","current")
            }             
    }	
    
    //Doors Main HighLight (alias current hlink for Doors after normal highlight logic is complete)
    if ((a.id.substring(0,4) == "nav_") || (a.id.substring(0,5) == "rnav_"))  {	
            xi=0;
            for (xi=0; xi <= DPArray.length-1; xi++) {
                wloc=wloc.replace("/Doors/" + DPArray[xi],"/Doors/Default");
            }   
            if ((a.href == wloc) && (a.id.substring(0,4) == "nav_")) {
	            a.setAttribute("id","current")
            }             
    }	
}


