var J = jQuery.noConflict();

/* bsn Auto Suggest search menu*/
var options = {
		script:'http://ask.altervista.org/e107/e107_plugins/search_menu/test.php?json=true&limit=5&',
		varname:'input',
		json:true
	};

/*Mainpage image changer with bounce animation*/
function bouncer(){

	if( J(".featured-item").length > 1 && J("#featured-content").hasClass('add_bounce')) 
	/*if more than one featured item is found in the html code the next button is generated, in addition to apply the bounce transition the featured-content div must have the class add_bounce*/
	{	
		var no_animation = true;
		var reflection = J("#reflect");
		var slide = J(".next-item")
		var transition = "easeOutBounce";
		
		
		slide.css({visibility:'visible'}).bind("click",function()
		{	
			if(no_animation)
			{
				no_animation = false;
				reflection.css({display:"none"});
				
				
					J(".current-item").fadeOut(500, shownext);	
						
					
			}
			return false;									  
		});
		
		
		
		function shownext()
		{	
			var next_item = J(".current-item").next(".featured-item");
			if (next_item.length == 0) next_item = J(".featured-item:eq(0)");
			J('#featured-content').css({'z-index':150});
			
			reflection.css({bottom:-1024, display:"block"}).animate({bottom:-431},1800,transition);
			next_item.animate({top:93},1800,transition, function()
			{	
				J(".current-item").css({top:-500, display:"block"}).removeClass("current-item");
				J(this).addClass("current-item");
				J('#featured-content').css({'z-index':1});
				no_animation = true;
			});
		}
		
		
	}
}


/*Blogpage image changer with fadeing animation*/
function smooth_transition(){
	/*if more than one featured item is found in the html && div must have the class add_bounce to apply fading animation*/
	if( J(".featured-item").length > 1 && J("#featured-content").hasClass('add_fade'))
	{
		var reflection = J("#reflect");
		
		function transition()
		{
			if (J.browser.msie && J.browser.version < 7){
			reflection.css({display:"none"});	
				}else{
			reflection.fadeOut(500);
				}
				
			J(".current-item").fadeOut(500, shownext);	
		}
		
		
		function shownext()
		{	
			var next_item = J(".current-item").next(".featured-item");
			if (next_item.length == 0) next_item = J(".featured-item:eq(0)");
			
			
			
			if (J.browser.msie && J.browser.version < 7){
			reflection.css({display:"block"});	
				}else{
			reflection.fadeIn(500);
				}

			next_item.css({display:"none",top:93}).fadeIn(500, function()
			{	
				J(".current-item").css({display:"none"}).removeClass("current-item");
				J(this).addClass("current-item");
				no_animation = true;
			});
		}
		
		setInterval(transition,5000);
		
	}
}



/*This functions checks on which subpage you are and applies the background to the main menu*/
function whichpage() 
{
	var current_url = location.pathname;
	
	J(".lavaLamp a").each(function(i)
	{
		var item_url = J(this).attr('href');
		if(current_url.match(item_url))
		{
			J(this).parent('li').addClass('current');
		}
	});
}




/*the following 2 functions are validating the contact form*/

function form_validation(){
	J("#name, #email, #message, #subject").each(function(i){
									  
				J(this).bind("blur", function(){
				var value = J(this).attr("value");
				var check_for = J(this).attr("id");
				var surrounding_element = J(this);

				if(check_for == "email"){
					if(!value.match(/^\w[\w|\.|\-]+@\w[\w|\.|\-]+\.[a-zA-Z]{2,4}$/)){
						surrounding_element.attr("class","").addClass("invalid-form");
						}else{
						surrounding_element.attr("class","").addClass("ajax_valid");	
						}
					}
				
				if(check_for == "name" || check_for == "message" || check_for == "subject"){
					if(value == ""){
						surrounding_element.attr("class","").addClass("invalid-form");
						return false;
						}else{
						surrounding_element.attr("class","").addClass("ajax_valid");	
						return true;
            }
					}
					
				
		 });
	});
}




function comment_validation(){
	J("#cname, #cmessage, #csubject").each(function(i){
									  
				J(this).bind("blur", function(){
				var value = J(this).attr("value");
				var check_for = J(this).attr("id");
				var surrounding_element = J(this);


				
				if(check_for == "cname" || check_for == "cmessage" || check_for == "csubject"){
					if(value == ""){
						surrounding_element.attr("class","").addClass("invalid-form");
						return false;
						}else{
						surrounding_element.attr("class","").addClass("ajax_valid");	
						return true;
            }
					}
					
				
		 });
	});
}



