<!-- 
// -----------------------------------------------------------------------------------

//
//      Additional methods for Element added by SU, Couloir
//      - further additions by Lokesh Dhakar (huddletogether.com)
//
Object.extend(Element, {
        getWidth: function(element) {
                element = $(element);
                return element.offsetWidth;
        },
        setWidth: function(element,w) {
                element = $(element);
        element.style.width = w +"px";
        },
        setHeight: function(element,h) {
                element = $(element);
        element.style.height = h +"px";
        },
        setTop: function(element,t) {
                element = $(element);
        element.style.top = t +"px";
        },
        setSrc: function(element,src) {
        element = $(element);
        element.src = src;
        },
        setHref: function(element,href) {
        element = $(element);
        element.href = href;
        },
        setInnerHTML: function(element,content) {
                element = $(element);
                element.innerHTML = content;
        }
});

// -----------------------------------------------------------------------------------

//
// moviePlayerGetPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Edit for Firefox by pHaez
//
function moviePlayerGetPageSize(){

        var xScroll, yScroll;

        if (window.innerHeight && window.scrollMaxY) {
                xScroll = document.body.scrollWidth;
                yScroll = window.innerHeight + window.scrollMaxY;
        } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
                xScroll = document.body.scrollWidth;
                yScroll = document.body.scrollHeight;
        } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
                xScroll = document.body.offsetWidth;
                yScroll = document.body.offsetHeight;
        }

        var windowWidth, windowHeight;
        if (self.innerHeight) { // all except Explorer
                windowWidth = self.innerWidth;
                windowHeight = self.innerHeight;
        } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
                windowWidth = document.documentElement.clientWidth;
                windowHeight = document.documentElement.clientHeight;
        } else if (document.body) { // other Explorers
                windowWidth = document.body.clientWidth;
                windowHeight = document.body.clientHeight;
        }

        // for small pages with total height less then height of the viewport
        if(yScroll < windowHeight){
                pageHeight = windowHeight;
        } else {
                pageHeight = yScroll;
        }

        // for small pages with total width less then width of the viewport
        if(xScroll < windowWidth){
                pageWidth = windowWidth;
        } else {
                pageWidth = xScroll;
        }


        arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
        return arrayPageSize;
}

// -----------------------------------------------------------------------------------

//
// moviePlayerGetPageScroll()
// Returns array with x,y page scroll values.
// Core code from - quirksmode.org
//
function moviePlayerGetPageScroll(){

        var yScroll;

        if (self.pageYOffset) {
                yScroll = self.pageYOffset;
        } else if (document.documentElement && document.documentElement.scrollTop){      // Explorer 6 Strict
                yScroll = document.documentElement.scrollTop;
        } else if (document.body) {// all other Explorers
                yScroll = document.body.scrollTop;
        }

        arrayPageScroll = new Array('',yScroll)
        return arrayPageScroll;
}

// ---------------------------------------------------

function moviePlayerHideSelectBoxes(){
        selects = document.getElementsByTagName("select");
        for (i = 0; i != selects.length; i++) {
                selects[i].style.visibility = "hidden";
        }
}

// ---------------------------------------------------

function moviePlayerShowSelectBoxes(){
        selects = document.getElementsByTagName("select");
        for (i = 0; i != selects.length; i++) {
                selects[i].style.visibility = "visible";
        }
}

// ---------------------------------------------------

//
// moviePlayerPause(numberMillis)
// Pauses code execution for specified time. Uses busy code, not good.
// Code from http://www.faqts.com/knowledge_base/view.phtml/aid/1602
//
function moviePlayerPause(numberMillis) {
        var now = new Date();
        var exitTime = now.getTime() + numberMillis;
        while (true) {
                now = new Date();
                if (now.getTime() > exitTime)
                        return;
        }
}


function moviePlayerAppear(flvMovie, duration, landingMovie, displayLink) {
    // Make the right things appear...  It should work fine.
    moviePlayerHideSelectBoxes();
    // stretch overlay to fill page and fade in
    var arrayPageSize = moviePlayerGetPageSize();
    document.getElementById('overlay').style.height = arrayPageSize[1] + "px";
    if (isMac()) {
      document.getElementById('overlay').style.backgroundImage = "url(http://www.hunterdouglas.com/images/trans_black.png)";
      Element.show('overlay');
    } else {
      document.getElementById('overlay').style.backgroundColor = "#000";
      document.getElementById('overlay').style.opacity = 0.6;
      document.getElementById('overlay').style.filter = "alpha(opacity=60)";
      new Effect.Appear('overlay', { duration: 0.2, from: 0.0, to: 0.6 });
    }
    var arrayPageScroll = moviePlayerGetPageScroll();
    var popTop = arrayPageScroll[1] + 70;

    var flash_contentVersion = 8;
    var flash_swfUrl = "http://www.hunterdouglas.com/flash/player.swf";
    var flash_bgcolor = "#FFFFFF";
    var flash_width = "480";
    var flash_height = "409";
    var flash_id_name = "videoplayer";
    var flash_align = "middle";
     
    var so = new SWFObject(flash_swfUrl, flash_id_name, flash_width, flash_height, flash_contentVersion, flash_bgcolor);
     
    //update the following to add as many variables as required to pass into the Flash
   
    so.addParam("align", flash_align);
    so.addParam("menu", "false");
    so.addParam("scale", "noscale");
    so.addParam("wmode", "window");
    if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){ 
     so.addParam("allowscriptaccess", "sameDomain"); 
    }
    so.addParam("pluginspage", "http://www.macromedia.com/go/getflashplayer");
    so.addParam("type", "application/x-shockwave-flash");
    // so.addParam("swLiveConnect", "true");
    so.addParam("quality", "high");
    so.addVariable("videoFile", flvMovie);
    so.addVariable("movieDuration", duration);
    so.addVariable("landingImg", landingMovie);
    so.addVariable("displayLink", displayLink);
    if ( (BrowserDetect.browser == "Firefox") && (BrowserDetect.OS == "Windows") ) {
        so.addVariable("BufferAll", true);
    }

    if (so.write('movie_content')) {
      // noop
    } else {
      // Make it error, gracefully.
      Element.update('movie_content','<span class="bodyMain"><br /><br /><br /><br />This video requires Flash 8.0 or higher to play.<br />Please get the latest version of Flash from Adobe:<br /><br /><a href="http://www.macromedia.com/go/getflashplayer/" class="bodyMain">http://www.macromedia.com/go/getflashplayer/</a></span>');
    }
    Element.setTop('movie_player', popTop);
    Element.show('movie_player');
}

function moviePlayerAway() {
  // Just hide the right divs.
  //
  Element.hide('movie_player');
  new Effect.Fade('overlay', { duration: 0.2});
  moviePlayerShowSelectBoxes();
  Element.update('movie_content', '');
}

popload_11 = new Image();
popload_11.src = "http://www.hunterdouglas.com/images/movie_bkg.gif";
popload_12 = new Image();
popload_12.src = "http://www.hunterdouglas.com/images/movie_close.gif";
popload_13 = new Image();
popload_13.src = "http://www.hunterdouglas.com/images/movie_close_over.gif";

movieplayer_loaded = true;
// -->
