    //Drop down menu global variables
    var menuList = new Array("ordermailer", "selectroll", "orderpics", "share", "merch", "acctinfo","selectcust", "manualcredit", "reports", "manage", "account_conflicts");
    var menuRef = "document.all['"
    var menuStyle = "'].style";
    var menuVisible = "visible";
    var menuHidden = "hidden";
    var currentTab = 0;
    var prevTab = 0;
    var isFirstClick = true;
    var inMenu = 0;
    var timerID = null;
    
	////////////////////////////////////////////////////////////////////
    //capture mouse click event for IE
	////////////////////////////////////////////////////////////////////
    document.onclick=mouseClick;
        
        
	////////////////////////////////////////////////////////////////////
	//
	//	Function: ImgOn()
	//	Parameters: imgName - the image name
	//	Returns: void
	//
	//	This function replaces an image with a "Mouse Over" image.  It should
	//  be fired using the onMouseOver event of the <A HREF> tag.  This
	//  function assumes that all images are stored in the images directory
	//  off of the root and that the "Mouse Over" image has the "_over.gif"
	//  extension.
	//
	////////////////////////////////////////////////////////////////////
    function ImgOn(imgName)
    {
        var img = eval("document." + imgName);

        if (img != null)
        {
            img.src = "images/" + imgName + "_over.gif"
        }    
    }
	
	 function HighlightOn(imgName)
    {	
        var img = eval("document." + imgName);

        if (img != null)
        {
            img.src = "images/" + "ARROW" + "_over.gif"
        }    
    } 
     function HighlightOff(imgName)
    {	
        var img = eval("document." + imgName);

        if (img != null)
        {
            img.src = "images/" + "ARROW" + ".gif"
        }    
    } 
    
	////////////////////////////////////////////////////////////////////
	//
	//	Function: ImgOff()
	//	Parameters: imgName - the image name
	//	Returns: void
	//
	//	This function replaces an image with the normal image.  It should
	//  be fired using the onMouseOut event of the <A HREF> tag.  This
	//  function assumes that all images are stored in the images directory
	//  off of the root.
	//
	////////////////////////////////////////////////////////////////////
    function ImgOff(imgName)
    {
        var img = eval("document." + imgName);
        
        if (img != null)
        {
            img.src = "images/" + imgName + ".gif";
        }    
    }        

	////////////////////////////////////////////////////////////////////
	//
	//  Function: ImgDown(imgName)
	//  Parameters: imgName - the image name
	//  Returns: void
	//
	//  This function replaces an image with the mousedown image.  It should
	//  be fired by the onmousedown event
	//
	////////////////////////////////////////////////////////////////////
	function ImgDown(imgName)
	{
	    var img = eval("document." + imgName);
	    
	    if (img != null)
	    {
		    imgDown = "images/" + imgName + "_down.gif"
		    img.src = imgDown
		}    
	}
	
	   
	////////////////////////////////////////////////////////////////////
	//
	//	Function: checkEMail()
	//	Parameters: emailAddr - the email address you would like checked
	//	Returns: boolean
	//
	//	This function is used to check the syntax of an email address.
    //  It will not check to see if the address actually exist, just that
    //  it is correctly syntaxed.
	//
	////////////////////////////////////////////////////////////////////
    function checkEMail(emailAddr)
    {

        var i = emailAddr.indexOf('@');
        if (i == -1)
        {
            return false;
        }
                    
        var username = emailAddr.substring(0, i);
        var domain = emailAddr.substring(i + 1, emailAddr.length);
                    
        i = 0;
        while ((username.substring(i, i + 1) == ' ') && (i < username.length))
        {
            i++;
        }
                    
        if (i > 0)
        {
            username = username.substring(i, username.length);
        }
                    
        i = domain.length - 1;
        while ((domain.substring(i, i + 1) == ' ') && (i >= 0))
        {
            i--;
        }
                    
        if (i < (domain.length - 1))
        {
            domain = domain.substring(0, i + 1);
        }
                    
        var ch;
        for (i = 0; i < username.length; i++)
        {
            ch = (username.substring(i, i + 1)).toLowerCase();
            if (!(((ch >= 'a') && (ch <= 'z')) || ((ch >= '0') && (ch <= '9')) ||
                (ch == '_') || (ch == '-') || (ch == '.')))
            {
                return false;
            }
        }
                    
        for (i = 0; i < domain.length; i++)
        {
            ch = (domain.substring(i, i + 1)).toLowerCase();
            if (!(((ch >= 'a') && (ch <= 'z')) || ((ch >= '0') && (ch <= '9')) ||
                (ch == '_') || (ch == '-') || (ch == '.')))
            {
                return false;
            }
        }
                    
        i = domain.indexOf('.');
        if (i == -1)
        {
            return false;
        }
                        
        return true;
    }
    
	////////////////////////////////////////////////////////////////////
	//
	//  Function: setLogin(frm)
	//  Parameters: frm - the login form from the HTML doc.
	//  Returns: void
	//
	//  This function fills in the user id and password for the login from
	//  by reading the values from the accout cookie.
	//
	////////////////////////////////////////////////////////////////////
    function setLogin(frm)
    {
        if (frm == null)
        {
            return
        }    

        var acctCookie = getCookie("account");
        if (acctCookie != null)
        {
            var startP = acctCookie.indexOf("p=");
            var startU = acctCookie.indexOf("u=");
            var sep = acctCookie.indexOf("&");
            var psw;
            var uid;
            
            if (startP > -1 && startU > -1)
            {        
                if (startP < sep)
                {
                    psw = unescape(acctCookie.substring(startP + 2, sep));
                    uid = unescape(acctCookie.substring(startU + 2, acctCookie.length));
                }
                else
                {
                    psw = unescape(acctCookie.substring(startP + 2, acctCookie.length));
                    uid = unescape(acctCookie.substring(startU + 2, sep));
                }
            
                frm.userid.value = uid;
                frm.password.value = psw;

                if (uid != "")
                {
                    frm.remember.checked = true;
                }
            }    
        }    
    }

	////////////////////////////////////////////////////////////////////
	//
	//  Function: getCookie(name)
	//  Parameters: name - the cookie name
	//  Returns: the cookie value
	//
	//  This function retrieves the value of the desired cookie.
	//
	////////////////////////////////////////////////////////////////////
    function getCookie(name)
    {
        var result = null;
        var myCookie = " " + document.cookie + ";";
        var searchName = " " + name + "=";
        var startOfCookie = myCookie.indexOf(searchName);
        var endOfCookie;
            
        if (startOfCookie != - 1)
        {
            startOfCookie += searchName.length;
            endOfCookie = myCookie.indexOf(";", startOfCookie);
            result = unescape(myCookie.substring(startOfCookie, endOfCookie));
        }
        return result;
    }
    
    /////////////////////////////////////////////////////////////////////
    //
    //   Function: getSelectedButton(buttonGroup)
    //   Parameters: buttonGroup -- the name of the button group
    //   Returns: the index of the selected button
    //
    ////////////////////////////////////////////////////////////////////
    function getSelectedButton(buttonGroup)
	{
		for (var i = 0; i < buttonGroup.length; i++)
		{
			if (buttonGroup[i].checked)
			{
				return i
			}
		}
		return -1
	}	
	
	/////////////////////////////////////////////////////////////////////////
	//
	//   Function: findOptionToSelect(optionGroup, optionValue)
	//	 Parameters: optionGroup -- the name of the optionGroup to be selected from
	//				 optionValue -- the value of the option being selected
	//   Returns: the index of the option with the value of optionValue
	//
	//////////////////////////////////////////////////////////////////////////
	function findOptionToSelect(optionGroup, optionValue)
	{	
		var optionGroupSize
		optionGroupSize = optionGroup.length

		var i	
		for (i = 0; i < optionGroupSize; i++)
		{
			if ( optionGroup.options[i].value == optionValue )
			{
				return i
			}
		}
		return 1
	}
	
	////////////////////////////////////////////////////////////////////
	//
	//	Function: setQty()
	//	Parameters: ctrl - the select control
	//	Returns: void
	//
	//	This function takes the value of the select control and replaces
	//  value of the input box that correspond to the select control name.
	//
	////////////////////////////////////////////////////////////////////
    function setQty(ctrl)
    {
        var frm = document.forms[0];
        var prints = ctrl.options[ctrl.selectedIndex].value;

        if (frm == null)
        {
            return
        }
            
        for (i=0; i < frm.elements.length; i++)
        {
            var match = (frm.elements[i].name).substring(0, (ctrl.name).length);
            if (match == ctrl.name && frm.elements[i] != ctrl)
            {
                frm.elements[i].value = prints;
            }
        }
            
    }

	////////////////////////////////////////////////////////////////////
	//
    // This function is used to increment or decrement the quantity
    //    of the input box that coresponds to the button image passed
    //    into this function
    //    PARAM: img = the button image.
	//
	////////////////////////////////////////////////////////////////////
    function adjustQty(which)
    {
        var frm = document.forms[0];
        var action = which.substring(which.length - 1, which.length);
        var print = which.substring(0, which.length -1);
        var found = false;
        
        if (frm == null)
        {
            return
        }    

        for (i=0; i < frm.elements.length; i++)
        {
            if (frm.elements[i].name == print)
            {
                found = true;
                break;
            }
        }
            
        if (found)
        {
            var qty = parseInt(frm.elements[i].value);
                
            if (action == "p")
            {
                if (qty < 99)
                {
                    qty++;
                }    
            }
            else
            {
                if (qty > 0)
                {
                    qty--;
                }
            }

            frm.elements[i].value = qty;
        }    
    }

	////////////////////////////////////////////////////////////////////
	//
	//	Function: mouseClick()
	//	Parameters: mouse click event
	//	Returns: none
	//
	//	Hides any drop down menus if the user click on anthing but the
	//  menu tabs.
	//
	////////////////////////////////////////////////////////////////////
    function mouseClick(e)
    {
        if (inMenu == 0 && !isFirstClick) closeAll();
    }
        
	////////////////////////////////////////////////////////////////////
    //capture mouse click event for Netscape
	////////////////////////////////////////////////////////////////////
    if (IsBrowserNS4() || IsBrowserNS6())
    {
        document.captureEvents(Event.CLICK);
    }
        
	////////////////////////////////////////////////////////////////////
	//
	//	Function: showMenu()
	//	Parameters: menuName - the name of the menu to display
	//	Returns: none
	//
	//	displays the drop down menu
	//
	////////////////////////////////////////////////////////////////////
    function showMenu(menuName)
    {
        SetMenuVar();
        var menu;
        if (IsBrowserNS6())
        {
           menu = eval(menuRef + menuName + "')");
        }
        else
        {
           menu = eval(menuRef + menuName + "']");
        }    

        if (menu)
        {
	        eval(menuRef + menuName + menuStyle + ".zIndex=200");
	        eval(menuRef + menuName + menuStyle + ".visibility='" + menuVisible + "'");
        }
    }
        
	////////////////////////////////////////////////////////////////////
	//
	//	Function: hideMenu()
	//	Parameters: menuName - the name of the menu to hide
	//	Returns: none
	//
	//	hides the drop down menu
	//
	////////////////////////////////////////////////////////////////////
    function hideMenu(menuName)
    {
        SetMenuVar();
        var menu;
        if (IsBrowserNS6())
        {
           menu = eval(menuRef + menuName + "')");
        }
        else
        {
           menu = eval(menuRef + menuName + "']");
        }    
                
        if (menu)
        {
             eval(menuRef + menuName + menuStyle + ".visibility='" + menuHidden + "'");
        }
    }
        
	////////////////////////////////////////////////////////////////////
	//
	//	Function: closeAll()
	//	Parameters: none
	//	Returns: none
	//
	//	hides all drop down menus and resets the tab images
	//
	////////////////////////////////////////////////////////////////////
    function closeAll()
    {
        for(var i = 0; i < menuList.length; i++)
        {
            hideMenu(menuList[i]);
            ImgOff("tab_" + menuList[i]);
        }
            
        isFirstClick = true;
        
        if (timerID != null)
        {
            clearTimeout(timerID);
            timerID = null;
        }    
    }
        
	////////////////////////////////////////////////////////////////////
	//
	//	Function: overMenu()
	//	Parameters: whichTab - the tab the mouse is over.
	//	Returns: none
	//
    //  displays mouse over image for the tab, also displays the drop 
    //  down menu for the tab if the user has clicked on a tab  (mimics 
    //  Windows'ish drop down menus).
	//
	////////////////////////////////////////////////////////////////////
    function overMenu(whichTab)
    {
        currentTab=whichTab;
        
        if (!isFirstClick)
        {
            for (var i=0; i < menuList.length; i++)
            {
                if (prevTab == menuList[i]) 
                {
                    ImgOff("tab_" + menuList[i]);
                    hideMenu(menuList[i]);
                }    

                if (currentTab == menuList[i])
                {
                    showMenu(menuList[i]);
                    ImgOn("tab_" + menuList[i]);
                }
            }
        }    
    }
        
	////////////////////////////////////////////////////////////////////
	//
	//	Function: menuToggle()
	//	Parameters: none
	//	Returns: none
	//
    //  fired when the user clicks a tab.  Displays the drop down menu 
    //  for the clicked tab and hides the other menus.
	//
	////////////////////////////////////////////////////////////////////
    function menuToggle()
    {
        isFirstClick = !isFirstClick;
                    
        for (var i=0; i < menuList.length; i++)
        {
            if (currentTab == menuList[i] && !isFirstClick)
            {
                showMenu(menuList[i]);
            }
            else
            {
                hideMenu(menuList[i]);
            }
        }
    }
        
	////////////////////////////////////////////////////////////////////
	//
	//	Function: defMouseOver()
	//	Parameters: whichTab - the tab the mouse is over.
	//	Returns: none
	//
    //  default Mouse Over for a tab
    //
	////////////////////////////////////////////////////////////////////
    function defMouseOver(whichTab)
    {
        inMenu = 1;
        if (isFirstClick)
        {
            ImgOn("tab_" + whichTab);
        }    
        overMenu(whichTab);
    }
        
	////////////////////////////////////////////////////////////////////
	//
	//	Function: defMouseOut()
	//	Parameters: whichTab - the tab the mouse is over.
	//	Returns: none
	//
    //  default Mouse Out for a tab
    //
	////////////////////////////////////////////////////////////////////
    function defMouseOut(whichTab)
    {
        inMenu=0;
        prevTab=whichTab;
        if (isFirstClick) 
        {
            ImgOff("tab_" + whichTab);
        }    
    }
        
	////////////////////////////////////////////////////////////////////
	//
	//	Function: menuPointerOn()
	//	Parameters: whichTab - the tab the mouse is over.
	//              imageIdx - the index of the menu sub-item.
	//	Returns: none
	//
    //  display the arrow on the menu for the menu item
    //
	////////////////////////////////////////////////////////////////////
    function menuPointerOn(whichTab, imageIdx)
    {
        if (IsBrowserIE4() || IsBrowserNS6())
        {
            var img = eval("document." + whichTab + imageIdx);
        }

        if (IsBrowserNS4())
        {
            var img = eval("document."+whichTab+".document.images."+whichTab+imageIdx);
        }        

        if (img != null)
        {
            img.src = "images/menu_arrow.gif";
        }
    }

	////////////////////////////////////////////////////////////////////
	//
	//	Function: menuPointerOff()
	//	Parameters: whichTab - the tab the mouse is over.
	//              imageIdx - the index of the menu sub-item.
	//	Returns: none
	//
    //  hides the arrow on the menu for the menu item
    //
	////////////////////////////////////////////////////////////////////
    function menuPointerOff(whichTab, imageIdx)
    {
        if (IsBrowserIE4() || IsBrowserNS6())
        {
            var img = eval("document." + whichTab + imageIdx);
        }    
        
        if (IsBrowserNS4())
        {
            var img = eval("document."+whichTab+".document.images."+whichTab+imageIdx);
        }        

        if (img != null)
        {
            img.src = "images/spacer.gif";
        }    
    }

	////////////////////////////////////////////////////////////////////
	//
	//	Function: SetMenuVar()
	//	Parameters: none
	//	Returns: none
	//
    //  sets the global menu variables based on the client browser.
    //
	////////////////////////////////////////////////////////////////////
    function SetMenuVar()
    {
        if (IsBrowserIE4())
        {
            menuRef = "document.all['";
            menuStyle = "'].style";
            menuVisible = "visible";
            menuHidden = "hidden";
        }

        if (IsBrowserNS4())
        {
            menuRef = "document.layers['";
            menuStyle = "']";
            menuVisible = "show";
            menuHidden = "hide";
        }
        
        if (IsBrowserNS6() || IsBrowserOpera())
        {
            menuRef = "document.getElementById('"
            menuStyle = "').style";
            menuVisible = "visible";
            menuHidden = "hidden";
        }
    }

	////////////////////////////////////////////////////////////////////
	//
	//	Function: IsBrowserIE4()
	//	Parameters: none
	//	Returns: boolean
	//
	//	Returns whether the client brower is Internet Expolorer 4.0 or
	//  greater.
	//
	////////////////////////////////////////////////////////////////////
    function IsBrowserIE4()
    {
        var navName = navigator.appName;
        var navVer = parseFloat(navigator.appVersion);
        var rtn = false;
        
        if (navName.indexOf('Microsoft') != -1)
        {
            if (navVer >= 4)
            {
                rtn = true;
            }
        }
        
        return rtn;    
    }

	////////////////////////////////////////////////////////////////////
	//
	//	Function: IsBrowserNS4()
	//	Parameters: none
	//	Returns: boolean
	//
	//	Returns whether the client brower is Netscape Navigator 4.0 or
	//  greater but less than Netscape Navigator 6.0
	//
	////////////////////////////////////////////////////////////////////
    function IsBrowserNS4()
    {
        var navName = navigator.appName;
        var navVer = parseFloat(navigator.appVersion);
        var rtn = false;
        
        if (navName.indexOf('Netscape') != -1)
        {
            if (navVer >= 4 && navVer < 5)
            {
                rtn = true;
            }
        }
        
        return rtn;    
    }

	////////////////////////////////////////////////////////////////////
	//
	//	Function: IsBrowserNS6()
	//	Parameters: none
	//	Returns: boolean
	//
	//	Returns whether the client brower is Netscape Navigator 6.0
	//
	////////////////////////////////////////////////////////////////////
    function IsBrowserNS6()
    {
        var navName = navigator.appName;
        var navVer = parseFloat(navigator.appVersion);
        var rtn = false;
        
        if (navName.indexOf('Netscape') != -1)
        {
            if (navVer >= 5)
            {
                rtn = true;
            }
        }
        
        return rtn;    
    }

	////////////////////////////////////////////////////////////////////
	//
	//	Function: IsBrowserWebTV()
	//	Parameters: none
	//	Returns: boolean
	//
	//	Returns whether the client brower is WebTV
	//
	////////////////////////////////////////////////////////////////////
    function IsBrowserWebTV()
    {
        var navName = navigator.appName;
        var rtn = false;
        
        if (navName.indexOf('WebTV') != -1)
        {
            rtn = true;
        }
        
        return rtn;    
    }
    
	////////////////////////////////////////////////////////////////////
	//
	//	Function: IsBrowserOpera()
	//	Parameters: none
	//	Returns: boolean
	//
	//	Returns whether the client brower is Opera
	//
	////////////////////////////////////////////////////////////////////
    function IsBrowserOpera()
    {
        var navName = navigator.appName;
        var rtn = false;
        
        if (navName.indexOf('Opera') != -1)
        {
            rtn = true;
        }
        
        return rtn;    
    }

    ////////////////////////////////////////////////////////////////////
	//
	//	Function: OpenDaughterWindow()
	//	Parameters: URL, name, windowType
	//	Returns: none
	//
	//	Open the given URL in a daughter window without changing the parent page
	//
	////////////////////////////////////////////////////////////////////
    function OpenDaughterWindow(URL, name, windowType)
    {
		var popupWin = window.open(URL, name, windowType)
		
		window.top.name = 'opener';
    }

    function ReturnOpenDaughterWindow(URL, name, windowType)
    {
		var popupWin = window.open(URL, name, windowType)
		
		window.top.name = 'opener';
		return popupWin;
    }

    var g_UploadWin = null;

    function OpenUploadWindow()
    {
       g_UploadWin = OpenPopupWindow("uploadwindow.asp", "UploadWindow", 150, 180);
    }

    function CloseUploadWindow()
    {
       if (g_UploadWin != null)
       {
          g_UploadWin.close();
          g_UploadWin = null;
       }
    }
    
    ////////////////////////////////////////////////////////////////////
	//
	//	Function: OpenPopupWindow()
	//	Parameters: URL, name
	//	Returns: the new window object
	//
	//	Open the given URL in a pop-up style window without changing the 
	//  parent page
	//
	////////////////////////////////////////////////////////////////////
    function OpenPopupWindow(URL, name, w, h)
    {
       var style = "width=" + w + ",height=" + h;
//       var newWin = ReturnOpenDaughterWindow(URL, name, "height=180,width=150");
       var newWin = ReturnOpenDaughterWindow(URL, name, style);
       return newWin;
    }
    
    ////////////////////////////////////////////////////////////////////
	//
	//	Function: ClosePopupWindow()
	//	Parameters: win - the window object
	//	Returns: none
	//
	//	Closes the window passed (usually created through OpenPopupWindow)
	//
	////////////////////////////////////////////////////////////////////
    function ClosePopupWindow(win)
    {
       if (win != null)
       {
          win.close();
       }
    }
    

	////////////////////////////////////////////////////////////////////
	//
	//	Function: checkSubmitted()
	//	Parameters: none
	//	Returns: boolean
	//
	//	Returns whether or not the form has been submitted.
	//  To use this method, a hidden field called "IsSubmitted" should
	//  be placed on the first form of the page, with the default value of 
	//  False.  The "OnSubmit" event handler of the form should call this
	//  method.  A value of False is returned to the event handler if the
	//  IsSubmitted variable has been set to true.  In that case, the submit
	//  button is simply ignored and no re-posting is done.
	//
	////////////////////////////////////////////////////////////////////
	function checkSubmitted()
	{
		var IsSubmitted = document.forms[0].IsSubmitted.value;
	
		if (IsSubmitted == "True")
		{
			return false;
		}		
		else 
		{
			document.forms[0].IsSubmitted.value = "True";
			return true;
		}
  	 }

	////////////////////////////////////////////////////////////////////
	//
	//	Function: GetQueryStringFromURL()
	//	Parameters: none
	//	Returns: the query string
	//
	//  This routine is used to return the query string off the URL
	//
	////////////////////////////////////////////////////////////////////
	function GetQueryStringFromURL()
	{
		var URL
		URL = document.URL
	    	
		var start
		start = URL.indexOf("?")
	    	
		if (start == -1)
		{
			return ""
		}
		else
		{
			return URL.substring(start, URL.length)
		}
	}

	////////////////////////////////////////////////////////////////////
	//	Function: addContacts()
	//	Parameters: none
	//	
	//  adds selected contacts to the Send To input text area
	//  Used by the share pages
	//
	////////////////////////////////////////////////////////////////////

	function addContacts()
	{
        
        var shareform = document.forms["shareform"];
        var emailString;
        emailString = shareform.sendto.value;
        
        for (var i = 0; i < shareform.sel_contacts.length; i++) 
        {
            if (shareform.sel_contacts.options[i].selected) 
            {
                if (emailString.indexOf(shareform.sel_contacts.options[i].value) == -1)
                {
                    if (emailString.length == 0)
                    {
                        emailString = shareform.sel_contacts.options[i].value;
                    }
                    else
                    {
                        emailString =  shareform.sel_contacts.options[i].value + ", " + emailString;
                    }
                }
                shareform.sel_contacts.options[i].selected = false;
            }       
        }
        shareform.sendto.value = emailString;
    }
    
	////////////////////////////////////////////////////////////////////
	//	Function: toggleSelect(cntl, selType)
	//	Parameters: selType - the select type (share or delete)
	//	
	//  toggles the selected image
	//  Used by delete image and share multiple pages
	//
	////////////////////////////////////////////////////////////////////    
    
    function toggleSelect(cntl, selType)
    {
        var frm = document.forms["selectform"];
        var img = eval("document.selimg" + cntl);
            
        if (frm == null || img == null)
        {
            return;
        }
            
        var state;
        for (i=0; i < frm.elements.length; i++)
        {
            if (frm.elements[i].name == ("sel" + cntl))
            {
                state = frm.elements[i].value;
                if (state == "True")
                {
                    frm.elements[i].value = "False";
                    if (selType == "delete")
                    {
                        img.src = "images/delete_image_prompt.gif";
                    }
                    else if (selType == "share")
                    {
                        img.src = "images/share_image_prompt.gif";
                    }
                }
                else
                {
                    frm.elements[i].value = "True";
                    if (selType == "delete")
                    {
                        img.src = "images/delete_image_selected.gif";
                    }
                    else if (selType == "share")
                    {
                        img.src = "images/share_image_selected.gif";
                    }
                }
                    
                break;
            }
        }        
    }
    
	////////////////////////////////////////////////////////////////////
	//	Function: toggleAllSelectsOn(selType)
	//	Parameters: selType - the select type (share or delete)
	//	
	//  toggles all the selected images in
	//  Used by delete image and share multiple pages
	//
	////////////////////////////////////////////////////////////////////    
    function toggleAllSelectsOn(selType)
    {
        var frm = document.forms["selectform"];
        var img;
        var name;

        for (i=0; i < frm.elements.length; i++)
        {
           
            name = frm.elements[i].name;
            name = name.substr(3);
            img = eval("document.selimg" + name);

            if (img != undefined)
            {            
                frm.elements[i].value = "True";
            
                if (selType == "delete")
                {
                    img.src = "images/delete_image_selected.gif";
                }
                else if (selType == "share")
                {
                    img.src = "images/share_image_selected.gif";
                }
            }
        }
    }
    
	////////////////////////////////////////////////////////////////////
	//	Functions: clickContactClear, clickContactCheckBox
	//	
	//	Used by add_contact and modify_contact to clear the contact form
	//  or the toggle the disabled attribute of the input boxes
	//  and clear their values.
	//
	////////////////////////////////////////////////////////////////////       
    
	function clickContactClear()  //clears the form of all user inputed information
	{
		document.forms[0].reset();
		clickContactCheckBox();
	}
		
	function clickContactCheckBox()  //enables/disables the ship to textboxes
							  //based on the checkbox status
	{
		if (contactform.chk_shipping.checked)
		{
			contactform.txt_shipFirstName.disabled = false
			contactform.txt_shipLastName.disabled = false
			contactform.txt_shipAddrFirst.disabled = false
			contactform.txt_shipAddrSecond.disabled = false
			contactform.txt_shipCity.disabled = false
			contactform.sel_shipStates.disabled = false
			contactform.txt_shipZipPre.disabled = false
			contactform.txt_shipZipPost.disabled = false
			contactform.txt_shipAreaCode.disabled = false
			contactform.txt_shipPhonePre.disabled = false
			contactform.txt_shipPhonePost.disabled = false
			contactform.txt_shipPhoneExt.disabled = false	
		}
		else
		{
			contactform.txt_shipFirstName.disabled = true
			contactform.txt_shipFirstName.value = ""
			contactform.txt_shipLastName.disabled = true
			contactform.txt_shipLastName.value = ""
			contactform.txt_shipAddrFirst.disabled = true
			contactform.txt_shipAddrFirst.value = ""
			contactform.txt_shipAddrSecond.disabled = true
			contactform.txt_shipAddrSecond.value = ""
			contactform.txt_shipCity.disabled = true
			contactform.txt_shipCity.value = ""
			contactform.sel_shipStates.disabled = true
			contactform.sel_shipStates.selectedIndex = 0
			contactform.txt_shipZipPre.disabled = true
			contactform.txt_shipZipPre.value = ""
			contactform.txt_shipZipPost.disabled = true
			contactform.txt_shipZipPost.value = ""
			contactform.txt_shipAreaCode.disabled = true
			contactform.txt_shipAreaCode.value = ""
			contactform.txt_shipPhonePre.disabled = true
			contactform.txt_shipPhonePre.value = ""
			contactform.txt_shipPhonePost.disabled = true
			contactform.txt_shipPhonePost.value = ""
			contactform.txt_shipPhoneExt.disabled = true
			contactform.txt_shipPhoneExt.value = ""			
		}
		return true
	}


