﻿// Fire popups

//mages/PopUps/ss_Options.png'

var CurrentPic = 4;
var MaxPic = 4;
var OfPic = " of 5";
var PopupPics = new Array(4);
var PopupDesc = new Array(4);
// different logic if this is docugrab(5 -9)
var doc_OfPic = " of 4";
var doc_MaxPic = 3;
var doc_CurrPic = 3;
var doc_PopupPics = new Array(3);
var doc_PopupDesc = new Array(3);

var pb_CurrPic = 4;
var pb_MaxPic = 4;
var pb_OfPic = " of 5";
var pb_PopupPics = new Array(4);
var pb_PopupDesc = new Array(4);



pb_PopupPics[0] = "../Images/PopUps/ss_ByDate.png";
pb_PopupDesc[0] = "PicBlitz has 3 views: By Date, Calendar, and Folders. Each works in a tab, independent of each other. View your photos and graphics with blazing speed,<br/> almost like a movie without clicking your mouse. ";
pb_PopupPics[1] = "../Images/PopUps/ss_Find.png";
pb_PopupDesc[1] = "Find your photos and graphics in a millisecond. I searched for 'Slide'. PicBlitz returned 229 matches out of 128,000  photos almost instantly! Click on <br/>the calendar control to see photos by date. They are shaded based on quantity.";
pb_PopupPics[2] = "../Images/PopUps/ss_HDV.png";
pb_PopupDesc[2] = "There are 7,900 folders in this scan. Only the folders containing photos and graphics are displayed. When resizing  or adjusting  brightness, a virtual <br/>copy is created with a suffix as shown in this example. The actual photo is never changed until you press 'save'. To use your own editor program, double-click on the photo list.";
pb_PopupPics[3] = "../images/PopUps/ss_SlideShow.png";
pb_PopupDesc[3] = "A speed adjustable full screen slideshow is synchronized with the photo lists. Press escape to exit.  PicBlitz will select the photo shown in the slideshow. <br/>";
pb_PopupPics[4] = "../images/PopUps/ss_Options.png";
pb_PopupDesc[4] = "The Options Tab allows you to control scan paths, photo types, and resize defaults.  Configure your photo editor and set the mouse hover speed, if it's  <br/>too fast. " +
  "Notice there are 128,000 photos in this scan. Typically, a scan takes less than 1 minute.";

doc_PopupPics[0] = "../images/PopUps/ss_Docu_Search.png";
doc_PopupDesc[0] = "Enter the text you want to search for. DocuGrab returns a list of the documents containing the words, with exact matches first.";
doc_PopupPics[1] = "../images/PopUps/ss_Docu_HDV.png";
doc_PopupDesc[1] = "You can browse through your documents in the hard drive view. Notice the folder tree is expanded so you don't have to click.";
doc_PopupPics[2] = "../images/PopUps/ss_Docu_DateView.png";
doc_PopupDesc[2] = "View your photos by date. It doesn't matter where the documents are on your hard drive. If they are in the DocuGrab dictionary, they can be viewed by date.";
doc_PopupPics[3] = "../images/PopUps/ss_Docu_Options.png";
doc_PopupDesc[3] = "Specify the folders, file types, dates, and maximum size in the Scan Control Tab. You control the documents in your dictionary.";
  
//#323d50



function NextPhoto() {
// ok - this is going to increase the current pic
if (CurrentPic < MaxPic) {
    CurrentPic = parseInt(CurrentPic) + 1;
    fireMyPopup(CurrentPic);
    }
}
function PrevPhoto(){
if (CurrentPic >  0) {
    CurrentPic = parseInt(CurrentPic) -1;
    fireMyPopup(CurrentPic);
    }
}

