$(document).ready(function(){//Onload del documento

	
	$(".vin").mouseover(function(){
	
		$(".vinetas").fadeOut("fast");
		var valor="#tipo"+this.id;
		$(valor).fadeIn("slow");
	});
	
	$(".vin").mouseout(function(){
	var valor="#tipo"+this.id;
		$(valor).fadeOut("slow");
	});
	$(".contizq").click(function(){
		
		// Creamos una cookie para leerla en la pagina wireless.js y mostrar la seccion correspondiente
		$.cookie('seccionCookie', this.id, { expires: 0.003 });
				
	});
	
	
	$(".cerrarimagen").click(function(){
		$(".demovideo").hide("fast");
		$("#contenidovideo1").html("");//borro el contenido html anterior
	});
	
	$(".video").click(function(){
	
	
		$(".demovideo").hide("fast");
		$("#demovideo1").show("hide");
		 
		$.ajax({
			type: "POST",
			dataType: "html",
			url: "ajax.video.php",
			data: "id="+this.id,
			beforeSend: function(objeto){//Posibles eventes que nos puede hacer falta
				//alert("Adi�s, me voy a ejecutar");
			},
			complete: function(objeto, exito){//Posibles eventes que nos puede hacer falta
				//alert("Me acabo de completar")
				if(exito=="success"){
					//   alert("Y con �xito");
				}
			},
			error: function(objeto, quepaso, otroobj){//Posibles eventes que nos puede hacer falta
				//alert("Estas viendo esto por que fall�");
				//alert("Pas� lo siguiente: "+quepaso);
			},
			success: function(datos){
		
				$("#contenidovideo1").html("");//borro el contenido html anterior
				$("#contenidovideo1").append(datos);//A�ado todo el contenido
	
			}
		});
	});
});

/* Para añadir popup de anuncio
function setCookie(name, value)
{
//If name is the empty string, it places a ; at the beginning
//of document.cookie, causing clearCookies() to malfunction.
if(name != '')
   document.cookie = name + '=' + value;
}

function getCookie(name)
{
//Without this, it will return the first value 
//in document.cookie when name is the empty string.
if(name == '')
   return('');

name_index = document.cookie.indexOf(name + '=');

if(name_index == -1)
   return('');

cookie_value =  document.cookie.substr(name_index + name.length + 1, 
                                       document.cookie.length);

//All cookie name-value pairs end with a semi-colon, except the last one.
end_of_cookie = cookie_value.indexOf(';');
if(end_of_cookie != -1)
   cookie_value = cookie_value.substr(0, end_of_cookie);

//Restores all the blank spaces.
space = cookie_value.indexOf('+');
while(space != -1)
     { 
     cookie_value = cookie_value.substr(0, space) + ' ' + 
     cookie_value.substr(space + 1, cookie_value.length);
					 
     space = cookie_value.indexOf('+');
     }

return(cookie_value);
}



var cadena = 'document.getElementById("WPS_popup_message").style.visibility="hidden"; return false';
var cadena1 = '<div class="wps_closewin_text"><a id="link_cerrar" onclick='+cadena+' href="#">Cerrar</a></div>';
var cadena2 = '<div class="wps_body"><p><object width="550" height="350"><br/><param value="plane.swf" name="movie"/><br/><embed width="550" height="350" src="plane.swf"/><br/><br/></object></p></div>';
var popup_content = cadena2+cadena1;
var popup_bgcolor = '#333333';
var popup_width = '550';
var effect = 'dropdown';
var popup_left = '350';
var popup_top = '150';
var delay='0';


if (getCookie('prueba') == ''){
	loadPopup (popup_content,popup_bgcolor,popup_width,effect,popup_left,popup_top,delay);
}
setCookie('prueba','1');
*/