﻿ 
        function ResetTabIndex() {
            document.getElementById('home_ctl_txtName').tabIndex = 1;
            document.getElementById('home_ctl_txtEmail').tabIndex = 2;
            document.getElementById('home_ctl_txtComments').tabIndex = 3;
            document.getElementById('home_ctl_btnSend').tabIndex = 4;
            document.getElementById('home_ctl_btnCancel').tabIndex = 5;
        }
         
        function SendRegistration() {
            var eventIdField = document.getElementById('home_ctl_eventId');
            var name = document.getElementById('home_ctl_txtName');
            var email = document.getElementById('home_ctl_txtEmail');
            var comments = document.getElementById('home_ctl_txtComments');
            WebService.SaveReg(eventIdField.value, name.value, email.value, comments.value, SaveResult);
        }

        function SaveResult(result) {
            if (result == "true") {
                alert('You have been successfully registered!');
            } else {
                alert('There was an error saving your registration.  Sorry!');
            }
            
        }

        function ShowModalPopup(index) {
            WebService.GetSlideXml(index, DisplayResult);
        }

        function HideModalPopup() {
            var modal = $find('home_ctl_MPE1');
            modal.hide();
        }

        function DisplayResult(result) {
            var doc;
            if (window.ActiveXObject) {
                doc = new ActiveXObject("Microsoft.XMLDOM");
                doc.async = "false";
                doc.loadXML(result);
            }
            else {
                var parser = new DOMParser();
                var doc = parser.parseFromString(result, "text/xml");
            }

            var root = doc.documentElement.childNodes;
            var tags;

            for (var i = 0; i < root.length; i++) {
                if (root[i].nodeType == 1) {
                    tags = root[i].childNodes;
                }
            }

            for (var i = 0; i < tags.length; i++) {
                if (tags[i].childNodes[0] != null) {
                    var xmlvalue = tags[i].childNodes[0].nodeValue;
                    switch (tags[i].nodeName) {
                        case "EventId":
                            var eventIdField = document.getElementById('home_ctl_eventId');
                            eventIdField.value = xmlvalue;
                            break;
                        case "Url":
                            if (xmlvalue != "none") {
                                window.location = xmlvalue;
                            }
                            break;
                        case "Popup":
                            var popup = document.getElementById('home_ctl_popup');
                            if (xmlvalue != 'none') {
                                var modal = $find('home_ctl_MPE1');
                                modal.show();
                                popup.style.backgroundImage = "url('" + xmlvalue + "')";
                            }
                            break;
                        case "Signup":
                            if (xmlvalue == 'Yes') {
                                document.getElementById('home_ctl_btnSignUp').style.display = 'inline';
                            } else {
                                document.getElementById('home_ctl_btnSignUp').style.display = 'none';
                            }
                            break;
                    }
                }
            }
        } 
        
        function onBefore(curr, next, opts) {
            var index = $(this).parent().children().index(this);
            var obj1 = document.getElementById("home_ctl_rptSlides_ctl00_slideCell");
            var obj2 = document.getElementById("home_ctl_rptSlides_ctl01_slideCell");
            var obj3 = document.getElementById("home_ctl_rptSlides_ctl02_slideCell");
            var obj4 = document.getElementById("home_ctl_rptSlides_ctl03_slideCell");

            if (index == 0) {
                obj1.style.background = "#DCEAC7";
                obj2.style.background = "#FFFFFF";
                obj3.style.background = "#FFFFFF";
                obj4.style.background = "#FFFFFF";
            }

            if (index == 1) {
                obj1.style.background = "#FFFFFF";
                obj2.style.background = "#DCEAC7";
                obj3.style.background = "#FFFFFF";
                obj4.style.background = "#FFFFFF";
            }

            if (index == 2) {
                obj1.style.background = "#FFFFFF";
                obj2.style.background = "#FFFFFF";
                obj3.style.background = "#DCEAC7";
                obj4.style.background = "#FFFFFF";
            }

            if (index == 3) {
                obj1.style.background = "#FFFFFF";
                obj2.style.background = "#FFFFFF";
                obj3.style.background = "#FFFFFF";
                obj4.style.background = "#DCEAC7";
            }       
                
        }


