function removeChilds(node,toIdx){
	var len,i;
	if(toIdx==undefined) toIdx=0;
	len=node.childNodes.length;
	if(toIdx==len) return true;
	for(i=len-1;i>=toIdx;i=i-1){
		node.childNodes[i].parentNode.removeChild(node.childNodes[i]);
	}
}

function removeOptions(node,toIdx){
	var len,i;
	if(toIdx==undefined) toIdx=0;
	len=node.options.length;
	if(toIdx>=len) return true;
	for(i=len-1;i>=toIdx;i=i-1){
		node.options[i].parentNode.removeChild(node.options[i]);
	}
}


function findFirstParent(node,tagName){
	//amig van szulo..
	while(node=node.parentNode){
		if(node.tagName==tagName) return node;
	}
	//ha idaig eljut, akkor nem talalt
	return false;
}

function findFirstSibling(node,tagName){
	while(node=node.nextSibling){
		if(node.tagName==tagName) return node;
	}
	
	return false;
}

function resetFormData(targetId){
	lmnt=document.getElementById(targetId);
	
	var x=lmnt.getElementsByTagName('INPUT');
	for(var i=0;i<x.length;i++){
		if(x[i].type=='radio' || x[i].type=='checkbox'){ 
			if(x[i].checked) x[i].checked=false;
			continue; 
		}
		if(x[i].type=='button') continue;
		x[i].value='';
	}
	x=lmnt.getElementsByTagName('SELECT');
	for(i=0;i<x.length;i++){
		x[i].selectedIndex=0;
	}
	x=lmnt.getElementsByTagName('TEXTAREA');
	for(i=0;i<x.length;i++){
		x[i].value='';
	}
}

function show(divId){
	if(document.getElementById(divId))
		document.getElementById(divId).style.display='block';
}

function hide(divId){
	document.getElementById(divId).style.display='none';
}

function showFromGroup(groupName,aTag){
	if(aTag.getAttribute){
		tmp=aTag.getAttribute('rel');
		targetId=tmp.replace('choose#','');
	}else{
		targetId=aTag;
	}
	var divs=document.getElementsByTagName('div');
	for(i in divs){
		if(divs[i].attributes){
			var relAttribute = String(divs[i].getAttribute('rel'));
			if(relAttribute.match(groupName)){
				divs[i].style.display='none';
			}
		}
	}
	show(targetId);
}

function showDefault(){
	showFromGroup('subMenu','');
}

function addEvent(obj, evType, fn) {
	if (obj.addEventListener) {
		obj.addEventListener(evType, fn, true);
		return true;
	} else if (obj.attachEvent) {
		var r = obj.attachEvent("on"+evType, fn);
		return r;
	} else {
		return false;
	}
}

function stopBubbling(event){
	if (event.preventDefault) {
		event.preventDefault(); event.stopPropagation();
	} else {
		event.cancelBubble = true; event.returnValue = false;
	}
}
function initMenu(){
	var aTags=document.getElementsByTagName('a');
	
	for(i in aTags){
		if(aTags[i].attributes){
			var relAttribute = String(aTags[i].getAttribute('rel'));
			if(relAttribute.match('choose')){
				aTags[i].onmouseover=function(){showFromGroup('subMenu',this)}
				aTags[i].onmouseout=showDefault;
			}
		}
	}
}

//addEvent(window,'load',initMenu);

function eml_coder(account,domain,dotwhat)
{
document.write('<a href="mailto:'+account+'&#64;'+domain+'&#46;'+dotwhat+'">'+account+'&#64;'+domain+'&#46;'+dotwhat+'</a>');
}
