// set up a link to click if needed
// var R1="http://www.stillwatermall.com/frameindex.cfm?goto="+escape(""+location.href,1);
// var R1="http://TEST.stillwatermall.com/";
// var R1="/index2.html?"+escape(""+location.href,1);
 var R1="/index2.html?"+location.href;

//if ( thispage )
//   {R1="/index.html"; };

 var FrameIt='<a href="'+R1+'" target="_top">See The Complete Site In Frames</a>';
 var STWMt=0;


function frameme(){
  clearTimeout(STWMt);
  top.location = R1;
}

//var isLocal=1;  // don't display Banner if local html  view
var isLocal=0;  // always  display Banner


var x = self.location.href.toLowerCase();

 

if ((x.indexOf("file://") != 0) && (x.indexOf("http://wc-home/") != 0) )
{

 isLocal=0;  // always  display Banner
 var r="" ;// + document.referrer;
 if (r!="") // A referrer.... but is it from us?
 {
   i = r.toLowerCase().indexOf(".stillwatermall.com/");
   test=0;
   if ((i>8) && (i<13)) {test=1};
   r=r.toLowerCase();
   i=r.indexOf("//stillwatermall.com/");
   if ((i>4) && (i<7)) {test=2};
   if (test==0)  // if not referred from us... go frame this page.
    { // document.write(FrameIt);  // Link #0,
      // document.write("<B>intended viewing in frames, please wait about 5 Seconds<B>");
      // STWMt=setTimeout("frameme()",5000); // set up a delay timer
    }
  }
 else  // no Referrer, then is it the top?
  { if (top.location==self.location) // If yes, then FrameIt
    { document.write(FrameIt);  
      // document.write("<B>This page is intended to be viewed in Frames, please wait for about 5 Seconds<B>");
      //  top.location = R1;
       STWMt=setTimeout("frameme()",2000); // set up a delay timer
    }
   else
    { // Not TOP, No Referrer... what to do... Could be correct
      //  maybe not .. test for another time
    }
  }
} // End of Local Drive test


//--- Don't write Floater banner if the page is going to refresh ------------------
isLocal=1;  // dont show banner  
if (STWMt||isLocal) ;
 else {
// Floater Banner code START
///////////////////////////////////////////////////////////////////
/*Site Logo Script (Geocities Watermark)
© Dynamic Drive (www.dynamicdrive.com)
For full source code, installation instructions,
100's more DHTML scripts, and TOS, visit http://www.dynamicdrive.com/ 

Adjust for Complete Floating AD, WebCatering LLC */
///////////////////////////////////////////////////////////////////

//edit the below 6 steps

// 1) substitute 116 and 42 with the width and height of your logo image, respectively
var logowidth=468
var logoheight=60

var staticlogo=new Image(logowidth,logoheight)

// 2) change the image path to reflect the path of your logo image
staticlogo.src="bannerimg.gif"

// 3) Change url below to the target URL of the logo
var logolink="http://dynamicdrive.com"

// 4) change the alttext variable to reflect the text used for the "alt" attribute of the image tag
var alttext="Dynamic Drive"

// 5) set below to either "1" or "0" ("1" fades the logo into view) Note: IE 4 specific
var fadeintoview=0

// 6) Finally, below variable determines the duration the logo should be visible after loading, in seconds. If you'd like the logo to appear for 20 seconds, for example, enter 20. Entering a value of 0 causes the logo to be perpectually visible. 
var visibleduration=0;

var OutString="";

var randban=new Array();

randban[0]="";//'<LAYER NAME="textLayer" src="http://www.stillwatermall.com/ads/framead.asp" LEFT=1 TOP=0 WIDTH=468 HEIGHT=60 CLIP="0,0,470,63"></LAYER><DIV ID="textDiv"><IFRAME SRC="http://www.stillwatermall.com/ads/framead.asp" NAME="textFrame" SCROLLING="No" WIDTH="470" HEIGHT="63" MARGINWIDTH=1 MARGINHEIGHT=1 FRAMEBORDER="No"></IFRAME></DIV>';


var Ran_num=0;
var Ran_FRM=0;
if (Math.random && Math.floor)
  { Ran_num=Math.floor(Math.random()*randban.length);
    Ran_FRM=Math.floor(Math.random()*randban.length*100000)+100000; }
  
//  TEST output Values... document.write("<br>"+Ran_FRM+"<br>"+randban.length+" Ad "+Ran_num+" Ad <br><br><br><br><br><br><br><br><br>");


OutString=randban[Ran_num]

///////////////////////////Do not edit below this line/////////////////////////
 
var ns4=document.layers
var ie4=document.all
var ns6=document.getElementById&&!document.all

var fadeset=''
if (fadeintoview)
fadeset="filter:alpha(opacity=0)"

if (ie4)
document.write('<span id="logo'+Ran_FRM+'" style="'+fadeset+';position:absolute;top:100;width:248;height:60">'+OutString+'</span>')

if (ns6)
document.write('<span id="logons6'+Ran_FRM+'" style="'+fadeset+';position:absolute;top:100;left:0;width:248;height:60">'+OutString+'</span>');

function regenerate(){
window.location.reload()
}
function regenerate2(){
if (ns4)
setTimeout("window.onresize=regenerate",400)
}


function bringintoview(){
if (logo.filters.alpha.opacity<=95)
logo.filters.alpha.opacity+=5
else{
clearInterval(viewit)
if (visibleduration!=0)
setTimeout("logo.style.visibility='hidden'",visibleduration*1000)
}
}

function createlogo(){
staticimage=new Layer(100)
staticimage.left=0
staticimage.top=0
staticimage.document.write(""+OutString+"");
staticimage.document.close()
staticimage.visibility="show"
regenerate2()
staticitns()
}

if (ns4)
window.onload=createlogo;
else if (ie4)
crosslogo=document.all['logo'+Ran_FRM]
else if (ns6)
crosslogo=document.getElementById("logons6"+Ran_FRM)

if (ie4||ns6){
w=2
h=ns6? window.innerHeight-logoheight-5 : document.body.clientHeight-logoheight-5
crosslogo.style.left=w
crosslogo.style.top=h
}

function logoit(){
var w2=ns6? pageXOffset+w : document.body.scrollLeft+w
var h2=ns6? pageYOffset+h : document.body.scrollTop+h
crosslogo.style.left=w2
crosslogo.style.top=h2
}
function logoit2(){
staticimage.left=pageXOffset+2
//staticimage.top=pageYOffset+window.innerHeight-staticimage.document.height-5
staticimage.top=pageYOffset+window.innerHeight-60-5
}

function insertimage(){
//crosslogo.innerHTML=OutString;
if (ie4){
if (fadeintoview)
viewit=setInterval("bringintoview()",100)
else{
if (visibleduration!=0)
setTimeout("crosslogo.style.visibility='hidden'",visibleduration*1000)
}
}
}

if (ie4){
window.onscroll=logoit
window.onresize=new Function("window.location.reload()")
window.onload=insertimage
}
else if (ns6){
startstatic=setInterval("logoit()",100)
window.onload=insertimage
window.onresize=new Function("window.location.reload()")
if (visibleduration!=0)
setTimeout("crosslogo.style.visibility='hidden';clearInterval(startstatic)",visibleduration*1000)
}


function staticitns(){
startstatic=setInterval("logoit2()",90)
if (visibleduration!=0)
setTimeout("staticimage.visibility='hide';clearInterval(startstatic)",visibleduration*1000)
}
} // end if STWMt or local
