	function getCookie(name) {
	  var dc = document.cookie;
	  var prefix = name + "=";
	  var begin = dc.indexOf("; " + prefix);
	  if (begin == -1) {
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	  } else
		begin += 2;
	  var end = document.cookie.indexOf(";", begin);
	  if (end == -1)
		end = dc.length;
	  return unescape(dc.substring(begin + prefix.length, end));
	} 

	function setCookie(name, value) {
		var cookname = name;
		if(cookname == "no_of_items") {
			num_item = value;
			num_item = parseInt(num_item) + 1;
			var curCookie = name + "=" + escape(num_item);
		}
		grtot = getCookie('total_value');
		if (grtot == null) {
			grtot = 0;
		}
		if(cookname == "total_value") {
			tot_val = value;
			grtot = parseInt(grtot) + tot_val;
			var curCookie = name + "=" + escape(grtot);
		}
		document.cookie = curCookie;
	} 

	function deleteCookie(name) {
	   if (getCookie(name)) {
		 document.cookie = name + "=" +"; expires=Thu, 01-Jan-70 00:00:01 GMT";
	   }
	}

	function gotest()
	  {
	    version=parseFloat(navigator.appVersion);
            if(navigator.appName.indexOf("Netscape") != -1 && version <= 4.05)
		{
		AppWnd=window.open("/shopping/browserupgrade.htm","win1","toolbar=no,directories=no, resize=no,menubar=no,location=no,scrollbars=yes,width=500,height=350,maximize=null");
		}
	  }

  
	function popupmenu(choice,wt,ht)
	   {
	     var winOpts="toolbars=no,maximize=no,resize=no,width="+wt+",height="+ht+",location=no,scrollbars=yes, directories=no";
	     confirmWin=window.open(choice,'theconfirmWin',winOpts);
	   }

function tr_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 tr_getCookieVal (j); 
  i = document.cookie.indexOf(" ", i) + 1; 
  if (i == 0) 
   break; 
 } 
 return null;
}
 
function tr_getCookieVal(offset) 
{
 var endstr = document.cookie.indexOf (";", offset);
 if (endstr == -1)
  endstr = document.cookie.length;
 return unescape(document.cookie.substring(offset, endstr));
}
 
function tr_SetCookie (name, value, expires, path, domain) 
{ 
 document.cookie = name + "=" + escape (value) + 
 ((expires == null) ? "" : ("; expires=" + expires)) + 
 ((path == null) ? "" : ("; path=" + path)) + 
 ((domain == null) ? "" : ("; domain=" + domain));
}
 
function DoCookies()
{
 var RetSessionStr;
 var RetUserStr;
 var value;
 RetUserStr = tr_GetCookie('RuW');
 RetSessionStr = tr_GetCookie('RsW');
 if (RetUserStr == null)
 {
 curdate = new Date();
  curtime = curdate.getTime();
  value = (curtime*1000) + Math.round(Math.random()*1000);
  tr_SetCookie("RuW", value, "Mon, 31-Dec-2001 23:59:59 GMT", "/", ".rediff.com");
 }
 
 if (RetSessionStr == null)
 {
  curdate = new Date();
  curtime = curdate.getTime();
  value = (curtime*1000) + Math.round(Math.random()*1000);
  tr_SetCookie("RsW", value, "", "/", ".rediff.com");
 }
 return;
}
DoCookies();