function my_sub() {

    J("#testinput").focus(function() {

        if (this.value == 'Search ...') {

            this.value = '';
        }
    });

    J("#testinput").blur(function() {
        if (this.value == '') {
            this.value = 'Search ...';
        }
    });

}





function validate_all(){
	var my_error;
	J(".ajax_form #send").bind("click", function(){
											 
	my_error = false;
	J(".ajax_form #name, .ajax_form #message, .ajax_form #email, .ajax_form #subject").each(function(i){
										   
				var value = J(this).attr("value");
				var check_for = J(this).attr("id");
				var surrounding_element = J(this);
				if(check_for == "email"){
					if(!value.match(/^\w[\w|\.|\-]+@\w[\w|\.|\-]+\.[a-zA-Z]{2,4}$/)){
						surrounding_element.attr("class","").addClass("invalid-form");
						my_error = true;
						}else{
						surrounding_element.attr("class","").addClass("ajax_valid");	
						}
					}
				
				if(check_for == "name" || check_for == "message" || check_for == "subject"){
					if(value == ""){
						surrounding_element.attr("class","").addClass("invalid-form");
						my_error = true;
						}else{
						surrounding_element.attr("class","").addClass("ajax_valid");	
						}
					}
						  /* if(J(".ajax_form #name, .ajax_form #message, .ajax_form #email, .ajax_form #subject").length  == i+1){
								if(my_error == false){
									J("#ajax_form").slideUp(400);
									var yourname = J("#name").attr('value');
									var email = J("#email").attr('value');
									var subject = J("#subject").attr('value');
									var message = J("#message").attr('value');
									var myemail = J("#myemail").attr('value');
									var myblogname = J("#myblogname").attr('value');
									J(".ajax_form #send").fadeOut(100);	
									
									J.ajax({
									   type: "POST",
									   url: "send.php",
									   data: "Send=true&yourname="+yourname+"&email="+email+"&website="+website+"&message="+message+"&myemail="+myemail+"&myblogname="+myblogname,
									   success: function(response){
									   J(".ajaxresponse").html(response); 
									   J(".ajax_form #send").fadeIn(400);
									   J(".ajax_form #name, .ajax_form #message, .ajax_form #email , .ajax_form #website").val("");
										   }
										});
									} 
							}*/
					});
					if (my_error == true){
			return false;
			}
	});
}

  /* Images Preload */
  var i = 0;//initialize
	var int=0;//Internet Explorer Fix
	J(window).bind("load", function() {//The load event will only fire if the entire page or document is fully loaded

		var int = setInterval("doThis(i)",500);//500 is the fade in speed in milliseconds		
	});

	function doThis() {
		var images = J('img.reflect_image').length;//count the number of images on the page
		if (i >= images) {// Loop the images
			clearInterval(int);//When it reaches the last image the loop ends
		}
		J('.loader').hide();
		J('img.reflect_image:hidden').eq(0).fadeIn(500).animate({"opacity": "0.5"}, "slow");//fades in the hidden images one by one
		i++;//add 1 to the count
	}
   
        
 J(document).ready(function(){
 
 
 
               J(function() {
               
               J('#carousel').carousel({
				tilt: 50,
				orientation: 'vertical',
				radius: 130,
				pausable: false,
				handle: J('#carousel').parent()
			});
			
			var offset = J('div.demo').offset(), radius = 200, distance = 0.7, size = 128;
			J('div.demo')
				.bind(J.browser.mozilla ? 'DOMMouseScroll' : 'mousewheel', function(event) {
 
					if ( event.wheelDelta ) delta = event.wheelDelta/120;
					if ( event.detail     ) delta = -event.detail/3;
					if ( J.browser.opera  ) delta = -event.wheelDelta;
					
					radius += delta;
					size += delta * 0.66;
 
				/*	J('#carousel').carousel('option', {
						radius: radius,
						width: size,
						height: size
					}); */
 
					event.preventDefault();
				})
				
				.bind('mousemove', function(event) {
					var position = event.pageY - offset.top;
					J('#carousel').carousel('option', 'tilt', ((position / this.offsetHeight) - 0.5) * -200);
			});


                J('#statstabs').tabs({ fxSlide: true, fxFade: true, fxSpeed: 'normal' });
                
                J('ul.spy').simpleSpy();
                //J('ul.spy2').simpleSpy(10);
                
               
 
 
 
				//Vertical Sliding
				J('.featured-image.slidedown').hover(function(){
					J(".cover", this).stop().animate({top:'-252px'},{queue:false,duration:300});
					J('.link_cover_box').show();
				}, function() {
					J(".cover", this).stop().animate({top:'0px'},{queue:false,duration:300});
				});

 
 	J('img.reflect_image').before("<div class='loader'><img src='http://ask.altervista.org/e107/e107_themes/reflect/images/working.gif' alt='' /></div>");

  J("div[id^='pane-']").each(function(){ J(this).jScrollPane({scrollbarWidth: 5}); });
  
 
  J("#ref_search, .reflect_image, .blog_entry").hover(function() {
            J(this).fadeTo(400, 1); // fadeIn() only works if target is totally fadedOut
        }, function() {
            J(this).stop(true,false); // prevents the creation of stacked actions
            J(this).fadeTo(400, 0.7);
        });
 
J("a[id^='comment-']").click(function() { 

     var id = '';
     var id = this.id.match(/comment-(\d+)/); 
     var author = J('#user-' + id[1]).text();
     var text = "[quote=" + author + "] " + J('#text-' + id[1]).text() + " [/quote]";
     
     J('textarea#message').val(text);
     
        });
 
 J("a.anchorLink").anchorAnimate();
 
 J("a#donate").bind("click", function() {
		J("#donate_form").submit()
	});
 
 

 
 J("a[id^='push-']").click(function() { 
     match = this.id.match(/push-(\d+)/);
        J("div#tog-"+match[1]).toggle('slow'); 
        J("div[id^='tog-']").hide();
    });  
 
	J("#mmfp_inline").fancybox({
		'frameWidth':		600, 
		'frameHeight':	300
	});
 	
	J("a.mmfp_thumb").fancybox({
		'hideOnContentClick': false
	});
	
		J(".thumb a").fancybox({
		'hideOnContentClick': false
	});
	
		J("a.irresistible_thumb").fancybox({
		'hideOnContentClick': false
	});
	
	J(".download a").fancybox({
		'frameWidth':		330, 
		'frameHeight':	330, 
		'overlayShow':		false
	});
	
	whichpage(); //checks wich suppage of the mainmenu we are and appends the current class for the lavalamp
	J(".lavaLamp").lavaLamp({ fx: "easeOutBack", speed: 700 });
	bouncer();
	smooth_transition();
	
	/**
	 * my new jQuery Tooltip function '09 (c) aseptik@gmail.com
	 * 12/09/2009 12.18.18
	 */         	
	 
   J(".bbcode_buttons, a").hover(function(e) {
   
   var title = J(this).attr('title');
   J(this).attr('title','');
   
   if ( title != "" ) {
   
   J("body").append("<div class='tooltip' id='tooltip'>"+title+"</div>");

   J("#tooltip").css({opacity:0.85, display:"none", visibility:"visible"}).animate({"padding": "6px"}, 100).fadeIn(400);
					
			J(this).mousemove(function(e){
				  
        	J("#tooltip").css({left:e.pageX+14, top:e.pageY+14});
			
      });
    }
  }, function(e) {
        var title2 = J("#tooltip").text();
        J(this).attr('title',title2); 
        J("#tooltip").remove();
           
        });

  
	form_validation();
	comment_validation();
	validate_all();
  my_sub();
	
  });

 });

jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		//alert(jQuery.easing.default);
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
	},
	easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
	easeInOutQuad: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t + b;
		return -c/2 * ((--t)*(t-2) - 1) + b;
	},
	easeInCubic: function (x, t, b, c, d) {
		return c*(t/=d)*t*t + b;
	},
	easeOutCubic: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t + 1) + b;
	},
	easeInOutCubic: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	},
	easeInQuart: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t + b;
	},
	easeOutQuart: function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	},
	easeInOutQuart: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
	},
	easeInQuint: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t*t + b;
	},
	easeOutQuint: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
	},
	easeInOutQuint: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
		return c/2*((t-=2)*t*t*t*t + 2) + b;
	},
	easeInSine: function (x, t, b, c, d) {
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
	},
	easeOutSine: function (x, t, b, c, d) {
		return c * Math.sin(t/d * (Math.PI/2)) + b;
	},
	easeInOutSine: function (x, t, b, c, d) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeInCirc: function (x, t, b, c, d) {
		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
	},
	easeOutCirc: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	},
	easeInOutCirc: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
	},
	easeInElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	},
	easeOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	easeInOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},
	easeInBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	easeOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	easeInOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158; 
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	},
	easeInBounce: function (x, t, b, c, d) {
		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
	},
	easeOutBounce: function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	},
	easeInOutBounce: function (x, t, b, c, d) {
		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
	}
});


