function capitalise(str)
{
	var letter = str.substr(0,1);
	return letter.toUpperCase() + str.substr(1);
}
function refreshNow()
{
	window.location.href = window.location.href;
}
function el(id)
{
	return document.getElementById(id);
}
function addEl(type,id,target)
{
	if(el(target) && !el(id))
	{
		var newdiv = document.createElement(type);
		newdiv.setAttribute('id',id);
		el(target).appendChild(newdiv);
		return el(id);
	}
}
function rmEl(element_id,parent_id)
{
	if(el(element_id) && el(parent_id))
	{
		el(parent_id).removeChild(el(element_id));
	}
}
function getWidth()
{
	var widChk = document.createElement('div');
	widChk.setAttribute('style', 'height:100%;width:100%;position:fixed;');
	widChk.setAttribute('id','wid');
	document.body.appendChild(widChk);

	var tmpw=el("wid").offsetWidth;
	tmpw=tmpw-5;
	document.body.removeChild(document.getElementById("wid"));
	return tmpw;
}
function ucfirst(string)
{
    return string.charAt(0).toUpperCase() + string.slice(1);
}
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

