$(document).ready(function () {
  $("div.portfolio>span").click(portfolioItemClick);
});

function portfolioItemClick (e) {
    if (ignoreClick)
    {
      ignoreClick = false;
      return;
    }
    ignoreClick = true;
    if ($(this).attr("href") !== false && typeof $(this).attr("href") !== 'undefined')
      window.location = $(this).attr("href");
    else
    {
      if ($(this).hasClass("explicitHeight"))
      {
        $(this).children("div").first().children("div").trigger("destroy");
        $(this).children("div").first().children("div").removeClass("explicitHeight");
        $(this).removeClass("explicitHeight");
        /*$("div.portfolio a").colorbox({rel:'colorbox[' +$(this).index() + ']'});*/
        
        $(this).children("div").first().children("div.arrow").removeClass(
          "arrow").addClass("extendedArrow").click(function ()
        {
          $(this).removeClass("extendedArrow").addClass("arrow");
          
          $(this).parent().parent().addClass("explicitHeight");
      $(this).parent().children(".ellipsis").addClass("explicitHeight");
          $(this).parent().children(".ellipsis").dotdotdot({
                          after: ".read-more"
                        });

        });
      }
    }
  }

var ignoreClick = false;
