/* IBO Javascript API
   (c) IBO GmbH, 2003 */

// zoooooom :)
var flexoZoomObj = null;
var flexoZoomImage = null;
var flexoLoadingImage = "http://shopping.lycos.de/lx/i/loading_lu001.gif";


// zoooooom :)

function FlexoShowZoom(objname,oUrl){
  if (flexoZoomObj == null) {
    flexoZoomObj = document.getElementById('ZoLayer');
  }
  if (flexoZoomObj != null) {
    flexoZoomImage = document.getElementById('zoomed');
    var el = document.getElementById(objname);
    for (var lx=0,ly=0;el!=null; lx+=el.offsetLeft,ly+=el.offsetTop,el=el.offsetParent);
    flexoZoomImage.src = flexoLoadingImage;
    flexoZoomImage.onload = flexoZoomImage.src = oUrl;
    FlexoShiftTo(flexoZoomObj, lx,ly-225);
    flexoZoomObj.style.visibility = "visible";
  }
}

// Set the visibility the zoomed Layer back to hidden and replace prodimage with loading img (de)
function FlexoHideZoom() {
  if (flexoZoomObj != null) {
    flexoZoomObj.style.visibility = "hidden";
    flexoZoomImage.src = flexoLoadingImage;
    flexoZoomImage.onload = flexoZoomImage.src = flexoLoadingImage;
  }
}

// Convert object name string or object reference
// into a valid element object reference
function FlexoGetRawObject(obj) {
  var theObj;
  if (typeof obj == "string") {
    theObj = document.getElementById(obj);
  } else {
    // pass through object reference
    theObj = obj;
  }
  return theObj;
}

// Convert object name string or object reference
// into a valid style (or NN4 layer) reference
function FlexoGetObject(obj) {
  var theObj = FlexoGetRawObject(obj);
    if (theObj) {
      theObj = theObj.style;
    }
    return theObj;
}

// Position an object at a specific pixel coordinate
function FlexoShiftTo(obj, x, y) {
  var theObj = FlexoGetObject(obj);
  if (theObj) {
    // equalize incorrect numeric value type
    var units = (typeof theObj.left == "string") ? "px" : 0 ;
    theObj.left = x + units;
    theObj.top = y + units;
  }
}

// Move an object by x and/or y pixels
function FlexoShiftBy(obj, deltaX, deltaY) {
  var theObj = FlexoGetObject(obj);
  if (theObj) {
    // equalize incorrect numeric value type
    var units = (typeof theObj.left == "string") ? "px" : 0;
    theObj.left = FlexoGetObjectLeft(obj) + deltaX + units;
    theObj.top = FlexoGetObjectTop(obj) + deltaY + units;
  }
}

// Retrieve the x coordinate of a positionable object
function FlexoGetObjectLeft(obj)  {
  var elem = FlexoGetRawObject(obj);
  var result = 0;
  if (document.defaultView) {
    var style = document.defaultView;
    var cssDecl = style.getComputedStyle(elem, "");
    result = cssDecl.getPropertyValue("left");
  } else if (elem.currentStyle) {
    result = elem.currentStyle.left;
  } else if (elem.style) {
    result = elem.style.left;
  }
  return parseInt(result);
}

// Retrieve the y coordinate of a positionable object
function FlexoGetObjectTop(obj)  {
  var elem = FlexoGetRawObject(obj);
  var result = 0;
  if (document.defaultView) {
    var style = document.defaultView;
    var cssDecl = style.getComputedStyle(elem, "");
    result = cssDecl.getPropertyValue("top");
  } else if (elem.currentStyle) {
    result = elem.currentStyle.top;
  } else if (elem.style) {
    result = elem.style.top;
  }
  return parseInt(result);
}

// Retrieve the rendered width of an element
function FlexoGetObjectWidth(obj)  {
  var elem = FlexoGetRawObject(obj);
  var result = 0;
  if (elem.offsetWidth) {
    result = elem.offsetWidth;
  } else if (elem.clip && elem.clip.width) {
    result = elem.clip.width;
  } else if (elem.style && elem.style.pixelWidth) {
    result = elem.style.pixelWidth;
  }
  return parseInt(result);
}

