//START USER EDITABLE STUFF//
var articlesArray = new Array('#', 'Select an article',
'/astro/advice/guy/index.html','A Girl\'s Guide to Guys\' Signs',
'/astro/forecast/2006/index.html','2006Forecast',
'/astro/advice/career/index.html','An Astrology Guide to Careers',
'/astro/advice/costume/index.html','Your Secret Identity',
'/astro/advice/weddings/index.html','The Perfect Wedding',
'/astro/advice/friendship/index.html','Friends and Foes of the Zodiac',
'/astro/advice/fitness/index.html','The Right Workout for Your Sign',
'/astro/advice/summer_travel/index.html','Summer Travel by Sign',
'/astro/advice/social_styles/index.html','Social Styles of the Zodiac',
'/astro/advice/sexy_eats/index.html','Sexy, Sumptuous Eats by Sign');
var qaArray = new Array('#', 'Select an article',

'/astro/advice/articles/astro_article_saturnhavoc.html','Does Saturn Wreak Havoc?','/astro/advice/articles/astro_article_committedaries.html','Will Her Aries Commit?',
'/astro/advice/articles/astro_article_unemployedpisces.html','The Perfect Pisces Job',
'/astro/advice/articles/astro_article_torntaurus.html','A Heartbroken Libra',
'/astro/advice/articles/astro_article_faithful.html','Keeping Him Faithful',
'/astro/advice/articles/astro_article_virgorut.html','Virgo in a Rut',
'/astro/advice/articles/astro_article_jealousgemini.html','A Jealous Gemini',
'/astro/advice/articles/astro_article_cuspdweller.html','On the Cusp',
'/astro/advice/articles/astro_article_torntaurus.html','A Taurus Torn',
'/astro/advice/articles/astro_article_slim_scorpio.html','A Scorpio Slims Down',
'/astro/advice/articles/astro_article_sagstruggles.html','A Sagittarius Struggles',
'/astro/advice/articles/astro_article_army.html','Enlist or Enroll',
'/astro/advice/articles/astro_article_timetotravel.html','Best Time to Travel',
'/astro/advice/articles/astro_article_reconciliation.html','Is a Reconciliation Possible?',
'/astro/advice/articles/astro_article_spottingasoulmate.html','Spotting a Soul Mate',
'/astro/advice/articles/astro_article_ariesemptynest.html','An Aries\' Empty Nest',
'/astro/advice/articles/astro_article_cap_calling.html','A Capricorn\'s Calling',
'/astro/advice/articles/astro_article_past_lives.html','Past Lives', 
'/astro/advice/articles/astro_article_angels.html','Understanding Angels', 
'/astro/advice/articles/astro_article_monthsofdoom.html', 'Months of Doom',
'/astro/advice/articles/astro_article_geminiguys.html','Gemini Guys',
'/astro/advice/articles/astro_article_fullmoonmadness.html','Full Moon Madness',
'/astro/advice/articles/astro_article_leosgoodlovers.html','Leo Lost in Love',
'/astro/advice/articles/astro_article_cancerclash.html','Cancer Clash');
//Associative Array for leftbox labels inside Astro/Advice/*
var leftboxLabels  = new Array();
//these specify which labels get associated with which article set
leftboxLabels['guy'] =  'CHOOSE  SIGN'
leftboxLabels['career'] =  'GET JOBS'
leftboxLabels['costume'] =  'GET COSTUMES'
leftboxLabels['weddings'] =  'WEDDING FOR...'
leftboxLabels['sexy_eats'] =  'GET FOODS...'
leftboxLabels['social_styles'] =  'GET STYLE'
leftboxLabels['summer_travel'] =  'TRAVEL FOR...'
leftboxLabels['fitness'] =  'GET WORKOUTS'
leftboxLabels['friendship'] =  'FIND FRIENDS'
var adviceLinks = new Array('/astro/advice/guy/index.html','A Girl\'s Guide to Guys\' Signs',
'/astro/forecast/2006/index.html','2006Forecast',
'/astro/advice/career/index.html','An Astrology Guide to Careers',
'/astro/advice/articles/astro_article_timetotravel.html','Best Time to Travel');

