Cufon.replace('#GotRoofHover',{hover: true, fontFamily: 'Vitesse Medium'});
Cufon.replace('#navigation li',{hover: true, fontFamily: 'Vitesse Medium'});
Cufon.replace('.jqmHeader h3',{hover: true, fontFamily: 'Vitesse Medium'});
Cufon.replace('#BodyText .energygeneration h3',{hover: true, fontFamily: 'Vitesse Medium'});
Cufon.replace('#BodyText h2',{hover: true, fontFamily: 'Vitesse Medium'});
Cufon.replace('#BodyText h4',{hover: true, fontFamily: 'Vitesse Medium'});
Cufon.replace('.homebar h3',{hover: true, fontFamily: 'Vitesse Medium'});
Cufon.replace('.intromessage h2',{hover: true, fontFamily: 'Vitesse Medium'});
Cufon.replace('.intromessageright h2',{hover: true, fontFamily: 'Vitesse Medium'});
Cufon.replace('#HeaderRight h3',{hover: true, fontFamily: 'Vitesse Medium'});
Cufon.replace('#Copyright h5 a',{hover: true, fontFamily: 'Vitesse Medium'});
Cufon.replace('.financialtoolschartfull h3',{hover: true, fontFamily: 'Vitesse Medium'});
Cufon.replace('#login_container h4',{hover: true, fontFamily: 'Vitesse Medium'});
Cufon.replace('.wuw_buttons a',{hover:true, fontFamily: 'Vitesse Medium'}); 
Cufon.replace('.project_types a',{hover:true, fontFamily: 'Vitesse Medium'}); 
Cufon.replace('#vid_title',{hover:true, fontFamily: 'Vitesse Medium'}); 
Cufon.replace('#sidebar_vid_title',{hover:true, fontFamily: 'Vitesse Medium'}); 
Cufon.replace('h3.careers_headline',{fontFamily: 'Vitesse Medium'}); 
Cufon.replace('#contact_form label',{fontFamily: 'Vitesse Medium'}); 
Cufon.replace('.dsn_form h3',{hover: true, fontFamily: 'Vitesse Medium'});

var image1 = $('<img />').attr('src', '/img/orange_transparent.png');



function initCycle(myid)
{
	$(myid).cycle(0);
	$(myid).cycle({ 
		startingSlide: 0,
		fx: 'fade',
		speed: 1000,
		timeout: 6000,
		nowrap: true
    });
}


function onBefore(currSlideElement, nextSlideElement, options, forwardFlag) {
      var $slides = $(this).parent().children();
	  var index = $slides.index(this);
	  index++;
	  initCycle('#IntroMessageQuote'+index);
}


		
	// Login page - simulated drop-down 
	
