$(document).ready(function(){
	$('#refer').click(function(){
		var sep = $('#emails').val() == '' ? '' : ',';
		if($('#emails').val().indexOf($('#email').val()) == -1)
			$('#emails').val($('#emails').val() + sep + $('#email').val());
		else {
			if($('#emails').val() == '')
				$('#emails').val($('#email').val());
		}
           frontend_url = $('#frontend_url').val();
           document.getElementById('referPosting').action = frontend_url+"main/referPosting";
           document.getElementById('referPosting').submit();
	});
	
	$('#close').click(function(){
		$("#uploaddiv").css("display", "none");
	});
	
	$('#thumb_img').click(function(){
		;
	});
	
	
	// for enlarge picture
	$('a[@rel*=lightbox]').lightBox({
		overlayBgColor: '#000',
		overlayOpacity: 0.6,
		imageLoading: '/images/loading.gif',
		imageBtnClose: '/images/close.gif',
		containerResizeSpeed: 350,
		txtImage: 'Imagem'
	   });
	$('#enlarge a').lightBox({
		overlayBgColor: '#000',
		overlayOpacity: 0.6,
		imageLoading: '/images/loading.gif',
		imageBtnClose: '/images/close.gif',
		containerResizeSpeed: 350,
		txtImage: 'Imagem'
	   });
	
	$('#showComment').click(function(){
		if($("#comments").css("display") == 'none'){
			$(this).html('Hide Comment');
			$("#comments").css("display", "block");
		} else if($("#comments").css("display") == 'block'){
			$("#comments").css("display", "none");
			$(this).html("Show Comment");
		}
	});
});

function showUpload(){
	document.getElementById('uploaddiv').style.display = "block";
}
