﻿   // show notification for Pinned sites only for Internet Explorer 9.
    if (!window.external.msIsSiteMode())
    { document.writeln("<div id='alertWrapper'><img id='attention' src='pinshine/ie9.png' alt='IE9' width=30 height=27/> <p>PIN this Site! Using <a href=http://www.microsoft.com/ie9>IE9</a> with Windows 7? Simply Drag the above Tab to your Windows Taskbar to pin for a Great user experience! </p><button type=button onclick=alertWrapper.style.visibility='hidden'></button><span><a href='#' onclick=alertWrapper.style.visibility='hidden'></a></span></div>") }

//flash taskbar(activate if, you want it on a button click)
/*function flashWindow()
{
    try {
        if (window.external.msIsSiteMode()) {
            alert('Tab away from this window to see task-bar effect.');
            window.setTimeout("window.external.msSiteModeActivate()", 2000);
        }
    }
    catch (ex) {
        // Fail silently.
    }
}*/

//fav icon drag
window.onload = function()
{
    try {
        if (window.external.msIsSiteMode()) {
            // Continue intialization
        }
        else {
            document.getElementById('divPinSite').style.display = "block";
        }
    }
    catch (e) {
        // Fail silently. Pinned Site API not supported.
    }
}


// add SiteMode
function fnAddSiteMode() 
    {
        if (window.external.msIsSiteMode())
            { //alert('In Site mode'); 
            }
    else ( window.external.msAddSiteMode()); 
   }


// add dynamic jumplists
   function fnCreateJumpList(iScenario) {
       fnClearJumpList();

       //    // Example with a Case Statement : change values in the parameters
       switch (iScenario) {

           case 1:
               window.external.msSiteModeCreateJumpList("Recent")
               window.external.msSiteModeAddJumpListItem("BBC2 - Good Will Hunting", "http://www.bbc.co.uk/iplayer/episode/b0078942/Good_Will_Hunting/", "http://localhost:8082/img/favicon.ico");
               window.external.msSiteModeAddJumpListItem("BBC1 - BBC Weekend News - 15/08/2010", "http://www.bbc.co.uk/iplayer/episode/b00tghyt/BBC_Weekend_News_15_08_2010/", "http://localhost:8082/img/favicon.ico");
               window.external.msSiteModeAddJumpListItem("CBeebies - Big Barn Farm - 40 Winks", "http://www.bbc.co.uk/iplayer/episode/b009kqc5/Big_Barn_Farm_Series_1_40_Winks/", "http://localhost:8082/img/favicon.ico");
               window.external.msSiteModeAddJumpListItem("BBC3 - Dr Who Confidential - Series 5", "http://www.bbc.co.uk/iplayer/episode/b00sbjzl/Doctor_Who_Confidential_Series_5_Blinded_by_the_Light/", "http://localhost:8082/img/favicon.ico");

               window.external.msSiteModeAddJumpListItem("BBC Parliament - Budget 2010", "http://www.bbc.co.uk/iplayer/episode/b00swny8/Budget_2010/", "http://localhost:8082/img/favicon.ico");
               window.external.msSiteModeAddJumpListItem("BBC1 - Casualty - Series 24", "http://www.bbc.co.uk/iplayer/episode/b00th1md/Casualty_Series_24_What_Tonight_Means_to_Me_Part_1/", "http://localhost:8082/img/favicon.ico");
               window.external.msSiteModeAddJumpListItem("BBC4 - Britain By Bike - West Yorkshire", "http://www.bbc.co.uk/iplayer/episode/b00td4sg/Britain_by_Bike_West_Yorkshire/", "http://localhost:8082/img/favicon.ico");

               break;

           case 2:
               window.external.msSiteModeCreateJumpList("New additions")
               window.external.msSiteModeAddJumpListItem("CBeebies - Driver Dan's Story Train - Shush", "http://www.bbc.co.uk/iplayer/episode/b00r4xfj/Driver_Dans_Story_Train_Shush/", "http://localhost:8082/img/favicon.ico");
               window.external.msSiteModeAddJumpListItem("BBC News Channel - Our World - Iraq - MilitiaMen", "http://www.bbc.co.uk/iplayer/episode/b00tj3h1/Our_World_Iraq_Militiamen/", "http://localhost:8082/img/favicon.ico");
               break;
       }
   
	// Example with an Array: feed this array from the datasource
	var artists = new Array ();
	artists [0] = "Lata Mangeshkar" ; 
	artists [1] = "Cliff Richars" ; 
	artists [2] = "Bryan Adams" ; 
	artists [3] = "Palash Sen" ; 
	artists [4] = "Kailash Kher" ; 
	artists [5] = "Mohit Chauhan" ; 
	artists [6] = "Kunal Jangawala" ; 

	window.external.msSiteModeCreateJumpList("Old Artists")

            var i;
            for (i = 0; i < artists.length; i++) {
                                var artistName;
                                artistName = artists[i];
                                alert(artistName); window.external.msSiteModeAddJumpListItem(artistName, 'http://www.bbc.co.uk/listen.aspx?artist=' + artistName, 'alert.ico');
            }
   
    window.external.msSiteModeShowJumpList();

}

// Clear JumpList
function fnClearJumpList() {
    window.external.msSiteModeClearJumplist();
}

// Add ThumbnailOverlay
function fnAddThumbNailOverlay(iState){

    fnClearThumbNailOverlay();


    // Example with a Switch Case Statement
        switch(iState)
        {
            
            case 1:
                window.external.msSiteModeSetIconOverlay("progressError.ico", "Fail");
                break;

            case 2:
                window.external.msSiteModeSetIconOverlay("progressSkip.ico", "Pass");
                break;

        }

}

function fnClearThumbNailOverlay() {
    window.external.msSiteModeClearIconOverlay();
}
// add SiteMode to Start Menu
function fnAddSiteMode() {
    if (window.external.msIsSiteMode()) { //alert('In Site mode'); 
    }
    else (window.external.msAddSiteMode());
}

// Hide the discoverability messageif the user doesnt want to see it
function fnhidealert() {
    alertWrapper.style.visibility = 'hidden';
}
    
