function ajaxsendtoafriend(form,id){
        
        if( form.name.value =='Tu nombre' || form.email.value=='Email de tu amigo' ){
                alert('Por favor entra tu nombre y el email de tu amigo en el formulario');
                return;
        }
               
        if(     form.email.value.indexOf('@')>0 && form.name.value != '' ) {
		form.referer.value=document.location.href;
                var url = '/sendmail.php';
                apost(url,id,'set_html',form);
		form.email.value=''
		form.name.value=''
        }else{
                alert("Por favor revise el formulario, algunos campos no son correctos.")
        }
	
	return false
}               


function writeOpenXZone(id)
{
	var m3_u = (location.protocol=='https:'?'https://adsdelivery.envialo.es/ajs.php':'http://adsdelivery.envialo.es/ajs.php');
	var m3_r = Math.floor(Math.random()*99999999999);
	if (!document.MAX_used) document.MAX_used = ',';
	document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
	document.write ("?zoneid="+id+"&amp;target=_blank");
	document.write ('&amp;cb=' + m3_r);
	if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
	document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
	document.write ("&amp;loc=" + escape(window.location));

	// Custom ESPANACASH vars
	if( document.promoid )
		document.write ("&amp;promoid=" + escape(document.promoid));
	if( document.promoinfo )
		document.write ("&amp;promoinfo=" + escape(document.promoinfo));
	if( document.bym )
		document.write ("&amp;bym=" + escape(document.bym));

	// Custom yosolo vars
	if( document.sex )
		document.write ("&amp;sex=" + escape(document.sex));
	if( document.usertype )
		document.write ("&amp;usertype=" + escape(document.usertype));

	if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
	if (document.context) document.write ("&context=" + escape(document.context));
	if (document.mmm_fo) document.write ("&amp;mmm_fo=1");
	document.write ("'><\/scr"+"ipt>");
}


function writeOpenXFloatingZone(id,align,valign,preventContext,closetime)
{
    if(!closetime){
  		closetime=15;
  	}
  	if(!align){
  		align='left';
  	}
  	if(!valign){
  		valign='middle';
  	}
  	    
   	var ox_u = 'http://adsdelivery.envialo.es/al.php?zoneid='+id+'&cb=INSERT_RANDOM_NUMBER_HERE&layerstyle=simple&align='+align+'&valign='+valign+'&padding=2&closetime='+closetime+'&padding=2&shifth=0&shiftv=0&closebutton=f&nobg=t&noborder=t';
	// Custom ESPANACASH vars
	if( document.promoid )
		ox_u +="&promoid=" + escape(document.promoid);
	if( document.promoinfo )
		ox_u +="&promoinfo=" + escape(document.promoinfo);
	if( document.bym )
		ox_u +="&bym=" + escape(document.bym);
	if( document.sex )
		ox_u +="&sex=" + escape(document.sex);

      if (document.context) ox_u += '&context=' + escape(document.context);
	// Custom yosolo vars
         document.write("<scr"+"ipt type='text/javascript' src='" + ox_u + "'></scr"+"ipt>");
}


function carga_imagen(id,sense)
{
	if(sense=='bigger'){
		var src=$(id).attr('src').replace(/\/[0-9]+x[0-9]+\//,'/320x240/');
		$(id).attr('src',src).css('position','absolute').css('border','4px solid #666666');
	}else{
		var src=$(id).attr('src').replace(/\/[0-9]+x[0-9]+\//,'/60x40/');
		$(id).attr('src',src).css('position','inherit').css('border','0px');
;
	}
}

function yosoloanunciosSendF(idobj,iditem)
{
	$.get('index.php?jump=anuncio.sendtoafriend&id='+iditem+'&container='+idobj, function(data){
		container=$('#'+idobj)
		container.addClass('anunciossendf')
		container.html(data);
	});
}

function yosoloanunciosclose(id){
	$('#'+id).hide('slow',function () { $('#'+id).removeClass('anunciossendf').addClass('anunciossendf_sent').fadeIn() } );
}

function getroompass()
{
	ip = document.getElementById('roompassword');

	if(ip)
	{
		passw=ip.value.replace(/^\s+|\s+$/g,'')
		if(passw.length >0){
			setCookie('roompassword',passw)	
			document.location.href=document.location.href;
		}else{
			alert('Debes introducir una contraseña');
			ip.focus();
		}
	}else{
		alert('Ha ocurrido un error del sistema');
	}
	return false;
}


