	jQuery(document).ready(function(){
		intervalo = setInterval(cambiarNoti,4000);		
		jQuery('#noticias .notis a').bind("mouseenter",function(){clearInterval(intervalo)});
		jQuery('#noticias .notis a').bind("mouseleave",function(){intervalo=setInterval(cambiarNoti,3000)});
	});
	
	
	
	function cambiarNoti() {
		div = jQuery('#noticias .notis a:visible');
		if (div.next().html()) {
			div.fadeOut('slow',function(){div.next().fadeIn('slow')});
		}
		else {
			div.fadeOut('slow',function(){jQuery('#noticias .notis a:first-child').fadeIn('slow')});
		}		
	}
	
	//multimedia
	function ampliarFoto(imagen) {
		var divNuevo;
		var im = new Image();
		im.src=imagen;//solo para saber el width y height, talvez desp lo cambie para usarla
		var width = im.width ? im.width : 400;
		var height = im.height ? im.height : 400;
		im.onload=jQuery(document.createElement('div')).attr('id','cargando_foto').css({'width':(width) ? (width+20)+'px' : '400px','height':(height) ? (height+20)+'px' : '400px','position':'absolute','z-index':'9','top':'30px','left':Math.round(jQuery('#oscuridad').width()/2-(width/2))+'px'}).html('<img src="ajax-loader.gif" style="margin-left:'+(width/2-25)+'px;margin-top:'+(height/2-10)+'px"/>').appendTo('body');
		jQuery('#oscuridad').fadeIn("slow",function(){divNuevo=jQuery(document.createElement('div')).attr('id','fotoGrande').css({'position':'absolute','top':'30px','z-index':'10','padding':'10px','background-color':'#FFF'}).html('<strong style="float:right;color:#000"><a href="javascript:void(0)" style="text-decoration:none;color:#000" onclick="cerrarFoto()">Cerrar</a></strong><div style="clear:both"></div><img src="'+imagen+'"/>').appendTo('body').hide();jQuery('#fotoGrande img').load(function(){jQuery('#cargando_foto img').fadeOut('slow');jQuery('#fotoGrande').css({'left':((Math.round(jQuery('#oscuridad').width()/2)-(jQuery('#fotoGrande').width()/2))+'px')}).fadeIn('slow',function(){jQuery('#cargando_foto img').remove();jQuery('#cargando_foto').css('width',jQuery('#fotoGrande').width()+'px')})})});
				
	}
	
	function cerrarFoto() {
		jQuery('#cargando_foto').remove();
		jQuery('#oscuridad').fadeOut('slow');
		jQuery('#fotoGrande').fadeOut('slow',function(){jQuery('#fotoGrande').remove()});
	}
	
	var yyy;
	function abrirLink(url,event){
		var div=jQuery("#link_compartir");
		div.fadeIn('slow');
		div.html("<div style=\"background:url(images/triangulo.gif) right bottom no-repeat; heigth:20px; width:280px\">&nbsp;</div><div style=\"background:#C21638;height:100px;width:290px;\"><div class=\"amarilloE\" style=\"padding:10px;float:left;width:220px\"><a href=\"javascript:void(0)\" onclick=\"copy_clip('http://muejeres.otton.cr/"+url+"')\">Copia</a> y pega el link para compartir el art&iacute;culo</div><div id=\"x\" style=\"float:right;width:20px;margin-top:5px;margin-right:5px;\"><img src=\"http://mujeres.otton.cr/images/x.gif\" onclick=\"cerrarbyid('link_compartir')\" onmouseover=\"this.style.cursor='pointer'\" height=\"13\" width=\"13\"></div><div style=\"padding:10px\"><input id=\"parasel\" style=\"margin-top:10px;border:none;width:100%;background:#FFF;\" value=\"http://mujeres.otton.cr/"+url+"\" onclick=\"this.focus();this.select==true ? this.select=false : this.select=true\" onblur=\"this.select=false\"></input></div></div>");
		div.css("top",event.clientY+5);
		div.css("left",event.clientX-280);
		div.css("height","100px");
		div.css("width","290px");
		jQuery("#parasel").focus();
		jQuery("#parasel").select();
	}
	
	function cerrarbyid(link) {
		jQuery('#'+link).fadeOut('slow',function() {jQuery('#'+link).html('')});
	}
	
	var bbb=function closeThis() {		
		jQuery("#link_compartir").fadeOut('slow',function() {jQuery("#link_compartir").html("")});
	}
	
	function hacer() {
		yyy=setTimeout(bbb,1000);
	}

