mthnames = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
cplanets = new Array("Sun", "Jupiter", "Moon", "Venus", "Mars", "Saturn", "Mercury", "Sun", "Jupiter", "Moon", "Venus", "Mars", "Saturn");
cremain  = new Array(1, 5, 2, 6, 3, 7, 4);
h0       = new Array("Sun", "Venus", "Mercury", "Moon", "Saturn", "Jupiter", "Mars", "Sun", "Venus", "Mercury", "Moon", "Saturn", "Jupiter", "Mars");
h1       = new Array("Moon", "Saturn", "Jupiter", "Mars", "Sun", "Venus", "Mercury", "Moon", "Saturn", "Jupiter", "Mars", "Sun", "Venus", "Mercury");
h2       = new Array("Mars", "Sun", "Venus", "Mercury", "Moon", "Saturn", "Jupiter", "Mars", "Sun", "Venus", "Mercury", "Moon", "Saturn", "Jupiter");
h3       = new Array("Mercury", "Moon", "Saturn", "Jupiter", "Mars", "Sun", "Venus", "Mercury", "Moon", "Saturn", "Jupiter", "Mars", "Sun", "Venus");
h4       = new Array("Jupiter", "Mars", "Sun", "Venus", "Mercury", "Moon", "Saturn", "Jupiter", "Mars", "Sun", "Venus", "Mercury", "Moon", "Saturn");
h5       = new Array("Venus", "Mercury", "Moon", "Saturn", "Jupiter", "Mars", "Sun", "Venus", "Mercury", "Moon", "Saturn", "Jupiter", "Mars", "Sun");
h6       = new Array("Saturn", "Jupiter", "Mars", "Sun", "Venus", "Mercury", "Moon", "Saturn", "Jupiter", "Mars", "Sun", "Venus", "Mercury", "Moon");
hseq     = new Array(5,3,1,0,2,4,6);
var fyear, fmth, fday;
var natal2z = 30;
var transitz = 31;
var dasaz  = 12; 
var interpretz = 13;
var chartlistz = 14;
var planetchartz = 15;
var confirmz = 17;
var horaryz = 19;


function resetZIndex() {
  document.styleSheets[0].rules[1].style.zIndex = dasaz;
  document.styleSheets[0].rules[3].style.zIndex = interpretz;
  document.styleSheets[0].rules[5].style.zIndex = chartlistz;
  document.styleSheets[0].rules[7].style.zIndex = planetchartz;
  document.styleSheets[0].rules[9].style.zIndex = transitz;
  document.styleSheets[0].rules[11].style.zIndex = natal2z;
  document.styleSheets[0].rules[12].style.zIndex = confirmz;
  document.styleSheets[0].rules[14].style.zIndex = horaryz;
}

function setLayerPos() {
  var cookies = document.cookie;
  var natalval = getCookieVal("natal", cookies);
  var dasaval = getCookieVal("dasa", cookies);
  var interpretval = getCookieVal("interpret", cookies);
  var chartlistval = getCookieVal("chartlist", cookies);
  var planetchartval = getCookieVal("planetchart", cookies);
  var transitval = getCookieVal("transit", cookies);
  var natal2val = getCookieVal("natal2", cookies);
  var confirmval = getCookieVal("confirm", cookies);
  var horaryval = getCookieVal("horary", cookies);

  var nataltop  = natalval.toString().substring(0, natalval.toString().indexOf('px') + 2);
  var natalleft = natalval.toString().substring(natalval.toString().indexOf('px') + 2, natalval.length);
  var natal2top  = natal2val.toString().substring(0, natal2val.toString().indexOf('px') + 2);
  var natal2left = natal2val.toString().substring(natal2val.toString().indexOf('px') + 2, natal2val.length);
  var confirmtop  = confirmval.toString().substring(0, confirmval.toString().indexOf('px') + 2);
  var confirmleft = confirmval.toString().substring(confirmval.toString().indexOf('px') + 2, confirmval.length);
  var horarytop  = horaryval.toString().substring(0, horaryval.toString().indexOf('px') + 2);
  var horaryleft = horaryval.toString().substring(horaryval.toString().indexOf('px') + 2, horaryval.length);
  var dasatop   = dasaval.toString().substring(0, dasaval.toString().indexOf('px') + 2);
  var dasaleft  = dasaval.toString().substring(dasaval.toString().indexOf('px') + 2, dasaval.length);
  var interprettop  = interpretval.toString().substring(0, interpretval.toString().indexOf('px') + 2);
  var interpretleft = interpretval.toString().substring(interpretval.toString().indexOf('px') + 2, interpretval.length);
  var chartlisttop  = chartlistval.toString().substring(0, chartlistval.toString().indexOf('px') + 2);
  var chartlistleft = chartlistval.toString().substring(chartlistval.toString().indexOf('px') + 2, chartlistval.length);
  var planetcharttop  = planetchartval.toString().substring(0, planetchartval.toString().indexOf('px') + 2);
  var planetchartleft = planetchartval.toString().substring(planetchartval.toString().indexOf('px') + 2, planetchartval.length);
  var transittop  = transitval.toString().substring(0, transitval.toString().indexOf('px') + 2);
  var transitleft = transitval.toString().substring(transitval.toString().indexOf('px') + 2, transitval.length);

  document.getElementById('nataldiv').style.top = (natalval != "") ? nataltop : document.getElementById('nataldiv').style.top;
  document.getElementById('nataldiv').style.left = (natalval != "") ? natalleft : document.getElementById('nataldiv').style.left;
  document.getElementById('natal2div').style.top = (natal2val != "") ? natal2top : document.getElementById('natal2div').style.top;
  document.getElementById('natal2div').style.left = (natal2val != "") ? natal2left : document.getElementById('natal2div').style.left;
  document.getElementById('confirmdiv').style.top = (confirmval != "") ? confirmtop : document.getElementById('confirmdiv').style.top;
  document.getElementById('confirmdiv').style.left = (confirmval != "") ? confirmleft : document.getElementById('confirmdiv').style.left;
  document.getElementById('horarydiv').style.top = (horaryval != "") ? horarytop : document.getElementById('horarydiv').style.top;
  document.getElementById('horarydiv').style.left = (horaryval != "") ? horaryleft : document.getElementById('horarydiv').style.left;
  document.getElementById('dasadiv').style.top = (dasaval != "") ? dasatop : document.getElementById('dasadiv').style.top;
  document.getElementById('dasadiv').style.left = (dasaval != "") ? dasaleft : document.getElementById('dasadiv').style.left;
  document.getElementById('interpretdiv').style.top = (interpretval != "") ? interprettop : document.getElementById('interpretdiv').style.top;
  document.getElementById('interpretdiv').style.left = (interpretval != "") ? interpretleft : document.getElementById('interpretdiv').style.left;
  document.getElementById('chartlistdiv').style.top = (chartlistval != "") ? chartlisttop : document.getElementById('chartlistdiv').style.top;
  document.getElementById('chartlistdiv').style.left = (chartlistval != "") ? chartlistleft : document.getElementById('chartlistdiv').style.left;
  document.getElementById('nataldiv').style.visibility = 'visible';
  document.getElementById('planetchartdiv').style.top = (planetchartval != "") ? planetcharttop : document.getElementById('planetchartdiv').style.top;
  document.getElementById('planetchartdiv').style.left = (planetchartval != "") ? planetchartleft : document.getElementById('planetchartdiv').style.left;
  document.getElementById('transitdiv').style.top = (transitval != "") ? transittop : document.getElementById('transitdiv').style.top;
  document.getElementById('transitdiv').style.left = (transitval != "") ? transitleft : document.getElementById('transitdiv').style.left;
}

