
// SWFOBJECT

document.observe('dom:loaded', function(){

  if ($('homepage-flash-replace')) {
    swfobject.embedSWF("flash/homepage.swf", "homepage-flash-replace", "750", "407", "9.0.0", false, {}, {}, { 'id' : 'flash-feature'});
  }

  if ($('about-flash-replace')) {
  	swfobject.embedSWF("flash/demo3.swf", "about-flash-replace", "300", "290", "9.0.0", false, {}, {}, { 'id' : 'flash-feature'});
  }

  if ($('demo-flash-replace')) {
    swfobject.embedSWF("flash/focus7.swf", "demo-flash-replace", "750", "450", "9.0.0", false, {}, {}, { 'id' : 'flash-feature'});
  }

  if ($('tv-flash-replace')) { 
    swfobject.embedSWF("flash/tvspot.swf", "tv-flash-replace", "750", "407", "9.0.0", false, {}, {}, { 'id' : 'flash-feature'});
  }

  if ($('tv-martha-replace')) { 
    swfobject.embedSWF("flash/martha_vid.swf", "tv-martha-replace", "750", "407", "9.0.0", false, {}, {}, { 'id' : 'flash-feature'});
  }

});

//// NAVIGATION ROLLOVERS
//
//var NavRollover = Class.create({
//	initialize : function(list_item){
//	  this.node = list_item;
//	  // don't rollover for active items or homepage
//	  if (!list_item || list_item.id == 'nav_home') { return; }
//	  // if it's active, give it frame 5 and stop animation
//	  if (list_item.hasClassName('Active')) {
//	    list_item.addClassName('Frame5');
//	    return;
//	  }
//	  this.current_frame = 0;
//	  this.currently_hovering = false;
//	  this.node.observe('mouseover', this.mouseOverHandler.bindAsEventListener(this));
//	  this.node.observe('mouseout', this.mouseOutHandler.bindAsEventListener(this));
//	},
//	mouseOverHandler : function(){
//	  this.currently_hovering = true;
//	  this.setAnimationTimeout(30);
//	},
//	mouseOutHandler : function(){
//	  this.currently_hovering = false;
//	  this.setAnimationTimeout(30);
//	},
//	setAnimationTimeout : function(timeout){
//	  setTimeout(this.animationHandler.bind(this), timeout);
//	},
//	animationHandler : function(){
//	  if (this.currently_hovering) {
//	    if (this.current_frame != 1) {
//	      this.current_frame += 1;
//	      this.drawAnimationFrame();
//	      this.setAnimationTimeout(30);
//	    }
//	  } else {
//	    if (this.current_frame != 0) {
//	      this.current_frame -= 1;
//	      this.drawAnimationFrame();
//        this.setAnimationTimeout(50);
//	    }
//	  }
//	},
//	drawAnimationFrame : function(){
//	  this.node.className = 'Frame'+this.current_frame;
//	}
//});
//document.observe('dom:loaded', function(){
//	$$('#MainNav LI').each(function(li){ new NavRollover(li); });
//});

// DROP DOWN MENU FOR IE

	window.onload = function()
	{
		var lis = document.getElementsByTagName('li');
		for(i = 0; i < lis.length; i++)
		{
			var li = lis[i];
			if (li.className == 'nav_prizes')
			{
				li.onmouseover = function() { this.getElementsByTagName('ul').item(0).style.display = 'block'; }
				li.onmouseout = function() { this.getElementsByTagName('ul').item(0).style.display = 'none'; }
			}
		}
	}
	
// POPUP

function HideContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "block";
}
function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }
else { document.getElementById(d).style.display = "none"; }
}


// PRINT CERTIFICATE
document.observe('dom:loaded', function(){
	if ($('certificate-wrap')) {
		var newButton = new Element('img', {'src' : 'images/button.print-certificate.gif', 'alt' : 'Print Certificate', 'class' : 'button'});
		newButton.observe("click", function() {
        pageTracker._trackEvent('Coupons', 'Print');		
		window.print() });		
		$('certificate-wrap').insert({'top' : newButton});
	}

});
