Smile = {
	
	// elements
	e_answer_boxes: '#get-answers li',
	e_topnav: '#topnav',
	e_footer_blockquote: '#footer-right blockquote',
	
	// misc
	misc_default_opacity: .7,
	
	// Load these js files
	files: [
		'js/thickbox-compressed.js',
		'css/thickbox.css'
	],
	
	// Start things up!
	init: function(){
		
		$(this.e_answer_boxes).css('opacity', this.misc_default_opacity);
		$(this.e_answer_boxes).hover(function(){
			$(this).fadeTo('fast', 1)
		}, function(){
			$(this).fadeTo('fast', Smile.misc_default_opacity)
		})
		
		this._loadFiles();
		this._prepare_dropdown();
		this._assign_dropdown_more_class();
		
		// If there is no image beside the testimonial in the footer, add a class
		if($(this.e_footer_blockquote).siblings('img').length == 0){
			$(this.e_footer_blockquote).addClass('full-width');
		}
		
	},
	
	_loadFiles: function(){
		
		$(this.files).each(function(i, file){
			
			if(file.indexOf('.js') != -1){
				var tag = '<script type="text/javascript" src="' + file + '"></script>';
			}
			else {
				var tag = '<link rel="stylesheet" href="' + file + '" type="text/css" media="all" />'
			}
			
			$('head').prepend(tag);
			
		});
		
	},
	
	// Create the multi level dropdown menu
	_prepare_dropdown: function(){
		
		$(this.e_topnav + " ul").css({display: "none"}); // Opera Fix
		
		$(this.e_topnav + " li").hover(function(){
			$(this).find('ul:first').css({visibility: "visible", display: "none"}).show(268);
		},function(){
			$(this).find('ul:first').css({visibility: "hidden"});
		});

		
	},
	
	// Detect if the dropdown contains more sub menus, add a class to it that has the arrow
	_assign_dropdown_more_class: function(){
	
		$(this.e_topnav + " ul a").each(function(){
			if($(this).siblings().length){
				$(this).addClass('more');
			}
		});
		
	}
	
}
