	$(document).ready(function(){
    
	$("ul#list-meetryan ul a").fancybox({
				'width':802,
				'height':502,
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe',
				'padding'			: 0
			});
	
	$("ul#list-products li a.fancy").fancybox({
				'width':802,
				'height':570,
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe',
				'padding'			: 0
			});
	
	$("#cart td a").fancybox({
				'width':802,
				'height':570,
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe',
				'padding'			: 0
			});
	
/*	jQuery(document).ready(function() {
	if ($('#home').length > 0) {
	$.fancybox(
				'<a href=http://www.twitter.com/ryanbriscoe6/ target=_blank><img src=/images/contest_splash.jpg height=525 width=700 alt=Contest /></a>',
				{
					'autoDimensions'	: false,
					'width'         	: 'auto',
					'height'        	: 'auto',
					'transitionIn'		: 'none',
					'transitionOut'		: 'none'
				}
			);
	}
	});
*/	
	
	//check if timeline exists
	if ($('#timeline').length>0) {
       $('#timeline ul').roundabout({
	     btnNext: '#next',
	       btnPrev: '#prev'
      });
				
      //$('li').focus(function() {$(this).find('.info').show();
      //}).blur(function() {$('.info').hide(200);});
	}
	
	//check if photo carousel exists
   	if ($('ul.list-photos').length>0) {
        $('ul.list-photos').jcarousel({scroll:1});
      }

	//check if videos/pics exists
	if ($('.intro').length>0) { 
	  $(".intro a").fancybox({
                    'titleShow'     : false,
                    'transitionIn'  : 'elastic',
                    'transitionOut' : 'elastic'
      });
    }
	
	//check if videos/pics exists
	if ($('.list-videos').length>0) { 
	  $(".list-videos li a").fancybox({
                    'titleShow'     : false,
                    'transitionIn'  : 'elastic',
                    'transitionOut' : 'elastic'
      });
    }
	
  //check if videos/pics exists
	if ($('.list-videos').length>0) { 
	  $(".list-videos a").fancybox({
                    'titleShow'     : false,
                    'transitionIn'  : 'elastic',
                    'transitionOut' : 'elastic'
      });
    }
	
	//check if videos/pics exists
	if ($('#answers').length>0) { 
	  $(".video-main").fancybox({
                    'titleShow'     : false,
                    'transitionIn'  : 'elastic',
                    'transitionOut' : 'elastic'
      });
    }
	
    if ($('#more-answers').length>0) { 
	    $("#more-answers a").fancybox({ 'titleShow'     : false});
    }
	
  //check if home
  if ($('#home').length>0) { 
  $('ul#main-nav a').hover(function() {
     var active = $(this).attr('rel');
    
     var active = '#' + active;
     $('.tab').hide();
	 $('#main-nav li').removeClass('active');
     $(active).show(0);
	 $(this).parent("li").addClass('active');
    });

   $(".video").fancybox({ 'titleShow'     : false});
   
   
   //$('#main-content').mouseleave(function() {
   //  $('.tab').hide();
	 //  $('#main-nav li').removeClass('active');
   //  $('#tab-home').show();
   //});
  }

  $(".fancyvideo").click(function() {
  	$.fancybox({
      'titleShow'     : false,
  		'width'		: 480,
  		'height'		: 385,
  		'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
  		'type'			: 'swf',
      'swf'       : '{}'
  	});
  
  	return false;
  });
      
});

function replaceURLWithHTMLLinks(text) {
  var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@##\/%?=~_|!:,.;]*[-A-Z0-9+&@##\/%=~_|])/ig;
  return text.replace(exp,"<a target=\"_blank\" href='$1'>$1</a>"); 
}

function parseTwitterDate(text) {
  var newtext = text.replace(/(\+\S+) (.*)/, '$2 $1');
  return newtext;
}

function twitterDateTimeString(twitterDateTime) {
  var createdAt = new Date(twitterDateTime);
  var hours = createdAt.getHours();
  var minutes = createdAt.getMinutes();
  
  var ampm = ((hours >= 12) ? " PM" : " AM");
  var hoursString = ((hours == 0) ? "12" : (hours > 12) ? hours - 12 : hours);
  var minutesString = ((minutes < 10) ? "0" + minutes : minutes); 
  
  var createdAtString = createdAt.getMonth()+1 + '/' + createdAt.getDate() + ' at ' + hoursString + ':' + minutesString + ' ' + ampm;

  var retString = 'Posted: ' + createdAtString;
  return retString;
}

function isIE()  
{  
    if(navigator.userAgent.match(/MSIE \d\.\d+/))  
        return true;  
    return false;  
} 

function zIndexWorkaround()  
{  
    // If the browser is IE,  

    if(isIE())  

    {  
        /*  
        ** For each div with class menu (i.e.,  
        ** the thing we want to be on top),  
        */ 

        $(".mainmenu li").parents().each(function() {  
            var p = $(this);  
            var pos = p.css("position");  
            
            // If it's positioned,  
            if(pos == "relative" ||  
               pos == "absolute" ||  
               pos == "fixed")  
            {  

                /*  
                ** Add the "on-top" class name when the  
                ** mouse is hovering over it, and remove  
                ** it when the mouse leaves.  
                */ 

                p.hover(function() {  
                        $(this).addClass("on-top");  
                    },  
                    function() {  
                        $(this).removeClass("on-top");  
                    });  
            }  
        });  
    }  
} 

