
function mouseReallyOut(oThis, e) {
	//alert (e.toElement.parentNode.className);
	//alert ( e.fromElement.parentNode.id + ' ' + e.fromElement.parentNode.className);
	//return false;
	
	/* IE */
	if (e.fromElement)
	{
  		// alert('IE')
		//if (e.toElement.parentNode.className=='' && e.toElement != oThis && e.fromElement.id == oThis.id)
		//if (e.fromElement.parentNode.className=='dropmenuastia' && e.toElement.parentNode.id!='logininfo' )
		//{
			//alert(e.toElement.id);
		if (e.fromElement.parentNode.className=='dropmenuastia' && e.toElement.parentNode.id!='logininfo' && e.toElement.id!='logininfo' && e.toElement.parentNode.id!=oThis.id )
		{
			//alert(oThis.id + '\n FROM ' + e.fromElement.parentNode.className + '\nTO: ' + e.toElement.id + '\n' + e.toElement.parentNode.id)
			//alert (oThis.id + ' : ' + oThis.className + ' : ' +  oThis.tagName + ' \n ' + e.toElement.tagName + ' : '  + e.toElement.id + ' : ' + e.toElement.parentNode.className);
			return true;
		}
		return false;
		// IE
		//alert(oThis + ' ' + e.toElement + ' ' + e.toElement.parentNode); // IE
  		//alert(oThis + ' ' + e.relatedTarget); // FIREFOX
	}

	/* FIREFOX */
	if (e.relatedTarget) {
	  return(e.relatedTarget != oThis && e.relatedTarget.parentNode  != oThis);
	}
	return(e.toElement != oThis && e.toElement.parentNode  != oThis);
	
}



function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function test()
{
	//return false;
	alert('test');
}

function alasvetovalikko_esiin(id) 
{ 
	var piilotusajastin;
	if (piilotusajastin) clearTimeout(piilotusajastin);
	piilotusajastin = null;

	//nykyvalue = document.getElementById('alert').value;
	//document.getElementById('alert').value = nykyvalue+'e';
	
	var obj, idnimi;
	idnimi = 'dropdown_' + id;
	tdnimi =  'td_' + id;
	animi =  'a_' + id;

	if ((obj=document.getElementById(idnimi))!=null) 
	{ 
		if (obj.style) 
		{ 
			obj=obj.style; 
		}
		obj.overflow='visible'; 	
		
		if (document.getElementById(tdnimi)!=null) 
		{ 
			document.getElementById(tdnimi).className = 'tdsininen';
		}
		if (document.getElementById(animi)!=null) 
		{ 
			document.getElementById(animi).className = 'navival_dropdown1';	
		}
	}
}

function alasvetovalikko_piiloon(id, oThis, e) 
{ 
	if (mouseReallyOut(oThis, e))
	{
		//alert('ok');
	}
	else
	{
		//alert('ei käy');
		return false;
	}
	//nykyvalue = document.getElementById('alert').value;
	//document.getElementById('alert').value = nykyvalue+'p';
	
	var obj, idnimi;
	idnimi = 'dropdown_' + id;
	tdnimi =  'td_' + id;
	animi =  'a_' + id;

	if ((obj=document.getElementById(idnimi))!=null) 
	{ 
		if (obj.style) 
		{ 
			obj=obj.style; 
		}
		obj.overflow='hidden'; 
		if (document.getElementById(tdnimi)!=null) 
		{ 
			document.getElementById(tdnimi).className = 'tdvalkoinen';	
		}
		if (document.getElementById(animi)!=null) 
		{ 
			document.getElementById(animi).className = 'naviurl_dropdown1';	
		}
	}
}




function alasvetovalikko() 
{ 
/*
	var i,p,v,obj, idnimi, args=alasvetovalikko.arguments;
	//alert('alkaa');
	idnimi = 'dropdown_' + args[0];
	tdnimi =  'td_' + args[0];
	// alert(idnimi);
	
	// for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) 
	for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(idnimi))!=null) 
	{ 
		v=args[i+2];
		if (obj.style) 
		{ 
			obj=obj.style; 
			v=(v=='show')?'visible':(v=='hide')?'hidden':v; 
		}
		//alert('OK');
		obj.overflow=v; 
	}
	//alert('lopput');
	*/
}

var uusi_ikkuna
function ai(url) 
{
	
	uusi_ikkuna = window.open(url, "tuote", "resizable=1,width=268,height=430,status=1,toolbar=0,menubar=0,scrollbars=1");
	document.ai_returnValue = false;
	uusi_ikkuna.focus();
}
