function getCookie( c_name )
{
	if ( document.cookie.length > 0 )
	{
		c_start = document.cookie.indexOf( c_name + "=" );
		if ( c_start != -1 )
		{
			c_start = c_start + c_name.length + 1;
			c_end = document.cookie.indexOf( ";", c_start );
			
			if ( c_end == -1 )
			{
				c_end = document.cookie.length;
			}
			return unescape( document.cookie.substring( c_start, c_end ) );
		}
	}
	return "";
}

function initSayt()
{
	if(saytHtmlIndexes)
	{
		searchAsYouType.initialize(document.getElementById(saytHtmlIndexes[0]) , false, saytHtmlIndexes[1]);
	}
}


function getByID(elementID) {
	return document.getElementById(elementID);
}

function debugOutput(obj,returnVariable) {
	debugBox = getByID('debugBox');
	if(!debugBox && !returnVariable) {
		elements = document.getElementsByTagName('body');
		body = elements[0];
		debugBox = document.createElement('div');
		debugBox.style.backgroundColor = "#FFFFFF";
		debugBox.id = 'debugBox';
		body.insertBefore(debugBox,body.firstChild);

	}
	var txt = '';
	if(typeof(obj) == 'object' && obj != null) {
		for(k in obj) {
			if(returnVariable) {
				txt += k + obj[k] + "\n";
			} else {
				txt +=  '<strong>' + k + '</strong>' + ' = ' + obj[k] + "<br />\n"
			}
		}
	} else {
		txt += obj;
	}
	if(returnVariable) {
		return txt;
	} else {
		debugBox.innerHTML = debugBox.innerHTML + txt + '<br />';
	}
}