function Weblink_Device(argType,argInfos){
	var that = this;
	if(!Weblink_Types.isValid(argType)) throw new InvalidDeviceException('Weblink_Type '+argType+' is not allowed');
	var Type = argType;
	var Firmware = new Weblink_Firmware();
	var setInfo = function(key,value){
		if(/firmware/.test(key) && Type != Weblink_Types.REMOTE_STARTER){
			Firmware[key] = value;
		} else {
			Infos[key] = value;
		}
	};

	this.firmware = Firmware;
	
	if(argInfos && typeof(argInfos)=='object'){
		
		var Infos = {};
		for(x in argInfos){
			setInfo(x,argInfos[x]);
		}
	} else {
		var Infos = {};
	}
	this.get = function(key){
		if(typeof(Infos[key])!="undefined"){
			return Infos[key];
		}
		return null;
	};
	this.getType = function(){
		return Type;
	};
	
	this.setInfos = function(key,value){
		if(typeof(key)=='object'){
			for(x in key){
				setInfo(x,key[x]);
			}
		} else {
			setInfo(key,value);
		}
	};
	this.alert = function(){
		alertX(Infos);
		alertX(Firmware);
	};
	this.getBlockSize = function(){
		switch(parseInt(that.get('BootLoader'))){
		case 1:
		case 15:
				return 64;
				break;
		case 2: case 3: case 9:
		case 16: case 17: case 25:
				return 128;
				break;
		case 4: case 5: case 6: case 7: case 8:
		case 10: case 11: case 12: case 13: case 14: case 18: case 19:
		case 20: case 21: case 22:
				return 256;
		}
	}
	this.getBlocks = function(v){
		var boot = that.get('BootLoader');
		if(that.getType() == Weblink_Types.REMOTE_STARTER) return 0;
		var Blocks = [];

		Blocks[1]=96;
		Blocks[2]=112;
		Blocks[3]=224;
		Blocks[4]=112;
		Blocks[5]=240;
		Blocks[6]=240;
		Blocks[7]=496;
		Blocks[8]=496;
		Blocks[9]=224;
		Blocks[10]=112;
		Blocks[11]=240;
		Blocks[12]=240;
		Blocks[13]=496;
		Blocks[14]=496;
		Blocks[15]=96;
		Blocks[16]=112;
		Blocks[17]=224;
		Blocks[18]=112;
		Blocks[19]=240;
		Blocks[20]=240;
		Blocks[21]=496;
		Blocks[22]=496;
		
		return Blocks[boot];
		
	};
	
	this.isStarter = function(){
		return (that.getType()==Weblink_Types.REMOTE_STARTER);	
	};
	this.isModule = function(){
		return (that.getType()&Weblink_Types.MODULE)!=0;	
	};
	this.isBlade = function(){
		return (that.getType()==Weblink_Types.BLADE_MODULE);
	};
}
