function loadup(){
	var f = document.handshape;
	var shape = f.handshape.value;
	var load_heartLine = f.heartLine.value;
	var load_gap = f.gap.value;
	var load_lifeLine = f.lifeLine.value;
	var load_headLine = f.headLine.value;
	var load_destinyLine = f.destinyLine.value;
	editline('heart');
	update_heart_line(load_heartLine);
	update_life_line(load_lifeLine);
	update_head_line(load_headLine);
	update_destiny_line(load_destinyLine);

	var handImgL = shape.toLowerCase();
	var handImgR = handImgL.replace(/ /, "_");
	var shapeHTML = "<p align=\"center\"><b>Hand shape</b><br /><a class=\"lo\" href=\"javascript:displayStep1()\"><img border=\"0\" height=\"50\" src='/images/shapes/" + handImgR + ".gif'><br /><u>Change " + shape + "</u></a></p>";
	document.getElementById('pr_1').innerHTML = shapeHTML;

}

function loadnext(){
	var f = document.handshape;
	var load_heartLine = f.heartLine.value;
	var load_lifeLine = f.lifeLine.value;
	var load_headLine = f.headLine.value;
	var load_destinyLine = f.destinyLine.value;
	var loadEmpty = '';
	if (load_destinyLine == "") {
		var loadEmpty = 'destiny';
	}
	if (load_headLine == "") {
		var loadEmpty = 'head';
	}
	if (load_lifeLine == "") {
		var loadEmpty = 'life';
	}
	if(load_heartLine == ""){
		var loadEmpty = 'heart';
	}
	if (loadEmpty != '') {
		editline(loadEmpty);
	}else{
		document.getElementById('heart_line_con').style.display = 'none';
		document.getElementById('life_line_con').style.display = 'none';
		document.getElementById('head_line_con').style.display = 'none';
		document.getElementById('destiny_line_con').style.display = 'none';
		document.getElementById('done_box').style.display = '';
		document.getElementById('pr_2').innerHTML = '<img style=\"cursor: help;float:left;margin:0 10px 0 0\" border=\"0\" src=\"/images/moretxt.gif\">You are almost done, just enter your name and email to view your palm reading.';
	}

}
function displayStep1(){
	inlargeshape('Air Hand');
	//document.getElementById("step1").style.display = "";
	document.getElementById("rest").style.display = "none";
}
function displayStep2(){
	document.getElementById("step1").style.display = "none";
	document.getElementById("rest").style.display = "";
	loadnext();
}
function readmypalm(){
	document.getElementById("inlarge").style.display = "none";
	document.getElementById("readmypalm").style.display = "";
	var f = document.handshape;
	if(f.handshape.value == ""){
		displayStep1();
	}else{
		displayStep2();
	}
}
function addShape(shape){
	document.handshape.handshape.value = shape;
	var handImgL = shape.toLowerCase();
	var handImgR = handImgL.replace(/ /, "_");
	var shapeHTML = "<p align=\"center\"><b>Hand shape</b><br /><a class=\"lo\" href=\"javascript:displayStep1()\"><img border=\"0\" height=\"50\" src='/images/shapes/" + handImgR + ".gif'><br /><u>Change " + shape + "</u></a></p>";
	document.getElementById('pr_1').innerHTML = shapeHTML;
	readmypalm();

}

