// JScript File
var DROP_ITEM_OFF_CLASS = "item-off";
var DROP_ITEM_ON_CLASS = "item-on";
var DROP_DISAPPEAR_MS = 3000

var initDone = false;

// A Stack to keep track of window timeouts
var timeoutIDs = [];



function Point(x, y) {
	this.x = x;
	this.y = y;
}

function getObj(id) {
	if(document.layers) {
		return document.layers[id];
	} else if(document.all) {
		return document.all[id];
	} else if(document.getElementById) {
		return document.getElementById(id);
	}
}

function getPosition(el) {
	if(document.all) {
		return getPositionIE(el);
	} else if(document.getElementById) {
		return getPositionNS(el);
	}
}

function getPositionNS(el) {
	return new Point(el.x, el.y);
}

function getPositionIE(el) {
	var r = new Point(el.offsetLeft, el.offsetTop);
	
	if(el.offsetParent) {
		var tmp = getPositionIE(el.offsetParent);
		r.x += tmp.x;
		r.y += tmp.y;
	}

	return r;
}

function Search()
{
    getObj("searchoptions").style.display = "block";
}

//function navWait(obj, index) {
//	setTimeout('dropNavigation()', 500);
//	if(){clearTimeout('dropNavigation()');}
//{

function navOverNavigation(obj, index) {
	actualObj = getObj(obj);
	dropHideAllNavigation();
	var target = getObj(dropNavigation[index][0]);
	target.style.display = 'block';
	timeoutIDs.push([ window.setTimeout('dropHideAllNavigation();', DROP_DISAPPEAR_MS), obj, index]);
	obj.src = dropNavigation[index][3].src;
}

function navOut(obj, index) {
	// Noop
}

function dropHide(index) {
	var target = getObj(drop[index][0]);
	target.style.display = 'none';
}

function dropHideAllNavigation() {
	for(var i = 0; i < dropNavigation.length; i++) {
		var target = getObj(dropNavigation[i][0]);
		target.style.display = 'none';
	}
	while(timeoutIDs.length > 0) {
		var timeout = timeoutIDs.pop();
		window.clearTimeout(timeout[0]);
		timeout[1].src = dropNavigation[timeout[2]][2].src;
	}
}

function putObj(parent, target, offsetX, offsetY) {
	var pt = getPosition(parent);
	target.style.top = new String(pt.y + offsetY) + 'px';
	target.style.left = new String(pt.x + offsetX) + 'px';
	return pt;
}

function mouseEvent(id, image){
    var img = getObj(id);
   img.src = image; 
}


// Array of objects describing the drop menus and their parent images
var dropNavigation= [
	[ 'drop_departments', 'nav_departments', new Image(), new Image() ],
	[ 'drop_exclusives', 'nav_exclusives', new Image(), new Image() ],
	[ 'drop_about', 'nav_about', new Image(), new Image() ],
	[ 'drop_features', 'nav_features', new Image(), new Image() ]
];

dropNavigation[0][2].src = 'media/images/nav-departments.gif';
dropNavigation[0][3].src = 'media/images/nav-departments.gif';
dropNavigation[1][2].src = 'media/images/nav-exclusives.gif';
dropNavigation[1][3].src = 'media/images/nav-exclusives.gif';
dropNavigation[2][2].src = 'media/images/nav-about.gif';
dropNavigation[2][3].src = 'media/images/nav-about.gif';
dropNavigation[3][2].src = 'media/images/nav-current.gif';
dropNavigation[3][3].src = 'media/images/nav-current.gif';


