$(document).ready(function() {
	$("a#7").click(function() {
		alert("Hallo Welt");
	});
	
	$("#sales2009").tablesorter({widgets: ['zebra','repeatHeaders'],sortList: [[1,1]],headers:{1:{sorter:'transactionvalue'}}}); 
	$("#tablesorter").tablesorter({widgets: ['zebra','repeatHeaders'],headers:{1:{sorter:'transactionvalue'}}}); 
	
	if($(".videolayer").length > 0) {
		$(".videolayer").click(function(){
			$(window).scrollTop("0px");
			var youtubeid = $(this).attr("rel");
			$(".video_inner").html('<object width="600" height="395"><param name="movie" value="http://www.youtube.com/v/'+youtubeid+'&hl=en_US&fs=1&color1=0x3a3a3a&color2=0x999999&autoplay=1"></param><param name="allowFullScreen" value="true"></param><param name="autoplay" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'+youtubeid+'&hl=en_US&fs=1&color1=0x3a3a3a&color2=0x999999&autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" autoplay="1" width="600" height="395"></embed></object>');
			$("#overlay").css("display", "block");
			return false;
		});
		$("#closeVideo").click(function(){
			$(".video_inner").html('');
			$("#overlay").css("display", "none");
			return false;
		});
	}
	
	if(get_url_param('teamvideo')){
		openTeamVideo();
	};
    
});

function get_url_param( name )
{
	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");

	var regexS = "[\\?&]"+name+"=([^&#]*)";
	var regex = new RegExp( regexS );
	var results = regex.exec( window.location.href );

	if ( results == null )
		return "";
	else
		return results[1];
}


function openTeamVideo(){
	$(window).scrollTop("0px");
	var youtubeid = '4l3SpZNCiUQ';
	$(".video_inner").html('<object width="600" height="395"><param name="movie" value="http://www.youtube.com/v/'+youtubeid+'&hl=en_US&fs=1&color1=0x3a3a3a&color2=0x999999&autoplay=1"></param><param name="allowFullScreen" value="true"></param><param name="autoplay" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'+youtubeid+'&hl=en_US&fs=1&color1=0x3a3a3a&color2=0x999999&autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" autoplay="1" width="600" height="395"></embed></object>');
	$("#overlay").css("display", "block");
}

$.tablesorter.addParser({
        // set a unique id
        id: 'transactionvalue',
        is: function(s) {
                // return false so this parser is not auto detected
                return false;
        },
        format: function(s) {
                // format your data for normalization

				var newstring=s.replace(".","");
                var intSplit = newstring.split(' ');

				
                return intSplit[0];
        },
        // set type, either numeric or text
        type: 'numeric'
});
