// convert all characters to lowercase to simplify testing   
//find out if the browser is MSIE and if ver is 5.5 or 6 for writeHdr
        var agt=navigator.userAgent.toLowerCase();                                  
        var appVer = navigator.appVersion.toLowerCase();                            
        var is_minor = parseFloat(appVer);                                          
        var is_major = parseInt(is_minor); 
		var iePos  = appVer.indexOf('msie');  
        if (iePos !=-1) {                                                           
        is_minor = parseFloat(appVer.substring(iePos+5,appVer.indexOf(';',iePos)))
           is_major = parseInt(is_minor);                                           
        }   
	var name = navigator.appName + is_minor;
//end browser sniff

//roll over effect for IE
sfHover = function() {
var sfEls = document.getElementById("nav").getElementsByTagName("LI");
for (var i=0; i<sfEls.length; i++) {
sfEls[i].onmouseover=function() {
this.className+=" sfhover";		}
sfEls[i].onmouseout=function() {
this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
}	}}
if (window.attachEvent) window.attachEvent("onload", sfHover);

//re-writes the header for the png image
var img = "<a href=\"http://www.badaboomfireworkspa.com\"><img src=\"../images/hdr4b.png\" width=\"900\" height=\"107\" border=\"0\" alt=\"\"></a>";

function writehdr(){
	document.getElementById('hdr').innerHTML=img;
	if(name=="Microsoft Internet Explorer5.5" || name=="Microsoft Internet Explorer6"){
		correctPNG();
	}
	else{	
		document.getElementById('hdr').innerHTML=img;}
	}

//edits for the contact us form
function Edit(frm)
{
	if (frm.name.value == "")
	{
		alert("You must enter your name");
		return false;
	}

	if (frm.email.value == "")
	{
		alert("You must enter an email address");
		frm.email.focus();
		return false;
	}

	if ((frm.email.value.indexOf("@") < 3) || (frm.email.value.indexOf(".") < 7))
    {
		alert("This is not a valid E-Mail addrress");
		frm.email.focus();
		frm.email.select();
		return false;
	} 


	if(frm.Comments.value == "" || frm.Comments.value == " ")
	{
		alert("The comment box is empty\n You must enter a comment");
		return false;
	} 
} 

//fixes the png issue in IE6 and 5.5
function correctPNG() 
   {
   for(var i=0; i<document.images.length; i++)
      {
   var img = document.images[i]
   var imgName = img.src.toUpperCase()
   if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
      {
   var imgID = (img.id) ? "id='" + img.id + "' " : ""
   var imgClass = (img.className) ? "class='" + img.className + "' " : ""
   var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='"
+ img.alt + "' "
   var imgStyle = "display:inline-block;" + img.style.cssText 
   if (img.align == "left") imgStyle = "float:left;" + imgStyle
   if (img.align == "right") imgStyle = "float:right;" + imgStyle
   if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle  
   var strNewHTML = "<span " + imgID + imgClass + imgTitle
   + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;"
+ imgStyle + ";"
      + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
   + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
   img.outerHTML = strNewHTML
   i = i-1
      }
      }
   }


function countdown_clock(year, month, day, hour, minute, format)
         {
         //I chose a div as the container for the timer, but
         //it can be an input tag inside a form, or anything
         //who's displayed content can be changed through
         //client-side scripting.
         html_code = '<div id="countdown" style="color:#0000ff;font-weight:bold;" align="center"></div>';
//         document.write("<div align='center' style='color:#FF6400;font-weight:bold'>Only");
         document.write(html_code);
//         document.write("left until July 4th 2008</div>");
         
         countdown(year, month, day, hour, minute, format);                
         }
         
function countdown(year, month, day, hour, minute, format)
         {var year=11;
         Today = new Date();
         Todays_Year = Today.getFullYear() - 2000;
         Todays_Month = Today.getMonth();                  
         
         //Convert both today's date and the target date into miliseconds.                           
         Todays_Date = (new Date(Todays_Year, Todays_Month, Today.getDate(), 
                                 Today.getHours(), Today.getMinutes(), Today.getSeconds())).getTime();                                 
         Target_Date = (new Date(year, month - 1, day, hour, minute, 00)).getTime();                  
         
         //Find their difference, and convert that into seconds.                  
         Time_Left = Math.round((Target_Date - Todays_Date) / 1000);
         
         if(Time_Left < 0)
            Time_Left = 0;
         
         switch(format)
               {
               case 0:
                    //The simplest way to display the time left.
                    countdown.innerHTML = Time_Left + ' seconds';
                    break;
               case 1:
                    //More datailed.
                    days = Math.floor(Time_Left / (60 * 60 * 24));
                    Time_Left %= (60 * 60 * 24);
                    hours = Math.floor(Time_Left / (60 * 60));
                    Time_Left %= (60 * 60);
                    minutes = Math.floor(Time_Left / 60);
                    Time_Left %= 60;
                    seconds = Time_Left;
                    
                    dps = 's'; hps = 's'; mps = 's'; sps = 's';
                    //ps is short for plural suffix.
                    if(days == 1) dps ='';
                    if(hours == 1) hps ='';
                    if(minutes == 1) mps ='';
                    if(seconds == 1) sps ='';
                    
					document.getElementById('countdown').innerHTML ="<br />Only ";
                    document.getElementById('countdown').innerHTML += days + ' day' + dps + ' ';
                    document.getElementById('countdown').innerHTML += hours + ' hour' + hps + ' ';
                    document.getElementById('countdown').innerHTML += minutes + ' minute' + mps + ' and ';
                    document.getElementById('countdown').innerHTML += seconds + ' second' + sps;
                    document.getElementById('countdown').innerHTML +=" left until July 4th 2011!!!";
                    break;
               default: 
                    countdown.innerHTML = Time_Left + ' seconds';
               }
               
         //Recursive call, keeps the clock ticking.
         setTimeout('countdown(' + year + ',' + month + ',' + day + ',' + hour + ',' + minute + ',' + format + ');', 1000);
         }
var newwindow;
function poptastic(url)
{
newwindow=window.open(url,'name','height=320,width=400,resizable=no,scrollbars=no,toolbar=no,status=no,location=no');
	if (window.focus) {newwindow.focus()}
}


function printthis(which) {
	document.getElementsByTagName('div').style.display = "none";
	document.getElementsById(which).style.display = "block";
	window.print();
	document.getElementsByTagName('div').style.display = "block";
} 