
var oChoice, oChoiceWin1;

function initChoice( options, cTitle, cUrl, lTitle, lUrl ) {
    var options = options ? options : {};
    options.fx = !$.browser.msie ? { opacity:'toggle' } : {};
    oChoice = $("#choice").tabs( options );

    if (cTitle && lTitle) {
          $("#choice").bind('tabsselect', function(event, ui) {
            if (ui.index!=1) {
              $('div.head h3.lTitle').fadeOut(200);
              $('div.head h3.cTitle').fadeIn(200);
              if (lUrl) {
                $('div.head div.lImg').fadeOut(200);
                $('div.head div.cImg').fadeIn(200);
              }
            } else {
              $('div.head h3.cTitle').fadeOut(200);
              $('div.head h3.lTitle').fadeIn(200);
              if (lUrl) {
                $('div.head div.cImg').fadeOut(200);
                $('div.head div.lImg').fadeIn(200);
              }
            }
          });
    }
}

function initChoiceWindows( options ) {
    var options = options ? options : { w1:false, w2:false, w3:false }
    options.t1 = options.t1 ? options.t1 : 'All Categories';
    options.t2 = options.t2 ? options.t2 : 'All Locations';
    options.t3 = options.t3 ? options.t3 : 'All Keywords';
    
    if (options.w1) {
      oChoiceWin1 = $("#win_choice_1").dialog( { 
        autoOpen:false, 
        draggable:true,
        title:options.t1,
        modal:true,
            height:280,
            maxHeight:500,
            width:280,
            maxWidth:280,
            minWidth:280
        })
        $("#button_choice_1").click( function(e){ 
            e.preventDefault(); 
            var p = $("#choice").position();
            oChoiceWin1.dialog( "option","position",[p.left+20,p.top+10] )
            oChoiceWin1.dialog("open"); 
        });
    }

    if (options.w2) {
      oChoiceWin2 = $("#win_choice_2").dialog( { 
        autoOpen:false, 
        draggable:true,
        title:options.t2,
        modal:true,
            height:280,
            maxHeight:500,
            width:280,
            maxWidth:280,
            minWidth:280
        })
        $("#button_choice_2").click( function(e){ 
            e.preventDefault(); 
            var p = $("#choice").position();
            oChoiceWin2.dialog( "option","position",[p.left+130,p.top+10] )
            oChoiceWin2.dialog("open"); 
        });
    }

    if (options.w3) {
      oChoiceWin3 = $("#win_choice_3").dialog( { 
        autoOpen:false, 
        draggable:true,
        title:options.t3,
        modal:true,
            height:280,
            maxHeight:500,
            width:280,
            maxWidth:280,
            minWidth:280
        })
        $("#button_choice_3").click( function(e){ 
            e.preventDefault(); 
            var p = $("#choice").position();
            oChoiceWin3.dialog( "option","position",[p.left+240,p.top+10] )
            oChoiceWin3.dialog("open"); 
        });
    }
}