/**
 * LavaLamp - A menu plugin for jQuery with cool hover effects.
 * @requires jQuery v1.1.3.1 or above
 *
 * http://gmarwaha.com/blog/?p=7
 *
 * Copyright (c) 2007 Ganeshji Marwaha (gmarwaha.com)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 * Version: 0.2.0
 * Requires Jquery 1.2.1 from version 0.2.0 onwards. 
 * For jquery 1.1.x, use version 0.1.0 of lavalamp
 */

(function(J) {
   
J.fn.anchorAnimate = function(settings) {

 	settings = jQuery.extend({
		speed : 1100
	}, settings);	
	
	return this.each(function(){
		var caller = this
		J(caller).click(function (event) {	
			event.preventDefault()
			var locationHref = window.location.href
			var elementClick = J(caller).attr("href")
			
			var destination = J(elementClick).offset().top;
			J("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, settings.speed, function() {
				window.location.hash = elementClick
			});
		  	return false;
		})
	})
};

J.fn.simpleSpy = function (limit, interval) {
  // set some defaults
  limit = limit || 6;
  interval = interval || 4000;
  
  return this.each(function () {
    // 1. setup
      // capture a cache of all the list items
    var Jlist = J(this),
      items = [], // uninitialised
      currentItem = limit,
      total = 0, // initialise later on
      height = Jlist.find('> li:first').height();
          
    // capture the cache
    Jlist.find('> li').each(function () {
      items.push('<li>' + J(this).html() + '</li>');
    });
    
    total = items.length;
    
    // chomp the list down to limit li elements    
    Jlist.find('> li').filter(':gt(' + (limit - 1) + ')').remove();

    // 2. effect        
    function spy() {
      // insert a new item with opacity and height of zero
      var Jinsert = J(items[currentItem]).css({
        height : 0,
        opacity : 0,
        display : 'none'
      }).prependTo(Jlist);
                    
      // fade the LAST item out
      Jlist.find('> li:last').animate({ opacity : 0}, 1000, function () {
        // increase the height of the NEW first item
        Jinsert.animate({ height : height }, 1000).animate({ opacity : 1 }, 1000);

        // AND at the same time - decrease the height of the LAST item
        J(this).animate({ height : 0 }, 1000, function () {
            // finally fade the first item in (and we can remove the last)
            J(this).remove();
        });
      });
        
      currentItem++;
      if (currentItem >= total) {
        currentItem = 0;
      }
        
      // trigger the effect again in 4 seconds
      setTimeout(spy, interval);
    }
    
    spy();
  });
};    

J.fn.lavaLamp = function(o) {
    o = J.extend({ fx: "linear", speed: 500, click: function(){} }, o || {});

    return this.each(function() {
        var me = J(this), noop = function(){},
            Jback = J('<li class="back"><div class="left"></div></li>').appendTo(me),
            Jli = J("li", this), curr = J("li.current", this)[0] || J(Jli[0]).addClass("current")[0];

        Jli.not(".back").hover(function() {
            move(this);
        }, noop);

        J(this).hover(noop, function() {
            move(curr);
        });

        Jli.click(function(e) {
            setCurr(this);
            return o.click.apply(this, [e, this]);
        });

        setCurr(curr);

        function setCurr(el) {
            Jback.css({ "left": el.offsetLeft+"px", "width": el.offsetWidth+"px" });
            curr = el;
        };

        function move(el) {
            Jback.each(function() {
                J(this).dequeue(); }
            ).animate({
                width: el.offsetWidth,
                left: el.offsetLeft
            }, o.speed, o.fx);
        };

    });
};
})(J);

