﻿

// Gets the Height of the user's Browser Window
// Used to setFooter and place Form on Default.aspx
function getWindowHeight() {
    var windowHeight=0;
    if (typeof(window.innerHeight)=='number') {
        windowHeight=window.innerHeight;
    }
    else {
            if (document.documentElement&& document.documentElement.clientHeight) {
                windowHeight=document.documentElement.clientHeight;
            }
            else {
                if (document.body&&document.body.clientHeight) {
                    windowHeight=document.body.clientHeight;
                }
            }
    }
    return windowHeight;
}



// Gets the Width of the user's Browser Window
// Used to place Form on Default.aspx
function getWindowWidth() {
    var windowWidth = 0;
    if (typeof(window.innerWidth) == 'number') {
        windowWidth = window.innerWidth;
    }
    else {
        if (document.documentElement && document.documentElement.clientWidth) {
            windowWidth = document.documentElement.clientWidth;
        }
        else {
            if (document.body && document.body.clientWidth) {
                windowWidth = document.body.clientWidth;
            }
        }
    }
    return windowWidth;
}		


// Places the Footer either at the bottom of the window
// or at the end of the content if content is longer than window
// so that the women on the product pages look right.
function setFooter() {
    if (document.getElementById) {
        var windowHeight=getWindowHeight();
        if (windowHeight>0) {
            var contentHeight=document.getElementById('content').offsetHeight;
            var footerElement=document.getElementById('footer');
            var footerHeight=footerElement.offsetHeight;
            if (windowHeight-(contentHeight+footerHeight)>=0) {
                footerElement.style.position='relative';
                footerElement.style.top=(windowHeight-(contentHeight+footerHeight))+'px';
            }
            else {
            footerElement.style.position='static';
            
            }
        }
    }
}




//This section is mostly for the imagemap of the women on Default.aspx
var imageMap = new Array();
var moreInfo = new Array();
function loadAll() {
  imageMap[0] = new Image();
  imageMap[0].src = "images/home_01.gif";
  imageMap[1] = new Image();
  imageMap[1].src = "images/home_02.gif";
  imageMap[2] = new Image();
  imageMap[2].src = "images/home_03.gif";
  imageMap[3] = new Image();
  imageMap[3].src = "images/home_04.gif";
  imageMap[4] = new Image();
  imageMap[4].src = "images/home_05.gif";
  imageMap[5] = new Image();
  imageMap[5].src = "images/home_06.gif";
  imageMap[6] = new Image();
  imageMap[6].src = "images/home_07.gif";
  imageMap[7] = new Image();
  imageMap[7].src = "images/home_08.gif";
  moreInfo[1] = new Image();
  moreInfo[1].src = "images/moreinfo.gif";
  moreInfo[2] = new Image();
  moreInfo[2].src = "images/moreinfo_on.gif";
  Play(); 
}

//This section was going to be used if quotes where to be
//listed out side of the images themselves.

//var quotes = new Array();   
//      quotes[0] = "&nbsp;";
//      quotes[1] = "&#8220;Pit, sed magnim vero dolorer ostrud ero odigna feugue tem volum<br>nulputat. Ut laorting eugiam quipsusto consecte dolorem veros autem<br>acillan velesecte tem vero odolorem quisisci bla ate dolobore&#8221;";
//      quotes[2] = "&#8220;The minute you read something that you can't understand, you can<br>almost be sure that it was drawn up by a lawyer.&#8221;";
//      quotes[3] = "&#8220;The ultimate result of shielding men from the effects of folly,<br>is to fill the world with fools.&#8221;";
//      quotes[4] = "&#8220;To succeed in politics, it is often necessary to rise above<br>your principles.&#8221;";
//      quotes[5] = "&#8220;Definition of Politics: &#8220;Poli&#8221; in latin meaning &#8220;many&#8221;<br>and &#8220;tics&#8221; meaning &#8220;blood-sucking parasites.&#8221;";
//      quotes[6] = "&#8220;A camel is a horse designed by committee.&#8221;"; 
//      quotes[7] = "&#8220;When buying and selling are controlled by legislation,<br>the first things to be bought and sold are legislators.&#8221;";