// Show Top Menu Bar
//
function showMenuBar() {
  if(!document.all) document.all = document.layers;
  g = new Toolbar(document.all.toolbar, document.all.toolbarCol, true);
  g.bgImg = null;
  g.bgColor = "#BFBFFF";
  g.Name = "Aspects";
  g.addItem("Aspects Menu :", "javascript:void(0);", 85);
  g.addItem("Grand Trine", "javascript:showGrandTrine();", 65);
  g.addItem("Minor Trine", "javascript:showMinorTrine();", 65);
  g.addItem("Core", "javascript:showCore();", 65);
  g.addItem("Square", "javascript:showSquare();", 65);
  g.addItem("Cardinal", "javascript:showCardinal();", 65);
  g.addItem("RESET", "javascript:showNormal();", 65);
  g.build();

  p = new Toolbar(document.all.toolbar2, document.all.toolbarCol, true);
  p.bgImg = null;
  p.bgColor = "yellow";
  p.Name = "Friendship";
  p.addItem("Relationship Menu :", "javascript:void(0);", 100);
  p.addItem("Sun","javascript:showRelationships(\"Sun\");", 45);
  p.addItem("Moon","javascript:showRelationships(\"Moon\");", 45);
  p.addItem("Mars","javascript:showRelationships(\"Mars\");", 45);
  p.addItem("Jup","javascript:showRelationships(\"Jupiter\");", 45);
  p.addItem("Ven","javascript:showRelationships(\"Venus\");", 45);
  p.addItem("Mer","javascript:showRelationships(\"Mercury\");", 45);
  p.addItem("Sat","javascript:showRelationships(\"Saturn\");", 45);
  p.addItem("Rahu","javascript:showRelationships(\"Rahu\");", 45);
  p.addItem("RESET","javascript:showRelationships(\"Reset\");", 45);
  p.build();

  p = new Toolbar(document.all.toolbar3, document.all.toolbarCol, true);
  p.bgImg = null;
  p.bgColor = "pink";
  p.Name = "Show";
  p.addItem("Pop-ups :", "javascript:void(0);", 80);
  p.addItem("House Meanings","javascript:showInterpret(\"1\");", 100);
  p.addItem("Planet Meanings","javascript:showPlanetChart();", 100);
  p.addItem("Transits","javascript:showTransitChart();", 80);
  p.addItem("Confirmation","javascript:showConfirmChart();", 80);
  p.addItem("Horary","javascript:showHoraryChart();", 80);
  p.addItem("Charts","javascript:parent.left_frame.showCharts();", 80);
  p.build();
}

// Show House Interpretations
//
function showInterpret(inhouse) {
  inhouse = parseFloat(inhouse)-1;
  var housenames = new Array("House of Impermanence",
				     "House of Extremity",
				     "House of Fame",
				     "House of Wealth",
				     "House of Kingly Position",
				     "House of Sickly/Change",
				     "House of Leader");
  var housetext = new Array(7);
  housetext[0] = "The keyword for this house is 'INCONSTANT'. The only consistency prevailing in this house is the ability to maintain consistency with being inconsistent. The planet in this house is simply unreliable. Anything that is gained will more than likely be lost, but then again anything that is lost will also be regained. It is like taking two steps forward and three back. What is important when analyzing this house is to see what the nature of the planet located in it represents. Is it a changeable planet like the Moon, or is it a more steady influence like the Sun? Does it represent unreliability in teachings or education because Jupiter resides here, or perhaps an interrupted education, or does it represent a need for a lot of talking one minute and then quieting down the next, like Mercury? If the planet above it is not harboring any animosity toward this planet, it can be easily mitigated through the owner of the House of Wealth.";

  housetext[1] = "The keyword for this house is 'EXTREME'. When we have a planet here that is working strongly as an asset for the chart, by virtue of its very nature, such as a well aspected benefic, this 'extreme' is used to bring about benefic results. For example, Jupiter may go to great lengths to accomplish an education, or bring knowledge to others, or attain wisdom, or be fair in judgments. He will be extreme in his mission, and when this is the case and the planet in this house is working strongly as an asset, it can actually be even stronger than the planet in the LEADER house. So this house, too, warrants attention. The other significance of this house is that it additionally implies that you are either going to extremes with a mission, whether positive or negative, or you're doing just the opposite and accomplishing nothing. So it is an 'either/or' house, all the way around.";

  housetext[2] = "The keyword for the House of Fame is 'REPUTATION'. This house tells you how you appear to the outside world - such as other people's impressions of you, what type of individual they think you are, how you are judged by others, what kind of vibe you throw, off, etc.. Now we must keep in mind that the planets all have dual natures, therefore it is important that we know the nature of the planet, such as if the planet is operating as a malefic or a benefic, if it receives any help thru aspects, etc.. So 'what you are really like', versus 'who other people THINK you are and what they THINK you are really like', will be reflected with the least amount of divergence in opinion, when the birth planet is actually placed in the House of Fame. A chart lord positioned in the House of Fame indicates that you are just as you appear to be, or 'What you see is what you get'. Overall, it's a good way to look at the chart and see how you are viewed by others. The Burmese consider this quite an important house according to Barbara Cameron. The first thing they are likely to ask you is, 'What is your birth planet and who is in your House of Fame?'";

  housetext[3] = "The key phrase to use for this house is 'WHAT BRINGS SATISFACTION'. Wealth here doesn't imply monetary wealth - it refers to what brings a sense of satisfaction in your life. If you have the birth lord or the Sun in this house,  your greatest source of satisfaction will come from your own efforts as opposed to those things outside yourself. The lord of the chart will give the clue as to what those efforts are. For the Sun, it may reflect in being a leader, for example, or being in charge, or a boss. For Saturn, it may be your structure and organizational abilities, hard work, ability to provide for yourself. Jupiter here may be indicative of your knowledge and intelligence. For Mars, it may be your energy reservoir, ambition, drive, strength, assertiveness, activities. Mercury in this house may indicate children, communications, etc. . . You get the idea. . . . Whatever these energies are is where the satisfaction is derived from, always reflecting on the nature and condition of the planet in question. This house is additionally the one we look at for the type of career or work you may be suited for.";

  housetext[4] = "The keyword here is 'DESIRES AND GOALS'. This house reflects your desires, goals, dreams and aspirations. Here are the traits that you admire in others and may wish for yourself. And even though you will keep on striving to attain some degree of satisfaction with those desires and accomplishments, you will never experience them to the degree that satisifes you totally. This will not keep you from trying however. . . . not a chance!";

  housetext[5] = "This house is the most difficult to interpret because its duality can remain elusive to those who are trying to nail down a predictive statement. It is the most annoying house because of that fact, and also because it presents a steady and persistent influence. The energies from this house can be mitigated. By mitigation we mean to influence, rearrange or redirect our circumstances to more suit our advantage. But you still have to be clear on what representation you want to mitigate and how. The influences can be alleviated, but they will not totally disappear, so you are still left holding a bit of annoying residue, no matter how hard you try. A birth planet located in this house can change like the wind. Who are you today? Again, as always, we have to factor in the nature and condition of the planet, what it represents, and attempt to alleviate the disturbing aspects through mitigation remedies. The Moon here can indicate very changeable feelings, irritation with feelings and personality (and even with Venus above it, it will not totally alleviate this changeablitiy, so relationships help, but are still risky too). The Sun in this house, may indicate a dissatisfaction with yourself, your father and/or authority figures. Mercury may indicate a certain difficulty in communication by not saying things right, or having problems with children perhaps. Mars here may indicate some difficulties with your spouse, energy problems, etc. . .";

  housetext[6] = "This is the Leader House, just as it indicates and represents the strongest motivating factor in your life. The planet in this house reflects what keeps you motivated to 'keep on keeping on'. It indicates how and in what manner you are driven to move onward. Here is also where your greatest assets lie and in most cases people are totally oblivious to the assets represented by the planet residing here. Others always take notice, but these assets are normally so natural and second nature to you, that you don't even notice them to the extent that others do. So when others make a reference to it, you don't always see what the big deal is. This position is at the apex of the CORE and the TRINE aspects and can be used very effectively to promote harmony within your individual personality. The energies reflected here can greatly motivate a child towards greater harmony as well. Again, the nature of the planet must always be factored in, and if a benefic, it reinforces the benefic leading attributes and does so with no malice. If the Leader planet however is a chart malefic, then you may have trouble dealing with, protecting, realizing, or even organizing your gifts and talents, depending on the siginificance of the planet involved - but they are nonetheless still apparent."

  resetZIndex();
  document.styleSheets[0].rules[3].style.zIndex = 99;
  document.getElementById('interpretdiv').style.visibility='visible';
  document.getElementById('interpretdiv2').style.visibility='visible';
  document.getElementById('housetitle_id').innerHTML = housenames[inhouse];
  document.getElementById('housetext_id').innerHTML = housetext[inhouse];
}

