﻿var manualEntry = 0;

function requestTickets(locationID) {
    var extra = "";
    
    if (manualEntry == 1)
        extra = "&manual_entry=true";

    loadWidgetForm("/site/WidgetForms/Forms/rallies3_tickets/rallies3_tickets.aspx?location=" + locationID + extra, 820, 100);
}

function volunteer(locationID) {
    loadWidgetForm("/shop/WidgetForms/Forms/rallies3_volunteer/rallies3_volunteer.aspx?location=" + locationID, 820, 100);
}

function pastorsBreakfast(locationID) {
    loadWidgetForm("/shop/WidgetForms/Forms/rallies3_breakfast/rallies3_breakfast.aspx?location=" + locationID, 820, 100);
}

function promoChoice() {
    if (promoIntervalID != -1)
        clearInterval(promoIntervalID);
        
    loadWidgetForm("/site/WidgetForms/Forms/rallies3_promote_choice/rallies3_promote_choice.aspx", 820, 100);
}

function tellAFriend(locationID) {
    loadWidgetForm("/site/WidgetForms/Forms/rallies3_tell_a_friend/rallies3_tell_a_friend.aspx?location=" + locationID, 820, 100);
}

function tellAFriendBreakfast(locationID) {
    loadWidgetForm("/site/WidgetForms/Forms/rallies3_tell_a_friend/rallies3_tell_a_friend.aspx?location=" + locationID + "&breakfast=true", 820, 100);
}

function loadTwitterFeed() {
    var xmlHttp;
    try {  // Firefox, Opera 8.0+, Safari 
        xmlHttp = new XMLHttpRequest(); 
    }
    catch (e) {  // Internet Explorer 
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");   
        }
        catch (e) {
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e) {
                alert("Your browser does not support AJAX!");
                return false;   
            }
        } 
    }
    
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4) {
            document.getElementById("twitter_feed_container").innerHTML = xmlHttp.responseText;
        }  
    }
 
    xmlHttp.open("post", "rallies3_twitter_ajaxAPI.aspx", true);
    xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
    xmlHttp.send(""); 
}

var promoIntervalID = -1;

function promoChoiceDelay() {   
    promoIntervalID = setInterval("promoChoice()", 100);
}