function copy_clip(content) {

   
}
	
	
	function cerrar_com() {
		jQuery("#oscuridad").fadeOut('slow');
		jQuery("#fb_comentarios").css("display","none");
		jQuery("#laX").css("display","none");
		jQuery("#comentar").html('');
	}

	function showComments(url) {
	jQuery("#oscuridad").fadeIn('slow');
	jQuery("#fb_comentarios").css("display","block");
	jQuery("#laX").css("display","block");
	//jQuery('<iframe src="frame_comentario.php?id=15"></iframe>').insertAfter("#fb_comentarios");
	//jQuery("#comentar").load(url);
	jQuery.ajax({
			 	url: url,
				async: true,
				dataType: "html",
				success: function(datos){
					//jQuery("#scrollbar").css("visibility","hidden");
					//jQuery(document.location).attr('href', 'http://www.'+jQuery(document.location).attr('href').split('//')[1]);
					jQuery("#comentar").html(datos);
				},
				type: "GET"
		});
}



	function funcion_de_enviar(form,divBf,divAf) {
		
            // definimos las opciones del plugin AJAX FORM
            var opciones= {
                               beforeSubmit: mostrarLoader, //funcion que se ejecuta antes de enviar el form
                               success: mostrarRespuesta //funcion que se ejecuta una vez enviado el formulario
							   
            };
             //asignamos el plugin ajaxForm al formulario myForm y le pasamos las opciones
            jQuery('#'+form).ajaxForm(opciones) ; 
            
             //lugar donde defino las funciones que utilizo dentro de "opciones"
             function mostrarLoader(){
                      jQuery("#"+divBf).fadeIn("slow");
             };
             function mostrarRespuesta (){
                          jQuery("#"+divBf).fadeOut("slow");
						  jQuery('#'+form).css("display", "none");
						  jQuery("#"+divAf).css("display", "block");
						  
             };
	}
		
	function makeScrollbar(content,scrollbar,handle,horizontal,ignoreMouse){
	var steps = (horizontal?(content.getScrollSize().x - content.getSize().x):(content.getScrollSize().y - content.getSize().y))
	var slider = new Slider(scrollbar, handle, {	
		steps: steps,
		mode: (horizontal?'horizontal':'vertical'),
		onChange: function(step){
			// Scrolls the content element in x or y direction.
			var x = (horizontal?step:0);
			var y = (horizontal?0:step);
			content.scrollTo(x,y);
		}
	}).set(0);
	if( !(ignoreMouse) ){
		// Scroll the content element when the mousewheel is used within the 
		// content or the scrollbar element.
		$$(content, scrollbar).addEvent('mousewheel', function(e){	
			e = new Event(e).stop();
			var step = slider.step - e.wheel * 30;	
			slider.set(step);					
		});
	}
	// Stops the handle dragging process when the mouse leaves the document body.
	$(document.body).addEvent('mouseleave',function(){slider.drag.stop()});
}

function makeScrollbar(content,scrollbar,handle,horizontal,ignoreMouse){
				var steps = (horizontal?(content.getScrollSize().x - content.getSize().x):(content.getScrollSize().y - content.getSize().y))
				var slider = new Slider(scrollbar, handle, {	
					steps: steps,
					mode: (horizontal?'horizontal':'vertical'),
					onChange: function(step){
						// Scrolls the content element in x or y direction.
						var x = (horizontal?step:0);
						var y = (horizontal?0:step);
						content.scrollTo(x,y);
					}
				}).set(0);
				if( !(ignoreMouse) ){
					// Scroll the content element when the mousewheel is used within the 
					// content or the scrollbar element.
					$$(content, scrollbar).addEvent('mousewheel', function(e){	
						e = new Event(e).stop();
						var step = slider.step - e.wheel * 30;	
						slider.set(step);					
					});
				}
				// Stops the handle dragging process when the mouse leaves the document body.
				$(document.body).addEvent('mouseleave',function(){slider.drag.stop()});
			}
						
			window.addEvent('domready', function(){				
				
			});
			