function myPopupRelocate() {
    var scrolledX, scrolledY;
    if (self.pageYOffset) {
        scrolledX = self.pageXOffset;
        scrolledY = self.pageYOffset;
    } else if (document.documentElement && document.documentElement.scrollTop) {
        scrolledX = document.documentElement.scrollLeft;
        scrolledY = document.documentElement.scrollTop;
    } else if (document.body) {
        scrolledX = document.body.scrollLeft;
        scrolledY = document.body.scrollTop;
    }

    var centerX, centerY;
    if (self.innerHeight) {
        centerX = self.innerWidth;
        centerY = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) {
        centerX = document.documentElement.clientWidth;
        centerY = document.documentElement.clientHeight;
    } else if (document.body) {
        centerX = document.body.clientWidth;
        centerY = document.body.clientHeight;
    }

    var leftOffset = scrolledX + (centerX - 800) / 2;
    var topOffset = scrolledY + (centerY - 800) / 2;

    document.getElementById("styled_popup").style.top = topOffset + "px";
    document.getElementById("styled_popup").style.left = leftOffset + "px";
}


// Browser safe opacity handling function

function setOpacity(value) {
    document.getElementById("styled_popup").style.opacity = value / 10;
    document.getElementById("styled_popup").style.filter = 'alpha(opacity=' + value * 10 + ')';
}

function fadeInMyPopup() {
    for (var i = 0; i <= 50; i++)
        setTimeout('setOpacity(' + (i /5) + ')', 8 * i);
    var test = 1;
}

function fadeOutMyPopup() {
    for (var i = 0; i <= 5; i++) {
        setTimeout('setOpacity(' + (5 - i / 5) + ')', 8 * i);
    }

    setTimeout('closeMyPopup()', 800);
}

function closeMyPopup() {
    document.getElementById("styled_popup").style.display = "none";
    document.getElementById("UTUBE").style.display = "block";
}

function fireMyPopup(PicToLoad) {
    // the idea here is if this is a different set of pictures, use it.
    var LocPic = PicToLoad;
    if (LocPic == "D") {
        // set the new parameters
        OfPic = doc_OfPic;
        CurrentPic = doc_CurrPic;
        MaxPic = doc_CurrPic;
        OfPic = doc_OfPic;
        PopupPics = doc_PopupPics;
        PopupDesc = doc_PopupDesc;
        PicToLoad = 0;
    } else if (LocPic == "P"){
        OfPic = pb_OfPic;
        CurrentPic = pb_CurrPic;
        MaxPic = pb_CurrPic;
        OfPic = pb_OfPic;
        PopupPics = pb_PopupPics;
        PopupDesc = pb_PopupDesc;
        PicToLoad = 0;

    }


    CurrentPic = PicToLoad;

    document.getElementById("PopUp_Img").src = PopupPics[PicToLoad];
    document.getElementById("PopUp_lbl").innerHTML = PopupDesc[PicToLoad];
    var numPic = parseInt(PicToLoad) +1;
    document.getElementById("lbl_Next").innerHTML = numPic.toString() + OfPic;
    myPopupRelocate();
    setOpacity(0);
    document.getElementById("styled_popup").style.display = "block";
    document.getElementById("UTUBE").style.display = "none";
     fadeInMyPopup();
    window.onscroll = myPopupRelocate;
}


//    <div id='styled_popup' style='width: 380px; height: 300px; display:none; position: absolute; top: 50px; left: 50px; '>
//            <table width='380' cellpadding='0' cellspacing='0' border='0'>
//<tr>
//<td><img alt="" height='23' width='356' src='images/popups/x11_title.gif'/></td>
//<td><a href='javascript:fadeOutMyPopup();'><img alt="" height='23' width='24' src='images/popups/x11_close.gif' border='0'/></a></td>
//</tr>
//<tr>
//<td colspan='2' style='background: url("images/boxtop.png") no-repeat top left; width: 380px; height: 277px;'>
//Hey, look at me!<br/>
//I'm fading :-)
//</td></tr>
//</table>
//</div>

