if (typeof(getTopLevelWnd().__browserId) == "undefined")
{
getTopLevelWnd().__browserId = (new Date()).getTime();
if (Trace_FRAMENAVIGATION) framenavigation_trace("assigned new browser id: " + getBrowserId());
}
function getBrowserId()
{
return getTopLevelWnd().__browserId;
}
function changeFrameLocationInFrameset(parentFrame, frameName, newLocation)
{
var allFrames = parentFrame.document.getElementsByTagName("frame");
var id = null;
for (i=0; i<allFrames.length; i++)
{
var f = allFrames.item(i);
if (f.getAttribute("name") == frameName)
{
id = f.getAttribute("id");
break;
}
}
changeFrameLocationWithId(parentFrame.frames[frameName], newLocation, id);
}
function changeFrameLocationWithId(targetFrame, newLocation, frameId)
{
var newUrl = newLocation + ((newLocation.indexOf("?") == -1) ? "?" : "&") +
'Reload=' + new Date().getTime();
if (frameId != null && frameId.length > 0)
{
newUrl += '&__dmfFrameId=' + frameId + '&__dmfBrowserId=' + getBrowserId();
}
if (Trace_FRAMENAVIGATION) framenavigation_trace("replacing frame location with: " + newUrl);
targetFrame.location.replace(newUrl);
}
function setCookie(name, value, expire, path)
{
var newCookie = name + "=" + escape(value)
+ ((expire == null) ? "" : ("; expires=" + expire.toGMTString()))
+ ((path == null) ? "" : ("; path=" + path));
document.cookie = newCookie;
if (Trace_FRAMENAVIGATION) framenavigation_trace("set cookie: " + newCookie);
}
function getCookie(Name)
{
var cookieVal = null;
var search = Name + "=";
if (document.cookie.length > 0)
{
offset = document.cookie.indexOf(search);
if (offset != -1)
{
offset += search.length;
end = document.cookie.indexOf(";", offset);
if (end == -1)
{
end = document.cookie.length;
}
cookieVal = unescape(document.cookie.substring(offset, end))
}
}
if (Trace_FRAMENAVIGATION) framenavigation_trace("getting cookie: " + cookieVal);
return cookieVal;
}
function deleteCookie(name, path)
{
if (getCookie(name) != null)
{
var expire = new Date();
// expire with yesterday's date
expire = new Date(expire.getTime() - (24 * 60 * 60 * 1000));
setCookie(name, "", expire, path);
}
}
function framenavigation_trace(msg)
{
Trace_println("framenavigation.js: " + msg);
}
