function initPopup() {
	if (typeof document.body.style.maxHeight == 'undefined')
	{
		var view = document.getElementById("view");
		if(view)
		{
			var view_ = view.getElementsByTagName("div");
			for (var i=0; i<view_.length; i++)
			{
				view_[i].onmouseover = function()
				{
					this.className += " hover";
				}
				view_[i].onmouseout = function()
				{
					this.className = this.className.replace(" hover", "");
				}
			}
		}
	}
}
function initNav() {
	if (typeof document.body.style.maxHeight == 'undefined')
	{
		var nav = document.getElementById("main-nav");
		var lis = nav.getElementsByTagName("li");
		for (var i=0; i<lis.length; i++)
		{
			lis[i].onmouseover = function()
			{
				this.className += " hover";
			}
			lis[i].onmouseout = function()
			{
				this.className = this.className.replace(" hover", "");
			}
		}
	}
}
	
var transparentImage = "../images/transparent.gif";
function fixTrans()
{
	if (typeof document.body.style.maxHeight == 'undefined') {

	var imgs = document.getElementsByTagName("img");
	
	for (i = 0; i < imgs.length; i++)
	{	
		if (imgs[i].src.indexOf(transparentImage) != -1)
		{
			return;
		}

		if (imgs[i].src.indexOf(".png") != -1)
			{
				var src = imgs[i].src;
				imgs[i].src = transparentImage;
				imgs[i].runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
				imgs[i].style.display = "inline-block";
			}
		}	
	}
}

if (document.all && !window.opera)
	attachEvent("onload", fixTrans);
function initInputs()
{
	var inputs = document.getElementsByTagName("input");
	for (var i=0; i<inputs.length; i++)
	{
		if (inputs[i].type == "text" && (inputs[i].name == "search"))
		{
			inputs[i].onfocus = function ()
			{
				if (this.value == "SEARCH OUR SITE")
					this.value = "";
			}
			inputs[i].onblur = function ()
			{
				if (this.value == "" && this.name == "search") this.value = "SEARCH OUR SITE";
			}
		}
	}
}
if (window.addEventListener)
	window.addEventListener("load", initInputs, false);
else if (window.attachEvent)
{
	window.attachEvent("onload", initInputs);
	window.attachEvent("onload", fixTrans);
	//window.attachEvent("onload", initNav);
	window.attachEvent("onload", initPopup);
}

//suckerfish menu
$(function() {			
   $("ul#nav").superfish({ 
   		delay:       500,                            // changed from one sec to 1/2 sec SRF 20081002 
		animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation
		speed:       'slow',                          // faster animation speed
    	//animation: {height:'show'},   // slide-down effect without fade-in 
    	//delay:     1200,               // 1.2 second delay on mouseout
        autoArrows:  true,                           // enable generation of arrow mark-up
		dropShadows: true                            // enable drop shadows
 
   	}).find('ul').bgIframe({opacity:false});   	   	  	     			
	
   $("ul#top-nav").superfish({ 
   		delay:       500,                            // changed from one sec to 1/2 sec SRF 20081002 
		animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation
		speed:       'slow',                          // faster animation speed
    	//animation: {height:'show'},   // slide-down effect without fade-in 
    	//delay:     1200,               // 1.2 second delay on mouseout
        autoArrows:  false,                           // disable generation of arrow mark-up
		dropShadows: false                            // disable drop shadows
 
   	}); //.find('ul').bgIframe({opacity:false});   	   	  	     			

});

// sIFR - replace text with Flash
var GeometricBold = {  src: 'GeometricBold.swf' };
var GeometricLight = {  src: 'GeometricLight.swf' };
sIFR.activate(GeometricBold, GeometricLight);

// primary navigation menu (on every page)
sIFR.replace(GeometricBold, {
  selector: 'h3.sifrh3'
  ,wmode: 'transparent'
  ,css: [
      '.sIFR-root { color: #692820; font-size:15px; cursor:pointer; }'
      ,'a { text-decoration: none; color: #692820;}'
      ,'a:link { color: #692820; }'
      ,'a:hover { color: #f5f0c7; }'
    ],
    filters: {
      DropShadow: {
        knockout: false
        ,distance: 2
        ,color: '#7b321f'
        ,strength: 1
      }
    }
});// end primary navigation menu

// View All Products in products.htm (on every page)
sIFR.replace(GeometricBold, {
  selector: '.view-all-products'
  ,wmode: 'transparent'
  ,css: [
      '.sIFR-root {text-align:center;font-weight: bold; color: #DC6E1F; font-size:18px; cursor:pointer; }'
      ,'a { text-decoration: none; }'
      ,'a:link { color: #EDA945; }'
      ,'a:hover { color: #f5f0c7; }'
     ],
    filters: {
      DropShadow: {
        knockout: false
        ,distance: 2
        ,color: '#692820'
        ,strength: 1
      }
    }
  }); // end View All Products in products.htm
  

jQuery(document).ready(function(){
	$('.lightbox-facility_tour a').lightBox({fixedNavigation:true});	
	$('.lightbox-innovation_tour a').lightBox({fixedNavigation:true});	
});

