function ocmenu(item, tid, t1, t2) {
	var id = document.getElementById(item);
	var textid = document.getElementById(tid);
	if (t1 == null) 
	{
		t1 = "+";
	}
	if (t2 == null) 
	{
		t2 = "-";
	}
	if (id.style.display == "block") 
	{
		id.style.display = "none";
		textid.innerText = t1;
	}
	else 
	{
		id.style.display = "block";
		textid.innerText = t2;
	}
}

function selectall(formname)
{
	var num = document.forms[formname].length;
	if (document.forms[formname].elements["selectallch"].checked)
	{
		document.forms[formname].elements["selectallch"].checked = false;
	}
	else
	{
		document.forms[formname].elements["selectallch"].checked = true;
	}
	for ( var i=0; i<num; i++)
	{
		if (document.forms[formname].elements[i].type == "checkbox")
		{
			if (document.forms[formname].elements[i].checked)
			{
				document.forms[formname].elements[i].checked = false;
			}
			else
			{
				document.forms[formname].elements[i].checked = true;
			}
		}
	}
}

function count_process(elt, operation)
{
	var count = document.getElementById(elt);
	var valuethis = count.value;
	if ( valuethis == "NaN")
	{
		 valuethis = 1;
	}
	else
	{
		if (operation == "+")
		{
			valuethis++;
		}
		else
		{
			if (operation == "-")
			{
				valuethis--;
			}
		}
		if (valuethis < 0)
		{
			valuethis = 0;
		}
	}
	if ( valuethis == "NaN")
	{
		 valuethis = 1;
	}
	count.value = valuethis;
}

function eelogexpand(item, tid, t1, t2) {
	var id = document.getElementById(item);
	var textid = document.getElementById(tid);
	if (t1 == null) 
	{
		t1 = "+";
	}
	if (t2 == null) 
	{
		t2 = "—";
	}
	if (id.style.height != "auto") 
	{
		id.style.height = "auto";
		textid.innerText = t2;
	}
	else 
	{
		id.style.height = "30px";
		textid.innerText = t1;
	}
	return false;
}

function getPosit(elem) {
    var pos = {x : elem.offsetLeft, y : elem.offsetTop};
    if (elem.offsetParent) {
        var tmp = getPosit(elem.offsetParent);
        pos.x += tmp.x;
        pos.y += tmp.y;
    } 
    return pos;
}

function zoomover(id)
{
	var a = document.getElementById(id);
	if (a.hasChildNodes)
	{
		var i = a.childNodes.length;
		for (ii=0; ii<i; ii++)
		{
			if (a.childNodes[ii].tagName == 'IMG')
			{
				if (a.childNodes[ii].offsetParent)
				{
					var left = getPosit(a.childNodes[ii]);
				}
			}
			if (a.childNodes[ii].tagName == 'SPAN')
			{
				a.childNodes[ii].style.display = "inline";
				a.childNodes[ii].style.left = left.x + "px";
				a.childNodes[ii].style.top = left.y + "px";
//				alert (a.childNodes[ii].offsetLeft);
			}
		}
	}
}

function zoomout(id)
{
	var a = document.getElementById(id);
	if (a.hasChildNodes)
	{
		var i = a.childNodes.length;
		for (ii=0; ii<i; ii++)
		{
			if (a.childNodes[ii].tagName == 'SPAN')
			{
				a.childNodes[ii].style.display = "none";
			}
		}
	}
}

function updown (id, operation)
{
	var num2 = document.getElementById(id);
	var num = parseInt(num2.value);
	if (isNaN(num))
	{
		num = 0;
	}
	if (operation == 'up')
	{
		num++;
	}
	else if (operation == 'down')
	{
		num--;
	}
	
	num2.value = num;
}

/* eEgnith multilang library */
function ml(formid, name)
{
	for (var i=1; i<=5; i++)
	{
		
		var temp = name+'0'+i;
		var tempflag = 'flag'+name+'0'+i;
		
		var fid = document.getElementById(temp);
		var fidflag = document.getElementById(tempflag);
		if (fid != null)
		{
			if (temp == formid)
			{
				fid.style.display = 'block';
				fidflag.style.backgroundColor = '#ececec';
				fidflag.style.paddingTop = '2';
				fidflag.style.paddingBottom = '6';
				fidflag.style.marginTop = '0';
			}
			else
			{
				fid.style.display = 'none';
				fidflag.style.backgroundColor = 'white';
				fidflag.style.paddingTop = '2';
				fidflag.style.paddingBottom = '2';
				fidflag.style.marginTop = '4';
			}
		}
	}
	
}

var cache = new Array();
var flags = new Array();

