// Simple follow the mouse script

var divName = 'mousePopup'; // div that is to follow the mouse
                       // (must be position:absolute)
var offX = 15;          // X offset from mouse position
var offY = 15;          // Y offset from mouse position

function mouseX(evt)
{
	if (!evt) evt = window.event;
	if (evt.pageX)
	{
		return evt.pageX - getAbsoluteLeft('main');
	}
	else if (evt.clientX)
	{
		return evt.clientX + (document.documentElement.scrollLeft ?  document.documentElement.scrollLeft : document.body.scrollLeft) - getAbsoluteLeft('main');
	}
	else return 0;
}

function mouseY(evt)
{
	if (!evt) evt = window.event;
	if (evt.pageY)
	{
		return evt.pageY;
	}
	else if (evt.clientY)
	{
		return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
	}
	else return 0;
}

function follow(evt)
{
	if (document.getElementById)
	{
		var obj = document.getElementById(divName).style;
		obj.visibility = 'visible';
		obj.left = (parseInt(mouseX(evt))+offX) + 'px';
		obj.top = (parseInt(mouseY(evt))+offY) + 'px';
	}
}

function stopfollow()
{
	document.getElementById(divName).style.visibility = 'hidden';
}

var minX=0;
var maxX=0;
var minY=0;
var maxY=0;

function drag_init()
{
var draggers=document.getElementsByTagName('div');
for (var i = 0; i < draggers.length; i++)
{
  if (draggers[i].className.indexOf('drsMoveHandle') > - 1)
  {
    elem=draggers[i].parentNode;
    while(elem)
    {
      if (elem.className.indexOf('drsElement') > - 1)
      {
        Drag.init(draggers[i], elem);
        break;
      }
      elem=elem.parentNode;
    }
  }
}
}

window.onresize=adjustHeight;

var theme_path;

//Returns an element's absolute left position, wherever it is in document hierarchy
function getAbsoluteLeft(elemid)
{
	element = document.getElementById(elemid);
	elementLeft = element.offsetLeft;
	while(element.offsetParent!=null)
  {
		elementParent = element.offsetParent;
		elementLeft += elementParent.offsetLeft;
		element = elementParent;
	}
	return elementLeft;
}
//Returns an element's absolute top position, wherever it is in document hierarchy
function getAbsoluteTop(elemid)
{
	element = document.getElementById(elemid);
	elementTop = element.offsetTop;
	while(element.offsetParent!=null)
  {
		elementParent = element.offsetParent;
		elementTop += elementParent.offsetTop;
		element = elementParent;
	}
	return elementTop;
}