$(document).ready(function() {
	
	$('ul.report_list li:nth-child(3n)').css('margin-right', '0px'); 
	$('ul.report_list li:nth-child(3n)').after('<div class="ClearAll"></div>'); 
      
	$('.login_col2_wrapper').hide();
	
	createDropDown();
        
        $(".dropdown dt a").click(function() {
            $(".dropdown dd ul").toggle();
        });

        $(document).bind('click', function(e) {
            var $clicked = $(e.target);
            if (! $clicked.parents().hasClass("dropdown"))
                $(".dropdown dd ul").hide();
        });
                    
        $(".dropdown dd ul li a").click(function() {
            var text = $(this).html();
            $(".dropdown dt a").html(text);
            $(".dropdown dd ul").hide();
			$('.login_col2_wrapper').fadeIn("fast");
            
            var source = $("#login_type");
            source.val($(this).find("span.value").html());
        });
			

    function createDropDown(){
        var source = $("#login_type");
        var selected = source.find("option[selected]");
        var options = $("option", source);
        
        $("#fake-dropdown").append('<dl id="target" class="dropdown"></dl>')
        $("#target").append('<dt><a href="#">Select One<span class="value">' + selected.val() + 
            '</span></a></dt>')
        $("#target").append('<dd><ul></ul></dd>')
		
		$('#target dd ul').append('<li><a href="#">Host Portal</a></li><li><a href="#">Investor Portal</a></li>')
		
     
    	}

	// END Login page	
	
	// SEIC page - tabs
	 $(".tabcontent").css('left', '-10000px'); 
		$("ul#tabs li:first").addClass("active").show(); 
		$(".tabcontent:first").css('left', '0px'); //Show first tab content

		//On Click Event
		$("ul#tabs li").click(function() {

			$(".tabcontent").css('left', '-10000px');  //Hide all tab content
			$("ul#tabs li").removeClass("active"); //Remove any "active" class
			$(this).addClass("active"); //Add "active" class to selected tab

			var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
			$(activeTab).css('left', '0px'); //show the active ID content
			
			return false;
		});
	
	
	$("#nav_projects").mouseenter(function(){
	      $("#GotRoofHover").fadeIn('fast');
	    }).mouseleave(function(){
	      $("#GotRoofHover").fadeOut('fast');
	    });
	
	$(".deactivated").mouseenter(function(){
	      $(this).children('.comingsoon').fadeIn();
	    }).mouseleave(function(){
	      $(this).children('.comingsoon').fadeOut();
	    });
	
	initCycle(".intromessagequote");


    $('#HomeSlideshow').cycle({ 
		fx: 'fade',
		speed: 1000,
		timeout: 12000,
		pager:  '#SliderNavTwo',
		pagerAnchorBuilder: function(idx, slide) { 
		        return '<a href="#"></a>'; 
		    },
		before: onBefore
    });

    $('#goto1').click(function() { 
        $('#HomeSlideshow').cycle(0); 
		initCycle('#IntroMessageQuote1');
        return false; 
    });
    $('#goto2').click(function() { 
        $('#HomeSlideshow').cycle(1); 
		
		initCycle('#IntroMessageQuote2');
        return false; 
    });
    $('#goto3').click(function() { 
        $('#HomeSlideshow').cycle(2);
		initCycle('#IntroMessageQuote3');
        return false; 
    });
    $('#goto4').click(function() { 
        $('#HomeSlideshow').cycle(3); 
		initCycle('#IntroMessageQuote4');
        return false; 
    });
    $('#goto5').click(function() { 
        $('#HomeSlideshow').cycle(4); 
		initCycle('#IntroMessageQuote5');
        return false; 
    });

	$('#SunriseDatabaseLink').click(function() { 
        $('#SunriseDatabaseFull').fadeIn(); 
    });

	$('#SunriseDatabaseLinkWhole').click(function() { 
        $('#SunriseDatabaseFull').fadeIn(); 
    });

	$('#RadianceDialLink').click(function() { 
        $('#RadianceDialFull').fadeIn(); 
    });

	$('#RadianceDialLinkWhole').click(function() { 
        $('#RadianceDialFull').fadeIn(); 
    });

	$('#AzimuthPanelLink').click(function() { 
        $('#AzimuthPanelFull').fadeIn(); 
    });

	$('#AzimuthPanelLinkWhole').click(function() { 
        $('#AzimuthPanelFull').fadeIn(); 
    });

	$('#SOLIndexLink').click(function() { 
        $('#SOLIndexFull').fadeIn(); 
    });

	$('#SOLIndexLinkWhole').click(function() { 
        $('#SOLIndexFull').fadeIn(); 
    });

	$('.closebutton').click(function() { 
        $('.financialtoolschartfull').fadeOut(); 
    });
	
	// MOCK DROPDOWN FOR PRESS RELEASES
	
	$('ul.press-year li a.current').toggle(function() { 
		$('ul.press-year li ul').show(); 
	}, function() { 
		$('ul.press-year li ul').hide(); 
		}); 
	
		$('body').click(function() {
			if ( $('ul.press-year li ul').is(':visible')){
				$('ul.press-year li ul').hide(); 	
			}
		 });

		$('ul.press-year li a.current').click(function(event){
		     event.stopPropagation();
			$('ul.press-year li ul').show(); 
		 });
		
	// MOCK DROPDOWN FOR WATCH US WORK MODAL
	
	$('a.active_loc').click(function(event){
	     event.stopPropagation();
		$('ul.curr_loc').toggle(); 
	 });
		
	
	$('.jqmContent').click(function(){
		if ( $('ul.curr_loc').is(':visible')){
	     	$('ul.curr_loc').hide(); 
		}
	 });
	
	$('ul.curr_loc li a').click(function() { 
		$('ul.curr_loc').find('li.active').removeClass('active');
		$(this).parent('li').addClass('active'); 
		var thisa = $(this).text(); 
		$('a.active_loc').text(thisa); 
		$('ul.curr_loc').hide(); 
	}); 

	$('ul.curr_loc li a.de').click(function() { 
		$('ul.wuw_buttons li').hide(); 
		$('ul.wuw_buttons li.Delaware').show(); 
	}); 
	
	$('ul.curr_loc li a.dc').click(function() { 
		$('ul.wuw_buttons li').hide(); 
		$('ul.wuw_buttons li.District').show(); 
	});
	
	$('ul.curr_loc li a.md').click(function() { 
		$('ul.wuw_buttons li').hide(); 
		$('ul.wuw_buttons li.Maryland').show(); 
	});
	
	$('ul.curr_loc li a.nj').click(function() { 
		$('ul.wuw_buttons li').hide(); 
		$('ul.wuw_buttons li.New').show(); 
	});
	
	$('ul.curr_loc li a.pa').click(function() { 
		$('ul.wuw_buttons li').hide(); 
		$('ul.wuw_buttons li.Pennsylvania').show(); 
	});
	
	$('ul.curr_loc li a.all').click(function() { 
		$('ul.wuw_buttons li').show(); 
	});
	
	// SM
	
	$('#BodyText .chartpanel h3').append('<span class="sm">&nbsp;sm</span>'); 
	
	//Firefox glitch in UL 
	
	$('#BodyText ul.dsun-press li:last').css('border', '0px');
	$('#BodyText ul.events li:last').css('border', '0px');
	
	//sidebar modal 
	
	$('#sidebar_video_modal').jqm({toTop: true, trigger: '#sidebar-vid-trigger', overlay: 80}); 
	
	$('#SidebarVideoPrezi').jqm({toTop: true, trigger: '#PreziTrigger', overlay: 80}); 
	
	// careers page 
	
	$('div.careers_slideshow').cycle({ 
		timeout: 6000
	}); 
	
	$('ul.careers_list li:nth-child(2n)').addClass('careers_alt'); 
	$('ul.careers_list_sub li:nth-child(2n)').removeClass('careers_alt'); 
	$('ul.careers_list_sub li:nth-child(3n)').css('margin-right', '40px'); 
	
	// new contact page 

	var newstr; 
	$('form.jotform-form select#input_7').change(function(){ 
		 	newstr = $(this).val(); 
			if(newstr == 'General') { 
				$('li.form_investor').fadeOut(500); 
				$('li.form_host').fadeOut(500); 
				$('li.form_media').fadeOut(500); 
				$('div.form_hr').fadeOut(500); 
				$('li#id_8').fadeIn(500); 
				$('li#id_9').fadeIn(500); 
				$('button#input_2').fadeIn(500); 
			}  
			if(newstr == 'Investor') { 
				$('li.form_investor').fadeIn(500); 
				$('li.form_host').hide(); 
				$('li.form_media').hide();
				$('div.form_hr').fadeIn(500); 
				$('li#id_8').fadeIn(500); 
				$('li#id_9').fadeIn(500); 
				$('button#input_2').fadeIn(500);
			}  
			if(newstr == 'Host') { 
				$('li.form_investor').hide(); 
				$('li.form_host').fadeIn(500); 
				$('li.form_media').hide();
				$('div.form_hr').fadeIn(500); 
				$('li#id_8').fadeIn(500); 
				$('li#id_9').fadeIn(500); 
				$('button#input_2').fadeIn(500);
			} 
			if(newstr == 'Media') { 
				$('li.form_investor').hide(); 
				$('li.form_host').hide(); 
				$('li.form_media').fadeIn(500); 
				$('div.form_hr').fadeIn(500); 
				$('#month_17').val('MM'); 
				$('#day_17').val('DD'); 
				$('#year_17').val('YYYY');
				$('li#id_8').fadeIn(500); 
				$('li#id_9').fadeIn(500); 
				$('button#input_2').fadeIn(500);
			}
			if(newstr == 'SelectOne') { 
				$('li.form_investor').fadeOut(500); 
				$('li.form_host').fadeOut(500); 
				$('li.form_media').fadeOut(500); 
				$('div.form_hr').fadeOut(500); 
				$('li#id_8').fadeOut(500); 
				$('li#id_9').fadeOut(500); 
				$('button#input_2').fadeOut(500);
			}
	});
	
	$('form#11644005491').validate(); 
	
	$('#month_17').focus(function() { 
		if($(this).val() == 'MM') {
			$(this).val(''); 
			$('#day_17').val(''); 
			$('#year_17').val(''); 
		} 
	}); 
	$('#day_17').focus(function() { 
		if($(this).val() == 'DD') {
			$(this).val(''); 
			$('#month_17').val(''); 
			$('#year_17').val(''); 
		}
	});
	$('#year_17').focus(function() { 
		if($(this).val() == 'YYYY') {
			$(this).val(''); 
			$('#day_17').val(''); 
			$('#month_17').val(''); 
		}
	});
	
	// new portal 
	
	 $(".portal_tabcontent").css('left', '-10000px'); 
		$("ul#portal_tabs li:first").addClass("active").show(); 
		$(".portal_tabcontent:first").css('left', '0px'); //Show first tab content

		//On Click Event
		$("ul#portal_tabs li").click(function() {

			$(".portal_tabcontent").css('left', '-10000px');  //Hide all tab content
			$("ul#portal_tabs li").removeClass("active"); //Remove any "active" class
			$(this).addClass("active"); //Add "active" class to selected tab

			var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
			$(activeTab).css('left', '0px'); //show the active ID content
			$(activeTab).children().hide(); 
			$(activeTab).children().fadeIn(100); 
			
			return false;
		});
		
	$('#portal_3 #FinancialToolsChart a').hover(function() { 
		$(this).parent().children('p').css('color', '#ffffff'); 
		$(this).parent().children('h3').css('color', '#ffffff'); 
	}, function() { 
		$(this).parent().children('p').css('color', '#333333'); 
		$(this).parent().children('h3').css('color', '#333333'); 
	}); 
	
	// CAPACITY UNDER DEVELOPMENT - PERCENTAGE BAR
	
	$('p.usage_amount span').each(function() { 
		var usageval = parseInt($(this).text()); 
		var usagetotal = parseInt($('p.usage_max').text()); 
		var usagepct = parseInt((usageval/usagetotal)*100); 
		$(this).parent('p').parent('.slideshowinfo').children('.percent_under_development').children('div.graph_bar').css('width', usagepct + '%'); 
	}); 
	
	// VIDEO PLAYER
	
	if($('#sidebar_player').length) { 
		var stopplayer3 = $('div.jqmOverlay'); 
		$(stopplayer3).click(function() { 
		    $f("sidebar_player").pause(); 
		});	
	}
	
	if($('#player').length) { 
		$('#ButtonUnderDevelopment, #UnderConstructionLink').click(function() { 
			$f('player').pause(); 
		});
	}
	
	if($('#PreziTrigger').length) { 
		$('#').click(function() { 
			$f('player').pause(); 
		});
	}
	
	 
	
	// SIDEBAR BUTTON HOVERS
	
	$('div.sidebar_button').hover(function() { 
		$(this).css('opacity', '0.7'); 
	}, function() { 
		$(this).css('opacity', '1'); 
	}); 
	
	
});

$.fn.cycle.updateActivePagerLink = function(pager, currSlideIndex) {
    $(pager).find('li').removeClass('activeLI')
        .filter('li:eq('+currSlideIndex+')').addClass('activeLI');
};

