jQuery.noConflict();
jQuery(document).ready(function(){ 
    jQuery("ul.sf-menu").superfish({
		pathClass:	'current',
        delay:       400,                               // 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 
    });
	jQuery("#blog_switch").click(function(){
		switch_blog();
	});
	jQuery.ajaxSetup({cache:false});
	jQuery(".expand-link").click(function(){
		var post_id = jQuery(this).attr("rel");
		loadingImg = jQuery(this).next();
		loadingImg.show();
		jQuery(this).fadeOut();
		jQuery(this).parent().next().load("http://www.signspotting.com/comment-ajax/",{id:post_id},function(response,status,xhr){
			if (status == "error") {
				var msg = "Sorry but there was an error: ";
				jQuery(this).html(msg + xhr.status + " " + xhr.statusText);
			}
			jQuery(this).slideDown('slow');
			jQuery(this).prev().hide('fast');
		});
		return false;
	});
	var facebook_connection = jQuery.ajax({type:'GET', url: 'http://www.signspotting.com/facebook-sync', data:facebook_sync_links, cache: false, success:function(msg){console.log('sync done/aborted');}});
	jQuery(window).unload(function (){ facebook_connection.abort();});
});

function switch_blog(){
	jQuery.ajax({type: 'GET', url: 'http://www.signspotting.com/wp-content/themes/thematic/blog-bounce.php', data: 'switch_initiated=true', cache: false, success: switch_success});
}

function switch_success(){
	location.reload();
}
