/**
 * @author .DeV!L
 */

$(function(){
	$('div.info').css('opacity', 0.0).show();
	
	$("div.view").hover(function(){
		var id = $(this).attr('id');
		$("div.info[id='i"+id+"']").stop();
		$("div.info[id='i"+id+"']").animate({
			 opacity: 1.0
		}, 500);
	},
	function(){
		var id = $(this).attr('id');
		$("div.info[id='i"+id+"']").stop();
		$("div.info[id='i"+id+"']").animate({
			 opacity: 0.0
		}, 500);
	});
	
	/*$("input#screenshot").filestyle({ 
		image: "images/file_btn.jpg",
		imageheight : 24,
		imagewidth : 70,
		width : 50
      });*/

	if ($('input#screenshot').size() > 0){
		$.ajax_upload('input#screenshot', {
			name: 'screenshot'
		});		
	}
	
	$('#fname').css({
		'width': '250px',
		'float': 'left',
		'margin-right': '6px'
	});
	
	$('input[type="file"]', $('input#screenshot').parent()).change(function(e)
	{
		$('#fname').val(file_from_path($(this).val()));
	});

});

function file_from_path(file){
	var i = file.lastIndexOf('\\');
	if (i !== -1 ){
		return file.slice(i+1);
	}
	return file;
}