var GLOBAL_IMAGE_ROOT = "http://localhost/subtilia/_imports/imgs" ;

function set_image_source(img,src)
{
	img.setAttribute("src",GLOBAL_IMAGE_ROOT+"/"+src) ;
}

function get_event_src_element(e)
{
	if( e.target     ) return e.target ;
	if( e.srcElement ) return e.srcElement ;
	return false ;
}

function get_key_code(e)
{
	if( e.which ) return e.which ;
	if( e.keyCode ) return e.keyCode ;
	return false ;
}

var GLOBAL_ELEMENT_NODE	= 1 ;
var GLOBAL_TEXT_NODE	= 3 ;
var GLOBAL_COMMENT_NODE	= 8 ;

function get_parent_node(pObj)
{
	vParent = pObj.parentNode ;
	return vParent ;
}

function get_next_sibling(vObj)
{
	vObj = vObj.nextSibling ;
	while( vObj.nodeType != GLOBAL_ELEMENT_NODE )
	{
		vObj = vObj.nextSibling ;
	}
	return vObj ;
}

function get_prev_sibling(vObj)
{
	vObj = vObj.previousSibling ;
	while( vObj.nodeType != GLOBAL_ELEMENT_NODE )
	{
		vObj = vObj.previousSibling ;
	}
	return vObj ;
}

function get_first_child(vObj)
{
	vObj = vObj.firstChild ;
	while( vObj.nodeType != GLOBAL_ELEMENT_NODE )
	{
		vObj = vObj.nextSibling ;
	}
	return vObj ;
}

function get_last_child(vObj)
{
	vObj = vObj.lastChild ;
	while( vObj.nodeType != GLOBAL_ELEMENT_NODE )
	{
		vObj = vObj.previousSibling ;
	}
	return vObj ;
}

function has_next_sibling(vObj)
{
	do
	{
		if( vObj.nextSibling == null ) return false ;
		vObj = vObj.nextSibling ;
	} while( vObj.nodeType != GLOBAL_ELEMENT_NODE ) ;
	return true ;
}

function has_prev_sibling(vObj)
{
	do
	{
		if( vObj.previousSibling == null ) return false ;
		vObj = vObj.previousSibling ;
	} while( vObj.nodeType != GLOBAL_ELEMENT_NODE ) ;
	return true ;
}

function has_first_child(vObj)
{
	if( vObj.childNodes.length == 0 ) return false ;
	vObj = vObj.firstChild ;
	return has_next_sibling(vObj) ;
}

function get_child_nodes(vObj)
{
	var out = new Array() ;
	if( !has_first_child(vObj) ) return out ;
	var vLast = get_first_child(vObj) ;
	out[0] = vLast ;
	var i=1 ;
	while( has_next_sibling(vLast) )
	{
		vLast = get_next_sibling(vLast) ;
		out[i++] = vLast ;
	}
	return out ;
}