// JavaScript Document

function  MostrarLoadImgJava( elemento, capa )
{
	if ( elemento ==2 )
		document.getElementById( capa ).style.display='';
	else
		document.getElementById( capa ).style.display="none";
}

function onchangefabricantes()
{
	var selecte = document.getElementById("brand");
	var indice = selecte.selectedIndex;
	var valor = selecte.options[indice].value;
	if(valor == -1)
	{
		new Ajax.Updater({success:'popupcont'}, '/admin/cell/newfab', {asynchronous:true, evalScripts:false, onComplete:function(request, json){Element.hide ('indicator');MostrarPopup('popup');Block_scr('separator');}, onLoading:function(request, json){Element.show ('indicator');}}); return false;
	}
}

function onchangeresoluciones()
{
	var selecte = document.getElementById("resoluciones");
	var indice = selecte.selectedIndex;
	var valor = selecte.options[indice].value;
	if(valor == -1)
	{	
		new Ajax.Updater({success:'popupcont'}, '/admin/celulares/newres', {asynchronous:true, evalScripts:false, onComplete:function(request, json){Element.hide ('indicator');MostrarPopup('popup');Block_scr('separator');}, onLoading:function(request, json){Element.show ('indicator');}}); return false;
	}
}

function reload_sel( id_element, destino, modulo, accion ){
  if( isNaN( document.getElementById( id_element ) ) ){
    dato = document.getElementById( id_element ).value;
    new Ajax.Updater( destino, '/admin/'+modulo+'/'+accion+'?Element='+dato, {asynchronous:true, evalScripts:true, onComplete:function(request){  Element.hide ( 'indicator' );}, onLoading:function(request){Element.show ( 'indicator' ); } } );
    return true;
  }else{
    return false;
  }
}

function reload_sel2( id_element, destino, modulo, accion ){
  if( isNaN( document.getElementById( id_element ) ) ){
    dato = document.getElementById( id_element ).value;
    new Ajax.Updater( destino, '/public/'+modulo+'/'+accion+'?Element='+dato, {asynchronous:true, evalScripts:true, onComplete:function(request){  Element.hide ( 'indicator' );}, onLoading:function(request){Element.show ( 'indicator' ); } } );
    return true;
  }else{
    return false;
  }
}

function reload_sel3( id_element, destino, modulo, accion ){
  if( isNaN( document.getElementById( id_element ) ) ){
    dato = document.getElementById( id_element ).value;
    new Ajax.Updater( destino, '/sites/'+modulo+'/'+accion+'?Element='+dato, {asynchronous:true, evalScripts:true, onComplete:function(request){  Element.hide ( 'indicator' );}, onLoading:function(request){Element.show ( 'indicator' ); } } );
    return true;
  }else{
    return false;
  }
}

function mostrar(nombreCapa){
  if( isNaN( document.getElementById( nombreCapa ) ) ){
    //document.getElementById( nombreCapa ).style.visibility="visible";
    document.getElementById( nombreCapa ).style.display="inline";
  }
}

//oculta un elemento por id
function ocultar(nombreCapa){
  if( isNaN( document.getElementById( nombreCapa ) ) ){
    //document.getElementById( nombreCapa ).style.visibility="hidden";
    document.getElementById( nombreCapa ).style.display="none";
  }
}

function AsignarValue( target, value )
{
  if( isNaN( document.getElementById( target ) ) ){
    document.getElementById( target ).value = value;
  }
}

