// Initialize sIFR
if (typeof sIFR == "function"){
  sIFR.replaceElement("#how_to_contact_page #content .contact_list_right h2", named({sFlashSrc: "/images/fonts/heaveneticacond5.swf", sColor: "#666666", sWmode: "transparent"}))
	sIFR.replaceElement(".home #content h2", named({sFlashSrc: "/images/fonts/heaveneticacond4.swf", sColor: "#A90800", sWmode: "transparent"}))
  sIFR.replaceElement("#content h2.sifr", named({sFlashSrc: "/images/fonts/heaveneticacond5.swf", sColor: "#A90800", sWmode: "transparent"}))
  sIFR.replaceElement("#content h3.sifr", named({sFlashSrc: "/images/fonts/heaveneticacond5.swf", sColor: "#454545", sWmode: "transparent"}))
  sIFR.replaceElement("#intro h1.sifr", named({sFlashSrc: "/images/fonts/heaveneticacond5.swf", sColor: "#ffffff", sWmode: "transparent"}))
  sIFR.replaceElement("#intro p.sifr", named({sFlashSrc: "/images/fonts/heaveneticacond5.swf", sColor: "#E8A49C", sWmode: "transparent"}))
  sIFR.replaceElement("#sidebar h2", named({sFlashSrc: "/images/fonts/heaveneticacond5.swf", sColor: "#666666", sWmode: "transparent"}))
  sIFR.replaceElement("h2.grey", named({sFlashSrc: "/images/fonts/heaveneticacond5.swf", sColor: "#666666", sWmode: "transparent"}))
}

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);

// Cross-browser event handling for IE5+, NS6 and Mozilla 
// By John Resig 
function addEvent( obj, type, fn ) 
{
	if (obj.addEventListener) {
		obj.addEventListener( type, fn, false );
 }	else if (obj.attachEvent)	{
		obj["e"+type+fn] = fn;
		obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
		obj.attachEvent( "on"+type, obj[type+fn] );
	}
}

function removeEvent( obj, type, fn ) 
{
 if (obj.removeEventListener) {
  obj.removeEventListener( type, fn, false );
 } else if (obj.detachEvent) {
  obj.detachEvent( "on"+type, obj[type+fn] );
  obj[type+fn] = null;
  obj["e"+type+fn] = null;
 }
}

// Applying classes via Javascript
// http://www.onlinetools.org/articles/unobtrusivejavascript/cssjsseparation.html
function cssjs(a,o,c1,c2) 
{
  switch (a) {
    case 'swap':
      o.className=!cssjs('check',o,c1)?o.className.replace(c2,c1):o.className.replace(c1,c2);
    break;
    case 'add':
      if(!cssjs('check',o,c1)){o.className+=o.className?' '+c1:c1;}
    break;
    case 'remove':
      var rep=o.className.match(' '+c1)?' '+c1:c1;
      o.className=o.className.replace(rep,'');
    break;
    case 'check':
      return new RegExp('\\b'+c1+'\\b').test(o.className)
    break;
  }
}

/* Tracing function for jsTrace() - http://www.easy-designs.net/code/jsTrace/ */
function trace( msg )
{
  if( typeof( jsTrace ) != 'undefined' ){
    jsTrace.send( msg );
  }
}


function initExploreProductRange() {
	if(!document.getElementById || !document.getElementById('explore-product-range') || !document.getElementById('product-range-dropdown')) {
       return;
    }
	
	var button = document.getElementById('explore-product-range');
	var dropdown = document.getElementById('product-range-dropdown');
	
	button.onmouseover = function() {
		if (cssjs('check', dropdown, 'hide')) {
            cssjs('remove', dropdown, 'hide')
        } else {
			cssjs('add', dropdown, 'hide')
		}
	}
	
	button.onmouseout = function() {
		if (cssjs('check', dropdown, 'hide')) {
            cssjs('remove', dropdown, 'hide')
        } else {
			cssjs('add', dropdown, 'hide')
		}
	}
	
	dropdown.onmouseover = function() {
		 cssjs('remove', this, 'hide')
	}
	
	dropdown.onmouseout = function() {
		 cssjs('add', this, 'hide')
	}
}

// ADD EVENT HANDLERS
addEvent(window, 'load', initExploreProductRange); 