//-------------------AJAX--------------------------

//pedido de ajax con jquery, si se da carga el contenido y lo hace en columnas
function getDataServer(url){

		if (url.indexOf("agenda")==0) {
					jQuery("#target").css("position","absolute");
					jQuery("#target").css("width","700px");			
		}
		else {
			jQuery("#target").css("position","");
			jQuery("#target").css("width","1000px");
			jQuery("#target").css("display","block");
		}
		
	if ((url.indexOf("prensa_items")==-1) && (url.indexOf('info.php')==-1 && (url.indexOf('propuesta_items')==-1))) {
	url = url.replace("@","?");
			jQuery("#PagH1 a").removeClass('rojoE');
			jQuery('#m-'+url.split('=')[1]).addClass('rojoE');
		//if (url.indexOf("prensa_items")==-1) {
     	jQuery.ajax({
			 	url: url,
				async: true,
				dataType: "html",
				success: function(datos){				
				if ((url.indexOf("noticias")==-1)&&(url.indexOf("prensa_items")==-1)&&(url.indexOf("agenda")==-1)&&(url.indexOf("contacto")==-1)&&(url.indexOf("unete")==-1)&&(url.indexOf("propuesta")==-1)&&(url.indexOf("videos")==-1) && (url.indexOf("descargas")==-1) && (url.indexOf("sala_prensa")==-1) && (url.indexOf("campanha")==-1)&& (url.indexOf("blog")==-1)&&(url.indexOf("vida") && (url.indexOf("multimedia")==-1)) && (url.indexOf("colaboraciones")==-1)) {
					jQuery("#target").css("width","1000px");
					jQuery("#carga").html(datos);
					jQuery(function(){
					jQuery("#carga").columnize({
						target: "#target",
						width:325,
						height:390
					});				
				});
				makeScrollbar( $('content'), $('scrollbar'), $('handle'), true );
				jQuery("#scrollbar").css("visibility","visible");
				} else {
					jQuery("#target").html("");
					jQuery("#scrollbar").css("visibility","hidden");
					jQuery("#target").css("width","1000px");
					//document.getElementById("target").style.background='#FF3388';
					jQuery("#target").html(datos);
					makeScrollbar( $('content'), $('scrollbar'), $('handle'), true );
				}
				},
				type: "GET"
		});
	}
	else {
		
		if (url.indexOf('si=1')==1) {
		jQuery.ajax({
			 	url: "noticias.php",
				async: true,
				dataType: "html",
				success: function(datos){				
					jQuery("#scrollbar").css("visibility","hidden");
					jQuery("#target").html(datos);
				},
				type: "GET"
		});
		
		}		
		else {			
			pet_prensa(url,2);
		}
		
		
		
	}
}

function getInfo(url,si) {
var url2 = url.replace('@','?');
url2 = url2.substring(1,url2.length);
jQuery("#crt").html("<img src=\"http://otton.cr/ajax-loader.gif\">");
	jQuery.ajax({
			 	url: url2,
				async: true,
				dataType: "html",
				success: function(datos){				
					jQuery("#relleno").html(datos);					
					jQuery(function(){
					if (datos.length!=7){
		jQuery("#relleno").columnize({				
			target: "#crt",
			width:300,
			height:390
		});
		makeScrollbar( $('content2'), $('scrollbar_peq'), $('handle2'), true );
		jQuery("#scrollbar_peq").css("visibility","visible");
		}
		else {
			jQuery("#crt").html("");
			jQuery("#scrollbar_peq").remove();
		}	 
});					
				},
				type: "GET"
		});
		
}

function peticion(url){
	if ((url.indexOf("prensa_items")==-1) && (url.indexOf("info.php")==-1) && url.indexOf("propuesta_items.php")==-1) {
	jQuery("#target").html("<div id=\"ajax_load\"><img src=\"http://otton.cr/ajax-loader.gif\"></div>");
	}
	getDataServer(url);
	var cadenaTexto = url;
	var fragmentoTexto = cadenaTexto.split('=');
	jQuery(document).attr('title', fragmentoTexto[1]+' | Mujeres| La Costa Rica que queremos...');
}

