$(document).ready(function() {
    $("#embedLink").click(function () {
        $("#embedCodeBox").slideToggle();
        return false;    
    });
});

function generateEmbedCode(id) {

    var width = 640;
    var height = 480;
   
    
    $('#embedError').text("");
    
    if ($('#embedWidth').val().match(/^[0-9]+$/)) {
        width = $('#embedWidth').val();
    } else {
        $('#embedError').text("Bitte gültige Breite angeben.");
        return;
    }   
    
    if (width < 20) {
        $('#embedError').text("Die Breite ist zu klein.");
        return;
    }   
    
    if ($('#embedHeight').val().match(/^[0-9]+$/)) {
        height = $('#embedHeight').val();
    } else {
        $('#embedError').text("Bitte gültige Höhe angeben.");
        return;
    }

    if (height < 20) {
        $('#embedError').text("Die Höhe ist zu klein.");
        return;
    }   
    
$('#embedText').attr("value", '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+width+'" height="'+height+'" id="ifvideoplayer" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><param name="movie" value="http://www.spieletrailer.com/external/trailer/'+id+'" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="http://www.spieletrailer.com/external/trailer/'+id+'" quality="high" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="ifvideoplayer" align="middle" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');

}