
	$(function(){
		
		//START: Consumer Landing Page Marquee/Hero carousel functionality
		//-- Large Marquee
		$('#nav-hero .1').parent().attr('class','on'); //default first nav item to the "on" state
		$('.marquee-container').jCarouselLite({
			btnNext: ".next",
			btnPrev: ".prev",
			visible: 1,
			auto: 800,
    	speed: 500,
    	timeout: 8000,
    	btnGo: ["#nav-hero .1", "#nav-hero .2", "#nav-hero .3", "#nav-hero .4"],
	    beforeStart: function(a) { //remove marquee nav highlight
				var targObj = a.find(":first").attr("id");
				targObj = targObj.substring(5);
				$('#nav-hero .'+targObj).parent().removeClass('on');		
			},
			afterEnd: function(a) { //add marquee nav highlight
				var targObj = a.find(":first").attr("id");
				targObj = targObj.substring(5);
				$('#nav-hero .'+targObj).parent().attr('class', targObj+' on');
			}
		});
		
		// INITIALIZE HOMEPAGE HERO ANIMATIONS
		$(function(){ var isHome = $('#page.page-home'); if(isHome[0]){ initHero(); } });
		
		
		//START: Consumer Top Navigation (calculate fill width of last nav item)
			var containerLen = $('#nav-main').outerWidth(); //get the width of the main nav container
			var topnavLen = 0;
			$('#nav-main ul:first > li').each(function(){ //find the width of each nav item
				topnavLen = topnavLen + $(this).outerWidth(); //add each width to global varable
			});
			var getDiff = containerLen - topnavLen; //get the difference of current nav item width from the container width
			var newtopLen = ($('#nav-main ul:first > li:last-child').width() + getDiff) -1; 
			$('#nav-main ul:first > li:last-child').width(newtopLen); //re-assign the new width for the last list item
		//END: Top Navigation
		
		
		//START: Consumer Landing Marquee Navigation (calculate fill width of last nav item)
			var marqLen = $('.marquee-container').width(); //get the width of the marquee container
			var navLen = 0;
			$('#nav-hero ul li').each(function(){ //find the width of each nav item
				navLen = navLen + $(this).outerWidth(); //add each width to global varable
			});
			var liDiff = marqLen - navLen; //get the difference of current nav item width from the container width
			var newLen = ($('#nav-hero ul li:last-child').width() + liDiff) -1; //re-assign the new width for the last list item
			$('#nav-hero ul li:last-child').width(newLen).css('text-align','center'); //center the text in the new width
		//END: Marquee Navigation
		
		
		
		//START: FAQs leftnav/accordian functionality
		$('#leftnav li a').click(function(){ //capture leftnav clicks
			$('#leftnav li a').each(function(){ //remove all leftnav "on" states
				$(this).removeClass('on');
			});
			$(this).addClass('on'); //add leftnav "on" state to current clicked element
			var targFAQ = $(this).parent().attr('class'); //get the class name of parent <li> which will be used to bind the relationship to the "FAQ" element
			$('#faq_content').children().attr('style','display:none;'); //hide all "FAQ" elements
			$('#faq_content #category_'+targFAQ).fadeIn('slow'); //display corresponding "FAQ" element
			
		});
		
		//-- Accordian
		$('.page-faqs .item p.Q a').click(function(){
			var answerStyle = $(this).parent().next().attr('style');
			if($.browser.msie){ //IE has issues with slideUp/Down()
				if(answerStyle == undefined || answerStyle == "" || answerStyle == "DISPLAY: none"){
					$('.answer').css('display','none');
					$(this).parent().next().show();
				}
				else {
					$(this).parent().next().hide();
				}
			}
			else { //If not IE use the slideUp/Down()
				if(answerStyle == undefined || answerStyle == "" || answerStyle == "display: none;" || answerStyle == "display: none; "){
					$('.answer').css('display','none');
					$(this).parent().next().slideDown('fast');
				}
				else {
					$(this).parent().next().slideUp('fast');
				}
			}
			if($(this).attr('class') == 'on') { 
				$(this).removeClass('on');
			}
			else { 
				$('.item p:first-child a').removeClass('on');
				$(this).addClass('on'); 
			}
		});
		
		//END: FAQs leftnav/accordian
		
	
		//since IE lacks support for the css psuedo selectors :first-child(ie6) and :last-child(all)
		//we will use jquery to add a classname of first/last-child to needed elements
		$('ul.nLine li:first-child').addClass('first-child');
		$('#nav-main ul li:first-child').addClass('first-child');
		$('#nav-main ul li:last-child').addClass('last-child');
		$('.top #nav-hero ul li:first-child').addClass('first-child');
		$('.btnType1 span:first-child').addClass('first-child');
		$('.btnType1 span:last-child').addClass('last-child');
		$('.btnType1.gray span:first-child').addClass('first-child');
		$('.btnType1.gray span:last-child').addClass('last-child');
		$('.btnType2 span:first-child').addClass('first-child');
		$('.btnType2 span:last-child').addClass('last-child');
		$('.btnType2.gray span:first-child').addClass('first-child');
		$('.btnType2.gray span:last-child').addClass('last-child');
		
		
	
		//remove right margin from right-most element
		$('#footer #footer_pods .footer_pod:last').css('margin-right','0px');
		
		//remove right border from righ-most element
		$(', #main #tabpage_compare #tabpage_compare_c3').css('border-right','0');
		
		//remove left padding from left-most element
		$('#footer #footer_pods .footer_pod ul li:first').css('padding-left','0');
		
		//hover state for tabpage columns
		$('#main #tabpage_compare_basic, #main #tabpage_compare_power150, #main #tabpage_compare_power200').hover(
			function(){
				$(this).removeClass('tabpage_column_off');
				$(this).siblings('.tabpage_compare_col').each(function(){
					if($(this).attr('id') != 'tabpage_compare_c0'){
						$(this).removeClass('tabpage_column_on').addClass('tabpage_column_off'); 
					}
				});
				$(this).addClass('tabpage_column_on');
			},
			function(){$(this).removeClass('tabpage_column_on').addClass('tabpage_column_off')}
		)
		
		//P&P - compare plans tabs behavior
		$('#main #tabs li a').live('click', function(){
			if($(this).attr('class') != 'on'){
				if($(this).attr('id') != 'tab_terms'){
					$('#main #tabs li a').removeClass('on');				
					$(this).addClass('on');
					var thisId = $(this).attr('id')
					var thisPage = thisId.substring(thisId.indexOf('_')+1);
					$('#main .tabpage').css('display','none');
					$('#main #tabpage_'+thisPage).css('display','block');
				}else{ buildTermsAndConditions(); }
			}
		});
		
		//P&P detail page - plans links behavior
		$('#main .tabpage .other_plans ul li a').click(function(){
				var thisId = $(this).attr('id')
				var thisPage = thisId.substring(thisId.indexOf('_')+1);
				$('#main #tabs li a').removeClass('on');				
				$('#main #tabs li a#tab_'+thisPage).addClass('on');
				$('#main .tabpage').css('display','none');
				$('#main #tabpage_'+thisPage).css('display','block');
		});
	
		// P&P SELECT THIS PLAN TOOLTIP
			var isPandP = $('#tabpage_compare');
			if(isPandP[0]){
			
				$('a.btnSelectPlan').bind('click',function(){ 
					$('.msgbox-on').fadeOut(200).removeClass('msgbox-on');
					$(this).parent().next().fadeIn(300).addClass('msgbox-on'); 
					$(this).parent().parent().parent().addClass('tabpage_column_on');
				});
			
				$('a.btnTooltip').live('click',function(){ 
					$('.msgbox-on').fadeOut(200).removeClass('msgbox-on');
					$(this).parent().next().fadeIn(300).addClass('msgbox-on'); 
				});
				
				$('a.closeTooltip').live('click',function(){ 
					$(this).parent().hide().removeClass('msgbox-on');; 
				});
				
				$('.tabpage_compare_col').bind('click',function(){
					$('.msgbox-on').hide().removeClass('msgbox-on');
					$('a.btnSelectPlan', this).parent().next().show().addClass('msgbox-on'); 
					$(this).addClass('tabpage_column_on');
				});
				
			}
		
		
		// DISPLAY ON-STATE FOR APPROPRIATE MAIN NAV ELEMENT
		$('#nav-main li').each(function(){
			getHref = $('a',this).attr('href');
			getUrl = "/"+ location.pathname.split('/').pop();
			if(getHref == getUrl){ $(this).addClass('on'); }
		});
		
		
		// RECOVERY ELIGIBLE OVERLAY BEHAVIORS
		
			var checkIfOverlay = $('#recoveryOverlayScreens');
			if(checkIfOverlay[0]){ 
				
				// REMOVE HEADER AND FOOTER
					$('#header,#footer').remove(); 
					
				// RESIZE PARENT CONTAINER APPROPRIATELY
					var iFrameContainer = $('#modal_content', parent.document.body);
					var newHeight = ($('#recoveryOverlay div:first').height()) +110;
					$(iFrameContainer).animate({ height: newHeight }, 5, function() { });
					$('#recovery-frame',top.document).attr('height',newHeight);
					$('#recoveryOverlay div:first').fadeIn('slow');
					
			}
				
		
		// ONE OFFS
		
			$('a[href=""]').live('click',function(){ return false; });
				
	
	})
	
