function stvtlog(id, imgid, imgwidth, imgheight)
{ 
  scsize = screen.width + "x" + screen.height;
  document.write('<IMG SRC="ptlstintm_change?id='+id +
                 '&urlfrom='+escape(document.referrer)+ 
                 '&scsize='+scsize+ 
                 '&depthpx='+screen.pixelDepth+
                 '&depthclr='+screen.colorDepth+
                 '&imgid='+imgid+ 
                 '&imgwidth='+imgwidth+ 
                 '&imgheight='+imgheight+ '" width="+imgwidth+" height="+imgheight+">');
}

function autologin(sessid, sso, pwd, urllgn, urls2p, codesess, ipadr)     
{     
  document.write('<FORM NAME="loginForm" ACTION="'+urllgn+'" method="POST">');
  document.write('<INPUT NAME="sessid" TYPE="hidden" VALUE="'+sessid+'">');  
  document.write('<INPUT NAME="ipaddress" TYPE="hidden" VALUE="'+ipadr+'">');  
  document.write('<INPUT NAME="site2pstoretoken" TYPE="hidden" VALUE="">');
  document.write('<INPUT NAME="ssousername" TYPE="hidden" VALUE="'+sso+'">');
  document.write('<INPUT NAME="password" TYPE="hidden" VALUE="'+pwd+'">');
  document.write('</FORM>');
  document.write('<IFRAME NAME="s2pFrame" style="width:0px; height:0px; border:0px" src="'+urls2p+'"></IFRAME>');    
  timerB=1000; 
  timerC=100; 
  codesessclnt = codesess;
  usrname = sso;
  chws2pLoaded(); 
} 
		        
function chws2pLoaded() 
{ 
  timerB-=timerC; 
  if (timerB > 0) 
    setTimeout("chws2pLoaded()", timerC) 
  else 
  { 
    var hw = parent.frames.s2pFrame.window;
    var hd = hw.document;
    var s2p = hd.forms.freshTokenForm.site2pstoretoken.value;
    document.loginForm.site2pstoretoken.value = s2p;

    SetCookie("PSPCODE", codesessclnt, 1000);
    SetCookie("PSPUSRN", usrname, 1000);
    document.loginForm.submit();
  } 
}     
		  								      


function lgnSubmit(codesess)
{
  ss=0;
  for(i=0; i<parent.frames.length; i++)  
  {
    obj=parent.frames[i].document.getElementsByTagName("INPUT")[0];
    if(obj) 
    { 
      if (obj.name=='site2pstoretoken')
      { document.loginForm.site2pstoretoken.value = obj.value;
        SetCookie("PSPCODE", codesess, 1000);
        SetCookie("PSPUSRN", document.loginForm.ssousername.value, 1000);
        ss=1;
      }
    }
  }
 if (ss==1) return true; else return false;
}

