function $(v) { return(document.getElementById(v)); }
function $S(v) { return(document.getElementById(v).style); }

function stept() {
	
	$S('img_1').visibility = "visible";
	$S('rune_1').visibility = "visible";
	$('step').setAttribute('href', 'javascript:stepz();');
	
}
function stepz() {
	
	$S('img_2').visibility = "visible";
	$S('rune_2').visibility = "visible";
	$('step').setAttribute('href', 'javascript:stepu();');
	
}
function stepu() {
	
	$S('img_3').visibility = "visible";
	$S('rune_3').visibility = "visible";
	$('step').setAttribute('href', '#');
	
}

function stepa() {
	
	$S('rune_2').visibility = "visible";
	$('step').setAttribute('href', '#');
	
}

function godness() {
	
	$S('chosencard').visibility = "visible";
	$S('card_1').visibility = "visible";
	$('c1').setAttribute('href', '#');
	$('c2').setAttribute('href', '#');
	$('c3').setAttribute('href', '#');
	$('c4').setAttribute('href', '#');
	$('c5').setAttribute('href', '#');
	$('c6').setAttribute('href', '#');
	$('c7').setAttribute('href', '#');
	$('c8').setAttribute('href', '#');
	$('c9').setAttribute('href', '#');
	$('c10').setAttribute('href', '#');
	$('c11').setAttribute('href', '#');
	
}

function del() {
	
	if(document.eler.vk.value == "Írja ide be a képen látható biztonsági kódot") {
		
		document.eler.vk.value = "";
		
	}
	
}

function disableSelection(target) {
	
	if (typeof target.onselectstart != "undefined") //IE route
	target.onselectstart = function() { return false }
	else if (typeof target.style.MozUserSelect != "undefined") //Firefox route
	target.style.MozUserSelect = "none"
	else //All other route (ie: Opera)
	target.onmousedown = function() { return false }
	target.style.cursor = "default"
}


function toggle(elemz)
{
	var elem = document.getElementById(elemz);
	if(elem.style.display == "block")
	{	
		elem.style.display = "none";	
	}
	else
	{		
		elem.style.display = "block";	
	}
	
}

function disableSelection(target) {
	
	if (typeof target.onselectstart != "undefined") //IE route
	target.onselectstart = function() { return false }
	else if (typeof target.style.MozUserSelect != "undefined") //Firefox route
	target.style.MozUserSelect = "none"
	else //All other route (ie: Opera)
	target.onmousedown = function() { return false }
	target.style.cursor = "default"
}


function initresult(tipus, ans, summa) {
	
	if(tipus == 'month') {
		
		$('monthpers').value = summa;
		$('monper').innerHTML = ans;
		$('rmonthpers').value = ans;
		toggle('persmontable');
		
	} else {
		
		$('daypers').value = summa;
		$('dayper').innerHTML = ans;
		$('rdaypers').value = ans;
		toggle('persdaytable');
	}
	
}

function vinitresult(tipus, ans, summa) {
	
	if(tipus == 'month') {
		
		$('monthpers').value = summa;
		$('monper').innerHTML = ans;
	/*	$('rmonthpers').value = ans;*/
		toggle('venusmontable');
		
	} else {
		
		$('daypers').value = summa;
		$('dayper').innerHTML = ans;
	/*	$('rdaypers').value = ans;*/
		toggle('venusdaytable');
	}
	
}

function clearDefault(el) {
	
  if (el.defaultValue==el.value) el.value = "";
  
}


var uveggomb = {
	
	showOracle: function(steps)
	{
		var oracle = document.getElementById('oracle');
		$('clicker').setAttribute('href', '#');
		oracle.style.zIndex = "1";
		
		if (steps == 6) return false;

		oracle.style.opacity = steps / 5;
		oracle.style.filter = 'alpha(opacity=' + steps * 20 + ')';
			
		steps += 1;
		
		setTimeout("uveggomb.showOracle(" + steps + ")", 50);
		
	}
	
}

var angelmessage = {
	
	showOracle: function(steps)
	{
		var oracle = document.getElementById('angel_inv');
	/*	$('angel_btn').setAttribute('href', '#');*/
		$S('angel_inv').visibility = "visible";
		
		if (steps == 6) return false;

		oracle.style.opacity = steps / 5;
		oracle.style.filter = 'alpha(opacity=' + steps * 20 + ')';
			
		steps += 1;
		
		setTimeout("angelmessage.showOracle(" + steps + ")", 50);
		
	}
	
}

