﻿//write out the temp form to hold values

if((typeof(Prototype) == 'undefined')&&((typeof(jQuery) == 'undefined'))) { 
document.write('<!--this is the where we "hold" the values of the buy link that has been selected-->');
document.write('<form action="" name="allstores">');
document.write('<input type="hidden" name="artistname" id="artistname" value=""/>');
document.write('<input type="hidden" name="albumname" id="albumname" value=""/>');
document.write('<input type="hidden" name="songname" id="songname" value=""/>');
document.write('</form>'); }

submittostore = function( storename )
{
    var fmatch = false;
    var sUrl;
    switch(storename)
    {
        case "amazon":
        fmatch = true;
            sUrl = 'http://www.amazon.com/exec/obidos/external-search?mode=music&tag=kexponline-20&keyword=';
            sUrl += document.allstores.albumname.value;
            sUrl += '%20-%20';
            sUrl += document.allstores.artistname.value;
            break;
            
        case "zune":
            fmatch = true;
            sUrl = 'http://social.zune.net/my/PartnerContentSearch.ashx';
            sUrl += '?Partner=KEXP';
            sUrl += '&Artist=' + document.allstores.artistname.value;
            sUrl += '&Album=' + document.allstores.albumname.value;
            sUrl += '&Song=' + document.allstores.songname.value;
            break;

        case "silverplatters":
            fmatch = true;
            sUrl = 'http://www.silverplatters.com/rel/v2_home.php';
            sUrl += '?se_556=' + document.allstores.artistname.value;
            sUrl += '&se_557=' + document.allstores.albumname.value;
            sUrl += '&storenr=215&deptnr=6&rc=1.2&db=salesnet&sn=215&sm=2&anyorall=1&search_menu_system=3';
            break;
                
        case "easystreet":
            fmatch = true;
            sUrl ='http://store.easystreetonline.com/rel/v2_home.php';
            sUrl += '?se_153=' + document.allstores.artistname.value;
            sUrl += '&se_154=' + document.allstores.albumname.value;
            sUrl += '&storenr=375&deptnr=3&rc=1.2&sn=375&sm=78&anyorall=1&search_menu_system=3'
            break;

        case "sonicboom":
            fmatch = true;
            sUrl = 'http://www.sonicboomrecords.com/catalog/';
            sUrl += '?artist=' + document.allstores.artistname.value;
            sUrl += '&album=' + document.allstores.albumname.value;
            break;

        case "insound":
            fmatch = true;
            sUrl = 'http://www.insound.com/search/searchmain.jsp?from=31702&select=album';
            sUrl += '&query=' + document.allstores.albumname.value;
            break;
            
        case "itunes":
        fmatch = true;
            sUrl = 'http://click.linksynergy.com/fs-bin/stat?id=/V0y3ifvJfM&offerid=78941&type=3&subid=0&tmpid=1826&RD_PARM1=http%253A%252F%252Fphobos.apple.com%252FWebObjects%252FMZSearch.woa%252Fwa%252FadvancedSearchResults%253Fmedia%253Dmusic%2526artistTerm%253D';
            var sArtistName = document.allstores.artistname.value.replace(/\_/g, "+");
            var sAlbumName = '%2526albumTerm%253D' + document.allstores.albumname.value.replace(/\_/g, "+");
            //var sArtistName = sArtistName.replace(/\_/g, "+");
            //var sAlbumName = sAlbumName.replace(/\_/g, "+");
            sUrl += sArtistName;
            sUrl += sAlbumName;
            break; 
        default:
        //do nothing
    }
    if (fmatch) {
         
      var newwin = window.open(sUrl, storename);
    }
}


