// JavaScript Document
	var browser=navigator.appName;
	var b_version=navigator.appVersion;
	var version=parseFloat(b_version);
	var links = new Array();

	function callFn(fn){
		return eval(fn);
	}

	function callPage(page, fn){
		if(document.getElementById('ajaxnav').src!='getback_process.php?hash=' + page){
			links[page] = fn;
			document.getElementById('ajaxnav').src = 'getback_process.php?hash=' + page;
			//callFn(fn);
		}
	}
	

function resalta(id, accion){
		
		/*if(accion == 'in'){
			document.getElementById('frm_' + id).style.backgroundColor = '#FFFFFF';	
		}else{
			document.getElementById('frm_' + id).style.backgroundColor = '#FFFFFF';				
		}*/
		return true;
	}
function editItem(mod, id){
		callPage(mod + '_edit_' + id, 'llamarasincrono(\'form.php?type=edit&mod=' + mod + '&id=' + id + '&nocache=' + new Date().getTime() + '\',\'right_content\',1)');
	}
function viewItem(mod, id){
		popView(mod,id);
	}
function newItem(mod){
		if(document.treeForm){
			parentId = document.treeForm.parentId.value;	
		}else{
			parentId = '';	
		}
		callPage(mod + '_new', 'llamarasincrono(\'form.php?type=new&mod=' + mod + '&parentId=' + parentId + '&nocache=' + new Date().getTime() + '\',\'right_content\',1)');	
	}	
function deleteItem(mod, id){
		callPage(mod + '_delete', 'llamarasincrono(\'core.php?action=delete&mod=' + mod + '&id='+ id +'&nocache=' + new Date().getTime() + '\',\'core\')');	
	}	
function deleteItemId(gId){
		callPage(gId + '_delete', 'llamarasincrono(\'core.php?action=delete&gId=' + gId + '&nocache=' + new Date().getTime() + '\',\'core\')');	
	}	

function setFecha(id, value){
		document.getElementById(id + '_txt').innerHTML = '<b>' + value + '</b>';
	}
function changeColor(id, val){
		document.getElementById('color_' + id).style.backgroundColor=val;
	}
function showAreas(id, mod){
	st = document.getElementById(id).style.display;
	if(st == 'none'){
		if(browser=='Netscape'){
			disp = 'table-row';
		}else{
			disp = 'block';
		}
		document.getElementById(id).style.display = disp;
		if(id=='dynParamsArea'){
		callPage(mod + '_params','llamarasincrono(\'params.php?nocache=' + new Date().getTime() + '&mod=' + mod + '\',\'right_content\')');	
		}	
	}else{
		document.getElementById(id).style.display = 'none';		
	}	
}
function showEditMailing(){
	if(browser=='Netscape'){
		disp = 'table-row';
	}else{
		disp = 'block';
	}
	document.getElementById('Mailing_new_list_area').style.display = disp;	
}
function modSearch(mod, cleanP){
	if(cleanP==1){
		document.formSearch.pagina.value=1;
	}	
	enviaFormulario('right_content.php','formSearch','right_content','search');	
}
function globalSearch(keyword){
		callPage('global_search_' + new Date().getTime(),'llamarasincrono(\'globalSearch.php?nocache=' + new Date().getTime() + '&keyword=' + keyword + '&search=true\',\'right_content\')');	
	document.formTop.global_keyword.value = '';
}
function verifyEnterSubmit(type){
	if (window.event && window.event.keyCode == 13){
		switch(type){
			case 'globalSearch':
				globalSearch(document.formTop.global_keyword.value);	
			break;
			case 'modSearch':
				modSearch(document.formSearch.mod.value, 1);	
			break;
		}
	}else{
		return false;	
	}
}
function checkProfile(id){
	tipoItem = id.substr(0,1);
	tipoValor = id.substr(1,1);
	idNum = id.substr(3);
	estado = document.getElementById(id).checked;
	if(estado==true){
		accion = true;	
	}else{
		accion = false;	
	}
	if(tipoItem=='a'){
		if(estado==true){
			switch(tipoValor){
				case 'R':
					tipos = Array('R');	
				break;
				case 'W':
					tipos = Array('R','W');	
					document.getElementById('aR_' + idNum).checked = true;
				break;
				case 'E':
					tipos = Array('R','W','E');	
					document.getElementById('aR_' + idNum).checked = true;
					document.getElementById('aW_' + idNum).checked = true;
				break;							
			}
		}else{
			switch(tipoValor){
				case 'E':
					tipos = Array('E');	
				break;
				case 'W':
					tipos = Array('W','E');	
					document.getElementById('aE_' + idNum).checked = false;
				break;
				case 'R':
					tipos = Array('R','W','E');	
					document.getElementById('aW_' + idNum).checked = false;
					document.getElementById('aE_' + idNum).checked = false;
				break;							
			}			
		}
		for (var i=0; i<document.dynform.elements.length; i++) { 
			obj = document.dynform.elements[i];
			objId = obj.id;
			for(var e=0; e<tipos.length; e++){
				if(obj.type == 'checkbox' && objId.substr(1,1)==tipos[e]){
					if(obj.parent == String(tipoItem + idNum)){
						obj.checked = accion;					
					}
				}
			}	
		} 		 
	}else if(tipoItem=='m'){
		if(estado==true){
			areaId = document.getElementById(id).getAttribute('parent').substr(1);				
			switch(tipoValor){
				case 'R':
					document.getElementById('aR_' + areaId).checked = true;
				break;
				case 'W':
					document.getElementById('aR_' + areaId).checked = true;					
					document.getElementById('aW_' + areaId).checked = true;				
					document.getElementById('mR_' + idNum).checked = true;				
				break;
				case 'E':
					document.getElementById('aR_' + areaId).checked = true;
					document.getElementById('aW_' + areaId).checked = true;
					document.getElementById('aE_' + areaId).checked = true;				
					document.getElementById('mR_' + idNum).checked = true;				
					document.getElementById('mW_' + idNum).checked = true;				
				break;				
			}
		}else{
			switch(tipoValor){
				case 'R':
					document.getElementById('mW_' + idNum).checked = false;				
					document.getElementById('mE_' + idNum).checked = false;				
				break;
				case 'W':
					document.getElementById('mE_' + idNum).checked = false;				
				break;
			}
		}	
	}
}

function textFade(id, txt){
	document.getElementById(id).innerHTML = '<font style="color:#cc0000">' + txt + '</font>';
	setTimeout("textFade('" + id + "','&nbsp;')",1000);
}	
function paginar(mod, pag){
	document.formSearch.pagina.value=pag;
	modSearch(mod);
}
function orderBy(mod, field, az){
	document.formSearch.order.value=field;
	document.formSearch.az.value=az;
	modSearch(mod);
}
function openHeaderIframe(){
	if(browser=='Netscape'){
		disp = 'table-row';
	}else{
		disp = 'block';
	}
	document.getElementById('header_app').style.display = disp;		
}
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];}}
}

