// JavaScript Document

/*******Actitivar Formulario*****/
function unBlock(){
var o1 = document.getElementById('disable');
var o2 = document.getElementById('disableAv');
var o4 = document.getElementById('alert');
	if (o1 != null) {
		o1.style.display="none";
	 }
	if (o2 != null) {
		o2.style.display="none";
	 }
	document.getElementById('breadcrumb').style.display="block";
	document.getElementById('container').className='showSelect';
	 if (o4 != null) {
		o4.style.display="block";
	 }


}
/*******End Actitivar Formulario*****/


/*******Display Block*****/

function displayBlock(idDiv){
	var theDiv = document.getElementById(idDiv);
	if (theDiv != null) {
		theDiv.style.display="block";
	}
}

function displayBlock2(idDiv,idDiv2){
	displayBlock(idDiv);
	displayBlock(idDiv2);
}

function displayBlock3(idDiv,idDiv2,idDiv3){
	displayBlock(idDiv);
	displayBlock(idDiv2);
	displayBlock(idDiv3);
}
/******End Display Block*****/

/*******Remove*****/
function remove(idDiv){
	var theDiv = document.getElementById(idDiv);
	if (theDiv != null) {
		theDiv.style.display="none";
	}
}
/******End Remove*****/

/*******Disable*****/
function disable(idDiv){
	var theDiv = document.getElementById(idDiv);
	if (theDiv != null) {
		theDiv.disabled=true;
	}
}
/******End Disable*****/

/******End removeIfAvailable*****/

/*******Ad Photo*****/
function adPhoto(){
	document.getElementById('add').style.visibility="visible";
}
/******End Add Photo*****/

/******Metodos de Exposicion*****/

function displayInLine(idDiv,idDiv2){
	document.getElementById(idDiv).style.display="inline";
	document.getElementById(idDiv2).style.display="none";
}
/******End Metodos de Exposicion*****/

/*******Popup*****/
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function newWindow(mylink, windowname)
{
	if (! window.focus) {
		return true;
	}
	var href;
	if (typeof(mylink) == 'string') {
	   href=mylink;
	} else {
	   href=mylink.href;
	}
	window.open(href, windowname, 'toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes');
	return false;
}
/******End Popup*****/

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
/************Filtro****************/
function muestraOculta(div1, div2){
	var o1 = document.getElementById(div1);
	var o2 = document.getElementById(div2);
	if (o1 != null && o2 != null ) {
        if (o1.style.display == 'none'){
          o1.style.display = 'block';
          o2.style.display = 'none';
		  } 
		  else  {
          o1.style.display = 'none';
          o2.style.display = 'block';
      }
	} 
	else{
		if (o1.style.display == 'none'){
			 o1.style.display = 'block';
		} 
		else  {
          o1.style.display = 'none';
		}		
	}
}
function muestraOculta3(div1, div2, div3){
	var o1 = document.getElementById(div1);
	var o2 = document.getElementById(div2);
	var o3 = document.getElementById(div3);
	      if (o1 != null) {
        if (o1.style.display == 'none'){
          o1.style.display = 'block';
		  o2.style.display = 'block';
          o3.style.display = 'none';
		  } else {
          o1.style.display = 'none';
		  o2.style.display = 'none';
          o3.style.display = 'block';
      }
	}
}

/*
function filter(opcion){
	//alert (opcion);
	var estado = opcion == 'nro';
	document.getElementById('startDate').disabled = estado;
	document.getElementById('endDate').disabled = estado;
	document.getElementById('concepto').disabled = estado;
	document.getElementById('nroReferencia').disabled = (estado == false);

	}
*/

function filter(opcion){ //opcion :  date | nro | lot
//	var estado = (opcion == 'nro');
	if (opcion == 'nro') {
	//Nro
		document.getElementById('startDate').disabled = true;
		document.getElementById('toDate').disabled = true;

    	if(document.getElementById('operationId')!=null){
			document.getElementById('operationId').disabled = true;
		}
		document.getElementById('referenceNumber').disabled = false;
		if (document.getElementById('lotId')!=null){
		document.getElementById('lotId').disabled = true;}
	}
	else if (opcion == 'date') {
	//REF
		document.getElementById('referenceNumber').disabled = true;
		document.getElementById('startDate').disabled = false;
		document.getElementById('toDate').disabled = false;
		if(document.getElementById('operationId')!=null){
			document.getElementById('operationId').disabled = false;
		}
		if (document.getElementById('lotId')!=null){
			document.getElementById('lotId').disabled = true;
			}
	}
	//LOT
	else if (opcion == 'lot') {
		document.getElementById('referenceNumber').disabled = true;
		document.getElementById('startDate').disabled = true;
		document.getElementById('toDate').disabled = true;
		 if(document.getElementById('operationId')!=null){
			document.getElementById('operationId').disabled = true;
		}
		if (document.getElementById('lotId')!=null){
			document.getElementById('lotId').disabled = false;
		}
	}
	else {
		alert('Error en la llamada');
	}
}
/*Para elegir categorķa en PUBLICACION*/
function muestra(id) {
	if(document.getElementById(id).value=="1"){
	document.getElementById('subcategorias').style.display="block";
	}
	else if(document.getElementById(id).value=="2"){
		document.getElementById('sub2categorias').style.display="block";

		}
		else if(document.getElementById(id).value=="3"){
		document.getElementById('sub3categorias').style.display="block";
		}
		else if(document.getElementById(id).value=="4"){
		document.getElementById('check_ok').style.display="block";
		window.document.getElementById('check_ok').focus();
		}
	else{
	document.getElementById('categorias').style.display="block";
	}
}
var estado=0;
function displayBlock5() {
	if(estado==0){
		document.getElementById('mp1').style.display="block";
		 estado=1;
		}
	else if(estado==1){
		document.getElementById('mp2').style.display="block";
		 estado=2;
		}
	else if(estado==2){
		document.getElementById('mp3').style.display="block";
		 estado=3;
		}
	else if(estado==3){
		document.getElementById('mp4').style.display="block";
		 estado=4;
		}
}

 function OpenWindow(win)
    {
      window.open (win, "", "width=370,height=125,scrollbars=yes");
    }

