//Filename: nd-core.js
//Purpose: Common variables and functions.
var lHome = "<b>Ron Aubrey<br />520 N 3rd ST<br />Nicholasville<br />KY  40356<br /></b>";
var lFax = "<b>(859) 885-9483</b>";
var lPhone = "<b>(859) 885-7317 (Between 9am and 5pm EST)</b>";

function dw(pData) {
	document.write(pData);
}
function makeOptions(x) {
	for (i=1;i<x+1;i++) {
		dw('<option>'+i+' </option>');
	}
}

function delay(x) {
	var today=new Date();
	var now=today.getSeconds();
	var today2; now2;

	while (1) {
		today2=new Date();
		var now2=today2.getSeconds();
		if (now2<now) {now2+=x;}
		if (now2-now>=3) {break;}
	}
}
function replace(string,text,by) {
// Replaces text with by in string
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}
function toggleFont(x) {
	if (document.getElementById(x).style.visibility == "hidden") {
		document.getElementById(x).style.visibility = 'visible';
	} else {
		document.getElementById(x).style.visibility = 'hidden';
	}
}
function openLogo() {
	var win = window.open('/nodog/logos.html','logos','width=735,height=670,left=10,top=10');
}
function openExample() {
	var win = window.open('/nodog/example/','examples','width=635,height=625,left=10,top=10,scrollbars=yes');
}
