$.noConflict();

var flashvars = {};
flashvars.clip_id = 11011574;
flashvars.show_title = 0;
flashvars.show_byline = 0;
flashvars.show_portrait = 0;

var params = {};		
var attributes = {};

swfobject.embedSWF("http://vimeo.com/moogaloop.swf", "videoPlayer", "600", "338", "9.0.0","", flashvars, params, attributes);

jQuery(document).ready(function($) {
	/*if( navigator && navigator.platform && navigator.platform.match( /^(iPad|iPod|iPhone)$/ ) ) {
		// iPad or iPod Touch or iPhone
	}else {
		$("img").lazyload({ 
			placeholder : "/cms/wp-content/themes/heandshe/lib/images/lazyload.gif",
			effect : "fadeIn"
		});
	}*/
	
	// On Click Dropdowns
	$('div#header li:has( ul )').each(function() {	
		$(this).children('a').click(function() {
			$ul = $(this).siblings('ul');
			$ul.toggleClass('on');
			if( $ul.hasClass('on') ) {
				on = true;
			}else {
				on = false;
			}
			$('div#header ul ul.on').each(function(){
				if( $(this) != $ul ) {
					$(this).removeClass('on');
				}
			});
			if( on == true ) {
				$ul.addClass('on');
			}
			return false;
		});
	});
	
	$('div#header ul ul').each(function(){
		$(this).css('margin-left', ( ( $(this).parent().width() / 2 ) - ( $(this).width() / 2 ) + 4 ) + "px" );
	});
	
	// Comment Form Links and Slide
	if( $('#commentForm').length > 0  && self.document.location.hash != "#commentForm") {
		$('#commentForm').slideUp();
		$('div.footerBuffer').css('height', '39px');
		
		$('a[href$=#commentForm]').click(function() {
			$('#commentForm').slideDown();
			$('div.footerBuffer').animate({
				height: 75
			});
		});
	}
	
	$('.post img, #fancybox-img')
		.live('contextmenu', function(){return false;})
		.live('dragstart', function(event){return false;});
	
	// Referrals
	$('ul.referrer-gallery li').each(function() {
		$('img', this).click(function() {
			$('ul.referrer-gallery li.selected').removeClass('selected');
			$(this).parent().addClass('selected');
			$('ul.referrer-text li').hide();
			$('ul.referrer-text li:eq('+$(this).parent().index()+')').fadeIn();
		});
	});
	$('ul.referrer-text li').hide();
	$('ul.referrer-text li:eq('+$('ul.referrer-gallery li.selected').index()+')').fadeIn();
});
