window.addEvent('domready', function (){

$$('div.hiddenContent').addClass('display');
$$('ul.hiddenContent').addClass('display');


    //-------------------bookmark page ------------------------//

	
	function mt_bookmark(e) {
 
	if (window.ie){
		window.external.AddFavorite(this.href, this.title);
 
	} else if (window.gecko){
		window.sidebar.addPanel(this.title, this.href,"");  
 
	} else {
		alert('your_msg_for_unsupported_browsers');
 
	}
 
	e = new Event(e);
}
	$$('a.fav').addEvent('domready', function(e) {
	
	
	var add_to_fav = $('fav');
 
	if (window.opera) add_to_fav.setProperty('rel' , 'sidebar');
	else add_to_fav.onclick = mt_bookmark.bindAsEventListener(add_to_fav);
 
});


    //------ START JS for Module 3 ------//
    var calendarToggle = $$('li.calendarAction')
    var calenderLinkToggle = $$('a.calendarToggle')

    $$('a.calendarToggle').addEvent('click', function(e) {
        e= new Event(e);

        calendarToggle.removeClass('calendarActive');

        $(this.parentNode).addClass('calendarActive');
        calenderLinkToggle.removeClass('active');
        this.addClass('active');

        var calendarActiveSize = $E('li.calendarActive ul li').getSize().size.y;
        $('calEventsNav').setStyle('height', calendarActiveSize + 20);
    });

    // close the Module 6 highlightActive

    $$('a.closeCalEvent').addEvent('click', function(e) {
        e= new Event(e);
        calendarToggle.removeClass('calendarActive');
        calenderLinkToggle.removeClass('active');
        $('calEventsNav').setStyle('height', 32);
    });
    //------ END JS for Module 3 ------//

    //------ START JS for Module 6 ------//
    var broadbandToggle = $$('li.broadbandAction')

    $$('a.broadbandToggle').addEvent('click', function(e) {
        e= new Event(e);

        broadbandToggle.removeClass('broadbandActive');

        $(this.parentNode).addClass('broadbandActive');

        var broadbandActiveSize = $E('li.broadbandActive ul li div').getSize().size.y;

        //set the height of the containing ul to push the content below down
        //plus 80 to clear the image and title
        $('broadbandActions').setStyle('height', broadbandActiveSize + 50);
    });

    // close the Module 6 highlightActive
    $$('a.closeBroadband').addEvent('click', function(e) {
        e= new Event(e);
        broadbandToggle.removeClass('broadbandActive');
        $('broadbandActions').setStyle('height', 37);
    });
    //------ END JS for Module 6 ------//

    //------ START JS for Module 7 ------//
    if (document.getElementById('highlights')) {
        var highLightToggle = $$('li.highlight')

        $$('a.highlightToggle').addEvent('click', function(e) {
            e= new Event(e);
            highLightToggle.removeClass('highlightActive');

            $(this.parentNode).addClass('highlightActive');

            //create a variable to hold the height of the li to expand
            var highlightActiveSize = $E('li.highlightActive ul li').getSize().size.y;

            //set the height of the containing ul to push the content below down
            //plus the 120 (90 for the image and 30 for the close li
            $('highlights').setStyle('height', highlightActiveSize + 120);

        });

        // close the Module 7 highlightActive
        $$('a.closeSmall').addEvent('click', function(e) {
            e= new Event(e);
            highLightToggle.removeClass('highlightActive');
            $('highlights').setStyle('height', 110);
        });
    }
    //------ END JS for Module 7 ------//

    //------ START JS for Module 8 ------//
    //returns true if the element is in the DOM
    if (document.getElementById('col_left_nav2Container')) {

        //get the higher of the nested lists and assign the highest height to the parent ul to push the content down (next div in flow)
        function get_col_left_nav2_height() {

            var col_left_nav2_Height = $E('li.nav2FlyOutActive ul').getSize().size.y;
            var col_left_nav2_Height1 = $E('li.nav2FlyOutActive ul').getSize().size.y;
            var col_left_nav2_Height2 = $E('li.nav2FlyOutActive ul li.nav2FlyOutActive2 ul li').getSize().size.y;

            if (col_left_nav2_Height1 > col_left_nav2_Height2) {
                var finalHeight = col_left_nav2_Height1;
            }

            if (col_left_nav2_Height2 > col_left_nav2_Height1) {
                var finalHeight = col_left_nav2_Height2;
            }

            $('col_left_nav2').setStyle('height', finalHeight);
        }
        get_col_left_nav2_height();
    }

    //set up the remove variable so we can de-activate the active state
    var remove = $$('li.nav2FlyOutReady')
    var remove2 = $$('li.nav2FlyOutReady2')
    $$('li.nav2FlyOutReady').addEvent('mouseenter', function(e) {
        e= new Event(e);
        //first remove the active state from previous li
        remove.removeClass('nav2FlyOutActive');
        //then we add the active state to the current li
        this.addClass('nav2FlyOutActive');
        remove2.removeClass('nav2FlyOutActive2');

        $E('li.nav2FlyOutActive ul li.nav2FlyOutReady2').addClass('nav2FlyOutActive2');
        get_col_left_nav2_height();
    });

    //set up the remove variable for the second level flyout
    var remove2 = $$('li.nav2FlyOutReady2')

    $$('li.nav2FlyOutReady2').addEvent('mouseenter', function(e) {
        e= new Event(e);
        //first remove the active state from previous li
        remove2.removeClass('nav2FlyOutActive2');
        //then we add the active state to the current li
        this.addClass('nav2FlyOutActive2');
        get_col_left_nav2_height();
    });

    //------ END JS for Module 8 ------//

    //------ START JS for Module 10 ------//
    var nav1FlyOutRemove = $$('li.nav1FlyOutReady')

    //set the toggle on the a link not on the li as we need to click another a to close
    //setting the toggle on the li will not allow us to close it!
    $$('a.nav1FlyOutToggle').addEvent('click', function(e) {
        e= new Event(e);
        nav1FlyOutRemove.removeClass('nav1FlyOutActive');
        //set the active class to the parent
        $(this.parentNode).addClass('nav1FlyOutActive');
        //find the position of the innerWrap div
        //var innerWrapPosition = $('innerWrap').getPosition().y;
        //find the position of the active li
        //var activeLiPosition = $E('li.nav1FlyOutActive').getPosition().y;
        //var flyoutPosition = activeLiPosition - innerWrapPosition;
        //set the position of the flyout

        $E('li.nav1FlyOutActive ul').setStyle('top', 0);

        var opaqueOverlayHeight = $('content').getSize().size.y;

        $('opaqueOverlay').setStyles({
            zIndex: 5,
            height: opaqueOverlayHeight
        });

    });

    // close the Module 10 nav1FlyOutActive
    $$('a.closeNav1Flyout').addEvent('click', function(e) {
        e= new Event(e);
        nav1FlyOutRemove.removeClass('nav1FlyOutActive');
        $('opaqueOverlay').setStyles({
            height: 0
        });
    });

    //------ END JS for Module 10 ------//

    // HIDDEN TOGGLES on rollover show hidden content for the current item //
    var removeHidden = $$('div.hiddenContent')
    $$('div.showHidden').addEvent('mouseenter', function(e) {
        e= new Event(e);
        removeHidden.removeClass('showHidden');
        this.getNext().addClass('showHidden');
    });

    //------ START JS for Module 11 (in brief/in detail content ------//

    $$('a.inDetail').addEvent('click', function(e) {
        e= new Event(e);
        $E('div.hiddenContent').addClass('showHidden');
        this.addClass('inDetailActive');
        $E('a.inBrief').removeClass('inBriefActive');
    });

    $$('a.inBrief').addEvent('click', function(e) {
        e= new Event(e);
        $E('div.hiddenContent').removeClass('showHidden');
        this.addClass('inBriefActive');
        $E('a.inDetail').removeClass('inDetailActive');
    });

    //------ START JS for Module 15 (show hide Graphs) ------//
    if (document.getElementById('graphs')) {

        var  graph_boxes = $$('div.graph_box');
        var  hidden_graph_boxes = $$('div.graph_box_hidden');

        $$('div.graph_box').addEvent('click', function(e) {
            e= new Event(e);

            hidden_graph_boxes.removeClass('graph_box_show');

            this.getNext().addClass('graph_box_show');


            var graphs_Height = $E('div.graph_box_show').getSize().size.y;
            $('graphs').setStyle('height', graphs_Height + 220);

            graph_boxes.addClass('unactive');
            this.removeClass('unactive');

        });

        // close the larger graph
        $$('a.close_graph').addEvent('click', function(e) {
            e= new Event(e);
            hidden_graph_boxes.removeClass('graph_box_show');
            $('graphs').removeProperty('style');
            graph_boxes.removeClass('unactive');
        });
    }
    //------ END JS for Module 15 ------//

    //------ START JS for Module 26a ------//
    var toggleList = $$('ul.hiddenContent')

    $$('a.toggleList').addEvent('mouseenter', function(e) {
        e= new Event(e);

        toggleList.removeClass('showHidden');
        this.getNext().addClass('showHidden');

    });
    //------ END JS for Module 26a ------//
    
			//------ Start JS for  Resourses link page	------//
	
		var features = new Accordion('li.atStart', 'ol.atStart', {
		opacity: false,
		onActive: function(toggler, element){
			toggler.setStyle('color', '#000');
			element.addClass('visible');
			element.removeClass('hidden');
			
		},
	 
		onBackground: function(toggler, element){
			toggler.setStyle('color', '#222');
			element.addClass('hidden');
			element.removeClass('visible');
			element.removeClass('relative');
			
		}
	}, $('features'));
	//------ END JS for  Resourses link page	------//
	
	





});


