﻿$(document).ready(function(){
    var $ddList = $('#tab1Col1 ul');
    $ddList.css('display', 'none');
    var generatedList = '<select><option value="#">Please select one...</option></select>';
    var liHref, liContent, curLink, $currentList;
    var newOption = '<option value="' + liHref + '">' + liContent + '</option>';
    var allOptions = '';
    $ddList.each(function(){
        $(this).before(generatedList);
        $currentList = $(this).prev('select');
        $('li', this).each(function(){
            if($('a', this)){
                liHref = $(this).find('a').attr('href');
            } else{
                liHref = '';
            }
            liContent = $(this).text();
            newOption = '<option value="' + liHref + '">' + liContent + '</option>';
            $currentList.append(newOption);
        });
    });
    $('#tab1Col1 select').change(function(){
        curLink = $(this).val();
        if(curLink != '#' && curLink != '' && curLink != 'undefined'){
            window.location = $(this).val();
        }
    });
});