// Show Planet Characteristics
//
function showPlanetChart() {
  resetZIndex();
  document.styleSheets[0].rules[7].style.zIndex = 99;
  document.getElementById('planetchartdiv').style.visibility='visible';
  document.getElementById('planetchartdiv2').style.visibility='visible';
}


// Show Transit Chart
//
function showTransitChart() {
  resetZIndex();
  parent.left_frame.resetTransitChart();
  document.styleSheets[0].rules[9].style.zIndex = 99;
  document.getElementById('tryear_id').value = "";
  document.getElementById('transitname').innerText=parent.left_frame.document.getElementById('name_id').value;
  if (document.getElementById('transitname').innerText == document.getElementById('chart1name').innerText) {
    document.getElementById('transitdiv').style.top = document.getElementById('nataldiv').style.top.toString().substring(0, document.getElementById('nataldiv').style.top.length - 2) - 36;
    document.getElementById('transitdiv').style.left = document.getElementById('nataldiv').style.left; 
  }
  if (document.getElementById('transitname').innerText == document.getElementById('chart2name').innerText) {
    document.getElementById('transitdiv').style.top = document.getElementById('natal2div').style.top.toString().substring(0, document.getElementById('natal2div').style.top.length - 2) - 36;
    document.getElementById('transitdiv').style.left = document.getElementById('natal2div').style.left; 
  }
  document.getElementById('transitdiv').style.visibility='visible';
  document.getElementById('transitdiv2').style.visibility='visible';
}


// Get Month, Date, Year from mmm dd ccyy format date
//
function getMthDayYr(fdate) {
  var i=0;
  var j=0;
  var daybeg, dayend, yrbeg, yrend;

  for (i=0; i<fdate.length; i++) {
    if (fdate.toString().charAt(i) == " ") {
	break;
    }
  }
  for (j=i+1; j<fdate.length; j++) {
    if (fdate.toString().charAt(j) == " ") {
	break;
    }
  }
  daybeg = i+1;
  dayend = j;
  yrbeg  = j+1;
  yrend  = fdate.length;

  fyear = parseFloat(fdate.toString().substring(yrbeg,yrend));
  fmth  = fdate.toString().substring(0,3);
  for (i=0; i<12; i++) {
    if (mthnames[i] == fmth)
	break;
  }
  fmth  = i;
  fday  = parseFloat(fdate.toString().substring(daybeg,dayend));

  return (true);
}


