//wrap code in a closure to allow use of $
(function ($) {
	
    PATROC.Helpers = (function () {
        	    var self = {};
        	    
        	     //generic helper loader
    			self.showHelper = function (appendTo, callback) {

    			            $helper = $('<div class="helper"></div>');
    			            $helper.close = this.close;
    			            $(appendTo).append($helper);
    			            callback.call($helper);
    			}
        	    
        	   
                self.showSliderHelper = function () {
                	self.showHelper('body',function (element) {

        				//build content
        				$container = $('<div class="helper-content"><p>Mouseover Pat\'s social media buttons to find out his latest on social media!</p></div>' + 
        								'<div class="arrow"></div>');
        				$(this).append($container);
						
						
						
    					//pulsate it!
    					function fadeIn() {
    					  PATROC.AnimationManager.fadeTo('.helper',1,200,0,function() {
    					  	setTimeout(fadeOut,11000);
    					  });
    					}
    					
    					function fadeOut() {
							PATROC.AnimationManager.fadeTo('.helper',0,200,0,function() {
								setTimeout(fadeIn,100);
							});
    					}
    					
    					function startAnim() {
    					  setTimeout(fadeIn,800);
    					}
    					
    					startAnim();
    					
 
        			});
        	
        		}
    	        
    	        //show helper
    	        self.show = function (type, url) {
    	        
    	        	PATROC.AnimationManager.fadeTo('.helper',1,300,0);

    	        }
    	
    	        //close helper
    	        self.close = function () {
    	        	//alert('close');
    	            PATROC.AnimationManager.fadeTo($('.helper'), 0, 300, 0, function () {
    	                $(this).remove();
    	                helperOpen = false;
    	            });
    	            return false;
    	        }
        		        
        		return self;
        	
        	}());
    


} (jQuery.noConflict()));
