stage = 0; cardCount=0; cards = new Array(3); titles = new Array(3); ids = new Array(3); resultTarot=new Array(3); var tarotReq = getXmlHttpRequestObject(); function getXmlHttpRequestObject(){ var request=null; try{ request=new XMLHttpRequest(); } catch(trymicrosoft){ try { request=new ActiveXObject("Msxml2.XMLHTTP"); }catch (othermicrosoft){ try{ request=new ActiveXObject("Microsoft.XMLHTTP"); }catch (failed){ request=null; } } } if (request==null){ alert("Cound not create XmlHttpRequest Object. Consider upgrading your browser."); } return request; } cards[0]='images/ft/30i.gif'; titles[0]='Eight of Wands - inverted'; ids[0]=130 cards[1]='images/ft/72i.gif'; titles[1]='Eight of Pentacles - inverted'; ids[1]=172 cards[2]='images/ft/7.gif'; titles[2]='The Lovers'; ids[2]=7 function select(inCard){ this.Instructions = document.getElementById('Instructions'); if(stage==0){ shuffle(); this.Instructions.innerHTML = "

Step 2: Now click the deck where you wish to cut the cards.

"; }else if (stage == 1){ cut(inCard); stage = 2; this.Instructions.innerHTML = "

Step 3: Select any 3 cards from the deck.

"; } else if(stage==2){ if(cardCount <= 3){ this.theCard=document.getElementById('card_'+inCard); newTop = theCard.style.top.substring(0, theCard.style.top.indexOf("p")); newLeft = theCard.style.left.substring(0, theCard.style.left.indexOf("p")); if(newTop<0){ return; } cardCount++; this.theCard.style.top = (newTop-31)+"px"; this.theCard.style.left = (newLeft-20)+"px"; this.bigCard=document.getElementById('cardbig_'+cardCount); this.bigCard.src=cards[cardCount-1]; document.getElementById('t'+cardCount).innerHTML="

"+titles[cardCount-1]+"

"; } if (cardCount == 3) { stage = 3; //this.theForm = document.getElementById('hidden'); //this.theForm.style.visibility = "visible"; //this.Instructions.innerHTML = "

Step 4: Enter your mobile number to get FREE answer.

"; this.Instructions.innerHTML = "

Step 4: Now click each card in turn to see what the tarot says about your past, present and future.

"; //document.mForm.phone.focus(); } } } function select2(inCard){ this.Instructions = document.getElementById('Instructions'); for (cardCount=1;cardCount<=3;cardCount++){ this.bigCard=document.getElementById('cardbig_'+cardCount); this.bigCard.src=cards[cardCount-1]; document.getElementById('t'+cardCount).innerHTML="

"+titles[cardCount-1]+"

"; } stage = 3; this.Instructions.innerHTML = "

Step 2: Now click each card in turn to see what the tarot says about your past, present and future.

"; } function shuffle(){ if (stage == 0){ stage = 1; hidebackwards(77); } } function cut(inCard){ hidebackwards(inCard); hideforwards(inCard+1); } function hideforwards(inCard){ this.theCard=document.getElementById('card_'+inCard); this.theCard.style.visibility="hidden"; if (inCard<77) { setTimeout("hideforwards("+(inCard+1)+");",15); } if (inCard==0 && stage == 2){ showforwards(inCard); } } function hidebackwards(inCard){ this.theCard=document.getElementById('card_'+inCard); this.theCard.style.visibility="hidden"; if (inCard>0){ setTimeout("hidebackwards("+(inCard-1)+");",15); } if (inCard==0 && stage == 1){ showforwards(0); } if (inCard==0 && stage == 2){ showbackwards(77); showforwards(0); } } function showforwards(inCard){ this.theCard=document.getElementById('card_'+inCard); this.theCard.style.visibility="visible"; if (inCard<77) { setTimeout("showforwards("+(inCard+1)+");",15); } } function showbackwards(inCard){ this.theCard=document.getElementById('card_'+inCard); this.theCard.style.visibility="visible"; if (inCard>0){ setTimeout("showbackwards("+(inCard-1)+");",15); } } function sendAnswer(form){ var thePhone = form.phone.value; if (thePhone.length != 10){ alert("Please enter valid phone number!"); return; } var prefix = thePhone.substring(1,3) if (prefix != "83" && prefix != "85" && prefix != "86" && prefix != "87"){ alert("Please enter valid phone number!"); return; } var numericExpression = /^[0-9]+$/; if(thePhone.match(numericExpression)== null){ alert("Please enter valid phone number!"); return; } document.mForm.c0.value=ids[0]; document.mForm.c1.value=ids[1]; document.mForm.c2.value=ids[2]; document.mForm.submit(); } function turnCard(numCard){ if (stage=="3"){ if (!resultTarot[numCard]){ var url='getTarotResult.php'; tarotReq.open("POST",url,true); var param='card='+ids[numCard]; tarotReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); tarotReq.onreadystatechange=function () { if (tarotReq.readyState==4){ document.getElementById("divTarotResult").innerHTML=tarotReq.responseText; resultTarot[numCard]=tarotReq.responseText; } } tarotReq.send(param); }else{ document.getElementById("divTarotResult").innerHTML=resultTarot[numCard]; } } }