$(document).ready(function(){
	$('ul.accordion').accordion({
		active: ".selected",
		autoHeight: true,
		header: ".opener",
		collapsible: false,
		event: "click"
	});

	$('ul.accordion2').accordion({
		autoHeight: false,
		active: ".selected",
		header: ".opener",
		collapsible: false,
		fillSpace: true,
		event: "click"
	});
	
	$('img.customWidgetDesign').fadeIn("slow");
	
	$('a.rihanna').click(function () {
      $('img.customWidgetDesign').replaceWith('<img src=' + '"images/rihanna.png" ' + 'class="customWidgetDesign" ' + 'alt=""/>');
    });
	
	$('a.jonas').click(function () { 
      $('img.customWidgetDesign').replaceWith('<img src=' + '"images/jonas_brothers.png" ' + 'class="customWidgetDesign" ' + 'alt=""/>');
    });
	
	$('a.lilwayne').click(function () {
      $('img.customWidgetDesign').replaceWith('<img src=' + '"images/lil_wayne.png" ' + 'class="customWidgetDesign" ' + 'alt=""/>');
    });
	
	$('a.rihanna').click(function () {
      $('img.customWidgetDesign').fadeIn("slow");
    });
	
	$('a.jonas').click(function () {
      $('img.customWidgetDesign').fadeIn("slow");
    });
	
	$('a.lilwayne').click(function () {
      $('img.customWidgetDesign').fadeIn("slow");
    });
    
    $('a.item1').click(function () {
      switchAppIndex(0);
    });
    
    $('a.item2').click(function () {
      switchAppIndex(1);
    });
    
    $('a.item4').click(function () {
      switchAppIndex(2);
    });
    
    function thisMovie(movieName) 
    {
        if (navigator.appName.indexOf("Microsoft") != -1) 
        {
            return window[movieName];
        } 
        else 
        {
            return document[movieName];
        }
    }
    
    function switchAppIndex(index)
    {      
        thisMovie("SoundStationWidget").switchAppIndex(index);
    }
    
    function showShareMenu()
    {
        thisMovie("SoundStationWidget").showShareMenu();
    }
    
});