/*======================================================================================
	openModalVideo()
	closeModal()
---------------------------------------------------------------------------------------- 

----------------------------------------------------------------------------------------*/
function openModal(modalId){
	$('#blackout').css({'display':'block','width':$(window).width(),'height':$(document).height()}).fadeIn(500).fadeTo(100,0.6, function(){
		$(modalId).css({'display':'block','top':'120px','left':$(window).width()/2-$(modalId).width()/2}).fadeIn(500);
		if($.browser.msie && $.browser.version < 8) { //target IE 7 and earlier
			if($('#faq-location-state-dropdown').length > 0) { //if location select box exists
				$('#faq-location-state-dropdown').hide(); //hide select box
			}
		} 
	});		    			
	$('#blackout, div#modal_content .btn_modalclose').bind('click', function(){ closeModal(modalId); return false; });
	scroll2(0);
	jQuery(window).bind('resize',function(){
		$('#blackout').css({'display':'block','width':$(window).width(),'height':$(document).height()}).fadeIn(500).fadeTo(100,0.6, function(){
			$(modalId).css({'display':'block','top':'120px','left':$(window).width()/2-$(modalId).width()/2}).fadeIn(500);
		});	
	});
}

function closeModal(modalId){
	$('#blackout').remove(); 
	$(modalId).remove(); 
	jQuery(window).unbind('resize');
	if($.browser.msie && $.browser.version < 8) { //target IE 7 and earlier
		if($('#faq-location-state-dropdown').length > 0) { //if location select box exists
			$('#faq-location-state-dropdown').show(); //show select box
		}
	} 
}
	
	
//Select Options Overlay (purchase or lease)
function buildOptions(plan){
	var referObj  = plan.indexOf('detail');
	if(referObj > 0){
		plan = plan.substring(0,referObj);
	}
	var overlayHTML = $('#tabpage_'+plan).html();
	$('body').append('<div id="blackout"></div>\
		<div id="modal_content" style="display:none;">\
		<a href="javascript:;" class="btn_modalclose" title="Close"></a>\
		<div id="modal_copy">\
			<div class="tabpage clearfix" id="tabpage_'+plan+'" style="display:block;">'+overlayHTML+'</div>\
		</div>\
		</div>'
	);
	openModal('#modal_content');
}
	

