/*
 * This script instantiates jQuery methods for broadband pages.
 * These methods could bind events to elements, for example.
 */

$(document).ready(function(){
	// Here we're appling the IE6 PNG 24 hack to all images with a src that contains "/assets/phonefeature".
	$("img[src*='/assets/datacardfeature']").supersleight({backgrounds: false});

	// Vertically align phone features controls within its parent.
	//$('#item-features-wrapper').vAlign();

	// init tab controls on phone details page, on page load
	$('#tab-item-specifics').simplyTabs();
	
	// Broadband Demo Popup
	$('.popup-trigger').click(
		function(event) {
			$('#lightbox-container-content').html( $('#bb-flash').html() );
			$('#lightbox-container').css({width:'530px'});
			$('#lightbox-container').jqmShow(); 
			event.preventDefault();
		}
	);
});

/*
 * ==========================================================
 * BROADBAND DEMO POPUP FUNCTIONS
 * ==========================================================
 */
 var isDomRendered_popupBBDemo = false;
 function popupBBDemo(swfpath) {
 	
 	if (DetectFlashVer(7,0,0)) {
 		
		var popupBBDemo = '<div style="padding: 1em 1em 0 1em; border-bottom: 1px solid #DADADA; height:35px;">';
		popupBBDemo += '<span class="theme-color" style="font-size: 18px;">&nbsp;&nbsp;&nbsp;&nbsp;Plug in. Click. Connect.</span>';
		popupBBDemo += '</div>';
		popupBBDemo += '<div id="popupcontentBBDemo"></div>';
		
 		$('#lightbox-container').addClass('bbmm-demo-popup');
 		$('#lightbox-container-content').html(popupBBDemo);
 		
 		var so = new SWFObject(swfpath, "BroadbandDemo", "500", "350", "0", "#FFFFFF");
 		so.useExpressInstall("/js/expressinstall.swf");
 		so.addParam("scale","noscale");
 		so.addParam("wmode","transparent");
 		so.write("popupcontentBBDemo");
 		
 		$('#lightbox-container').jqmShow();
 	} else {
 		$('#lightbox-container-content').html("<p>You must have Flash version 7 or greater installed to view the Broadband Demo.</p>");
 		$('#lightbox-container').jqmShow();
 	}

 }

 function closeBBDemoPopup(popupid) {
 	$("popupcontentBBDemo").update();
 	$(popupid).style.display = "none";
 }

