$(document).ready(function(){

    $(".job .h3h").each(function(){
        cont = $(this).html();
        $(this).html('<div class="arrow-job"><img src="/images/down.jpg" /></div>'+cont);
    });
    
    $(".job .h3h").click(function () {
      jQuery(".job-details", $(this).parent()).slideToggle();
      jQuery(".arrow-job", $(this).parent()).children("img").swapArrows();
    });

    $(".job-details").hide();

    $(".job .h3h").hover(
        function(){$(this).toggleClass('underlined')},
        function(){$(this).toggleClass('underlined')}
    );

    if($.jqURL.get("id")){
        var id = $.jqURL.get("id");
    }

    if(id === undefined){
        $('.job:first .job-details').toggle();
        $('.job:first .arrow-job').children("img").swapArrows();
    }else{
        $('#'+id+' .job-details').toggle();
        $('#'+id+' .arrow-job').children("img").swapArrows();;
    }

    $(".images a").click(function(){
        imagePopUp($(this).attr('href'));
        return false;
    });

});

function imagePopUp(img) {
html = '<html><head><title>Imagen agrandada</title>'
     + '</head><body style="margin: 0px 0; text-align:center; ">'
     + '<img src="' + img + '" border=0 NAME=image ' + 'onload="window.resizeTo(document.image.width,(document.image.height*1.3))">'
     + "</body></html>";

 n = Math.floor(Math.random()*1000);
 popup = window.open('',img,'toolbar=0,location=0, directories=0,menuBar=0, scrollbars=0,resizable=1');

 popup.document.open();
 popup.document.write(html);
 popup.document.close();
 if (window.focus) {popup.focus();}

};

