/********************** block error/s ************************/

/********************** break out of frames ******************/

if (window!= top)
{
 top.location.href=location.href
}

/******************** preload image/s ***********************/

function preloadImages()
{
 theImages = new Array();

 for (i = 0; i < preloadImages.arguments.length; i++)
 {
  if (document.images) 
  {
   theImages[i] = new Image();
   theImages[i].src = preloadImages.arguments[i];
  }
 }
}

/********************** image rollover/s **************************/

var imgOn = new Image(105, 12);
imgOn.src = 'underline_on.gif';

function rollOn(imgName)
{
 if (document.images)
 {
  document[imgName].src = '/images/underline_on.gif';
 }
}

function rollOff(imgName)
{
 if (document.images)
 {
  document[imgName].src = '/images/underline_off.gif';
 }
}

/************************* thumbnail change ************************/

function imgChange(picimage) 
{
 identifier = picimage;

 document['picViewer'].src = "thumbnails/" + picimage + "_thumb.gif";
 
 return picimage;
}

/************************* send to new page ************************/

function sendTo(label)
{
 if (has_support)
 {
  var new_url = "pdfs/" + label + ".pdf";
  location = new_url;
  return false;
 }
 else
 {
  var new_url = "gifs/" + label + ".gif";
  location = new_url;
  return false;
 }
}

/************************* Acrobat detection ***********************/

var has_support = false;
var use_vb = false;

preloadImages("cost_thumb.gif", "immigration_thumb.gif", "toiletbowl_thumb.gif", "power_thumb.gif", "beware_thumb.gif", "wigger_thumb.gif");

function acrobatDetect()
{
 if (navigator.mimeTypes && navigator.mimeTypes.length)
 {
  x = navigator.mimeTypes["application/pdf"];
  if (x && x.enabledPlugin)
  {
   has_support = true;
  }
 }
 else if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1))
 {
  use_vb = true;
  ieDetect()  
 }
} 

/*************************** popup window ********************/

// global variables
var IE3 = false;
var NS2 = false;
var popwin = null;

//opens up a centered popup that contains the image

function showPopup(imgSrc, imgWidth, imgHeight)
{
 // initialize function variables
 var leftPos = 0;
 var topPos = 0;
 var no_focus = false;

 if (window.screen) // test and set window postion
 {
  leftPos = Math.floor((screen.availWidth - imgWidth) / 2 );
  topPos = Math.floor((screen.availHeight - imgHeight) / 2 );
 }
 else
 {
  leftPos = 0;
  topPos = 0;
 }

 var settings = 'width=' + imgWidth + ',height=' + imgHeight + ',top=' + topPos + ',left=';
 settings += + leftPos + ',screenX=' + leftPos + ',screenY=' + topPos + ',scrollbars=yes';

 popwin = window.open(imgSrc,"imgWin",settings);

 popwin.title = "Image Viewer";

 // determine if browser is too old
 if ((navigator.appName == "Netscape") && navigator.appVersion == 2)
 {
  NS2 = true;
  alert("NS2");
 }

 else if ((navigator.appName == "Microsoft Internet Explorer") && (navigator.appVersion == 3))
 {
  IE3 = true;
  alert("IE3");
 } 

 // tests if window can focus()
 if (IE3 == false && NS2 == false)
 {
  popwin.focus();
 }

 // displays the image in the popup window
 popwin.document.open();
 popwin.document.write('<body><img src="' + imgSrc + '"></body>');
 popwin.document.close();
}

// close popup on page unload

function closePop()
{
 // tests if window can close()
 if (IE3 == false && NS2 == false)
 {
  if (popwin && !popwin.closed)
  {
   popwin.close();
  }
 }
}

/********************************** cross-browser marquee *******************************/

var first; 
var msgWidth = 1100; 
var bannerWidth = 600; 
var message = '<nobr><font id="scroller">\"We must secure the existence of our people and a future for White children.\" \-The 14 Words<\/font><\/nobr>';

//Netscape 4.x specific variables
var marqueewidth = 600;
var marqueeheight = 25;
var speed = 6;

function scroll()
{
 first = true;
 leftSide = msgWidth;

 if (document.getElementById)
 {
  document.write('<div id="canvas"><div id="canvasText">' + message + '</div></div>');
  scrollem(bannerWidth, 4, 88);
 }
 /*else if (document.all)
 {
  document.write('<marquee height="26" width="562" scrollamount="3" scrolldelay="90" bgcolor="gray style="font-size: small">' + message + '</marquee>');
 }
 else if (document.layers)
 {
  document.write('<ilayer width="&{marqueewidth};" height="&{marqueeheight};"name="cmarquee01"><center><layer name="cmarquee02"></layer></center></ilayer>');
  scrollem(bannerWidth, 4, 88);
 }*/ 
}

function scrollem(Left, dx, speed)
{
 if (document.getElementById)
 {
  var rightSide;
  var text = document.getElementById('canvasText');
  Left -= dx;

  if (Left < 0)
   {
    rightSide = -Left;
    leftSide = (leftSide > 0 ? leftSide - dx : 0);
    text.style.clip = 'rect(0px, '+ leftSide + 'px, 0px, ' + rightSide + 'px)';   
    text.style.left = Left + "px";    

    if (Left < -msgWidth)       
    {       
     Left = bannerWidth;     
     leftSide = msgWidth;      
    }	  
   } 
   else
   {    
    if (first)
    {
     text.style.visibility = 'hidden';
    }   
    leftSide -= dx;    
    text.style.clip = 'rect(0px, ' + leftSide + 'px, 0px, 0px)';   
    text.style.left = Left + "px";   
    if (first) 
    {     
     text.style.top = -0.5 + "px";  // this statement not needed in M12    
     text.style.visibility = 'visible';   
     first = false;      
    }    
   }  
  timerID = setTimeout("scrollem(" + Left + ", " + dx + ", " + speed + ")", speed);
  }
 else if (document.layers)
 {
  regenerate2()
  }
} 

//Netscape 4.x specific functions

/*function regenerate()
{
 window.location.reload()
}

function regenerate2()
{
 setTimeout("window.onresize = regenerate", 450);
 intializemarquee();
}

function intializemarquee()
{
 document.cmarquee01.document.cmarquee02.document.write('<nobr>' + message + '</nobr>');
 document.cmarquee01.document.cmarquee02.document.close();
 thelength = document.cmarquee01.document.cmarquee02.document.widthscrollit();
}

function scrollit()
{
 if (document.cmarquee01.document.cmarquee02.left>=thelength * (-1))
 {
 document.cmarquee01.document.cmarquee02.left -= speed;
 setTimeout("scrollit()", 100);
 }
 else
 {
  document.cmarquee01.document.cmarquee02.left = marqueewidthscrollit();
 }  
}*/
