function agregarPopup(cualForm,cualSelect){ 
	objeto=eval("document."+cualForm+"."+cualSelect)
    var indice = objeto.selectedIndex;
    var valor = objeto.options[indice].value;
	if (cualSelect=="idRubrosEmpresa"){
		href="altas-varios.php?seccion=alta-rubro";
	}else if (cualSelect=="id_tipo"){
		href="altas-varios.php?seccion=alta-tipotrabajo";
	}else {
		href="altas-varios.php?seccion=alta-catnoticia";
	}
	if(valor=="mas"){
		MM_openBrWindow(href,'altas','scrollbars=no,status=yes,width=300,height=315')
	}
} 

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//funciones del Admin
function preloadImages(){
MM_preloadImages('images/btn-editClaro-over.jpg')
MM_preloadImages('images/btn-editOscuro-over.jpg')
MM_preloadImages('images/btn-deleteClaro-over.jpg')
MM_preloadImages('images/btn-deleteOscuro-over.jpg')
MM_preloadImages('images/tit-trabajo-over.jpg')
MM_preloadImages('images/tit-inicio-over.jpg')
MM_preloadImages('images/tit-entregado-over.jpg')
MM_preloadImages('images/tit-empresa-over.jpg')
MM_preloadImages('images/tit-categoria-over.jpg')
MM_preloadImages('images/tit-contacto-over.jpg')
MM_preloadImages('images/tit-descripcion-over.jpg')
MM_preloadImages('images/tit-detalle-over.jpg')
MM_preloadImages('images/tit-fecha-over.jpg')
MM_preloadImages('images/tit-instancias-over.jpg')
MM_preloadImages('images/tit-nombre-over.jpg')
MM_preloadImages('images/tit-telefono-over.jpg')
MM_preloadImages('images/tit-titular-over.jpg')
}


function emptyvalidation(entered, alertbox)
{
// Emptyfield Validation by Henrik Petersen / NetKontoret
// Explained at www.echoecho.com/jsforms.htm
// Please do not remove this line and the two lines above.
with (entered)
{
if (value==null || value=="")
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
}
function formvalidation(thisform)
{
// This function checks the entire form before it is submitted
// Note: This function needs to be customized to fit your form
with (thisform)
{
	if (emptyvalidation(nombre_empresa,"La empresa no tiene nombre")==false) {nombre_empresa.focus(); return ;};
	if (emptyvalidation(username,"No ingresó un nombre de usuario")==false) {username.focus(); return ;};
	if (emptyvalidation(pass1,"No ingresó un password")==false) {pass1.focus(); return ;};
	if (pass1.value!=pass2.value) {
		alert("Los passwords no coinciden");
		pass1.value="";
		pass2.value="";
		pass1.focus();
		return;
		}
	if (pass1.value.length <6) {
		alert("El password debe tener almenos 6 caracateres");
		pass1.focus();
		return;
	}
}
	thisform.submit();
}<!--
function decision(url)
{
 var where_to= confirm("Seguro que desea borrar ese registro?");
 if (where_to== true) {
   window.location=url;
 }
}
 function formtrabajo(thisform)
{
// This function checks the entire form before it is submitted
// Note: This function needs to be customized to fit your form
with(thisform) {
	
if (emptyvalidation(nombre_trabajo,"El trabajo no tiene nombre")==false) {nombre_trabajo.focus(); return ;};


}
window.document.thisform.submit();
}
function validarinstancia(thisform)
{
	window.document.thisform.submit();
}
var newwindow;

function poptastic(url)
{
	newwindow=window.open(url,'name',scrollbars=0,toolbar=0,menubar=0);
	if (window.focus) {newwindow.focus()}
}

function popImg(imageURL) {
var imgWin = window.open('about:blank','imgWin','width=200, height=200, left=100, top=100');

with (imgWin.document) {
writeln('<html><head><title>Loading...</title>');
writeln('<style type="text/css"><!-- body { margin: 0px; } --></style></head>');
writeln('<body onload="self.focus();"><img id="pic" style="display:none" /></body></html>');
close();
}
var img = new Image();
img.onload = function() { sizeImgWin(imgWin, img) };
img.src = imageURL;
}

function sizeImgWin(win, img) {
var new_w = img.width;
var new_h = img.height;
var old_w = win.innerWidth || win.document.body.offsetWidth;
var old_h = win.innerHeight || win.document.body.offsetHeight;
if (!new_w) { new_w = old_w; }
if (!new_h) { new_h = old_h; }
new_w -= old_w; new_h -= old_h;
win.resizeBy(new_w,new_h);
win.document.title = img.src.substring(img.src.lastIndexOf("/")+1);
var pic = win.document.getElementById('pic');
pic.src = img.src;
pic.style.display = 'block';
}

// Funciones Show Hide and Drag
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);



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; }
}
function MM_showHide() { //v6.0
  var i,p,v,obj,args=MM_showHide.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')?'block':(v=='hide')?'none':v; }
    obj.display=v; }
}
function checkSelectRubro(){ 
    var indice = document.agregartrab.id_tipo.selectedIndex;
    var valor = document.agregartrab.id_tipo.options[indice].value ;
	if(valor==""){document.agregartrab.id_tipo.selectedIndex=indice+1;}
	if(valor=="raya"){document.agregartrab.id_tipo.selectedIndex=indice+2;}
} 
