﻿function set_selected(objid){
  var img = document.getElementById(objid);
  if(objid == "home")
    img.src = "images/home_button_selected.png";
  else if(objid == "videos")
    img.src = "images/videos_button_selected.png";
  else if(objid == "nominate")
    img.src = "images/nominate_button_selected.png";
  else if(objid == "share")
    img.src = "images/share_button_selected.png";
  else if(objid == "faq")
    img.src = "images/faq_button_selected.png";
}

var scrolling = null;
function scrolltop(objid)
{
var d = document.getElementById('faq_content');
d.scrollTop = d.scrollTop - 4;
scrolling = window.setTimeout(function(){scrolltop(),3000});
}
function stopscroll()
{
window.clearTimeout(scrolling);
}
function scrolldown()
{
var d = document.getElementById('faq_content');
d.scrollTop = d.scrollTop + 4;
scrolling = window.setTimeout(function(){scrolldown(),3000});
}

//$(document).ready(function(){
//  $("#content-slider").slider({
//    animate: true,
//    change: handleSliderChange,
//    slide: handleSliderSlide
//  });
//});
//function handleSliderChange(e, ui)
//{
//  var maxScroll = $("#content-scroll").attr("scrollHeight") - 
//                  $("#content-scroll").height();
//  $("#content-scroll").animate({scrollTop: ui.value * 
//     (maxScroll / 100) }, 1000);
//}

//function handleSliderSlide(e, ui)
//{
//  var maxScroll = $("#content-scroll").attr("scrollHeight") - 
//                  $("#content-scroll").height();
//  $("#content-scroll").attr({scrollTop: ui.value * (maxScroll / 100) });
//}



var windowState = (function(){
     var readScroll = {scrollLeft:0,scrollTop:0};
     var readSize = {clientWidth:0,clientHeight:0};
     var readScrollX = 'scrollLeft';
     var readScrollY = 'scrollTop';
     var readWidth = 'clientWidth';
     var readHeight = 'clientHeight';
     function otherWindowTest(obj){
      if((document.compatMode)&&
       (document.compatMode == 'CSS1Compat')&&
       (document.documentElement)){
        return document.documentElement;
        }else if(document.body){
      return document.body;
      }else{
      return obj;
     }
     };
if((typeof this.innerHeight == 'number')&&
(typeof this.innerWidth == 'number')){
readSize = this;
readWidth = 'innerWidth';
readHeight = 'innerHeight';
}else{
readSize = otherWindowTest(readSize);
}
if((typeof this.pageYOffset == 'number')&&
(typeof this.pageXOffset == 'number')){
readScroll = this;
readScrollY = 'pageYOffset';
readScrollX = 'pageXOffset';
}else{
readScroll = otherWindowTest(readScroll);
}
return {
getScrollX:function(){
return (readScroll[readScrollX]||0);
},
getScrollY:function(){
return (readScroll[readScrollY]||0);
},
getWidth:function(){
return (readSize[readWidth]||0);
},
getHeight:function(){
return (readSize[readHeight]||0);
}
};
})();
var viewPortWidth = windowState.getWidth();
var viewPortHeight = windowState.getHeight();
var horizontalScroll = windowState.getScrollX();
var verticalScroll = windowState.getScrollY();
var hPos = Math.round(horizontalScroll+((viewPortWidth-442)/2)); //442 is the div width
var vPos = Math.round(verticalScroll+((viewPortHeight-225)/2));  //225 is the div height

hPos = (hPos < 0)?0:hPos;
vPos = (vPos < 0)?0:vPos;

function getStyleObj(id){
var obj = null;
if(document.getElementById){
obj = document.getElementById(id);
}else if(document.all){
obj = document.all[id];
}else if(document.layers){
obj = document.layers[id];
}
return (obj && obj.style) || obj;
}
function showoverlay()
{ 
     var divStyleRef = getStyleObj("overlay");
     if(divStyleRef){
       var positionMod = (typeof divStyleRef.top == 'string')?"px":0;
       divStyleRef.top = vPos + positionMod;
       divStyleRef.left = hPos + positionMod;
       divStyleRef.display = "block";
     }
}
function closeoverlay(){ var div = document.getElementById("overlay"); div.style.display = "none";}
window.onresize = function(){ var div = document.getElementById("overlay"); if(div){if(div.style.display == "block"){
 viewPortWidth = windowState.getWidth();
viewPortHeight = windowState.getHeight();
horizontalScroll = windowState.getScrollX();
verticalScroll = windowState.getScrollY();
hPos = Math.round(horizontalScroll+((viewPortWidth-442)/2)); //442 is the div width
vPos = Math.round(verticalScroll+((viewPortHeight-225)/2));  //225 is the div height

hPos = (hPos < 0)?0:hPos;
vPos = (vPos < 0)?0:vPos;
 showoverlay();
 }
 }
 }
 
 /**********Google Map functions***********************/
        function shownominee() {
            showAddress(document.myform.address.value) ;
        }
/***********************End Google Map functions*******************/
