$(document).ready(function(){
    $("a.videoLink").hover(function(){
        $("span",$(this)).show("fast");
    }
    ,
    function(){
        $("span",$(this)).hide("fast");
    });
});

function checkFields(webSiteLinkAction) {
    var numberReg = /^[^-_0a-zA-Z][0-9]{1,4}$/;
    if( !numberReg.test($("[name=valueWidth]").val().toString()) ) {
        alert("Wrong width for video object!");
        $("[name=valueWidth]").focus();
        return false;
    }
    if( !numberReg.test($("[name=valueHeight]").val().toString()) ) {
        alert("Wrong height for video object!");
        $("[name=valueHeight]").focus();
        return false;
    }

    $("[name=agree]").attr("disabled","disabled");
    
    $.ajax({
        type: "POST",
        url: webSiteLinkAction,
        dataType: "json",
        data: {
            valueUrl:$("[name=valueLink]").val(),
            valueWidth:$("[name=valueWidth]").val(),
            valueHeight:$("[name=valueHeight]").val(),
            pageId:$("[name=pid]").val(),
            pName:$("[name=pname]").val()
        },
        success: function(msg){
            $("[name=agree]").removeAttr("disabled");
            parent.tb_remove();
            top.location.reload();
        },
        error: function(msgErr){
            $("[name=agree]").removeAttr("disabled");
            alert(msgErr);
        },
        timeout: 20000
    });

    return false;
}