// Retrieve the rendered height of an element
function FlexoGetObjectHeight(obj)  {
  var elem = FlexoetRawObject(obj);
  var result = 0;
  if (elem.offsetHeight) {
    result = elem.offsetHeight;
  } else if (elem.clip && elem.clip.height) {
    result = elem.clip.height;
  } else if (elem.style && elem.style.pixelHeight) {
    result = elem.style.pixelHeight;
  }
  return parseInt(result);
}

// Return the available content width space in browser window
function FlexoGetInsideWindowWidth() {
  if (window.innerWidth) {
    return window.innerWidth;
  } else if (document.body && document.body.clientWidth) {
    return document.body.clientWidth;
  }
  return 0;
}

// Return the available content height space in browser window
function FlexoGetInsideWindowHeight() {
  if (window.innerHeight) {
    return window.innerHeight;
  } else if (document.body && document.body.clientHeight) {
    return document.body.clientHeight;
  }
  return 0;
}



function equal_columns(){
  var o="offsetHeight";
  var colLeft = document.getElementById("giftHer");
  var colCenter = document.getElementById("giftHim");
  var colRight = document.getElementById("giftKids");

  if(colLeft && colCenter && colRight){
    var m = Math.max( colLeft[o], colCenter[o], colRight[o] );
    document.getElementById("hercolumn").style.height = m+"px";
    document.getElementById("himcolumn").style.height = m+"px";
    document.getElementById("kidscolumn").style.height = m+"px";
 
    equalize_done = 1;
  }
}

function giftfinder_hookevents(){
  if(!window.equalize_done) equalize_done = 0;
  if(!equalize_done){
    equal_columns();
  }
  // repeat if not done properly
  if(!equalize_done)setTimeout("giftfinder_hookevents()",100);
}
giftfinder_hookevents();

function globaltabs_toggle(e){
	if(!this.id||!this.id.indexOf("globaltab")==0)return;
	var ev = e || event; if(!ev) return;
	var cs = ev.type=="mouseover" ? "tabhover" : "";
	this.className = cs;
}

function ToggleNext(el){
	if(!el)return false;
	var orgEl = el;
	while(el && (el=el.nextSibling) ) if( el.nodeType==1 ) break;
	if(!el||!el.style)return false;
	var bActive = el.style.display!="block";
	el.style.display = bActive ? "block" : "none";
	orgEl.className = bActive ? "active" : "";
	return false
}

function gccc_extend(){
	return true; // this function does not work

	var d=document,g="getElementById",o="offsetHeight",r="onresize";
	var glbcntl = d[g]("globalcontentleft");
	var glbcntc = d[g]("globalcontentcentercontent");
	var glbcnth = d[g]("sectionhead");
	var glbcntf = d[g]("globalcontentcenterfooter");
	var glbcntr = d[g]("globalcontentright");
	if(glbcntl&&glbcntc&&glbcnth&&glbcntf&&glbcntr){
		var realH = parseInt(glbcntc[o] + glbcnth[o] + glbcntf[o]);
		var m = Math.max( glbcntl[o], realH, glbcntr[o] );
		var diff = (m - realH), newHeight = (glbcntc[o] + diff);
		if(newHeight) glbcntc.style.height = newHeight;
		glbcntl[r] = glbcntc[r] = glbcntr[r] = gccc_extend;
		l_done.gc = 1;
	}
}

function Lycos_hookevents(){
	if(!window.l_done) l_done = {gt:0,gc:0}
	if(!l_done.gt){
		var gt = document.getElementById("globaltabs"), els;
		if(gt && (els=gt.childNodes)){
			for(var i=0, il=els.length; i<il; i++){
				if(!els[i]) break;
				els[i].onmouseover = els[i].onmouseout = globaltabs_toggle;
			}
			if(i==il) l_done.gt = 1;
		}
	}
	if(!l_done.gc){
		gccc_extend();
	}

	if(!l_done.gt||!l_done.gc)setTimeout("Lycos_hookevents()",10);
}
if(document.getElementById) Lycos_hookevents();