function PopUpTL(mode, target)
{
    var desturl = "http://www.searsphotos.com/customercare_redirect.asp";

    if (target == "searsportrait")
       desturl = "http://www.searsphotos.com/customercare_redirect.asp";

    if (mode == "onload") {
       var srcurl = window.location.href;
       var i = srcurl.indexOf("?w=");
       if ( i == -1) 
          return;

       var w = srcurl.substr(i+3);   
       desturl += "&responder=XDetail&w=" + w;
    } 

    if (navigator.appName == "Netscape")
       window.open(desturl,"screenp","width=655,height=500,scrollbars=1,toolbar=1, resizable=1, menu=0,screenX=120,screenY=15");
    else if (navigator.appName == "Microsoft Internet Explorer")
       window.open(desturl,"screenp","width=655,height=500,scrollbars=1,toolbar=1, resizable=1, menu=0,left=120,top=15"); 
}

	
function SetNavigationLinks()
{
	var tag
	
	var bTagFormPresent
	bTagFormPresent = !((document.forms["TagForm"] == null))
	
	if (bTagFormPresent == true)
	{
		tag = document.forms["TagForm"].elements["tag"].value
	}
	else
	{
		tag = GetTagFromURL()	
	}
	
	var firstIndex
	firstIndex = document.forms["IndexForm"].elements["firstIndex"].value
	
	var lastIndex
	lastIndex = document.forms["IndexForm"].elements["lastIndex"].value

	for (var i = Number(firstIndex); i <= Number(lastIndex); i++)
	{
		addTagToHREF(tag, i)
	}
	
	return true
}
	
