function loadTP() {
	var url = __avego_tp_getURLFromScriptTag__();
	var tp_src = "";
	if(url == null) tp_src = "http://www.avego.com/transportal/appLoad.action";//default to avego.com if no src is found
	else tp_src = url + "appLoad.action";
	
	tp_src += "?op=" + TP_OPCODE;
	
	if (typeof(TP_RESELLERKEY) != "undefined" && TP_RESELLERKEY != null) tp_src += "&reseller=" + TP_RESELLERKEY;
	if (typeof(TP_PREFILLFROMTEXT) != "undefined" && TP_PREFILLFROMTEXT != null) tp_src += "&faddr=" + TP_PREFILLFROMTEXT;
	if (typeof(TP_FROMLAT) != "undefined" && TP_FROMLAT != null) tp_src += "&flat=" + TP_FROMLAT;
	if (typeof(TP_FROMLON) != "undefined" && TP_FROMLON != null) tp_src += "&flon=" + TP_FROMLON;
	if (typeof(TP_FROMSTOPID) != "undefined" && TP_FROMSTOPID != null) tp_src += "&fid=" + TP_FROMSTOPID;
	if (typeof(TP_PREFILLTOTEXT) != "undefined" && TP_PREFILLTOTEXT != null) tp_src += "&taddr=" + TP_PREFILLTOTEXT;
	if (typeof(TP_TOLAT) != "undefined" && TP_TOLAT != null) tp_src += "&tlat=" + TP_TOLAT;
	if (typeof(TP_TOLON) != "undefined" && TP_TOLON != null) tp_src += "&tlon=" + TP_TOLON;
	if (typeof(TP_TOSTOPID) != "undefined" && TP_TOSTOPID != null) tp_src += "&tid=" + TP_TOSTOPID;
	if (typeof(TP_GEOAPPEND) != "undefined" && TP_GEOAPPEND != null) tp_src += "&geoapd=" + TP_GEOAPPEND;
	if (typeof(TP_HEIGHT) != "undefined" && TP_HEIGHT != null) tp_src += "&h=" + TP_HEIGHT;
	if (typeof(TP_WIDTH) != "undefined" && TP_WIDTH != null) tp_src += "&w=" + TP_WIDTH;
	if (typeof(TP_HEADER) != "undefined" && TP_HEADER != null) tp_src += "&pheader=" + TP_HEADER;
	if (typeof(TP_COPYRIGHT) != "undefined" && TP_COPYRIGHT != null) tp_src += "&pfooter=" + TP_COPYRIGHT;
	if (typeof(TP_JPTAB) != "undefined" && TP_JPTAB != null) tp_src += "&jptab=" + TP_JPTAB;
	if (typeof(TP_NVTAB) != "undefined" && TP_NVTAB != null) tp_src += "&nvtab=" + TP_NVTAB;
	if (typeof(TP_SVTAB) != "undefined" && TP_SVTAB != null) tp_src += "&svtab=" + TP_SVTAB;
	if (typeof(TP_BKTAB) != "undefined" && TP_BKTAB != null) tp_src += "&bktab=" + TP_BKTAB;
	if (typeof(TP_JPSEARCH) != "undefined" && TP_JPSEARCH != null) tp_src += "&geosch=" + TP_JPSEARCH;
	if (typeof(TP_SEARCH_DROPDOWN) != "undefined" && TP_SEARCH_DROPDOWN != null) tp_src += "&searchdd=" + TP_SEARCH_DROPDOWN;
	if (typeof(TP_MAPLAT) != "undefined" && TP_MAPLAT != null) tp_src += "&mlat=" + TP_MAPLAT;
	if (typeof(TP_MAPLON) != "undefined" && TP_MAPLON != null) tp_src += "&mlon=" + TP_MAPLON;
	if (typeof(TP_MAPZOOM) != "undefined" && TP_MAPZOOM != null) tp_src += "&mzoom=" + TP_MAPZOOM;
	if (typeof(TP_TICKETING) != "undefined" && TP_TICKETING != null) tp_src += "&olticket=" + TP_TICKETING;
	if (typeof(TP_PRESET_TAB) != "undefined" && TP_PRESET_TAB != null) tp_src += "&tab=" + TP_PRESET_TAB;
	if (typeof(TP_PRESET_FROM) != "undefined" && TP_PRESET_FROM != null) tp_src += "&pfrom=" + TP_PRESET_FROM;
	if (typeof(TP_PRESET_TO) != "undefined" && TP_PRESET_TO != null) tp_src += "&pto=" + TP_PRESET_TO;
	if (typeof(TP_PRESET_TIME) != "undefined" && TP_PRESET_TIME != null) tp_src += "&ptime=" + TP_PRESET_TIME;
	if (typeof(TP_PRESET_DATE) != "undefined" && TP_PRESET_DATE != null) tp_src += "&pdate=" + TP_PRESET_DATE;
	
	//var tp_date = new Date();
	//tp_src += "&cy=" + tp_date.getFullYear() + "&cm=" + (tp_date.getMonth() + 1) + "&cd=" + tp_date.getDate();
	
	document.getElementById("transportal").src = tp_src;
	if (typeof(TP_HEIGHT) == "undefined" || TP_HEIGHT == null || TP_HEIGHT == "" || TP_HEIGHT < 620)
		document.getElementById("transportal").height = "620px";
	else
		document.getElementById("transportal").height = TP_HEIGHT;
	if (typeof(TP_WIDTH) == "undefined" || TP_WIDTH == null || TP_WIDTH == "" || TP_WIDTH < 480)
		document.getElementById("transportal").width = "480px";
	else
		document.getElementById("transportal").width = TP_WIDTH;
}
function __avego_tp_getURLFromScriptTag__()
{
	var AVEGOimport = __avego_getPathToSelf__();
	if(AVEGOimport != null)
	{
		var tmp = AVEGOimport.split("script/setup.js");
		return tmp[0];
	}
	return null;
}
function __avego_getPathToSelf__() 
{
	if (typeof(CM_TP_SRC_OVERWRITE) != "undefined" && CM_TP_SRC_OVERWRITE != null){
		return CM_TP_SRC_OVERWRITE + "/transportal/";
	}
	
	var scripts = document.getElementsByTagName("script");
	var src;
	for (var i = 0; i < scripts.length; i++) {
		if (src = scripts[i].getAttribute("src")) {
			//console.info(src);
			if (src == "http://localhost:8080/transportal/script/setup.js"){
				return src
			}
			else if (src.search("www.avego.com")) {
				return src;
			}
		}
	}
	return null;
}