function update_captcha(id) {
    document.getElementById("captcha_" + id).innerHTML = "<div class=\"cap_holder\"><br \/><br \/>Updating image ...<br \/><\/div>";
    function update_captcha_callback(php_output) {
        document.getElementById("captcha_" + id).innerHTML = php_output;
    }
    x_ajax_captcha(id, update_captcha_callback);
}
function make_sure(message) {
    if (confirm(message)) {
        return true;
    }
    else {
        return false;
    }
}
function hide_help(div) {
    new Effect.Fade(div, {duration: 1});
}
function show_help2(div) {
    if (document.getElementById(div).style.display != 'none') {
        new Effect.BlindUp(div, {duration: 1});
    }
    else {
        new Effect.BlindDown(div, {duration: 1});
    }
}
function show_help(div) {
    new Effect.Appear(div, {duration: 1});
}
function show_content_preview() {
    document.getElementById("page_preview").style.display = 'block';
}
function hide_content_preview() {
    document.getElementById("page_preview").style.display = 'none';
}
function select_value(input, field, src) {
    document.getElementById(field).value = input;
    document.getElementById(src).innerHTML = '';
}
var delay = 1000;
var timerID = null;
var secs = 0;
var image_pass = 1;
function start_timer() {
    secs = secs + 1;
 //   if (intro == 1 && secs % 10 == 0 && secs > 0) {
//	if (intro == 1 && (secs == 3 || (secs + 3) % 10 == 0) && secs > 0 ) {
if (intro == 1 && (secs == 2 || secs % 10 == 0) && secs > 0) {
       image_pass++;
       rotate_images(image_pass)
       if (image_pass == 4) {
            image_pass = 0;
        }   
    } 
              timerID = self.setTimeout("start_timer()", delay)
}
function do_intro() {
        new Effect.Appear("intro_1", {duration: 1, delay: 1});
        new Effect.Appear("intro_2", {duration: 1, delay: 1.5});
        new Effect.Appear("intro_3", {duration: 1, delay: 2});
        new Effect.Appear("intro_4", {duration: 1, delay: 2.5});
        new Effect.Appear("intro_5", {duration: 1, delay: 3});
}

function rotate_images(image_pass) {
    /* IMAGE 1 */
    new Effect.Fade("image_1", {duration: 1, delay: 0, afterFinish: switch_image1}); // fade out
    function switch_image1() {
        document.getElementById("image_1").innerHTML = '<img src="/images/photo_1-' + image_pass + '.png" width="128" height="128" alt="photo" />'; // switch image
        new Effect.Appear("image_1", {duration: 1, delay: 0}); // fade back in
    }
    /* IMAGE 2 */
    new Effect.Fade("image_2", {duration: 1, delay: 1, afterFinish: switch_image2});
    function switch_image2() {
        document.getElementById("image_2").innerHTML = '<img src="/images/photo_3-' + image_pass + '.png" width="128" height="128" alt="photo" />';
        new Effect.Appear("image_2", {duration: 1, delay: 0});
    }
    /* IMAGE 3 */
    new Effect.Fade("image_3", {duration: 1, delay: 2, afterFinish: switch_image3});
    function switch_image3() {
        document.getElementById("image_3").innerHTML = '<img src="/images/photo_5-' + image_pass + '.png" width="128" height="128" alt="photo" />';
        new Effect.Appear("image_3", {duration: 1, delay: 0});
    }
    /* IMAGE 4 */
    new Effect.Fade("image_4", {duration: 1, delay: 3, afterFinish: switch_image4});
    function switch_image4() {
        document.getElementById("image_4").innerHTML = '<img src="/images/photo_7-' + image_pass + '.png" width="128" height="128" alt="photo" />';
        new Effect.Appear("image_4", {duration: 1, delay: 0});
    }
    /* IMAGE 5 */
    new Effect.Fade("image_5", {duration: 1, delay: 4, afterFinish: switch_image5});
    function switch_image5() {
        document.getElementById("image_5").innerHTML = '<img src="/images/photo_9-' + image_pass + '.png" width="128" height="128" alt="photo" />';
        new Effect.Appear("image_5", {duration: 1, delay: 0});
    }
}
function current_class(){
    document.getElementById('home_p').style.backgroundPosition = '0px 0px';
    document.getElementById('specials_p').style.backgroundPosition = '0px 0px';
    document.getElementById('contact_p').style.backgroundPosition = '0px 0px';
    document.getElementById('celebrate_p').style.backgroundPosition = '0px 0px';
    document.getElementById("search_p").style.backgroundPosition = '0px -59px';
}
function print_iframe(url){
    document.getElementById("content").innerHTML = '<iframe src="http://www.hooraypromos.com/' + url + '" style="width: 100%; height: 800px; border: none;"></iframe>';
}
