
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 ');

    var rxp = new RegExp('('+ $("input[name=lookfor]:eq(0)").val() +')','i');

    $(".bookTitle").each(function() {
        var txt = $(this).html();
        if(this.nodeName == 'A') {
            $(this).html( txt.replace(rxp,"<span class='highlight1'>$1</span>"));
        }
        else {
            $(this).html( txt.replace(rxp,"<span class='highlight2'>$1</span>"));
        }
    });
});









