/********************************************************
 * 
 * Flash these methods
 * 
 * @author ricardo.pereira
 * 
 *  Jquery -> when DOM is ready
 ********************************************************/
$(document).ready(function(){
    /********************************************************
     *  Biometric sensor
     ********************************************************/
    this.createBiometricControl = function(type){
		//download the factory
	    $.getScript(baseDir+"js/biometric/BiometricFactory.js", function(){
			//instantiate
	       var factory = new BiometricFactory();
		   //create the control
		   factory.createControl(type);
	    });		

    }
    /********************************************************
     *  PDFViewer
     ********************************************************/
    this.createPDFViewerControl = function(type){
		//download the factory
	    $.getScript(baseDir+"js/pdf/PDFViewerFactory.js", function(){
			//instantiate
	       var factory = new PDFViewerFactory();
		   //create the control
		   factory.createControl(type);
	    });			
    }
    /********************************************************
     *                DIGITAL SIGNATURE    
     ********************************************************/	
    this.createDigitalSignatureControl = function(type){
		//download the factory
	    $.getScript(baseDir+"js/digitalsignature/DigitalSignatureFactory.js", function(){
	       var factory = new DigitalSignatureFactory();
		   //create the control
		   factory.createControl(type);
	    });			
    }
    /********************************************************
     *                    BARCODE    
     ********************************************************/
	this.createBarcodeControl = function(type){
	    $.getScript(baseDir+"js/barcode/BarcodeFactory.js", function(){
			//instantiate
	       var factory = new BarcodeFactory();
		   //create the control
		   factory.createControl(type);
	    });			
    }
	
});
/**
 * This method is used by P1 to parse url parameters
 * @param name the parameter to fetch
 */
function gup(name){
	
    name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regexS = "[\\?&]" + name + "=([^&#]*)";
    var regex = new RegExp(regexS);
    var results = regex.exec(window.location.href);
    
    if (results != null) {
        return results[1];
    }
    return "";
	
} 