function GetTagFromURL()
{
	var URL
	URL = document.URL
	
	var tagIndex
	tagIndex = URL.indexOf("tag")
	
	if (tagIndex == -1)
	{
		return ""
	}
	else
	{
		return URL.substring(tagIndex + 4, tagIndex + 64 + 4)
	}
}


function addTagToHREF(tag, i)
{
	var tempString

	tempString =  document.anchors[i].name

	if (tempString.indexOf("javascript") == -1)
	{
		if (tag.length > 0)
		{
			if (tempString.indexOf("?") == -1)
			{
				tempString = tempString + "?tag=" + tag
			}
			else
			{
				tempString = tempString + "&tag=" + tag
			}
		}
		document.links[i].href = tempString
	}
	else
	{
		if (tempString.indexOf("javascript:location.replace('view_help.asp')") == -1)
		{
			document.links[i].href = tempString
		}
		else
		{
			document.links[i].href = "javascript:location.replace('view_help.asp?tag=" + tag + "')"
		}	
	}	
	return true	
}

function AddTagAndRedirect(pagename)
{
   location.href = pagename + GetQueryStringFromURL();
}

function AddTagAndRedirectToLocation(pagename, pagelocation)
{
   location.href = pagename + GetQueryStringFromURL() + pagelocation;
}

