
// url keeper for the thumbnails

var examples = new Object();
examples['firstAdmin'] = 'http://1stutoronto.ca/demo/admin/calendar';
examples['first'] = 'http://1stutoronto.ca/demo/events.php';
examples['findaPerson'] = 'http://1stutoronto.ca/publicDemo/contact.php?instant=findPerson';
examples['echo'] = "http://echowomenschoir.ca";
examples['resume'] = "http://friendlyweb.ca/resume/";

$(document).ready(function() 
{
  // make subtitles shout less;
  $(".subtitle").css("opacity","0.7");

  // javascript functionality and styling for thumbnails 
  
  $(".thumbnailRight img:nth-child(1)").each( function()
    {
       this.id = this.parentNode.id + 'Bw';
       this.src = 'portfolio/img/thumbnail/bw/' + this.parentNode.id + '.gif';
    }
    )
    
  $(".thumbnailRight img:nth-child(2)").each( function()
      {
         this.id = this.parentNode.id + 'Color';
         this.src = 'portfolio/img/thumbnail/colour/' + this.parentNode.id + '.gif';

      }
      )

  $(".thumbnailRight a").each(  function()
    {
         this.href = examples[this.id];
         this.target = '_blank';
         this.onmouseover= function() { color( this.id); };
         this.onmouseout = function() { uncolor( this.id) };
    }
    );
    
    $(".thumbnailRight img:nth-child(1)").addClass("thumbnailBw").css('display','');
    $(".thumbnailRight img:nth-child(2)").addClass("thumbnailColor").css('display','none');
    
    // javascript and styling for opening divs
    
    $(".inside").hide();
    $(".insideA").show();
    
    // blank targets
    
    $(".newWindow").attr("target", "_blank");
});

function color( id)
{
  $('#' + id + 'Bw').hide();
  $('#' + id + 'Color').show();
}

function uncolor( id)
{
  $('#' + id + 'Bw').show();
  $('#' + id + 'Color').hide();
}

function viewPage( url)
{
  window.open(url, url,"");
}

function toggle( id, href)
{
  $('#' + id).toggle('slow');
  var html = $('#' + id + 'A').html();
  var tail1 = html.substring(html.length-3,html.length);
  var newHtml = '';
  if ( tail1 == '...')
    newHtml = html.substring(0, html.length-3) + ":";  
  else
  {
    var tail2 = html.substring(html.length-1,html.length);
    if ( tail2 == ':')
      newHtml = html.substring(0, html.length -1) + "...";
    else
      newHtml = html;      
  }
  $('#' + id + 'A').html(newHtml);
}