var colororacle = {
	
	showOracle: function(steps)
	{
		var oracle = document.getElementById('color');
		
		for(i = 1; i < 17; i++) {
			
			$("sun" + i).setAttribute('href', '#');
		
		}
		
		if (steps == 6) return false;

		oracle.style.opacity = steps / 5;
		oracle.style.filter = 'alpha(opacity=' + steps * 20 + ')';
			
		steps += 1;
		
		colororacle.showResult(0);
		setTimeout("colororacle.showOracle(" + steps + ")", 50);
		
	},
	
	showResult: function(steps)
	{

		var oracle = document.getElementById('chosencolor');
		$S('chosencolor').visibility = "visible";
		if (steps == 6) return false;

		oracle.style.opacity = steps / 5;
		oracle.style.filter = 'alpha(opacity=' + steps * 20 + ')';
			
		steps += 1;
		
		setTimeout("colororacle.showResult(" + steps + ")", 50);
		
	},
	
	showHover: function(elem)
	{
		
		$S("sun" + elem).visibility = "visible";
		
	},
	
	hideHover: function(elem)
	{
		
		$S("sun" + elem).visibility = "hidden";
		
	}
	
}

var tarotoracle = {
	
	showPast: function(steps)
	{
		
		var oracle = document.getElementById('tarot_1');
		$S('tarot_1').visibility = "visible";
		
		if (steps == 6) return false;

		oracle.style.opacity = steps / 5;
		oracle.style.filter = 'alpha(opacity=' + steps * 20 + ')';
			
		steps += 1;
		
		setTimeout("tarotoracle.showPast(" + steps + ")", 50);
		
	},
	
	showPastCard: function(steps)
	{
		
		var oracle = document.getElementById('tarotcardleft');
		$S('tarotcardleft').visibility = "visible";
		if (steps == 6) return false;

		oracle.style.opacity = steps / 5;
		oracle.style.filter = 'alpha(opacity=' + steps * 20 + ')';
			
		steps += 1;
		
		setTimeout("tarotoracle.showPastCard(" + steps + ")", 50);
		
	},
	
	showPresent: function(steps)
	{
		var oracle = document.getElementById('tarot_2');
		$S('tarot_2').visibility = "visible";
		
		if (steps == 6) return false;

		oracle.style.opacity = steps / 5;
		oracle.style.filter = 'alpha(opacity=' + steps * 20 + ')';
			
		steps += 1;
		
		setTimeout("tarotoracle.showPresent(" + steps + ")", 50);
		
	},
	
	showPresentCard: function(steps)
	{

		var oracle = document.getElementById('tarotcardmiddle');
		$S('tarotcardmiddle').visibility = "visible";
		if (steps == 6) return false;

		oracle.style.opacity = steps / 5;
		oracle.style.filter = 'alpha(opacity=' + steps * 20 + ')';
			
		steps += 1;
		
		setTimeout("tarotoracle.showPresentCard(" + steps + ")", 50);
		
	},
	
	showFuture: function(steps)
	{
		var oracle = document.getElementById('tarot_3');
		$S('tarot_3').visibility = "visible";
		if (steps == 6) return false;

		oracle.style.opacity = steps / 5;
		oracle.style.filter = 'alpha(opacity=' + steps * 20 + ')';
			
		steps += 1;
		
		setTimeout("tarotoracle.showFuture(" + steps + ")", 50);
		
	},
	
	showFutureCard: function(steps)
	{

		var oracle = document.getElementById('tarotcardright');
		$S('tarotcardright').visibility = "visible";
		if (steps == 6) return false;

		oracle.style.opacity = steps / 5;
		oracle.style.filter = 'alpha(opacity=' + steps * 20 + ')';
			
		steps += 1;
		
		setTimeout("tarotoracle.showFutureCard(" + steps + ")", 50);
		
	},
	
	cardOne: function()
	{
		
		for(i = 1; i < 23; i++) {
			
			$("tcard" + i).setAttribute('href', 'javascript:tarotoracle.cardTwo();');
		
		}
		tarotoracle.showPastCard(0);
		tarotoracle.showPast(0);
		
	},
	
	cardTwo: function()
	{
		
		for(i = 1; i < 23; i++) {
			
			$("tcard" + i).setAttribute('href', 'javascript:tarotoracle.cardThree();');
		
		}
		tarotoracle.showPresentCard(0);
		tarotoracle.showPresent(0);
		
	},
	
	cardThree: function()
	{
		
		for(i = 1; i < 23; i++) {
			
			$("tcard" + i).setAttribute('href', '#');
		
		}
		tarotoracle.showFutureCard(0);
		tarotoracle.showFuture(0);
		
	}
	
}