// Show Confirmation Chart
//
function showConfirmChart() {
  document.getElementById('confirmname').innerText=parent.left_frame.document.getElementById('name_id').value;
  if (document.getElementById('condate_id').value != "") {
  var year, month, monthtext, date, ampm;
  year  = parent.left_frame.document.getElementById('birthyear_id').value;
  year  = parseInt(year);
  year  = isNaN(year) ? 0 : tooLong(year);
  monthtext = parent.left_frame.document.getElementById('birthmonth_id').options[parent.left_frame.document.getElementById('birthmonth_id').selectedIndex].innerText;
  month = parent.left_frame.document.getElementById('birthmonth_id').options[parent.left_frame.document.getElementById('birthmonth_id').selectedIndex].value;
  month = isNaN(month) ? 0 : parseInt(month);
  date  = parent.left_frame.document.getElementById('birthdate_id').options[parent.left_frame.document.getElementById('birthdate_id').selectedIndex].value;
  date  = isNaN(date) ? 0 : parseInt(date);
  ampm  = parent.left_frame.document.getElementById('ampm_id').options[parent.left_frame.document.getElementById('ampm_id').selectedIndex].value;
  var bdate = new Date(year, month-1, date);
  var conflist = "<table id='confirmtable' cellspacing='0' cellpadding='0'>\n";
  var rem=0;
  var wedbirth = (parent.left_frame.document.getElementById('dayofweek_id').innerText == "Wednesday") ? true : false;
  var userahu  = (wedbirth && ampm == "PM") ? true : false;

  var fromDate = new Date(bdate);
      fromDate.setHours(0);
      fromDate.setHours(0);
      fromDate.setMinutes(0);
      fromDate.setSeconds(0);

  confdate = getMthDayYr(document.getElementById('condate_id').value);
  var cdate = new Date(fyear, fmth, fday);
  var workDate = new Date(cdate);
      workDate.setHours(0);
      workDate.setMinutes(0);
      workDate.setSeconds(0);

  if ((workDate.getMonth() > fromDate.getMonth()) || 
	((workDate.getMonth() == fromDate.getMonth()) && (workDate.getDate() >= fromDate.getDate()))) {
    rem = 1;
  }
  rem += (workDate.getFullYear() - fromDate.getFullYear()) % 8;
  if (rem == 0) rem=7;

  for (i=0; i<7; i++) {
    if (cremain[i] == rem) {
	j=i;
	break;
    }
  }

  for (i=0; i<7; i++) {
      dspplanet = (cplanets[i+j] == "Mercury" && userahu) ? "Rahu" : cplanets[i+j];
	switch (i) {
	  case 0 :
	    conflist += "<tr>\n" + 
				"<td style='width:150px; color:green'>" + 
				  dspplanet +
				"<\/td>\n" + 
				"<td style='width:150px'>" + 
				  "&nbsp;" +
				"<\/td>\n" + 
			    "<\/tr>\n";
	    break;

	  case 1 :
	    conflist += "<tr>\n" + 
				"<td style='width:150px; color:green'>" + 
				  dspplanet +
				"<\/td>\n" + 
				"<td style='width:150px; color:green'>" + 
				  "Working For" +
				"<\/td>\n" + 
			    "<\/tr>\n";
	    break;

	  case 2 :
	    conflist += "<tr>\n" + 
				"<td style='width:150px; color:green'>" + 
				  dspplanet +
				"<\/td>\n" + 
				"<td style='width:150px'>" + 
				  "&nbsp;" +
				"<\/td>\n" + 
			    "<\/tr>\n" +
			    "<tr style='height:5px'>\n" +
				"<td colspan='2'>&nbsp;<\/td>" +
			    "<\/tr>\n";
	    break;

	  case 3 : 
	    conflist += "<tr>\n" + 
				"<td style='width:150px'>" + 
				  dspplanet +
				"<\/td>\n" + 
				"<td style='width:150px'>" + 
				  "On the Fence" +
				"<\/td>\n" + 
			    "<\/tr>\n" +
			    "<tr style='height:5px'>\n" +
				"<td colspan='2'>&nbsp;<\/td>" +
			    "<\/tr>\n";
	    break;

	  case 4 : 
	    conflist += "<tr>\n" + 
				"<td style='width:150px; color:#cb0017'>" + 
				  dspplanet +
				"<\/td>\n" + 
				"<td style='width:150px'>" + 
				  "&nbsp;" +
				"<\/td>\n" + 
			    "<\/tr>\n";
	    break;

	  case 5 : 
	    conflist += "<tr>\n" + 
				"<td style='width:150px; color:#cb0017'>" + 
				  dspplanet +
				"<\/td>\n" + 
				"<td style='width:150px; color:#cb0017'>" + 
				  "Working Against" +
				"<\/td>\n" + 
			    "<\/tr>\n";
	    break;

	  case 6 : 
	    conflist += "<tr>\n" + 
				"<td style='width:150px; color:#cb0017'>" + 
				  dspplanet +
				"<\/td>\n" + 
				"<td style='width:150px'>" + 
				  "&nbsp;" +
				"<\/td>\n" + 
			    "<\/tr>\n";
	    break;

	  default:
	    conflist += "<tr>\n" + 
				"<td style='width:150px'>" + 
				  dspplanet +
				"<\/td>\n" + 
				"<td style='width:150px'>" + 
				  "&nbsp;" +
				"<\/td>\n" + 
			    "<\/tr>\n";
      }
  }
  conflist += "<\/table>";
  document.getElementById('confirmtext_id').innerHTML=conflist;
  }

  resetZIndex();
  document.styleSheets[0].rules[12].style.zIndex = 99;
  document.getElementById('confirmdiv').style.visibility='visible';
  document.getElementById('confirmdiv2').style.visibility='visible';
}


// Show Horary Chart
//
function showHoraryChart() {
  var dspplanet;
  var dow    = parseFloat(document.getElementById('horaryday_id').options[document.getElementById('horaryday_id').selectedIndex].value);
  var htime  = parseFloat(document.getElementById('horarytime_id').options[document.getElementById('horarytime_id').selectedIndex].value);
  var htimei = document.getElementById('horarytime_id').selectedIndex;
  var htimet = parseFloat(document.getElementById('horarytime_id').options[document.getElementById('horarytime_id').selectedIndex].innerText);
  document.getElementById('horaryname').innerText=parent.left_frame.document.getElementById('name_id').value;
  if (dow != 9 && htime != 9) {
  var horarylist = "<table id='horarytable' cellspacing='0' cellpadding='0'>\n";
 
  if (htimei > 0 && htimei < 5) {
    if (dow == 0) 
      dow = 6;
    else
      dow -= 1;
  }

  for (i=0; i<7; i++) {
      dspplanet = eval("h" + dow + "[" + (htime + hseq[i]) + "]");
	switch (i) {
	  case 0 :
	    horarylist += "<tr>\n" + 
				"<td style='width:150px; color:green'>" + 
				  dspplanet +
				"<\/td>\n" + 
				"<td style='width:150px'>" + 
				  "&nbsp;" +
				"<\/td>\n" + 
			    "<\/tr>\n";
	    break;

	  case 1 :
	    horarylist += "<tr>\n" + 
				"<td style='width:150px; color:green'>" + 
				  dspplanet +
				"<\/td>\n" + 
				"<td style='width:150px; color:green'>" + 
				  "Working For" +
				"<\/td>\n" + 
			    "<\/tr>\n";
	    break;

	  case 2 :
	    horarylist += "<tr>\n" + 
				"<td style='width:150px; color:green'>" + 
				  dspplanet +
				"<\/td>\n" + 
				"<td style='width:150px'>" + 
				  "&nbsp;" +
				"<\/td>\n" + 
			    "<\/tr>\n" +
			    "<tr style='height:5px'>\n" +
				"<td colspan='2'>&nbsp;<\/td>" +
			    "<\/tr>\n";
	    break;

	  case 3 : 
	    horarylist += "<tr>\n" + 
				"<td style='width:150px'>" + 
				  dspplanet +
				"<\/td>\n" + 
				"<td style='width:150px'>" + 
				  "On the Fence" +
				"<\/td>\n" + 
			    "<\/tr>\n" +
			    "<tr style='height:5px'>\n" +
				"<td colspan='2'>&nbsp;<\/td>" +
			    "<\/tr>\n";
	    break;

	  case 4 : 
	    horarylist += "<tr>\n" + 
				"<td style='width:150px; color:#cb0017'>" + 
				  dspplanet +
				"<\/td>\n" + 
				"<td style='width:150px'>" + 
				  "&nbsp;" +
				"<\/td>\n" + 
			    "<\/tr>\n";
	    break;

	  case 5 : 
	    horarylist += "<tr>\n" + 
				"<td style='width:150px; color:#cb0017'>" + 
				  dspplanet +
				"<\/td>\n" + 
				"<td style='width:150px; color:#cb0017'>" + 
				  "Working Against" +
				"<\/td>\n" + 
			    "<\/tr>\n";
	    break;

	  case 6 : 
	    horarylist += "<tr>\n" + 
				"<td style='width:150px; color:#cb0017'>" + 
				  dspplanet +
				"<\/td>\n" + 
				"<td style='width:150px'>" + 
				  "&nbsp;" +
				"<\/td>\n" + 
			    "<\/tr>\n";
	    break;

	  default:
	    horarylist += "<tr>\n" + 
				"<td style='width:150px'>" + 
				  dspplanet +
				"<\/td>\n" + 
				"<td style='width:150px'>" + 
				  "&nbsp;" +
				"<\/td>\n" + 
			    "<\/tr>\n";
      }
  }
  horarylist += "<\/table>";
  document.getElementById('horarytext_id').innerHTML=horarylist;
  }

  resetZIndex();
  document.styleSheets[0].rules[14].style.zIndex = 99;
  document.getElementById('horarydiv').style.visibility='visible';
  document.getElementById('horarydiv2').style.visibility='visible';
}