//Recovery Act Eligibility Overlays
function buildRecoveryOverlay(screen){
	$('body').append('<div id="blackout"></div>\
		<div id="modal_content" style="display:none;">\
			<a href="javascript:;" class="btn_modalclose" title="Close"></a>\
					<iframe id="recovery-frame" name="recovery-frame" src="/recovery-eligible/intro.cfm" width="890" height="auto" scrolling="no">\
						Sorry, your browser doesn\'t support iframes.\
					</iframe>\
		</div>'
	);
	//After the Iframe content is loaded... set heights and call openModal()
	$('#recovery-frame').load(function(){
		var targHeight = $(this).contents().find('#modal_copy').innerHeight();
    $(this).height(targHeight);
		$('#modal_content').css('height',targHeight);
		openModal('#modal_content');
	});
}

//Address Eligibility Overlays
function buildAddressVerificationOverlay(screen){
	$('body').append('<div id="blackout"></div>\
		<div id="modal_content" style="display:none;">\
			<a href="javascript:;" class="btn_modalclose" title="Close"></a>\
					<iframe id="addressverify-frame" name="addressverify-frame" src="/address-verification/form.cfm" width="890" height="auto" scrolling="no">\
						Sorry, your browser doesn\'t support iframes.\
					</iframe>\
		</div>'
	);
	//After the Iframe content is loaded... set heights and call openModal()
	$('#addressverify-frame').load(function(){
		var targHeight = $(this).contents().find('#modal_copy').innerHeight();
    $(this).height(targHeight);
		$('#modal_content').css('height',targHeight);
		openModal('#modal_content');
	});
}

