Monday, October 11, 2004

JavaScript code block for Smart Navigation

function Unload()
{
var XPOS, YPOS;
<% if (bMovePlace){%>
XPOS = document.body.scrollLeft + event.x;
YPOS = document.body.scrollTop + event.y;
<% }%> <% else {%>
XPOS = <% = iscrXPos%>;
YPOS = <% = iscrYPos%>;
<% }%>
SetCookie("XPOS", XPOS) SetCookie("YPOS", YPOS) }

function Load()
{
var XPOS, YPOS;
<% if (bMovePlace == false){%>
XPOS = <% = iscrXPos%>;
YPOS = <% = iscrYPos%>;
SetCookie("XPOS", XPOS) SetCookie("YPOS", YPOS) <% }%>
XPOS = GetCookie("XPOS");
YPOS = GetCookie("YPOS");
if ((XPOS != null) && (YPOS != null))
window.scrollBy(XPOS, YPOS);

RTFEdit_Desc.document.body.innerHTML = window.document.forms(0).Hidden_Desc.value + "
" + window.document.forms(0).Hidden_Add_Desc.value;
}

function SetCookie(name, value)
{
document.cookie = name + "=" + escape(value)
}

function getCookieVal (offset)
{
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1) endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name)
{
var arg = name + "=";
var alen = arg.length; var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg) return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}

No comments: