//************************************************************
//   GNU General Public License.  See the README.TXT
//          file for more details.
//    -------------------------------------------
//************************************************************


//Global Constants
CWIDTH=75
CHEIGHT=158
FANH=15
FANV=20
PACKED='P'
VERTFAN='V'
HORIZFAN='H'
FLOATIMGS=30;

//Pile Rules Constants
NONE='N'
ANY='Y'
FIXED='X'
BOTH='B'
UP='U'
DOWN='D'
SUIT='S'
RANK='R'
COLOR='C'
ALTCOLOR='A'

//Constant Arrays
SUITS=new Array("H");
RANKS=new Array("A","K","L");

//Global Variables

var Comments=new Array("<B>The Magician means effort</B><BR></BR><BR>Your answer will be positive but you must put effort into it.</BR> ","<B>The Hanged Man</B><BR></BR><BR>The answer is Negative. Time and patience will be necessary to fulfill your goals. </BR>","<B>The Strength</B><BR></BR><BR>Your answer is positive. You will be lucky and succeed. </BR>")

CurrPile=1;
Dragging=false;
InitLeft=0;
InitTop=0;
InitElleft=0;
InitElTop=0;
SourceI=0;
SourceCard=0;
TargetCard=0;
cards2drag=0;
BaseCard='';
NumDeals=0;
CurrDeal=0;
CompletionURL='';
UndoOK=false;
UndoSrc=0;
UndoTgt=0;
InUndo=false;
SaveNumDeals=0;
results=''
var l = '' 
issame=''
c1=''
c2=''
c3=''




//Global Arrays
aPiles=new Array();
aPileNames=new Array();
aBehaviours=new Array();
aBuild=new Array();
aGroup=new Array();
aDrag=new Array();
aAutoTgt=new Array();
aMaxLength=new Array();
aUndoSrc=new Array();
aUndoTgt=new Array();

//Global Event Handlers
document.onmousedown=DragStart;
document.onmouseup=DragEnd;
document.onmousemove=DoDrag;
document.onclick=DoClick;
document.ondblclick=AutoTarget;
document.onkeydown=DoCommand;
document.onhelp=DefHelp;

function DefHelp(){
event.returnValue=false;
showHelp('solhelp.htm');
}


function DoCommand(){
CommandKey=event.keyCode;
switch(CommandKey){
	case 85:DoUndo();break;// U for Undo
	case 77:
 	   if(confirm('Change game mode to '+(NumDeals==-1?'TOURNAMENT?':'PRACTICE?')))	
           {NumDeals==-1?NumDeals=SaveNumDeals:NumDeals=-1;break;}
            //M to switch between practice and tourney modes
	}
}

function SaveUndo(thesrc,thetgt,inDrag){
setTimeout("InUndo=false",50);
UndoSrc=thesrc;UndoTgt=thetgt;
aUndoSrc.length=0;aUndoTgt.length=0;
for(q=0;q<aPiles[thesrc].length;q++)
   aUndoSrc[q]=aPiles[thesrc][q];
if(inDrag){
   	for(q=0;q<aDrag.length;q++)
		aUndoSrc[aUndoSrc.length]=aDrag[q];
	}
for(q=0;q<aPiles[thetgt].length;q++)
   aUndoTgt[q]=aPiles[thetgt][q];
UndoOK=true;
}

function DoUndo(){
if(!UndoOK) return;
aPiles[UndoSrc].length=0;aPiles[UndoTgt].length=0;
for(i=0;i<aUndoSrc.length;i++)
   aPiles[UndoSrc][i]=aUndoSrc[i];
for(i=0;i<aUndoTgt.length;i++)
  aPiles[UndoTgt][i]=aUndoTgt[i];
PaintCards(UndoSrc);PaintCards(UndoTgt);
UndoOK=false;
}


function Check4Completion(){
//Default completion handler - Game over when all foundations have reached their Maxlength
GameComplete=true;
for(i=0;i<aPileNames.length;i++){
	if(aPileNames[i].substr(0,1)=='F'){ //Foundation
            if(!(aPiles[i].length==aMaxLength[i])) GameComplete=false;
		}
	}
if(c1 !='' ){ DoEffect();}
if(GameComplete){location.href=CompletionURL;}

}





//Turn card up if down
function AutoFlip(fpile){
FlipCard=(aPiles[SourceI].length>0)?aPiles[fpile][aPiles[fpile].length-1]:"";
if(FlipCard.length==2)      /// changed to 3 from 2  hms
	aPiles[fpile][aPiles[fpile].length-1]=FlipCard+"U";
   
}