//END USER EDITABLE STUFF//



function onAErrorHandler(msg,url,line) {
//alert(msg + "\n" + url + "\n" + line);
return true;
}
onerror = onAErrorHandler;

var zodiac = new Array("Aries","Taurus","Gemini","Cancer","Leo","Virgo","Libra","Scorpio","Sagittarius","Capricorn","Aquarius","Pisces");
var mos = new Array('jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec');
var thisSign,thisYear, thisMonth, lastMonth, nextMonth;
var astroDate = new Date();
thisSign = extractSign();
thisYear = astroDate.getYear();
if ((is_nav) || (thisYear<200)) thisYear+=1900;
lastMonth = mos[astroDate.getMonth()-1];
thisMonth = mos[astroDate.getMonth()];
nextMonth = mos[astroDate.getMonth()+1];
var loc = new String(location);
//astroglyphs card reader
if (location.search.length>0) {
	var query = new String(location.search);
	if ((loc.indexOf('/glyphs/index.html')!=-1) && (query.indexOf('glyphid')!=-1)) {
		var glyphid = query.substring(9,(query.length));
		var glyphURL = "http://www.lifetimetv.com/cgi/decoder.pl?id="+glyphid;
		openWindow(glyphURL,"astroglyphs",468,390,0);	
	}
}
	//If you're in the articles section, where are you:
	var artDirTest = loc.indexOf('/astro/advice/');
	var dirEnd = loc.lastIndexOf('/');
	if ((artDirTest)!=-1) {
		var artPath = loc.substring(artDirTest,dirEnd);
		var parsedDirStart = artPath.lastIndexOf('/');
		var thisArtDir = artPath.substring((parsedDirStart+1),artPath.length);
	}
