	//Variable Global, para manejo de si un atributo es modificado o no
	var oldValue="";
	var oldValueClase="";
			
	var globalId = "";
	var globalIdMembersGroup = "";	
	var globalIdMessage="";			
	var globalTexto="";			
	var pos2 = ''
	var IdEntity = ''
	var swjava = 0
	var IdHtmlEditor = 0
	ie = document.all?1:0
	ns4 = document.layers?1:0

	var sw   = 0
	var num  = 0
	var swOC = 0

	
	function load_eventos(){
		eval(globalTexto)
		for (i=0;i<document.formulario.length;i++){
			if(document.formulario.elements[i].type!='hidden' && document.formulario.elements[i].type!='button' && document.formulario.elements[i].type!='submit' && document.formulario.elements[i].readOnly!=true){

			   document.formulario.elements[i].tabIndex = i
		        }else{
		          if(document.formulario.elements[i].type!='button' || document.formulario.elements[i].type!='submit'){
		            document.formulario.elements[i].tabIndex = 1000
		          }  
		        }

			     if(document.formulario.type_from){
			     	if(document.formulario.type_from.value!='') {
				     if(document.formulario.elements[i].type=='select-one'){
				        var StrName = document.formulario.elements[i].name
				        if(StrName.search('tp_entidad')!=-1){
				           for(j=0;j<document.formulario.elements[i].length;j++){
				           	if(document.formulario.elements[i][j].value==document.formulario.type_from.value){
				           	   document.formulario.elements[i].selectedIndex=j
						   break				           		
			           		}
				           }
				        }   
				     }       
			        }        
		       
		            } 
		}	
		
			try {	                
									tabPane1.tabPane.setSelectedIndex(0)
										/*
		                var swTabSel = tabPane1.tabPane.selectedIndex + 1
		                if(tabPane1.tabPane.pages.length<swTabSel)
		                   tabPane1.tabPane.setSelectedIndex(tabPane1.tabPane.pages.length-1)
		                */   
      }
			catch(e) {
				
			}	                   
			
		
		
	}
	
	function adjustIFrameSize(iframeWindow) {
	  if (iframeWindow.document.height) {
	    var iframeElement = parent.document.getElementById(iframeWindow.name);
	    	iframeElement.style.height = iframeWindow.document.height + 'px';
	    	iframeElement.style.width = iframeWindow.document.width + 'px';
	  }
	  else if (document.all) {
	    var iframeElement = document.all[iframeWindow.name];
	    if (iframeWindow.document.compatMode && iframeWindow.document.compatMode != 'BackCompat') 
	    {
	      iframeElement.style.height = iframeWindow.document.documentElement.scrollHeight + 15 + 'px';
	      iframeElement.style.width = iframeWindow.document.documentElement.scrollWidth + 15 + 'px';
	    }
	    else {
	    	if(iframeElement){
		      iframeElement.style.height = iframeWindow.document.body.scrollHeight  +'px'; //+ 15
		      iframeElement.style.width = iframeWindow.document.body.scrollWidth + 'px';
		}      
	    }
	  }
	}

	function adjustIFrameSize2(iframeWindow) {
	  if (iframeWindow.document.height) {
	    var iframeElement = parent.document.getElementById(iframeWindow.name);
	    	iframeElement.style.height = iframeWindow.document.height + 'px';
	    	iframeElement.style.width = iframeWindow.document.width + 'px';
	  }
	  else if (document.all) {
	    var iframeElement = document.all[iframeWindow.name];
	    if (iframeWindow.document.compatMode && iframeWindow.document.compatMode != 'BackCompat') 
	    {
	      iframeElement.style.height = iframeWindow.document.documentElement.scrollHeight + 15 + 'px';
	      iframeElement.style.width = iframeWindow.document.documentElement.scrollWidth + 15 + 'px';
	    }
	    else {
	      iframeElement.style.height = iframeWindow.document.body.scrollHeight + 16 + 'px'; //+ 15
	      iframeElement.style.width = iframeWindow.document.body.scrollWidth + 16 + 'px';
	    }
	  }
	}

	function adjustIFrameSize3(iframeWindow) {
	  if (iframeWindow.document.height) {
	    var iframeElement = parent.document.getElementById(iframeWindow.name);
	    	iframeElement.style.height = iframeWindow.document.height + 'px';
	    	iframeElement.style.width = iframeWindow.document.width + 'px';
	  }
	  else if (document.all) {
	    var iframeElement = document.all[iframeWindow.name];
	    if (iframeWindow.document.compatMode && iframeWindow.document.compatMode != 'BackCompat') 
	    {
	      iframeElement.style.height = iframeWindow.document.documentElement.scrollHeight + 20 + 'px';
	      iframeElement.style.width = "100%"
	    }
	    else {
	      iframeElement.style.height = iframeWindow.document.body.scrollHeight + 20 + 'px'; //+ 15
	      iframeElement.style.width = "100%"
	    }
	  }
	}
	