//function to show/hide a popup div.
//first parameter is the id of the div you want to show/hide
//second is the target's id: the nearest element you want your div to show up
//third is the vertical position, relative to this target element:
//string "top" will make the popup show above the target,
//while "bottom" will make it show bellow.
//Fourth parameter is the horizontal position:
//string "left" will make the div appear on the left side of the target element,
//"right", on the right side.
//Parameters 2, 3 and 4 are optional to hide the popup (like for a closing button, or as a result of a function)
function show_hide_div(elemid, targetid, vertical, horizontal)
{
  elem = document.getElementById(elemid);
  if (elem.style.display!='block')
  {
    // Show existing box
		elem.style.visibility='hidden';
    elem.style.display='block';
    if (elem.className && elem.className.indexOf('drsElement') > -1)
    {
      elem.style.width="auto";
      if(BrowserDetect.browser == "Explorer")
      {
        elem.style.width=elem.offsetWidth;
      }
      else
      {
        elem.style.width=elem.offsetWidth-8;
      }
    }
    background=document.getElementById("darkBackgroundLayer");
    background.style.height=document.getElementById("foot").offsetHeight+document.getElementById("foot").offsetTop;
    background.style.width=document.documentElement.offsetWidth;
    if(BrowserDetect.browser == "Explorer")
    {
      background.style.left=-document.getElementById("main").offsetLeft-21;
    }
    else
    {
      background.style.left=-document.getElementById("main").offsetLeft-1;
    }
    if(background.counter)
    {
      background.counter++;
    }
    else
    {
      background.counter=1;
    }
    background.style.display="block";
    fadeBackground(background);
  }
  else
	{
    elem.style.display='none';
    elem.style.visibility='visible';
    if(BrowserDetect.browser == "Explorer")
    {
      document.getElementById("backframe").style.width = "0px";
      document.getElementById("backframe").style.height = "0px";
      document.getElementById("backframe").style.top = "0px";
      document.getElementById("backframe").style.left = "0px";
    }
    background.counter--;
    if(background.counter < 1)
    {
      unfadeBackground(background);
      background.counter=0;
    }
    return false;
	}
	if (targetid != null)
	{
		target = document.getElementById(targetid);
		if (vertical != null)
		{
			switch(vertical)
			{
				case 'top':
					var top=getAbsoluteTop(targetid) - elem.offsetHeight ;
					if (top < 0)
			    {
            top=0;
          }
					elem.style.top = top + "px";
				break;
				case 'bottom':
					var top=getAbsoluteTop(targetid) + target.offsetHeight + 5;
					if (top < 0)
			    {
            top=0;
          }
					elem.style.top = top + "px";
				break;
			}
		}
		if (horizontal != null)
		{
			switch(horizontal)
			{
				case 'left':
				// Use the "main" element position for calculation. If "main" is renamed, it has to be renamed here too.
					var left=getAbsoluteLeft(targetid) - getAbsoluteLeft('main') - elem.offsetWidth + target.offsetWidth + 10;
					elem.style.left = left+ "px";
				break;
				case 'right':
				// Use the "main" element position for calculation. If "main" is renamed, it has to be renamed here too.
					var left=getAbsoluteLeft(targetid) - getAbsoluteLeft('main');
					elem.style.left = left+ "px";
				break;
			}
		}
		if(elem.style.display == "block")
		{
		  growEffect(elem,vertical,horizontal);
		}
	}
	else
	{
	  if(elem.style.display == "block")
		{
      elem.style.visibility='visible';
    }
  }
}

function resizeIFrame(elem)
{
  if(BrowserDetect.browser == "Explorer")
  {
    with(document.getElementById("backframe").style)
    {
      width = (elem.offsetWidth-20)+"px";
      height = (elem.offsetHeight-20)+"px";
      top = (elem.offsetTop+4)+"px";
      left = (elem.offsetLeft+4)+"px";
      visibility = "visible";
    }
  }
}

function hideIFrame()
{
  if(BrowserDetect.browser == "Explorer")
  {
    with(document.getElementById("backframe").style)
    {
      width = "0px";
      height = "0px";
      top = "0px";
      left = "0px";
      visibility = "hidden";
    }
  }
}

function adjustHeight()
{
  if (document.getElementById)
  {
      var targetElement=document.getElementById("main");
      var footerElement=document.getElementById("foot");
      if(!footerElement)
      {
        setTimeout("adjustHeight();",1000);
      }
      else
      {
      if (targetElement && document.documentElement.offsetHeight && targetElement.offsetHeight)
      {
          var documentHeight=document.documentElement.offsetHeight;
          if (targetElement.offsetHeight+footerElement.offsetHeight<documentHeight)
          {
              if(BrowserDetect.browser == "Explorer")
              {
                targetElement.style.height=String(documentHeight-footerElement.offsetHeight-4)+'px';
              }
              else
              {
                targetElement.style.height=String(documentHeight-footerElement.offsetHeight-8)+'px';
              }
          }
          else
          {
            targetElement.style.height='auto';
            if (targetElement.offsetHeight+footerElement.offsetHeight<documentHeight)
            {
              footerElement.style.visibility="hidden";
              if(BrowserDetect.browser == "Explorer")
              {
                targetElement.style.height=String(documentHeight-footerElement.offsetHeight-4)+'px';
              }
              else
              {
                targetElement.style.height=String(documentHeight-footerElement.offsetHeight-8)+'px';
              }
              footerElement.style.visibility="visible";
            }
          }
      }
      minX= document.body.offsetLeft-document.getElementById("main").offsetLeft;
      maxX= document.body.offsetWidth-document.getElementById("main").offsetLeft-22;
      maxY= footerElement.offsetTop+footerElement.offsetHeight;
      }
  }
}

