var tb,fst,mtb,tx,rx,my,sy,mtp,ts,lm,wn,np,ctr,frm;
var mtl=new Array(2);
var mtr=new Array(2);
var mty=new Array(2);
var mtw=new Array(2);
var nav = 0;
if(navigator.userAgent.indexOf('Opera')>-1||navigator.userAgent.indexOf('MSIE')==-1)
nav = 1;
var shp=0;
var ttl=0;
var lb=0;
var slk=0;

function wnd(){
fst=document.getElementById('fst');
mtb=fst.getElementsByTagName('table');
tb=document.getElementById('tb');
ctr=document.getElementById('ctr');
frm=document.getElementById('frm');
ts=document.getElementById('ts');
np=document.getElementById('np');
res();
}

function upcard(){
var cc=getCookies();
var spl=cc.split('|');
lm=spl.length;
var sp=new Array();
var nm=0;
for(var i=0;i<lm;i++){
var vl=ts.tBodies[0].rows[i].cells[4].getElementsByTagName('input')[0].value;
if(parseInt(vl)>0&&!isNaN(vl)){
var pl=spl[i].split('&');
pl[3]=vl;
sp[nm]=pl.join('&');
nm++;
 }
}
if(nm>0){
var qw=sp.join('|');
addCard('sp',qw);
}
else{
delCookie('sp');
}
self.location.reload(true);
}

function rate(){
if(ctr.selectedIndex==0){
var rt=np.value;
if(rt.length<5||rt.length>5){
alert('Please enter 5 digit zip code');
np.focus();
return;
}
if(isNaN(rt)){
alert('Please enter correct zip code');
np.focus();
return;
}
frm.action='rate.php';
}else
frm.action='inter.php';
frm.submit();
}

function ccel(){
if(ctr.selectedIndex==0){
slk=0;
np.disabled=false;
//frm.action='rate.php';
}
else{
slk=1;
np.disabled=true;
//frm.action='inter.php';
 }
}

function EmptyCart(){
delCookie('sp');
self.location.reload(true);
}

/*****************************************************/

function sover(i){
if(document.attachEvent)
document.attachEvent('onmousemove',msmv);
else
document.addEventListener('mousemove',msmv,false);
quit();
mtb[i].style.visibility='visible';
}

function smv(i,e){
tx=mtl[i];
rx=mtr[i];
my=mty[i];
window.status=tx+'+'+rx+'+'+my+'+'+sy+'+'+e.pageX+'+'+e.pageY;
}

function quit(){
for(var i=0;i<2;i++)
mtb[i].style.visibility='hidden';
}

function res(){
sy=tb.offsetTop;
mtp=sy+tb.offsetHeight-2;
for(var i=0;i<2;i++){
var j=i+1;
mtl[i]=tb.offsetLeft+tb.rows[0].cells[j].offsetLeft;
mtb[i].style.top=mtp+'px';
mty[i]=mtp+mtb[i].offsetHeight;
mtb[i].style.left=mtl[i]+'px';
if(mtb[i].offsetWidth<tb.rows[0].cells[j].offsetWidth)
mtb[i].style.width=tb.rows[0].cells[j].offsetWidth+1+'px';
mtr[i]=mtl[i]+mtb[i].offsetWidth;
 }
}

function free(){
window.open('http://www.sajerobinson.com/free.html',null,'height='+document.body.clientWidth/2+',width='+document.body.clientWidth/2+',top=0,left=0,status=no,toolbar=no,menubar=no,location=no');
}

function msmv(e){
if(nav==1){
if(e.pageX<=tx||e.pageY>=my||e.pageY<=sy||e.pageX>=rx)
quit();
}
else{
if(window.event.x<=tx||window.event.y>=my||window.event.y<=sy||window.event.x>=rx)
quit();
 }
}

function lnkcard(){
self.location.href='http://www.sajerobinson.com';
}
