

//Esconder los estilos para el pasador:
document.write('<style type="text/css">#central .imagen a img {display: none; } .formCarta {display: none; } #enviarCarta {cursor: pointer; }</style>');
var objetos = new Array();
function pasador(id) {
	objetos[id] = $('fotos-'+id).getElementsByTagName('img');
	var actual = 0;
	objetos[id][0].style.display = 'block';
	$('fotos-'+id).innerHTML += '<div id="flechas-'+id+'"><span id="left-'+id+'">anterior</span><span id="right-'+id+'">siguiente</span></div>';
	$('right-'+id).onclick = function() {
		objetos[id][actual].style.display = 'none';
		if((actual+1)<objetos[id].length) {actual++;} else {actual=0;}
		objetos[id][actual].style.display = 'block';
	}
	$('left-'+id).onclick = function() {
		objetos[id][actual].style.display = 'none';
		if(actual==0) {actual=(objetos[id].length-1);} else {actual--;}
		objetos[id][actual].style.display = 'block';
	}
}

function getCookie( name ) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
		return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ';', len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}

function setCookie( name, value, expires, path, domain, secure ) {
	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires ) {
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = name+'='+escape( value ) +
		( ( expires ) ? ';expires='+expires_date.toGMTString() : '' ) + //expires.toGMTString()
		( ( path ) ? ';path=' + path : '' ) +
		( ( domain ) ? ';domain=' + domain : '' ) +
		( ( secure ) ? ';secure' : '' );
}

function deleteCookie( name, path, domain ) {
	if ( getCookie( name ) ) document.cookie = name + '=' +
			( ( path ) ? ';path=' + path : '') +
			( ( domain ) ? ';domain=' + domain : '' ) +
			';expires=Thu, 01-Jan-1970 00:00:01 GMT';
}

function submitForm(form) {
	$(form).submit();
};


function detectEvent(e) {
	opc = false;
	var evt = e || window.event;
	tecla = evt.keyCode;
	
	if (tecla > 47 && tecla < 58) {	opc = true;} /* los numeros del 0 al 9 para el IE */
	if (evt.charCode > 47 && evt.charCode < 58) {opc = true;} /* los numeros del 0 al 9 para FF */
	if (tecla == 35 && !document.all) {opc = true;} /* la tecla END para FF */
	if (tecla == 46 && !document.all) {opc = true;} /* la tecla DELETE para FF */
	if (tecla > 36 && tecla < 41 && !document.all) {opc = true;	} /* las flechas para el FF */
	if (tecla == 8 || tecla==9 || tecla==13){opc = true;} /* Backspace, TAB y Enter */

	if(opc==false) { Sexy.alert('Solo se aceptan números.'); }
	return opc;
}

function toggle(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != 'none' ) {
		el.style.display = 'none';
	}
	else {
		el.style.display = 'block';
	}
}