function inlargeshape(shape){
	var handImgL = shape.toLowerCase();
	var handImgR = handImgL.replace(/ /, "_");
	var desk = document.getElementById('desk_' + handImgR).innerHTML
	var tip = document.getElementById('tip_' + handImgR).innerHTML
	var shapeHTML = "<p style=\"color:#EA1D25;font-size:12pt\"><b>Place your <span style=\"color:#000000;font-size:14pt\"><u>LEFT HAND</u></span> in front of your face and select the <span style=\"color:#000000;font-size:14pt\"><u>BEST MATCHING</u></span> shape of your hand.</b></p><img style=\"float:left;margin:5px 10px 0 0\" border=\"0\" src='/images/shapes/large/" + handImgR + ".gif'><br /><br /><div style=\"height:100px\"><h1 style=\"text-align:right;margin:0 10px 0 0\">" + shape + "</h1><hr style=\"margin:0 10px 0 0\" /><p style=\"font-size:14px;color:#000000;margin:0 10px 0 0\"><b><span style=\"color:#EA1D25\">Tip:</span> " + tip + "</b></p></div><p style=\"float:right;margin:0 10px 0 0\"><form name=\"lshape\"><input style=\"background:#C3E3A6;color:#568C26;font-weight: bold\" type=\"button\" name=\"prshape\" value=\"Previous\" onclick=\"inlargeshape(document.lshape.allshapes.options[document.lshape.pr.value].value);\"> <select style=\"background:#568C26;color:#C3E3A6;font-weight: bold\" name=\"allshapes\" onchange=\"inlargeshape(this.value)\"><option value=\"Air Hand\">Air Hand</option><option value=\"Conic Hand\">Conic Hand</option><option value=\"Earth Hand\">Earth Hand</option><option value=\"Elementary Hand\">Elementary Hand</option><option value=\"Fire Hand\">Fire Hand</option><option value=\"Philosophical Hand\">Philosophical Hand</option><option value=\"Psychic Hand\">Psychic Hand</option><option value=\"Spatulate Hand\">Spatulate Hand</option><option value=\"Practical Hand\">Practical Hand</option><option value=\"Water Hand\">Water Hand</option><option value=\"Mixed Hand\">Mixed Hand</option></select> <input type=\"button\" style=\"background:#C3E3A6;color:#568C26;font-weight: bold\" name=\"nextshape\" value=\"Next\" onclick=\"inlargeshape(document.lshape.allshapes.options[document.lshape.nt.value].value);\"><input type=\"hidden\" name=\"nt\"><input type=\"hidden\" name=\"pr\"><br /><br /><br /><br /><input style=\"width:305px;background:#F00;color:#FF0;font-size:12pt;font-weight: bold\" type=\"button\" name=\"addthis\" value=\"Yes, This is my Hand Type\" onclick=\"addShape(document.lshape.allshapes.value);\"></p></form><br /><br /></p>";
	document.getElementById('inlarge').innerHTML = shapeHTML;
	document.getElementById("step1").style.display = "none";
	document.getElementById("inlarge").style.display = "";
	document.lshape.allshapes.value = shape;
	var org = document.lshape.allshapes.selectedIndex;
	var ns = org+1;
	var pr = org-1;
	if(ns == 11){
		document.lshape.nextshape.disabled=true;
	}
	if(org == 0){
		document.lshape.prshape.disabled=true;
	}
	document.lshape.nt.value = ns;
	document.lshape.pr.value = pr;
}
function inlargeshapeclose(){
	document.getElementById("step1").style.display = "";
	document.getElementById("inlarge").style.display = "none";

}
function openzoom(zoom){
	document.getElementById('in_' + zoom).style.display = '';
}
function closezoom(zoom){
	document.getElementById('in_' + zoom).style.display = 'none';
}
function editline(line){
	var desk = document.getElementById('desk_' + line + '_line').innerHTML;
	document.getElementById('pr_2').innerHTML = '<img style=\"cursor: help;float:left;margin:0 10px 0 0\" border=\"0\" src=\"/images/moretxt.gif\">' + desk;
	document.getElementById('heart_line_con').style.display = 'none';
	document.getElementById('life_line_con').style.display = 'none';
	document.getElementById('head_line_con').style.display = 'none';
	document.getElementById('destiny_line_con').style.display = 'none';
	document.getElementById('done_box').style.display = 'none';
	document.getElementById(line +'_line_con').style.display = '';
}
function closeeditline(line){
	document.getElementById(line + '_line_con').style.display = 'none';
}