// Show Aspects
//
function showWhite() {
  document.getElementById('house1t_id').style.backgroundColor='#ffffff';
  if (document.getElementById('house1_id').style.backgroundColor!='yellow')
    document.getElementById('house1_id').style.backgroundColor='#ffffff';
  document.getElementById('house1txt_id').style.backgroundColor='#ffffff';
  document.getElementById('house1b_id').style.backgroundColor='#ffffff';

  document.getElementById('house2t_id').style.backgroundColor='#ffffff';
  if (document.getElementById('house2_id').style.backgroundColor!='yellow')
    document.getElementById('house2_id').style.backgroundColor='#ffffff';
  document.getElementById('house2txt_id').style.backgroundColor='#ffffff';
  document.getElementById('house2b_id').style.backgroundColor='#ffffff';

  document.getElementById('house3t_id').style.backgroundColor='#ffffff';
  if (document.getElementById('house3_id').style.backgroundColor!='yellow')
    document.getElementById('house3_id').style.backgroundColor='#ffffff';
  document.getElementById('house3txt_id').style.backgroundColor='#ffffff';
  document.getElementById('house3b_id').style.backgroundColor='#ffffff';

  document.getElementById('house4t_id').style.backgroundColor='#ffffff';
  if (document.getElementById('house4_id').style.backgroundColor!='yellow')
    document.getElementById('house4_id').style.backgroundColor='#ffffff';
  document.getElementById('house4txt_id').style.backgroundColor='#ffffff';
  document.getElementById('house4b_id').style.backgroundColor='#ffffff';

  document.getElementById('house5t_id').style.backgroundColor='#ffffff';
  if (document.getElementById('house5_id').style.backgroundColor!='yellow')
    document.getElementById('house5_id').style.backgroundColor='#ffffff';
  document.getElementById('house5txt_id').style.backgroundColor='#ffffff';
  document.getElementById('house5b_id').style.backgroundColor='#ffffff';

  document.getElementById('house6t_id').style.backgroundColor='#ffffff';
  if (document.getElementById('house6_id').style.backgroundColor!='yellow')
    document.getElementById('house6_id').style.backgroundColor='#ffffff';
  document.getElementById('house6txt_id').style.backgroundColor='#ffffff';
  document.getElementById('house6b_id').style.backgroundColor='#ffffff';

  document.getElementById('house7t_id').style.backgroundColor='#ffffff';
  if (document.getElementById('house7_id').style.backgroundColor!='yellow')
    document.getElementById('house7_id').style.backgroundColor='#ffffff';
  document.getElementById('house7txt_id').style.backgroundColor='#ffffff';
  document.getElementById('house7b_id').style.backgroundColor='#ffffff';

  document.getElementById('house7l_id').style.backgroundColor='#ffffff';
  document.getElementById('house7r_id').style.backgroundColor='#ffffff';
}

function showNormal() {
  document.getElementById('house1t_id').style.backgroundColor='#ffcc99';
  if (document.getElementById('house1_id').style.backgroundColor!='yellow')
    document.getElementById('house1_id').style.backgroundColor='#ffcc99';
  document.getElementById('house1txt_id').style.backgroundColor='#ffcc99';
  document.getElementById('house1b_id').style.backgroundColor='#ffcc99';

  document.getElementById('house2t_id').style.backgroundColor='#ffcc99';
  if (document.getElementById('house2_id').style.backgroundColor!='yellow')
    document.getElementById('house2_id').style.backgroundColor='#ffcc99';
  document.getElementById('house2txt_id').style.backgroundColor='#ffcc99';
  document.getElementById('house2b_id').style.backgroundColor='#ffcc99';

  document.getElementById('house3t_id').style.backgroundColor='#ccffcc';
  if (document.getElementById('house3_id').style.backgroundColor!='yellow')
    document.getElementById('house3_id').style.backgroundColor='#ccffcc';
  document.getElementById('house3txt_id').style.backgroundColor='#ccffcc';
  document.getElementById('house3b_id').style.backgroundColor='#ccffcc';

  document.getElementById('house4t_id').style.backgroundColor='#ccffcc';
  if (document.getElementById('house4_id').style.backgroundColor!='yellow')
    document.getElementById('house4_id').style.backgroundColor='#ccffcc';
  document.getElementById('house4txt_id').style.backgroundColor='#ccffcc';
  document.getElementById('house4b_id').style.backgroundColor='#ccffcc';

  document.getElementById('house5t_id').style.backgroundColor='#ccffcc';
  if (document.getElementById('house5_id').style.backgroundColor!='yellow')
    document.getElementById('house5_id').style.backgroundColor='#ccffcc';
  document.getElementById('house5txt_id').style.backgroundColor='#ccffcc';
  document.getElementById('house5b_id').style.backgroundColor='#ccffcc';

  document.getElementById('house6t_id').style.backgroundColor='#ffcc99';
  if (document.getElementById('house6_id').style.backgroundColor!='yellow')
    document.getElementById('house6_id').style.backgroundColor='#ffcc99';
  document.getElementById('house6txt_id').style.backgroundColor='#ffcc99';
  document.getElementById('house6b_id').style.backgroundColor='#ffcc99';

  document.getElementById('house7t_id').style.backgroundColor='#ccffcc';
  if (document.getElementById('house7_id').style.backgroundColor!='yellow')
    document.getElementById('house7_id').style.backgroundColor='#ccffcc';
  document.getElementById('house7txt_id').style.backgroundColor='#ccffcc';
  document.getElementById('house7b_id').style.backgroundColor='#ccffcc';

  document.getElementById('house7l_id').style.backgroundColor='#ccffcc';
  document.getElementById('house7r_id').style.backgroundColor='#ccffcc';

  if (document.getElementById('house1_id').innerText == " ") return;
}