function pet_prensa(url,si) {
	var url2 = url.replace('@','?');
	url2=url2.substring(1,url2.length);
	jQuery("#crt").html("");
	jQuery("#scrollbar_peq").css("visibility","hidden");
	
	jQuery("#cargar_not").html("<img src=\"http://otton.cr/ajax-loader.gif\">");
	jQuery.ajax({
			 	url: url2,
				async: true,//revisar
				dataType: "html",
				success: function(datos){
					jQuery("#cargar_not").html(datos);
					jQuery("#crt").html("");
				},
				type: "GET"
		});	
	/*}
	if (si==1){
		jQuery.historyLoad(url2.replace("?","@"));
	}*/
}

function pet_descarga(url,si) {
	var url2 = url.replace('@','?');
	url2 = url2.substring(1,url2.length);
	jQuery("#cargar_descarga").html("");
	jQuery("#item").html("");
	jQuery("#cargar_not").html("<img src=\"http://otton.cr/ajax-loader.gif\">");
	jQuery.ajax({
			 	url: url2,
				async: true,//revisar
				dataType: "html",
				success: function(datos){
					jQuery("#cargar_not").html(datos);
				},
				type: "GET"
		});	
	/*}
	if (si==1){
		jQuery.historyLoad(url2.replace("?","@"));
	}*/
}

function itemDescarga(url,si) {
	var url2 = url.replace('@','?');
	url2 = url2.substring(1,url2.length);
	jQuery("#item").html("cargando...");
	jQuery.ajax({
			 	url: url2,
				async: true,//revisar
				dataType: "html",
				success: function(datos){										
					jQuery("#item").html(datos);				

				},
				type: "GET"
		});
}

function getDescargas(url,si){
	var url2 = url.replace('@','?');
	url2 = url2.substring(1,url2.length);
	jQuery("#item").html("");
	jQuery("#cargar_descarga").html("cargando...");
	jQuery.ajax({
			 	url: url2,
				async: true,//revisar
				dataType: "html",
				success: function(datos){										
					jQuery("#cargar_descarga").html(datos);				

				},
				type: "GET"
		});	
	
}

function getPro(url,si) {
	var url2 = url.replace('@','?');
	url2 = url2.substring(1,url2.length);
	jQuery("#crt").html("cargando...");
	jQuery.ajax({
			 	url: url2,
				async: true,//revisar
				dataType: "html",
				success: function(datos){										
					jQuery("#relleno").html(datos);
					jQuery("#relleno").columnize({				
			target: "#crt",
			width:400,
			height:400
		});
					jQuery("#scrollbar_med").css("visibility","visible");
					makeScrollbar( $('content3'), $('scrollbar_med'), $('handle3'), true );

				},
				type: "GET"
		});	
	
}

function avanzar(url) {
	jQuery("#target").html("<div id=\"ajax_load\"><img src=\"http://otton.cr/ajax-loader.gif\"></div>");
	jQuery.ajax({
			 	url: url,
				async: true,//revisar
				dataType: "html",
				success: function(datos){										
					jQuery("#target").html(datos);
					//makeScrollbar( $('DosColumnasLibres'), $('scrollbar_med'), $('handle3'), true );

				},
				type: "GET"
		});	
}

function pageload(hash) {
		 // hash doesn't contain the first # character.
		if(hash) {
			// restore ajax loaded state
			//if (hash.indexOf("prensa_items")==-1)
			if (hash!='')			
			peticion(hash);					
		} else {
			jQuery('#target').html('');
			jQuery('#carga').html('');
			jQuery('#scrollbar').css("visibility","hidden");
			// start page
			//peticion(hash);//default de la primera pagina
		}
	}

	jQuery(document).ready(function(){	
		// Initialize history plugin.
		// The callback is called at once by present location.hash.
		jQuery.historyInit(pageload, "otton.php");		
		var hash ="";
				// set onlick event for buttons
		jQuery("a[rel='history']").click(function(){			
		hash = this.href.replace('?','@').split("/")[3];//cambio el ? por @ porque no pasa ?
		jQuery("#PagH, a").removeClass("rojoE");
		jQuery("#"+this.id).addClass("rojoE");
		jQuery("#video_ini").html('');
		jQuery('#noticias').remove();
		hash=hash.substring(1,hash.length);
		//var hash = this.href;
			//hash = hash.replace(/^.*#/, '');
			// moves to a new page. 
			// pageload is called at once. 
			// hash don't contain "#", "?"			
			jQuery.historyLoad(hash);
			return false;
		});
	});