//------ page tools script -----//
function mailpage()
{
  mail_str = "mailto:?subject= " + document.title;
  mail_str += "&body= I recommend -- " + document.title;
  mail_str += " " + location.href;
  location.href = mail_str;
}


function dcsMultiTrack(){
    for (var i=0;i<arguments.length;i++){

        if (arguments[i].indexOf('WT.')==0){
            WT[arguments[i].substring(3)]=arguments[i+1];
            i++;
        }
        if (arguments[i].indexOf('DCS.')==0){
            DCS[arguments[i].substring(4)]=arguments[i+1];
            i++;
        }
        if (arguments[i].indexOf('DCSext.')==0){
            DCSext[arguments[i].substring(7)]=arguments[i+1];
            i++;
        }
    }
    var dCurrent=new Date();
    DCS.dcsdat=dCurrent.getTime();
    dcsTag();
}
// End dcsMultiTrack Function

function trackEvent(url,title,group,subgroup){
    //var url="/wp/page.html";
    //var title="our page";
    //var group="broadband";
    //var subgroup="test sub";
    var track_url = url;
    var track_title = "WP - "+title;
    var track_group = "WP - "+group;
    var track_subgroup = "WP - "+subgroup;

    dcsMultiTrack("DCS.dcsuri",track_url,"WT.ti",track_title,"WT.cg_n",track_group,"WT.cg_s",track_subgroup);
    //alert("URL: "+track_url+"\n\n TITLE: "+track_title+"\n\n GROUP: "+track_group+"\n\n SUBGROUP: "+track_subgroup);
}

function trackEvent2(url,title,group,subgroup){
    //var url="/wp/page.html";
    //var title="our page";
    //var group="broadband";
    //var subgroup="test sub";
    var track_url = url;
    var track_title = "WP - "+title+ document.title;
    var track_group = "WP - "+group;
    var track_subgroup = "WP - "+subgroup;
	

    dcsMultiTrack("DCS.dcsuri",track_url,"WT.ti",track_title,"WT.cg_n",track_group,"WT.cg_s",track_subgroup);
    //alert("URL: "+track_url+"\n\n TITLE: "+track_title+"\n\n GROUP: "+track_group+"\n\n SUBGROUP: "+track_subgroup);
}