function showGrandTrine() {
  showWhite();
  document.getElementById('house2t_id').style.backgroundColor='#ffcc99';
  if (document.getElementById('house2_id').style.backgroundColor!='yellow')
    document.getElementById('house2_id').style.backgroundColor='#ffcc99';
  document.getElementById('house2txt_id').style.backgroundColor='#ffcc99';
  document.getElementById('house2b_id').style.backgroundColor='#ffcc99';

  document.getElementById('house6t_id').style.backgroundColor='#ffcc99';
  if (document.getElementById('house6_id').style.backgroundColor!='yellow')
    document.getElementById('house6_id').style.backgroundColor='#ffcc99';
  document.getElementById('house6txt_id').style.backgroundColor='#ffcc99';
  document.getElementById('house6b_id').style.backgroundColor='#ffcc99';

  document.getElementById('house7t_id').style.backgroundColor='#ccffcc';
  if (document.getElementById('house7_id').style.backgroundColor!='yellow')
    document.getElementById('house7_id').style.backgroundColor='#ccffcc';
  document.getElementById('house7txt_id').style.backgroundColor='#ccffcc';
  document.getElementById('house7b_id').style.backgroundColor='#ccffcc';
}

function showMinorTrine() {
  showWhite();
  document.getElementById('house2t_id').style.backgroundColor='#ffcc99';
  if (document.getElementById('house2_id').style.backgroundColor!='yellow')
    document.getElementById('house2_id').style.backgroundColor='#ffcc99';
  document.getElementById('house2txt_id').style.backgroundColor='#ffcc99';
  document.getElementById('house2b_id').style.backgroundColor='#ffcc99';

  document.getElementById('house4t_id').style.backgroundColor='#ccffcc';
  if (document.getElementById('house4_id').style.backgroundColor!='yellow')
    document.getElementById('house4_id').style.backgroundColor='#ccffcc';
  document.getElementById('house4txt_id').style.backgroundColor='#ccffcc';
  document.getElementById('house4b_id').style.backgroundColor='#ccffcc';

  document.getElementById('house6t_id').style.backgroundColor='#ffcc99';
  if (document.getElementById('house6_id').style.backgroundColor!='yellow')
    document.getElementById('house6_id').style.backgroundColor='#ffcc99';
  document.getElementById('house6txt_id').style.backgroundColor='#ffcc99';
  document.getElementById('house6b_id').style.backgroundColor='#ffcc99';
}

function showCore() {
  showWhite();
  document.getElementById('house1t_id').style.backgroundColor='#ffcc99';
  if (document.getElementById('house1_id').style.backgroundColor!='yellow')
    document.getElementById('house1_id').style.backgroundColor='#ffcc99';
  document.getElementById('house1txt_id').style.backgroundColor='#ffcc99';
  document.getElementById('house1b_id').style.backgroundColor='#ffcc99';

  document.getElementById('house4t_id').style.backgroundColor='#ccffcc';
  if (document.getElementById('house4_id').style.backgroundColor!='yellow')
    document.getElementById('house4_id').style.backgroundColor='#ccffcc';
  document.getElementById('house4txt_id').style.backgroundColor='#ccffcc';
  document.getElementById('house4b_id').style.backgroundColor='#ccffcc';

  document.getElementById('house7t_id').style.backgroundColor='#ccffcc';
  if (document.getElementById('house7_id').style.backgroundColor!='yellow')
    document.getElementById('house7_id').style.backgroundColor='#ccffcc';
  document.getElementById('house7txt_id').style.backgroundColor='#ccffcc';
  document.getElementById('house7b_id').style.backgroundColor='#ccffcc';
}

function showSquare() {
  showWhite();
  document.getElementById('house2t_id').style.backgroundColor='#ffcc99';
  if (document.getElementById('house2_id').style.backgroundColor!='yellow')
    document.getElementById('house2_id').style.backgroundColor='#ffcc99';
  document.getElementById('house2txt_id').style.backgroundColor='#ffcc99';
  document.getElementById('house2b_id').style.backgroundColor='#ffcc99';

  document.getElementById('house3t_id').style.backgroundColor='#ccffcc';
  if (document.getElementById('house3_id').style.backgroundColor!='yellow')
    document.getElementById('house3_id').style.backgroundColor='#ccffcc';
  document.getElementById('house3txt_id').style.backgroundColor='#ccffcc';
  document.getElementById('house3b_id').style.backgroundColor='#ccffcc';

  document.getElementById('house5t_id').style.backgroundColor='#ccffcc';
  if (document.getElementById('house5_id').style.backgroundColor!='yellow')
    document.getElementById('house5_id').style.backgroundColor='#ccffcc';
  document.getElementById('house5txt_id').style.backgroundColor='#ccffcc';
  document.getElementById('house5b_id').style.backgroundColor='#ccffcc';

  document.getElementById('house6t_id').style.backgroundColor='#ffcc99';
  if (document.getElementById('house6_id').style.backgroundColor!='yellow')
    document.getElementById('house6_id').style.backgroundColor='#ffcc99';
  document.getElementById('house6txt_id').style.backgroundColor='#ffcc99';
  document.getElementById('house6b_id').style.backgroundColor='#ffcc99';

  document.getElementById('house7t_id').style.backgroundColor='#ccffcc';
  if (document.getElementById('house7_id').style.backgroundColor!='yellow')
    document.getElementById('house7_id').style.backgroundColor='#ccffcc';
  document.getElementById('house7txt_id').style.backgroundColor='#ccffcc';
  document.getElementById('house7b_id').style.backgroundColor='#ccffcc';
}

function showCardinal() {
  showWhite();
  document.getElementById('house1t_id').style.backgroundColor='#ffcc99';
  if (document.getElementById('house1_id').style.backgroundColor!='yellow')
    document.getElementById('house1_id').style.backgroundColor='#ffcc99';
  document.getElementById('house1txt_id').style.backgroundColor='#ffcc99';
  document.getElementById('house1b_id').style.backgroundColor='#ffcc99';

  document.getElementById('house3t_id').style.backgroundColor='#ccffcc';
  if (document.getElementById('house3_id').style.backgroundColor!='yellow')
    document.getElementById('house3_id').style.backgroundColor='#ccffcc';
  document.getElementById('house3txt_id').style.backgroundColor='#ccffcc';
  document.getElementById('house3b_id').style.backgroundColor='#ccffcc';

  document.getElementById('house5t_id').style.backgroundColor='#ccffcc';
  if (document.getElementById('house5_id').style.backgroundColor!='yellow')
    document.getElementById('house5_id').style.backgroundColor='#ccffcc';
  document.getElementById('house5txt_id').style.backgroundColor='#ccffcc';
  document.getElementById('house5b_id').style.backgroundColor='#ccffcc';

  document.getElementById('house7t_id').style.backgroundColor='#ccffcc';
  if (document.getElementById('house7_id').style.backgroundColor!='yellow')
    document.getElementById('house7_id').style.backgroundColor='#ccffcc';
  document.getElementById('house7txt_id').style.backgroundColor='#ccffcc';
  document.getElementById('house7b_id').style.backgroundColor='#ccffcc';
}


