
//********************************************************************

function repeat(n, c) {
	if (n > 0 && c.length > 0 ) {
		s = "";
		for ( i = 0; i < n; i++ ) {
			s = s + c;
		}
	} else {
		s = "";
	}
	return s;
}

//********************************************************************

function lpad(s, ml, p) {
	if (s.length == 0) {
		return string(ml, p);
	} else if (ml == 0) {
		return "";
	} else if (ml < s.length) {
		return s;
	} else {
		return repeat(ml - s.length, p)+s;
	}
}

//********************************************************************

function today() {
	now = new Date();
	m = now.getMonth()+1;
	mm = lpad(m.toString(),2,"0");
	d = now.getDate();
	dd = lpad(d.toString(),2,"0");
	return now.getFullYear()+"-"+mm+"-"+dd;
}

//********************************************************************

function GetScriptName (url) {
	if (url.length > 0) {
		sidx = url.lastIndexOf("/")+1;
		eidx = url.length;
		script = url.substring(sidx, eidx);
	} else {
		script = "";
	}
	return script;
}


