function setCookie( name, value ) {

// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );

expires = 180 * 1000 * 60 * 60 * 24;
var expires_date = new Date( today.getTime() + (expires) );

document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" );
}

function getCookie( name ) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
		return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}

function deleteCookie( name, path, domain ) {
	if ( getCookie( name ) ) document.cookie = name + "=" + ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function setStyle( id ) {
	setCookie( "style", id);
	// refresh
	// window.location.href = unescape(window.location.pathname);
	window.location.reload( false );
}


function changeColor( id, color ) {
document.getElementById("paper" + id + '').style.background=color;
}

function high( id) {
	changeColor(id, '#99ff00');
}

function low( id) {
	changeColor(id, 'yellow');
}

function block( id) {
	changeColor(id, '#ff9900');
}

function conflict( id) {
	changeColor(id, '#ff3333');
}

function dontCare( id) {
	changeColor(id, 'white');
}

function accept4WW( id) {
	changeColor(id, '#99ff00');
}

function accept4PW( id) {
	changeColor(id, '#CCFF00');
}

function accept4PA( id) {
	changeColor(id, '#CCFF99');
}

function reject( id) {
	changeColor(id, '#FF3333');
}

function pending( id) {
	changeColor(id, 'yellow');
}

function left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}
function right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}