var otarotoracle = {
	
	showResult: function(steps)
	{
		
		var oracle = document.getElementById('taroto');
		$S('taroto').visibility = "visible";
		
		if (steps == 6) return false;

		oracle.style.opacity = steps / 5;
		oracle.style.filter = 'alpha(opacity=' + steps * 20 + ')';
			
		steps += 1;
		
		setTimeout("otarotoracle.showResult(" + steps + ")", 50);
		
	},
	
	showCard: function(steps)
	{
		
		var oracle = document.getElementById('tarotcardmiddle');
		$S('tarotcardmiddle').visibility = "visible";
		$S('tarotcardfix').visibility = "visible";
		if (steps == 6) return false;

		oracle.style.opacity = steps / 5;
		oracle.style.filter = 'alpha(opacity=' + steps * 20 + ')';
			
		steps += 1;
		
		setTimeout("otarotoracle.showCard(" + steps + ")", 50);
		
	},
	
	cardOne: function()
	{
		
		for(i = 1; i < 23; i++) {
			
			$("tcard" + i).setAttribute('href', '#');
		
		}
		$S("text").display = "none";
		$S("texttitle").visibility = "visible";
		otarotoracle.showCard(0);
		otarotoracle.showResult(0);
		
	}
	
}

var lovetarotoracle = {
	
	showOne: function(steps)
	{
		
		var oracle = document.getElementById('tarot_1');
		$S('tarot_1').visibility = "visible";
		
		if (steps == 6) return false;

		oracle.style.opacity = steps / 5;
		oracle.style.filter = 'alpha(opacity=' + steps * 20 + ')';
			
		steps += 1;
		
		setTimeout("lovetarotoracle.showOne(" + steps + ")", 50);
		
	},
	
	showOneCard: function(steps)
	{
		
		var oracle = document.getElementById('lovetarotcardleft');
		$S('lovetarotcardleft').visibility = "visible";
		if (steps == 6) return false;

		oracle.style.opacity = steps / 5;
		oracle.style.filter = 'alpha(opacity=' + steps * 20 + ')';
			
		steps += 1;
		
		setTimeout("lovetarotoracle.showOneCard(" + steps + ")", 50);
		
	},
	
	showTwo: function(steps)
	{
		var oracle = document.getElementById('tarot_2');
		$S('tarot_2').visibility = "visible";
		
		if (steps == 6) return false;

		oracle.style.opacity = steps / 5;
		oracle.style.filter = 'alpha(opacity=' + steps * 20 + ')';
			
		steps += 1;
		
		setTimeout("lovetarotoracle.showTwo(" + steps + ")", 50);
		
	},
	
	showTwoCard: function(steps)
	{

		var oracle = document.getElementById('lovetarotcardright');
		$S('lovetarotcardright').visibility = "visible";
		if (steps == 6) return false;

		oracle.style.opacity = steps / 5;
		oracle.style.filter = 'alpha(opacity=' + steps * 20 + ')';
			
		steps += 1;
		
		setTimeout("lovetarotoracle.showTwoCard(" + steps + ")", 50);
		
	},
	
	cardOne: function()
	{
		
		for(i = 1; i < 23; i++) {
			
			$("tcard" + i).setAttribute('href', 'javascript:lovetarotoracle.cardTwo();');
		
		}
		lovetarotoracle.showOneCard(0);
		lovetarotoracle.showOne(0);
		
	},
	
	cardTwo: function()
	{
		
		for(i = 1; i < 23; i++) {
			
			$("tcard" + i).setAttribute('href', '#');
		
		}
		lovetarotoracle.showTwoCard(0);
		lovetarotoracle.showTwo(0);
		
	}
	
}

var druidaoracle = {
	
	showResult: function(steps)
	{
		
		var card = document.getElementById('card_1');
		$S('card_1').visibility = "visible";
		
		if (steps == 6) return false;

		oracle.style.opacity = steps / 5;
		oracle.style.filter = 'alpha(opacity=' + steps * 20 + ')';
			
		steps += 1;
		
		setTimeout("druidaoracle.showResult(" + steps + ")", 50);
		
	},
	
	showCard: function(steps)
	{
		
		var oracle = document.getElementById('chosendruidacard');
		$S('chosendruidacard').visibility = "visible";
		if (steps == 6) return false;

		oracle.style.opacity = steps / 5;
		oracle.style.filter = 'alpha(opacity=' + steps * 20 + ')';
			
		steps += 1;
		
		setTimeout("druidaoracle.showCard(" + steps + ")", 50);
		
	},
	
	cardOne: function()
	{
		
		for(i = 1; i < 25; i++) {
			
			$("tcard" + i).setAttribute('href', '#');
		
		}
	/*	$S("text").display = "none";
		$S("texttitle").visibility = "visible";*/
		druidaoracle.showCard(0);
		druidaoracle.showResult(0);
		
	}
	
}

