
/* Current Date/Time Functions */

var d = new Date;		// current date/time
var hebcal_g2h = "http://www.hebcal.com/converter/?";	// URL


function today() {
	document.write(d.toLocaleString());
}


// Convert current date to Hebrew Date (local JS function - in kdate.js)

	function hebday() {
	var tday   = d.getDate();
	var tmonth = d.getMonth() + 1;
	var tyear  = d.getFullYear();
	if(tyear < 1900)
		tyear += 1900;	// if date from Netscape, then add 1900
	var hebDate = civ2heb(tday, tmonth, tyear);
	var hmS = hebDate.substring(hebDate.indexOf(' ')+1, hebDate.length);
	var hDay = eval(hebDate.substring(0, hebDate.indexOf(' ')));
	var hMonth = eval(hmS.substring(0, hmS.indexOf(' ')));
	var hYear = hmS.substring(hmS.indexOf(' ')+1, hmS.length);
	document.write(hDay + ' ' + hebMonth[hMonth+1] + ' ' + hYear);
	}


// Convert current date to Hebrew Date (Hebcal)

	function hebdate_win() {

	var gy = d.getFullYear();
	var gm = d.getMonth() + 1;	// adjust for base 0
	var gd = d.getDate();


	var conv_str = "gd=" + gd + "&gm=" + gm + "&gy=" + gy + "&g2h=Compute+Hebrew+Date&heb=on";

	var url_str = encodeURI(hebcal_g2h + conv_str);

	// window.alert("OK - " + url_str);

	w = window.open(url_str, "Hebrew_Date_Converter", "resizable,scrollbars=yes,width=540,height=535");
	w.focus();
	}


// Hebrew Calendar w/candle lighting times

	function hebrewcal_win() {

	hcwin = window.open("hebrewcal.html","Hebrew_Calendar", "resizable,scrollbars=yes,width=800,height=600");
	hcwin.focus();
	}


