//js file
try{
		document.addEventListener("click",toggleMenu,false);
	}catch(e){
		document.attachEvent("onclick",toggleMenu);
	}
var target;
var timer ;

function toggleMenu(evt,t){
	target = document.getElementById(t);
	prnt = document.getElementById('alltitlelinks');
	items = prnt.getElementsByTagName('UL');
	for(i = 0; i< items.length; i++){
		n = items[i].childNodes[1] ? 1 : 0;
		curnode = items[i].childNodes[n].childNodes[2] ? items[i].childNodes[n].childNodes[2] : items[i].childNodes[n].childNodes[1]; 
		if(items[i].parentNode.id == "alltitlelinks" && target != curnode){
			curnode.style.display = "none";
		}
	}
	if(evt.type == "click"){
		showIt();
		if(t != null){
			if( evt.stopPropagation ) { 
				evt.stopPropagation(); 
			}
			evt.cancelBubble = true;	
		}
	}else{
		timer = setTimeout("showIt()",250);
	}
}
function showIt(){
	try{
		target.style.display = "block";
	}catch(e){
		return false;
	}
}
	/*********************************************************************
	 * Get an object, this function is cross browser
	 * *** Please do not remove this header. ***
	 * This code is working on my IE7, IE6, FireFox, Opera and Safari
	 * 
	 * Usage: 
	 * var object = get_object(element_id);
	 *
	 * @Author Hamid Alipour Codehead @ webmaster-forums.code-head.com		
	**/
	function get_object(id) {
		var object = null;
		if( document.layers )	{			
			object = document.layers[id];
		} else if( document.all ) {
			object = document.all[id];
		} else if( document.getElementById ) {
			object = document.getElementById(id);
		}
		return object;
	}
	/*********************************************************************/
	
	/*********************************************************************
	 * No onMouseOut event if the mouse pointer hovers a child element 
	 * *** Please do not remove this header. ***
	 * This code is working on my IE7, IE6, FireFox, Opera and Safari
	 * 
	 * Usage: 
	 * <div onMouseOut="fixOnMouseOut(this, event, 'JavaScript Code');"> 
	 *		So many childs 
	 *	</div>
	 *
	 * @Author Hamid Alipour Codehead @ webmaster-forums.code-head.com		
	**/
	function is_child_of(parent, child) {
		if( child != null ) {			
			while( child.parentNode ) {
				if( (child = child.parentNode) == parent ) {
					return true;
				}
			}
		}
		return false;
	}
	function fixOnMouseOut(element, event, JavaScript_code) {
		var current_mouse_target = null;
		if( event.toElement ) {				
			current_mouse_target 			 = event.toElement;
		} else if( event.relatedTarget ) {				
			current_mouse_target 			 = event.relatedTarget;
		}
		if( !is_child_of(element, current_mouse_target) && element != current_mouse_target ) {
			eval(JavaScript_code);
		}
	}
	/*********************************************************************/
	
function killTimer(){
	clearTimeout(timer);
}
