function takeYear(theDate) {
	x = theDate.getYear();
	var y = x % 100;
	y += (y < 38) ? 2000 : 1900;
	return y;
}
function LZ(x) {return(x<0||x>9?"":"0")+x};
function tid() {
  var regexS = "[\\?&]tid=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1].split('-');
}
function itemType() {
	return window.location.href.split('/')[3];
}
function id() {
	return window.location.href.split('/')[4].split('.')[0].split('-')[0];
}
function go(dest,debug) {
	var dt = new Date();
	var y=takeYear(dt)+"";
	var M=dt.getMonth()+1;
	var d=dt.getDate();
	var h=dt.getHours();
	var m=dt.getMinutes();
	var tidyDt=y+'-'+LZ(M)+'-'+LZ(d)+'-'+LZ(h)+'-'+LZ(m);
	var arTid = tid();
	if (arTid.length >= 4 && arTid[1].toLowerCase() == 'myp') {
		var hrf=dest+''+arTid[0]+'-'+tidyDt+'-'+itemType()+'-'+id()+'-'+arTid[1]+'-'+window.location.href.split('MYP-')[1].substring(0,20);
	} else if (arTid.length == 3) {
		var hrf=dest+''+arTid[0]+'-'+tidyDt+'-'+itemType()+'-'+id()+'-'+arTid[1]+'-'+arTid[2];
	} else if (arTid.length == 2) {
		var hrf=dest+''+arTid[0]+'-'+tidyDt+'-'+itemType()+'-'+id()+'-'+arTid[1];
	} else { 
		var hrf=dest+''+arTid[0]+'-'+tidyDt+'-'+itemType()+'-'+id();
	}
	if (!debug) {
	window.location.replace(hrf);
	} else {
		prompt('',hrf);
	}
}