;
//jQuery.noConflict();
jQuery(document).ready(function() {

    jQuery("input#ctl00_searchTextBox").keyup(function(e) {
        if (e.keyCode == 13) {
            jQuery("#aspnetForm").submit();
        }
    });

    jQuery("input#ctl00_contentContentPlaceholder_searchPanel_ctl00_searchTextBox2").keyup(function(e) {
        if (e.keyCode == 13) {
            document.location = '/search/index.aspx?search=' + jQuery("input#ctl00_contentContentPlaceholder_searchPanel_ctl00_searchTextBox2").val();
            //jQuery("#aspnetForm").submit();
        }
    });

    jQuery(".rowhover tr").mouseover(function() {
        $(this).addClass("rowhoverover");
    }).mouseout(function() {
        $(this).removeClass("rowhoverover");
    });

    // hide videoplayer
    jQuery("[id^='videoPlayer-']").hide();

    // activate href style for current window location
    jQuery(".urlactivate").each(function() {
        if (this.href == window.location) {
            jQuery(this).addClass("active");
        }
    });

    // init accordion
    jQuery("[id^='jqaccordion-']").accordion({ alwaysOpen: false, active: true, animated: "bounceslide", header: "a.ac1-label" });
    jQuery('#tbcompare tbody tr:even').addClass('ctcolbg');
    
    
});

function previewImage(image) {
    tb_show("Preview",image,false);
}

function clearTextBox(id, deftext) {
    jQuery(id).val('');
}

function fillEmptyTextBox(id, text) {
    if (jQuery(id).val() == '') {
        jQuery(id).val(text);
    }
}

function TrackDownload ( filename ) {
	window.open("/download/tracker/"+filename, "Ventuz Download", "width=150,height=20,location=no,menubar=no,status=no,directories=no,scrollbars=no,toolbar=no");
}

function clearTrialRequestForm() {
    jQuery(".formcontrol").val('');
}

function TausenderTrenner(number) {
    
    number = '' + number;
    if (number.length > 3) {
        var mod = number.length % 3;
        var output = (mod > 0 ? (number.substring(0, mod)) : '');
        for (i = 0; i < Math.floor(number.length / 3); i++) {
            if ((mod == 0) && (i == 0))
                output += number.substring(mod + 3 * i, mod + 3 * i + 3);
            else
            // hier wird das Trennzeichen festgelegt mit '.'
                output += '.' + number.substring(mod + 3 * i, mod + 3 * i + 3);
        }
        return (output);
    }
    else return number;

}

// ******* FLASH PLAYER VARS AND INIT START **************
var flashvars = {};

flashvars.playerpath = "/download/flv";
flashvars.contentpath = "/download/flv/content";
flashvars.skin = "skin-applestyle.swf";
flashvars.autoscale = "false";
flashvars.videowidth = "300";
flashvars.videoheight = "225";
flashvars.debug = "false";
flashvars.wmode = "transparent";
flashvars.buttonOverlay = false;

var params = {};
params.scale = "noscale";
params.allowfullscreen = "false";
params.salign = "tl";

var playerVisible = false;
var currentmoviefile = '';

function startVideoPlayer(moviefile, playerid, pbgcolor, palign, pautoplay, forceplay, width, height) {
    
    if (playerid == '' | playerid == 'undefined') {
        playerid = 'videoPlayer';
    }

    if (pbgcolor == '' | pbgcolor == 'undefined') {
        pbgcolor = '#c1a0a7';
    }

    if (palign == 'undefined') {
        palign = '';
    }

    if (pautoplay == undefined) {
        pautoplay = 'true';
    }

    if (width == undefined) {
        width = 320;
    }

    if (height == undefined) {
        height = 200;
    }

    flashvars.autoplay = pautoplay;

    var attributes = {};
    attributes.align = palign;

    params.bgcolor = pbgcolor;
    // strip path information
    moviefile = moviefile.match(/[-_\w]+[.][\w]+$/i)[0];
    currentmoviefile = moviefile;
    
    if (!playerVisible | moviefile != currentmoviefile | forceplay != undefined) {
        currentmoviefile = moviefile;

        flashvars.video = moviefile;
        swfobject.embedSWF("/download/flv/flvplayer.swf", playerid, width, height, "9.0.28", "/download/flv/expressInstall.swf", flashvars, params, attributes);
        swfobject.addParam("wmode", "transparent");
        jQuery('#' + playerid).show(2000);
        playerVisible = true;
    }
    else {
        jQuery('#' + playerid).hide();
        flashvars.video = '';
        swfobject.embedSWF("/download/flv/flvplayer.swf", playerid, width, height, "9.0.28", "/download/flv/expressInstall.swf", flashvars, params, attributes);
        playerVisible = false;
        jQuery('#' + playerid).hide();
    }
}