//Rebate Overlay
function buildRebate(){
	$('body').append('<div id="blackout"></div>\
		<div id="modal_content" style="display:none;">\
			<a href="javascript:;" class="btn_modalclose" title="Close"></a>\
			<iframe id="speedtest-frame" name="speedtest-frame" src="/rebate.cfm" width="890" height="470" scrolling="no">\
				Sorry, your browser doesn\'t support iframes.\
			</iframe>\
		</div>'
	);
	openModal('#modal_content');
}

//Speed Test Overlay
function buildSpeedTest(){
	if(!$('#blackout').length == 0) {
		closeModal("#modal_content");
	}
	$('body').append('<div id="blackout"></div>\
		<div id="modal_content" style="display:none;">\
			<a href="javascript:;" class="btn_modalclose" title="Close"></a>\
			<iframe id="speedtest-frame" name="speedtest-frame" src="/speedtest.cfm" width="890" height="450" scrolling="yes">\
				Sorry, your browser doesn\'t support iframes.\
			</iframe>\
		</div>'
	);
	openModal('#modal_content');
}


//Locations Overlay
function buildLocationsOverlay(id){
	$('body').append('<div id="blackout"></div>\
		<div id="modal_content" style="display:none;">\
			<a href="javascript:;" class="btn_modalclose" title="Close"></a>\
			<iframe id="locations-frame" name="locations-frame" src="/locations.cfm#'+id+'_hash" width="800" height="500" scrolling="no">\
				Sorry, your browser doesn\'t support iframes.\
			</iframe>\
		</div>'
	);
	openModal('#modal_content');
}


//Terms and Conditions Overlay
function buildTermsAndConditions(){
	var termsCopy = '\
		<script type="text/javascript"  src="http://w.sharethis.com/button/buttons.js"></script>\
		<script type="text/javascript">stLight.options({publisher:\'49aa198a-ba9e-4b18-96fb-e143bb8b27dd\'});</script>\
		<h2>Satellite Internet Plans - Terms & Conditions</h2>\
		<p>*Speed</p>\
		<p>Stated Speeds not guaranteed and Fair Access Policy applies.</p>\
		<p>The Power 200 service plan is only available through the new HughesNet satellite. Approximately 1% will not be able to receive the Power 200 plan as a result of trees or other obstacles that block the signal from the satellite to the home.</p>\
		<p>In all cases, actual upload speed will likely be lower than speed indicated during peak hours. See our speed FAQ for more information on typical speeds. Download speeds may also be temporarily slowed in cases when patterns of system usage exceed the download threshold for an extended period of time. See the HughesNet Fair Access Policy for more information.</p>\
		<p>Each email account has 2 GB of storage. The domain of your email addresses will be @Hughes.net. HughesNet email is compatible with any email client that supports POP3 and SMTP protocols.</p>\
		<p>**Equipment</p>\
		<p>Equipment provided to you may be new or refurbished as new. Any refurbished equipment will have the same warranty as new equipment.</p>\
		<p>Your service requires a 24-month service commitment and a major credit or debit card to purchase. </p>\
		<p>For more information, see <a href="http://web.hughesnet.com/sites/legal/Pages/ForYourHome.aspx" target="_blank">HughesNet Terms and Conditions</a>.</p>\
		<ul id="modal_icons"><li><a href="javascript:;" onClick="window.print();"><img src="/_assets/images/icons/icon_print.gif" alt="Print" /></a></li>\
		<li><span class="st_sharethis" displayText="ShareThis"></span></li></ul>';
	
	if(!$('#blackout').length == 0) {
		$('#modal_copy').html(termsCopy);
	}
	else {
		$('body').append('<div id="blackout"></div>\
			<div id="modal_content" style="display:none;">\
			<a href="javascript:;" class="btn_modalclose" title="Close"></a>\
			<div id="modal_copy">'+termsCopy+'</div>\
			</div>'
		);
	}
	openModal('#modal_content');
}


//===== START: Plans Page scripts ==========//

// this script checks the URL for a hash
// if found it will display the corresponding tabbed navigation item (plan detail)
if(!$('#tabpage_compare').length == 0) {
  $(window).hashchange( function(){
    buildPlanTabs();
    if(!$('#blackout').length == 0) {
			closeModal("#modal_content");
		}
  })
  $(window).hashchange();
}