function FeedMenu( sLinkSelector, sClass ){
    
    var jqoFeedMenu = J('<span class="feed_menu"><select></select></span>');
    var jqoSelect = jqoFeedMenu.find('select');
    
    if( sClass ){
    	jqoFeedMenu.addClass( sClass );
    }
    
    //feed links
    var defaults = { links: sLinkSelector || 'link[type*=rss],link[type*=atom]' };
    
    /*
    *
    *	Function build	
    *	
    *	@description	
    *
    *	This function builds the feed menu by ripping RSS|Atom feed
    *	content and creating links for those.						
    *							
    */
    this.build = function( mFeedLinks ) {
    	
    	mFeedLinks = mFeedLinks || defaults.links;
    	
    	var oAtom 	= J('<optgroup label="Atom Feeds"></optgroup>');
    	var oRSS 	= J('<optgroup label="RSS Feeds"></optgroup>'); 
    	var oAll    = [];
    	
    	J(mFeedLinks).each(
    		function(){
    			var sFeedType = J(this).is('link[type*=rss]')? "rss" : J(this).is('link[type*=atom]')?"atom":null;
    			var sFeedTitle= J(this).is('link')? "Subscribe to '" + J(this).attr('title') + "'" : J(this).attr('title');
    			
    			var oOption = J('<option></option>')
    					.html( sFeedTitle )
    					.attr('value', J(this).attr('href') )
    					.click(
    						function(){
    							document.location.href = J(this).attr('value');
    							jqoFeedMenu.removeClass('feed_menu_focused');
    						}
    					);
    			
    			if( sFeedType == 'rss' ) {
    				oRSS.append(oOption);
    			} else if ( sFeedType == 'atom' ) {
    				oAtom.append(oOption);
    			}
    			oAll.push(oOption);
    			
    		}
    	);
    	
    	//if there were RSS or Atom feeds found, append them
    	if ( oRSS.find('option').length > 1 ) {
    		if( J.browser.opera){
    			jqoSelect.append( oRSS.find('option') );
    		}else{
    			jqoSelect.append( oRSS );
    		}
    	}	
    	if ( oAtom.find('option').length > 1 ) {
    		if( J.browser.opera){
    			jqoSelect.append( oAtom.find('option') );
    		}else{
    			jqoSelect.append( oAtom );
    		}
    	} else {
    		for( opt in oAll){
    			jqoSelect.append( oAll[opt] );
    		}
    	}
    	
    	//setup the event handlers
    	/*jqoFeedMenu
    		.click(
    			function(){
    				J('.feed_menu select')
    					.not(J(this).find('select'))
    					.blur();
    			}
    		);
    		*/
    	jqoSelect
    		.blur( 	function(){ 
    					if( J.browser.msie || J.browser.safari || J.browser.opera ){
    						this.selectedIndex = -1;
    					
    					}
    					jqoFeedMenu.removeClass('open'); 
    				} 
    		)
    		.focus( function(){
    					if( J.browser.msie || J.browser.safari || J.browser.opera ){
    						this.selectedIndex = -1;
    					
    					}
    					jqoFeedMenu.addClass('open'); 
    				} 
    		)
    		.change(
    			function(){
    				if( J.browser.msie || J.browser.safari || J.browser.opera ){
 		   				var i = this.selectedIndex;
 		   				this.selectedIndex = -1;
 		   				if ( i > -1 ) {
 		   					var o = this.options[i];
 		   					this.selectedIndex = -1;
 		   					document.location.href = J(o).attr('value');
 		   				}
    				}
    			}
    		)
    		.get(0).selectedIndex=-1;
    }
    
    /*
    *
    *	Function feedMenu.write	
    *	
    *	@description	
    *
    *	This function takes a jQuery selector and appends the 
    *	feed menu in that DOM node. If no nodes are found, it
    *	is not written.  If no selector was specified, this
    *	function automatically places the feeds menu as the
    *	last child of the body.
    *	
    *	@param	mTarget	A mixed type variable: string or jQuery or null	
    *
    */
    this.write = function( mTarget ) {
    	
    	//target for the menu is defaulted to the page body
    	mTarget = mTarget || 'body';
    	
    	//build the feed menu options
    	this.build();
    	
    	//shove the feed menu in the target item
    	J(mTarget).append( jqoFeedMenu );
    	
    }

}
