function prompt(message, link) {
  if(confirm(message)) {
    location.href=link;
  }
}

function help(id) {
    alert('Help coming soon!');
}

function comment(comment_id, name, comment) {
    $("#commentBox").show();
    if(comment_id == undefined) {
        comment_id = "";
    }
    if(name == undefined) {
        name = "";
    }
    if(comment == undefined) {
        comment = "";
    }
    document.forms['commentForm'].name.value = name;
    document.forms['commentForm'].comments.value = comment;
    document.forms['commentForm'].name.focus();
    document.forms['commentForm'].btnSubmit.value = "Save Comment";
    document.forms['commentForm'].comment_id.value = comment_id;
}

function theme(img, bc) {
    var swidth = screen.width;
    var sheight = screen.height;
    var popup = null; 
    var height = 300;
    var width = 300;
    var left = (swidth/2) - (width/2);
    var top = (sheight/2) - (height/2);
    var over = "Preview Theme";

    popup=window.open("","msg","scrollbars=yes,height="+height+",width="+width+",left="+left+",top="+top); 
    if (popup != null) { 
        if (popup.opener == null) { 
            popup.opener = self;     
        } 
        popup.location.href = img; 
    }  
}

function poll(id, siteID) {
    var swidth = screen.width;
    var sheight = screen.height;
    var popup = null; 
    var height = 300;
    var width = 400;
    var left = (swidth/2) - (width/2);
    var top = (sheight/2) - (height/2);
    var over = "Vote!";

    popup=window.open("","msg","scrollbars=yes,height="+height+",width="+width+",left="+left+",top="+top); 
    if (popup != null) { 
        if (popup.opener == null) { 
            popup.opener = self;     
        } 
        popup.location.href = "viewpoll.php?ID=" + id+"&siteID="+siteID
    }  
}

var secs;
var timerID = null;
var timerRunning = false;
var delay = 1000;
var extra = '';
var setSeconds = 0;
        
function InitializeTimer(seconds, e) {
    // Set the length of the timer, in seconds
    extra = e;
    secs = seconds
    setSeconds = seconds;
    StopTheClock()
    StartTheTimer(seconds)
}       
    
function StopTheClock() {
    if(timerRunning) {
        clearTimeout(timerID)
    }
    timerRunning = false;
}       
    
function StartTheTimer(seconds) {
    if (secs==0) {
        StopTheClock()
        // Here's where you put something useful that's
        // supposed to happen after the allotted time.
        // For example, you could display a message:
        window.location='/photos/slideshow/?refresh='+setSeconds;
    }       
    else {
        self.status = secs
        secs = secs - 1 
        timerRunning = true
        timerID = self.setTimeout("StartTheTimer()", delay)
    }
}


