$(document).ready(function(){
  //dropdown
  $('#dd-handle, #website #nav-website a, #mobile #nav-mobile a, #logo #nav-logo a').live('click', function() {
    if($('#dd').hasClass('active')){
      $('#dd').removeClass('active');
    } else{
      $('#dd').addClass('active');
    }
    return false;
  });
  
  $('#dd.active a').live('click', function(){
    theID = $(this).attr('href').replace('#','');
    listHTML = $('#nav-'+theID).html();
    $('.top').attr('id', theID);
    $('#nav-'+theID).remove();
    $('#dd-dd').prepend('<li id="nav-'+theID+'">'+listHTML+'</li>');
    $('#dd').removeClass('active');
    return false;
  });
  
  $('#tour .col').click(function() {
    if($(this).hasClass('current')) {
      if ($('.wireframe').length > 0) {
        $('.top').attr('class', 'top screenshot '+$(this).attr('id'));
        $(this).find('.thumb').removeClass('screen').addClass('frame');
        $(this).find('.overlay').html('View the wireframe <span></span>');
      } else {
        $('.top').attr('class', 'top wireframe '+$(this).attr('id'));
        $(this).find('.thumb').removeClass('frame').addClass('screen');
        $(this).find('.overlay').html('View the screenshot <span></span>');
      }
    } else {
      $('.frame').removeClass('frame').addClass('screen');
      $('.current').removeClass('current');
      $(this).addClass('current');
      $('.top').attr('class', 'top wireframe '+$(this).attr('id'));
    }
  });
  
  $('#tour .col').hover(
    function () { $(this).addClass('hover'); }, 
    function () { $(this).removeClass('hover'); }
  );
  
  $('#home #quote-refresh').click(function() {
    quoteArray = [
      '&ldquo;The slickest mockup tool we&rsquo;ve seen yet.&rdquo; &mdash; <a href="http://thenextweb.com/apps/2010/06/29/mocksup-is-the-slickest-mockup-tool-weve-seen-yet/">The Next Web</a>',
      '&ldquo;I think the idea is brilliant.&rdquo; &mdash; <a href="http://carsonified.com">Ryan Carson</a>',
      '&ldquo;Made my life so much easier.&rdquo; &mdash; <a href="http://redkeg.com">Matt</a>',
      '&ldquo;Damn cool way to present mockups.&rdquo; &mdash; <a href="http://rustinjessen.com/">Rustin</a>',
      '&ldquo;Get onto this!&rdquo; &mdash; <a href="http://nuuji.com/">Dean</a>',
      '&ldquo;Really liking the look of Mocksup.&rdquo; &mdash; <a href="http://peterusborne.com/">Peter</a>',
      '&ldquo;An amazing tool.&rdquo; &mdash; <a href="http://andy-davis">Andy</a>',
      '&ldquo;Wow, Mocksup is awesome!&rdquo; &mdash; <a href="http://www.yeahstyledg.com/">Alvaro</a>',
      '&ldquo;Awesome program to link mockups together.&rdquo; &mdash; <a href="http://lizyjoy.com">Elizabeth</a>'
    ]
    randomNum = Math.floor(Math.random()*8);
    if ($('#quote-content').html() == quoteArray[randomNum]){
      randomNum = Math.floor(Math.random()*8);
    } else {
      $('#quote-content').hide();
      $('#quote-content').html(quoteArray[randomNum]);
      $('#quote-content').fadeIn('fast');
    }
    return false;
  });
  
  $('#compare #quote-refresh, #plans #quote-refresh').click( function() {
    quoteArray = [
      '&ldquo;Looking at a site that will allow you to take static images and make them into a full-blown, interactive demo of your product gave me a &ldquo;wow, that&rsquo;s cool&rdquo; moment...&rdquo;<br /><span id="quote">&mdash; Brad McCarty, <a href="http://thenextweb.com">The Next Web</a></span>',
      '&ldquo;I&rsquo;ve been exporting PNGs, making fake backgrounds and just chaining a loop of images together for years—thank God I&rsquo;ve found something like Mocksup. Made my life so<br />much easier!&rdquo;<br /><span id="quote">&mdash; Matt Quintanilla, <a href="http://redkeg.com">Redkeg</a></span>',
      '&ldquo;I&rsquo;ve used Balsamiq for a while, which is great for putting a wireframe together to give a developer to get an estimate, but this ties it all together!&rdquo;<br /><span id="quote">&mdash; <a href="http://www.kevingainey.com">Kevin Gainey</a></span>',
      '&ldquo;Liking Mocksup. It&rsquo;s coming in useful to me as I&rsquo;m redoing <a href="http://www.origencreatives.com">Origen Creatives</a>, my business site.<br /><span id="quote">&mdash; Josh Clark, <a href="http://www.origencreatives.com">Origen Creatives</a></span>',
      '&ldquo;An amazing tool to allow clients to interact<br />with the static designs that are presented as design comps&rdquo;<br /><span id="quote">&mdash; <a href="http://andy-davis">Andy Davis</a></span>',
      '&ldquo;Incredible app! Seriously &mdash; love it and will be using it.&rdquo;<br /><span id="quote">&mdash; Adam Campbell, <a href="http://hotmeteor.com">Hot Meteor</a></span>',
      '&ldquo;Imagine being able to easily browse every version of every mockup you’ve ever created,<br />as well as everything that was ever said about them.&rdquo;<br /><span id="quote">&mdash; <a href="http://31three.com/">Jesse Bennett-Chamberlain</a></span>',
    ]
    randomNum = Math.floor(Math.random()*6);
    if ($('#quote-content').html() == quoteArray[randomNum]){
      randomNum = Math.floor(Math.random()*6);
    } else {
      $('#quote-content').hide();
      $('#quote-content').html(quoteArray[randomNum]);
      $('#quote-content').fadeIn('fast');
    }
    return false;
  });
});