<!-- 11/01/2001 MSJ.js
// 12/12/2001 seed added
var It
var O
var fav1=new Image
var i_dir='http://www.photo-proofs.com/SHU/images/'
var I_dir='http://www.photo-proofs.com/SHU/images/icons/'

var X=360
var Y=543 // not standard!
var Sz = "width="+X+",height="+Y

// finds the name of each voter number
var Fi=location.search.substr(1,2) // the number of the voter
var i=0

if((Fi=='F1')||(Fi=='F2')||(Fi=='F3')||(Fi=='F4')||(Fi=='F5')||(Fi=='F6')){i=Fi.substr(1,1)}
else{Fi=''}

var Name0, Name1, Name2, Name3, Name4, Name5, Name6
if(typeof voter_names=='object')
{
  if(voter_names[0]){Name1=voter_names[0]}else{Name1=' '}
  if(voter_names[1]){Name2=voter_names[1]}else{Name2=' '}
  if(voter_names[2]){Name3=voter_names[2]}else{Name3=' '}
  if(voter_names[3]){Name4=voter_names[3]}else{Name4=' '}
  if(voter_names[4]){Name5=voter_names[4]}else{Name5=' '}
  if(voter_names[5]){Name6=voter_names[5]}else{Name6=' '}
}


// this opens the enlargement popup

function openWin(imag,bc) {
  ctr=0
  var winName="image" + imag
  if(bc==1){winName+="C"}
  else{bc=0}
  var Ht
  var Wd
  var act='add'
  var use=Fi
  var ref=location.href
  var args=''
  if(location.search.indexOf('/')==-1){
    ref=ref.substr(0,ref.length-3)
    args='?'+use+'^'+imag+'^'+ref+'^'+bc
    } //
  else {
    args=location.search
    args=args.substr(0,args.length-2)+'^'+bc
    }

  //alert("ref= "+ref)

  var features="scrollbars,resizable,status,menubar," + Sz

  var URL='http://www.photo-proofs.com/SHU/pages/image.html'+args

  //alert("URL= "+URL)

  newWin=window.open(URL,winName,features)
  }



// Use this function to save a cookie.
function setCookie(user, value) {
  var D=new Date()
  var T=new Date((1000*60*60*24*31) + D.getTime()) // one month
  var exp=T.toGMTString()
  document.cookie=user+"=" + escape(value) + ";path=" + location.pathname + ";expires="+exp
  }

// Use this function to delete a cookie.
function delCookie(Name) {
  if(Name=='_ALL_') {document.cookie=Num+"=; expires=Thu, 01-Jan-70 00:00:01 GMT" +  "; path=/";}
  else {
  var C=getCookie(Num)
    if (C!="") {
      var cAry=C.split(" |")
      if (cAry.length<4){document.cookie=Num+"=; path=/; expires=Thu, 01-Jan-70 00:00:01 GMT"}
      else {
        var store=''
        for(var i=1;i<cAry.length-1;i+=2){
          if(Name!=cAry[i]) {
            store+=cAry[i]+" |"+cAry[i+1]
            }
          }
        setCookie(store)
        location.reload()
        //frm.submit
        }
      }
    }
  }

// Use this function to retrieve a cookie.
var count=0
function getCookie(name) {
  var oldCookie=""
  var dc=document.cookie;
  var c_name=name + "=";
  if (dc.length > 0) {
    var begin=dc.indexOf(c_name);
    if (begin!=-1) {
      begin+=c_name.length;
      var end=dc.indexOf(";", begin);
      if (end==-1) { end=dc.length; }
      oldCookie=unescape(dc.substring(begin, end));
      }
    }
  return oldCookie
}

var ctr=0
// this checks the voting cookie and updates the icons.
function checkCookie(page,tar) {
  //if(document.upd){document.upd.src="http://www.photo-proofs.com/SHU/images/update.png"}
  if((ctr++==0)&&(document.referrer.indexOf('SHU')>-1)){seed()}
  var ImA = window["ImA"+page]
  var L=ImA.length
  if(!tar){tar='b'}
  for (var i=0;i<L;i++) {
    var I=ImA[i]
    for (var f=1;f<7;f++) {
      var Qi = "F"+f
      C=getCookie(Qi)
      if (C.indexOf(I)>-1) {
        var It=document[Qi+I]
        if (typeof It=='object'){
          It.src=I_dir+Qi+tar+"ON.gif"
          }
        }
      else {
        var It=document[Qi+I]
        if (typeof It=='object'){
          It.src=I_dir+Qi+tar+"OFF.gif"
          }
        }
      }
    }
  //if(document.upd){setTimeout('document.upd.src="http://www.photo-proofs.com/SHU/images/onepixel.gif"',1000)}
  }


// mouseovers for color/b-w and rotate
function Or(tar,state){
  if(state!='ON'){
    WS=''
    if(tar!='R'){
      document.BorC.src=i_dir+BC+"OFF.png"
      }
    else {
      document.Rot.src=i_dir+"rotateOFF.png"
      }
    }
  else{
    if(tar!='R'){
      document.BorC.src=i_dir+BC+"OVER.png"
      WS='view this image in '+BC
      }
    else {
      document.Rot.src=i_dir+"rotateOVER.png"
      WS='rotate this image'
      }
    }
  window.status=WS
  return true
  }

