function get_cookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    // if cookie exists
    if (offset != -1) { 
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset);
      // set index of end of cookie value
      if (end == -1) end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}
function checkRemove()
{
  if (confirm('Are you sure you want to delete this item?'))
  {
    return true;
  }
  else
  {
    return false;
  }
}
function newPopUp(newurl,newname) 
{
  apopup=window.open(newurl,newname,'toolbar=yes,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width=650,height=500,screenX=(screen.width-650)/2,screenY=(screen.height-500)/2');
}

function newPopUpNonFixed(newurl,newname,x,y,doscroll,doresize,dotoolbar) 
{
  if(x == '') { x = '650'; }
  if(y == '') { y = '500'; } 
  if(doscroll=='') { doscroll = 'yes'; }
  if(doresize=='') { doresize = 'yes'; }
  if(dotoolbar=='') { dotoolbar = 'yes'; }  
  apopup=window.open(newurl,newname,'toolbar=' + dotoolbar + ',location=no,directories=no,status=no,scrollbars=' + doscroll + ',resizable=' + doresize + ',copyhistory=no,width=' + x + ',height=' + y + ',screenX=(screen.width-' + x + ')/2,screenY=(screen.height-' + y + ')/2');
}

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);
}

function monthtoint(name) {
	if(name='January') return 0;
	if(name='February') return 1;
	if(name='March') return 2;
	if(name='April') return 3;
	if(name='May') return 4;
	if(name='June') return 5;
	if(name='July') return 6;
	if(name='August') return 7;
	if(name='September') return 8;
	if(name='October') return 9;
	if(name='November') return 10;
	if(name='December') return 11;	
}

function doPrint()
{
	window.focus();
	window.print();
}

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);
    }
}

function IsNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
}

function checkAll(field)
{
  for (i = 0; i < field.length; i++)
	field[i].checked = true ;
}