function RefreshUploadInputs()
{
   if (IsBrowserNS4())
      return;

   var select = document.forms["UploadImages"].elements["sel_UPLOAD"];
   var divDynamic = GetElementDiv("DynamicArea");

   ShowOrHideElement(true, "divDropDown");
   divDynamic.innerHTML = "";

   // if the first option (the default) is selected, don't add any more HTML 
   if (select.options[0].selected)
      return;

   // show each set of inputs, up through the one selected.
   for (var i = 1; i < select.options.length; i++)
   {
      divDynamic.innerHTML = divDynamic.innerHTML + GetElementDiv(select.options[i].value).innerHTML;

      if (select.options[i].selected)
         return;
   }
}

function GetElementDiv(elementDiv)
{
   // NS6 needs to use this one, but IE5.0 shouldn't
   if (IsBrowserNS6() && document.getElementsByTagName)
      return document.getElementsByTagName("*")[elementDiv];

   if (document.getElementById)
      return document.getElementById(elementDiv);
   else if (document.all)
      return document.all[elementDiv];
   else
      return document.layer[elementDiv];
}

function SetImageSrcByLoggedInStatus(bLoggedIn, imgName, srcLoggedIn, srcNotLoggedIn)
{
   var imgElement = GetElementDiv(imgName);

   if (bLoggedIn == "True")
       imgElement.src = srcLoggedIn;
   else
       imgElement.src = srcNotLoggedIn
}

