function showInfo(title,site,link,artwork){
    $('#wait').hide()
    $("#form").append("<h3>"+title+"</h3><br>");
    $("#form").append("<a href='"+link+"'><img src='"+artwork +"'/></a><br>");
}

function showError(msg){
    $('#wait').hide()
    $("#form").append(msg+"<br><br>");
}
function addDownloadLink(typeDownload,ext,comment,link,title){
    $('#wait').hide()
    $("#form").append("<p><a href='"+link+"'>"+ext+ " " + comment+ "</p>");

}

function isUrl(s) {        
    var regexp = /(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
	return  regexp.test(s);
}

$(document).ready(function() {
    $('#type_url').click(function(){
        l = $('#link_url').val();
        if(l!=''){
            h = $(this).parent().attr('href');
            $(this).parent().attr('href',h+'?url='+l);
        }
    });
    $("#upload-form").submit(function(){
        if(!$('#accept_terms').attr('checked')){
            alert('Please accept terms of service')
            return false;
        }
        return true
    })
    $("#upload_submit").click(
        function(){

            if(!isUrl($('#link_url').val())){
                alert ("Please enter valid url");
                return false;
            }
            return $("#upload-form").submit();
        }
    );
});
