  $(document).ready( function() {
	if (window.location.pathname.toLowerCase() == "/technicaltracks") {
		/*for (i=2; i < 23; i++) { $("#tr"+i).hide(); }*/
		var page = location.hash;
		if (page != "") { 
			if (page == "#Application_Server_&_Infrastructure") { $("#tr1").show(); }
			else if (page == "#Architecture") { $("#tr2").show(); }
			else if (page == "#BI_Customer_Business_Value") { $("#tr3").show(); }
			else if (page == "#BI_Empower_Your_Users") { $("#tr4").show(); }
			else if (page == "#BI_Improve_Organizational_Effectiveness") { $("#tr5").show(); }
			else if (page == "#BI_Increase_IT_and_Developer_Efficiency") { $("#tr6").show(); }
			else if (page == "#BI_Partner_Services_&_Solutions_Delivery") { $("#tr7").show(); }
			else if (page == "#Cloud_Computing_&_Online_Services") { $("#tr9").show(); }
			else if (page == "#Database_Platform") { $("#tr10").show(); }
			else if (page == "#Developer_Tools_Languages_&_Frameworks") { $("#tr11").show(); }
			else if (page == "#Development_Practices") { $("#tr12").show(); }
			else if (page == "#Management") { $("#tr13").show(); }
			else if (page == "#Office_&_SharePoint") { $("#tr14").show(); }
			else if (page == "#Security_Identity_&_Access") { $("#tr15").show(); }
			else if (page == "#Unified_Communications") { $("#tr16").show(); }
			else if (page == "#Virtualization") { $("#tr17").show(); }
			else if (page == "#Web_Platforms") { $("#tr18").show(); }
			else if (page == "#Windows_Client") { $("#tr19").show(); }
			else if (page == "#Windows_Embedded") { $("#tr20").show(); }
			else if (page == "#Windows_Phone") { $("#tr21").show(); }
			else if (page == "#Windows_Server") { $("#tr22").show(); }
			else { $("#tr1").show(); }
		}
		else {
			$("#tr1").show();
		}
	}



if (window.location.pathname.toLowerCase() == "/schedulechanges") {

        $(function () {
            $("#schedulechanges tr:even").addClass("altRow");
        });

        $("#schedulechanges .title").click(function () {
            var index = $("#schedulechanges .title").index(this) + 1;
            $("#schedulechanges .topic:nth-child(" + index + ") .description").slideToggle();
        });
}


	if (window.location.pathname.toLowerCase() == "/preconferenceseminars") {
		var page = location.hash;
		if (page != "") { 
			page = page.replace(/#/g, "");
			speakerpop(page, 0);
		}
		$("#precons .speakers .speakerl").each(function () {
		   var speakera = "";
		   var speakers = $(this).html();
		   speakers = speakers.split(",");
		   for (i = 0; i < speakers.length; i++) {
			   eachspkr = jQuery.trim(speakers[i]);
			   eachspkr = eachspkr.split(" ");
			   var speakername = "";
			   for (x = 0; x < eachspkr.length; x++) {
				   if (x==0) { speakername = eachspkr[x]; }
				   else { speakername += " "+eachspkr[x]; }
			   }
			   if (i==0) { speakera = "<span class='spkname'>"+speakername+"</span>"; }
			   else { speakera += ", <span class='spkname'>"+speakername+"</span>"; }
		   }
		   $(this).html(speakera);
		});
		$("#precons .spkname").click(function () { speakerpop($(this).html(), 1); });
        $("#precons .category").each(function () {
		   if ($(this).find('span').html() == 'Session Type:') { $(this).hide(); }
		});
		$("#precons .title").click(function() {
			var index = $("#precons .title").index(this)+1;
			$("#precons .topic:nth-child("+index+") .description").slideToggle();
		});
	}
    function speakerpop(spname, updsp)
	{
		spname = spname.replace(/ /g, "_");
		$.ajax({
			type: "GET",
			url: "/speaker/details/"+spname+"?format=html",
			cache: false,
			success: function(data) {
				$("#spkrlbox").html("");
				if(updsp == 1) {
					updateshare(spname);
				}
				$("#spkrlbox").append(data);
				$.fn.colorbox({open:"true", innerWidth:"50%",  height:"450px", inline:true, href:"#spkrlbox"});
			}
		});
	}
	function updateshare(spname)
	{
		$("#spkrlbox").append("<div class='spshare'><p>Share:</p></div>");
		$(".spshare").append('<a href="http://del.icio.us/post?title=Microsoft%20TechEd%20North%20America%202010%20-%20Featured%20Speakers&url=http%3A%2F%2FNorthAmerica.MSTechEd.com%2Ffeaturedspeakers%3Ffbid%3D'+document.getElementById('fbid').value+'%26mtag%3Dmbar%26site_id%3Ddel.icio.us%23'+spname+'" target="_blank" class="link_share link_share_del.icio.us link_share_del.icio.us_2 link_share_2" id="link_share_del.icio.us_2"><img src="http://static.meteorsolutions.com/none.gif" width="16" height="16" style="background: url(http://static.meteorsolutions.com/share_plate.gif) -0px -32px no-repeat;" alt="DEL.ICIO.US" class="img_share img_share_del.icio.us img_share_del.icio.us_2 img_share_2" id="img_share_del.icio.us_2" /></a>');
		$(".spshare").append('<a href="mailto:?subject=Microsoft%20TechEd%20North%20America%202010%20-%20Featured%20Speakers&body=http%3A%2F%2FNorthAmerica.MSTechEd.com%2Ffeaturedspeakers%3Ffbid%3D'+document.getElementById('fbid').value+'%26mtag%3Dmbar%26site_id%3Demail%23'+spname+'" class="link_share link_share_email link_share_email_2 link_share_2"><img src="http://static.meteorsolutions.com/none.gif" width="16" height="16" style="background: url(http://static.meteorsolutions.com/share_plate.gif) -0px -80px no-repeat;" alt="EMAIL" class="img_share img_share_email img_share_email_2 img_share_2" id="img_share_email_2" /></a>');			
		$(".spshare").append('<a href="http://www.facebook.com/share.php?u=http%3A%2F%2FNorthAmerica.MSTechEd.com%2Ffeaturedspeakers%3Ffbid%3D'+document.getElementById('fbid').value+'%26mtag%3Dmbar%26site_id%3Dfacebook%23'+spname+'" target="_blank" class="link_share link_share_facebook link_share_facebook_2 link_share_2" id="link_share_facebook_2"><img src="http://static.meteorsolutions.com/none.gif" width="16" height="16" style="background: url(http://static.meteorsolutions.com/share_plate.gif) -0px -96px no-repeat;" alt="FACEBOOK" class="img_share img_share_facebook img_share_facebook_2 img_share_2" id="img_share_facebook_2" /></a>');
		$(".spshare").append('<a href="http://www.linkedin.com/shareArticle?mini=true&title=Microsoft%20TechEd%20North%20America%202010%20-%20Featured%20Speakers%26summary%3D%26source%3D&url=http%3A%2F%2FNorthAmerica.MSTechEd.com%2Ffeaturedspeakers%3Ffbid%3D'+document.getElementById('fbid').value+'%26mtag%3Dmbar%26site_id%3Dlinkedin%23'+spname+'" target="_blank" class="link_share link_share_linkedin link_share_linkedin_2 link_share_2"  id="link_share_linkedin_2"><img src="http://static.meteorsolutions.com/none.gif" width="16" height="16" style="background: url(http://static.meteorsolutions.com/share_plate.gif) -80px -96px no-repeat;" alt="LINKEDIN" class="img_share img_share_linkedin img_share_linkedin_2 img_share_2" id="img_share_linkedin_2" /></a>');
		$(".spshare").append('<a href="http://twitter.com/home?status=Microsoft%20TechEd%20North%20America%202010%20-%20Featured%20Speaker%20http%3A%2F%2FNorthAmerica.MSTechEd.com%2Ffeaturedspeakers%3Ffbid%3D'+document.getElementById('fbid').value+'%26mtag%3Dmbar%26site_id%3Dtwitter%23'+spname+'" target="_blank" class="link_share link_share_twitter link_share_twitter_2 link_share_2" id="link_share_twitter_2"><img src="http://static.meteorsolutions.com/none.gif" width="16" height="16" style="background: url(http://static.meteorsolutions.com/share_plate.gif) -64px -64px no-repeat;" alt="TWITTER" class="img_share img_share_twitter img_share_twitter_2 img_share_2" id="img_share_twitter_2" /></a>');
	}
	if (window.location.pathname.toLowerCase() == "/birds-of-a-feather") {
		$('#bofcycleimg').html("");
		$('#bofcycleimg').crossSlide({
		  sleep: 2,
		  fade: 1
		}, [
		  { src: '/p/TENA10/resources/bof_right_1.jpg' },
		  { src: '/p/TENA10/resources/bof_right_2.jpg' },
		  { src: '/p/TENA10/resources/bof_right_3.jpg' },
		  { src: '/p/TENA10/resources/bof_right_4.jpg' }
		]);
		var mylist = $('#boflisting');
		var listitems = mylist.children('.topic').get();
		listitems.sort(function(a, b) {
		   var compA = $(a).find(".title").text().toUpperCase();
		   var compB = $(b).find(".title").text().toUpperCase();
		   return (compA < compB) ? -1 : (compA > compB) ? 1 : 0;
		})
		$.each(listitems, function(idx, itm) { mylist.append(itm); })
	
		$("#boflisting .category").each(function () {
		   if ($(this).find('span').html() == 'Session Type:') { $(this).hide();  }
		});
		$("#boflisting .title").click(function() {
			var index = $("#boflisting .title").index(this)+2;
			$("#boflisting .topic:nth-child("+index+") .description").slideToggle();
		});
		
	}
});

var curTrack = 1;
function showTrackDetail(cid)
{
  $("#tr"+curTrack).hide();
  curTrack = cid;
  $("#tr"+curTrack).show();
}

var agendaPos = 1;
var total = 6;
$(function() {
	for (var i = 1; i < total; i++) {
		$("#agendaDayUL li:nth-child("+i+")").addClass("hideme");
	}
	$("#agendaDayUL li:nth-child(1)").removeClass("hideme");
	$("#agendaDayUL tr:even").addClass("altRow");
    $("#tracks tr:even").addClass("altRow");
});

function daychange(daynum)
{
	if (daynum == 6) 
	{
		$("#agendaDayUL li:nth-child("+agendaPos+")").addClass("hideme");
		agendaPos--;
		if (agendaPos < 1) { agendaPos = 5; }
		$("#agendaDayUL li:nth-child("+agendaPos+")").removeClass("hideme");
	} else if (daynum == 7) 
	{
		$("#agendaDayUL li:nth-child("+agendaPos+")").addClass("hideme");
		agendaPos++;
		if (total <= agendaPos) { agendaPos = 1; }
		$("#agendaDayUL li:nth-child("+agendaPos+")").removeClass("hideme");
	}
	else 
	{
		$(".dayBank a:nth-child("+agendaPos+")").removeClass('selected');
		$("#agendaDayUL li:nth-child("+agendaPos+")").addClass("hideme");
		agendaPos = daynum;
		$(".dayBank a:nth-child("+agendaPos+")").addClass('selected');
		$("#agendaDayUL li:nth-child("+agendaPos+")").removeClass("hideme");
	}
}

function showall(printme)
{
	$(".dayBank").hide();
	$(".next").hide();
	$(".back").hide();
	$(".dayview").show();
	$("#agendaDayUL").removeClass("agendaDays");
	$("#agendaDayUL").addClass("agendaDaysAll");
	for (var i = 1; i < total; i++) {
		$("#agendaDayUL li:nth-child("+i+")").removeClass("hideme");
		$("#agendaDayUL li:nth-child("+i+")").addClass('viewall');
	}
	if (printme == "yes") { window.print(); }
}

function showday()
{
	$(".dayBank").show();
	$(".next").show();
	$(".back").show();
	$(".dayview").hide();
	$("#agendaDayUL").addClass("agendaDays");
	$("#agendaDayUL").removeClass("agendaDaysAll");
	for (var i = 1; i < total; i++) {
		$(".dayBank a:nth-child("+i+")").removeClass('selected');
		$("#agendaDayUL li:nth-child("+i+")").addClass("hideme");
		$("#agendaDayUL li:nth-child("+i+")").removeClass('viewall');
	}
	$(".dayBank a:nth-child(1)").addClass('selected');
	$("#agendaDayUL li:nth-child(1)").removeClass("hideme");
}

