﻿$(function() {
    $('#tabscontainer').tabs();
    $("#savedjobs").load("/includes/ajax/content.aspx", {type:'jobs', from:'savedjobs', url: location.href});
    $("#gadball").load("/includes/ajax/content.aspx", {type:'jobs', from:'gadball', url: location.href});
    $("#simplyhired").load("/includes/ajax/content.aspx", {type:'jobs', from:'simplyhired', url: location.href});
    $("#indeed").load("/includes/ajax/content.aspx", {type:'jobs', from:'indeed', url: location.href});
    $("#juju").load("/includes/ajax/content.aspx", {type:'jobs', from:'juju', url: location.href});
    $("#jobfrenzy").load("/includes/ajax/content.aspx", {type:'jobs', from:'jobfrenzy', url: location.href});
});    

function save(jid) {
    $.post("/includes/ajax/content.aspx", {save: jid}, function(data) { 
        if (data != "") {
            if (data == "0") {
                jGrowlTheme('success', 'Saved', 'Job saved successfully. <a href="/jobs/saved.aspx">view<a/>');	
            }
            $('#save_' + jid).html('<img alt=\"*\" width=\"12px\" src=\"/includes/images/icons/disc.png\" /> Saved');
            $("#savedjobs").load("/includes/ajax/content.aspx", {type:'jobs', from:'savedjobs', url: location.href});
        }
    });
    
}

function togglerefine() {
    if ($('#refinesearch').is(':visible')) {
        $('#refinesearch').hide();
        $('#refinelinkshow').show();
        $('#refinelinkhide').hide();
        $('#searchresults').removeClass("right80");
        $('#searchresults').addClass("left100");
    } else {
        $('#refinesearch').show();
        $('#refinelinkshow').hide();
        $('#refinelinkhide').show();
        $('#searchresults').addClass("right80");
        $('#searchresults').removeClass("left100");
    }
}

function showrefine(section) {
    $('#' + section).toggle();
    
    if ($('#' + section).is(':visible')) {
        $('#img' + section).html('<img alt=\"-\" class=\"noborder\" width=\"9px\" height=\"9px\" src=\"http://fs.datafrenzy.com/images/buttons/arrow_down_hover.gif\" />');
    }
    else {
        $('#img' + section).html('<img alt=\"+\" class=\"noborder\" width=\"9px\" height=\"9px\" src=\"http://fs.datafrenzy.com/images/buttons/arrow_up_hover.gif\" />');
    }
}

function closejsa() {
    $('#jsa').hide("slide", {direction: "up"},500);
}


function togglesummary() {
    if ($('.itemdetail').is(':visible')) {
        $('#summarylink').html('Switch to Detail View');
        $(".itemdetail").hide();
        $(".itemsummary").show();
        $.post("/includes/ajax/content.aspx", {type:'jobview', view:'summary'});
    }
    else {
        $('#summarylink').html('Switch to Summary View');
        $(".itemdetail").show();
        $(".itemsummary").hide();
        $.post("/includes/ajax/content.aspx", {type:'jobview', view:'detail'});
    }
}


 $(document).ready(function(){           
   showrefine('c');
   showrefine('cat');
   showrefine('emp');
   showrefine('days');
 });
