var scroll = (window.scrollTo) ? 1 : 0; 
//START : Logic to clear cache when user shuts down the browser w/o logging off
function getNewHttpObject() {
	var objType = false;
	try {
		objType = new ActiveXObject('Msxml2.XMLHTTP');
	} catch(e) {
		try {
			objType = new ActiveXObject('Microsoft.XMLHTTP');
		} catch(e) {
			objType = new XMLHttpRequest();
		}
	}
	return objType;
}
//END : Logic to clear cache

function saveScroll(ASPPageName) 
{ 

if(window.screenLeft < 10004) 
{ 
//alert("Refresh Coordinate: "+window.screenLeft+","+window.screenTop); 
} 
else 
{ 
//alert("Closing Coordinate: "+window.screenLeft+","+window.screenTop); 

} 
//alert("This is unload function ");

//    alert('This is saveScroll'+ window.event.clientY +' '+window.event.clientX);
try 
{ 
if (!scroll) return; 
var x = document.body.scrollLeft; 
var y = document.body.scrollTop; 
var DocumentTitle = ASPPageName; 
var cookieDate = new Date(); 
cookieDate.setTime(cookieDate.getTime() + 3*1000); //3 seconds 
var Expires = ";expires=" + cookieDate.toString(); 
document.cookie="xy=" + x + "_" + y + "_" + DocumentTitle; //+ Expires; 
} 
catch(e) 
{ 

} 
} 

function loadScroll(ASPPageName) 
{ 
try 
{ 
if (!scroll) return; 
var xy = ReadACookie("xy"); 
if (!xy) return; 
var ar = xy.split("_"); 
if (ar.length == 3) 
{ 
if (ar[2] == ASPPageName) 
{ 
window.scrollTo(parseInt(ar[0]), parseInt(ar[1])); 
} 
} 
} 
catch(e) 
{ 

} 
} 

function ReadACookie(TheName) 
{ 
try 
{ 
var cookieData = new String(document.cookie); 
var cookieHeader = TheName + "="; 
var cookieStart = cookieData.indexOf(cookieHeader) + cookieHeader.length; 
var cookieEnd = cookieData.indexOf(";",cookieStart); 
if(cookieEnd == -1) 
{ 
cookieEnd = cookieData.length 
} 
if(cookieData.indexOf(cookieHeader) != -1) 
{ 
return cookieData.substring(cookieStart,cookieEnd); 
} 
else 
{ 
//no cookie 
return "" 
} 
} 

catch(e) 
{ 
return "" 
} 
} 

