var isMSIE = 0;
var isNetscape = 0;
var css = "default.css";
var version = parseFloat(navigator.appVersion);

if (navigator.appName.indexOf("Netscape") != -1)
	isNetscape = 1;

if (navigator.appName.indexOf("Microsoft") != -1)
	isMSIE = 1;

// IF MSIE THEN use default.css
if (isMSIE) css = "default.css";

// IF Netscape
else if (isNetscape) {
	if (version >= 5) css = "default.css";	// IF version 6+ THEN use default.css
	else css = "default_ns.css";		// IF version <6 THEN use default_ns.css
	}

document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"");
document.write(css);
//document.write("\"%3E"); may be needed for netscape
document.write("\">");

function CheckOptions(myForm)
{
	if(myForm.selectedIndex==0)
	{
		alert("Please select an option.");
		myForm.focus();
		return false;
	}
	else
	{
		return true;
	
	}
}

// this function is used for the holiday popup from the home page.
function PopUp()
{
	if(document.cookie==null || document.cookie=="")
		{
		var myDate = new Date();
		// Y2K Fix
		if (myDate.getYear() <= 1000) var myYear= myDate.getYear() + 1900;
		else  myYear= myDate.getYear(); 
		var myMonth = myDate.getMonth() +1; // this line gets the Month variable to correspond with the 		calendar month.
		var dayOfMonth = myDate.getDate();  // this line gets the current date (day of the month).
		var holiday = (myMonth + "/" + dayOfMonth + "/" + myYear);
		//document.write(holiday);
		var dateArray = new Array();
		dateArray["11/20/2006"] = "thanksgiving";
		dateArray["11/21/2006"] = "thanksgiving";
		dateArray["11/22/2006"] = "thanksgiving";
		dateArray["11/23/2006"] = "thanksgiving";
	
		dateArray["12/21/2006"] = "christmas";
		dateArray["12/22/2006"] = "christmas";
		dateArray["12/23/2006"] = "christmas";
		dateArray["12/24/2006"] = "christmas";
		dateArray["12/25/2005"] = "christmas";

		dateArray["12/28/2006"] = "newyear";
		dateArray["12/29/2006"] = "newyear";
		dateArray["12/30/2006"] = "newyear";
		dateArray["12/31/2006"] = "newyear";
		dateArray["1/1/2007"] = "newyear";

		dateArray["5/24/2007"] = "memorial";
		dateArray["5/25/2007"] = "memorial";
		dateArray["5/26/2007"] = "memorial";
		dateArray["5/27/2007"] = "memorial";
		dateArray["5/28/2007"] = "memorial";

		dateArray["7/1/2007"] = "independence";
		dateArray["7/2/2007"] = "independence";
		dateArray["7/3/2007"] = "independence";
		dateArray["7/4/2007"] = "independence";

		dateArray["8/30/2007"] = "labor";
		dateArray["8/31/2007"] = "labor";
		dateArray["9/1/2007"] = "labor";
		dateArray["9/2/2007"] = "labor";
		dateArray["9/3/2007"] = "labor";

		if (dateArray[holiday])
			{
			window.open('holidays.htm', dateArray[holiday], 'scrollbars=no,toolbar=no,width=435,height=400');
			}
		}
	document.cookie="Visited=Yes;";
}

function HolidayMsg(){
with (document) 
{               
                //Phone Error Message
	//        writeln('<div style="background:#F4F4F4;border:2px solid #8599B9;color:#13267A;font-weight:bold;padding:2px;margin:4px;">We are currently experiencing intermittent telephone problems.<br><br>You can still place orders via our secure shopping cart or you can e-mail us at <a href="mailto:info&#64;heavenlyoffice.com">info&#64;heavenlyoffice.com</a> with your inquiries.</div>');
	
	          //Shopping Cart Error Message
	//	  writeln('<div style="background:#F4F4F4;border:2px solid #8599B9;color:#13267A;font-weight:bold;padding:2px;margin:4px;">We are currently experiencing shopping cart problems.<br><br>You can still place orders via telephone (1-800-257-2968) or you can e-mail us at <a href="mailto:info&#64;heavenlyoffice.com">info&#64;heavenlyoffice.com</a> with your inquiries.</div>');
                
                var myDate = new Date();
		// Y2K Fix
		if (myDate.getYear() <= 1000) var myYear= myDate.getYear() + 1900;
		else  myYear= myDate.getYear(); 
		var myMonth = myDate.getMonth() +1; // this line gets the Month variable to correspond with the 		calendar month.
		var dayOfMonth = myDate.getDate();  // this line gets the current date (day of the month).
		var holiday = (myMonth + "/" + dayOfMonth + "/" + myYear);
		//document.write(holiday);
		var dateArray = new Array();
		dateArray["11/21/2011"] = "thanksgiving";
		dateArray["11/22/2011"] = "thanksgiving";
		dateArray["11/23/2011"] = "thanksgiving";
		dateArray["11/24/2011"] = "thanksgiving";

		dateArray["12/22/2011"] = "christmas";
		dateArray["12/23/2011"] = "christmas";
		dateArray["12/24/2011"] = "christmas";
		dateArray["12/25/2011"] = "christmas";
		dateArray["12/26/2011"] = "christmas";

		dateArray["12/29/2011"] = "newyear";
		dateArray["12/30/2011"] = "newyear";
		dateArray["12/31/2011"] = "newyear";
		dateArray["1/1/2012"] = "newyear";
		dateArray["1/2/2012"] = "newyear";

		dateArray["5/26/2011"] = "memorial";
		dateArray["5/27/2011"] = "memorial";
		dateArray["5/28/2011"] = "memorial";
		dateArray["5/29/2011"] = "memorial";
		dateArray["5/30/2011"] = "memorial";

		dateArray["7/1/2011"] = "independence";
		dateArray["7/2/2011"] = "independence";
		dateArray["7/3/2011"] = "independence";
		dateArray["7/4/2011"] = "independence";

		dateArray["9/1/2011"] = "labor";
		dateArray["9/2/2011"] = "labor";
		dateArray["9/3/2011"] = "labor";
		dateArray["9/4/2011"] = "labor";
		dateArray["9/5/2011"] = "labor";

		var innerHtmlArray = new Array();
                innerHtmlArray["thanksgiving"] = "Heavenly Office will be closed ";
		innerHtmlArray["thanksgiving1"] = "Thursday, November 24, 2011.<br><br>";
		innerHtmlArray["thanksgiving2"] = "Feel free to order online and ";
		innerHtmlArray["thanksgiving3"] = "Happy Thanksgiving<br>";
		innerHtmlArray["thanksgiving4"] = "from Heavenly Office!";

		innerHtmlArray["christmas"] = "Heavenly Office will be closed ";
		innerHtmlArray["christmas1"] = "Monday, December 26, 2011.<br><br>";
		innerHtmlArray["christmas2"] = "Feel free to order online and ";
		innerHtmlArray["christmas3"] = "Happy Holidays from<br>";
		innerHtmlArray["christmas4"] = "Heavenly Office!";

		innerHtmlArray["newyear"] = "Heavenly Office will be closed ";
		innerHtmlArray["newyear1"] = "Monday, January 2, 2011.<br><br>";
		innerHtmlArray["newyear2"] = "Feel free to order online and ";
		innerHtmlArray["newyear3"] = "have a happy New Year<br>";
		innerHtmlArray["newyear4"] = "from Heavenly Office!";

		innerHtmlArray["memorial"] = "Heavenly Office will be closed ";
		innerHtmlArray["memorial1"] = "Monday, May 30, 2011 for Memorial Day.<br><br>";
		innerHtmlArray["memorial2"] = "Feel free to order online and ";
		innerHtmlArray["memorial3"] = "thank you from all of us at ";
		innerHtmlArray["memorial4"] = "Heavenly Office!";

		innerHtmlArray["independence"] = "Heavenly Office will be closed ";
		innerHtmlArray["independence1"] = "Monday, July 4, 2011.<br><br>";
		innerHtmlArray["independence2"] = "Feel free to order online and ";
		innerHtmlArray["independence3"] = "happy 4th of July from ";
		innerHtmlArray["independence4"] = "Heavenly Office!";


		innerHtmlArray["labor"] = "Heavenly Office will be closed ";
		innerHtmlArray["labor1"] = "Monday, September 5, 2011 for Labor Day.<br><br>";
		innerHtmlArray["labor2"] = "Feel free to order online and ";
		innerHtmlArray["labor3"] = "thank you from all of us at ";
		innerHtmlArray["labor4"] = "Heavenly Office!";

		var myDate = new Date();
		var myYear = '';
		var myMonth = '';
		var dayOfMonth = '';
		// Y2K Fix
		if (myDate.getYear() <= 1000) 
		{
		myYear= myDate.getYear() + 1900;
		} else {
		myYear= myDate.getYear(); 
		}
		myMonth = myDate.getMonth() +1; // this line gets the Month variable to correspond with the calendar month.
		dayOfMonth = myDate.getDate();  // this line gets the current date (day of the month).
		var holiday = myMonth + "/" + dayOfMonth + "/" + myYear;
		if (dateArray[holiday])
			{
			writeln('<div style="background:#F4F4F4;border:2px solid #8599B9;color:#13267A;font-weight:bold;padding:2px;margin:4px;">');
			document.write(innerHtmlArray[dateArray[holiday]]);
			document.write(innerHtmlArray[dateArray[holiday] + "1"]);
			document.write(innerHtmlArray[dateArray[holiday] + "2"]);
			document.write(innerHtmlArray[dateArray[holiday] + "3"]);
			document.write(innerHtmlArray[dateArray[holiday] + "4"]);
			writeln('</div>');
			}
		
	}	
}
