var panelclosed=0;	
function launch_message(titulo , texto )
	{
			var unique_id = $.gritter.add({
				// (string | mandatory) the heading of the notification
				//title: 'This is a sticky notice!',
				title: titulo,
				// (string | mandatory) the text inside the notification
				//text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus eget tincidunt velit. Cum sociis natoque penatibus et <a href="#" style="color:#ccc">magnis dis parturient</a> montes, nascetur ridiculus mus.',
				text: texto,
				// (string | optional) the image to display on the left
				//image: 'images/myface_bigger.jpg',
				//image: imagen,
				// (bool | optional) if you want it to fade out on its own or just sit there
				sticky: true, 
				// (int | optional) the time you want it to be alive for before fading out
				time: '6000',
				// (string | optional) the class name you want to apply to that specific message
				class_name: 'my-sticky-class' 
			});
			
			// You can have it return a unique id, this can be used to manually remove it later using
			
			setTimeout(function(){
				
				$.gritter.remove(unique_id, { 
					fade: true,
					speed: 'slow'
				});
				
			}, 6000)
			
			
			return false;
		
		}
		//Jordi Dotras
		/*function acceptNum(evt, tipo)
		{  
			// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57, retroceso = 08, @ = 64   
			//www.elcodigoascii.com.ar/ascii-codigo.php
			var nav4 = window.Event ? true : false;
			var key = nav4 ? evt.which : evt.keyCode;  
			
			if (tipo == 'telf'){
				//alert(key);
				return (key <= 13 || key <= 08 || (key >= 48 && key <= 57));
			}
			else if (tipo == 'mail')
			{
				//alert(key);
				return (key <= 13 || key == 64 || key <= 08 || (key >= 97 && key <= 122));
				
			}	
				
		} */
		function closepanel()
		{
			if(panelclosed==0)
				{
					document.getElementById('columnaizquierda').style.width=34 + "px";
					document.getElementById('columnacentral').style.left=34 + "px";
					panelclosed=1;
				}
			else
				{
					document.getElementById('columnaizquierda').style.width=210 + "px";
					document.getElementById('columnacentral').style.left=210 + "px";
					panelclosed=0;
				}
		}
		
		
	
		
		/*var documentHeight = 0;
		var topPadding = 70;
		$(function() {
			var offset = $("#columnaizquierda").offset();
		    documentHeight = $(document).height();
		    $(window).scroll(function() {
		    	setTimeout("mover(" + offset.top + "," + documentHeight + ");",300);
		       
		    });
		});
		function mover(offset_top,documentHeight)
		{
			var sideBarHeight = $("#columnaizquierda").height();
	        if ($(window).scrollTop() > offset_top) {
	            var newPosition = ($(window).scrollTop() - offset_top) + topPadding;
	            var maxPosition = documentHeight - (sideBarHeight);
	            if (newPosition > maxPosition) {
	                newPosition = maxPosition;
	            }
	            $("#columnaizquierda").stop().animate({
	                marginTop: newPosition
	            });
	        } else {
	            $("#columnaizquierda").stop().animate({
	                marginTop: 0
	            });
	        };
		}*/
		function redirigirCombo(ruta , idcombo)
		{
			window.location = ruta + "/" + document.getElementById(idcombo).options[document.getElementById(idcombo).selectedIndex].value;
		}
		function vervideo(urlvideo)
		{		
			document.getElementById('videodiv').style.visibility="visible";
			document.getElementById('videoplayer').style.visibility="visible";
			posicionultimopunto=urlvideo.lastIndexOf(".");
			if(posicionultimopunto!=-1)
			{
				extension=urlvideo.slice(posicionultimopunto - urlvideo.length);
				extension=extension.toLowerCase();
				if((extension==".png")||(extension==".jpg")||(extension==".gif")||(extension==".jpeg"))
					{						
						aray=urlvideo.split("public");
						
						document.getElementById('iframevideo').src = aray[0] + "index.php/" + "es/empresa/imagengrande/url/" + urlvideo;
					}
				else
					{			
					
						parent.document.getElementById("iframevideo").style.width="800px";
						parent.document.getElementById("iframevideo").style.height="580px";
						parent.document.getElementById("videoplayer").style.width="800px";
						parent.document.getElementById("videoplayer").style.height="600px";
						parent.document.getElementById("iframe").style.width="800px";
						parent.document.getElementById("iframe").style.height="600px";
						parent.document.getElementById("closer").style.left="780px";
						parent.document.getElementById("videoplayer").style.left="-400px";
						document.getElementById('iframevideo').src = urlvideo;
					}
				
			}
			else
			{
				document.getElementById('iframevideo').src = urlvideo;
			}
			
		}
		function inArray(needle, haystack) { 
		    var length = haystack.length; 
		    for(var i = 0; i < length; i++) { 
		        if(haystack[i] == needle) return true; 
		    } 
		    return false; 
		} 
		function cerrarvideo()
		{
			document.getElementById('videoplayer').style.visibility="hidden";
			document.getElementById('videodiv').style.visibility="hidden";
			document.getElementById('iframevideo').src = "";
		}
		
		function resaltar(actual)
		{
			document.getElementById('lnk_' + actual).className = "selected";
		}
		
		function noresaltar(actual)
		{
			document.getElementById('lnk_' + actual).className = "noselected";
		}
		function goTo(actual)
		{
			window.location=document.getElementById('lnk_' + actual).href ;
		}
		function vergaleria(baseUrl)
		{
			document.getElementById('videodiv').style.visibility="visible";
			document.getElementById('videoplayer').style.visibility="visible";
			
			parent.document.getElementById("iframevideo").style.width="800px";
			parent.document.getElementById("iframevideo").style.height="580px";
			parent.document.getElementById("videoplayer").style.width="800px";
			parent.document.getElementById("videoplayer").style.height="600px";
			parent.document.getElementById("iframe").style.width="800px";
			parent.document.getElementById("iframe").style.height="580px";
			parent.document.getElementById("closer").style.left="780px";
			parent.document.getElementById("videoplayer").style.left="-400px";
			//alert(baseUrl + "/empresa/galeria");
			document.getElementById('iframevideo').src = baseUrl + "/empresa/galeria";
			
		}
		function vergaleriaNum(baseUrl )
		{
			//alert(baseUrl );
			document.getElementById('videodiv').style.visibility="visible";
			document.getElementById('videoplayer').style.visibility="visible";
			
			parent.document.getElementById("iframevideo").style.width="800px";
			parent.document.getElementById("iframevideo").style.height="580px";
			parent.document.getElementById("videoplayer").style.width="800px";
			parent.document.getElementById("videoplayer").style.height="600px";
			parent.document.getElementById("iframe").style.width="800px";
			parent.document.getElementById("iframe").style.height="580px";
			parent.document.getElementById("closer").style.left="780px";
			parent.document.getElementById("videoplayer").style.left="-400px";
			//alert(baseUrl + "/empresa/galeria");
			parent.document.getElementById('iframevideo').src = baseUrl ;
			
		}
		function abrirgaleria(num)
        {  
            urlactual = document.URL;
            posicionultimointerrogante=urlactual.lastIndexOf("galeria"); 
            //alert(posicionultimointerrogante + " ->  " + urlactual);
            if(posicionultimointerrogante!=-1)
			{
            	//alert(urlactual.substring(0,posicionultimointerrogante) + "?numgaleria=1" );
            	urlfinal = urlactual.substring(0,posicionultimointerrogante + 7) + "/" +num ;
			}
            else
            {
            	urlfinal = urlactual + "/empresa/galeria/" + num;
            }
            //alert(document.URL);
            //alert(urlfinal);
            parent.vergaleriaNum(urlfinal);
        }