function buildPlanTabs(){
	var loc = window.location;
	if(loc.hash != ""){
		switch(loc.hash){
			case '#basic':
				$("document").ready(function() {
				    setTimeout(function() {
				        $('#tab_basic').trigger('click');
				    },5);
				});
			break;
			case '#power150' :  
				$("document").ready(function() {
				    setTimeout(function() {
				        $('#tab_power150').trigger('click');
				    },5);
				});
			break;
			case '#power200':
				$("document").ready(function() {
				    setTimeout(function() {
				        $('#tab_power200').trigger('click');
				    },5);
				});
			break;
		}
	}
	else {
		$("document").ready(function() {
		    setTimeout(function() {
		        $('#tab_compare').trigger('click');
		    },5);
		});
	}
}


function CheckPlanForm(form_ref){
		
		// set the PaymentTypeID boolean to false
			var isPaymentTypeID = false; 				
		
		// set the variable to the get the value of the form's checked payment type radio button																					
			var getPaymentTypeID_val = $('#'+form_ref+' input[name="PaymentTypeID"]:checked').val();		
		
		// check the value, if it's above zero set PaymentTypeID boolean to true; else deliver validation error message
			//if(getPaymentTypeID_val>0) { isPaymentTypeID=true; } else { alert('Please choose a payment option.'); }
		
		// use the PaymentTypeID boolean to either return true or false; if true the form will be submitted
			//return(isPaymentTypeID);
			return true;
	
	}
	
//===== END: Plans Page scripts ==========//	



//===== START: FAQs Page scripts ==========//
$("document").ready(function() {
	if(!$('.page-faqs').length == 0) {
		var loc = window.location;
		//FAQs - check for url hash (bookmark)
		if(loc.hash != ""){
			switch(loc.hash){
				case '#Fair-Access-Policy': //open the fair access policy
					$('#leftnav .general a').trigger('click');
					$('#fairAccess').trigger('click');
					setTimeout(function() {
				  	var topPos = $('#fairAccess').offset().top;
						scroll2(topPos);
				  },500);
				break;
				case '#High-Speed-Availability': //open high-speed check my area
					$('#leftnav .general a').trigger('click');
					$('#highSpeedCheck').trigger('click');
					setTimeout(function() {
				  	var topPos = $('#highSpeedCheck').offset().top;
						scroll2(topPos);
				  },500);
				break;
				case '#Installation-Expectations': //open time of installation
					$('#leftnav .installation a').trigger('click');
					$('#installationExpectations').trigger('click');
					setTimeout(function() {
				  	var topPos = $('#installationExpectations').offset().top;
						scroll2(topPos);
				  },500);
				break;
				case '#Standard-Installation': //open standard installation
					$('#leftnav .installation a').trigger('click');
					$('#standardInstallation').trigger('click');
					setTimeout(function() {
				  	var topPos = $('#standardInstallation').offset().top;
						scroll2(topPos);
				  },500);
				break;
				case '#Rural-Satellite-Solution': //open standard installation
					$('#leftnav .general a').trigger('click');
					$('#ruralSolution').trigger('click');
					setTimeout(function() {
				  	var topPos = $('#ruralSolution').offset().top;
						scroll2(topPos);
				  },500);
				break;
			}
		}
		
		//FAQs Locations SelectBox onChange event
		$('#faq-location-state-dropdown').change(function(){
			var selectedTxt = $(this).find('option').filter(':selected').text();
			buildLocationsOverlay($(this).val());
		});
	}
});

//-- Open FAQ > (General > What is your upload/download allowance policy (Fair Access Policy)?)
function openFairAccessPolicy(){
	var filePath = window.location.pathname;
	var fileName = filePath.substr(filePath.lastIndexOf("/") + 1);
	if(fileName != "faqs.cfm"){
		window.location.href = "/faqs.cfm#Fair-Access-Policy";
	}
	else {
		if(!$('#blackout').length == 0) {
			closeModal("#modal_content");
		}
		$('#leftnav .general a').trigger('click');
		$('#fairAccess').trigger('click');
		setTimeout(function() {
	  	var topPos = $('#fairAccess').offset().top;
			scroll2(topPos);
	  },500);
	}
}