function AutoTarget(){
el=event.srcElement;
if(!(el.tagName=='IMG')){return}
clickdiv=el.parentElement.id.substr(1);
if(clickdiv==0) return; //Deck does not support AutoTargeting
if(!(aAutoTgt[clickdiv].charAt(0)=='Y')) return;//not an Autotgt source

AutoCard=aPiles[SourceI][SourceCard];
if(AutoCard.length<3) return; //Face Down Card // changed to 4 from 3 hms

//Cycle through AutoTgt targets to see which can accomodate the AutoCard
for(i=1;i<aAutoTgt.length;i++){
	if(aAutoTgt[i].charAt(1)=='Y'){ //Valid AutoTgt target
		if(i==SourceI) continue; //Target should not be same as source
		TargetI=i;
		//TargetCard=aPiles[TargetI][aPiles[TargetI].length-1]
		if(IsValidTarget()){//Move Autocard to target
			SaveUndo(SourceI,TargetI,false);
			aPiles[i][aPiles[i].length]=aPiles[SourceI][aPiles[SourceI].length-1];
			aPiles[SourceI].length--;
			FlipCard=(aPiles[SourceI].length>0)?aPiles[SourceI][aPiles[SourceI].length-1]:"";
			if(FlipCard.length==2)
  				aPiles[SourceI][aPiles[SourceI].length-1]=FlipCard+"U";
			PaintCards(i);PaintCards(SourceI);
			Check4Completion();
			break;
			}
		
		}
	}


}

function DoClick(){
el=event.srcElement;
if(!(el.tagName=='IMG')){return}
clickdiv=el.parentElement.id.substr(1);

if(event.shiftKey){ //Cheat key support
  // alert(aPiles[clickdiv].join("\n"))
   }
else{
   if((clickdiv==0)&&(aPiles[0].length>0)&&(aPiles[0][0].substr(2,1)=='')){//clicked on Face-down Deck
      if(!(aAutoTgt[0]=='')){ //If deck has AutoDealing
		for(i=0;i<aPileNames.length;i++){
                  	if(aPileNames[i]==aAutoTgt[0]){ //found target
				//Undo Support
				SaveUndo(0,i,false);
                        	//Transfer card, turning face up
                        	for(j=1;(j<=aMaxLength[0])&&(aPiles[0].length>0);j++){
					aPiles[i][aPiles[i].length]=aPiles[0][aPiles[0].length-1]+'U';
         				aPiles[0].length--;
                        		PaintCards(0);PaintCards(i);
					}
				}
			}
               }
       }
    else{
    //Redeal support-only for single waste pile
    if((clickdiv==0)&&(aPiles[0].length==0)&&!(NumDeals==CurrDeal)){
      CurrDeal++;
      //First find the waste pile
      wp=-1;
      for(i=0;i<aPileNames.length;i++)
          {if(aPileNames[i]==aAutoTgt[0]){wp=i}}
      if(wp>0){
		SaveUndo(wp,0,false);
		//Transfer cards from Waste to Deck
		for(i=0;i<aPiles[wp].length;i++){
                  aPiles[0][i]=aPiles[wp][aPiles[wp].length-i-1].substr(0,2);
 			}
            aPiles[wp].length=0;
            PaintCards(0);PaintCards(wp);
		}
	}
	}
    
   
    }


}

function IsValidSource(){
retval=true;
tmpRank=aGroup[SourceI].substr(0,1);
tmpSuit=aGroup[SourceI].substr(1,1);
//Check if group movement allowed 
if((tmpRank==NONE)||(tmpSuit==NONE)){
   if(aPiles[SourceI].length==SourceCard+1)//Single card movement
    	{return true}
   else
	{return false} 
   }
if((tmpRank=='')||(tmpSuit=='')){return false}

//CurrCard=aPiles[SourceI][SourceCard].substr(0,2);
for(i=SourceCard+1;i<aPiles[SourceI].length;i++){
	ar=GetAllowableRanks(aPiles[SourceI][i-1].substr(0,1),tmpRank);
      if(ar.lastIndexOf(aPiles[SourceI][i].substr(0,1))<0){return false};
      as=GetAllowableSuits(aPiles[SourceI][i-1].substr(1,1),tmpSuit);
      if(as.lastIndexOf(aPiles[SourceI][i].substr(1,1))<0){return false};
	
	}

return retval;
}