//--------------------------------------------------------------------------

//Animation function by Hesido.com;
function easeInOut(minValue,maxValue,totalSteps,actualStep,powr) {
	var delta = maxValue - minValue;
	var stepp = minValue+(1 / totalSteps)*actualStep*delta;
	return Math.ceil(stepp);
}

function easeInOut2(minValue,maxValue,totalSteps,actualStep,powr) {
	var delta = maxValue - minValue;
	var stepp = minValue+(Math.pow(((1 / totalSteps)*actualStep),0.4)*delta);
	return stepp;
}

// Init MouseOn Color Fading. Color values are hard coded so far, but will be update for custom colors
function fadeBGColMem(elemid,backStartRGB,backEndRGB,fontStartRGB,fontEndRGB)
{
	elem=document.getElementById(elemid);
	if (!elem.currentbgRGB)
	{
	  elem.currentbgRGB = backStartRGB.split(',');
		elem.currentftRGB = fontStartRGB.split(',');
	}
	doBGFadeMem(elem,elem.currentbgRGB,backEndRGB.split(','),12,20,1);
	doFTFadeMem(elem,elem.currentftRGB,fontEndRGB.split(','),12,20,1);
}

//Init MouseOut color fading. Color values are hard coded so far, but will be update for custom colors
function fadeBGColRestore(elemid,backRestoreRGB,fontRestoreRGB)
{
	elem=document.getElementById(elemid);
	if (!elem.currentbgRGB) return;
	if (!elem.currentftRGB) return;
	doBGFadeMem(elem,elem.currentbgRGB,backRestoreRGB.split(","),20,20,1);
	doFTFadeMem(elem,elem.currentftRGB,fontRestoreRGB.split(","),20,20,1);
}

//BG Color Fading function. Color values are hard coded so far, but will be update for custom colors
function doBGFadeMem(elem,startRGB,endRGB,steps,intervals,powr)
{
	if (elem.bgFadeMemInt) window.clearInterval(elem.bgFadeMemInt);
	var actStep = 0;
	for(var i=0; i < startRGB.length;i++)
	{
    startRGB[i]=parseFloat(startRGB[i]);
    endRGB[i]=parseFloat(endRGB[i]);
  }
	elem.bgFadeMemInt = window.setInterval(
		function() {
			elem.currentbgRGB = [
				easeInOut(startRGB[0],endRGB[0],steps,actStep,powr),
				easeInOut(startRGB[1],endRGB[1],steps,actStep,powr),
				easeInOut(startRGB[2],endRGB[2],steps,actStep,powr)
				];
			elem.style.backgroundColor = "rgb("+
				elem.currentbgRGB[0]+","+
				elem.currentbgRGB[1]+","+
				elem.currentbgRGB[2]+")";
			actStep++;
			if (actStep > steps) window.clearInterval(elem.bgFadeMemInt);
		}
		,intervals);
}

