/***********************************************
* Image Thumbnail viewer- © Dynamic Drive (www.dynamicdrive.com)
* Last updated Sept 26th, 03'. This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var ie=document.all
var ns6=document.getElementById&&!document.all

function writeopt() {
document.write('\
<div style="display:none; position:absolute; left:50px; top:50px;" id="mygliderdiv"> \
<div style="background-color: #FFFFDD; width:425px; border:2px dashed red; padding: 0 1em 1em 1em;"> \
 <a style="float:right; font-size: 9px;" href="#" onclick="myGlide.hide();return false;">close</a> \
 <form method="post" action="http://www.aweber.com/scripts/addlead.pl"> \
 <input type="hidden" name="meta_web_form_id" value="1382567069"> \
 <input type="hidden" name="meta_split_id" value=""> \
 <input type="hidden" name="unit" value="spoiledpups"> \
 <input type="hidden" name="redirect" value="http://spoiled-pups.com/thankyou.html"> \
 <input type="hidden" name="meta_redirect_onlist" value="http://spoiled-pups.com/alreadysubscribed.html"> \
 <input type="hidden" name="meta_adtracking" value="glider_fiveoff"> \
 <input type="hidden" name="meta_message" value="1"> \
 <input type="hidden" name="meta_required" value="from"> \
 <input type="hidden" name="meta_forward_vars" value="1"> \
 <center><h1 style="color:red; margin-top:0;">Act Now And Get <u>Five Percent Off</u>!</h1></center> \
 <div style="float:left; margin-right:1em;"><img src="/images/5PercentOff.png" alt="Five Percent Off" width=100 height=85><br><img src="http://nelsonminica.com/photo.jpg" alt="Photo of Nelson Minica" width=100 height=133></div> \
 <p>This offer will <b>only be shown to you once</b>, so don\'t miss it!</p> \
 <p>Simply enter your name and email below and start reaping all the rewards of being a Spoiled Pups list member!</p> \
 <div style="margin-left: 150px">- Nelson Minica, owner</div><br> \
 <table><tr><td>Your Name:</td><td><input type="text" name="name" value="" size="30"></td></tr> \
 <tr><td>Your Email:</td><td><input type="text" name="from" value="" size="30"></td></tr></table> \
 <center><input type="submit" name="submit" value="Send Me The Coupon!"></center><br> \
 <p align="center"><font size=1>I hate spam and promise to <b>never</b> share your information with anyone!</font></p> \
 </form></div> \
</div>');
}

 function launcher() {
  if(!getCookie('aweber_subscribed')) {
   if(!getCookie('popup3shown')) {
    var mydate = new Date();
    mydate.setTime(mydate.getTime() + 315360000000);  //milliseconds: 315360000000 = forever, 432000000= 5 days
    setCookie('popup3shown', '1', mydate, '/', document.domain, 0);

    document.getElementById('mygliderdiv').style.display = 'block';
    myGlide = new Glider('mygliderdiv',50, 50, null, null, 700,-1);
    myGlide.show();
    }
   }
  }

function writeinno() {
document.write('\
<div id="innotek" style="height:180px;width:200px;padding: 10px;margin:-180px 0 0 -200px;visibility:hidden;background:white;border: red solid 1px;position: relative;left:150px;"> \
<center><img src="/images/innotek.gif"><br><br> \
To ensure the purchase of authentic INNOTEK brand products, look for the INNOTEK Authorized Internet Retailer icon. INNOTEK brand products purchased from unauthorized internet retailers will not qualify for warranty coverage. \
</center></div>');
}
function showinno(){
document.getElementById("innotek").style.visibility="visible";
}
function hideinno(){
document.getElementById("innotek").style.visibility="hidden";
}

function writessl() {
document.write('<div id="sslseal" style="visibility:hidden;text-align:left;background:white;border: red solid 1px;position: relative;top:219px;left:271px;height:219px;width:271px;margin:-219px 0 0 -271px;"><img style="margin:0;padding:10px;" src="/sslseal.jpg" border="0"></div>');
}
function showssl(){
document.getElementById("sslseal").style.visibility="visible";
}
function hidessl(){
document.getElementById("sslseal").style.visibility="hidden";
}

function lessinfo(){
document.getElementById("info").style.display="none";
}
function moreinfo(){
document.getElementById("info").style.display="block";
}
function toginfo(){
if (document.getElementById("info").style.display=="none") document.getElementById("info").style.display="block";
else document.getElementById("info").style.display="none";
}

function dwr(s){
document.write(s);
}
function dwl(s,t){
document.write('<a href="http://spoiled-pups.com'+s+'">'+t+'</a>');
}
function dwls(s,t){
document.write('<a href="https://spoiled-pups.com'+s+'">'+t+'</a>');
}
function dwx(s,t,x){
document.write('<a href="http://spoiled-pups.com'+s+'" '+x+'>'+t+'</a>');
}
function dwxs(s,t,x){
document.write('<a href="https://spoiled-pups.com'+s+'" '+x+'>'+t+'</a>');
}
function dwid(id,s,t){
document.getElementById(id).innerHTML = '<a href="http://spoiled-pups.com'+s+'">'+t+'</a>';
}
function ppseal(){
document.write('<a href="https://www.paypal.com/us/verified/pal=paypal%40spoiled%2dpups%2ecom" target="_blank"><img src="/images/paypal_verification_seal.gif" border="0" alt="Official PayPal Seal" height=50 width=50></a>');
}

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat" && !window.opera)? document.documentElement : document.body
}

function enlarge(which, e, position, imgwidth, imgheight){
if (ie||ns6){
crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage
if (position=="center"){
pgyoffset=ns6? parseInt(pageYOffset) : parseInt(ietruebody().scrollTop)
horzpos=ns6? pageXOffset+window.innerWidth/2-imgwidth/2 : ietruebody().scrollLeft+ietruebody().clientWidth/2-imgwidth/2
vertpos=ns6? pgyoffset+window.innerHeight/2-imgheight/2 : pgyoffset+ietruebody().clientHeight/2-imgheight/2
if (window.opera && window.innerHeight) //compensate for Opera toolbar
vertpos=pgyoffset+window.innerHeight/2-imgheight/2
vertpos=Math.max(pgyoffset, vertpos)
}
else{
var horzpos=ns6? pageXOffset+e.clientX : ietruebody().scrollLeft+event.clientX
var vertpos=ns6? pageYOffset+e.clientY : ietruebody().scrollTop+event.clientY
}
crossobj.style.left=horzpos+"px"
crossobj.style.top=vertpos+"px"

if (which.substring(0,1)=="<") { imgtxt=which; }
else { imgtxt='<img src="'+which+'">'; }
crossobj.innerHTML='<div align="right" id="dragbar" style="width:'+imgwidth+'"><span id="closetext" onClick="closepreview()">Close</span> </div>'+imgtxt;
crossobj.style.visibility="visible"
return false
}
else //if NOT IE 4+ or NS 6+, simply display image in full browser window
return true
}

function closepreview(){
crossobj.style.visibility="hidden"
if (window.ajaxtarget) document.getElementById(ajaxtarget).innerHTML=''
}

function drag_drop(e){
if (ie&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx+"px"
crossobj.style.top=tempy+event.clientY-offsety+"px"
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx+"px"
crossobj.style.top=tempy+e.clientY-offsety+"px"
}
return false
}

function initializedrag(e){
if (ie&&event.srcElement.id=="dragbar"||ns6&&e.target.id=="dragbar"){
offsetx=ie? event.clientX : e.clientX
offsety=ie? event.clientY : e.clientY

tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)

dragapproved=true
document.onmousemove=drag_drop
}
}

document.onmousedown=initializedrag
document.onmouseup=new Function("dragapproved=false")


   function setCookie(name, value, expires, path, domain, secure) {
     var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
     document.cookie = curCookie;
   }

   function getCookie(name) {
      var dc = document.cookie;
      var prefix = name + "=";
      var begin = dc.indexOf("; " + prefix);
      if (begin == -1) {
         begin = dc.indexOf(prefix);
         if (begin != 0) return null;
      } else
         begin += 2;
      var end = document.cookie.indexOf(";", begin);
   if (end == -1)
      end = dc.length;
      return unescape(dc.substring(begin + prefix.length, end));
   }
   


/*************************************************************************
  This code is from Dynamic Web Coding at www.dyn-web.com
  Copyright 2003-4 by Sharon Paine
  See Terms of Use at www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

/*
  dw_lib.js - used with dw_glide.js, dw_glider.js, ...
  version date July 2004
*/