function rollOver(iState)
    {      
    if(document.images)
        {
            document.imageMap.src = imageMap[iState].src;
            //  document.getElementById("quote").innerHTML = eval('quotes[' + iState + ']');
        }
}
    
 function rollOver2(iState)
    {      
        if(document.images)
        {
            document.moreinfopic.src = moreInfo[iState].src;
        }
}   

// These next scripts are so the ImageMap automatically 
// cycles through all the girls but pauses on mouseover

var boardNum = 0;
var boardSpeed = 2000;     

function rotateImageMap() {
    if (boardNum < (imageMap.length - 1)) {
        boardNum++;
    }
    else {
        boardNum = 0;
    }
        document.imageMap.src = imageMap[boardNum].src;
        // document.getElementById("quote").innerHTML = eval('quotes[' + boardNum + ']');
    Play();
}

var play = true;

function PlayOrPause(){
    var e = document.getElementById("playButton");
    var currentLabel = e.value;
    if (currentLabel == "[pause]"){
        var e = document.getElementById("playButton");
		e.value = "[play]";
        play = false;
    } 
    else {
        var e = document.getElementById("playButton");
		e.value = "[pause]";
		play = true;
		Play();
    }
}

function Pause(){
	var e = document.getElementById("playButton");
	e.value = "[play]";
    play = false;
	}

function Play(){
	if (play) {
  	    setTimeout('rotateImageMap()',boardSpeed);
	}
}


// setContent plased the reg form in the center of the screen.
		
function setContent() {
    if (document.getElementById) {
        var windowHeight = getWindowHeight();
        var windowWidth = getWindowWidth();
        if (windowHeight > 0) {
            var contentElement = document.getElementById('regform');
            var contentHeight = contentElement.offsetHeight;
            var contentWidth = contentElement.offsetWidth;
                if (windowHeight - contentHeight > 0) {
                    contentElement.style.position = 'absolute';
                    contentElement.style.top = ((windowHeight / 2) - (contentHeight / 2)) + 'px';
                    contentElement.style.left = ((windowWidth / 2) - (contentWidth / 2)) + 'px';
                    changeOpac(0,'regform');
                }
                else {
                    contentElement.style.position = 'static';
                    changeOpac(0,'regform');
                }
        }
    }
		
}

// This handles fading the form in and out
// for the most part
function opacity(id, opacStart, opacEnd, millisec) { 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 
    if(opacStart > opacEnd){ 
        for(i = opacStart; i >= opacEnd; i--) 
        { 
        setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
        timer++; 
        }
    setTimeout("formGone('" + id + "')",(timer * speed)); 
    } 
    else if(opacStart < opacEnd) 
    {
        document.getElementById("regform").style.zIndex=1000;
		document.getElementById("regform").style.visibility="visible";
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
            }
    } 
} 

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
} 


// Once form is faded out it needs to move to back
// of z-index to be out of the way of other mouseovers
function formGone(id) {
    document.getElementById(id).style.visibility="hidden";
    document.getElementById(id).style.zIndex=1;
} 
        
function fixPNG(id) {
    var arVersion = navigator.appVersion.split("MSIE")
    var version = parseFloat(arVersion[1])

    if ((version >= 5.5) && (document.body.filters)) 
    {
    for(var i=0; i<document.images.length; i++)
        {
        var img = document.images[i]
        var imgName = img.src.toUpperCase()
        if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
            {
             var imgID = (img.id) ? "id='" + img.id + "' " : ""
             var imgClass = (img.className) ? "class='" + img.className + "' " : ""
             var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
             var imgStyle = img.style.cssText 
             if (img.align == "left") imgStyle = "float:left;" + imgStyle
             if (img.align == "right") imgStyle = "float:right;" + imgStyle
             if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
             var strNewHTML = "<div " + imgID + imgClass + imgTitle
             + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
             + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
             + "(src=\'" + img.src + "\', sizingMethod='scale');\"></div>"
             img.outerHTML = strNewHTML
             i = i-1
            }
        }
    }
}            
        
        