function openPop(url, name_pop){ 
	window.open(url, name_pop, 'status=0,toolbar=0, menubar=0,directories=0,resizable=0,scrollbars=1,width=300px, height=590px');
}

$(document).ready(function(){
	$('#form_trabalhe').formValidation({
		alias		   : 'msg'
		,required	   : 'accept'
		,err_list	   : true
		,callback	   : 'callback'
		,display_alert : 'display_erro'
	});
	
});

function callback() { return true; }

function display_erro(list) {
	var erro_htm  = document.getElementById('erro_html');
	var erro      = document.getElementById('erro');

	erro.style.display  = 'block';
	erro_html.innerHTML = "<ul>" + list + "</ul>";
	return false;
}

function deletarCategoria(nome, id){
	var resposta = confirm('Deseja excluir a categoria ( '+nome+' )');
	if(resposta == true){
		window.location.href='?action=del.cat&id='+id;
	}
}

function addCategoria(){
	var nome = document.getElementById('nova_cat').value;
	
	if(nome != "") {
		var resposta = confirm('Deseja inserir a categoria ( '+nome+' )');
		if(resposta == true){
			document.form.submit();
		}
	} else {
		alert("Favor informar o nome da categoria.")
	}
}

function confirmDelete(){
	var resposta = confirm('Confirma exclusao das fotos selecionadas');
	if(resposta == true){
		document.form_img.action.value = "del.fotos";
		document.form_img.submit();
	}
}




// JavaScript Document
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
var timer_id;
function scroll_iframe(frm,inc,dir) {
  if (timer_id) clearTimeout(timer_id);
  if (window.frames[frm]) {
    if (dir == "v") window.frames[frm].scrollBy(0, inc);
    else window.frames[frm].scrollBy(inc, 0);
	timer_id = setTimeout("scroll_iframe('" + frm + "'," + inc + ",'" + dir + "')", 20);
  }
}
function stopScroll() { if (timer_id) clearTimeout(timer_id); }
