/* -----------------------------------------------
   Floating layer - v.1
   (c) 2006 www.haan.net
   contact: jeroen@haan.net
   You may use this script but please leave the credits on top intact.
   Please inform us of any improvements made.
   When usefull we will add your credits.
  ------------------------------------------------ */

x = 20;
y = 70;
function setVisible(obj,e)
{
        //alert(e);

	obj = document.getElementById(obj);
	obj.style.visibility = (obj.style.visibility == 'visible') ? 'hidden' : 'visible';
        if(obj.style.visibility == 'visible')
        {
            obj.style.left = (window.innerWidth - obj.clientWidth)/2;
        }
}


$(document).ready(function() {

    $('#webshot').css('visibility','hidden');
    var imgSrc = $('#webshot').attr('src');

    // prepare Options Object for the form
    var options = {
        target:     '#webcite',
        url:        'WebAuthor.php',
        success:    function() {
           // alert('Thanks for your comment!');
            setVisible("layer1",null);
            return false;
        }
    };
    $('#authUpdate').ajaxForm(options);


    function img_loader() {
       $.ajax({
            url: imgSrc,
            type: 'HEAD',
            dataType: 'text',
            timeout: 1000,

            error: function(req, stat, err12){
                $('#webshot').attr('src',"/deadline-2s.gif");
            },

            success: function(){
                var img = new Image()
                img.src = imgSrc +"?aj";

                $('#webshot').replaceWith(img);
            }
        });
    }

    $('#webshot').error( function () {
            $('#webshot').attr('src',"/images/wait.gif");
            window.setTimeout(img_loader, 10000);
        }
    );

    $('#webshot').css('visibility','visible ');


});









