function loadfuncs(){
	searchFormInit();
	initRollovers();
}

//for top + linuup
function productloadfuncs(productskey,goodskey){
	searchFormInit();
	initRollovers();

	var pm = new menuControler('lineupmenu','catlink','products_level');
	var gm = new menuControler('lineupmenu2','catlink','goods_level');
	if(productskey != undefined && productskey != ''){
		pm.menuopen(productskey);
	}
	if(goodskey != undefined && goodskey != ''){
		gm.menuopen(goodskey);
	}


}

function menuControler (id,innerClassName,idKey) {

	this._getElementsByClassNameExtend = function(obj,className){
		var list = obj.getElementsByTagName("a");
		var keynum = 0;
		for (var i = 0; i < list.length; i++) {
			if (list[i].className.indexOf(innerClassName) > -1) {
				self._test2(list[i],keynum);
				clist2[keynum] = list[i];
				keynum++;
			}
		}

		var list2 = obj.getElementsByTagName("ul");
		var keynum2 = 0;
		for (var j = 0; j < list2.length; j++) {
			if (list2[j].className.indexOf('open') > -1) {
				clist[keynum2] = list2[j];
				keynum2++;
			}
		}
		return true;
	};

	this._allReset = function(){
		for (var i = 0; i < clist2.length; i++) {
			clist2[i].style.fontWeight= "normal";
			clist2[i].style.textDecoration= "none";

		}
	}

	this._allClose = function(){
		for (var i = 0; i < clist.length; i++) {
			clist[i].style.display="none";
		}
	}


	this._test2 = function(o,num){
		o.onclick = function(){

			var tmpid = idKey + num;
			var obj2 = document.getElementById(tmpid);
			if(obj2.style.display == "block"){
				self._allClose();
				self._allReset();
			}else{
				self._allClose();
				self._allReset();
				obj2.style.display="block";
				this.style.fontWeight= "bold";
				this.style.textDecoration= "underline";
			}
		}
	}
	this.menuopen = function(num){

			var tmpid = idKey + num;
			var obj2 = document.getElementById(tmpid);

			if(obj2.style.display == "block"){
				self._allClose();
				self._allReset();
			}else{
				self._allClose();
				self._allReset();
				obj2.style.display="block";
				clist2[num].style.fontWeight= "bold";
				clist2[num].style.textDecoration= "underline";
			}
	}

	this._test = function(num){
		alert(num);
		//		olist[i].style.display="block";	
	}

	var self = this; 		//set scope
	var obj = document.getElementById(id);
	var clist = new Array();	//div class child elements Position List
	var clist2 = new Array();	//div class child elements Position List

	//Set Root Class Object	
	obj = this._getElementsByClassNameExtend(obj,innerClassName);

}

/////////////////////////////////////
//for line up top image preview
////////////////////////////////////
function show(url){
	var t = document.getElementById('thumbwindow');
	var timg = document.getElementById('thumbwin_img');
	timg.src = '/lineup/images/spacer.gif';
	t.style.display = 'block';
	timg.src = url;
}
function hide(){
	var t = document.getElementById('thumbwindow');
	var timg = document.getElementById('thumbwin_img');
	t.style.display = 'none';
	timg.src = '/lineup/images/spacer.gif';
}

function getMousePosition(e) {
	var obj = new Object();
	
	if(e) {
		obj.x = e.pageX;
		obj.y = e.pageY;
	}
	else {
		obj.x = event.x + document.body.scrollLeft;
		obj.y = event.y + document.body.scrollTop;
	}

	return obj;
}


function setPosition(){
	target2 = document.getElementById('thumbwindow');
	window.document.onmousemove = function(e){
		target2.style.top = (getMousePosition(e).y+10) + "px";
		target2.style.left = (getMousePosition(e).x+10) + "px";
	}
}

