$(document).ready(function() {
	$("div.header div.version").css({ '-moz-border-radius': '6px', '-webkit-border-radius': '6px' });
	$("div#contact_form .text_input").css({ '-moz-border-radius': '4px', '-webkit-border-radius': '4px' });
	$("div#about div.right").css({ '-moz-border-radius' : '8px', '-webkit-border-radius': '8px' });
	$("div#contact_form p label").css({ 
			'-moz-border-radius-topleft': '4px', 
			'-moz-border-radius-bottomleft': '4px', 
			'-webkit-border-bottom-left-radius' : '4px',
			'-webkit-border-top-left-radius' : '4px'  
	});
	$("select").css({ '-khtml-appearance' : 'none' });
	$('#reviews').serialScroll({
	  items: 'div',
	  axis: 'y',
	  duration: 800,
	  interval: 5000,
	  cycle: true
	});
	$('#reviews').trigger('next');
	$(".pop_video").click(function() {
			$.fancybox({
				'padding'		: 0,
				'autoScale'		: false,
				'transitionIn'	: 'none',
				'transitionOut'	: 'none',
				'title'			: this.title,
				'width'			: 320,
				'height'		: 480,
				'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
				'type'			: 'swf',
				'swf'			: {
				'wmode'				: 'transparent',
				'allowfullscreen'	: 'true'
				}
			});
	
			return false;
		});
	
	
	$(".tabs a, a.app_store, a.pop_video, a.screenshots").click(function() {
			var which_tab = 'tab: ' + $(this).attr('text');
			var which_img = 'img: ' + $(this).attr('title');
			
			
			var myEvent = new WoopraEvent(which_tab + ' / ' + which_img ); // Call it whatever you want
			myEvent.fire();
		});
	
	
	
	
	
	
	
	$("a.screenshots").fancybox({
			'transitionIn'	:	'elastic',
			'transitionOut'	:	'elastic',
			'speedIn'		:	400, 
			'speedOut'		:	400
		});
		$('input#send').click(function() {
        var name = $('input#name').val();
        var email = $('input#email').val();
				var topic = $('select#topic').val();
        var message = $('textarea#message').val();
        $.ajax({
            type: 'post',
            url: '/assets/app/scripts/send_email.php',
            data: 'name=' + name + '&email=' + email + '&topic=' + topic + '&message=' + message,

            success: function(results) {
                $('p.validation').html(results);
            }
        }); // end ajax
    });
	$("ul.tabs").tabs("div.panes > div", { history: true });
	
	$("#media a").fancybox({
			'transitionIn'	:	'dissolve',
			'transitionOut'	:	'dissolve',
			'speedIn'		:	400, 
			'speedOut'		:	400
		});
	
});
