function AddMyLista(id,idLoja,e,ac)
{
	$('#lista_add_new').load('/usuario/listanewproduto/'+id+'/'+idLoja+'/'+ac+'.html');
	
	var height = $('#AlertAdd').height();
	var width = $('#AlertAdd').width();

	leftVal=e.pageX-width+"px";
	topVal=e.pageY-height+"px";

	$('#AlertAdd').css({left:leftVal,top:topVal}).fadeIn(700);

}; 

function PrecoValida() 
{
	$("input[name^=valor_alerta]").priceFormat({
		prefix: '',
		centsSeparator: ',',
		thousandsSeparator: '.'
	});
}


function Carregar(pagina,obj_id) {

	$.ajax({
			type: "POST",
			url: pagina,
			data: "obj_id="+obj_id,
			cache: false,
			success: function(html){
			$("#tradepar").before(html);
		}
	});
}

function add_list(objeto_id,obj_htm)
{
  $('#' + obj_htm + '').html(objeto_id);
}

function PostaArray(pagina,form_id,obj_id)
{
	var query_string = '';
	
	$("#" + form_id + " input[type='checkbox']").each(
		function()
		{
			if(this.checked)
			{
				query_string += "&" + this.name + "[" + this.value + "]=" + this.value;
			}
		});

	$("#" + form_id + " input[type='hidden']").each(
		function()
		{
			query_string += "&" + this.name + "=" + this.value;
		});

	$("#" + form_id + " input[type='text']").each(
		function()
		{
			query_string += "&" + this.name + "=" + this.value;
		});
	
	$("#" + form_id + " textarea").each(
		function()
		{
			query_string += "&" + this.name + "=" + this.value;
		});

	$.ajax(	
		{
			type: "POST",
			url: pagina,
			data: "obj_id=" + obj_id + query_string,
			success: function(html){
			$("#tradepar").before(html);
			}
		 });	
}
function Centralizar(id) {
	var item= $("#" + id);
	var win = $(window);
	item.css({
		position: "absolute",
		top: (win.height() / 2) - (item.height() / 2),
		left: (win.width() / 2) - (item.width() / 2)
	});
};
function Remover(obj_id) {
	$("#obj_"+obj_id).remove();
}
function LimpaForm(form_id)
{
	$("#" + form_id + " input[type='text']").each(
		function()
		{
			this.value = '';
		});
	$("#" + form_id + " input[type='password']").each(
		function()
		{
			this.value = '';
		});

	$("#" + form_id + " textarea").each(
		function()
		{
			this.value = '';
		});
}