//<%--        <asp:Panel ID="PanelTopRight" runat="server"  
//            style="position: absolute; top: 234px; left: 962px; height: 196px; width: 254px;">
//                  <input type="image" value=' Fire! '  onmouseover="fireMyPopup()"  src="Images/logo.png"/> 
//        </asp:Panel>
//--%>        
//        <%--<div id='mypopup'   style='position: absolute; width: 250px; height: 200px; display: none; background: #ddd; border: 1px solid #000; right: 0px; top: 500px'>
//        <input type="button"  value='X ' onclick='document.getElementById("mypopup").style.display = "none"' style="color:Red"/> 
//<p>My content that will be displayed in the popup</p>
//</div> --%>

//<%--<div id='styled_popup' name='styled_popup' style='width: 380px; height: 300px; display:none; position: absolute; top: 500px; right: 50px;'>
//    <table width='380' cellpadding='0' cellspacing='0' border='0'>
//        <tr>
//            <td>
//                <img alt = "" height='23' width='356' src='images/popups/x11_title.gif'/>
//          </td>
//            <td>
//                <a href='javascript:styledPopupClose();'><img height='23' width='24' src='images/popups/x11_close.gif' border='0'></a>
//            </td>
//        </tr>
//        <tr>
//            <td colspan='2' style='background:  url("images/boxtop.png") no-repeat top left; width: 380px; height: 277px;'>
//                POPUP CONTENTS GOES HERE :-)
//            </td>
//        </tr>
//    </table>
//</div>
//--%>
//<%--<input type='submit' value=' Fire ' onclick='document.getElementById("styled_popup").style.display="block"'/> 
//--%>
// <%--   <div id='styled_popup' style='width: 380px; height: 300px; display:none; position: absolute; top: 50px; left: 50px; '>
//            <table width='380' cellpadding='0' cellspacing='0' border='0'>
//<tr>
//<td><img alt="" height='230' width='356' src='images/popups/x11_title.gif'/></td>
//<td><a href='javascript:fadeOutMyPopup();'><img alt="" height='23' width='24' src='images/popups/x11_close.gif' border='0'/></a></td>
//</tr>
//<tr>
//<td colspan='2' style='background: url("images/boxtop.png") no-repeat top left; width: 380px; height: 277px;'>
//Hey, look at me!<br/>
//I'm fading :-)
//</td></tr>
//</table>--%>
//function fireMyPopup() {
//  // Determine how much the visitor had scrolled
// 
//    var scrolledX, scrolledY;
//    if (self.pageYOffset) {
//        scrolledX = self.pageXOffset;
//        scrolledY = self.pageYOffset;
//    } else if (document.documentElement && document.documentElement.scrollTop) {
//        scrolledX = document.documentElement.scrollLeft;
//        scrolledY = document.documentElement.scrollTop;
//    } else if (document.body) {
//        scrolledX = document.body.scrollLeft;
//        scrolledY = document.body.scrollTop;
//    }

//    // Determine the coordinates of the center of the page

//    var centerX, centerY;
//    if (self.innerHeight) {
//        centerX = self.innerWidth;
//        centerY = self.innerHeight;
//    } else if (document.documentElement && document.documentElement.clientHeight) {
//        centerX = document.documentElement.clientWidth;
//        centerY = document.documentElement.clientHeight;
//    } else if (document.body) {
//        centerX = document.body.clientWidth;
//        centerY = document.body.clientHeight;
//    }
//    var leftOffset = scrolledX + (centerX - 250) / 2;
//    var topOffset = scrolledY + (centerY - 200) / 2;
//    document.getElementById("styled_popup").style.top = topOffset + "px";
//    document.getElementById("styled_popup").style.left = leftOffset + "px";
//    document.getElementById("styled_popup").style.display = "block";
//}

//function fireMyPopup(PicToLoad) {
//    myPopupRelocate();
//    document.getElementById("PopUp_Img").src = PicToLoad;
//    document.getElementById("styled_popup").style.display = "block";
//    document.body.onscroll = myPopupRelocate;
//    window.onscroll = myPopupRelocate;
//}
////function styledPopupClose() {
//    document.getElementById("styled_popup").style.display = "none";
//

// Faded PopUP