function getVideos (url,si) {
	var url2 = url.replace('@','?');
	url2 = url2.substr(1,url2.length);
	jQuery("#DosColumnasLibres").html("");
	jQuery("#cargar_video").html("<img src=\"http://otton.cr/ajax-loader.gif\">");
	jQuery.ajax({
			 	url: url2,
				async: true,//revisar
				dataType: "html",
				success: function(datos){					
					jQuery("#DosColumnasLibres").html("");
					jQuery("#cargar_video").html(datos);
					//makeScrollbar( $('DosColumnasLibres'), $('scrollbar_med'), $('handle3'), true );
				},
				type: "GET"
		});	
}


function getVid (url,si) {
	var url2 = url.replace('@','?');
	url2 = url2.substring(1,url2.length);
	jQuery("#DosColumnasLibres").html("<img src=\"http://otton.cr/ajax-loader.gif\">");
	jQuery.ajax({
			 	url: url2,
				async: true,//revisar
				dataType: "html",
				success: function(datos){									
					jQuery("#DosColumnasLibres").html(datos);
					jQuery("#target").css("position","absolute");				
					//makeScrollbar( $('DosColumnasLibres'), $('scrollbar_med'), $('handle3'), true );

				},
				type: "GET"
		});	
}

//funcion para hacer la vara en columnas

/*
$('#timeline')
  .bind('mousedown', function(e) {
    // aquí vendrá nuestro código
  });
  
  $(document)
  .data('timeline', {
    element: this,
    scroll: this.scrollLeft,
    x : e.clientX
  });*/
var a= function func (){
	var mousePositions = document.getElementById('mousePositions');
	mousePositions.style.top = y+'px';
}

function position(x,y){
	/*mousePositions.innerHTML = 'X coords: '+x+', Y coords: '+y;*/
	jQuery("#mousePositions").html("");
	jQuery("#mousePositions").css("display",'block');
	jQuery("#mousePositions").css("left",  x+'px');
	jQuery("#mousePositions").css("top", y+'px');
}
var aaa;
function cerrar(id){
	 aaa = setTimeout(cer, 700);
}

var cer = function cerrar2(id){

var div = document.getElementById('mousePositions');
div.style.display = 'none';
}

function cerrar3(){
var mousePositions = document.getElementById('mousePositions');
mousePositions.style.display = 'none';
}


function cerrar4(){
var mousePositions = document.getElementById('formulario');
mousePositions.style.display = 'none';
}

function cargarEventos(event,fecha){
	jQuery("#contenidoCal").html("Cargando...");
	jQuery("#mousePositions").fadeIn("slow");
	jQuery("#mousePositions").css("left",  event.clientX+'px');
	jQuery("#mousePositions").css("top", event.clientY+'px');
jQuery.ajax({
			 	url: "consultas_agenda.php?fecha="+fecha,
				async: true,
				dataType: "html",
				success: function(datos){				
					/*jQuery("#scrollbar").css("display","none");*/
					jQuery("#contenidoCal").html(datos);
				},
				type: "GET"
		});
		}
		
function cargarFormulario(event, pagina){
	jQuery("#formulario").html("Cargando Formulario...");
	jQuery("#formulario").css("display",'block');
	jQuery("#formulario").css("left",  event.clientX+'px');
	jQuery("#formulario").css("top", event.clientY+'px');
jQuery.ajax({
			 	url: pagina,
				async: true,
				dataType: "html",
				success: function(datos){				
					/*jQuery("#scrollbar").css("display","none");*/
					jQuery("#formulario").html(datos);
				},
				type: "GET"
		});
		}
		
function valor(campo){
//alert('ghkljdklñ');
window.document.getElementById(campo).value = '';
}

function valor2(campo){
//alert('ghkljdklñ');
window.document.getElementById(campo).value = 'E-mail';
}