function GetAllowableRanks(tgtrank,piledir,pilelast){
retstr='';
tmpRankStr=RANKS.join('');
if(piledir==ANY){return tmpRankStr}
if(tgtrank==pilelast){return ''}
tmpTgtPos=tmpRankStr.lastIndexOf(tgtrank);
if((piledir==UP)||(piledir==BOTH)){
	retstr+=(tmpTgtPos==tmpRankStr.length-1)?tmpRankStr.charAt(0):tmpRankStr.charAt(tmpTgtPos+1);
    	}
if((piledir==DOWN)||(piledir==BOTH)){
	retstr+=(tmpTgtPos==0)?tmpRankStr.charAt(tmpRankStr.length-1):tmpRankStr.charAt(tmpTgtPos-1);
    	}
return retstr;
}

function GetAllowableSuits(tgtsuit,pilemode){
retstr='';
if(pilemode==SUIT){return tgtsuit}
if(pilemode==ANY){return 'HDCS'}
if(pilemode==COLOR){
   if((tgtsuit=='H')||(tgtsuit=='D')){return 'HD'}
   else{return 'CS'}
   }
if(pilemode==ALTCOLOR){
   if((tgtsuit=='H')||(tgtsuit=='D')){return 'CS'}
   else{return 'HD'}
   }
return '';
}

function IsValidTarget(){
if(TargetI<=0){return false}
tmpBase=aBuild[TargetI].substr(0,1);
tmpDir=aBuild[TargetI].substr(1,1);
tmpMode=aBuild[TargetI].substr(2,1);
tmpLast=aBuild[TargetI].substr(3,1);
srcSuit=aDrag[0].substr(1,1);
srcRank=aDrag[0].substr(0,1);

ValTgt=true;
//If Target Pile is packed, Targetcard will not hold right value
if(aBehaviours[TargetI].substr(0,1)==PACKED)
   {TargetCard=aPiles[TargetI].length-1}

//Check for violations of MaxLength and Grouping Rules
if(aMaxLength[TargetI]>0){
	if(aPiles[TargetI].length+aDrag.length>aMaxLength[TargetI])
		 {return false;}
	}
if(cards2drag>1){
      grpRank=aGroup[TargetI].substr(0,1);
      grpSuit=aGroup[TargetI].substr(1,1);
	if((grpRank=='')||(grpSuit=='')||(grpRank==NONE)||(grpSuit==NONE))
           {return false}
	}

//Check if Target Pile is empty-apply empty rule
if(aPiles[TargetI].length==0){
   //if  Empty, Piles are not allowed to be filled...
   if(tmpBase==NONE){return false}
   if(tmpBase==ANY){return true}
   if(tmpBase==FIXED){
      if(BaseCard==''){BaseCard=srcRank;return true;}
      else{return srcRank==BaseCard?true:false} 
	}
   //Not NONE, ANY or FIXED
   if(!(srcRank==tmpBase)){return false}
   }
else {//Target Pile not empty - apply build rule
     //Dont allow build on face down cards
    if(aPiles[TargetI][TargetCard].substr(2,1)==''){return false}

    tgtSuit=aPiles[TargetI][TargetCard].substr(1,1);
    tgtRank=aPiles[TargetI][TargetCard].substr(0,1);

   
   ar=GetAllowableRanks(tgtRank,tmpDir,tmpLast);
   if(ar.lastIndexOf(srcRank)<0){return false};
   as=GetAllowableSuits(tgtSuit,tmpMode);
   if(as.lastIndexOf(srcSuit)<0){return false};

   }
return ValTgt;
}

