var cur_vis_obj = null;
var cur_vis_obj2 = null;
var hide_delay = 100;
var tstat, hidemenuID1, hidemenuID2;


function show(obj,id_menu,num) {
	if (cur_vis_obj != null) {
		cur_vis_obj.style.display = "none";
	}
	if (id_menu != null) {
		obj_id_menu = document.getElementById(id_menu);
		var pos = posAbsolute(obj);
		obj_id_menu.style.left = pos.left + pos.width/5 + document.body.scrollLeft;
		obj_id_menu.style.top = pos.top - parseInt(obj_id_menu.style.height) - 1 + document.body.scrollTop;
		obj_id_menu.style.display = "";
		if(navigator.appName == "Opera" || navigator.appName == "Netscape"){
			obj_id_menu.style.top = parseInt(obj_id_menu.style.top) - 1;
		}
		cur_vis_obj = obj_id_menu;
	}

}

function show2(obj,id_menu) {
	if (cur_vis_obj2 != null) {
		cur_vis_obj2.style.display = "none";
	}
	if (id_menu != null) {
		obj_id_menu = document.getElementById(id_menu);
		var pos = posAbsolute(obj);
		obj_id_menu.style.left = pos.left + pos.width + document.body.scrollLeft - 4;
		obj_id_menu.style.top = pos.top - parseInt(obj_id_menu.style.height) + pos.height + 3 + document.body.scrollTop;
		obj_id_menu.style.display = ""; 
		if(navigator.appName == "Opera"){navigator.appName == "Netscape"
			obj_id_menu.style.left = parseInt(obj_id_menu.style.left) + 2;
		} else if(navigator.appName == "Netscape"){
			obj_id_menu.style.left = parseInt(obj_id_menu.style.left) + 4;
		}
		cur_vis_obj2 = obj_id_menu;
	}

}

function show2hide(obj){
	obj.style.display = "none";
}
			
function hidemenu(num) {
		hidemenuID = setTimeout("show()",hide_delay);
		tstat = 1;
		if(num == 1 || tstat == 1){
			hidemenuID1 = setTimeout("show2hide(price1)",hide_delay);
		}
		if(num == 2 || tstat == 1){
			hidemenuID2 = setTimeout("show2hide(price2)",hide_delay);
		}
		if(num == 3 || tstat == 1){
			hidemenuID3 = setTimeout("show2hide(price3)",hide_delay);
		}
		if(num == 4 || tstat == 1){
			hidemenuID4 = setTimeout("show2hide(price4)",hide_delay);
		}
}

function unhidemenu(num) {
		if(tstat == 1){
			clearTimeout(hidemenuID);
			clearTimeout(hidemenuID1);
			clearTimeout(hidemenuID2);
			clearTimeout(hidemenuID3);
			clearTimeout(hidemenuID4);
			tstat = 0;
		}
		if(num == 1){
			clearTimeout(hidemenuID1);
		}
		if(num == 2){
			clearTimeout(hidemenuID2);
		}
		if(num == 3){
			clearTimeout(hidemenuID3);
		}
		if(num == 4){
			clearTimeout(hidemenuID3);
		}
}

function check() {
	i+=1;
	i = i % 2;
	return i;
}

function posAbsolute(obj)
{
  var left = obj.offsetLeft;
  var top = obj.offsetTop;
  for (var parent = obj.offsetParent; parent; parent = parent.offsetParent)
  {
    left += parent.offsetLeft - parent.scrollLeft;
    top += parent.offsetTop - parent.scrollTop;
  }
  return {left: left, top: top, width: obj.offsetWidth, height: obj.offsetHeight};
}

var cur_open_obj = null;
function show_price(obj){
	if(cur_open_obj == obj){
		obj.style.display = "none";
		cur_open_obj = null;
	}
	else if(cur_open_obj != null){
		cur_open_obj.style.display = "none";
		obj.style.display = "";
		cur_open_obj = obj;
	} else {
		obj.style.display = "";
		cur_open_obj = obj;
	}
}

function showi(obj){
	var res;
	for (var i in obj){
		res = res + "   " + i + ":" + obj[i];
	}
	return res;
}

function changeClass(obj,type){
	if(type == 0){
		obj.style.backgroundColor = "#eeeeee";
	} else {
		obj.style.backgroundColor = "";
	}
}

