function preLoadImages()
{
	if (document.images) //object not available in older browsers
    {
      preload_image_object = new Image();
      // set image url
      image_url = new Array();
      image_url[0] = "/images/forhim_minus.gif";
      image_url[1] = "/images/forher_minus.gif";
      image_url[2] = "/images/forhim_plus.gif";
      image_url[3] = "/images/forher_plus.gif";

      var i = 0;
      for(i=0; i<=3; i++) 
	  {
      	preload_image_object = new Image();
        preload_image_object.src = image_url[i];
	  }
	
	  if(typeof(preloadMainImages) != 'undefined')
	  {
		  for(i=0; i < preloadMainImages.length; i++)
		  {
      		preload_image_object = new Image();
			preload_image_object.src = preloadMainImages[i];
		  }
	  }
	
	  if(typeof(preloadFeatImages) != 'undefined')
	  {
		  for(i=0; i < preloadFeatImages.length; i++)
		  {
      		preload_image_object = new Image();
			preload_image_object.src = preloadFeatImages[i];
		  }
	  }
    }
}

function opacity(id, opacStart, opacEnd, millisec, CallbackFunction) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "','" + opacEnd + "','" + CallbackFunction + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "','" + opacEnd + "','" + CallbackFunction + "')",(timer * speed)); 
            timer++; 
        } 
    } 
} 
//change the opacity for different browsers 
function changeOpac(opacity, id, desired, callback) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
	if(opacity == desired && callback != '')
	{
		setTimeout(callback, 50);
	}
}
function ChangeMainAd()
{
currentMainAd++;
if(currentMainAd >= adMainHtml.length)
	currentMainAd = 0;
FadeMainOut();
}
function FadeMainOut()
{
opacity('mainAdDiv', 100, 0, 600, 'ChangeMainAndFadeIn()');
}
function ChangeMainAndFadeIn()
{
document.getElementById('mainAdDiv').innerHTML = adMainHtml[currentMainAd];
opacity('mainAdDiv', 0, 100, 600, 'SetMainAdTimer()');
}
function SetMainAdTimer()
{
setTimeout('ChangeMainAd()', 4000);
}

function ChangeFeatAd()
{
currentFeatAd++;
if(currentFeatAd >= adFeatHtml.length)
	currentFeatAd = 0;
FadeFeatOut();
}
function FadeFeatOut()
{
opacity('featAdDiv', 100, 0, 600, 'ChangeFeatAndFadeIn()');
}
function ChangeFeatAndFadeIn()
{
document.getElementById('featAdDiv').innerHTML = adFeatHtml[currentFeatAd];
opacity('featAdDiv', 0, 100, 600, 'SetFeatAdTimer()');
}
function SetFeatAdTimer()
{
setTimeout('ChangeFeatAd()', 5200);
}


/* show/hide top swirl */
function headerMOver(i) {
	var s = document.getElementById("topS" + i);
	s.style.visibility = "visible";
	var c = document.getElementById("topC" + i);
	c.style.backgroundColor = "#FE0000";
}
function headerMOut(i) {
	var s = document.getElementById("topS" + i);
	s.style.visibility = "hidden";
	var c = document.getElementById("topC" + i);
	c.style.backgroundColor = "";
}

/* show/hide the menus */
function ToggleBrands(h)
{
	var b = document.getElementById(h + "Brands");
	var a = document.getElementById("for" + h + "PlusMinus");
	if(b.style.display == "none")
	{
		b.style.display = "inline";
		a.src = "/images/for" + h + "_minus.gif";
	}
	else
	{
		b.style.display = "none";
		a.src = "/images/for" + h + "_plus.gif";
	}	
}


/* change footer link backgrounds */
function FOver(f){
	f.style.backgroundColor = "#FF0000";
}
function FOut(f){
	f.style.backgroundColor = "";
}

/* keep/stop parent menu highlighted and show the arrow*/
function kp(i)
{
	var e = document.getElementById("b" + i);
	var ea = document.getElementById("b" + i + "a");
	e.style.backgroundColor = "#FE0000";
	e.style.color = "#FFFFFF";
	ea.style.position = "absolute";
	ea.style.top = "4px";
	ea.style.left = "125px";
	ea.width = "10";
	ea.height = "12";
	ea.border = "0";
	ea.style.display = "inline";
}
function sp(i)
{
	var e = document.getElementById("b" + i);
	var ea = document.getElementById("b" + i + "a");
	e.style.backgroundColor = "";
	e.style.color = "";
	ea.style.display = "none";
}

function updateTimeLeft(){
	foo = new Date;
	unixtime = parseInt(foo.getTime() / 1000);
	timeLeft = endTime - (unixtime + clientDiff);
	minsLeft = Math.floor(timeLeft / 60);
	secondsLeft = timeLeft - (minsLeft * 60);
	if(timeLeft >= 0)
		setTimeout('updateTimeLeft()', 100);
	else
	{
		minsLeft = 0;
		secondsLeft = 0;
	}
	
	document.getElementById('clearanceTimeLeftTime').innerHTML =  minsLeft + ' mins ' + secondsLeft;
}

function updateClearanceTimeLeft(){
	foo = new Date;
	unixtime = parseInt(foo.getTime() / 1000);
	timeLeft = endTime - (unixtime + clientDiff);
	minsLeft = Math.floor(timeLeft / 60);
	secondsLeft = timeLeft - (minsLeft * 60);
	if(timeLeft >= 0)
		setTimeout('updateClearanceTimeLeft()', 100);
	else
	{
		minsLeft = 0;
		secondsLeft = 0;
	}
	
	document.getElementById('clearanceTimeLeftTime').innerHTML =  'Time remaining: ' + minsLeft + ' minutes and ' + secondsLeft + ' seconds';
}