dynObj.holder = {};
// constructor
function dynObj(id,x,y,w,h) {
  var el = dynObj.getElemRef(id);
  if (!el) return;  this.id = id;
  dynObj.holder[this.id] = this; this.animString = "dynObj.holder." + this.id;
  var px = window.opera? 0: "px";
        this.x = x || 0;        if (x) el.style.left = this.x + px;
        this.y = y || 0;        if (y) el.style.top = this.y + px;
        this.w = w || el.offsetWidth || 0;        this.h = h || el.offsetHeight || 0;
        // if w/h passed, set style width/height
        if (w) el.style.width = w + px; if (h) el.style.height = h + px;
}

dynObj.getElemRef = function(id) {
  var el = document.getElementById? document.getElementById(id): null;
  return el;
}

dynObj.getInstance = function(id) {
  var obj = dynObj.holder[id];
  if (!obj) obj = new dynObj(id);
  else if (!obj.el) obj.el = dynObj.getElemRef(id);
  return obj;
}

dynObj.prototype.shiftTo = function(x,y) {
  var el = this.el? this.el: dynObj.getElemRef(this.id)? dynObj.getElemRef(this.id): null;
  if (el) {
    if (x != null) el.style.left = (this.x = x) + "px";
    if (y != null) el.style.top = (this.y = y) + "px";
  }
}

