function clearMe(obj){
	obj.value='';	
}

function opac(obj){
	obj.style.filter = 'alpha(opacity=70)';
	obj.style.opacity = .70;
}

function restore(obj){
	
	obj.style.filter = 'alpha(opacity=100)';
	obj.style.opacity = 1;
}

function pp(myurl,w,h,t,l,sb,tb,name){ 
	var s = ['no','yes'];
	var parametros='status=no, resizable=no, scrollbars=' + s[sb] +',toolbars=' + s[tb] + ',width='+ w +',height='+ h +',top='+ t +',left='+ l; 
	window.open(myurl,name,parametros);
	return false;
}

function show360(url){
	pp(url,410,450,100,100,0,0,'c360')
}

function getURL(url, container, lc){
	//FadeEffect('relcon');				
	new Ajax.Request(
		url,
		{
			method:'get',
  			parameters: {lc: lc},
			onSuccess: function(transport){
				res = transport.responseText || "10";
				$(container).innerHTML = res;
				ShowEffect('cover');		
			},
			onFailure: function(){ 
				alert('Something went wrong...');
				tc="1000";
			} 
		}
	);	

	return false;
}

function validateAgree(){
	if (document.getElementById('agree').checked== true) {
		return true;
	}
	else{
		alert('Debes aceptar el acuerdo');
		return false;
	}
}

  function FadeEffect(element){
       new Effect.Fade(element, 
       { duration:5});
   }
   function ShowEffect(element){
       new Effect.Opacity(element, 
       {duration:8, from:1, to:1, transition: Effect.Transitions.linear, queue:'front'});
       new Effect.Opacity(element, 
       {duration:2, from:1, to:.5, transition: Effect.Transitions.linear, queue:'end'});
   }

function getCover(n){
	clearTimeout(timer)
	i=n;
	if (n==1){
		getURL('/home/coverA.php', 'cover', '')
	}	
	if (n==2){
		getURL('/home/coverB.php', 'cover', '')
	}	
	else if(n==3){
		getURL('/home/coverC.php', 'cover', '')
	}
	if(n==4){
		getURL('/home/coverD.php', 'cover', '')
	}
	if(n==5){
		getURL('/home/coverE.php', 'cover', '')
	}	
	if(n==6){
		getURL('/home/coverF.php', 'cover', '')
	}
	else if(n==7){
		getURL('/home/coverG.php', 'cover', '')
	}
	i=i+1;
	if (i>8){
		i=1	
	}
	timer=setTimeout('getCover(i)',10000);
	return false;
}

var i=1;