function showtip2(shape,e){
  if (document.all&&document.readyState=="complete"){
	var handImgL = shape.toLowerCase();
	var handImgR = handImgL.replace(/ /, "_");
  	var desk = document.getElementById('desk_' + handImgR).innerHTML
	var tip = document.getElementById('tip_' + handImgR).innerHTML
    document.all.tooltip2.innerHTML='<span style=\"color:#F78F1E\"><b>Tip:</b></span> '+tip+''
    document.all.tooltip2.style.pixelLeft=event.clientX+document.body.scrollLeft+10
    document.all.tooltip2.style.pixelTop=event.clientY+document.body.scrollTop+10
    document.all.tooltip2.style.visibility="visible"
	}
}
function hidetip2(){
	document.all.tooltip2.style.visibility="hidden"
}

		function clean_heart_line(){
		// Empty
				for (var x = 2; x <= 5; x++)
   				{
   				 document.getElementById("heartl_" + x).style.display="none";
   				}
		}
		function update_heart_line(linePick){
				clean_heart_line();
				document.getElementById(linePick).style.display="";
				document.handshape.heartLine.value = linePick;
		}

		function update_des(q){
			if(q == 'y'){
					document.handshape.destinyLine.value = '';
					document.getElementById('desBox').style.display = '';
			}else{
					clean_destiny_line();
					document.handshape.destinyLine.value = 'n';
					document.getElementById('desBox').style.display = 'none';
					document.des.reset();
			}
		}

		function update_gap(){
 						if(document.gap.gap_lines.checked == false){
 							document.handshape.gap.value = '';
							document.getElementById("headl_1").style.top="65px";
							document.getElementById("headl_2").style.top="75px";
							document.getElementById("headl_3").style.top="75px";
							document.getElementById("headl_4").style.top="75px";
						}else{
							document.getElementById("headl_1").style.top="55px";
							document.getElementById("headl_2").style.top="60px";
							document.getElementById("headl_3").style.top="60px";
							document.getElementById("headl_4").style.top="60px";
							document.handshape.gap.value = 'y';
						}
		}
		function clean_head_line(){
		// Empty
			update_gap();
				for (var x = 1; x <= 4; x++)
   				{
   				 document.getElementById("headl_" + x).style.display="none";
   				}
		}
		function update_head_line(linePick){
		// Empty
			update_gap();
			clean_head_line();
				document.getElementById(linePick).style.display="";
				document.handshape.headLine.value = linePick;
		}
		function clean_life_line(){
		// Empty
				for (var x = 1; x <= 3; x++)
   				{
   				 document.getElementById("lifel_" + x).style.display="none";
   				}
		}
		function update_life_line(linePick){
				clean_life_line();

				document.getElementById(linePick).style.display="";
				document.handshape.lifeLine.value = linePick;
		}
		function clean_destiny_line(){
		// Empty
				for (var x = 1; x <= 4; x++)
   				{
   				 document.getElementById("destinyl_" + x).style.display="none";
   				}
		}
		function update_destiny_line(linePick){
				clean_destiny_line();

				document.getElementById(linePick).style.display="";
				document.handshape.destinyLine.value = linePick;
		}

function submitmypalm(){
	var d = document.submitpalm;
	if (d.fullName.value == "" ) {
	alert("Please Enter Your Name");
	d.fullName.focus();
	return false;
	}
	if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(d.email.value)){
	alert("Invalid E-mail Address! Please re-enter.")
	d.email.focus();
	return false;
	}
	if (d.bdm.selectedIndex == "" ) {
	alert("Please Enter Your DOB Month");
	d.bdm.focus();
	return false;
	}
		if (document.submitpalm.bdd.selectedIndex == "" ) {
	alert("Please Enter Your DOB Day");
	d.bdd.focus();
	return false;
	}
		if (document.submitpalm.bdy.selectedIndex == "" ) {
	alert("Please Enter Your DOB Year");
	d.bdy.focus();
	return false;
	}

	var f = document.handshape;
	var load_handShape = f.handshape.value;
	var handImgL = load_handShape.toLowerCase();
	var handImgR = handImgL.replace(/ /, "_");
	var load_heartLine = f.heartLine.value;
	var load_gap = f.gap.value;
	var load_lifeLine = f.lifeLine.value;
	var load_headLine = f.headLine.value;
	var load_destinyLine = f.destinyLine.value;
	var load_name = document.submitpalm.fullName.value;
	var load_email = document.submitpalm.email.value;

	var bdm = d.bdm.options[d.bdm.selectedIndex].value;
	var bdd = d.bdd.options[d.bdd.selectedIndex].value;
	var bdy = d.bdy.options[d.bdy.selectedIndex].value;
	window.location.href = 'https://www.palmday.com/payment.php?action=true&bdm=' + bdm + '&bdd=' + bdd + '&bdy=' + bdy + '&handShape=' + handImgR + '&heartLine=' + load_heartLine + '&headLine=' + load_headLine + '&lifeLine=' + load_lifeLine + '&destinyLine=' + load_destinyLine + '&gap=' + load_gap + '&email=' + load_email + '&fullName=' + load_name;
}
function op_edit(){
	document.getElementById("step3").style.display = "none";
	document.getElementById("step2").style.display = "";
	document.getElementById("progress").style.display = "";
	document.getElementById("main_hand").style.display = "";
}
function op_new(){
	var answer = confirm("This will start reading your palm from the begining.\n Do you want to continue?")
	if (answer){
		window.location.href='/read-my-palm.php';
	}
}
function op_print(){
	document.showresults.focus();
	document.ishowresults.print();
}
function checksave(){
	window.location.href = 'http://www.palmday.com';
}