function DragStart(){
if((event.button==2)&&(NumDeals==-1)){
	clickdiv=event.srcElement.parentElement.id.substr(1);
	if (aPiles[clickdiv])
	   //   alert(aPiles[clickdiv].join("\n"));
	return;
	}
   
el=event.srcElement;
//Ignore event if el is not an image
//Note-don't use any images in doc apart from card imgs
if(!(el.tagName=='IMG')){return}

//Get SourceI - index of card to move
pel=el.parentElement;
SourceI=parseInt(pel.id.substr(1));
if(aBehaviours[SourceI].substr(0,1)=='V')
   {SourceCard=el.offsetTop/FANV;}
if(aBehaviours[SourceI].substr(0,1)=='H')
   {SourceCard=el.offsetLeft/FANH;}
if(aBehaviours[SourceI].substr(0,1)=='P')
   {SourceCard=aPiles[parseInt(pel.id.substr(1))].length-1;}

cards2drag=1;

if(el.draggable){
    if(!IsValidSource()){return;}

    InitLeft=event.clientX;
    InitTop=event.clientY;
    Dragging=true;
    //Align the floating DIV
    floater.style.pixelTop=el.style.pixelTop+el.parentElement.style.pixelTop;
    InitEltop=floater.style.pixelTop;
    floater.style.pixelLeft=el.style.pixelLeft+el.parentElement.style.pixelLeft;
    InitElleft=floater.style.pixelLeft;
    //Get Source elements image
    floater.children[0].src=el.src;
    floater.children[0].style.visibility='visible';
    el.style.visibility='hidden';
    //Get how may cards to move
    chels=el.parentElement.children;
    for(i=1;i<chels.length;i++){
      if((i>SourceCard)&&(!(chels[i].style.visibility=='hidden'))){
	    floater.children[cards2drag].src=chels[i].src;
	    floater.children[cards2drag].style.visibility='visible';
		//chels visibility
          chels[i].style.visibility='hidden';    
	    cards2drag++;
          }
      }
    //Finally move cards to temporary aDrag array
    for(i=0;i<cards2drag;i++)
	  aDrag[i]=aPiles[SourceI][SourceCard+i]
    aDrag.length=cards2drag;	     
    aPiles[SourceI].length-=cards2drag;    
    PaintCards(SourceI);        

    }
else //Not Draggable
  {cards2drag=0;}

}

function DragEnd(){
if(!Dragging){return;}
Dragging=false;
InitTop=0;
InitLeft=0;
InitEltop=0;
InitElleft=0;
for(i=0;i<floater.children.length;i++)
  {floater.children[i].style.visibility='hidden';}
if(cards2drag==0){return}
//Detect target
InsideArea=0;
TargetI=-1;

ftop=floater.style.pixelTop;
fleft=floater.style.pixelLeft;
for(i=0;i<zone.children.length;i++){
     LastVisCard=0;
     for(j=0;j<zone.children[i].children.length;j++)
       {if(!(zone.children[i].children[j].style.visibility=='hidden')){LastVisCard=j}}
    TopElem=zone.children[i].children[LastVisCard];
    tmpleft=zone.children[i].style.pixelLeft+TopElem.offsetLeft;
    tmptop=zone.children[i].style.pixelTop+TopElem.offsetTop;
    //Thanks to Stanley Rajasingh for this algorithm
    hOverlap=CWIDTH-Math.abs(fleft-tmpleft);
    vOverlap=CHEIGHT-Math.abs(ftop-tmptop); 
    if((hOverlap>0)&&(vOverlap>0)){
       tmpArea=hOverlap*vOverlap;
       if(tmpArea>InsideArea){InsideArea=tmpArea;TargetI=i;TargetCard=LastVisCard}
       } 

    }

// alert(SourceCard)

if(!IsValidTarget()){
    tmpTargetLength=aPiles[SourceI].length;
    for(i=0;i<cards2drag;i++){
      aPiles[SourceI].length++;
      aPiles[SourceI][tmpTargetLength]=aDrag[i];
      tmpTargetLength++;
	}
    
    PaintCards(SourceI);

   }
else{ //Valid move--Transfer cards
    InUndo=true;
    SaveUndo(SourceI,TargetI,true);
    tmpTargetLength=aPiles[TargetI].length;
    for(i=0;i<cards2drag;i++){
      aPiles[TargetI].length++;
      aPiles[TargetI][tmpTargetLength]=aDrag[i];
      tmpTargetLength++;
	}
    
    PaintCards(TargetI);
    AutoFlip(SourceI);
    PaintCards(SourceI);
    
    }

Check4Completion();
//alert(aPiles[SourceI].join(","))
//alert(aPiles[TargetI].join(","))

//*******************HMS Capture card values****************zxc
 
var y = aPiles[TargetI]
var x = TargetI
var z =aPiles[TargetI].join(",")
var t = z.substr(2)
var m = z.substr(0,1)


var value = ''

if(t=="U" && m != issame){;
l += m;
c1=l.substring(0,1);
c2=l.substring(1,2);
c3=l.substring(2,3)
results = l.indexOf(m);
//alert('l->'+l+' tarigetI->'+TargetI+' issame->' + issame+' results->'+results +'-c1-->'+c1+'-c2-->'+c2+'-c3-->'+c3);
issame = m;

//if(c3 == ''){}



}


}



