function hit_stat(id) {
        var url = "http://stat.adlesse.com/log.php?id=" + id + "&r=" + Math.round(100000 * Math.random());
        var im = new Image();
        im.src = url;
}

$(document).ready(function(){

	$('html').addClass('js');
	
	$('.blockOverlay, .close-popup').live('click', function(){
		$.unblockUI();
	});

});


$(function(){
	$("#tabs").tabs({
		select: function(event, ui) {
			window.location.hash = ui.tab.hash;   
		}
	});

	if (window.location.hash == ""){
		SelectTab('#fastesttube');
	} else if(window.location.hash == "#congratulations"){
		hit_stat(815);
		SelectTab('#fastesttube');
		$.blockUI({
			overlayCSS: { opacity: '.85' },
			message: $('#congratulations'),
			css: {
				width: '800px',
				left: '50%',
				marginLeft: '-400px',
				top: '120px',
				border: 'none', 
				textAlign: 'left',
				cursor: null,
				backgroundColor: '#FFF',
				'-webkit-border-radius': '10px', 
				'-moz-border-radius': '10px', 
				color: '#000'
			}
		});
	} else {
		SelectTab(window.location.hash);
	};
	
	$("#tabs").removeClass("hidden");
	$("#divnav").removeClass("hidden");
	
});

function SelectTab(tabNum){
	
	var colors= new Array()
	colors['#fastesttube']="#FF8C00";
	colors['#learnmore']="#00B6DE";
	colors['#supports']="#A3C93A";
	colors['#contactus']="#FF0000";

	var $tabs = $('#tabs').tabs(); // first tab selected
	$tabs.tabs('select', tabNum); // switch to proper tab	   
	
	$("#tabs").css("border-color",colors[tabNum]);
}
