
function open_video(vID){
	window.open('index.asp?action=content.disclaimer&id_video='+vID+'&id_class=<%=param("id_class")%>&id_content=<%=param("id_content")%>','video','width=820,height=550,resizable=yes,scrollbars=yes');
}

function open_doc(isLink,url,documentName){
	if(isLink == 1){
		window.open(url,'doc','');						
	}else{
		window.open('files/documents/document/'+documentName,'doc','width=820,height=550,resizable=yes,scrollbars=yes');						
	}
	
	
}


function handleKeyPress(e,form){
	var key=e.keyCode || e.which;
	//alert(window.event.keyCode)
		if (key==13){
			window.event.keyCode =0;
		}

		
	}

	function handleCtrlKey(e,form){
	var key=e.keyCode || e.which;
		if (key==118){
			//alert("enter");
			window.event.keyCode =0;
		}
	}

//=================

//bloqueo click derecho
function denyRightMouse(){
	 if(event.button == 2 || event.button == 3)
	 {
		  alert("Click derecho bloqueado");
		  //window.event.keyCode = 555;  
		  return false;
	 }
 }
//====================

//Bloqueo de teclas SuperHiperStrong
 function funDown()
 {
 var pressedKey = String.fromCharCode(event.keyCode).toLowerCase();
   if (event.ctrlKey && (pressedKey == "n" || pressedKey == "r" || pressedKey == "u" ||
  pressedKey == "q" || pressedKey == "w" || pressedKey == "i" ||
  pressedKey == "o" || pressedKey == "p" || pressedKey == "a" ||
  pressedKey == "v"))
 {
     alert("Comando inválido");            
     return false;
 }
 
 //Bloquea la tecla Ctrl+Insert   
 if (event.ctrlKey && window.event.keyCode == 45)
 {
    alert("Comando inválido"); 
     return false;
 }

 //Captura la tecla BackSpace
 if(window.event && window.event.keyCode == 8) 
 {
	  alert("Comando inválido");   
	  window.event.keyCode = 555;     
	  return false;
 }
 
 //Captura la tecla Tab
 if(window.event && window.event.keyCode == 9) 
 {
      alert("Comando inválido"); 
	  window.event.keyCode = 555;  
	  return false;
 }  
 
 //Captura la tecla F5
 if(window.event && window.event.keyCode == 116) 
 {
	  alert("Comando inválido"); 
	  window.event.keyCode = 555;  
	  return false;
 }  
 
 //Captura la tecla F11
 if(window.event && window.event.keyCode == 122) 
 {
	  alert("Comando inválido"); 
	  window.event.keyCode = 555;  
	  return false;
 }  
 
 //Captura la tecla Alt y AltGr que manejan el mismo ASCII
 if(window.event && window.event.keyCode == 18) 
 {
	  alert("Comando inválido"); 
	  window.event.keyCode = 555;  
	  return false;
 }  
 
 //Captura la tecla que saca la ventana emergente, simulando click  //derecho con el ratón
 if(window.event && window.event.keyCode == 93) 
 {
	  alert("Comando inválido"); 
	  //window.event.keyCode = 555;  
	  return false;
 }

 if(event.button == 2 || event.button == 3)
 {
	 alert("Comando inválido"); 
	  //window.event.keyCode = 555;  
	  return false;
 }
 
 return true;
 }
 //==================00
	
	/* class roll over */
	function roll_over(obj,state,clas){
		obj.className = clas;
	}
	
	/*validate max chars*/
	
	function maxChars(str,maxChar){
	
	for (var i = str.length ; i > 1; i--){
		tmpStr = str.substring(i,str.length)

			if(str.charAt(i) == '\\'){
				document.write(tmpStr)
					if(tmpStr.length > maxChar){
					
						break;					
						return false;
						
						
					}				
				}
		}
	}
	
	/*prevent enterKey form submit*/
	function KeyPress()	{
		//alert(window.event.keyCode)
		if (window.event.keyCode == 13)
		window.event.keyCode =0;
	}
	/*check date 00/00/0000*/

		function esDigito(sChr){
		var sCod = sChr.charCodeAt(0);
		return ((sCod > 47) && (sCod < 58));
		}
		function valSep(oTxt){
		var bOk = false;
		bOk = bOk || ((oTxt.value.charAt(2) == "-") && (oTxt.value.charAt(5) == "-"));
		bOk = bOk || ((oTxt.value.charAt(2) == "/") && (oTxt.value.charAt(5) == "/"));
		return bOk;
		}
		function finMes(oTxt){
		var nMes = parseInt(oTxt.value.substr(3, 2), 10);
		var nRes = 0;
		switch (nMes){
		case 1: nRes = 31; break;
		case 2: nRes = 29; break;
		case 3: nRes = 31; break;
		case 4: nRes = 30; break;
		case 5: nRes = 31; break;
		case 6: nRes = 30; break;
		case 7: nRes = 31; break;
		case 8: nRes = 31; break;
		case 9: nRes = 30; break;
		case 10: nRes = 31; break;
		case 11: nRes = 30; break;
		case 12: nRes = 31; break;
		}
		return nRes;
		}
		function valDia(oTxt){
		//alert("dia:"+parseInt(oTxt.value.substr(3, 2), 10));
		var bOk = true;
		var nDia = parseInt(oTxt.value.substr(3, 2), 10);
		bOk = bOk || ((nDia >= 1) && (nDia <= finMes(oTxt)));
		return bOk;
		}
		function valMes(oTxt){
		//alert(parseInt(oTxt.value.substr(0, 2), 10));
		var bOk = true;
		var nMes = parseInt(oTxt.value.substr(0, 2), 10);
		bOk = bOk || ((nMes >= 1) && (nMes <= 12));
		return bOk;
		}
		function valAno(oTxt){
		var bOk = true;
		var nAno = oTxt.value.substr(6);
		bOk = bOk && ((nAno.length == 2) || (nAno.length == 4));
		if (bOk){
		for (var i = 0; i < nAno.length; i++){
		bOk = bOk && esDigito(nAno.charAt(i));
		}
		if (nAno > 1900 && nAno < 2200){
				alert(nAno);
				bOk = false;
			}
		}
		return bOk;
		}
		function valFecha(oTxt){
		var bOk = true;
		if (oTxt.value != ""){
		bOk = bOk && (valAno(oTxt));
		bOk = bOk && (valMes(oTxt));
		bOk = bOk && (valDia(oTxt));
		bOk = bOk && (valSep(oTxt));
		b0k = true;
		if (!bOk){
		alert("Fecha inválida");
		oTxt.value = "";
		oTxt.focus();
		}
		}
		}

	/*--*/
	/* remove trailing and leading blanks from a string */
	function trim(s) {
		while (s.substring(0,1) == ' ') {
			s = s.substring(1,s.length);
		}
		while (s.substring(s.length-1,s.length) == ' ') {
			s = s.substring(0,s.length-1);
		}
		return s;
	}
	
	/* check if object is an array */
	function isArray(obj){
		return(typeof(obj.length)=="undefined")?false:true;
	}

	/* basic form validation */
	function checkForm(poForm){
	//alert(poForm.id_type.selectedIndex);
		for(i=0; i<poForm.elements.length; i++){
		
		
		//custom validations I
		if(poForm.elements[i].accept!=null){
			if(trim(poForm.elements[i].accept)!=''){


			//check only valid characters
				if((trim(poForm.elements[i].value) != "")&&(poForm.elements[i].accept=="chars")){	
					if (!validName(poForm.elements[i].value)){	
						alert('Debe escribir caracteres válidos: //:?>¿¡!$@1234567890ABCDEFGHIJKLMNÑOPQRSTUVWXYZabcdefghijklmnñopqrstuvwxyz -_.,ÁÉÍÓÚáéíóú');
						poForm.elements[i].focus();
						return false;	
					}								
				}	
				
			//check only valid characters with out focus
				if((trim(poForm.elements[i].value) != "")&&(poForm.elements[i].accept=="charsnf")){	
					if (!validName(poForm.elements[i].value)){	
						alert('Debe escribir caracteres válidos: //:?>¿¡!$@1234567890ABCDEFGHIJKLMNÑOPQRSTUVWXYZabcdefghijklmnñopqrstuvwxyz -_.,ÁÉÍÓÚáéíóú');
						return false;	
					}								
				}			
				
			//check only valid characters with out focus
				if((trim(poForm.elements[i].value) != "")&&(poForm.elements[i].accept=="charscolor")){	
					if (!validColor(poForm.elements[i].value)){	
						alert('Debe escribir caracteres válidos: //:#$>1234567890ABCDEFGHIJKLMNÑOPQRSTUVWXYZabcdefghijklmnñopqrstuvwxyz');
						return false;	
					}								
				}			
				
				//check length
				if((trim(poForm.elements[i].value) != "")&&(poForm.elements[i].alt=="length275")){
					if(poForm.elements[i].value.length>275){
						alert("Longitud mayor a 275 caracteres");
							poForm.elements[i].focus();
 						  return false;
					}
				}												
								
							
			}
			}			
		
		
			if(poForm.elements[i].lang == "true"){
				//alert(poForm.elements[i].type);

			//check checkboxes	
			if((trim(poForm.elements[i].value) != "")&&(poForm.elements[i].alt=="strongCheckBox")){
				laPalomita = eval("poForm."+poForm.elements[i].name);
				checada = false;
				if(isArray(laPalomita)){
					for(j=0; j<laPalomita.length; j++){
						if(laPalomita[j].checked)
							checada = true;
					}
				} else{
					if(laPalomita.checked)
						checada = true;
				}
				
				if(!checada){
					if(isArray(laPalomita)){
						alert(laPalomita[0].title);
						laPalomita[0].focus();
					} else{
						alert(laPalomita.title);
						laPalomita.focus();
					}
					return false;
				}				
			}
			//=============================
			
			//check sourcerew <<CUSTOM>>

		 //=============================
				
				switch (poForm.elements[i].type) {				
					case "text":
					case "password":
					case "textarea":
					case "file":
						if(trim(poForm.elements[i].title)!=""){
							if(trim(poForm.elements[i].value) == ""){
								alert(poForm.elements[i].title);
								poForm.elements[i].value = "";
								poForm.elements[i].focus();
								return false;
							}
						}
						//custom validations
						if(poForm.elements[i].accept!=null){
							if(trim(poForm.elements[i].accept)!=''){							
							
							}
						}							
							
						if(poForm.elements[i].alt!=null){
							if(trim(poForm.elements[i].alt)!=''){							
								//check email address
									if((trim(poForm.elements[i].value) != "")&&(poForm.elements[i].alt=="email")){
										var b = poForm.elements[i].value
										var temp = new Array();
										temp = b.split(',');
									for (irf=0; irf<temp.length; irf++){
											//alert(temp[irf]);
										if(!emailCheck(temp[irf])){
											alert("Escriba una direccion de e-mail válida");
											poForm.elements[i].focus();
											return false;
										}
									}
								}
								//check numeric values
								if((trim(poForm.elements[i].value) != "")&&(poForm.elements[i].alt=="numeric")){
									if(!checknumber(poForm.elements[i].value)){
										alert("El campo debe ser tipo numérico");
										poForm.elements[i].focus();
										return false;
									}
								}
								
								
								//check valid files
								if((trim(poForm.elements[i].value) != "")&&(poForm.elements[i].alt=="file")){
									var tmp_file_obj = poForm.elements[i];
									var tmp_file_name = trim(poForm.elements[i].value);
									var tmp_file_types = trim(poForm.elements[i].accept);
								
									if(!checkfiletype(tmp_file_name,tmp_file_types)){
										alert("Archivo inválido, verifique el tipo de archivo.");
										tmp_file_obj.focus();
										return false;
									}
									
									if (!checkfilename(tmp_file_name)){
										alert("El nombre del archivo no puede contener caracteres especiales como letras acentuadas o espacios");
										tmp_file_obj.focus();
										return false;
									}
								}
							}
						}
						break;
						
					case "radio":
						elradio = eval("poForm."+poForm.elements[i].name);
						checado = false;
						if(isArray(elradio)){
							for(j=0; j<elradio.length; j++){
								if(elradio[j].checked)
									checado = true;
							}
						} else{
							if(elradio.checked)
								checado = true;
						}
						if(!checado){
							if(isArray(elradio)){
								alert(elradio[0].title);
								elradio[0].focus();
							} else{
								alert(elradio.title);
								elradio.focus();
							}
							return false;
						}
						break;
					case "select-one":
						//alert("Ok.OK"+poForm.elements[i].name);
						if(poForm.elements[i].alt!= null){
						
							if(trim(poForm.elements[i].alt)!=''){
							//custom validations
								if(poForm.elements[i].alt =='checkSourceNew'){
								//alert("aqui");
									if(poForm.id_type.selectedIndex == 1){
									
										if(poForm.id_source.selectedIndex == 0){
												alert("Seleccione la fuente de la noticia.");
												poForm.id_source.focus();
												return false
											}
											
									}
								}
							}
							
						}else{
							//original
							if(poForm.elements[i].selectedIndex < 1){
								alert(poForm.elements[i].title);
								poForm.elements[i].focus();
								return false;
							}
							//end original
						}
						break;
						
						
						
					case "select-multiple":
						if(poForm.elements[i].selectedIndex < 1){
							alert(poForm.elements[i].title);
							poForm.elements[i].focus();
							return false;
						}
						break;
				}
			}
		}
		return true;
	}
	
	/*Validate special characters*/
	/*******************************
	CAMBIO EN PFIZER 
	OJO. Oscar Jiménez hizo este cambio en su copia de archivo.
	********************************/
	function validName(checkStr) {
	 var checkOK = "////:?>¿¡!$@1234567890ABCDEFGHIJKLMNÑOPQRSTUVWXYZabcdefghijklmnñopqrstuvwxyz -_.,ÁÉÍÓÚáéíóú\r\n\"\+;()"; 
 
	 for (h = 0; h < checkStr.length; h++) { 
	  ch = checkStr.charAt(h); 
  	for (j = 0; j < checkOK.length; j++) 
	   if (ch == checkOK.charAt(j)) { break }
	    if (j == checkOK.length) { 
		//alert (checkOK.charAt(j));
		return false }
	 }	
	 return true;
	 }
	 
	/*Validate special characters*/
	function validColor(checkStr) {
	 var checkOK = "//:#$>1234567890ABCDEFGHIJKLMNÑOPQRSTUVWXYZabcdefghijklmnñopqrstuvwxyz"; 
 
	 for (h = 0; h < checkStr.length; h++) { 
	  ch = checkStr.charAt(h); 
  	for (j = 0; j < checkOK.length; j++) 
	   if (ch == checkOK.charAt(j)) { break }
	    if (j == checkOK.length) { return false }
	 }	
	 return true;
	 }	 
	
	/* validates an email address */
	function emailCheck(emailStr) {
		var emailPat=/^(.+)@(.+)$/
		var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
		var validChars="\[^\\s" + specialChars + "\]"
		var quotedUser="(\"[^\"]*\")"
		var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
		var atom=validChars + '+'
		var word="(" + atom + "|" + quotedUser + ")"
		var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
		var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
		var matchArray=emailStr.match(emailPat)
		if (matchArray==null) {
			return false
		}
		var user=matchArray[1]
		var domain=matchArray[2]
		if (user.match(userPat)==null) {
		    return false
		}
		var IPArray=domain.match(ipDomainPat)
		if (IPArray!=null) {
			for (var i=1;i<=4;i++) {
				if (IPArray[i]>255) {
					return false
				}
			}
			return true
		}
		var domainArray=domain.match(domainPat)
		if (domainArray==null) {
			return false
		}
		var atomPat=new RegExp(atom,"g")
		var domArr=domain.match(atomPat)
		var len=domArr.length
		if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3) {
			return false
		}
		if (len<2) {
			alert(errStr)
			return false
		}
		return true;
	}
	
	/* open window */
	function openWin(Addr, Name, Options){
		var tmp = window.open(Addr, Name, Options);
	}
	
	/* validates a number */	
	function checknumber(poField){
		var x=poField;
		var anum=/(^\d+$)|(^\d+\.\d+$)/;
		if (anum.test(x))
			testresult=true;
		else{
			testresult=false;
		}
		return (testresult);
	}
	
	/* check if filename contains special chars */
	function checkfilename(fileName) {
		var donde = fileName.lastIndexOf('\\');
		var ArregloChars = new Array('á','é','í','ó','ú',' ','ñ','Á','É','Í','Ó','Ú','Ñ','/','*','?');
		for(indPet=0;indPet<16;indPet++) {
		
		if(fileName.indexOf(ArregloChars[indPet], donde) >= 0) {
				return false;
			}
		}
		return true;
	}	
	
	/* check if file is of specified type */
	function checkfiletype(filePath, fileTypes) {
		var fileName = new Array();
		fileName = filePath.split('.');
		var fileExt = fileName[fileName.length-1];
		fileExt = fileExt.toLowerCase()
		var aFileTypes = fileTypes.split(',');
		var counter=0;
		var found=0;
		while (counter < aFileTypes.length) {
			if(fileExt==aFileTypes[counter]) {
				found=1;
				break;
			}
		  counter+=1;
		}
		if(!found) {
			return false;
		}
		return true;
	}
	
	/* show and hide a block */
	function displayBlock(elemID) {
		var DataID = elemID;
		if (DataID.style.display=="block") {
			DataID.style.display="none";
		} else {
			DataID.style.display="block";
		}
	}
	
	function showBlock(elemID) {
		var DataID = elemID;
		DataID.style.display="block";
	}
	
	function hideBlock(elemID) {
		var DataID = elemID;
		DataID.style.display="none";
	}
	
	/* promts user logout */												
	function doLogout(pURL){
		if (window.confirm('¿Está seguro que desea terminar la sesión?'))
			window.location.href=pURL;
		else
			return;
	}
	
	/* confirm deletion */
	function cfm_delete(modName,itemID,itemName){
		if (window.confirm('¿Está seguro que desea eliminar '+itemName+'?'))
			self.location.href='index.asp?action='+modName+'.delete&'+itemID;
	}
	
	/* confirm deletion */
	function cfm_deletecity(modName,itemID,itemName){
		if (window.confirm('¿Está seguro que desea eliminar '+itemName+'?'))
			self.location.href='index.asp?action='+modName+'.deletecity&'+itemID;
	}
	
	
	


	/* confirm status update */
	function cfm_status(modName,itemID,itemName,itemActive){
		if (itemActive){
			if (window.confirm('¿Está seguro que desea desactivar '+itemName+'?'))
				self.location.href='index.asp?action='+modName+'.status&active=0&'+itemID;
		} else {
			if (window.confirm('¿Está seguro que desea activar '+itemName+'?'))
				self.location.href='index.asp?action='+modName+'.status&active=1&'+itemID;
		}
	}
	
	/* confirm status update */
	function cfm_statuscity(modName,itemID,itemName,itemActive){
		if (itemActive){
			if (window.confirm('¿Está seguro que desea desactivar '+itemName+'?'))
				self.location.href='index.asp?action='+modName+'.statuscity&active=0&'+itemID;
		} else {
			if (window.confirm('¿Está seguro que desea activar '+itemName+'?'))
				self.location.href='index.asp?action='+modName+'.statuscity&active=1&'+itemID;
		}
	}
	
	/* confirm status update */
	function cfm_private(modName,itemID,itemName,itemActive){
		if (itemActive){
			if (window.confirm('¿Está seguro que desea que sea público '+itemName+'?'))
				self.location.href='index.asp?action='+modName+'.private&active=0&'+itemID;
		} else {
			if (window.confirm('¿Está seguro que desea que sea privado '+itemName+'?'))
				self.location.href='index.asp?action='+modName+'.private&active=1&'+itemID;
		}
	}	
	
	/* sort window */
	function cfm_sort(modName,parentID){
		wnd = window.open('index.asp?action='+modName+'.sortform&id_parent='+parentID,'sort','width=550,height=300,resizable=no,scrollbars=yes,menubar=no');
	}
	
	/* history window */
	function cfm_history(modName,modID,itemID){
		wnd = window.open('index.asp?action='+modName+'.history&id_module='+modID+'&id_item='+itemID,'history','width=550,height=300,resizable=no,scrollbars=yes,menubar=no');
	}
	
	/* sessions window for admins */
	function cfm_sessions_adm(adminID){
		wnd = window.open('index.asp?action=admins.sessions&id_admin='+adminID,'sessions','width=650,height=300,resizable=no,scrollbars=yes,menubar=no');
	}
	
	/* sessions window for users */
	function cfm_sessions_usr(userID){
		wnd = window.open('index.asp?action=users.sessions&id_user='+userID,'sessions','width=650,height=300,resizable=no,scrollbars=yes,menubar=no');
	}
	
	/* videos window */
	function cfm_videos(modName,contentID){
		wnd = window.open('index.asp?action='+modName+'.videosmain&id_content='+contentID,'videos','width=550,height=300,resizable=no,scrollbars=yes,menubar=no');
	}
	
	/* documents window */
	function cfm_docs(modName,contentID){
		wnd = window.open('index.asp?action='+modName+'.docsmain&id_content='+contentID,'docs','width=550,height=300,resizable=no,scrollbars=yes,menubar=no');
	}
	
	/* equals window */
	function cfm_asoc(modName,contentID){
		wnd = window.open('index.asp?action='+modName+'.asocmain&id_product='+contentID,'equals','width=550,height=300,resizable=no,scrollbars=yes,menubar=no');
	}
	
	
	/* tecnic_dates  window */
	function cfm_tec(modName,contentID,id_type){
		wnd = window.open('index.asp?action='+modName+'.tecmain&id_product='+contentID+'&id_type='+id_type,'tecnics','width=550,height=300,resizable=no,scrollbars=yes,menubar=no');
	}
	
	
	/* tecnic_dates  window */
	function cfm_sizes(modName,contentID,id_type){
		wnd = window.open('index.asp?action='+modName+'.sizemain&id_product='+contentID+'&id_type='+id_type,'sizes','width=550,height=300,resizable=no,scrollbars=yes,menubar=no');
	}
	
	/* change class for slideshow */
	function classover(classname){
		if(document.getElementById(classname).className!='img_on')
			document.getElementById(classname).className='img_over';
	}
	function classout(classname){
		if(document.getElementById(classname).className!='img_on')
			document.getElementById(classname).className='img_off';
	}
	function classrestore(classname){
		document.getElementById(classname).className='img_off';
	}
	function classon(classname){
		document.getElementById(classname).className='img_on';
	}
	
	
	/* draw clock (loading...) */