dynObj.prototype.shiftBy = function(x,y) { this.shiftTo(this.x+x, this.y+y); }

dynObj.prototype.show = function() {
  var el = this.el? this.el: dynObj.getElemRef(this.id)? dynObj.getElemRef(this.id): null;
  if (el) el.style.visibility = "visible";
}
dynObj.prototype.hide = function() {
  var el = this.el? this.el: dynObj.getElemRef(this.id)? dynObj.getElemRef(this.id): null;
  if (el) el.style.visibility = "hidden";
}


// for time-based animations
// resources: www.13thparallel.org and www.youngpup.net (accelimation)
var dw_Bezier = {
  B1: function (t) { return t*t*t },
  B2: function (t) { return 3*t*t*(1-t) },
  B3: function (t) { return 3*t*(1-t)*(1-t) },
  B4: function (t) { return (1-t)*(1-t)*(1-t) },
  // returns current value based on percentage of time passed
  getValue: function (percent,startVal,endVal,c1,c2) {
    return endVal * this.B1(percent) + c2 * this.B2(percent) + c1 * this.B3(percent) + startVal * this.B4(percent);
  }
}

// adapted from accelimation.js by Aaron Boodman of www.youngpup.net
dw_Animation = {
  instances: [],
  add: function(fp) {
    this.instances[this.instances.length] = fp;
          if (this.instances.length == 1) this.timerID = window.setInterval("dw_Animation.control()", 10);
  },

  remove: function(fp) {
    for (var i = 0; this.instances[i]; i++) {
                  if (fp == this.instances[i]) {
                          this.instances = this.instances.slice(0,i).concat( this.instances.slice(i+1) );
                          break;
                  }
          }
          if (this.instances.length == 0) {
                  window.clearInterval(this.timerID);        this.timerID = null;
          }
  },

  control: function() {
    for (var i = 0; this.instances[i]; i++) {
                  if (typeof this.instances[i] == "function" ) this.instances[i]();
      else eval(this.instances[i]);
    }
  }
}