function drawSexyEats() {
	document.write('Take me away');
}
function drawArticleLinks() {
	var str = "";
	var adviceList = new Array();
	adviceList.push('<div align=center class=boxhdr>MORE LINKS</div>');
	adviceList.push('<img src="http://www.lifetimetv.com/images/astro/astro_dotline_lightpurple.gif" vspace=4><br>');
	for (i=0;i<adviceLinks.length;i+=2) {
		str = '<a href="' + adviceLinks[i] + '">' + adviceLinks[i+1] + '</a><br><br>';	
		adviceList.push(str);		
	}
	adviceList = adviceList.join('\n');
	document.write(adviceList);
}
function drawCustomLeftbox() {
	//alert('drawcustom');
	var commonArray = new Array();
	var label = leftboxLabels[thisArtDir];
	var i = 0;
	var j = 0;
	while (i<zodiac.length) {
	 	commonArray[j] = zodiac[i].toLowerCase() + ".html";
	 	j++;
	 	commonArray[j] = zodiac[i];
	 	i++;
	 	j++;
	}
	drawBox(commonArray,label,'Choose sign');
}
function drawPulldown(lmargin,type,label,style) {
	var templine, widthOption = "";
	var i = 0;
	var list = new Array(); 
	var tempArray = eval(type+'Array');
	if (lmargin!=0) { widthOption = '<td width=' + lmargin + '>'; }
	list.push('<table cellpadding=0 cellspacing=0 border=0>');
	list.push('<form>');
	if (label!="") {
	templine = '<tr><td class='+style+'><b>'+label+'</b></td></tr>';
	list.push(templine);
	}
	templine = '<tr>' + widthOption + '<td>';
	list.push(templine);
	templine=null;
	list.push('<select onChange=\"if ((w=this.options[this.selectedIndex].value)!=\'\') window.location=w\">');
	while (i<tempArray.length) {
		templine='<option value="' + tempArray[i] + '">' + tempArray[i+1] + '</option>';
		list.push(templine);
		i=i+2;
	}
	list.push('</select>');
	list.push('</td></tr></form></table>');
	list = list.join('\n');
	document.write(list);
}
function getDescription(num) {
	//document.all.zodiac_descr.innerHTML = "Jello";
	var textToShow = "YOUR DAILY HOROSCOPE";
	if (num!='D') { textToShow = zodiac[num]; }
	textToShow = textToShow.toUpperCase();
	document.getElementById("zodiac_descr").innerHTML = textToShow;
}
function drawBox(boxContents,boxHdr,firstOption) {
	var tempString = "";
	var myBox = new Array();
	myBox.push('<table cellpadding=0 cellspacing=0 border=0 width=127>');
	myBox.push('<tr>');
	myBox.push('<td width=1 class="boxborder"><img src="http://www.lifetimetv.com/images/common/spacer.gif" height=1 width=1></td>');
	myBox.push('<td colspan=3 height=1 class="boxborderlite"><img src="http://www.lifetimetv.com/images/common/spacer.gif" width=1 height=1></td>');
	myBox.push('<td width=1 class="boxborder"><img src="http://www.lifetimetv.com/images/common/spacer.gif" height=1 width=1></td>');
	myBox.push('</tr>');
	myBox.push('<tr>');
	myBox.push('<td width=1 class="boxborder"><img src="http://www.lifetimetv.com/images/common/spacer.gif" height=1 width=1></td>');
	myBox.push('<td width=14 class="boxbody">&nbsp;</td>');
	myBox.push('<td width=97 class="boxbody"><form>');
		tempString = "<span class=\"boxhdr\"><span style=\"line-height:200%;\">&nbsp;" + boxHdr + "</span></span>";
	myBox.push(tempString);
		tempString = null;
	myBox.push('<select onChange=\"if ((w=this.options[this.selectedIndex].value)!=\'\') window.location=w\">');
		tempString = "<option>"+firstOption+"</option>";	
	myBox.push(tempString);
		tempString = null;
		var i = 0;
		var j = 0;
		while (i<(boxContents.length/2)) {
			tempString = "<option value=\"" + boxContents[j] + "\">" + boxContents[j+1] + "</option>";
			myBox.push(tempString);
			tempString = null;
			i++;
			j+=2;
		}
	myBox.push('</select>');
	myBox.push('</form>');
	myBox.push('<br>');
	myBox.push('</td>');
	myBox.push('<td width=14 class="boxbody">&nbsp;</td>');
	myBox.push('<td width=1 class="boxborder"><img src="http://www.lifetimetv.com/images/common/spacer.gif" height=1 width=1></td>');	
	myBox.push('</tr>');
	myBox.push('<tr>');
	myBox.push('<td colspan=5 height=1 class="boxborder"><img src="http://www.lifetimetv.com/images/common/spacer.gif" width=1 height=1></td>');
	myBox.push('</tr>');
	myBox.push('</table>');
	myBox = myBox.join('\n');
	document.write(myBox);
	myBox = null;
}
function loadForecast(prefix) {
	var forecastArray = new Array();
	var tempURL = "";
	var i = 0;
	var j = 0;
	while (i<zodiac.length) {
		tempURL = "http://www.lifetimetv.com/astro//" + prefix + "cast/"+ thisYear + "/" + zodiac[i].toLowerCase()+".html";
	 	forecastArray[j]=tempURL;
	 	j++;
	 	forecastArray[j]=zodiac[i];
	 	i++;
	 	j++;
	}
	return forecastArray;
}
function drawForecast() {
	var tempCastArray = loadForecast('fore');
	drawBox(tempCastArray,thisYear + ' FORECAST','Choose sign');
}
function drawLovecast() {
	var tempCastArray = loadForecast('love');
	drawBox(tempCastArray,thisYear + ' LOVECAST','Choose sign');
}
function drawNumerPulldown() {
	var numerArray = new Array('/astro/numerology/astro_numer_1.html',1,
	'/astro/numerology/astro_numer_2.html',2,
	'/astro/numerology/astro_numer_3.html',3,
	'/astro/numerology/astro_numer_4.html',4,
	'/astro/numerology/astro_numer_5.html',5,
	'/astro/numerology/astro_numer_6.html',6,
	'/astro/numerology/astro_numer_7.html',7,
	'/astro/numerology/astro_numer_8.html',8,
	'/astro/numerology/astro_numer_9.html',9,
	'/astro/numerology/astro_numer_11.html',11,
	'/astro/numerology/astro_numer_22.html',22);
	drawBox(numerArray,'NUMEROLOGY','Pick number');
}
function drawChinesePulldown() {
	var chineseArray = new Array('/astro/chinese/astro_chinese_rat.html','Rat',
	'/astro/chinese/astro_chinese_ox.html','Ox',
	'/astro/chinese/astro_chinese_tiger.html','Tiger',
	'/astro/chinese/astro_chinese_rabbit.html','Rabbit',
	'/astro/chinese/astro_chinese_dragon.html','Dragon',
	'/astro/chinese/astro_chinese_snake.html','Snake',
	'/astro/chinese/astro_chinese_horse.html','Horse',
	'/astro/chinese/astro_chinese_sheep.html','Sheep',
	'/astro/chinese/astro_chinese_monkey.html','Monkey',
	'/astro/chinese/astro_chinese_rooster.html','Rooster',
	'/astro/chinese/astro_chinese_dog.html','Dog',
	'/astro/chinese/astro_chinese_pig.html','Pig');
	drawBox(chineseArray,'PICK SYMBOL','Choose one');
}
function drawDailyScopes() {
	var dailyArray = new Array();
	var tempArray = new Array('/cgi/astro_daily.pl?sign=1','/cgi/astro_daily.pl?sign=2','/cgi/astro_daily.pl?sign=3','/cgi/astro_daily.pl?sign=4','/cgi/astro_daily.pl?sign=5','/cgi/astro_daily.pl?sign=6','/cgi/astro_daily.pl?sign=7','/cgi/astro_daily.pl?sign=8','/cgi/astro_daily.pl?sign=9','/cgi/astro_daily.pl?sign=10','/cgi/astro_daily.pl?sign=11','/cgi/astro_daily.pl?sign=12');
	var i = 0;
	var j = 0;
	while (i<zodiac.length) {
	 	dailyArray[j]=tempArray[i];
	 	j++;
	 	dailyArray[j]=zodiac[i];
	 	i++;
	 	j++;
	}
	drawBox(dailyArray,'DAILY \'SCOPES','Choose sign');
}
function drawLoveScopes() {
	var loveArray = new Array();
	var i = 0;
	var j = 0;
	while (i<zodiac.length) {
//	 	loveArray[j]="javascript:getLovescope('" + zodiac[i].toLowerCase()  + "')";
		loveArray[j]="http://www.lifetimetv.com/astro//summerscopes/2005/" + zodiac[i].toLowerCase() + ".html";
	 	j++;
	 	loveArray[j]=zodiac[i];
	 	i++;
	 	j++;
	}
	drawBox(loveArray,'SUMMER \'SCOPES','Choose sign');
}
function getLovescope(thisArg) {
	var directionOption = thisYear + "/" + thisMonth + "/";
	var currMonthN = "";
	loc = new String(location);
	for (i=0;i<=mos.length;i++) {
		if (loc.indexOf(mos[i])!=-1) {
			currMonthN = i;
		}
	}
	lastMonth=mos[currMonthN-1];
	nextMonth=mos[currMonthN+1];
	//FOR LEFT PULLDOWN BOX
	//go back a month
	if (thisArg == "prev") {
		if (thisMonth=="jan") { directionOption = (thisYear-1)+ "/" +lastMonth + "/"; }
		else { directionOption = thisYear+ "/" +lastMonth + "/"; }
		location="http://www.lifetimetv.com/astro//lovescopes/" + directionOption + thisSign + ".html";
	}
	//go forward a month
	else if (thisArg == "next") {
		if (thisMonth=="dec") { directionOption = (thisYear+1)+ "/" +nextMonth + "/"; }
		else { directionOption = thisYear+ "/" +nextMonth + "/"; }
		location="http://www.lifetimetv.com/astro//lovescopes/" + directionOption + thisSign + ".html";
	}
	else {
		//current month by default, called by sign name ie. Aries
		location="http://www.lifetimetv.com/astro//lovescopes/" + directionOption + thisArg + ".html";
	}
}
function drawLovescopesIndex() {
        var i = 0;
        var lstr = "";
	while (i<zodiac.length) {
	   lstr = "<a href=\""+ "http://www.lifetimetv.com/astro//summerscopes/2005/" + zodiac[i].toLowerCase() + ".html\">" + zodiac[i] + "</a><br>";
       document.write(lstr);
       i++;
	}
}
function getLovecast() {
	location="http://www.lifetimetv.com/astro//lovecast/" +thisYear+ "/" +thisSign+ ".html"; 
}
function extractSign() {
	//This function looks for sign names in the location string
	var currSign,checkSign,tempSign;
	for(i=0;i<12;i++) {
		currSign = new String(zodiac[i]);
		checkSign=currSign.toLowerCase();
			if (loc.indexOf(checkSign)!=-1) { 
				tempSign=checkSign; 
				break;
			}
	}
	return tempSign;
}
var m="1";
var d="1";
function getZodiac(form) {
	//alert('m='+m+',day='+d);
	var mon = m; var day = d;
	if ( ((mon=='03') && (day>20)) || ((mon=='04') && (day<21)) ) { window.location="http://www.lifetimetv.com/shows/ip/birthdays/birthdays_aries.html"; } //aries
	if ( ((mon=='04') && (day>20)) || ((mon=='05') && (day<22)) ) { window.location="http://www.lifetimetv.com/shows/ip/birthdays/birthdays_taurus.html"; } //taurus
	if ( ((mon=='05') && (day>21)) || ((mon=='06') && (day<23)) ) { window.location="http://www.lifetimetv.com/shows/ip/birthdays/birthdays_gemini.html"; } //gemini
	if ( ((mon=='06') && (day>22)) || ((mon=='07') && (day<24)) ) { window.location="http://www.lifetimetv.com/shows/ip/birthdays/birthdays_cancer.html"; } //cancer
	if ( ((mon=='07') && (day>23)) || ((mon=='08') && (day<24)) ) { window.location="http://www.lifetimetv.com/shows/ip/birthdays/birthdays_leo.html"; } //leo
	if ( ((mon=='08') && (day>23)) || ((mon=='09') && (day<24)) ) { window.location="http://www.lifetimetv.com/shows/ip/birthdays/birthdays_virgo.html"; } //virgo
	if ( ((mon=='09') && (day>23)) || ((mon=='10') && (day<24)) ) { window.location="http://www.lifetimetv.com/shows/ip/birthdays/birthdays_libra.html"; } //libra
	if ( ((mon=='10') && (day>23)) || ((mon=='11') && (day<23)) ) { window.location="http://www.lifetimetv.com/shows/ip/birthdays/birthdays_scorpio.html"; } //scorpio
	if ( ((mon=='11') && (day>22)) || ((mon=='12') && (day<22)) ) { window.location="http://www.lifetimetv.com/shows/ip/birthdays/birthdays_sagittarius.html"; } //sagittarius
	if ( ((mon=='12') && (day>21)) || ((mon=='01') && (day<21)) ) { window.location="http://www.lifetimetv.com/shows/ip/birthdays/birthdays_capricorn.html"; } //capricorn
	if ( ((mon=='01') && (day>20)) || ((mon=='02') && (day<20)) ) { window.location="http://www.lifetimetv.com/shows/ip/birthdays/birthdays_aquarius.html"; } //aquarius
	if ( ((mon=='02') && (day>19)) || ((mon=='03') && (day<21)) ) { window.location="http://www.lifetimetv.com/shows/ip/birthdays/birthdays_pisces.html"; } //pisces
}