function dc(fl)
{
  var x,y;
  if (self.innerHeight)
  {// all except Explorer
    x = self.innerWidth;
    y = self.innerHeight;
  }
  else 
  if (document.documentElement && document.documentElement.clientHeight)
  {// Explorer 6 Strict Mode
   x = document.documentElement.clientWidth;
   y = document.documentElement.clientHeight;
  }
  else
  if (document.body)
  {// other Explorers
   x = document.body.clientWidth;
   y = document.body.clientHeight;
  }

  var el=document.getElementById('desktop');
	if(null!=el)
	{
		el.style.visibility = (fl==1)?'visible':'hidden';
		el.style.display = (fl==1)?'block':'none';
		el.style.width = x + "px";
		el.style.height = y + "px";
		el.style.zIndex = 1;
	}

	var el=document.getElementById('loader');
	if(null!=el)
	{
		var top = (y/2) - 50;
		var left = (x/2) - 200;
		if( left<=0 ) left = 10;

		el.style.visibility = (fl==1)?'visible':'hidden';
		el.style.display = (fl==1)?'block':'none';
		el.style.left = left + "px"
		el.style.top = top + "px";
		el.style.zIndex = 2;
	}
}

	/* left menu effect */
	function left_menu(stt,elem){
		if(stt)
			document.getElementById(elem).style.visibility="visible"
		else
			document.getElementById(elem).style.visibility="hidden"
	}