//Font Color Fading function. Color values are hard coded so far, but will be update for custom colors
function doFTFadeMem(elem,startRGB,endRGB,steps,intervals,powr)
{
	if (elem.ftFadeMemInt) window.clearInterval(elem.ftFadeMemInt);
	var actStep = 0;
	for(var i=0; i < startRGB.length;i++)
	{
    startRGB[i]=parseFloat(startRGB[i]);
    endRGB[i]=parseFloat(endRGB[i]);
  }
	elem.ftFadeMemInt = window.setInterval(
		function() {
			elem.currentftRGB = [
				easeInOut(startRGB[0],endRGB[0],steps,actStep,powr),
				easeInOut(startRGB[1],endRGB[1],steps,actStep,powr),
				easeInOut(startRGB[2],endRGB[2],steps,actStep,powr)
				];
			var urls = elem.getElementsByTagName("a");
			for(var i=0; i<urls.length; i++)
			{
				urls[i].style.color = "rgb("+
				elem.currentftRGB[0]+","+
				elem.currentftRGB[1]+","+
				elem.currentftRGB[2]+")";
			}
			actStep++;
			if (actStep > steps) window.clearInterval(elem.ftFadeMemInt);
		}
		,intervals);
}

// End of Fade functions


//Pan Functions

function fold_unfold(elemid, X1, Y1, X2, Y2)
{
	if(document.getElementById(elemid).title == "closed")
	{
		PanElement(elemid, X1, Y1);
	}
	else
	{		
		PanRestore(elemid, X2, Y2);
	}
}

function PanElement(elemid, X, Y)
{
	elem=document.getElementById(elemid);
	elem.title="";
  elem.style.visibility="visible";
	var top = parseFloat(elem.offsetTop);
	var left = parseFloat(elem.offsetLeft);
	if (!elem.currentPos) elem.currentPos = [left,top];
	doPosChangeMem(elem,elem.currentPos,[X,Y],20,20,0.5);
}

function PanRestore(elemid, X, Y)
{
	elem=document.getElementById(elemid);
	elem.title = "closed";
	if (!elem.currentPos) return;
	doPosChangeMem(elem,elem.currentPos,[X,Y],20,20,0.5);
}

function Jump(elemid, X1, Y1, X2, Y2)
{
	elem=document.getElementById(elemid);
	elem.title="";
	elem.style.visibility="visible";
	var top = parseFloat(elem.offsetTop);
	var left = parseFloat(elem.offsetLeft);
	if (!elem.currentPos) elem.currentPos = [left,top];
	doPosJump(elem,elem.currentPos,[X1,Y1],[X2,Y2],20,20,0.5);
}

function doPosChangeMem(elem,startPos,endPos,steps,intervals,powr)
	{
	if (elem.posChangeMemInt) window.clearInterval(elem.posChangeMemInt);
	var actStep = 0;
	elem.posChangeMemInt = window.setInterval(
		function() {
			elem.currentPos = [
				easeInOut(startPos[0],endPos[0],steps,actStep,powr),
				easeInOut(startPos[1],endPos[1],steps,actStep,powr)
				];
			elem.style.left = elem.currentPos[0]+"px";
			elem.style.top = elem.currentPos[1]+"px";
			actStep++;
			if (actStep > steps)
			{
				window.clearInterval(elem.posChangeMemInt);
				if(elem.title == "closed")
				{
          elem.style.visibility="hidden";
        }
			}
		}
		,intervals);
}

function doPosJump(elem,startPos,midPos,endPos,steps,intervals,powr)
{
	if (elem.posChangeMemInt) window.clearInterval(elem.posChangeMemInt);
	var actStep = 0;
	elem.posChangeMemInt = window.setInterval(
		function() {
			elem.currentPos = [
				easeInOut(startPos[0],midPos[0],steps,actStep,powr),
				easeInOut(startPos[1],midPos[1],steps,actStep,powr)
				];
			elem.style.left = elem.currentPos[0]+"px";
			elem.style.top = elem.currentPos[1]+"px";
			actStep++;
			if (actStep > steps)
			{
				window.clearInterval(elem.posChangeMemInt);
				if((elem.style.zIndex == "") || (elem.style.zIndex == "-1"))
				{
					elem.style.zIndex="15";
				}
				else
				{
					elem.style.zIndex="-1";
					elem.title = "closed";
				}
				doPosChangeMem(elem,midPos,endPos,20,20,0.5);
			}
		}
		,intervals);
}

