jQuery.noConflict();

// For SuperFish drop-down menu
jQuery(document).ready(function($){ 

	// From here: http://remysharp.com/2007/05/18/add-twitter-to-your-blog-step-by-step/
	getTwitters('tweet', { 
	  id: 'MitchLapides',
	  ignoreReplies: true, 
	  template: '<a href="http://twitter.com/%user_screen_name%/statuses/%id_str%/">%time%</a> - %text% <a href="http://twitter.com/MitchLapides/">(Follow us)</a>'
	});

    jQuery("ul.sf-menu").supersubs({ 
        minWidth:    12,                                // minimum width of sub-menus in em units 
        maxWidth:    14,                                // maximum width of sub-menus in em units 
        extraWidth:  1                                  // extra width can ensure lines don't sometimes turn over 
                                                        // due to slight rounding differences and font-family 
    }).superfish({ 
        delay:       200,                               // delay on mouseout 
        animation:   {opacity:'show',height:'show'},    // fade-in and slide-down animation 
        speed:       'fast',                            // faster animation speed 
        autoArrows:  false,                             // disable generation of arrow mark-up 
        dropShadows: false                              // disable drop shadows 
    });
	
	// select #flowplanes and make it scrollable. use circular and navigator tab3
	$("#flowpanes").scrollable({ circular: true, mousewheel: false }).navigator({
		// select #flowtabs to be used as navigator
		navi: "#flowtabs",
		// select A tags inside the navigator to work as items (not direct children)
		naviItem: 'a',
		// assign "current" class name for the active A tag inside navigator
		activeClass: 'current',
		// make browser's back button work
		hitab1: true,
		vertical:true
	}).autoscroll({ autoplay: true, interval:4000 });
	
	/* Old Twitter JavaScript
	
	$('#tweet').ajaxComplete(function(e) {
	if ($('.tweet_text', $(this)).size()) {
		$('.tweet_text').append("<span><a href='http://twitter.com/MitchLapides/'> (Follow us)<\/a><\/span>");
	}
	});
	
	$("#tweet").tweet({
		username: "MitchLapides",
		join_text: "auto",
		count: 1,
		auto_join_text_default: "",
		loading_text: "loading tweets...",
		outro_text: "<span><a href='http://twitter.com/MitchLapides/'> (Follow us)<\/a><\/span>"
	});
	
	*/
		
	$("a#ftbox").fancybox({
		'onComplete'    : function() {$("#fancybox-wrap").unbind('mousewheel.fb');} , 
		'overlayShow'	: true,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'centerOnScroll': true,
		'type'          : 'iframe',
		'scrolling'     : 'yes',
		'autoScale'     : false,
		'height'        : 700,
		'width'         : 657
	});
	
	$("a#ftbox_wider").fancybox({
		'onComplete'    : function() {$("#fancybox-wrap").unbind('mousewheel.fb');} , 
		'overlayShow'	: true,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'centerOnScroll': true,
		'type'          : 'iframe',
		'scrolling'     : 'yes',
		'autoScale'     : false,
		'height'        : 700,
		'width'         : 732
	});
	
	$("a#ft_contact_sidebar").fancybox({
		'onComplete'    : function() {$("#fancybox-wrap").unbind('mousewheel.fb');} , 
		'overlayShow'	: true,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'centerOnScroll': true,
		'type'          : 'inline',
		'scrolling'     : 'no',
		'autoScale'     : true
	});
	
	$("a.get_click_screenshot").fancybox({
		'onComplete'    : function() {$("#fancybox-wrap").unbind('mousewheel.fb');} , 
		'overlayShow'	: true,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'centerOnScroll': true,
		'type'          : 'iframe',
		'scrolling'     : 'yes',
		'width'         : 685,
		'height'        : 700
	});
	
	// Get URL parameters
	// From here: http://jquery-howto.blogspot.com/2009/09/get-url-parameters-values-with-jquery.html
	$.extend({
		getUrlVars: function(){
			var vars = [], hash;
			var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
			for(var i = 0; i < hashes.length; i++) {
				hash = hashes[i].split('=');
				vars.push(hash[0]);
				vars[hash[0]] = hash[1];
			}
			return vars;
		},
			getUrlVar: function(name){
				return $.getUrlVars()[name];
		}
	});
	
	var loggedout = $.getUrlVar('loggedout');
	var pwreset   = $.getUrlVar('reset');
	
	if(loggedout && !pwreset) {
		$("a#lost-password").fancybox({
			'onComplete'    : function() {$("#fancybox-wrap").unbind('mousewheel.fb');} , 
			'overlayShow'	: true,
			'transitionIn'	: 'none',
			'transitionOut'	: 'elastic',
			'centerOnScroll': true,
			'type'          : 'inline',
			'scrolling'     : 'no',
			'autoScale'     : false,
			'padding'       : 20
		}).trigger('click');
	} else {
		$("a#lost-password").fancybox({
			'onComplete'    : function() {$("#fancybox-wrap").unbind('mousewheel.fb');} , 
			'overlayShow'	: true,
			'transitionIn'	: 'elastic',
			'transitionOut'	: 'elastic',
			'centerOnScroll': true,
			'type'          : 'inline',
			'scrolling'     : 'no',
			'autoScale'     : false,
			'padding'       : 20
		});
	}
	
});