function mlall(id)
{
	var len = cache.length;
	var thisid = '';
	
	for (var i=1; i<=5; i++)
	{
		var temp = '0'+i;
		var fidflag = document.getElementById(flags[i]);
		if (fidflag)
		{
			if (temp == id)
			{
				fidflag.style.backgroundColor = '#eff5e5';
				fidflag.style.paddingTop = '2';
				fidflag.style.paddingBottom = '10';
				fidflag.style.marginTop = '0';
				if (fidflag.hasChildNodes())
				{
					fidflag.childNodes(0).style.opacity = "0";
					fidflag.childNodes(0).style.filter = "alpha(opacity=99)";
				}
			}
			else
			{
				fidflag.style.backgroundColor = 'white';
				fidflag.style.paddingTop = '2';
				fidflag.style.paddingBottom = '2';
				fidflag.style.marginTop = '8';
				if (fidflag.hasChildNodes())
				{
					fidflag.childNodes(0).style.opacity = "0.5";
					fidflag.childNodes(0).style.filter = "alpha(opacity=50)";
				}
			}
		}
	}
	
	
	for (var i = 1; i <= len; i++)
	{
		if (cache[i])
		{
			thisid = cache[i].substring(3,5);
			var fid = document.getElementById(cache[i]);
			if (thisid == id)
			{
				
				fid.style.display = 'block';
			}
			else
			{
				fid.style.display = 'none';
			}
		}
	}
}

function ee_js_replace_value (from, to)
{
	var fromvalue = document.getElementById(from);
	var tovalue = document.getElementById(to);
	tovalue.value = fromvalue.value;
}

function ee_js_set_display (id, display)
{
	var el = document.getElementById(id);
	el.style.display = display;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
/*
var xpos;
var ypos;

function imouse(){
	ypos=event.y+document.body.scrollTop;  
	xpos=event.x+document.body.scrollLeft;  
}
document.onmousemove=imouse;
*/

function balonme()
{
	$('span.baloonme').hover(function(){
		
        $(this).find("em").animate({opacity: "show", top: "-75"}, "slow");
		var imagepath = $(this).find("em").attr("title");
		var ourimage = new Image();
		ourimage.src=imagepath;
		if (ourimage.height == 0 || ourimage.width == 0)
		{	
			var div_marginleft = 100 - $(this).width()/2;
			var div_margintop = 100 - $(this).height()/2;
		}
		else
		{
			var hc = ourimage.height/300;
			var wc = ourimage.width/300;
			if (hc > 1 || wc > 1)
			{
				if (hc >= wc)
				{
					ourimage.width = 300/ourimage.height * ourimage.width;
					ourimage.height = 300;
				}
				if (hc < wc)
				{
					ourimage.height = 300/ourimage.width * ourimage.height;
					ourimage.width = 300;
				}
			}
			var div_marginleft = ourimage.width/2 - $(this).width()/2;
			var div_margintop = ourimage.height/2 - $(this).height()/2;
		}
		
		$(this).find("em").show("slow");
		$(this).find("em").addClass("baloonclass");
		$(this).find("em").css("margin-left","-"+div_marginleft+"px");
		$(this).find("em").css("margin-top","-"+div_margintop+"px");
		var hoverText = $(this).attr("title");
		$(this).find("em").append("<img src=\""+imagepath+"\" alt=\""+hoverText+"\" />");
		if (ourimage.height == 0 || ourimage.width == 0)
		{
			$(this).find("em").find("img").css("width","300");
			$(this).find("em").find("img").css("height","300");
		}
		else
		{
			$(this).find("em").find("img").css("width",ourimage.width);
			$(this).find("em").find("img").css("height",ourimage.height);
		}
		}, function() {
			$(this).find("em").hide("fast");
			$(this).find("em").empty();
	});
}

function filtermenu2 (){
	$('#shopfilter').hover(function() {
		$(this).children("ul").slideDown("slow");
		$("#shopfilter ul li:has(ul)").hover(function()        
		{        
			$(this).children("ul").css("display", "none");       
			$(this).children("ul").slideDown("slow");        
		},     
		function()     
		{        
			$(this).children("ul").slideUp("fast");     
		});
	},
		function() {
			$(this).children("ul").slideUp("fast");
		}
	);
}
function filtermenu (){
	$('#shopfilter').click(function() {
		$(this).children("ul").css("left", "-160");
		$(this).children("ul").slideDown("slow");
		$("#shopfilter ul li:has(ul)").hover(function()        
		{        
			$(this).children("ul").css("display", "none");       
			$(this).children("ul").css("left", "-100");       
			$(this).children("ul").slideDown("slow");        
		},     
		function()     
		{        
			$(this).children("ul").slideUp("slow");     
		});
	}
	);
	$('#shopfilter ul li a#closemenu').dblclick(function(){
		$(this).parent().parent().css("display", "none");
	});
}


$(document).ready(function(){
	//balonme();
	filtermenu2();
});