// mouseovers for the favorites hot spots
var oc_flag=0
var temp=''
function Oc(imag,state) {
  if (Fi=='') {
    window.status=''
    if(state=='on') {window.status='current vote'}
    return true
    }
  var tar = 'b'
  var O='OFF'
  var WS=''
  var It=document[Fi+imag]
  temp=It.src
  if (state=='on') {
    O='ON'
    if (temp.indexOf("ON")==-1){
      oc_flag=0
      WS="mark this image as a favorite"
      }
    else {
      WS="remove your vote for "+imag
      oc_flag=1
      }
    }

    if (oc_flag==0){temp=I_dir+Fi+tar+O+".gif"}
    It.src=temp

  window.status=WS
  return true
  }

// mouseovers for the page list
function Op(page) {
  page0=(page<10)?"0"+page : page;
  if(page0==self.location.href.substr(-7,2)) {
    window.status='This page.'
    return true
    }
  else {
    if (page==0) {
      window.status=''
      return true
      }
    else {
      window.status="go to images "+(12*(page-1)+1)+" to "+(12*page)
      return true
      }
    }
  }

// function to Email
function Ema(){
  var D=document.Emails
  if(D.ses_ID.value=="blabn40jg"){
    var URL='email.html'
    var winName="mail"
    var features="scrollbars,resizable,status,menubar"
    mailWin=window.open(URL,winName,features)
    }
  else {
    D.submit()
    }
  }

// function to show the favorites pages
function Sho(){ // will fix target...
  var D=document.Show
  D.user.value=Fi
  D.h_ref.value=location.pathname
  D.target='_blank'
  D.submit()
  }

// function to order prints
function Ord(){ //
  if (Fi=='') {alert("You need to log in with a voter name in\norder to order prints."); return}
  var D=document.Order
  D.user.value=Fi
  D.submit()
  }

var St
var sT
// function to seed client vote cookie
function seed(){
  var D=document.Vote
  var features="width=200,height=100"
  voteWin=window.open('','Votewin',features)
  sT=setTimeout("writeList('voteWin')",200)
  D.action.value=''
  D.image.value=''
  D.user.value=Fi
  D.h_ref.value=location.pathname
  D.target='Votewin'
  St=setTimeout('document.Vote.submit()',300)
  }

// function to store favorite vote
function Atemp(img) {
  if(img.indexOf('.')>-1){return}
  if (Fi=='') {alert("You need to log in with a voter name in\norder to pick your favorites."); return}
  var D=document.Vote
  if (oc_flag==1) {
    var Q1="Do you wish to unpick this image ("+img+")?"
    if (confirm(Q1)) { D.action.value='del' }
    else {return}
    }
  else {D.action.value='add'}
  var features="width=200,height=100"
  voteWin=window.open('','Votewin',features)
  sT=setTimeout("writeList('voteWin')",200)
  D.user.value=Fi
  D.h_ref.value=location.pathname
  D.image.value=img
  D.target='Votewin'
  St=setTimeout('document.Vote.submit()',300)
  }

// function to stuff comment into voting window
function writeList(arg){
  var content='<HTML><HEAD><TITLE>VOTE</TITLE>\n'
  content+='</HEAD><body text="#666666" bgcolor="#000000" link="#666666" vlink="#333333" alink="#FF0066">\n'
  content+='<center><br>&nbsp;<br>&nbsp;Accessing voting process...</center><br>\n'
  content+='</BODY></HTML>\n'
  voteWin.document.write(content)
  voteWin.document.close()  // throws an error in NN ??
  }

// mouseovers for the page list
function Op(page) {
  page0=(page<10)?"0"+page : page;
  if(page0==self.location.href.substr(-7,2)) {
    window.status='This page.'
    return true
    }
  else {
    if (page==0) {
      window.status=''
      return true
      }
    else {
      window.status="go to images "+(12*(page-1)+1)+" to "+(12*page)
      return true
      }
    }
  }

// mouseovers for the buttons
function Mo(arg) {
  if(arg=='Op'){
    status="Order Prints"
    document.order.src=i_dir+"orderOVER.png"
    }
  if(arg=='Ep'){
    status="Email these proof sheets to a friend or associate."
    document.email.src=i_dir+"emailOVER.png"
    }
  if(arg=='Sp'){
    status="Show the selected favorites in new pages."
    document.show.src=i_dir+"showOVER.png"
    }
  if(arg=='op'){
    document.order.src=i_dir+"orderOFF.png"
    status=''
    }
  if(arg=='ep'){
    document.email.src=i_dir+"emailOFF.png"
    status=''
    }
  if(arg=='sp'){
    document.show.src=i_dir+"showOFF.png"
    status=''
    }
  return true
  }


// this opens a new window for a URL
function newBrowser(site) {
  window.open(site,"sub","status,location,menubar,resizable,scrollbars,screenX=20,screenY=20");
  }

var temp=new Image
temp.src=i_dir+"orderOVER.png"
temp.src=i_dir+"emailOVER.png"
temp.src=i_dir+"showOVER.png"

//-->