//End Of Pan Functions

//Resize Functions

function widthChange(elemid,width,height)
{
	elem=document.getElementById(elemid);
	if (!elem.currentWidth)
  {
    elem.currentWidth = parseFloat(elem.offsetWidth);
    elem.restoreWidth = parseFloat(elem.offsetWidth-2);
  }
	if (!elem.currentHeight)
  {
    elem.currentHeight = parseFloat(elem.offsetHeight);
    elem.restoreHeight = parseFloat(elem.offsetHeight-2);
  }
  elem.style.zIndex='2';
	doWidthChangeMem(elem, elem.currentWidth, elem.currentHeight, width, height, 10,10,0.333);
}

function widthRestore(elemid)
{
  elem=document.getElementById(elemid);
	if (!elem.currentWidth) return;
	doWidthChangeMem(elem,elem.currentWidth, elem.currentHeight,elem.restoreWidth,elem.restoreHeight,10,10,0.5);
	elem.style.zIndex='1';
}

function doWidthChangeMem(elem, startWidth, startHeight, endWidth, endHeight, steps,intervals,powr)
{
	if (elem.widthChangeMemInt) window.clearInterval(elem.widthChangeMemInt);
	var actStep = 0;
	elem.widthChangeMemInt = window.setInterval(
		function()
		{
			elem.currentWidth = easeInOut(startWidth,endWidth,steps,actStep,powr);
			elem.currentHeight = easeInOut(startHeight,endHeight,steps,actStep,powr);
			elem.style.width = elem.currentWidth+"px";
			elem.style.height = elem.currentHeight+"px";
			actStep++;
			if (actStep > steps)
      {
        window.clearInterval(elem.widthChangeMemInt);
      }
		}
		,intervals);
}

//Classifieds Google maps growing functions
function growMap(point)
{
	elem1=document.getElementById("event_map");
	elem2=document.getElementById("map_box");
	if (!elem1.currentWidth) elem1.currentWidth = 200;
	if (!elem1.currentHeight) elem1.currentHeight = 120;
	if (!elem2.currentLeft) elem2.currentLeft = parseFloat(elem2.offsetLeft);
	if (!elem2.currentTop) elem2.currentTop = parseFloat(elem2.offsetTop);
	if (!elem2.previousLeft) elem2.previousLeft = elem2.currentLeft - 300;
	if (!elem2.previousTop) elem2.previousTop = elem2.currentTop;
	doGrowMapMem(elem1, elem2, elem1.currentWidth, elem1.currentHeight, elem2.currentLeft, elem2.currentTop, 500, 350, elem2.previousLeft, elem2.previousTop, 10,10,0.333,point);
}

function doGrowMapMem(elem1, elem2, startWidth, startHeight, startLeft, startTop, endWidth, endHeight, endLeft, endTop, steps,intervals,powr,point)
{
	if (elem1.widthChangeMemInt) window.clearInterval(elem1.widthChangeMemInt);
	var actStep = 0;
	elem1.widthChangeMemInt = window.setInterval(
		function()
		{
			elem1.currentWidth = easeInOut(startWidth,endWidth,steps,actStep,powr);
			elem1.currentHeight = easeInOut(startHeight,endHeight,steps,actStep,powr);
			elem2.currentLeft = easeInOut(startLeft,endLeft,steps,actStep,powr);
			elem2.currentTop = easeInOut(startTop,endTop,steps,actStep,powr);
			elem1.style.width = elem1.currentWidth+"px";
			elem1.style.height = elem1.currentHeight+"px";
			elem2.style.left = elem2.currentLeft+"px";
			elem2.style.top = elem2.currentTop+"px";
			actStep++;
			if (actStep > steps)
      {
        window.clearInterval(elem1.widthChangeMemInt);
        document.getElementById("map_drag").style.display="block";
        document.getElementById('event_map_title').innerHTML=title;
        map.checkResize();
        map.addControl(controls = new GSmallMapControl());
		    map.addControl(types = new GMapTypeControl());
        map.setCenter(point, 14);
      }
		}
		,intervals);
}