//if(TargetI) == 3){results='Fucked Up';}
//alert('I say it is '+ results)


function DoDrag(){
if(Dragging){
  floater.style.pixelLeft=event.clientX+InitElleft-InitLeft;
  floater.style.pixelTop=event.clientY+InitEltop-InitTop;
  return false;
  }

}

//The most horrible example of spaghetti coding :-) 
function PaintCards(pileno){
ImgStr="";
TargetDiv=eval("document.all.P"+pileno);
pilelength=aPiles[pileno].length;
numimages=TargetDiv.children.length;
freeimages=0;
pilestruct=aBehaviours[pileno].substr(0,1);
//alert(pilelength)
//***********Paint proc for packed piles (1 image)
if(pilestruct=='P'){ 
    TargetDiv.children[0].style.visibility='visible';
    //************* Which card to paint
    //if pile is Empty paint suitable marker 
    if(pilelength==0) //No cards in pile
       {TargetDiv.children[0].src="cards\\"+aBehaviours[pileno].substr(1)+".gif";  ///hms1
        TargetDiv.children[0].draggable=false; }
    else { //Pile not empty - paint top card(Last card in Array)
         if(aPiles[pileno][pilelength-1].substr(2)=='U')//Card faces up
		{TargetDiv.children[0].src="cards\\"+aPiles[pileno][pilelength-1].substr(0,2)+".gif"
		 TargetDiv.children[0].draggable=true;
             }	
         else //Card faces down   //HMS
	      {TargetDiv.children[0].src="cards\\b.gif";
             TargetDiv.children[0].draggable=true;}

	   }
    }

//*************Paint proc for fanned piles(indeterminate images)
else{
    //**PART I**********Adjust length of pile********************
    //***First find no of free and used images
    for(i=0;i<numimages;i++){
	if(TargetDiv.children[i].style.visibility=='hidden'){freeimages++;}
	} 
    usedimages=TargetDiv.children.length-freeimages; 
    //alert(freeimages+","+usedimages+","+pilelength)
    //***If Pile Length has increased
    if(pilelength>usedimages){
	//***Use available images, if any
      for(i=usedimages;i<TargetDiv.children.length;i++)
	   {TargetDiv.children[i].style.visibility='';if(i==pilelength-1){break}}
      //***Create new images
      if(pilelength>TargetDiv.children.length){
          for(i=TargetDiv.children.length;i<pilelength;i++){
		if(pilestruct=='V'){ImgStr+="<IMG style='position:absolute;top:"+FANV*i+"' WIDTH='"+CWIDTH+"' HEIGHT='"+CHEIGHT+"' SRC='cards\\b.gif'>"}
            else{ImgStr+="<IMG style='position:absolute;left:"+FANH*i+"' WIDTH='"+CWIDTH+"' HEIGHT='"+CHEIGHT+"' SRC='cards\\b.gif'>"}

		}
          TargetDiv.innerHTML+=ImgStr;
          }
	}
    //***If Pile Length has decreased
    else{
	  //***Hide images
        
	  for(i=pilelength;i<usedimages;i++)
   		{TargetDiv.children[i].style.visibility='hidden';}
	  }
    //**PART II**********Draw Cards****************************
    //***Draw suitable marker if pile empty
    if(pilelength==0){
        TargetDiv.children[0].src="cards\\"+aBehaviours[pileno].substr(1)+".gif";TargetDiv.children[0].style.visibility='visible';
        TargetDiv.children[0].draggable=false;}
    //***Draw appropriate card 
    for(i=0;i<pilelength;i++){
	if(aPiles[pileno][i].substr(2)=='U'){ //***Face Up
	     TargetDiv.children[i].src="cards\\"+aPiles[pileno][i].substr(0,2)+".gif";
	     TargetDiv.children[i].draggable=true;
           }
	  else{ //***Face Down
	     TargetDiv.children[i].src="cards\\b.gif";
	     TargetDiv.children[i].draggable=false;
		}

        }		
    }
}


function BuildPile(ddown,dup){
aPiles[CurrPile]=new Array();
ddown=parseInt(ddown);
dup=parseInt(dup);
i=0;
//***Deal Cards
while(i<ddown){
  aPiles[CurrPile][i]=aPiles[0][aPiles[0].length-1];
  aPiles[0].length--;i++;  
  }

while(i<(ddown+dup)){
  aPiles[CurrPile][i]=aPiles[0][aPiles[0].length-1]+"U";
  aPiles[0].length--;i++;  
  }
CurrPile++;
}