function change_content(layername,content){
	
   if(document.getElementById(layername)){
   		document.getElementById(layername).innerHTML=content;
      /*window.document.layers[layername].document.open();            
      window.document.layers[layername].document.write("<font face='Verdana, Arial, Helvetica, sans-serif' size=1>("+content+")</font>");
      window.document.layers[layername].document.close();   
      */
   }
   if(window.document.all)
      window.document.all[layername].innerHTML= content;
      
      
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
   var r, re;                    //Declare variables.
   var ss = winName
   re = / /g;             //Create regular expression pattern.
   winName = ss.replace(re, "_");    //Replace " " with "_".
   window.open(theURL,winName,features);
}



	
function ChargeIframeButtonNew(TypeEntityActive,num,type_entIni,strcampo){
		if(strcampo.search('__')!=-1){
			 if(document.formulario.TypeAttRelacion){
				 type_entIni = document.formulario.TypeAttRelacion.value
				 //num = num.replace('__1','')
				 //strcampo = strcampo.replace('__1','')
			 }	
		}	

    if(TypeEntityActive==''){
    	if(MsgAlertLookup)
    	   alert(MsgAlertLookup)
    	else
    	   alert("Revisar relación")
    	return	
    }
    

    
    document.frames['FrameTempLoad'].location.href='../aspx/Add_object_button_Right.aspx?Action=ButtonNew&TypeEntityActive='+TypeEntityActive+"&type_entIni="+type_entIni+"&strcampo="+strcampo+"&num="+num
    return
}


function redir(nameatt,sfile,type_entity){
    
	var frm = parent.document.frames;
    Framecount = frm.length

		var ObjFiledown=eval("document.formulario."+nameatt)
		if (ObjFiledown){
			sfile2=ObjFiledown.value
			var ArraynameFileDownload = sfile2.split("/")			
			//if(ArraynameFileDownload[0]!=sfile){
			//	 sfile = ArraynameFileDownload[0]
				 // para verificar con RCONCHA
			//}
		}

  if (type_entity!=''){
          //var nameatt = 'document.formulario.Download_'+ nameatt 
          //nameatt = eval(nameatt)
          //var sfile = nameatt.value
          sfile   = sfile.replace("\/","\\")
	  			sfile   = sfile.replace("Ã¡","á")
	  			sfile   = sfile.replace("Ã©","é")
	  			sfile 	= sfile.replace("Ã­","í")
	  			sfile 	= sfile.replace("Ã³","ó")
	  			sfile 	= sfile.replace("Ãº","ú")
	  			sfile 	= sfile.replace("Ã±","ñ")
	  			sfile 	= sfile.replace("\/","\\")
	  			sfile 	= sfile.replace("Ã³","ó")
	  			//sfile 	= sfile.replace("Ã","Ñ")

	  			
	  			
					//sfile 	= sfile.replace("Ã€", "À")
					//sfile 	= sfile.replace("Ã‰", "É") 
					//sfile 	= sfile.replace("Ã*", "í") 
					//sfile 	= sfile.replace("Ã“", "Ó") 
					

          //alert('../../h2_sales/asp/download_files.asp?strFileName='+ sfile +'&amp;Strtype=s_file')

		if(type_entity==3){
		   location.href = '../../h2_sales/asp/download_files.asp?strFileName='+ sfile +'&amp;Strtype=s_file&amp;nameatt='+nameatt+'&amp;type_entity='+type_entity
		   return
		 }
	   
          
          if(Framecount==4){
          	//alert('1.1')
			parent.frames('f00').location.href = '../../h2_sales/asp/download_files.asp?strFileName='+ sfile +'&amp;Strtype=s_file&amp;nameatt='+nameatt+'&amp;type_entity='+type_entity 
		  }
	      else
	      {
	       //alert('2')
	      if(sfile.search('.htm')!=-1)
	      		window.open('../../h2_sales/asp/download_files.asp?strFileName='+ sfile +'&amp;Strtype=s_file&amp;nameatt='+nameatt+'&amp;type_entity='+type_entity,'Download','left=200,top=100,width=500,height=400,toolbar=0, scrollbars=yes,resizable=yes')
	      else
		      location.href = '../../h2_sales/asp/download_files.asp?strFileName='+ sfile +'&amp;Strtype=s_file&amp;nameatt='+nameatt+'&amp;type_entity='+type_entity 
	      
		  }
		}else{
        sfile = sfile.replace("Ã¡","á")
        sfile = sfile.replace("Ã©","é")
        sfile = sfile.replace("Ã­","í")
        sfile = sfile.replace("Ã³","ó")
        sfile = sfile.replace("Ãº","ú")
        sfile = sfile.replace("Ã±","ñ")
       // sfile 	= sfile.replace("Ã","Ñ")
        sfile = sfile.replace("\/","\\")
        
        if(Framecount==4)
 	   parent.frames('f00').location.href = '../../h2_sales/asp/download_files.asp?strFileName='+ sfile +'&amp;Strtype=s_file&amp;nameatt='+nameatt+'&amp;type_entity='+document.formulario.tipoentidad.value
 	else   
 	   location.href = '../../h2_sales/asp/download_files.asp?strFileName='+ sfile +'&amp;Strtype=s_file&amp;nameatt='+nameatt+'&amp;type_entity='+document.formulario.tipoentidad.value
 }	  
}



	function adjustIFrameSizeLookup(iframeWindow) {
	  if (iframeWindow.document.height) {
	    var iframeElement = parent.document.getElementById(iframeWindow.name);
	    	iframeElement.style.height = iframeWindow.document.height + 'px';
	    	iframeElement.style.width = iframeWindow.document.width + 'px';
	  }
	  else if (document.all) {
	    var iframeElement = document.all[iframeWindow.name];
	    if (iframeWindow.document.compatMode && iframeWindow.document.compatMode != 'BackCompat') 
	    {
	      iframeElement.style.height = iframeWindow.document.documentElement.scrollHeight + 'px';
	      iframeElement.style.width = iframeWindow.document.documentElement.scrollWidth + 'px';
	    }
	    else {
	      iframeElement.style.height = iframeWindow.document.body.scrollHeight + 'px'; //+ 15
	      iframeElement.style.width =  iframeWindow.document.body.scrollWidth + 'px';
	    }
	  }
	}