// Planet Relationships
//
var planets  = new Array(8); 
planets[0] = "sun";
planets[1] = "moon";
planets[2] = "mars";
planets[3] = "jupiter";
planets[4] = "venus";
planets[5] = "mercury";
planets[6] = "saturn";
planets[7] = "rahu";

var planetcolors              = new Array(8);
planetcolors["clicked planet"]= "red"
planetcolors["neutral"]       = "gray";
planetcolors["enemy"]         = "red";
planetcolors["neg. element"]  = "orange";
planetcolors["friend"]        = "green";
planetcolors["pos. element"]  = "blue";
planetcolors["pos. enemy"]    = "blue";
planetcolors["neg. enemy"]    = "red";

// Friendship status constructor
function festatus(sustatus,mostatus,mastatus,justatus,vestatus,mestatus,sastatus,rastatus) {
  this.sun     = sustatus; 
  this.moon    = mostatus; 
  this.mars    = mastatus;
  this.jupiter = justatus;
  this.venus   = vestatus;
  this.mercury = mestatus;
  this.saturn  = sastatus;
  this.rahu    = rastatus;
}

var planetfe = new Array(8);
planetfe[0] = new festatus("clicked planet", "neutral", "enemy", "friend", "neutral", "neg. element", "pos. element", "neutral");        // Sun
planetfe[1] = new festatus("neutral", "clicked planet", "neg. element", "pos. enemy", "neutral", "friend", "neutral", "neutral"); // Moon
planetfe[2] = new festatus("enemy", "neg. element", "clicked planet", "neutral", "friend", "neutral", "neutral", "pos. element");       // Mars
planetfe[3] = new festatus("friend", "pos. enemy", "neutral", "clicked planet", "neutral", "neutral", "neutral", "neg. element"); // Jupiter
planetfe[4] = new festatus("neutral", "neutral", "friend", "neutral", "clicked planet", "pos. element", "neg. enemy", "neutral"); // Venus
planetfe[5] = new festatus("neg. element", "friend", "neutral", "neutral", "pos. element", "clicked planet", "neutral", "enemy");        // Mercury
planetfe[6] = new festatus("pos. element", "neutral", "neutral", "neutral", "neg. enemy", "neutral", "clicked planet", "friend"); // Saturn
planetfe[7] = new festatus("neutral", "neutral", "pos. element", "neg. element", "neutral", "enemy", "friend", "clicked planet");        // Rahu

function getPlanetRelation(refplanet, compplanet) {
  if (compplanet == " ") return (compplanet);
  refplanet = refplanet.toString().toLowerCase();
  compplanet = compplanet.toString().toLowerCase();
  for (i=0; i<planets.length; i++) {
    if (planets[i] == refplanet)
      break;
  }
  for (j=0; j<planets.length; j++) {
    if (planets[j] == compplanet)
      break;
  }

  rel = eval("planetfe[i]." + compplanet.toString().toLowerCase());
  return (rel);
}

function getPlanetColor(relation) {
  if (relation == " ") return;
  return (planetcolors[relation]);
}

