
var Site = {
	config : {
		base_url : '/',
		site_url : '/index.php'
	},
	start: function() 
	{
		// On Dom Ready
		jQuery(function($) 
		{
			
			/*
			 * Start Vote Box 
			 */
			$('.vote_box a').click( function () {
				var url = $(this).attr('title');
				$(this).parent().load(url);
			});

			$('.watch a').click( function () {
				var url = $(this).attr('title');
				$(this).load(url);
			});

			$('input[title!=""]').hint();


		   $("form input, form select").live('keypress', function (e) {
		        if ($(this).parents('form').find('button[type=submit].default, input[type=submit].default').length <= 0) return true;
		        if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
		        	$(this).parents('form').find('button[type=submit].default, input[type=submit].default').click();
		        	return false;
		        } else {
		        	return true;
		        }
		   });
			/*
			 * End Vote Box 
			 */
			
			// Prepend favicon to all text links
			/* FavoriteIcon v1.1 - 5 May 09 (http://blog.liviuholhos.com/javascript/add-a-favicon-near-external-links-with-jquery)
			 * Author : Liviu Holhos (http://www.liviuholhos.com/) */
			(function($){
				$.fn.favoriteIcon = function(options) {
					var defaults = {
						iconClass    : 'favoriteIcon',
						insertMethod : 'prependTo',
						iconSearched : 'favicon.ico'
					};
					var options = $.extend(defaults, options);

					$(this).filter(function(){
						return this.hostname && this.hostname !== location.hostname;
					}).each(function() {
						var link = jQuery(this);
						var faviconURL = link.attr('href').replace(/^(http:\/\/[^\/]+).*$/, '$1')+'/'+options.iconSearched;
						var faviconIMG = jQuery('<img class="'+options.iconClass+'" src="" alt="" />')[options.insertMethod](link);
						var extImg = new Image();
						extImg.src = faviconURL;
						if (extImg.complete)
							faviconIMG.attr('src', faviconURL);
						else
							extImg.onload = function() { faviconIMG.attr('src', faviconURL); };
					});
				}
			})(jQuery);
			
			$(".favicon").favoriteIcon({ iconClass : 'favoriteIcon' });
		
		}); //End jQuery()
	} // End start()
}; // End Site

Site.start();