// JavaScript Document
//sIFR Text Placement

function do_sIFR(){
  // replacement statements go here so I can turn this shit back on once i shut it down from lightbox
 
		if(typeof sIFR == "function"){
		sIFR.replaceElement(named({sSelector:"body h2", sFlashSrc:"../js/frutiger.swf", sColor:"#000000", sLinkColor:"#000000", sBgColor:"#FFFFFF", sHoverColor:"#CCCCCC", nPaddingTop:22, nPaddingLeft:0, nPaddingBottom:14, sFlashVars:"textalign=left&offsetTop=4"}));
		};

};
do_sIFR(); // launch it immediatly so the headlines will get replaced



//Image Preload
var myimages = new Array();
function preloading(){
	for (x=0; x<preloading.arguments.length; x++){
	myimages[x] = new Image();
	myimages[x].src = preloading.arguments[x];
	}
}

preloading('../images/b-viewdescription2.jpg','../images/b-watchvideo2.jpg','../images/loading.gif');

 
//Drag List Variables
var myStartEffect = function(element) {
     element._opacity = Element.getOpacity(element);
     new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7});
     new Effect.Highlight(element, {});
   }


/*

oldOnLoad = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = function() {
      preloading('images/b-viewdescription2.jpg','images/b-watchvideo2.jpg');
    };
  } else {

window.onload = function() {
      oldOnLoad();
      preloading('images/b-viewdescription2.jpg','images/b-watchvideo2.jpg'); 
	  
	  };
	  
  }
  
*/

// Used to toggle the alt tag for the pre-workout tips - so the tool tip will switch behind CLICK TO SHOW and CLICK TO HIDE
function toggleDisplay() { 
if( document.getElementById("showme").style.display == "none" ) {
    document.getElementById("showme").style.display = "block";
	document.getElementById("hideme").style.display = "none";
  } else { 
    document.getElementById("showme").style.display = "none";
	document.getElementById("hideme").style.display = "block";  }
}

function toggleDisplayPost() { 
if( document.getElementById("showmepost").style.display == "none" ) {
    document.getElementById("showmepost").style.display = "block";
	document.getElementById("hidemepost").style.display = "none";
  } else { 
    document.getElementById("showmepost").style.display = "none";
	document.getElementById("hidemepost").style.display = "block";  }
}

/* -------------------------------------------------------------- */
/*  ------------------------- TOOL TIPS ------------------------- */
/* -------------------------------------------------------------- */

// Origanal code from Squidfingers 
// Modified by Artcrime (Jeremy Galanes)
tooltip = {
	name : "tooltipDiv",
	offsetX : 12,
	offsetY : -22,
	tip : null
};
tooltip.init = function () {
	if (!document.getElementById) return;
	
	// It would be nice to be able to generate the tooltip div, 
	// but when using document.createElement Explorer5/MacOS9, 
	// the tooltip div becomes 100% of the window height.
	// Therefore, we have to use document.getElementById to access
	// a div that is already in the body.
	
	// this.tip = document.createElement ("div");
	// this.tip.setAttribute ("id", this.name);
	// document.body.appendChild (this.tip);
	
	this.tip = document.getElementById (this.name);
	if (this.tip) document.onmousemove = function (evt) {tooltip.move (evt)};
	
	var a;
	var anchors = document.getElementsByTagName ("a");
	for (var i = 0; i < anchors.length; i ++) {
		a = anchors[i];
		// if (a.className == "tooltip") {   // displays only anchors with the class tooltip
			
			
			
			// Made it so it only displays anchors with an alt tag that has shit in it
			if (a.rel == "" || a.rel == void 0 || a.rel == "undefined" || a.rel == undefined || a.rel == null) {
			
			}
			else {
			
			// Display tool tip functions
			a.onmouseover = function () {tooltip.show (this.rel)};
			a.onmouseout = function () {tooltip.hide ()};
			
			}
			
			
			
		// }
	}
	
	var a2;
	var area = document.getElementsByTagName ("area");
	for (var jarea = 0; jarea < area.length; jarea ++) {
		a2 = area[jarea];
		// if (a.className == "tooltip") {   // displays only anchors with the class tooltip
			
					
			// Made it so it only displays anchors with an alt tag that has shit in it
			if (a2.alt == "" || a2.alt == void 0 || a2.alt == "undefined" || a2.alt == undefined || a2.alt == null) {
			
			}
			else {
			
			// Display tool tip functions
			a2.onmouseover = function () {tooltip.show (this.alt)};
			a2.onmouseout = function () {tooltip.hide ()};
			
			}
			
			
		// }
	}
	
	
	
};
tooltip.move = function (evt) {
	var x=0, y=0;
	if (document.all) {// Explorer
	
		// Explorer5 contains the documentElement object but it's empty, 
		// so we must check if the scrollLeft property is available.
		
		// If Explorer6 is in Quirks mode, the documentElement properties 
		// will still be defined, but they will contain the number 0.
		
		// If Explorer6 is in Standards compliant mode, the document.body 
		// properties will still be defined, but they will contain the number 0.
		
		x = (document.documentElement && document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : document.body.scrollLeft;
		y = (document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop;
		x += window.event.clientX;
		y += window.event.clientY;
		
	} else {// Mozilla
		x = evt.pageX;
		y = evt.pageY;
	}
	// If the style property value is not a string containing the unit measurement,
	// browsers in standard compliant mode will not set the property.
	this.tip.style.left = (x + this.offsetX) + "px";
	this.tip.style.top = (y + this.offsetY) + "px";
};
tooltip.show = function (text) {
	if (!this.tip) return;
	this.tip.innerHTML = text;

		// Without the next line, Explorer5/Mac has a redraw problem.
		this.tip.style.visibility = "visible";
		this.tip.style.display = "block";
		
		// cant get this to work!   new Effect.Appear('tooltipDiv', {duration:.5, queue: 'end', fps: 40, afterFinish: function(){           }});
		
};
tooltip.hide = function () {
	if (!this.tip) return;
	// Without the next line, Explorer5/Mac has a redraw problem.
	this.tip.style.visibility = "hidden";
	this.tip.style.display = "none";
	this.tip.innerHTML = "";
};


// ||||||||||||||||||||||||||||||||||||||||||||||||||

window.onload = function(){
	tooltip.init ();
};