//-- Open FAQ (General > Can I get high-speed Internet in my area?)
function openHighSpeedAvailability(){
	var filePath = window.location.pathname;
	var fileName = filePath.substr(filePath.lastIndexOf("/") + 1);
	if(fileName != "faqs.cfm"){
		window.location.href = "/faqs.cfm#High-Speed-Availability";
	}
	else {
		if(!$('#blackout').length == 0) {
			closeModal("#modal_content");
		}
		$('#leftnav .general a').trigger('click');
		$('#highSpeedCheck').trigger('click');
		setTimeout(function() {
	  	var topPos = $('#highSpeedCheck').offset().top;
			scroll2(topPos);
	  },500);
	}
}

//-- Open FAQ (General > What can I expect at the time of installation?)
function openInstallationExpectations(){
	var filePath = window.location.pathname;
	var fileName = filePath.substr(filePath.lastIndexOf("/") + 1);
	if(fileName != "faqs.cfm"){
		window.location.href = "/faqs.cfm#Installation-Expectations";
	}
	else {
		if(!$('#blackout').length == 0) {
			closeModal("#modal_content");
		}
		$('#leftnav .installation a').trigger('click');
		$('#installationExpectations').trigger('click');
		setTimeout(function() {
	  	var topPos = $('#installationExpectations').offset().top;
			scroll2(topPos);
	  },500);
	}
}

//-- Open FAQ (General > Is HughesNet a solution for rural satellite Internet service?)
function openRuralSatelliteSolution(){
	var filePath = window.location.pathname;
	var fileName = filePath.substr(filePath.lastIndexOf("/") + 1);
	if(fileName != "faqs.cfm"){
		window.location.href = "/faqs.cfm#Rural-Satellite-Solution";
	}
	else {
		if(!$('#blackout').length == 0) {
			closeModal("#modal_content");
		}
		$('#leftnav .general a').trigger('click');
		$('#ruralSolution').trigger('click');
		setTimeout(function() {
	  	var topPos = $('#ruralSolution').offset().top;
			scroll2(topPos);
	  },500);
	}
}

//===== END: FAQs Page scripts ==========//


function openPopupWindow(theURL,winName,features){ window.open(theURL,winName,features); }
function changePaymentTypeID(formID,inputVal){ $('#'+formID+' input.PaymentTypeID').val(inputVal); }
function submitPlanForm(planformID,nopayment){ 
	var yDocName = "/ViewPlans/SelectPlan/"+planformID;
	var yDocGroup = "Consumer";
	var yCreateURL = "/consumerhughesnet/ViewPlans/SelectPlan/"+planformID;
	
	
	if(nopayment == "1") {
		recPageview(yDocName,yDocGroup,yCreateURL);
		setTimeout(function() {
			$('#planform-'+planformID).submit();
		},500);
	}
	
	else {
		//make sure a payment option is selected
		if($('input[name=planform-PaymentTypeID]:radio:checked').length == 0){
			alert('Please select a payment option.');
		}
		else {
			recPageview(yDocName,yDocGroup,yCreateURL);
			setTimeout(function() {
				$('#planform-'+planformID).submit();
			},500);
		}
	}
}
function submitPlanView(planformID){ 
	var yDocName = "/ViewPlans/SelectPlan/"+planformID;
	var yDocGroup = "Consumer";
	var yCreateURL = "/consumerhughesnet/ViewPlans/SelectPlan/"+planformID;	
	recPageview(yDocName,yDocGroup,yCreateURL);

}


// CROSS BROWSER PAGE SCROLL ANIMATION
function scroll2(topPos) { 
	if($.browser.msie && $.browser.version == 6){ 
		$('html').animate({scrollTop:topPos},'fast');
	} 
	else if($.browser.safari){
		$('body').animate({scrollTop:topPos},'fast');
	}
	else {
		$('html,body').animate({scrollTop:topPos},'fast');
	}
}


// YAHOO TRACKING CLICK FUNCTION 
function recPageview(document_name,document_group,createurl) {
	var YWATracker = YWA.getTracker('10001366773462')
	YWATracker.setDocumentName(document_name);
	YWATracker.setDocumentGroup(document_group);
	YWATracker.setUrl(createurl);
	// Added "setAction" to tracker - JG 5/2/2011 
	YWATracker.setAction("PRODUCT_VIEW");
	YWATracker.submit();
	//alert('Testing Analytics: document_name:'+document_name+', document_group:'+document_group+', createurl:'+createurl);
}