function showRelationships(inplanet) {
  if (document.getElementById('house1_id').innerText == " ") return;

  document.getElementById('house1_id').style.color='#000000';
  document.getElementById('house1_id').innerText = document.getElementById('house1_id').innerText.toString().toLowerCase();
  document.getElementById('house2_id').style.color='#000000';
  document.getElementById('house2_id').innerText = document.getElementById('house2_id').innerText.toString().toLowerCase();
  document.getElementById('house3_id').style.color='#000000';
  document.getElementById('house3_id').innerText = document.getElementById('house3_id').innerText.toString().toLowerCase();
  document.getElementById('house4_id').style.color='#000000';
  document.getElementById('house4_id').innerText = document.getElementById('house4_id').innerText.toString().toLowerCase();
  document.getElementById('house5_id').style.color='#000000';
  document.getElementById('house5_id').innerText = document.getElementById('house5_id').innerText.toString().toLowerCase();
  document.getElementById('house6_id').style.color='#000000';
  document.getElementById('house6_id').innerText = document.getElementById('house6_id').innerText.toString().toLowerCase();
  document.getElementById('house7_id').style.color='#000000';
  document.getElementById('house7_id').innerText = document.getElementById('house7_id').innerText.toString().toLowerCase();

  var p1 = document.getElementById('house1_id').innerText.toString().toLowerCase();
  var p2 = document.getElementById('house2_id').innerText.toString().toLowerCase();
  var p3 = document.getElementById('house3_id').innerText.toString().toLowerCase();
  var p4 = document.getElementById('house4_id').innerText.toString().toLowerCase();
  var p5 = document.getElementById('house5_id').innerText.toString().toLowerCase();
  var p6 = document.getElementById('house6_id').innerText.toString().toLowerCase();
  var p7 = document.getElementById('house7_id').innerText.toString().toLowerCase();

  if (p1 == document.bp.toString().toLowerCase())
    document.getElementById('house1_id').innerText = document.getElementById('house1_id').innerText.toString().toUpperCase();
  if (p2 == document.bp.toString().toLowerCase())
    document.getElementById('house2_id').innerText = document.getElementById('house2_id').innerText.toString().toUpperCase();
  if (p3 == document.bp.toString().toLowerCase())
    document.getElementById('house3_id').innerText = document.getElementById('house3_id').innerText.toString().toUpperCase();
  if (p4 == document.bp.toString().toLowerCase())
    document.getElementById('house4_id').innerText = document.getElementById('house4_id').innerText.toString().toUpperCase();
  if (p5 == document.bp.toString().toLowerCase())
    document.getElementById('house5_id').innerText = document.getElementById('house5_id').innerText.toString().toUpperCase();
  if (p6 == document.bp.toString().toLowerCase())
    document.getElementById('house6_id').innerText = document.getElementById('house6_id').innerText.toString().toUpperCase();
  if (p7 == document.bp.toString().toLowerCase())
    document.getElementById('house7_id').innerText = document.getElementById('house7_id').innerText.toString().toUpperCase();

  if (inplanet == "Reset") {
    document.getElementById('house1txt_id').innerHTML = "&nbsp;";
    document.getElementById('house2txt_id').innerHTML = "&nbsp;";
    document.getElementById('house3txt_id').innerHTML = "&nbsp;";
    document.getElementById('house4txt_id').innerHTML = "&nbsp;";
    document.getElementById('house5txt_id').innerHTML = "&nbsp;";
    document.getElementById('house6txt_id').innerHTML = "&nbsp;";
    document.getElementById('house7txt_id').innerHTML = "&nbsp;";
    return;
  }

  h1rel = getPlanetRelation(inplanet.toString().toLowerCase(),p1);
  h2rel = getPlanetRelation(inplanet.toString().toLowerCase(),p2);
  h3rel = getPlanetRelation(inplanet.toString().toLowerCase(),p3);
  h4rel = getPlanetRelation(inplanet.toString().toLowerCase(),p4);
  h5rel = getPlanetRelation(inplanet.toString().toLowerCase(),p5);
  h6rel = getPlanetRelation(inplanet.toString().toLowerCase(),p6);
  h7rel = getPlanetRelation(inplanet.toString().toLowerCase(),p7);

  h1color = getPlanetColor(h1rel);
  h2color = getPlanetColor(h2rel);
  h3color = getPlanetColor(h3rel);
  h4color = getPlanetColor(h4rel);
  h5color = getPlanetColor(h5rel);
  h6color = getPlanetColor(h6rel);
  h7color = getPlanetColor(h7rel);

  switch (h1rel) {
    case "pos. enemy" :
      htm1txt = "(<span style='color:blue'>Pos. <\/span><span style='color:red'>Enemy<\/span>)";
      break;
    case "neg. enemy" :
      htm1txt = "(<span style='color:red'>neg. enemy<\/span>)";
      break;
    case "clicked planet" :
      htm1txt = "(<span style='color:" + h1color + "'>" + h1rel + "<\/span>)";
	document.getElementById('house1_id').style.color = "red";
	document.getElementById('house1_id').innerText = document.getElementById('house1_id').innerText.toString().toUpperCase();
      break;
    default :
      htm1txt = "(<span style='color:" + h1color + "'>" + h1rel + "<\/span>)";
      break;
  }

  switch (h2rel) {
    case "pos. enemy" :
      htm2txt = "(<span style='color:blue'>Pos. <\/span><span style='color:red'>Enemy<\/span>)";
      break;
    case "neg. enemy" :
      htm2txt = "(<span style='color:red'>neg. enemy<\/span>)";
      break;
    case "clicked planet" :
      htm2txt = "(<span style='color:" + h2color + "'>" + h2rel + "<\/span>)";
	document.getElementById('house2_id').style.color = "red";
	document.getElementById('house2_id').innerText = document.getElementById('house2_id').innerText.toString().toUpperCase();
      break;
    default :
      htm2txt = "(<span style='color:" + h2color + "'>" + h2rel + "<\/span>)";
      break;
  }

  switch (h3rel) {
    case "pos. enemy" :
      htm3txt = "(<span style='color:blue'>Pos. <\/span><span style='color:red'>Enemy<\/span>)";
      break;
    case "neg. enemy" :
      htm3txt = "(<span style='color:red'>neg. enemy<\/span>)";
      break;
    case "clicked planet" :
      htm3txt = "(<span style='color:" + h3color + "'>" + h3rel + "<\/span>)";
	document.getElementById('house3_id').style.color = "red";
	document.getElementById('house3_id').innerText = document.getElementById('house3_id').innerText.toString().toUpperCase();
      break;
    default :
      htm3txt = "(<span style='color:" + h3color + "'>" + h3rel + "<\/span>)";
      break;
  }

  switch (h4rel) {
    case "pos. enemy" :
      htm4txt = "(<span style='color:blue'>Pos. <\/span><span style='color:red'>Enemy<\/span>)";
      break;
    case "neg. enemy" :
      htm4txt = "(<span style='color:red'>neg. enemy<\/span>)";
      break;
    case "clicked planet" :
      htm4txt = "(<span style='color:" + h4color + "'>" + h4rel + "<\/span>)";
	document.getElementById('house4_id').style.color = "red";
	document.getElementById('house4_id').innerText = document.getElementById('house4_id').innerText.toString().toUpperCase();
      break;
    default :
      htm4txt = "(<span style='color:" + h4color + "'>" + h4rel + "<\/span>)";
      break;
  }

  switch (h5rel) {
    case "pos. enemy" :
      htm5txt = "(<span style='color:blue'>Pos. <\/span><span style='color:red'>Enemy<\/span>)";
      break;
    case "neg. enemy" :
      htm5txt = "(<span style='color:red'>neg. enemy<\/span>)";
      break;
    case "clicked planet" :
      htm5txt = "(<span style='color:" + h5color + "'>" + h5rel + "<\/span>)";
	document.getElementById('house5_id').style.color = "red";
	document.getElementById('house5_id').innerText = document.getElementById('house5_id').innerText.toString().toUpperCase();
      break;
    default :
      htm5txt = "(<span style='color:" + h5color + "'>" + h5rel + "<\/span>)";
      break;
  }

  switch (h6rel) {
    case "pos. enemy" :
      htm6txt = "(<span style='color:blue'>Pos. <\/span><span style='color:red'>Enemy<\/span>)";
      break;
    case "neg. enemy" :
      htm6txt = "(<span style='color:red'>neg. enemy<\/span>)";
      break;
    case "clicked planet" :
      htm6txt = "(<span style='color:" + h6color + "'>" + h6rel + "<\/span>)";
	document.getElementById('house6_id').style.color = "red";
	document.getElementById('house6_id').innerText = document.getElementById('house6_id').innerText.toString().toUpperCase();
      break;
    default :
      htm6txt = "(<span style='color:" + h6color + "'>" + h6rel + "<\/span>)";
      break;
  }

  switch (h7rel) {
    case "pos. enemy" :
      htm7txt = "(<span style='color:blue'>Pos. <\/span><span style='color:red'>Enemy<\/span>)";
      break;
    case "neg. enemy" :
      htm7txt = "(<span style='color:red'>neg. enemy<\/span>)";
      break;
    case "clicked planet" :
      htm7txt = "(<span style='color:" + h7color + "'>" + h7rel + "<\/span>)";
	document.getElementById('house7_id').style.color = "red";
	document.getElementById('house7_id').innerText = document.getElementById('house7_id').innerText.toString().toUpperCase();
      break;
    default :
      htm7txt = "(<span style='color:" + h7color + "'>" + h7rel + "<\/span>)";
      break;
  }

  document.getElementById('house1txt_id').innerHTML = htm1txt;
  document.getElementById('house2txt_id').innerHTML = htm2txt;
  document.getElementById('house3txt_id').innerHTML = htm3txt;
  document.getElementById('house4txt_id').innerHTML = htm4txt;
  document.getElementById('house5txt_id').innerHTML = htm5txt;
  document.getElementById('house6txt_id').innerHTML = htm6txt;
  document.getElementById('house7txt_id').innerHTML = htm7txt;
}


function tooLong(val) {
  if (val >= 0) {
    return Math.floor(val);
  }
  else {
    return Math.ceil(val);
  }
}