$(document).ready(function(){
    $('#successForm').animate({opacity: 0}, 1500,  function(){
        $('#successForm').hide();
         var websiteUrl = $('#websiteUrl').val();
         var url = $('#pageUrl').val();
         top.tb_remove();
         top.location.href=websiteUrl+url.toLowerCase()+'.html';
});

    $('#errorForm').animate({opacity: 0}, 3000,  function(){
        $('#errorForm').hide();
    });


});

function proccessUrl(url)
{
    var ltrim = /^\s+/g;
    var rtrim = /\s+$/g;

    url = url.replace(ltrim,'');
    url = url.replace(rtrim,'');
    if(url != '')
    {
        url = url+'.html';
        return replaceSpace(url,'-');
    }else
    {
        return false;
    }

}

function replaceSpace(str,delimiter)
{
    var trim = /\s+/g;
    return str.replace(trim,delimiter);
}

function hideMessages()
{
       $(".success").hide();
       $(".errors").hide();
}