function shrinkMap()
{
  document.getElementById("map_drag").style.display="none";
  document.getElementById("map_box").title="";
  map.removeControl(controls);
	map.removeControl(types);
	elem1=document.getElementById("event_map");
	elem2=document.getElementById("map_box");
	if (!elem1.currentWidth) elem1.currentWidth = 500;
	if (!elem1.currentHeight) elem1.currentHeight = 350;
	elem2.currentLeft = parseFloat(elem2.offsetLeft);
	elem2.currentTop = parseFloat(elem2.offsetTop);
	elem2.previousLeft = elem2.currentLeft;
	elem2.previousTop = elem2.currentTop;
	if(BrowserDetect.browser == "Explorer")
  {
    var targetLeft=document.getElementById('listings').offsetWidth - 206;
  }
  else
  {
    var targetLeft=document.getElementById('listings').offsetWidth - 212;
  }
	var targetTop=getAbsoluteTop('listings');
	doShrinkMapMem(elem1, elem2, elem1.currentWidth, elem1.currentHeight, elem2.currentLeft, elem2.currentTop, 200, 120, targetLeft, targetTop, 10,10,0.333);
}

function doShrinkMapMem(elem1, elem2, startWidth,startHeight, startLeft, startTop, endWidth, endHeight, endLeft, endTop, steps,intervals,powr)
{
	if (elem1.widthChangeMemInt) window.clearInterval(elem1.widthChangeMemInt);
	var actStep = 0;
	elem1.widthChangeMemInt = window.setInterval(
		function()
		{
			elem1.currentWidth = easeInOut(startWidth,endWidth,steps,actStep,powr);
			elem1.currentHeight = easeInOut(startHeight,endHeight,steps,actStep,powr);
			elem2.currentLeft = easeInOut(startLeft,endLeft,steps,actStep,powr);
			elem2.currentTop = easeInOut(startTop,endTop,steps,actStep,powr);
			elem1.style.width = elem1.currentWidth+"px";
			elem1.style.height = elem1.currentHeight+"px";
			elem2.style.left = elem2.currentLeft+"px";
			elem2.style.top = elem2.currentTop+"px";
			elem2.style.width = "auto";
			elem2.style.height = "auto";
			actStep++;
			if (actStep > steps)
      {
        window.clearInterval(elem1.widthChangeMemInt);
        if (BrowserDetect.browser != "Explorer")
        {
          document.getElementById("map_outerpair1").style.background="transparent";
          document.getElementById("map_outerpair2").style.background="transparent";
          document.getElementById("map_shadowbox").style.background="transparent";
        }
        document.getElementById("map_innerbox_2pxborder").style.padding="0px";
        document.getElementById("map_innerbox_2pxborder").style.border="none";
        map.checkResize();
        point=marker.getPoint();
        map.setCenter(point, 13);
      }
		}
		,intervals);
}

function heightChange(elemid,height)
{
	elem=document.getElementById(elemid);
	if (!elem.currentHeight) elem.currentHeight = parseFloat(elem.offsetHeight);
	doHeightChangeMem(elem, elem.currentHeight, height, 20,20,0.5);
}

function doHeightChangeMem(elem,startHeight,endHeight,steps,intervals,powr)
{
	if (elem.heightChangeMemInt) window.clearInterval(elem.heightChangeMemInt);
	var actStep = 0;
	elem.heightChangeMemInt = window.setInterval(
		function()
		{
			elem.currentHeight = easeInOut(startHeight,endHeight,steps,actStep,powr);
			elem.style.height = elem.currentHeight;
			actStep++;
			if (actStep > steps)
      {
        window.clearInterval(elem.heightChangeMemInt);
        adjustHeight();
      }
		}
		,intervals);
}

