var w_elaboradorPrensa = "false";
var welabNoticia;
var wmodifNoticia;
var wCtrl_ssContrib = 0;

	function elabNoticia(i){	
		if (w_elaboradorPrensa == "true"){
			//alert("cierreSeguridad");
			w_elaboradorPrensa = "false";
			welabNoticia.close();
		} else {
			welabNoticia = window.open("/Institucional_01/auxiliares/ElaboracionPrensa/index.htm?idiom=" +i);
			w_elaboradorPrensa = "true";
			welabNoticia.focus(); 						
		}
	}
	
	function modifNoticia(ddocn,did){	
		if (wCtrl_ssContrib == 1) {
		} else {
			document.location.href=document.location.href + "?SSContributor=true";
		}
		wCtrl_ssContrib = 1;
	}
	

	function modifNoticia_bak(ddocn,did){	
	
		if (w_elaboradorPrensa == "true"){
			alert("cierreSeguridad");
			w_elaboradorPrensa = "false";
			welabNoticia.close();
			modifNoticia(did,ddocn);
		} else {
			alert("/Institucional_01/auxiliares/ElaboracionPrensa/index.htm?act=m&_i_d_=" + did + "&_na_me_=" + ddocn);
			welabNoticia = window.open("/Institucional_01/auxiliares/ElaboracionPrensa/index.htm?act=m&_i_d_=" + did + "&_na_me_=" + ddocn);
			welabNoticia.focus(); 
			w_elaboradorPrensa = "true";						
		}	
	}
	
	
	function end_elabNoticia(){
	//		
		//alert("cierreDesdeVentanaHija");
		//elabNoticia.focus();
		welabNoticia.close();
		//elabNoticia = null;
		//w_elaboradorPrensa = "false";
		
		setTimeout("recarga()", 1000); 	
			
	}

	
	function recarga(){
		//alert("recarga");
		window.location.href=window.location.href;
	}

	
	function MM_jumpMenuGo(objId,targ,restore){ //v9.0
	  var selObj = null;  with (document) { 
	  if (getElementById) selObj = getElementById(objId);
	  if (selObj) eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	  if (restore) selObj.selectedIndex=0; }
	}

	window.onload=cargainit;


	function externalLinks() { 
	 if (!document.getElementsByTagName) return; 
	 var anchors = document.getElementsByTagName("a"); 
	 for (var i=0; i<anchors.length; i++) { 
	   var anchor = anchors[i]; 
	   if (anchor.getAttribute("href") && 
		   anchor.getAttribute("rel") == "external") 
		 anchor.target = "_blank"; 
	 } 
	} 


	function MM_jumpMenu(targ,selObj,restore){ //v3.0
	 var s = selObj.options[selObj.selectedIndex].value;
	  window.open(s);
	  if (restore) selObj.selectedIndex=0;
	}

	function cargainit(){
	externalLinks();

		// basic version is: $('div.demo marquee').marquee() - but we're doing some sexy extras

		$('#avisos marquee').marquee('pointer').mouseover(function () {
			$(this).trigger('stop');
		}).mouseout(function () {
			$(this).trigger('start');
		}).mousemove(function (event) {
			if ($(this).data('drag') == true) {
				this.scrollLeft = $(this).data('scrollX') + ($(this).data('x') - event.clientX);
			}
		}).mousedown(function (event) {
			$(this).data('drag', true).data('x', event.clientX).data('scrollX', this.scrollLeft);
		}).mouseup(function () {
			$(this).data('drag', false);
		});

		var max_min=100;
		var max_gran=190;
		// adjust image dimensions 
		$('.imagen_peq').each(function(){ 
			if($(this).width()>max_min){
				if($(this).width()>($(this).height())){
					//mas ancho que alto
					var tanto=((max_min*100)/$(this).width());
					$(this).css("height",($(this).height()*tanto)/100);
					$(this).css("width",max_min);
				}else if($(this).width()<($(this).height())){
					//mas alto que ancho
					var tanto=((max_min*100)/$(this).height());
					$(this).css("width",($(this).width()*tanto)/100);
					$(this).css("height",max_min);
				}else{
					$(this).css("width",max_min);
					$(this).css("height",max_min);
				}
			}
			$(this).css("display","block");
		});
		$('.imagen_gran').each(function(){ 
			if($(this).width()>max_gran){
				if($(this).width()>($(this).height())){
					//mas ancho que alto
					var tanto=((max_gran*100)/$(this).width());
					$(this).css("height",($(this).height()*tanto)/100);
					$(this).css("width",max_gran);
				}else if($(this).width()<($(this).height())){
					//mas alto que ancho
					var tanto=((max_gran*100)/$(this).height());
					$(this).css("width",($(this).width()*tanto)/100);
					$(this).css("height",max_gran);
				}else{
					$(this).css("width",max_gran);
					$(this).css("height",max_gran);
				}
			}
			$(this).css("display","block");
		});
		
		$(".alert_button").click( function() {
			jAlert('<h3 style="text-align:right;"><a href="#" onclick="$.alerts._hide();callback(true);">X</a></h3><p align="center"><img src="/PresentacionInet/groups/sistema/documents/sistema/icono_info2.gif" alt="INFO" /></p><p><strong>IFEMA le ofrece la posibilidad de recibir información periódica de las noticias, actividades y contenidos de las ferias que usted seleccione.<br /><br />Le rogamos cumplimente el siguiente formulario para su registro en nuestra Base de Datos.</strong></p><div id="popup_panel"><input type="button" id="popup_ok" value="&nbsp;CERRAR&nbsp;">&nbsp;&nbsp;<input type="button" id="popup_okk" value="&nbsp;FORMULARIO&nbsp;" /><br /><br /></div>', 'Diálogo Alert');
		});

	}

	
	function validar(form){
		var cadena="";
		var valor_email = form.email.value;

		if(form.nombreYapellidos.value=="")
			cadena+="Nombre y Apellidos: requerido\n";
		if(form.nombre_medio.value=="")
			cadena+="Nombre del Medio: requerido\n";
		if(form[3].selectedIndex==0)
			cadena+="Tipo de Medio: requerido\n";
		if(valor_email=="")
			cadena+="Correo Electronico: requerido\n";
		else if(valor_email.indexOf("@")==-1)
			cadena+="Correo Electronico: No es un correo valido";
		if(cadena==""){
			 return true;
		}else{
			alert(cadena)
			return false;
		}
	}

	
	function validar_i(form){
		var cadena="";
		var valor_email = form.email.value;

		if(form.nombreYapellidos.value=="")
			cadena+="Name and Surname: requered\n";
		if(form.nombre_medio.value=="")
			cadena+="Name of the Media: requered\n";
		if(form[3].selectedIndex==0)
			cadena+="Type of Media: requered\n";
		if(valor_email=="")
			cadena+="Email: requered\n";
		else if(valor_email.indexOf("@")==-1)
			cadena+="Email: this is not valid";
		if(cadena==""){
			 return true;
		}else{
			alert(cadena)
			return false;
		}	
	}
