window.onload = function ()
{
	/*
	var new_width = window.innerWidth * 0.8;
	
	document.getElementsByTagName ('body').item (0).style.width = new_width + 'px';
	
	document.getElementById ('header').style.width = new_width - 150 + 'px';
	
	var es = document.getElementById ('eservices');
	es.style.width = new_width - 150 + 'px';
	es.style.display = 'block';
//	es.style.background = '#FFF url("style/CAP/img/eservices_spread.jpg") repeat-x bottom left';
	es.getElementsByTagName ('a').item (0).style.width = new_width - 150 + 'px';
	es.getElementsByTagName ('a').item (0).style.backgroundPosition = 'right';
	
	document.getElementById ('main').style.width = new_width - 150 - 6 + 'px';
	*/
};

function isArray( array )
{
	return array != null && typeof array == "object" && 'splice' in array && 'join' in array;
}

function addAlert( msg )
{
	var body = document.getElementsByTagName( 'body' ).item( 0 );
	
	var m_alert = document.createElement ('p');
	m_alert.innerHTML = msg;
	m_alert.setAttribute( 'class', 'alert' );
	
	if ( body.hasChildNodes() )
	{
		body.insertBefore( m_alert, body.firstChild );
	}
	else
	{
		body.appendChild( m_alert );
	}
}

function insertAtCursor( myField, myValue )
{
	//IE support
	if ( document.selection )
	{
		myField.focus();
		sel = document.selection.createRange();
		sel.text = myValue;
	}
	//MOZILLA/NETSCAPE support
	else if ( myField.selectionStart || myField.selectionStart == 0 )
	{
		var startPos = myField.selectionStart;
		var endPos = myField.selectionEnd;
		myField.value = myField.value.substring( 0, startPos ) + myValue + myField.value.substring( endPos, myField.value.length );
	} 
	else
	{
		myField.value += myValue;
	}
}