/**
 * makes an image to pulsate
 */
function opacityEffect (element_id, image_name, path, total, hidden_element)
{
    //show the hidden element (with a smaller z-index)
    jQuery('#' + hidden_element).fadeIn(4000);
    var name = image_name;
    //change image of hidden element and get the next image name
    image_name = changeImage(hidden_element, name, path, total);
    //hide the first image
    jQuery('#' + hidden_element).fadeOut(4000);
    //change images z-index~
    $(element_id).style.zIndex = "5";
    $(hidden_element).style.zIndex = "10";
    //call next effect
    setTimeout("opacityEffect('" + hidden_element + "', '" + image_name + "', '" + path + "', '" + total + "', '" + element_id + "')", 8000);
}

/**
 * changes the image of an element
 */
function changeImage (element_id, image_name, path, total)
{
    //change the image
    $(element_id).src = path + image_name;
    //get next image name
    var options = image_name.split('_');
    var extension = options[1].split('.');
    var image_id = parseFloat(extension[0]) + parseFloat(1);
    //if is the last image, then set first image name
    if (image_id > total)
    {
        image_id = 1;
    }
    //return image name
    return options[0] + "_" + image_id + "." + extension[1];
}

/**
 * changes the screen path and calls the screen
 */
function changeScreen (screen_path)
{
    var new_image = 'url(' + screen_path + ')';
    /*
    //add screen path
    $('banner_services').src = screen_path;
     //hides animation
    $('banner_image').hide();
    $('banner_image2').hide();
    //shows the screen
    $('banner_services').show();
    */
    //alert(screen_path);
    $('images').style.backgroundImage = new_image;

}

/**
 * shows the screen and shows the animation
 */
function hideScreen (screen_path)
{
    var new_image = 'url(' + screen_path + ')';
    /*
    //hides the screen
    $('banner_services').hide();
    //shows the animation
    $('banner_image').show();
    $('banner_image2').show();
    */
    $('images').style.backgroundImage = new_image;
}

function shakeEffect(id)
{
    jQuery('#' + id).effect("shake", { times:2, distance:8 }, 450);
    setTimeout("shakeEffect('" + id + "')",8000);
}
