jqueryFlowplayer = function(options){
    var settings = jQuery.extend({
        flowPath: '', //Path a los archivos. Se configura en ajaxIndex.js
        playerName: 'FlowPlayer.swf',
        videoPath: '',//path a los vídeos. Se configura en ajaxIndex.js
        name: '',
        contentHolder: 'playerDiv',
        anchura: '',
        altura: ''
    }, options);
    this.created;//Si se ha podido insertar el vídeo
    this.identificador = 'flowplayer';
    settings.playerConfig = {
        autoRewind: true,
        useNativeFullScreen: true,
        showMenu: false,
        loop: false,
		videoFile: "'" + settings.videoPath + settings.videoFile + "'"
    };
    this.configString = "{";
    for (var key in settings.playerConfig) {
        this.configString += key + ': ' + settings.playerConfig[key] + ',';
    }
    this.configString = this.configString.substr(0, this.configString.length - 1)
    this.configString += "}";
    this.startVideo = function(videoName){
        var video = settings.videoPath + videoName;
        var config = settings.playerConfig;
        config.videoFile = video;
        document.getElementById(settings.name).setConfig(config);
    }
    
    var fo = new SWFObject(settings.flowPath + settings.playerName, settings.name, settings.anchura, settings.altura, "7", "#ffffff", true);
    // need this next line for local testing, it's optional if your swf is on the same domain as your html page	  	 
    fo.addParam("AllowScriptAccess", "always");
    fo.addParam("allowFullScreen", "true");
	fo.addVariable("config", this.configString);
  if (fo) {//Si se ha creado el player lo inserta
        fo.write(settings.contentHolder);
        this.created = true;
    } else {//Si no indica falso, par parar la carga de la página
        this.created = false;
    }
	this.stop =  function(){
		var player = document.getElementById(settings.name);
		if( player.DoStop ){
			player.DoStop();
		}
	}
    
}