/*
                dw_glider.js - requires dw_lib.js
                glide to maintain window location on scroll
                version date: September 2003

                This code is from Dynamic Web Coding at www.dyn-web.com
    See Terms of Use at http://www.dyn-web.com/bus/terms.html
    Permission granted to use this code
    as long as this entire notice is included.

    Resources: ypChaser by Aaron Boodman (www.youngpup.net)
    DHTML chaser tutorial at DHTML Lab - www.webreference.com/dhtml
*/

Glider.holder = [];
function Glider(id,x,y,w,h,d,ac) {
        this.glideDur = d || 1000; this.origX = x; this.origY = y; this.ac = -ac || 0;
        this.baseObj = dynObj;
        this.baseObj(id,x,y,w,h);
  Glider.holder[Glider.holder.length] = this;
  if (!Glider.winHt) Glider.winHt = getWinHeight();
}
Glider.prototype = new dynObj;
Glider.prototype.onGlideInit = function () {}

Glider.prototype.checkGlider = function() {
        var destY = getScrollY() + this.origY;
        if (destY != this.y) {
                if (destY != this.dy) {
                        this.dy = destY;
                        this.glideInit();
      this.onGlideInit();
                }
                this.glide();
        }
}

Glider.prototype.glideInit = function() {
        this.gt = new Date().getTime();
        var distY = this.dy - this.y;
        if ( Math.abs(distY) > Glider.winHt ) {        // distance greater than window height?
                this.gsy = (distY > 0)? this.dy - Glider.winHt: this.dy + Glider.winHt;
        } else this.gsy = this.y;
  this.g_yc1 = this.gsy + ( (1+this.ac) * (this.dy - this.gsy)/3 );
        this.g_yc2 = this.gsy + ( (2+this.ac) * (this.dy - this.gsy)/3 );
}

Glider.prototype.glide = function() {
        var elapsed = new Date().getTime() - this.gt;
  if (elapsed < this.glideDur) {
    var y = dw_Bezier.getValue( elapsed/this.glideDur, this.gsy, this.dy, this.g_yc1, this.g_yc2 );
    this.shiftTo(null,y);
  } else this.shiftTo(null,this.dy);
}

Glider.control = function() {
  for (var i=0; Glider.holder[i]; i++) {
    var curObj = Glider.holder[i];
    if (curObj) curObj.checkGlider();
  }
}
//Glider.timer = setInterval("Glider.control()",20);
dw_Animation.add(Glider.control);

// returns height of window
function getWinHeight() {
        var winHt = 0;
        if (window.innerHeight) winHt = window.innerHeight-18;
        else if (document.documentElement && document.documentElement.clientHeight)
                winHt = document.documentElement.clientHeight;
        else if (document.body && document.body.clientHeight)
                winHt = document.body.clientHeight;
        return winHt;
}

// returns amount of vertical scroll
function getScrollY() {
        var sy = 0;
        if (document.documentElement && document.documentElement.scrollTop)
                sy = document.documentElement.scrollTop;
        else if (document.body && document.body.scrollTop)
                sy = document.body.scrollTop;
        else if (window.pageYOffset)
                sy = window.pageYOffset;
        else if (window.scrollY)
                sy = window.scrollY;
        return sy;
}

// onresize, get window height
if (window.addEventListener)
  window.addEventListener("resize", function(){ Glider.winHt = getWinHeight(); }, "false");
else if (window.attachEvent)
  window.attachEvent("onresize", function(){ Glider.winHt = getWinHeight(); } );