var sn = {
	
	AJAX: function()
	{
		sn.xmlHttp=null;
		
		try
	  	{
	  		// Firefox, Opera 8.0+, Safari
	  		sn.xmlHttp=new XMLHttpRequest();
	  	}
		catch (e)
	  	{
	  		// Internet Explorer
	  		try
			{
				sn.xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
	  		catch (e)
			{
			sn.xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
		}
	return sn.xmlHttp;
	},
	
	getVenus: function() {
		
		sn.xmlHttp = sn.AJAX();
		if(sn.xmlHttp == null) {
			
			alert ("Your browser does not support AJAX!");
			return;
			
		}
		
		var formNode = document.getElementById('persnumb');
		
		var month = '?m=' + formNode.monthpers.value;
		var day = '&d=' + formNode.daypers.value;
		var year = '&y=' + formNode.yearpers.value;
		
		var url = '/venusengine.php' + month + day + year;
		
		sn.xmlHttp.onreadystatechange=function()
		{		
			if(sn.xmlHttp.readyState == 1)
			{
				$("venusajaxres").innerHTML = '';

			}
			if(sn.xmlHttp.readyState == 4)
			{
				$("venusajaxres").innerHTML = sn.xmlHttp.responseText;

			}
		}
		sn.xmlHttp.open("GET",url,true);
		sn.xmlHttp.send(null);
	},
	
	getPersYear: function() {
		
		sn.xmlHttp = sn.AJAX();
		if(sn.xmlHttp == null) {
			
			alert ("Your browser does not support AJAX!");
			return;
			
		}
		
		var formNode = document.getElementById('persnumb');
		
		var month = '?monthpers=' + formNode.monthpers.value;
		var day = '&daypers=' + formNode.daypers.value;
		var rday = '&rdaypers=' + formNode.rdaypers.value;
		var rmonth = '&rmonthpers=' + formNode.rmonthpers.value;
		
		var url = '/persnumajax.php' + month + day + rday + rmonth;
		
		sn.xmlHttp.onreadystatechange=function()
		{		
			if(sn.xmlHttp.readyState == 1)
			{
				$("ajaxres").innerHTML = 'Töltés...<br /><br /><img src="images/progress.gif" />';

			}
			if(sn.xmlHttp.readyState == 4)
			{
				$("ajaxres").innerHTML = sn.xmlHttp.responseText;

			}
		}
		sn.xmlHttp.open("GET",url,true);
		sn.xmlHttp.send(null);
	}
	
	
}


var victorian = {
	
	showPresent: function(steps)
	{
		
		var oracle = document.getElementById('vic_1');
		$S('vic_1').visibility = "visible";
		var card = document.getElementById('vic_c_left');
		$S('vic_c_left').visibility = "visible";
		
		if (steps == 6) return false;

		oracle.style.opacity = steps / 5;
		oracle.style.filter = 'alpha(opacity=' + steps * 20 + ')';
		
		card.style.opacity = steps / 5;
		card.style.filter = 'alpha(opacity=' + steps * 20 + ')';
			
		steps += 1;
		
		setTimeout("victorian.showPresent(" + steps + ")", 50);
		
	},
	
	showMods: function(steps)
	{
		
		var oracle = document.getElementById('vic_2');
		$S('vic_2').visibility = "visible";
		var card = document.getElementById('vic_c_middle');
		$S('vic_c_middle').visibility = "visible";
		
		if (steps == 6) return false;

		oracle.style.opacity = steps / 5;
		oracle.style.filter = 'alpha(opacity=' + steps * 20 + ')';
		
		card.style.opacity = steps / 5;
		card.style.filter = 'alpha(opacity=' + steps * 20 + ')';
			
		steps += 1;
		
		setTimeout("victorian.showMods(" + steps + ")", 50);
		
	},
	
	showFuture: function(steps)
	{
		
		var oracle = document.getElementById('vic_3');
		$S('vic_3').visibility = "visible";
		var card = document.getElementById('vic_c_right');
		$S('vic_c_right').visibility = "visible";
		
		if (steps == 6) return false;

		oracle.style.opacity = steps / 5;
		oracle.style.filter = 'alpha(opacity=' + steps * 20 + ')';
		
		card.style.opacity = steps / 5;
		card.style.filter = 'alpha(opacity=' + steps * 20 + ')';
			
		steps += 1;
		
		setTimeout("victorian.showFuture(" + steps + ")", 50);
		
	},
	
	cardOne: function()
	{

		$("vic_a_middle").setAttribute('href', 'javascript:victorian.cardTwo();');
		$("vic_a_left").setAttribute('href', '#');
		
		victorian.showPresent(0);
		
	},
	
	cardTwo: function()
	{

		$("vic_a_right").setAttribute('href', 'javascript:victorian.cardThree();');
		$("vic_a_middle").setAttribute('href', '#');
		victorian.showMods(0);
		
	},
	
	cardThree: function()
	{
		
		$("vic_a_right").setAttribute('href', '#');
		victorian.showFuture(0);
		
	}
	
}