// YAHOO TRACKING CLICK FUNCTION 
// Added "setAction" to tracker - JG 5/4/2011
function myPageviewWrapper(document_name,document_group,act_number) {
	var YWATracker = YWA.getTracker('10001366773462')
	YWATracker.setDocumentName(document_name);
	YWATracker.setDocumentGroup(document_group);	 
	YWATracker.setAction(act_number);
	YWATracker.submit();
	//alert('Testing Analytics: document_name:'+document_name+', document_group:'+document_group+', createurl:'+createurl);
}


// HOMEPAGE HERO ANIMATIONS

	var heroleftTopSpeed = 11000;
	var heroleftBtmSpeed = 15000;
	var heroleftTopOn = 1;
	var heroleftBtmOn = 1;
	
	function initHero(){
		$('#hero-lefttop').prepend(' <img src="/_assets/images/consumer/heroleft-top/3.jpg" width="310" height="140" alt="" rel="3" /><img src="/_assets/images/consumer/heroleft-top/2.jpg" width="310" height="140" alt="" rel="2" /> ');
		$('#hero-leftbtm').prepend(' <img src="/_assets/images/consumer/heroleft-bottom/3.jpg" width="310" height="140" alt="" rel="3" /><img src="/_assets/images/consumer/heroleft-bottom/2.jpg" width="310" height="140" alt="" rel="2" /> ');
		setInterval("rotateHeroLeftTop()", heroleftTopSpeed);
		setInterval("rotateHeroLeftBtm()", heroleftBtmSpeed);
		$('.marquee').css('visibility','visible');
	}
	
	function rotateHeroLeftTop(){
		var heroleftTopCnt = $('#hero-lefttop img').size();
		$('#hero-lefttop img[rel="'+heroleftTopOn+'"]').fadeOut(900, function(){
			if(heroleftTopOn == heroleftTopCnt){ heroleftTopOn = 1; } else { heroleftTopOn++ }
			$('#hero-lefttop img[rel="'+heroleftTopOn+'"]').fadeIn(900);
		});
	}
	
	function rotateHeroLeftBtm(){
		var heroleftBtmCnt = $('#hero-leftbtm img').size();
		$('#hero-leftbtm img[rel="'+heroleftBtmOn+'"]').fadeOut(900, function(){
			if(heroleftBtmOn == heroleftBtmCnt){ heroleftBtmOn = 1; } else { heroleftBtmOn++ }
			$('#hero-leftbtm img[rel="'+heroleftBtmOn+'"]').fadeIn(900);
		});
	}

// EXTRABANDWIDTHID LISTENERS
	$('input[rel$="-plusup1"]').live('click',function(){ var getRel=$(this).attr('rel'); getRel = getRel.slice(0, -1); $('input#'+getRel+'1').attr('checked','checked');  $('input[id='+getRel+'0').attr('checked','false'); });
	$('input[rel$="-plusup0"]').live('click',function(){ var getRel=$(this).attr('rel'); getRel = getRel.slice(0, -1); $('input#'+getRel+'0').attr('checked','checked');  $('input[id='+getRel+'1').attr('checked','false');  });

	

// WEBTRENDS CUSTOM TRACKING FUNCTIONS
function wt_setContentGroups(currPage) { //set appropriat content and sub-content groups
	var currPage = currPage.substr(0, currPage.lastIndexOf('.'));
	//console.log(currPage);
	//dcsMultiTrack('WT.ti',currPage,'WT.cg_n','Consumer','WT.cg_s',currPage);
}

function wt_setSelectPlan_dcsTag(planName) { //set click tags on dynamic plan buttons
	var dcsURL = '';
	switch (planName){
		case 'Basic':
			dcsURL = "dcsMultiTrack('DCS.dcsuri','/home/basic/selectthisplan','WT.ti','Home / Basic/select this plan');";
			break;
		case 'Power 150':
			dcsURL = "dcsMultiTrack('DCS.dcsuri','/home/power150/selectthisplan','WT.ti','Home / Basic/select this plan/power150');";
			break;
		case 'Power 200':
			dcsURL = "dcsMultiTrack('DCS.dcsuri','/home/power200/selecthisplan','WT.ti','Home / Basic/select this plan/power200');";
			break;
	}
	if(dcsURL != '') { eval(dcsURL) };
}	

 $(document).ready(function() {
   if ($('#tabpage_power200').length == 0) {
	   $('#tab_power200').hide();
   }
 });
 