function BuildStock(stocktype){
StockIndex=0;
StartRank=0;
aPiles[0]=new Array();
//Provision for German Deck
if((stocktype==3)||(stocktype==4)){
  StartRank=6;
  }

// HMS ///Numbor of cards to random 3
for(i=0;i<1;i++){
   for(j=StartRank;j<3;j++){
      aPiles[0][StockIndex]=RANKS[j]+SUITS[i];
	StockIndex++;
      if((stocktype%2)==0){
         aPiles[0][StockIndex]=RANKS[j]+SUITS[i];
	   StockIndex++;
	   }
      }
   }



//Shuffle
DeckLen=aPiles[0].length;
for(i=0;i<DeckLen;i++){
  j=(Math.random()*100)%(DeckLen-1);
  j=(Math.round(j));
  temp=aPiles[0][i];
  aPiles[0][i]=aPiles[0][j];
  aPiles[0][j]=temp;
  }

}


//Read Game Data File and Initialize Game Layout

function LoadGame(){ 

LayoutStr="";
while(!Rules.recordset.EOF){
    divID=Rules.recordset.absolutePosition-1; 
    divX=Rules.recordset.Fields("PosX").value;
    divY=Rules.recordset.Fields("PosY").value;
    dtype=Rules.recordset.Fields("Type").value;
    ddown=Rules.recordset.Fields("DealDn").value;
    dup=Rules.recordset.Fields("DealUp").value;
    dstruct=Rules.recordset.Fields("Structure").value;
    dgif=Rules.recordset.Fields("EmptyGIF").value;


    aBehaviours[divID]=dstruct+dgif;
    aBuild[divID]=Rules.recordset.Fields("Build").value;
    aGroup[divID]=Rules.recordset.Fields("Grp").value;
    aAutoTgt[divID]=Rules.recordset.Fields("AutoTgt").value;
    aMaxLength[divID]=Rules.recordset.Fields("MaxLength").value;
    aPileNames[divID]=dtype;
		
    if(dtype=="D"){ //***Deck
	//***Build the deck based on deck type in DealDn field
	//***Deck type 1=Std Single,2=Std Double, 3=German Sing, 4=German Dbl
      BuildStock(ddown);
      NumDeals=1;SaveNumDeals=dup;
      CompletionURL=Rules.recordset.Fields("Build").value;
      }
    else{ //***Foundation or Pile
      //***Load the cards into F or P using DealUp and DealDn info
      BuildPile(ddown,dup);
	}
    LayoutStr+="<DIV ID='P"+divID+"' style='position:absolute;left:"+divX+";top:"+divY+"'>"+
    "<IMG style='position:absolute;zorder:0' WIDTH='"+CWIDTH+"' HEIGHT='"+CHEIGHT+"' SRC='cards\\trans.gif'>"+"</DIV>";
     //Src needs to be set because of a bug in IE4 which prevents dynamically
	//setting the source if original source is not provided.
    Rules.recordset.MoveNext();	
    }


if(document.HasSpecialDeal){DoSpecialDeal()};
zone.innerHTML=LayoutStr;
numpiles=Rules.recordset.recordCount;
for(i=0;i<numpiles;i++)
 {setTimeout("PaintCards("+i+");",10);}
 //{PaintCards(i);}//bug-wont work
//****Populate the Floating Div
LayoutStr="";
for(i=0;i<FLOATIMGS;i++)
   {LayoutStr+="<IMG style='position:absolute;visibility:hidden;top:"+FANV*i+"' WIDTH='"+CWIDTH+"' HEIGHT='"+CHEIGHT+"' SRC='cards\\trans.gif'>"}
floater.innerHTML=LayoutStr;
}

function DoEffect(){
//a place for get card values from conn ///hms


//See what the user has chosen for Position 1;

//alert(c1)

if(c1=="A") Bubble.children[0].innerHTML=Comments[0];
if(c1=="K") Bubble.children[0].innerHTML=Comments[2];
if(c1=="L") Bubble.children[0].innerHTML=Comments[1];
Bubble.style.pixelLeft = 425 
Bubble.style.pixelTop=100;
if(Bubble.style.pixelTop<document.body.scrollTop) 
Bubble.style.pixelTop=document.body.scrollTop;
Bubble.style.visibility="visible";
TheTimer=setTimeout("Bubble.style.visibility='hidden'",10000);


}