function fadeBackground(elem)
{
  if (!elem.currentOp)
  {
      elem.currentOp = 0;
  }
  if (BrowserDetect.browser != "Explorer")
  {
    doFadeBack(elem, elem.currentOp, 0.25, 10,5,0.5);
  }
}

function unfadeBackground(elem)
{
  if (!elem.currentOp)
  {
      elem.currentOp = 0;
  }
  if (BrowserDetect.browser == "Explorer")
  {
    elem.style.display="none";
  }
  else
  {
    undoFadeBack(elem, elem.currentOp, 0.0, 10,5,0.5);
  }
}

function doFadeBack(elem,startOp,endOp,steps,intervals,powr)
{
	if (elem.OpChangeMemInt) window.clearInterval(elem.OpChangeMemInt);
	var actStep = 0;
	elem.OpChangeMemInt = window.setInterval(
		function()
		{
			elem.currentOp = easeInOut2(startOp,endOp,steps,actStep,powr);
			elem.style.opacity = elem.currentOp;
			elem.style.MozOpacity = elem.currentOp;
			actStep++;
			if (actStep > steps)
      {
        window.clearInterval(elem.OpChangeMemInt);
      }
		}
		,intervals);
}

function undoFadeBack(elem,startOp,endOp,steps,intervals,powr)
{
	if (elem.OpChangeMemInt) window.clearInterval(elem.OpChangeMemInt);
	var actStep = 0;
	elem.OpChangeMemInt = window.setInterval(
		function()
		{
			elem.currentOp = easeInOut2(startOp,endOp,steps,actStep,powr);
			elem.style.opacity = elem.currentOp;
			elem.style.MozOpacity = elem.currentOp;
			actStep++;
			if (actStep > steps)
      {
        window.clearInterval(elem.OpChangeMemInt);
        elem.style.display="none";
      }
		}
		,intervals);
}

function growEffect(elem,vertical,horizontal)
{
  var effect=document.getElementById("effect");
  effect.style.display="block";
  switch(vertical)
  {
    case "top":
      effect.style.top=elem.offsetTop+elem.offsetHeight + "px";
    break;
    case "bottom":
      effect.style.top=elem.offsetTop + "px";
    break;
  }
  switch(horizontal)
  {
    case "left":
      effect.style.left=elem.offsetLeft+elem.offsetWidth + "px";
    break;
    case "right":
      effect.style.left=elem.offsetLeft + "px";
    break;
  }
  effect.style.height="0px";
  effect.style.width="0px";
  effect.style.visibility="visible";
  doGrowEffect(elem, effect, effect.offsetWidth, effect.offsetHeight, effect.offsetLeft, effect.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetLeft, elem.offsetTop, 10,10,0.333);
}

function doGrowEffect(elem, effect, startWidth, startHeight, startLeft, startTop, endWidth, endHeight, endLeft, endTop, steps,intervals,powr)
{
	if (effect.widthChangeMemInt) window.clearInterval(effect.widthChangeMemInt);
	var actStep = 0;
	effect.widthChangeMemInt = window.setInterval(
		function()
		{
			effect.currentWidth = easeInOut(startWidth,endWidth,steps,actStep,powr);
			effect.currentHeight = easeInOut(startHeight,endHeight,steps,actStep,powr);
			effect.currentLeft = easeInOut(startLeft,endLeft,steps,actStep,powr);
			effect.currentTop = easeInOut(startTop,endTop,steps,actStep,powr);
			effect.style.width = effect.currentWidth+"px";
			effect.style.height = effect.currentHeight+"px";
			effect.style.left = effect.currentLeft+"px";
			effect.style.top = effect.currentTop+"px";
			actStep++;
			if (actStep > steps)
      {
        window.clearInterval(effect.widthChangeMemInt);
        elem.style.visibility="visible";
        effect.style.visibility="hidden";
        effect.style.display="none";
        resizeIFrame(elem);
      }
		}
		,intervals);
}

