/**
 * 
 */

 // Last pno is 303
 
 
//added Apr-19-2013 ask by Madhu to add this line.
Ext.Ajax.timeout = 30000;
//End
/* Added by SS */
var taccustmiRNA = null;
var custmiRNAPreAmp = null;
var unitQty = null;
var PgxInstruExtData = null;
var PgxTrainingExtData = null;
var PgxServiceExtData = null;
var PgxInstallInstrumentExtData = null;
var PgxSnpInstrumentExtData = null;
var PgxCnvInstrumentExtData = null;
var pgxOutputList = null;
var warningEMessageArray = [];
var FixedOpenArrayAccessories = null;
/*End*/
var CustomPlatingRec = null;
var CustomPlatingmiRNAOA = null;
var OpenArrayDisVal =  null;

var platesCardsModel = null;
var tubesModel = null;
var masterMixModel = null;
var copyModel = null;
var plusRNAModel = null;
var muteModel = null;
var tacTapHelper = null;
var experimentInfo = null;
var outputList = null;
var isSecondStepInitiated = false;
var region = null;
var currency = null;
var openArray = null;
var openArrayFixed = null;
var accessories = null;
var tsstable = null;
var managertable = null;
var tsstablemirna = null;
var managertablemirna = null;
var tsstabledigitalpcr = null;
var managertabledigitalpcr = null;
var genoTypeTubes = null;
var genoMasterMix = null;
var mirnaAssay = null;
var mirnaAccessories = null;
var copyrefassayModel = null;
var mirnaMasterMix = null;
var mirnaPreAmp = null;
var mirnaRT = null;
var needAllThese = {};
var currMode = "All";
var openarraydiscm = 0;
var pricelist = null;
var producturls = null;
var quantstudio = null;
var taqManArrayPlatesFixed = null;
var openarrayruntimes = null;
var copymastermixModel =null;
var cnvMasterMix = null;
var isIE7 = false;
var isIE8 = false;
var isIE9 = false;
var isIPad = false;
var detailspageinfo = null;
var chartDisplayed = false;
var activetabid = "stepone";
var defaultInstruemntID = 'QuantStudio'
var listOfInstrument = null;
var enableDetailPage = false;
var tubesMasterMix = null;
if (!window.console) console = {
        log: function () {}
};

var live 					= true;
var Development				= false;
var hostName				= location.hostname;
if(hostName == "p43"){	
	live 					= false;
	Development 			= true;	
}else{
	live 					= true;
	Development 			= false;	
}


function showLoading(status) {
    if (status) {
        if (isIE7) {
            Ext.get('loading').dom.className = 'visible';
        } else {
            //Ext.get('loading').removeCls('hidden');
            //Ext.get('loading').addCls('visible');
        }
    } else {
        if (isIE7) {
            Ext.get('loading').dom.className = 'hidden';
        } else {
            //Ext.get('loading').removeCls('visible');
            //Ext.get('loading').addCls('hidden');
        }
    }
}

function loadModel(modelType, modelUrl) {
    Ext.Ajax.request({
        url: modelUrl,
        async: (isIE7 ? false : true),
        success: function (response, opts) { 
            var modelData = Ext.decode(response.responseText);
            
			if (modelType == 'PriceList') {
				pricelist = buildModel(modelType, modelData);
				needAllThese.U = true;
			} else if (modelType == 'ProductURLs') {
				producturls = buildModel(modelType, modelData);
				needAllThese.V = true;
			} else if (modelType == 'listOfInstrument') {
				listOfInstrument = buildModel(modelType, modelData);
				needAllThese.Z = true;
			} else if( modelType == 'unitQtyModel'){
				unitQty = buildModel(modelType, modelData);
				needAllThese.AC = true;
			} else if (modelType == 'MirnaAccessories') {
				mirnaAccessories = buildModel(modelType, modelData);
				needAllThese.Q = true;
			}  else if (modelType == 'OpenArrayDisVal'){
				OpenArrayDisVal = buildModel(modelType, modelData);
				needAllThese.AO = true;
			} else if (modelType == 'maxTargetList') {
                maxTargetList = buildModel(modelType, modelData);
                needAllThese.AM = true;
            }
			
			
			if(getExperimentInfo('type') == "Gene Expression"){
				if (modelType == "Tubes") {
					tubesModel = buildModel(modelType, modelData);
					needAllThese.B = true;
				} else if (modelType == 'TacTapHelper') {
					tacTapHelper = buildModel(modelType, modelData);
					needAllThese.D = true;
				} else if (modelType == "PlatesCards") {
					platesCardsModel = buildModel(modelType, modelData); 
					needAllThese.A = true;
				} else if (modelType == "MasterMix") {
					masterMixModel = buildModel(modelType, modelData);
					needAllThese.C = true;
				} else if (modelType == 'QuantStudio') {
					quantstudio = buildModel(modelType, modelData);
					needAllThese.W = true;
				} else if (modelType == 'OpenArray') {
					openArray = buildModel(modelType, modelData);
					needAllThese.E = true;
				} else if (modelType == 'Accessories') {
					accessories = buildModel(modelType, modelData);
					needAllThese.F = true;
				} else if (modelType == 'TssTable') {
					tsstable = buildModel(modelType, modelData);
					needAllThese.G = true;
				} else if (modelType == 'OpenArrayRuntimes') {
					openarrayruntimes = buildModel(modelType, modelData);
					needAllThese.X = true;
				} else if (modelType == "Plusrna") {
					plusRNAModel = buildModel(modelType, modelData);
				} else if (modelType == 'OpenArrayFixed') {
					openArrayFixed = buildModel(modelType, modelData);
					needAllThese.M = true;
				}  else if (modelType == 'TaqManArrayPlatesFixed') {
					taqManArrayPlatesFixed = buildModel(modelType, modelData);
					needAllThese.Y = true;
				} else if (modelType == 'FixedOpenArrayAccessories') {
					FixedOpenArrayAccessories = buildModel(modelType, modelData);
					needAllThese.AN = true;
				} else if ( modelType =='CustommiRNACards'){
					taccustmiRNA = buildModel(modelType, modelData);
					needAllThese.AA = true;
				} else if (modelType == 'CNVMasterMix') {
					cnvMasterMix = buildModel(modelType, modelData);
					needAllThese.AL = true;
				}  else if (modelType == 'GenoMasterMix') {
					genoMasterMix = buildModel(modelType, modelData);
					needAllThese.O = true;
				} else if (modelType == 'TubesMasterMix') {
					tubesMasterMix = buildModel(modelType, modelData);
					needAllThese.AJ = true;
				} else if (modelType == 'QuantStudio') {
					quantstudio = buildModel(modelType, modelData);
					needAllThese.W = true;
				}  else if (modelType == 'MirnaPreAmp') {
					mirnaPreAmp = buildModel(modelType, modelData);
					needAllThese.T = true;
				} else if (modelType == 'MirnaRT') {
					mirnaRT = buildModel(modelType, modelData);
					needAllThese.S = true;
				}
			} else if(getExperimentInfo('type') == "miRNA"){
				if (modelType == "Tubes") {
					tubesModel = buildModel(modelType, modelData);
					needAllThese.B = true;
				} else if (modelType == 'Mirnaassay') {
					mirnaAssay = buildModel(modelType, modelData);
					needAllThese.P = true;
				} else if (modelType == 'MirnaMasterMix') {
					mirnaMasterMix = buildModel(modelType, modelData);
					needAllThese.R = true;
				} else if (modelType == 'MirnaRT') {
					mirnaRT = buildModel(modelType, modelData);
					needAllThese.S = true;
				} else if (modelType == 'MirnaPreAmp') {
					mirnaPreAmp = buildModel(modelType, modelData);
					needAllThese.T = true;
				} else if (modelType == 'QuantStudio') {
					quantstudio = buildModel(modelType, modelData);
					needAllThese.W = true;
				} else if (modelType == 'Accessories') {
					accessories = buildModel(modelType, modelData);
					needAllThese.F = true;
				} else if (modelType == 'TssTableMirna') {
					tsstablemirna = buildModel(modelType, modelData);
					needAllThese.I = true;
				} else if (modelType == 'OpenArrayRuntimes') {
					openarrayruntimes = buildModel(modelType, modelData);
					needAllThese.X = true;
				} else if( modelType == 'CustommiRNAPreAmp'){
					custmiRNAPreAmp = buildModel(modelType, modelData);
					needAllThese.AB = true;
				} else if (modelType == "MasterMix") {
					masterMixModel = buildModel(modelType, modelData);
					needAllThese.C = true;
				} else if ( modelType =='CustommiRNACards'){
					taccustmiRNA = buildModel(modelType, modelData);
					needAllThese.AA = true;
				} else if (modelType == 'CNVMasterMix') {
					cnvMasterMix = buildModel(modelType, modelData);
					needAllThese.AL = true;
				}  else if (modelType == 'GenoMasterMix') {
					genoMasterMix = buildModel(modelType, modelData);
					needAllThese.O = true;
				} else if (modelType == 'TubesMasterMix') {
					tubesMasterMix = buildModel(modelType, modelData);
					needAllThese.AJ = true;
				}
			} else if(getExperimentInfo('type') == "Genotyping"){ 
				if (modelType == 'GenoTypeTubes') {
					genoTypeTubes = buildModel(modelType, modelData);
					needAllThese.N = true;
				} else if (modelType == 'QuantStudio') {
					quantstudio = buildModel(modelType, modelData);
					needAllThese.W = true;
				}  else if (modelType == 'GenoMasterMix') {
					genoMasterMix = buildModel(modelType, modelData);
					needAllThese.O = true;
				} else if (modelType == 'OpenArrayRuntimes') {
					openarrayruntimes = buildModel(modelType, modelData);
					needAllThese.X = true;
				} else if (modelType == 'Accessories') {
					accessories = buildModel(modelType, modelData);
					needAllThese.F = true;
				} else if (modelType == 'FixedOpenArrayAccessories') {
					FixedOpenArrayAccessories = buildModel(modelType, modelData);
					needAllThese.AN = true;
				} else if (modelType == 'TssTable') {
					tsstable = buildModel(modelType, modelData);
					needAllThese.G = true;
				} else if (modelType == 'QuantStudio') {
					quantstudio = buildModel(modelType, modelData);
					needAllThese.W = true;
				}
			} else if(getExperimentInfo('type') == "Mutation Detection"){
				if (modelType == 'GenoTypeTubes') {
					genoTypeTubes = buildModel(modelType, modelData);
					needAllThese.N = true;
				} else if (modelType == "MutationDetection") {
					muteModel = buildModel(modelType, modelData);
					needAllThese.AR = true;
				} else if (modelType == 'GenoMasterMix') {
					genoMasterMix = buildModel(modelType, modelData);
					needAllThese.O = true;
				} else if (modelType == 'TubesMasterMix') {
					tubesMasterMix = buildModel(modelType, modelData);
					needAllThese.AJ = true;
				} else if (modelType == 'CNVMasterMix') {
					cnvMasterMix = buildModel(modelType, modelData);
					needAllThese.AL = true;
				} else if (modelType == 'QuantStudio') {
					quantstudio = buildModel(modelType, modelData);
					needAllThese.W = true;
				}
			} else if(getExperimentInfo('type') == "Copy Number"){
				if (modelType == "Copyrefassay") {
					copyrefassayModel = buildModel(modelType, modelData);
					needAllThese.AP = true;
				} else if (modelType == "Copy") {
					copyModel = buildModel(modelType, modelData);
					needAllThese.AQ = true;
				} else if (modelType == 'CNVMasterMix') {
					cnvMasterMix = buildModel(modelType, modelData);
					needAllThese.AL = true;
				} else if (modelType == 'QuantStudio') {
					quantstudio = buildModel(modelType, modelData);
					needAllThese.W = true;
				}
			} else if (getExperimentInfo("type") == "PGx"){
				if( modelType == 'PgxInstruExtraction'){
					PgxInstruExtData = buildModel(modelType, modelData);
					needAllThese.AD = true;
				} else if( modelType == 'PgxTraining'){
					PgxTrainingExtData = buildModel(modelType, modelData);
					needAllThese.AE = true;
				} else if( modelType == 'PgxInstallInstrument'){
					PgxInstallInstrumentExtData = buildModel(modelType, modelData);
					needAllThese.AF = true;
				} else if( modelType == 'PgxService'){
					PgxServiceExtData = buildModel(modelType, modelData);
					needAllThese.AG = true;
				} else if( modelType == 'PgxSnpInstrument'){
					PgxSnpInstrumentExtData = buildModel(modelType, modelData);
					needAllThese.AH = true;
				}  else if( modelType == 'PgxCnvInstrument'){
					PgxCnvInstrumentExtData = buildModel(modelType, modelData);
					needAllThese.AI = true;
				} else if (modelType == 'GenoTypeTubes') {
					genoTypeTubes = buildModel(modelType, modelData);
					needAllThese.N = true;
				} else if (modelType == 'GenoMasterMix') {
					genoMasterMix = buildModel(modelType, modelData);
					needAllThese.O = true;
				} else if (modelType == 'TssTable') {
					tsstable = buildModel(modelType, modelData);
					needAllThese.G = true;
				} else if (modelType == 'Accessories') {
					accessories = buildModel(modelType, modelData);
					needAllThese.F = true;
				} else if (modelType == 'OpenArrayRuntimes') {
					openarrayruntimes = buildModel(modelType, modelData);
					needAllThese.X = true;
				} else if (modelType == 'QuantStudio') {
					quantstudio = buildModel(modelType, modelData);
					needAllThese.W = true;
				} else if (modelType == "Copy") {
					copyModel = buildModel(modelType, modelData);
					needAllThese.AQ = true;
				} if (modelType == "Copyrefassay") {
					copyrefassayModel = buildModel(modelType, modelData);
					needAllThese.AP = true;
				} else if (modelType == "Copymastermix") {
					copymastermixModel = buildModel(modelType, modelData);
					 needAllThese.AK = true;
				}
			} 
			if (getExperimentInfo("isCPSoamiRNA")){
				if (modelType == 'CustomPlating') {
					CustomPlatingRec = buildModel(modelType, modelData);
					needAllThese.CMP = true;
				} else if (modelType == 'CustomPlatingmiRNAOA') {
					CustomPlatingmiRNAOA = buildModel(modelType, modelData);
					needAllThese.CMO = true;
				} else if (modelType == 'Mirnaassay') {
					mirnaAssay = buildModel(modelType, modelData);
					needAllThese.P = true;
				} else if (modelType == 'TacTapHelper') {
					tacTapHelper = buildModel(modelType, modelData);
					needAllThese.D = true;
				}  else if (modelType == "PlatesCards") {
					platesCardsModel = buildModel(modelType, modelData); 
					needAllThese.A = true;
				} else if (modelType == 'Accessories') {
					accessories = buildModel(modelType, modelData);
					needAllThese.F = true;
				} else if (modelType == 'MirnaRT') {
					mirnaRT = buildModel(modelType, modelData);
					needAllThese.S = true;
				} else if (modelType == 'MirnaPreAmp') {
					mirnaPreAmp = buildModel(modelType, modelData);
					needAllThese.T = true;
				} else if (modelType == 'OpenArrayRuntimes') {
					openarrayruntimes = buildModel(modelType, modelData);
					needAllThese.X = true;
				} else if (modelType == 'QuantStudio') {
					quantstudio = buildModel(modelType, modelData);
					needAllThese.W = true;
				}
			}
			
        },
        failure: function (response, opts) {
            if(response.status == 0){
				console.log(modelUrl);
				console.log("JSON not loaded");
				//alert('The Tool does not load properly due to slow network connection.  It will re-load now.');
				//location.reload(true);
			}			
        }
    });
}

function haveEverythingNeeded() {
    //return needAllThese.A && needAllThese.B && needAllThese.C && needAllThese.D && needAllThese.E && needAllThese.F && needAllThese.G && needAllThese.H && needAllThese.I && needAllThese.J && needAllThese.K && needAllThese.L && needAllThese.M && needAllThese.N && needAllThese.O && needAllThese.P && needAllThese.Q && needAllThese.R && needAllThese.S && needAllThese.T && needAllThese.U && needAllThese.V && needAllThese.W && needAllThese.X && needAllThese.Y && needAllThese.AD && needAllThese.AE && needAllThese.AF && needAllThese.AG && needAllThese.AH && needAllThese.AI && needAllThese.AJ && needAllThese.AK && needAllThese.AL && needAllThese.AM && needAllThese.AN && needAllThese.CMP && needAllThese.CMO && needAllThese.AO;	
	
		
	if(getExperimentInfo('type') == "Gene Expression"){
		return needAllThese.B && needAllThese.D && needAllThese.A && needAllThese.C && needAllThese.W && needAllThese.F && needAllThese.G && needAllThese.X && needAllThese.M && needAllThese.Y && needAllThese.AN && needAllThese.AA && needAllThese.U && needAllThese.V && needAllThese.AL &&  needAllThese.O && needAllThese.AJ && needAllThese.AO && needAllThese.Q && needAllThese.W ;
	} else if(getExperimentInfo('type') == "miRNA"){
		return needAllThese.B && needAllThese.P && needAllThese.R && needAllThese.S && needAllThese.T && needAllThese.W && needAllThese.F && needAllThese.I && needAllThese.X && needAllThese.AB && needAllThese.C && needAllThese.AA && needAllThese.Q && needAllThese.AL && needAllThese.AJ && needAllThese.O;
	} else if(getExperimentInfo('type') == "Genotyping"){ 
		return needAllThese.N && needAllThese.W && needAllThese.O && needAllThese.X && needAllThese.F && needAllThese.AN && needAllThese.G && needAllThese.AO && needAllThese.Q && needAllThese.W;
	} else if(getExperimentInfo('type') == "Mutation Detection"){
		return needAllThese.N && needAllThese.O && needAllThese.U && needAllThese.V && needAllThese.AJ && needAllThese.AL && needAllThese.Z && needAllThese.AC && needAllThese.Q && needAllThese.W && needAllThese.AR;
	} else if(getExperimentInfo('type') == "Copy Number"){
		return needAllThese.AL && needAllThese.U && needAllThese.V && needAllThese.AP && needAllThese.AQ && needAllThese.Z && needAllThese.AC && needAllThese.Q && needAllThese.W;
	} else if (getExperimentInfo("type") == "PGx"){
		return needAllThese.AD && needAllThese.AE && needAllThese.AF && needAllThese.AG && needAllThese.AH && needAllThese.AI && needAllThese.N && needAllThese.O && needAllThese.G && needAllThese.F && needAllThese.X && needAllThese.W && needAllThese.AQ && needAllThese.AP && needAllThese.AK;
	} 
	if (getExperimentInfo("isCPSoamiRNA")){
		return needAllThese.CMP && needAllThese.CMO && needAllThese.P && needAllThese.D && needAllThese.A && needAllThese.F && needAllThese.S && needAllThese.T && needAllThese.Q && needAllThese.X && needAllThese.W;
	}
	
} 

function loadModels() {
	//loadModel('PriceList', 'data/pricelist.json');
   /* loadModel('PlatesCards', 'data/plates_cards.json');
    loadModel('Tubes', 'data/tubes.json');
    loadModel('Copy', 'data/copy.json');   
    loadModel('OpenArray', 'data/openarray.json');   
    loadModel('OpenArrayFixed', 'data/openarrayfixed.json');
    loadModel('Accessories', 'data/accessories.json');
    loadModel('GenoTypeTubes', 'data/genotypetubes.json');   
    loadModel('MutationDetection', 'data/mutationdetection.json');   
    loadModel('ProductURLs', 'data/producturls.json');
    loadModel('QuantStudio', 'data/quantstudio.json');
	
	delayjsonloading();
		
    startWatching();*/
	if(getExperimentInfo('type') == "Gene Expression"){
		loadGeneExpJson();
	} else if(getExperimentInfo('type') == "miRNA"){
		loadMirnaJson();
	} else if(getExperimentInfo('type') == "Genotyping"){
		loadGenotypingJson();
	} else if(getExperimentInfo('type') == "Copy Number"){
		loadCNVJson();
	} else if(getExperimentInfo('type') == "Mutation Detection"){
		loadMutationDetJson();
	} else if (getExperimentInfo("type") == "PGx"){
		loadPGXJson();
	} 
	if (getExperimentInfo("isCPSoamiRNA")){
		loadCPSJson();
	}
}

function delayjsonloading(){
	loadModel('copyrefassayModel', 'data/copyrefassay.json');
    loadModel('Copymastermix', 'data/copymastermix.json');
    loadModel('CNVMasterMix', 'data/cnvmastermix.json');
    loadModel('MasterMix', 'data/mastermix.json');
    loadModel('TacTapHelper', 'data/tactaphelper.json');
	loadModel('TssTable', 'data/tsstable.json');
    loadModel('ManagerTable', 'data/managertable.json');
    loadModel('TssTableMirna', 'data/tsstablemirna.json');
    loadModel('ManagerTableMirna', 'data/managertablemirna.json');
    loadModel('ManagerTableDigitalPcr', 'data/managertabledigitalpcr.json');
    loadModel('TssTableDigitalPcr', 'data/tsstabledigitalpcr.json');
	loadModel('GenoMasterMix', 'data/genomastermix.json');
    loadModel('Mirnaassay', 'data/mirnaassay.json');
    loadModel('Plusrna', 'data/plusrna.json');
	loadModel('MirnaAccessories', 'data/mirnaaccessories.json');
    loadModel('MirnaRT', 'data/mirnaRT.json');
    loadModel('MirnaPreAmp', 'data/mirnapreamp.json');
    loadModel('MirnaMasterMix', 'data/mirnamastermix.json');
	loadModel('OpenArrayRuntimes', 'data/openarrayruntimes.json');
    loadModel('listOfInstrument', 'data/instrument.json');
	loadModel('TaqManArrayPlatesFixed', 'data/arrayplatesfixed.json');
	loadModel('CustommiRNACards', 'data/mirnaCUST.json');
	loadModel('CustommiRNAPreAmp', 'data/mirnacustpreamp.json');
	loadModel('unitQtyModel', 'data/units.json');
	loadModel('PgxInstruExtraction', 'data/pgxinstruextraction.json');
	loadModel('PgxTraining', 'data/pgxtraining.json');
	loadModel('PgxInstallInstrument', 'data/pgxinstallationinstrument.json');
	loadModel('PgxService', 'data/pgxservice.json');
	loadModel('PgxSnpInstrument', 'data/pgxsnpinstruments.json');
	loadModel('PgxCnvInstrument', 'data/pgxcnvinstruments.json');
	loadModel('TubesMasterMix', 'data/tubesmastermix.json');
	loadModel('maxTargetList', 'data/maxTargetList.json');
	loadModel('FixedOpenArrayAccessories', 'data/FixedOpenArrayAccessories.json');
	loadModel('CustomPlating', 'data/CustomPlatingModel.json');
	loadModel('CustomPlatingmiRNAOA', 'data/mirnaCPSOA.json');
	loadModel('OpenArrayDisVal', 'data/discoutValueList.json');
}

function loadGenotypingJson(){
	
	if( genoTypeTubes == null ) loadModel('GenoTypeTubes', 'data/genotypetubes.json'); 
	if( quantstudio == null ) loadModel('QuantStudio', 'data/quantstudio.json');
	if( genoMasterMix == null ) loadModel('GenoMasterMix', 'data/genomastermix.json');
	if( accessories == null ) loadModel('Accessories', 'data/accessories.json');
	if( openarrayruntimes == null ) loadModel('OpenArrayRuntimes', 'data/openarrayruntimes.json');
	if( FixedOpenArrayAccessories == null ) loadModel('FixedOpenArrayAccessories', 'data/FixedOpenArrayAccessories.json');
	if( tsstable == null ) loadModel('TssTable', 'data/tsstable.json');
	if( mirnaAccessories == null ) loadModel('MirnaAccessories', 'data/mirnaaccessories.json');
	
	startWatching()
}

function loadGeneExpJson(){
	if( tubesModel == null ) loadModel('Tubes', 'data/tubes.json');
	if( tacTapHelper == null ) loadModel('TacTapHelper', 'data/tactaphelper.json');
	if( platesCardsModel == null ) loadModel('PlatesCards', 'data/plates_cards.json');
	if( masterMixModel == null ) loadModel('MasterMix', 'data/mastermix.json');
	if( quantstudio == null ) loadModel('QuantStudio', 'data/quantstudio.json');
	if( openArray == null ) loadModel('OpenArray', 'data/openarray.json'); 
	if( accessories == null ) loadModel('Accessories', 'data/accessories.json');
	if( tsstable == null ) loadModel('TssTable', 'data/tsstable.json');
	if( openarrayruntimes == null ) loadModel('OpenArrayRuntimes', 'data/openarrayruntimes.json');
	if( plusRNAModel == null ) loadModel('Plusrna', 'data/plusrna.json');
	if( openArrayFixed == null ) loadModel('OpenArrayFixed', 'data/openarrayfixed.json');
	if( taqManArrayPlatesFixed == null ) loadModel('TaqManArrayPlatesFixed', 'data/arrayplatesfixed.json');
	if( FixedOpenArrayAccessories == null ) loadModel('FixedOpenArrayAccessories', 'data/FixedOpenArrayAccessories.json');
	if( taccustmiRNA == null ) loadModel('CustommiRNACards', 'data/mirnaCUST.json');
	if( genoMasterMix == null ) loadModel('GenoMasterMix', 'data/genomastermix.json');
	if( cnvMasterMix == null ) loadModel('CNVMasterMix', 'data/cnvmastermix.json');
	if( tubesMasterMix == null ) loadModel('TubesMasterMix', 'data/tubesmastermix.json');
	if( mirnaAccessories == null ) loadModel('MirnaAccessories', 'data/mirnaaccessories.json');
	if( mirnaPreAmp == null ) loadModel('MirnaPreAmp', 'data/mirnapreamp.json');
	if( mirnaRT == null ) loadModel('MirnaRT', 'data/mirnaRT.json');
	
	startWatching();
}

function loadCNVJson(){
	
	if( copyrefassayModel == null ) loadModel('Copyrefassay', 'data/copyrefassay.json');
	if( copyModel == null) loadModel('Copy', 'data/copy.json');
	if( cnvMasterMix == null ) loadModel('CNVMasterMix', 'data/cnvmastermix.json');
	if( mirnaAccessories == null ) loadModel('MirnaAccessories', 'data/mirnaaccessories.json');
	if( quantstudio == null ) loadModel('QuantStudio', 'data/quantstudio.json');
	
	startWatching();
}

function loadMutationDetJson(){
	if(genoTypeTubes == null) loadModel('GenoTypeTubes', 'data/genotypetubes.json'); 
	if(muteModel == null) loadModel('MutationDetection', 'data/mutationdetection.json'); 
	if(genoMasterMix == null) loadModel('GenoMasterMix', 'data/genomastermix.json');
	if(cnvMasterMix == null) loadModel('CNVMasterMix', 'data/cnvmastermix.json');
	if(tubesMasterMix == null) loadModel('TubesMasterMix', 'data/tubesmastermix.json');
	if(mirnaAccessories == null) loadModel('MirnaAccessories', 'data/mirnaaccessories.json');
	if(quantstudio == null) loadModel('QuantStudio', 'data/quantstudio.json');
	
	startWatching();
}

function loadMirnaJson(){
	if( tubesModel == null ) loadModel('Tubes', 'data/tubes.json');
	if( mirnaAssay == null ) loadModel('Mirnaassay', 'data/mirnaassay.json');
	if( mirnaMasterMix == null ) loadModel('MirnaMasterMix', 'data/mirnamastermix.json');
	if( mirnaRT == null ) loadModel('MirnaRT', 'data/mirnaRT.json');
	if( mirnaPreAmp == null ) loadModel('MirnaPreAmp', 'data/mirnapreamp.json');
	if( quantstudio == null ) loadModel('QuantStudio', 'data/quantstudio.json');
	if( accessories == null ) loadModel('Accessories', 'data/accessories.json');
	if( tsstablemirna == null ) loadModel('TssTableMirna', 'data/tsstablemirna.json');
	if( mirnaAccessories == null ) loadModel('MirnaAccessories', 'data/mirnaaccessories.json');
	if( openarrayruntimes == null ) loadModel('OpenArrayRuntimes', 'data/openarrayruntimes.json');
	if( custmiRNAPreAmp == null ) loadModel('CustommiRNAPreAmp', 'data/mirnacustpreamp.json');
	if( masterMixModel == null ) loadModel('MasterMix', 'data/mastermix.json');
	if( taccustmiRNA == null ) loadModel('CustommiRNACards', 'data/mirnaCUST.json');
	if( genoMasterMix == null ) loadModel('GenoMasterMix', 'data/genomastermix.json');
	if( cnvMasterMix == null ) loadModel('CNVMasterMix', 'data/cnvmastermix.json');
	if( tubesMasterMix == null ) loadModel('TubesMasterMix', 'data/tubesmastermix.json');
	
	startWatching();
}

function loadPGXJson(){	
	if( PgxInstruExtData == null ) loadModel('PgxInstruExtraction', 'data/pgxinstruextraction.json');
	if( PgxTrainingExtData == null ) loadModel('PgxTraining', 'data/pgxtraining.json');
	if( PgxInstallInstrumentExtData == null ) loadModel('PgxInstallInstrument', 'data/pgxinstallationinstrument.json');
	if( PgxServiceExtData == null ) loadModel('PgxService', 'data/pgxservice.json');
	if( PgxSnpInstrumentExtData == null ) loadModel('PgxSnpInstrument', 'data/pgxsnpinstruments.json');
	if( PgxCnvInstrumentExtData == null ) loadModel('PgxCnvInstrument', 'data/pgxcnvinstruments.json');
	if( genoTypeTubes == null ) loadModel('GenoTypeTubes', 'data/genotypetubes.json');
	if( genoMasterMix == null ) loadModel('GenoMasterMix', 'data/genomastermix.json');
	if( tsstable == null ) loadModel('TssTable', 'data/tsstable.json');
	if( accessories == null ) loadModel('Accessories', 'data/accessories.json');
	if( openarrayruntimes == null ) loadModel('OpenArrayRuntimes', 'data/openarrayruntimes.json');
	if( quantstudio == null ) loadModel('QuantStudio', 'data/quantstudio.json');
	if( copyModel == null) loadModel('Copy', 'data/copy.json');
	if( copyrefassayModel == null ) loadModel('Copyrefassay', 'data/copyrefassay.json');
	if( copymastermixModel == null ) loadModel('Copymastermix', 'data/copymastermix.json');
	
	startWatching();
}

function loadCPSJson(){
	if( CustomPlatingRec == null ) loadModel('CustomPlating', 'data/CustomPlatingModel.json');
	if( CustomPlatingmiRNAOA == null ) loadModel('CustomPlatingmiRNAOA', 'data/mirnaCPSOA.json');
	if( mirnaAssay == null ) loadModel('Mirnaassay', 'data/mirnaassay.json');
	if( tacTapHelper == null ) loadModel('TacTapHelper', 'data/tactaphelper.json');
	if( platesCardsModel == null ) loadModel('PlatesCards', 'data/plates_cards.json');
	if( accessories == null ) loadModel('Accessories', 'data/accessories.json');
	if( mirnaRT == null ) loadModel('MirnaRT', 'data/mirnaRT.json');
	if( mirnaPreAmp == null ) loadModel('MirnaPreAmp', 'data/mirnapreamp.json');
	if( mirnaAccessories == null ) loadModel('MirnaAccessories', 'data/mirnaaccessories.json');
	if( openarrayruntimes == null ) loadModel('OpenArrayRuntimes', 'data/openarrayruntimes.json');
	if( quantstudio == null ) loadModel('QuantStudio', 'data/quantstudio.json');
	
	startWatching();
}

function startWatching() {
    if ( !haveEverythingNeeded() ) {
        setTimeout(startWatching, 300);
        return;
    }
    everythingIsLoaded();
}

function haveEverythingNeededCSPlating(){
	return needAllThese.CMP;
}



function everythingIsLoaded() {
    if (isSecondStepInitiated == true && getExperimentInfo("IsPGX") != "PGx" ) {
        showLoading(false);
		if( getExperimentInfo("isCustomPlatingCalc") ){
			showSecondStepCsPlating();			
		}else{
			startSecondStep();			
		}
    }
	if( getExperimentInfo("IsPGX") == "PGx" && (gup('ispgx') ==null || gup('ispgx') =='')){
		stratPGxSecondStep();
	}
    showLoading(false);
}

function getUrlParameter(sParam) {
	var sPageURL = window.location.search.substring(1);
	var sURLVariables = sPageURL.split('&');
	for (var i = 0; i < sURLVariables.length; i++) 
	{
		var sParameterName = sURLVariables[i].split('=');
		if (sParameterName[0] == sParam) 
		{
			return sParameterName[1];
		}
	}
} 

// Load pgx app from url values
function loadPgxFromUrlParam(){
	if((gup('param1') != null && gup('param1') != "") && (gup('param2') != null && gup('param2') != "") && (gup('param3') != null && gup('param3') != "") && (gup('param4') != null && gup('param4') != "") && (gup('param5') != null && gup('param5') != "") && ((gup('param6') != null && gup('param6') != "")) && ((gup('param7') != null && gup('param7') != "")) && ((gup('param8') != null && gup('param8') != "")) && ((gup('param9') != null && gup('param9') != "")) && ((gup('param10') != null && gup('param10') != "")) && ((gup('param11') != null && gup('param11') != "")) && ((gup('ispgx') != null && gup('ispgx') != ""))){
			
			Ext.get('pgxbtn').addCls('pgxtbuttonselected');
			
			stratPGxSecondStep();			
			
			pgxsamplecomboxoption('pgxsamplecombobox','','');
			pgxsamplecomboxoption('pgxsnpopenarrayformat','','');
			pgxsamplecomboxoption('pgxcnainstruments','','');
			pgxsamplecomboxoption('pgxintallation_installneed','', '');
			pgxsamplecomboxoption('pgxintallation_maintenance','','');
			pgxsamplecomboxoption('pgxintallation_addtraining','', '');
			pgxsamplecomboxoption('pgx_delivery_methodcombo','', '');
			//pgxsamplecomboxoption('pgxsnpformatneed','', 'ALL');
			pgxsamplecomboxoption('pgxcnainstrumentsneedtouse','', '');
			pgxsamplecomboxoption('pgxsnpassaytype','', '');
			pgxsamplecomboxoption('pgxcnvassaytype','', '');
	
			Ext.get('no_of_pgxsamples').dom.value = gup('param1');
			Ext.get('pgxsamplecombobox').dom.value = gup('param2');
			$("#calcreagents").html(gup('param2'));
			Ext.get('no_of_reagentsmonths').dom.value = gup('param3');
			//Ext.get('no_of_pgxsamples').dom.value = gup('param4');
			Ext.get('pgxsnpopenarrayformat').dom.value = gup('param5').replace("%20"," ");
			Ext.get('pgxsnpformatneed').dom.value = gup('param6').replace("%20"," ");
			Ext.get('pgxsnpreplicates').dom.value = gup('param7');
			Ext.get('pgxcnasample').dom.value = gup('param8');
			Ext.get('pgxcnainstruments').dom.value = gup('param9').replace("%20"," ");
			Ext.get('pgxcnainstrumentsneedtouse').dom.value = gup('param10').replace("%20"," ");
			Ext.get('pgxcnvassaytype').dom.value = gup('param11').replace("%20"," ");
			if(gup('param12') != "" && gup('param12') != null){				
				Ext.get('pgxsnpassaytype').dom.value = gup('param12').replace("%20"," ");
			}
			if(gup('param13') != "" && gup('param13') != null){				
				Ext.get('pgxsnpsample').dom.value = gup('param13').replace("%20"," ");
			}
			if(gup('param14') != "" && gup('param14') != null){				
				Ext.get('pgxdnavalues').dom.value = gup('param14').replace("%20"," ");
			}
			if(gup('param15') != "" && gup('param15') != null){				
				Ext.get('pgxsnpqsoavalue').dom.value = gup('param15').replace("%20"," ");
			}
			if(gup('param16') != "" && gup('param16') != null){				
				Ext.get('pgxsnpaccufillvalue').dom.value = gup('param16').replace("%20"," ");
			}
			if(gup('param17') != "" && gup('param17') != null){				
				Ext.get('pgxcnanoofinstruments').dom.value = gup('param17').replace("%20"," ");
			}
			
			if(gup('param4').replace("%20"," ") == "Reagents only"){
				 Ext.get('generateQuoteFor1').dom.checked = true;
			} else {
				Ext.get('generateQuoteFor2').dom.checked = true;
			}
			updateExperimentInfo("generateQuoteFor", gup('param4').replace("%20"," ")); 
			quoteForReagent();
			
			
			$('#currency').empty()
			updateExperimentInfo("isCustomPlatingCalc",false);
			addZoneCurrencies(gup('region'));
			
			if($("#ReferralMenu").hasClass('tabAcitive')){
				Ext.get('pgxcurnandcalbtn').addCls('hidden').removeCls('visible');						
			} else{
				Ext.get('pgxcurnandcalbtn').addCls('visible').removeCls('hidden');	
				Ext.get('currencydivpop').addCls('visible').removeCls('hidden');
			}
			Ext.get('selectInstrumentDrpdwn').addCls('hidden').removeCls('visible');
			//Ext.get('viewTab').addCls('hidden').removeCls('visible');  // hiding referel tab menu for PGx
				
			/*custom-Plating*/
			
			Ext.get('CustomPlateProcess').addCls('hidden');
			Ext.get('CustomPlateProcess').removeCls('visible');
			/*end*/
			
			Ext.get('pgxtabbarTab3').addCls('hidden');
			Ext.get('pgxtabbarTab3').removeCls('visible');
			
			
        	Ext.get('tabbar').removeCls('visible');
        	Ext.get('tabbar').addCls('hidden');
        	
        	Ext.get('pgxtabbar').removeCls('hidden');
        	Ext.get('pgxtabbar').addCls('visible');
        	
        	//tochangecurrencycombobox(selectObj); //pgxcurrency
			
        	Ext.get('select_species').removeCls('visible');
			Ext.get('speciesselector').removeCls('visible');
			Ext.get('digitalQS3DCombo').removeCls('visible');
			Ext.get('inputsforApplications').removeCls('visible');
			Ext.get('DesiredFormat').removeCls('visible');
			Ext.get('curnandcalbtn').removeCls('visible');
			
			Ext.get('select_species').addCls('hidden');
    		Ext.get('speciesselector').addCls('hidden');
			Ext.get('digitalQS3DCombo').addCls('hidden');
			Ext.get('inputsforApplications').addCls('hidden');
			Ext.get('DesiredFormat').addCls('hidden');
			Ext.get('curnandcalbtn').addCls('hidden');
			
			
			
			Ext.get('consumablesection').removeCls('visible');
			Ext.get('consumablesection').addCls('hidden');
			
			Ext.get('ChemistryDiv').addCls('hidden');
			Ext.get('ChemistryDiv').removeCls('visible');
			
			Ext.get('preAmpParnt').addCls('hidden');
			Ext.get('preAmpParnt').removeCls('visible');
			$('.chemCompl').css('background','none');
			
			Ext.get('PGxProcess').removeCls('hidden');
			Ext.get('PGxProcess').addCls('visible');
			
		}
}		

Ext.onReady(function () {
	loadModel('PriceList', 'data/pricelist.json');
	loadModel('ProductURLs', 'data/producturls.json');
	loadModel('OpenArrayDisVal', 'data/discoutValueList.json');
	loadModel('listOfInstrument', 'data/instrument.json');
	loadModel('unitQtyModel', 'data/units.json');
	loadModel('MirnaAccessories', 'data/mirnaaccessories.json');
	loadModel('maxTargetList', 'data/maxTargetList.json');
	//loadModels();
	//Parse.$ = jQuery;
//	Parse.initialize("oJbzfSxiYPLdCsKbITDUaljJoLCAX67e94j5fh0F", "c6OtiZwy6satErYfkdiHCfZSJ5aHHDjwOIJhIowP");
		
    if (navigator.appVersion.indexOf("MSIE 7.") != -1) {
        isIE7 = true;
    }
    if (navigator.appVersion.indexOf("MSIE 8.") != -1) {
        isIE8 = true;
    }
    if (navigator.appVersion.indexOf("MSIE 9.") != -1) {
        isIE9 = true;
    }
    if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
        isIPad = true;
    }
    if (isIE9 || isIE7 || isIE8) {
        //Ext.MessageBox.alert('Message', 'It appears that you are using Internet Explorer. The tool is compatible only with Chrome, Firefox and Safari browsers.');
    }
	
	// Madhu asked to remove NT Cycler on 23-02-2016
	Ext.get('ntcycler').removeCls('visible');
	Ext.get('ntcycler').addCls('hidden');
	
    //loadModels(); 
    Ext.get('referenceassay').addCls('hidden');
    Ext.get('emessage').addCls('hidden');
    experimentInfo = buildExperimentModel();
    outputList = buildOutputListModel();
	//pgxOutputList = bulidPgxOutputListModel();
    detailspageinfo = buildDetailsPageInfoModel();
   // pgxcurrency
    updateExperimentInfo("isCustomPlatingCalc",false);
	updateExperimentInfo("isCPSoamiRNA", false);
    addZoneCurrencies(gup('region'));
	
	if(gup('region') != null || gup('region') != ""){ 
		if (gup('region') == 'NA' && gup('region') == 'na') { 
			region = "NA";
			currency = "USD";
			setCookie("currency", "NA-USD", 30);
		} else if (gup('region') == 'EMEA' || gup('region') == 'emea') { 
			region = "EMEA";
			currency = "EUR";
			setCookie("currency", "EMEA-EUR", 30);
		} else if (gup('region') == 'APAC' || gup('region') == 'apac') { 
			region = "APAC";
			currency = "AUS";
			setCookie("currency", "APAC-AUS", 30);
		} 
	} else {
		var currencyObj = Ext.get('currency').dom;
		var regCurrency = currencyObj.options[currencyObj.selectedIndex].value;
		var currParts = regCurrency.split("-");
		region = currParts[0];
		currency = currParts[1];
		setCookie("currency", regCurrency, 30);	
	}
	Ext.get('typeGe').addCls('tbuttonselected');
	// Result for referral view from url
	if(gup('ispgx') !=null && gup('ispgx') !='' && gup('ispgx') == "false"){
	
		if((gup('type') != null && gup('type') != "") && (gup('targets') != null && gup('targets') != "") && (gup('samples') != null && gup('samples') != "")){
			
			// Loading Json files when calculate price button clicked
			if (!haveEverythingNeeded()){				
				showLoading(true);
				loadModels();
				//delayjsonloading();				
			} 	
				
				//var instrumentName = gup('inst');
				//defaultInstruemntID = instrumentName;
				updateExperimentInfo("type",gup('type').replace("%20"," "))
				updateExperimentInfo("nooftargets", gup('targets'));
				updateExperimentInfo("noofsamples", gup('samples'));
				updateExperimentInfo("openarrayinstrument", defaultInstruemntID);
				
				//updateExperimentInfo("species",gup('species'));				
				//updateExperimentInfo("noofreplicates", gup('replicates'));
				//updateExperimentInfo("noofsubarrays", gup('replicates'));
				
				
				Ext.get('no_of_targets').dom.value = gup('targets');
				Ext.get('no_of_samples').dom.value = gup('samples');
				//Ext.get('no_of_replicates').dom.value = gup('replicates');
				//Ext.get('no_of_referance_targets').dom.value = gup('replicates');
				
							
				var applicationType = gup('type').replace("%20"," ");
				if(applicationType == "Gene Expression"){
					Ext.get('typeGe').addCls('tbuttonselected');
					Ext.get('typeMi').removeCls('tbuttonselected');
					Ext.get('typeGt').removeCls('tbuttonselected');
					Ext.get('typeCnv').removeCls('tbuttonselected');
					Ext.get('typeMd').removeCls('tbuttonselected');
				} else if(applicationType == "miRNA"){
					Ext.get('typeMi').addCls('tbuttonselected');
					Ext.get('typeGe').removeCls('tbuttonselected');
					Ext.get('typeGt').removeCls('tbuttonselected');
					Ext.get('typeCnv').removeCls('tbuttonselected');
					Ext.get('typeMd').removeCls('tbuttonselected');
				} else if(applicationType == "Genotyping"){
					Ext.get('typeGt').addCls('tbuttonselected');
					Ext.get('typeGe').removeCls('tbuttonselected');
					Ext.get('typeMi').removeCls('tbuttonselected');
					Ext.get('typeCnv').removeCls('tbuttonselected');
					Ext.get('typeMd').removeCls('tbuttonselected');
				} else if(applicationType == "Copy Number"){
					Ext.get('typeCnv').addCls('tbuttonselected');
					Ext.get('typeGe').removeCls('tbuttonselected');
					Ext.get('typeMi').removeCls('tbuttonselected');
					Ext.get('typeGt').removeCls('tbuttonselected');
					Ext.get('typeMd').removeCls('tbuttonselected');
					Ext.get('targetspn').update('# of Mutations');
					Ext.get('reftargets').removeCls('hidden');
				} else if(applicationType == "Mutation Detection"){
					Ext.get('typeMd').addCls('tbuttonselected');
					Ext.get('typeGe').removeCls('tbuttonselected');
					Ext.get('typeMi').removeCls('tbuttonselected');
					Ext.get('typeGt').removeCls('tbuttonselected');
					Ext.get('typeCnv').removeCls('tbuttonselected');
				}
				//Ext.get(applicationType).addCls('tbuttonselected');
				
				/*var species = gup('species').toLowerCase();		
				Ext.get(species).addCls('tbuttonselected');*/
				
				//showSecondStep();
				
				if(getExperimentInfo("type") == "Copy Number"){
					 Ext.get('referenceassay').removeCls('hidden');
					  addReferanceAssay(getExperimentInfo("species"));
				} else{
					Ext.get('referenceassay').addCls('hidden');
				}
			
		} else {
			//Ext.get('Gene Expression').addCls('tbuttonselected');
		}
	} else {
		if(gup('ispgx') !=null && gup('ispgx') !='' && gup('ispgx') == "true"){
			updateExperimentInfo("IsPGX", "PGx");
			Ext.get('delayjsonloading').addCls('dispBlck');
			Ext.get('delayjsonloading').removeCls('dispNone');
			showLoading(true);
			loadModels();
			//delayjsonloading();	
			loadPgxFromUrlParam();
		}
		
	}
	
	
	// To show Referral view from URL param view=referral
	if(gup('view')== "referral"){
		Ext.get('needHelpDiv').addCls('hidden').removeCls('visible');
		Ext.get('reftargets').addCls('hidden').removeCls('visible');
		Ext.get('replicatesDiv').addCls('hidden').removeCls('visible');
		Ext.get('chooseFromat').addCls('hidden').removeCls('visible');
		Ext.get('select_species').addCls('hidden').removeCls('visible');
		Ext.get('chemistrySection').addCls('hidden').removeCls('visible');
		Ext.get('consumablesection').addCls('hidden').removeCls('visible');
		Ext.get('speciesselector').addCls('hidden').removeCls('visible');
		Ext.get('cpsbtn').addCls('hidden').removeCls('visible');
		Ext.get('curnandcalbtn').addCls('hidden').removeCls('visible');
		Ext.get('DesiredFormat').addCls('hidden').removeCls('visible');	
		Ext.get('currencydivpop').addCls('hidden').removeCls('visible');	
		Ext.get('headerTab').addCls('hidden').removeCls('visible');
		Ext.get('referralSectionDiv').addCls('visible').removeCls('hidden');
		Ext.get('ReferralMenu').addCls('tabAcitive').removeCls('tabNonActive');
		Ext.get('costMenu').addCls('tabNonActive').removeCls('tabAcitive');	
	}
	
	
	//Ext.get('currency').update(regCurrency);
	//$('select[name="currency"]').find('option[value="'+regCurrency+'"]').prop('selected', true);
	//$('[name=currency]').val(regCurrency);
	//$('#currency option:first').prop('selected', true);
	//$('#currency option:contains("'+regCurrency+'")').prop('selected', true);
	//$("select#currency").get(0).selectedIndex = regCurrency;
	Ext.get('expmethodselector1').addCls('hidden');
    Ext.get('expmethodselector1').removeCls('visible');
	
	updateExperimentInfo("method", "Standard");
	updateExperimentInfo("tubeSel", "All");		
	
	quoteForReagent();
	
    var expTypeSelectHandler = function (selected) {
    	
        Ext.get('mouse').removeCls('hidden');
        Ext.get('rat').removeCls('hidden');
        /* Commented on 16-10-2014 by Magesh */
		/*
		Ext.get('welltubeselector').addCls('visible');
        Ext.get('welltubeselector').removeCls('hidden');
        Ext.get('formatAmplification').addCls('visible');
        Ext.get('formatAmplification').removeCls('hidden');
		*/
		/*Added on 17-10-2014 by Magesh */
		
		//Ext.get('preAmpParnt').removeCls('hidden');
		//Ext.get('welltubeselector').removeCls('hidden');
		//Ext.get('formatAmplification').removeCls('hidden');
		
		//Ext.get('preAmpParnt').addCls('visible');
		//Ext.get('welltubeselector').addCls('visible');
		//Ext.get('formatAmplification').addCls('visible');
		
		/* End */
		
        Ext.get('chemistry').addCls('visible');
        Ext.get('chemistry').removeCls('hidden');
        Ext.get('expmethodselector').addCls('visible');
        Ext.get('expmethodselector').removeCls('hidden');
        //Ext.get('throughput').addCls('visible');
        //Ext.get('throughput').removeCls('hidden');
       // Ext.get('throughputselector').addCls('visible');
       // Ext.get('throughputselector').removeCls('hidden');
        Ext.get('fastmeth').removeCls('hidden');
        Ext.get('fastmeth1').removeCls('hidden');
        Ext.get('sybrsec').removeCls('visible');
        Ext.get('sybrsec').addCls('hidden');
        Ext.get('peampselection').addCls('hidden');
        Ext.get('peampselection').removeCls('visible');
        Ext.get('ipcselection').addCls('hidden');
        Ext.get('ipcselection').removeCls('visible');
        Ext.get('reptext').update('replicates');
        Ext.get('reptext1').update('replicates');
        //Ext.get('expmethodselector1').addCls('visible');
        //Ext.get('expmethodselector1').removeCls('hidden');
        Ext.get('assayperc').dom.value = "0%";
        Ext.get('masterperc').dom.value = "0%";
        Ext.get('plateperc').dom.value = "0%";
        Ext.get('accessoriesperc').dom.value = "0%";
        Ext.get('openarrayperc').dom.value = "0%";
        Ext.get('preamprtperc').dom.value = "0%";
        Ext.get('human').addCls('tbuttonselected');
        Ext.get('rat').removeCls('tbuttonselected');
        Ext.get('mouse').removeCls('tbuttonselected');
        Ext.get('referenceassay').addCls('hidden');
        Ext.get('refnameassay').addCls('hidden');
        Ext.get('refnameassay').removeCls('visible');
        Ext.get('digitalrefnameassay').addCls('hidden');
        Ext.get('digitalreferenceassay').addCls('hidden');
        Ext.get('digitalQS3DApplicable').addCls('hidden');
        
        //Ext.get('ntcycler').addCls('tbuttonselected');
        Ext.get('anyinstrument').addCls('tbuttonselected');
        Ext.get('quantstudio').removeCls('tbuttonselected');
        Ext.get('reftargets').addCls('hidden');
        Ext.get('reftargets').removeCls('visible');
        Ext.get('refsecondtargets').addCls('hidden');
       
        Ext.get('sprice').addCls('tbuttonselected');
        Ext.get('stime').removeCls('tbuttonselected');
        sortedBy = 1;
		Ext.get("newsortby").dom.value = "Price"
        updateExperimentInfo("nooftargets", 24);
        updateExperimentInfo("noofsamples", 20);
        updateExperimentInfo("noofreplicates", 2);
        updateExperimentInfo("noofsubarrays", 2);
        updateExperimentInfo("noofreftargets", 2);
        updateExperimentInfo("species", "Human");
        updateExperimentInfo("openarrayinstrument", defaultInstruemntID);
        Ext.get('fixedcontfilter').dom.checked = true;
        var selectObj = selected.dom.getAttribute("data-expinfo").toString();
		Ext.get('QS3D').addCls('hidden');
		Ext.get('QS3D').removeCls('visible');
		updateExperimentInfo("IsPGX", selectObj);
		updateExperimentInfo("type", selectObj);
        if(selectObj ==  'PGx'){
			$('#currency').empty()
			updateExperimentInfo("isCustomPlatingCalc",false);
			addZoneCurrencies(gup('region'));
			selected.addCls('pgxtbuttonselected');
			if($("#ReferralMenu").hasClass('tabAcitive')){
				Ext.get('pgxcurnandcalbtn').addCls('hidden').removeCls('visible');						
			} else{
				Ext.get('pgxcurnandcalbtn').addCls('visible').removeCls('hidden');	
				Ext.get('currencydivpop').addCls('visible').removeCls('hidden');
			}
			Ext.get('selectInstrumentDrpdwn').addCls('hidden').removeCls('visible');
			//Ext.get('viewTab').addCls('hidden').removeCls('visible');  // hiding referel tab menu for PGx
				
			/*custom-Plating*/
			
			Ext.get('CustomPlateProcess').addCls('hidden');
			Ext.get('CustomPlateProcess').removeCls('visible');
			/*end*/
			
			Ext.get('pgxtabbarTab3').addCls('hidden');
			Ext.get('pgxtabbarTab3').removeCls('visible');
			
        	createPGxSpinner();
			
        	Ext.get('tabbar').removeCls('visible');
        	Ext.get('tabbar').addCls('hidden');
        	
        	Ext.get('pgxtabbar').removeCls('hidden');
        	Ext.get('pgxtabbar').addCls('visible');
        	
        	//tochangecurrencycombobox(selectObj); //pgxcurrency
			
        	Ext.get('select_species').removeCls('visible');
			Ext.get('speciesselector').removeCls('visible');
			Ext.get('digitalQS3DCombo').removeCls('visible');
			Ext.get('inputsforApplications').removeCls('visible');
			Ext.get('DesiredFormat').removeCls('visible');
			Ext.get('curnandcalbtn').removeCls('visible');
			
			Ext.get('select_species').addCls('hidden');
    		Ext.get('speciesselector').addCls('hidden');
			Ext.get('digitalQS3DCombo').addCls('hidden');
			Ext.get('inputsforApplications').addCls('hidden');
			Ext.get('DesiredFormat').addCls('hidden');
			Ext.get('curnandcalbtn').addCls('hidden');
			
			
			
			Ext.get('consumablesection').removeCls('visible');
			Ext.get('consumablesection').addCls('hidden');
			
			Ext.get('ChemistryDiv').addCls('hidden');
			Ext.get('ChemistryDiv').removeCls('visible');
			
			Ext.get('preAmpParnt').addCls('hidden');
			Ext.get('preAmpParnt').removeCls('visible');
			$('.chemCompl').css('background','none');
			
			Ext.get('PGxProcess').removeCls('hidden');
			Ext.get('PGxProcess').addCls('visible');
			
			//Loading Json files when PGx tab clicked
			if (!haveEverythingNeeded()){
				Ext.get('delayjsonloading').removeCls('dispNone');
				Ext.get('delayjsonloading').addCls('dispBlck');
				showLoading(true);
				loadModels();
				//delayjsonloading();	
				//Ext.get('delayjsonloading').addCls('dispNone');
				//Ext.get('delayjsonloading').removeCls('dispBlck');				
			}else{
				stratPGxSecondStep();
			}
        	//showLoading(false);
			
			/*Ext.get('pgxcnaqaplate').on('keyup', function (e) {
				var pgxcnvplates = Ext.get('pgxcnaqaplate').dom.value;
				if (isNumber(pgxcnvplates)) {
					calcforPGXInputs();
				}
			});*/
			//showAll();
		} else if( selectObj ==  'Custom Plating' ){
			
			Ext.get('viewTab').addCls('hidden').removeCls('visible');  // hiding referel tab menu for PGx
			
			Ext.get('pgxbtn').addCls('pgximg');
	        Ext.get('pgxbtn').removeCls('pgxtbuttonselected');
			//updateExperimentInfo("csPlatingAssayVal", "Gene Expression");
			updateExperimentInfo("csPlatingAssayVal", "miRNA");
			updateExperimentInfo("isCustomPlatingCalc",true);
			$('#currency').empty()
			addZoneCurrencies(gup('region'));
			if(gup('region') != null && gup('region') != ""){ 
				if (gup('region') == 'NA' || gup('region') == 'na') { 
					region = "NA";
					currency = "USD";
					setCookie("currency", "NA-USD", 30);
				} else if (gup('region') == 'EMEA' || gup('region') == 'emea') { 
					region = "EMEA";
					currency = "EUR";
					setCookie("currency", "EMEA-EUR", 30);
				} else if (gup('region') == 'APAC' || gup('region') == 'apac') { 
					region = "APAC";
					currency = "AUS";
					setCookie("currency", "APAC-AUS", 30);
				} 
			} else {
				region = "NA";
				currency = "USD";
				setCookie("currency", "NA-USD", 30);
			}
			/* Hiding some Html designs between custom plating and other applications*/
			//Ext.get('secondstepdiscvals').removeCls('visible');
			//Ext.get('secondstepdiscvals').addCls('hidden');
			$("#secondstepdiscvals").css('visibility','hidden');
			
			Ext.get('costSummaryDiv').addCls('hidden');
			Ext.get('costSummaryDiv').removeCls('visible');
			
			Ext.get('secondsteptargets').removeCls('visible');
			Ext.get('secondsteptargets').addCls('hidden');
			
			Ext.get('secondstepINVtargets').removeCls('hidden');
			Ext.get('secondstepINVtargets').addCls('visible');
			
			Ext.get('secondstepCUSMOtargets').addCls('hidden');
			Ext.get('secondstepCUSMOtargets').removeCls('visible');
			/* End*/
			
			Ext.get('pgxtabbar').removeCls('visible');
			Ext.get('pgxtabbar').addCls('hidden');
			
			Ext.get('tabbar').removeCls('hidden');
        	Ext.get('tabbar').addCls('visible');
			
			/*PGX*/
			//Ext.get('pgxtabbar').removeCls('visible');
			//Ext.get('pgxtabbar').addCls('hidden');
			
			//Ext.get('tabbar').removeCls('hidden');
        	//Ext.get('tabbar').addCls('visible');
			
			Ext.get('PGxProcess').addCls('hidden');
			Ext.get('PGxProcess').removeCls('visible');
			
			/*currency*/
			//Ext.get('currencydivpop').addCls('hidden');
			//Ext.get('currencydivpop').removeCls('visible');
			/*end*/
			
			/*Non PGX*/
			Ext.get('select_species').removeCls('visible');
			Ext.get('speciesselector').removeCls('visible');
			Ext.get('digitalQS3DCombo').removeCls('visible');
			Ext.get('inputsforApplications').removeCls('visible');
			Ext.get('DesiredFormat').removeCls('visible');
			Ext.get('curnandcalbtn').removeCls('visible');
			
			Ext.get('select_species').addCls('hidden');
    		Ext.get('speciesselector').addCls('hidden');
			Ext.get('digitalQS3DCombo').addCls('hidden');
			Ext.get('inputsforApplications').addCls('hidden');
			Ext.get('DesiredFormat').addCls('hidden');
			Ext.get('curnandcalbtn').addCls('hidden');
			
			//Ext.get('PGxProcess').removeCls('hidden');
			//Ext.get('PGxProcess').addCls('visible');
			
			Ext.get('consumablesection').removeCls('visible');
			Ext.get('consumablesection').addCls('hidden');
			
			Ext.get('ChemistryDiv').addCls('hidden');
			Ext.get('ChemistryDiv').removeCls('visible');
			
			Ext.get('preAmpParnt').addCls('hidden');
			Ext.get('preAmpParnt').removeCls('visible');
			
			$('.chemCompl').css('background','none');
			
			/*custom-Plating*/
			Ext.get('CustomPlateProcess').removeCls('hidden');
			Ext.get('CustomPlateProcess').addCls('visible');
			/*Ext.get('miRNA_questions_div').addCls('hidden');
			Ext.get('miRNA_questions_div').removeCls('visible');*/
			Ext.get('miRNA_questions_div').addCls('visible');
			Ext.get('miRNA_questions_div').removeCls('hidden');
			//Ext.get('invAssaysDiv').addCls('visible');
			//Ext.get('invAssaysDiv').removeCls('hidden');
			Ext.get('cpsOpenArray').addCls('tbuttonselected');
			//Ext.get('cpsWellPlates').addCls('tbuttonselected');
			Ext.get('miRNA').addCls('visible');
			Ext.get('miRNA').removeCls('hidden');
			Ext.get('miRNA').addCls('tbuttonselected');
			Ext.get('Gene Expression').addCls('hidden');
			Ext.get('SNP').addCls('hidden');
			Ext.get('CNV').addCls('hidden');
			Ext.get('Cast PCR').addCls('hidden');
			Ext.get('Gene Expression').removeCls('visible');
			Ext.get('SNP').removeCls('visible');
			Ext.get('CNV').removeCls('visible');
			Ext.get('Cast PCR').removeCls('visible');
			/*Ext.get('Gene Expression').addCls('tbuttonselected');
			Ext.get('Gene Expression').removeCls('hidden');
			Ext.get('Gene Expression').addCls('visible');
			Ext.get('SNP').removeCls('tbuttonselected');
			Ext.get('SNP').removeCls('hidden');
			Ext.get('SNP').addCls('visible');
			Ext.get('CNV').removeCls('tbuttonselected');
			Ext.get('CNV').removeCls('hidden');
			Ext.get('CNV').removeCls('visible');
			Ext.get('Cast PCR').removeCls('hidden');
			Ext.get('Cast PCR').removeCls('tbuttonselected');
			Ext.get('Cast PCR').addCls('visible');*/
			//updateExperimentInfo("cpsConsumableType", "plates");
			updateExperimentInfo("cpsConsumableType", "openarray");
			//updateExperimentInfo("isCPSoamiRNA", false);
			Ext.get('cpsInvAssaySPn').update('# of assays');
			updateExperimentInfo("isCPSoamiRNA", true);
		} else{
			Ext.get('viewTab').addCls('visible').removeCls('hidden'); // showing referel tab menu for other application
			Ext.get('selectInstrumentDrpdwn').addCls('visible').removeCls('hidden');
			if($("#ReferralMenu").hasClass('tabAcitive')){
				Ext.get('DesiredFormat').addCls('hidden').removeCls('visible');
				Ext.get('curnandcalbtn').addCls('hidden').removeCls('visible');
			} else {
				Ext.get('DesiredFormat').addCls('visible').removeCls('hidden');
				Ext.get('curnandcalbtn').addCls('visible').removeCls('hidden');
			}
			updateExperimentInfo("isCustomPlatingCalc",false);
			updateExperimentInfo("isCPSoamiRNA", false);
			$('#currency').empty()
			addZoneCurrencies(gup('region'));
			$("#currency").val(getCookie("currency"));
			
			
			Ext.get('costSummaryDiv').addCls('visible');
			Ext.get('costSummaryDiv').removeCls('hidden');
			
			Ext.get('techboth').removeCls('tbuttonselected');
			Ext.get('techdigitalpcr').removeCls('tbuttonselected');
			Ext.get('techrealtimepcr').removeCls('tbuttonselected');
			
			/* Hiding some Html designs between custom plating and other applications*/
			//Ext.get('secondstepdiscvals').removeCls('hidden');
			//Ext.get('secondstepdiscvals').addCls('visible');
			$("#secondstepdiscvals").css('visibility','visible');
			
			Ext.get('secondsteptargets').removeCls('hidden');
			Ext.get('secondsteptargets').addCls('visible');
			
			Ext.get('secondstepINVtargets').removeCls('visible');
			Ext.get('secondstepINVtargets').addCls('hidden');
			
			Ext.get('secondstepCUSMOtargets').removeCls('visible');
			Ext.get('secondstepCUSMOtargets').addCls('hidden');
			/* End*/
			
			
			/*custom-Plating*/
			Ext.get('CustomPlateProcess').addCls('hidden');
			Ext.get('CustomPlateProcess').removeCls('visible');
			/*end*/
			
			Ext.get('pgxtabbarTab3').removeCls('hidden');
			Ext.get('pgxtabbarTab3').addCls('visible');
			
			Ext.get('pgxtabbar').removeCls('visible');
			Ext.get('pgxtabbar').addCls('hidden');
			
			Ext.get('tabbar').removeCls('hidden');
        	Ext.get('tabbar').addCls('visible');
        	
			//tochangecurrencycombobox(selectObj);
			if (selectObj == "Genotyping") {
				Ext.get('targetspn').update('# of targets');
            	Ext.get('well96').update("96-well <br> (25 uL rxn)");
            	Ext.get('well384').update("384-well <br> (5 uL rxn)");
	        } else {
	            Ext.get('well96').update("96-well <br> (20 uL rxn)");
	            Ext.get('well384').update("384-well <br> (10 uL rxn)");
	        }
        	
        	Ext.get('PGxProcess').removeCls('visible');
			Ext.get('PGxProcess').addCls('hidden');
			
        	Ext.get('select_species').addCls('visible');
			Ext.get('speciesselector').addCls('visible');
			//Ext.get('digitalQS3DCombo').addCls('visible');
			Ext.get('inputsforApplications').addCls('visible');
			Ext.get('DesiredFormat').addCls('visible');
			Ext.get('curnandcalbtn').addCls('visible');
			
			Ext.get('consumablesection').removeCls('hidden');
			Ext.get('consumablesection').addCls('visible');
			
			Ext.get('preAmpParnt').addCls('hidden').removeCls('visible');
			
			$('.chemCompl').css('background','url("images/borderR.jpg") repeat-x left bottom');
			
	        if (selectObj == "Gene Expression") {
				if($("#ReferralMenu").hasClass('tabAcitive')){
					Ext.get('select_species').addCls('hidden').removeCls('visible');
					Ext.get('chemistrySection').addCls('hidden').removeCls('visible');
					Ext.get('consumablesection').addCls('hidden').removeCls('visible');
					Ext.get('speciesselector').addCls('hidden').removeCls('visible');
					Ext.get('DesiredFormat').addCls('hidden').removeCls('visible');
					Ext.get('curnandcalbtn').addCls('hidden').removeCls('visible');
				} else {
					Ext.get('select_species').addCls('visible').removeCls('hidden');
					Ext.get('chemistrySection').addCls('visible').removeCls('hidden');
					Ext.get('consumablesection').addCls('visible').removeCls('hidden');
					Ext.get('speciesselector').addCls('visible').removeCls('hidden');
					Ext.get('DesiredFormat').addCls('visible').removeCls('hidden');
					Ext.get('curnandcalbtn').addCls('visible').removeCls('hidden');
				}
				updateExperimentInfo("isCustomPlatingCalc",false);
				Ext.get('pgxbtn').addCls('pgximg');
	            Ext.get('pgxbtn').removeCls('pgxtbuttonselected');
				
				Ext.get('targetspn').update('# of targets');
	            Ext.get('refsecondtargets').addCls('hidden');
	            Ext.get('reftargets').addCls('hidden');
	            Ext.get('reftargets').removeCls('visible');
	            Ext.get('fixedcontfilter').removeCls('hidden');
	            Ext.get('referenceassay').addCls('hidden');
	            Ext.get('refnameassay').addCls('hidden');
	            Ext.get('refnameassay').removeCls('visible');
	            Ext.get('digitalrefnameassay').addCls('hidden');
	            Ext.get('digitalreferenceassay').addCls('hidden');
	            Ext.get('digitalQS3DApplicable').addCls('hidden');
	            
	            Ext.get('fixedpanel').removeCls('hidden');
	            Ext.get('reptext').update('replicates');
	            Ext.get('reptext1').update('replicates');
	            Ext.get('sybrsec').removeCls('hidden');
	            Ext.get('sybrsec').addCls('visible');
	            Ext.get("right").removeCls('hidden');
	            //Ext.get('throughput').addCls('visible');
	            //Ext.get('throughput').removeCls('hidden');
	           // Ext.get('throughputselector').addCls('hidden');
	           // Ext.get('throughputselector').removeCls('visible');
	            //New
	            Ext.get('ChemistryDiv').addCls('visible');
	            Ext.get('ChemistryDiv').removeCls('hidden');
	          //  Ext.get('ThroughputDiv').addCls('hidden');
	           // Ext.get('ThroughputDiv').removeCls('visible');
	            //Ext.get('DesiredFormat').addCls('visible');
	            //Ext.get('DesiredFormat').removeCls('hidden');
				
				//Added on 17-10-2014 by Magesh		
				//Ext.get('preAmpParnt').removeCls('hidden');
				//Ext.get('welltubeselector').removeCls('hidden');
				//Ext.get('formatAmplification').removeCls('hidden');
				/* End */
				Ext.get('All').addCls('tbuttonselected');
				
				if($( "#Tube" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('Tube').removeCls('tbuttonselected');
				}
				if($( "#TAPFast" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('TAPFast').removeCls('tbuttonselected');
				}
				if($( "#TAPStandard" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('TAPStandard').removeCls('tbuttonselected');
				}				
	            if($( "#TAC" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('TAC').removeCls('tbuttonselected');
				}
				if($( "#OpenArray" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('OpenArray').removeCls('tbuttonselected');
				}
				if($( "#Chips" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('Chips').removeCls('tbuttonselected');
				}
				Ext.get('preAmpParnt').addCls('hidden').removeCls('visible');
	            updateExperimentInfo("type", "Gene Expression");
				//updateExperimentInfo("technology", "Both");
	            resetTbutton("openarrayinstrumentselector", defaultInstruemntID);
	        } else if (selectObj == "miRNA") {
				if($("#ReferralMenu").hasClass('tabAcitive')){
					Ext.get('select_species').addCls('hidden').removeCls('visible');
					Ext.get('chemistrySection').addCls('hidden').removeCls('visible');
					Ext.get('consumablesection').addCls('hidden').removeCls('visible');
					Ext.get('speciesselector').addCls('hidden').removeCls('visible');
					Ext.get('DesiredFormat').addCls('hidden').removeCls('visible');
					Ext.get('curnandcalbtn').addCls('hidden').removeCls('visible');
				} else {
					Ext.get('select_species').addCls('visible').removeCls('hidden');
					Ext.get('chemistrySection').addCls('visible').removeCls('hidden');
					Ext.get('consumablesection').addCls('visible').removeCls('hidden');
					Ext.get('speciesselector').addCls('visible').removeCls('hidden');
					Ext.get('DesiredFormat').addCls('visible').removeCls('hidden');
					Ext.get('curnandcalbtn').addCls('visible').removeCls('hidden');
				}
				Ext.get('pgxbtn').addCls('pgximg');
	            Ext.get('pgxbtn').removeCls('pgxtbuttonselected');
				
				Ext.get('targetspn').update('# of targets');
	            Ext.get('refsecondtargets').addCls('hidden');
	            Ext.get('reftargets').addCls('hidden');
	            Ext.get('reftargets').removeCls('visible');
	            Ext.get('referenceassay').addCls('hidden');
	            Ext.get('refnameassay').addCls('hidden');
	            Ext.get('refnameassay').removeCls('visible');
	            Ext.get('digitalrefnameassay').addCls('hidden');
	            Ext.get('digitalreferenceassay').addCls('hidden');
	            Ext.get('digitalQS3DApplicable').addCls('hidden');
	            
	            Ext.get('fixedpanel').removeCls('hidden');
	            Ext.get('standardmeth').addCls('tbuttonselected');
	            Ext.get('standardmeth1').addCls('tbuttonselected');
	            Ext.get('fastmeth').removeCls('tbuttonselected');
	            Ext.get('fastmeth1').removeCls('tbuttonselected');
	            Ext.get('reptext').update('replicates');
	            Ext.get('peampselection').addCls('visible');
	            Ext.get('peampselection').removeCls('hidden');
	            Ext.get('expmethodselector').addCls('hidden');
	            Ext.get('expmethodselector').removeCls('visible');
	            //Ext.get('preampchk').dom.checked = true;
	            Ext.get('fixedcontfilter').removeCls('hidden');
	            //Ext.get('expmethodselector1').addCls('hidden');
	            //Ext.get('expmethodselector1').removeCls('visible');
	            Ext.get('chemistry').addCls('hidden');
	            Ext.get('chemistry').removeCls('visible');
	            Ext.get("right").removeCls('hidden');
	            //New
	            Ext.get('ChemistryDiv').addCls('hidden');
	            Ext.get('ChemistryDiv').removeCls('visible');
	            //Ext.get('throughput').addCls('visible');
	            //Ext.get('throughput').removeCls('hidden');
	            //Ext.get('DesiredFormat').addCls('visible');
	           // Ext.get('DesiredFormat').removeCls('hidden');
	            updateExperimentInfo("type", "miRNA");
	            updateExperimentInfo("method", "Standard");
				Ext.get('All').addCls('tbuttonselected');
				
				if($( "#Tube" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('Tube').removeCls('tbuttonselected');
				}
				if($( "#TAPFast" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('TAPFast').removeCls('tbuttonselected');
				}
				if($( "#TAPStandard" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('TAPStandard').removeCls('tbuttonselected');
				}				
	            if($( "#TAC" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('TAC').removeCls('tbuttonselected');
				}
				if($( "#OpenArray" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('OpenArray').removeCls('tbuttonselected');
				}
				if($( "#Chips" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('Chips').removeCls('tbuttonselected');
				}
				updateExperimentInfo("tubeSel", "All");
				Ext.get('preAmpParnt').addCls('visible').removeCls('hidden');
				Ext.get('welltubeselector').removeCls('hidden');
				Ext.get('formatAmplification').removeCls('hidden');
				instruemntButtonFilter();
	            resetTbutton("openarrayinstrumentselector", defaultInstruemntID);
	        } else if (selectObj == "Genotyping") {
				if($("#ReferralMenu").hasClass('tabAcitive')){
					Ext.get('select_species').addCls('hidden').removeCls('visible');
					Ext.get('chemistrySection').addCls('hidden').removeCls('visible');
					Ext.get('consumablesection').addCls('hidden').removeCls('visible');
					Ext.get('speciesselector').addCls('hidden').removeCls('visible');
					Ext.get('DesiredFormat').addCls('hidden').removeCls('visible');
					Ext.get('curnandcalbtn').addCls('hidden').removeCls('visible');
				} else {
					Ext.get('select_species').addCls('visible').removeCls('hidden');
					Ext.get('chemistrySection').addCls('visible').removeCls('hidden');
					Ext.get('consumablesection').addCls('visible').removeCls('hidden');
					Ext.get('speciesselector').addCls('visible').removeCls('hidden');
					Ext.get('DesiredFormat').addCls('visible').removeCls('hidden');
					Ext.get('curnandcalbtn').addCls('visible').removeCls('hidden');
				}
				Ext.get('preAmpParnt').addCls('hidden').removeCls('visible');
				Ext.get('pgxbtn').addCls('pgximg');
	            Ext.get('pgxbtn').removeCls('pgxtbuttonselected');
				
				Ext.get('targetspn').update('# of targets');
	            Ext.get('refsecondtargets').addCls('hidden');
	            Ext.get('reftargets').addCls('hidden');
	            Ext.get('reftargets').removeCls('visible');
	            Ext.get('fixedpanel').removeCls('hidden');
	            Ext.get('refnameassay').addCls('hidden');
	            Ext.get('refnameassay').removeCls('visible');
	            Ext.get('digitalrefnameassay').addCls('hidden');
	            Ext.get('digitalreferenceassay').addCls('hidden');
	            Ext.get('digitalQS3DApplicable').addCls('hidden');
	            
	            Ext.get('fixedcontfilter').removeCls('hidden');
	            Ext.get('expmethodselector').addCls('hidden');
	            Ext.get('expmethodselector').removeCls('visible');
	            Ext.get('referenceassay').addCls('hidden');
	            //Ext.get('expmethodselector1').addCls('hidden');
	            //Ext.get('expmethodselector1').removeCls('visible');
	            Ext.get('reptext').update('replicates');
	            Ext.get('rat').addCls('hidden');
	            Ext.get('human').addCls('tbuttonselected');
	            Ext.get('rat').removeCls('tbuttonselected');
	            Ext.get('mouse').removeCls('tbuttonselected');
	            Ext.get('chemistry').addCls('hidden');
	            Ext.get('chemistry').removeCls('visible');
	            Ext.get("right").removeCls('hidden');
	            //New
	            Ext.get('ChemistryDiv').addCls('hidden');
	            Ext.get('ChemistryDiv').removeCls('visible');
	           // Ext.get('ThroughputDiv').addCls('hidden');
	           // Ext.get('ThroughputDiv').removeCls('visible');
	            //Ext.get('DesiredFormat').addCls('visible');
	            //Ext.get('DesiredFormat').removeCls('hidden');
	            updateExperimentInfo("type", "Genotyping");
	            updateExperimentInfo("species", "Human");
				
				Ext.get('All').addCls('tbuttonselected');
				
				if($( "#Tube" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('Tube').removeCls('tbuttonselected');
				}
				if($( "#TAPFast" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('TAPFast').removeCls('tbuttonselected');
				}
				if($( "#TAPStandard" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('TAPStandard').removeCls('tbuttonselected');
				}				
	            if($( "#TAC" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('TAC').removeCls('tbuttonselected');
				}
				if($( "#OpenArray" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('OpenArray').removeCls('tbuttonselected');
				}
				if($( "#Chips" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('Chips').removeCls('tbuttonselected');
				}
				updateExperimentInfo("tubeSel", "All");				
				Ext.get('welltubeselector').removeCls('hidden');
				Ext.get('formatAmplification').removeCls('hidden');
				instruemntButtonFilter();
	            resetTbutton("openarrayinstrumentselector", defaultInstruemntID);
	        } else if (selectObj == "Copy Number") {
				
				if($("#ReferralMenu").hasClass('tabAcitive')){
					Ext.get('select_species').addCls('hidden').removeCls('visible');
					Ext.get('chemistrySection').addCls('hidden').removeCls('visible');
					Ext.get('consumablesection').addCls('hidden').removeCls('visible');
					Ext.get('speciesselector').addCls('hidden').removeCls('visible');
					Ext.get('DesiredFormat').addCls('hidden').removeCls('visible');
					Ext.get('curnandcalbtn').addCls('hidden').removeCls('visible');
				} else {
					Ext.get('select_species').addCls('visible').removeCls('hidden');
					Ext.get('chemistrySection').addCls('visible').removeCls('hidden');
					Ext.get('consumablesection').addCls('visible').removeCls('hidden');
					Ext.get('speciesselector').addCls('visible').removeCls('hidden');
					Ext.get('DesiredFormat').addCls('visible').removeCls('hidden');
					Ext.get('curnandcalbtn').addCls('visible').removeCls('hidden');
				}
				Ext.get('preAmpParnt').addCls('hidden').removeCls('visible');
				Ext.get('pgxbtn').addCls('pgximg');
	            Ext.get('pgxbtn').removeCls('pgxtbuttonselected');
				
				Ext.get('targetspn').update('# of targets');
	            Ext.get('refsecondtargets').addCls('hidden');
	            Ext.get('reftargets').addCls('hidden');
	            Ext.get('reftargets').removeCls('visible');
	            addReferanceAssay("Human");
	            //Ext.get('fixedpanel').removeCls('hidden');
	            Ext.get('fixedpanel').addCls('hidden');
	            Ext.get('refnameassay').removeCls('hidden');
				Ext.get('refnameassay').addCls('visible');
	            Ext.get('fixedcontfilter').addCls('hidden');
	            Ext.get('referenceassay').removeCls('hidden');
	            
	            Ext.get('digitalrefnameassay').addCls('hidden');
	            Ext.get('digitalreferenceassay').addCls('hidden');
	            Ext.get('digitalQS3DApplicable').addCls('hidden');
	            
	            Ext.get('rat').addCls('hidden');
				//Commented on 17/10/2014 by MM
	            //Ext.get('welltubeselector').addCls('hidden');
				//Ext.get('formatAmplification').addCls('hidden');
				//End
	            //Ext.get('welltubeselector').removeCls('visible');
	            //Ext.get('formatAmplification').removeCls('visible');

	            Ext.get('human').addCls('tbuttonselected');
	            Ext.get('rat').removeCls('tbuttonselected');
	            Ext.get('mouse').removeCls('tbuttonselected');
	            Ext.get('chemistry').addCls('hidden');
	            Ext.get('chemistry').removeCls('visible');
	            Ext.get('expmethodselector').addCls('hidden');
	            Ext.get('expmethodselector').removeCls('visible');
	            //Ext.get('throughput').addCls('hidden');
	            //Ext.get('throughput').removeCls('visible');
	            //Ext.get('throughputselector').addCls('hidden');
	            //Ext.get('throughputselector').removeCls('visible');
	            //Ext.get('reptext').update('subarrays');
	            //Ext.get('reptext1').update('subarrays');
	            //Ext.get('expmethodselector1').addCls('hidden');
	            //Ext.get('expmethodselector1').removeCls('visible');
	            //alert("hi");
	            //Ext.get('openarrayinstrument').addCls('hidden');
	            //Ext.get('openarrayinstrument').removeCls('visible');
	           // Ext.get('openarrayinstrumentselector').addCls('hidden');
	            //Ext.get('openarrayinstrumentselector').removeCls('visible');
	            //Ext.get("right").addCls('hidden');
	            //New
				Ext.get("right").addCls('visible');
	            Ext.get('ChemistryDiv').addCls('hidden');
	            Ext.get('ChemistryDiv').removeCls('visible');
	            //Ext.get('ThroughputDiv').addCls('hidden');
	           // Ext.get('ThroughputDiv').removeCls('visible');
	            //Ext.get('DesiredFormat').addCls('hidden');
	            //Ext.get('DesiredFormat').removeCls('visible');
				//Ext.get('DesiredFormat').addCls('visible');
	            //Ext.get('DesiredFormat').removeCls('hidden');
	            updateExperimentInfo("type", "Copy Number");
	            updateExperimentInfo("species", "Human");
				Ext.get('All').addCls('tbuttonselected');
				
				if($( "#Tube" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('Tube').removeCls('tbuttonselected');
				}
				if($( "#TAPFast" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('TAPFast').removeCls('tbuttonselected');
				}
				if($( "#TAPStandard" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('TAPStandard').removeCls('tbuttonselected');
				}				
	            if($( "#TAC" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('TAC').removeCls('tbuttonselected');
				}
				if($( "#OpenArray" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('OpenArray').removeCls('tbuttonselected');
				}
				if($( "#Chips" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('Chips').removeCls('tbuttonselected');
				}
				updateExperimentInfo("tubeSel", "All");
				
				Ext.get('welltubeselector').removeCls('hidden');
				Ext.get('formatAmplification').removeCls('hidden');
				instruemntButtonFilter();
				//updateExperimentInfo("technology", "Both");
	            //resetTbutton("openarrayinstrumentselector", "none");
				resetTbutton("openarrayinstrumentselector", defaultInstruemntID);
	        } else if (selectObj == "Mutation Detection") {
				if($("#ReferralMenu").hasClass('tabAcitive')){
					Ext.get('reftargets').addCls('hidden').removeCls('visible');
					Ext.get('select_species').addCls('hidden').removeCls('visible');
					Ext.get('chemistrySection').addCls('hidden').removeCls('visible');
					Ext.get('consumablesection').addCls('hidden').removeCls('visible');
					Ext.get('speciesselector').addCls('hidden').removeCls('visible');
					Ext.get('DesiredFormat').addCls('hidden').removeCls('visible');
					Ext.get('curnandcalbtn').addCls('hidden').removeCls('visible');
				} else {
					Ext.get('reftargets').addCls('visible').removeCls('hidden');
					Ext.get('select_species').addCls('visible').removeCls('hidden');
					Ext.get('chemistrySection').addCls('visible').removeCls('hidden');
					Ext.get('consumablesection').addCls('visible').removeCls('hidden');
					Ext.get('speciesselector').addCls('visible').removeCls('hidden');
					Ext.get('DesiredFormat').addCls('visible').removeCls('hidden');
					Ext.get('curnandcalbtn').addCls('visible').removeCls('hidden');
				}
				Ext.get('preAmpParnt').addCls('hidden').removeCls('visible');
				Ext.get('pgxbtn').addCls('pgximg');
	            Ext.get('pgxbtn').removeCls('pgxtbuttonselected');
				
				Ext.get('targetspn').update('# of Mutations');
	            Ext.get('refsecondtargets').removeCls('hidden');
	            //Ext.get('reftargets').removeCls('hidden');
	            //Ext.get('reftargets').addCls('clearfix');
	            Ext.get('fixedpanel').addCls('hidden');
	            Ext.get('refnameassay').addCls('hidden');
				Ext.get('refnameassay').removeCls('visible');
	            Ext.get('fixedcontfilter').addCls('hidden');
	            Ext.get('referenceassay').addCls('hidden');
	            
	            Ext.get('digitalrefnameassay').addCls('hidden');
	            Ext.get('digitalreferenceassay').addCls('hidden');
	            Ext.get('digitalQS3DApplicable').addCls('hidden');
	            
	            Ext.get('rat').addCls('hidden');
	            Ext.get('mouse').addCls('hidden');
				
				//Commented on 17/10/2014 by MM
	            //Ext.get('welltubeselector').addCls('hidden');
				//Ext.get('formatAmplification').addCls('hidden');
				//End
				
	            //Ext.get('welltubeselector').removeCls('visible');
	            //Ext.get('formatAmplification').removeCls('visible');
	            Ext.get('human').addCls('tbuttonselected');
	            Ext.get('rat').removeCls('tbuttonselected');
	            Ext.get('mouse').removeCls('tbuttonselected');
	            Ext.get('chemistry').addCls('hidden');
	            Ext.get('ipcselection').addCls('visible');
	            Ext.get('ipcselection').removeCls('hidden');
	            Ext.get('chemistry').removeCls('visible');
	            Ext.get('expmethodselector').addCls('hidden');
	            Ext.get('expmethodselector').removeCls('visible');
	            //Ext.get('throughput').addCls('hidden');
	            //Ext.get('throughput').removeCls('visible');
	            //Ext.get('throughputselector').addCls('hidden');
	           // Ext.get('throughputselector').removeCls('visible');
	            //Ext.get('reptext').update('subarrays');
	            //Ext.get('reptext1').update('subarrays');
	            //Ext.get('expmethodselector1').addCls('hidden');
	            //Ext.get('expmethodselector1').removeCls('visible');
	            //alert("hi");
	           // Ext.get('openarrayinstrument').addCls('hidden');
	            //Ext.get('openarrayinstrument').removeCls('visible');
	           // Ext.get('openarrayinstrumentselector').addCls('hidden');
	           // Ext.get('openarrayinstrumentselector').removeCls('visible');
	            //Ext.get("right").addCls('hidden');
	            //New
	            Ext.get('ChemistryDiv').addCls('hidden');
	            Ext.get('ChemistryDiv').removeCls('visible');
	            //Ext.get('ThroughputDiv').addCls('hidden');
	            //Ext.get('ThroughputDiv').removeCls('visible');
	           // Ext.get('DesiredFormat').addCls('hidden');
	            //Ext.get('DesiredFormat').removeCls('visible');
				//Ext.get('DesiredFormat').addCls('visible');
	            //Ext.get('DesiredFormat').removeCls('hidden');
	            updateExperimentInfo("type", "Mutation Detection");
	            updateExperimentInfo("species", "Human");
				Ext.get('All').addCls('tbuttonselected');
				
				if($( "#Tube" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('Tube').removeCls('tbuttonselected');
				}
				if($( "#TAPFast" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('TAPFast').removeCls('tbuttonselected');
				}
				if($( "#TAPStandard" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('TAPStandard').removeCls('tbuttonselected');
				}				
	            if($( "#TAC" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('TAC').removeCls('tbuttonselected');
				}
				if($( "#OpenArray" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('OpenArray').removeCls('tbuttonselected');
				}
				if($( "#Chips" ).hasClass( "tbuttonselected" ) == true){
					Ext.get('Chips').removeCls('tbuttonselected');
				}
				updateExperimentInfo("tubeSel", "All");
				
				Ext.get('welltubeselector').removeCls('hidden');
				Ext.get('formatAmplification').removeCls('hidden');
				instruemntButtonFilter();
	            //resetTbutton("openarrayinstrumentselector", "none");
				resetTbutton("openarrayinstrumentselector", defaultInstruemntID);
	        } else if(selectObj ==  'Digital PCR'){
				Ext.get('preAmpParnt').addCls('hidden').removeCls('visible');
	            Ext.get('refsecondtargets').addCls('hidden');
	            Ext.get('reftargets').addCls('hidden');
	            Ext.get('reftargets').removeCls('visible');
	            Ext.get('fixedpanel').addCls('hidden');
	            Ext.get('fixedcontfilter').addCls('hidden');
	            Ext.get('refnameassay').addCls('hidden');
	            Ext.get('referenceassay').addCls('hidden');
	            
	            addAssayForApplication("Human", "Digital PCR");
	            
	            Ext.get('digitalrefnameassay').addCls('hidden');
	            Ext.get('digitalreferenceassay').addCls('hidden');
	            Ext.get('digitalQS3DApplicable').addCls('hidden');
	            
	            Ext.get('mouse').addCls('hidden');
	            Ext.get('rat').addCls('hidden');
	            Ext.get('welltubeselector').addCls('hidden');
	            Ext.get('welltubeselector').removeCls('visible');
	            Ext.get('formatAmplification').addCls('hidden');
	            Ext.get('formatAmplification').removeCls('visible');
	            Ext.get('human').addCls('tbuttonselected');
	            Ext.get('rat').removeCls('tbuttonselected');
	            Ext.get('mouse').removeCls('tbuttonselected');
	            Ext.get('chemistry').addCls('hidden');
	            Ext.get('chemistry').removeCls('visible');
	            Ext.get('expmethodselector').addCls('hidden');
	            Ext.get('expmethodselector').removeCls('visible');
	            //Ext.get('throughput').addCls('hidden');
	            //Ext.get('throughput').removeCls('visible');
	           // Ext.get('throughputselector').addCls('hidden');
	          //  Ext.get('throughputselector').removeCls('visible');
	            Ext.get('reptext').update('subarrays');
	            Ext.get('reptext1').update('subarrays');
	            //Ext.get('expmethodselector1').addCls('hidden');
	            //Ext.get('expmethodselector1').removeCls('visible');
	            Ext.get("right").removeCls('hidden');
	            //New
	            Ext.get('DesiredFormat').addCls('visible');
	            Ext.get('DesiredFormat').removeCls('hidden');
	            updateExperimentInfo("type", "Digital PCR");
	            updateExperimentInfo("species", "Human");
				Ext.get('QS3D').addCls('hidden');
				Ext.get('QS3D').removeCls('visible');
	            resetTbutton("openarrayinstrumentselector", defaultInstruemntID);
	        }
			
			
			
			
	        //clearChartData();
			instruemntButtonFilter();
	       // showAll();
			if($( "#techboth" ).hasClass( "tbuttonselected" )){
				techBoth();
			}else if($( "#techrealtimepcr" ).hasClass( "tbuttonselected" )){
				techRealTimePCR();
			}else if($( "#techdigitalpcr" ).hasClass( "tbuttonselected" )){
				techDigitalPCR();
			}
	     }
    };
	
    var expMethodSelectHandler = function (selected) {
        if ("" + selected.dom.getAttribute("data-expinfo") == "Fast") {	
            updateExperimentInfo("method", "Fast");
        } else {
            updateExperimentInfo("method", "Standard");
        }
		instruemntButtonFilter();
        //commented on 14/05/2014
        //processOutputList();
    };
	
	
	/* Sankar 25/02/2015*/
	var cpsConsumablesSelectHandler = function (selected){
		 if ("" + selected.dom.getAttribute("data-expinfo") == "cpsWellPlates") {
			updateExperimentInfo("csPlatingAssayVal", "Gene Expression");
			updateExperimentInfo("cpsConsumableType", "plates");
			updateExperimentInfo("isCPSoamiRNA", false);
			Ext.get('secondstepINVtargets').addCls('visible');
			Ext.get('secondstepINVtargets').removeCls('hidden');
			Ext.get('miRNA_questions_div').addCls('hidden');
			Ext.get('miRNA_questions_div').removeCls('visible');
			//Ext.get('invAssaysDiv').addCls('visible');
			//Ext.get('invAssaysDiv').removeCls('hidden');
			Ext.get('cpsInvAssaySPn').update('# of Inv Assays');
			Ext.get('secondstepINVtargetsSpn').update('# of Inv Assays');
			Ext.get('cpsOpenArray').removeCls('tbuttonselected');
			Ext.get('cpsWellPlates').addCls('tbuttonselected');
			Ext.get('miRNA').addCls('visible');
			Ext.get('miRNA').removeCls('hidden');
			Ext.get('miRNA').removeCls('tbuttonselected');
			Ext.get('Gene Expression').addCls('tbuttonselected');
			Ext.get('Gene Expression').removeCls('hidden');
			Ext.get('Gene Expression').addCls('visible');
			Ext.get('SNP').removeCls('tbuttonselected');
			Ext.get('SNP').removeCls('hidden');
			Ext.get('SNP').addCls('visible');
			Ext.get('CNV').removeCls('tbuttonselected');
			Ext.get('CNV').removeCls('hidden');
			Ext.get('CNV').removeCls('visible');
			Ext.get('Cast PCR').removeCls('hidden');
			Ext.get('Cast PCR').removeCls('tbuttonselected');
			Ext.get('Cast PCR').addCls('visible');
        }  else if("" + selected.dom.getAttribute("data-expinfo") == "cpsOpenArray"){
            updateExperimentInfo("csPlatingAssayVal", "miRNA");
			updateExperimentInfo("cpsConsumableType", "openarray");
			updateExperimentInfo("isCPSoamiRNA", true);
			//Ext.get('csplate_no_of_custommto').dom.value = 24; Madhu asked to remove this on 06-10-2015
			Ext.get('csplate_no_of_custommto_hd').addCls('visible');
			Ext.get('csplate_no_of_custommto_hd').removeCls('hidden');
			//Ext.get('secondstepINVtargets').addCls('hidden');
			//Ext.get('secondstepINVtargets').removeCls('visible');
			Ext.get('secondstepINVtargets').addCls('visible');
			Ext.get('secondstepINVtargets').removeCls('hidden');
			Ext.get('secondstepINVtargetsSpn').update('# of Inv/MTO Assays');
			Ext.get('miRNA_questions_div').addCls('visible');
			Ext.get('miRNA_questions_div').removeCls('hidden');
			Ext.get('cpsInvAssaySPn').update('# of assays');
			//Ext.get('invAssaysDiv').addCls('hidden');
			//Ext.get('invAssaysDiv').removeCls('visible');
			Ext.get('cpsOpenArray').addCls('tbuttonselected');
			//Ext.get('cpsWellPlates').removeCls('tbuttonselected');
			Ext.get('miRNA').addCls('tbuttonselected');
			Ext.get('miRNA').addCls('visible');
			Ext.get('miRNA').removeCls('hidden');
			Ext.get('Gene Expression').addCls('hidden');
			Ext.get('Gene Expression').removeCls('visible');
			Ext.get('SNP').addCls('hidden');
			Ext.get('SNP').removeCls('visible');
			Ext.get('CNV').addCls('hidden');
			Ext.get('CNV').removeCls('visible');
			Ext.get('Cast PCR').addCls('hidden');
			Ext.get('Cast PCR').removeCls('visible');
        }
	}
	/* End 25/02/2015*/
	
	/*Magesh 05/1/2015*/
	var expCSPlatingAssaySelectHandler = function (selected) {
		
		//Ext.get('csplate_no_of_custommto').addCls('visible');
		//Ext.get('csplate_no_of_custommto').removeCls('hidden');
		Ext.get('csplate_no_of_custommto_hd').addCls('visible');
		Ext.get('csplate_no_of_custommto_hd').removeCls('hidden');
		//Ext.get('csplate_no_of_custommto').dom.value = 24; Madhu asked to remove this on 06-10-2015
        if ("" + selected.dom.getAttribute("data-expinfo") == "Gene Expression") {
            updateExperimentInfo("csPlatingAssayVal", "Gene Expression");
        }  else if("" + selected.dom.getAttribute("data-expinfo") == "miRNA"){
            updateExperimentInfo("csPlatingAssayVal", "miRNA");
        }  else if("" + selected.dom.getAttribute("data-expinfo") == "SNP"){
			updateExperimentInfo("csPlatingAssayVal", "SNP");
		}  else if("" + selected.dom.getAttribute("data-expinfo") == "CNV"){
			updateExperimentInfo("csPlatingAssayVal", "CNV");
		} else if("" + selected.dom.getAttribute("data-expinfo") == "Cast PCR"){
			updateExperimentInfo("csPlatingAssayVal", "Cast PCR");
			//Ext.get('csplate_no_of_custommto').addCls('hidden');
			//Ext.get('csplate_no_of_custommto').removeCls('visible');
			Ext.get('csplate_no_of_custommto_hd').addCls('hidden');
			Ext.get('csplate_no_of_custommto_hd').removeCls('visible');
			//Ext.get('csplate_no_of_custommto').dom.value = 0; Madhu asked to remove this on 06-10-2015
		}
        //commented on 14/05/2014
        //processOutputList();
    };
	/*End 05/01/2015*/
	
	/*hari 13/10/2014*/
	var expTubeMethodSelectHandler = function (selected) {
		Ext.get('preAmpParnt').addCls('hidden');
		//Ext.get('tubeTypeCombo').addCls('hidden');
        Ext.get('welltubeselector').addCls('hidden');
		Ext.get('formatAmplification').addCls('hidden');
		updateExperimentInfo("technology", "Both");
		techBoth();
        if ("" + selected.dom.getAttribute("data-expinfo") == "All") {	
			
            updateExperimentInfo("tubeSel", "All");
			
			Ext.get('welltubeselector').removeCls('hidden');
			Ext.get('formatAmplification').removeCls('hidden');
			instruemntButtonFilter();
			Ext.get('techdigitalpcr').addCls('visible');
			Ext.get('techdigitalpcr').removeCls('hidden');
			Ext.get('techrealtimepcr').addCls('visible');
			Ext.get('techrealtimepcr').removeCls('hidden');
			Ext.get('techboth').addCls('visible');
			Ext.get('techboth').addCls('tbuttonselected');
			Ext.get('techboth').removeCls('hidden');
			Ext.get('preAmpParnt').addCls('hidden').removeCls('visible');
        }  else if("" + selected.dom.getAttribute("data-expinfo") == "Tube"){
            updateExperimentInfo("tubeSel", "Tube");
			
			Ext.get('welltubeselector').removeCls('hidden');
			
			//Ext.get('formatAmplification').addCls('visible');
			Ext.get('formatAmplification').removeCls('hidden');			
			Ext.get('techdigitalpcr').addCls('hidden');
			Ext.get('techdigitalpcr').removeCls('visible');			
			Ext.get('techrealtimepcr').addCls('visible');
			Ext.get('techrealtimepcr').removeCls('hidden');
			Ext.get('techrealtimepcr').addCls('tbuttonselected');
			Ext.get('techboth').addCls('hidden');
			Ext.get('techboth').removeCls('visible');
			Ext.get('techboth').removeCls('tbuttonselected');
			Ext.get('techdigitalpcr').removeCls('tbuttonselected');
			if(getExperimentInfo('type') == "Gene Expression" || getExperimentInfo('type') == "miRNA"){
				Ext.get('preAmpParnt').addCls('visible').removeCls('hidden');
			} else {
				Ext.get('preAmpParnt').addCls('hidden').removeCls('visible');
			}
			
			instruemntButtonFilter();
        }  else if("" + selected.dom.getAttribute("data-expinfo") == "TAPFast"){
			updateExperimentInfo("tubeSel", "TAPFast");
			Ext.get('techdigitalpcr').addCls('hidden');
			Ext.get('techdigitalpcr').removeCls('visible');
			Ext.get('techrealtimepcr').addCls('visible');
			Ext.get('techrealtimepcr').removeCls('hidden');
			Ext.get('techrealtimepcr').addCls('tbuttonselected');
			Ext.get('techboth').addCls('hidden');
			Ext.get('techboth').removeCls('visible');
			Ext.get('techboth').removeCls('tbuttonselected');
			Ext.get('techdigitalpcr').removeCls('tbuttonselected');
			Ext.get('preAmpParnt').addCls('hidden').removeCls('visible');
			instruemntButtonFilter();
		} else if("" + selected.dom.getAttribute("data-expinfo") == "TAPStandard"){
			updateExperimentInfo("tubeSel", "TAPStandard");
			Ext.get('techdigitalpcr').addCls('hidden');
			Ext.get('techdigitalpcr').removeCls('visible');
			Ext.get('techrealtimepcr').addCls('visible');
			Ext.get('techrealtimepcr').removeCls('hidden');
			Ext.get('techrealtimepcr').addCls('tbuttonselected');
			Ext.get('techboth').addCls('hidden');
			Ext.get('techboth').removeCls('visible');
			Ext.get('techboth').removeCls('tbuttonselected');
			Ext.get('techdigitalpcr').removeCls('tbuttonselected');
			Ext.get('preAmpParnt').addCls('hidden').removeCls('visible');
			instruemntButtonFilter();
		} else if("" + selected.dom.getAttribute("data-expinfo") == "TAC"){
			updateExperimentInfo("tubeSel", "TAC");
			Ext.get('techdigitalpcr').addCls('hidden');
			Ext.get('techdigitalpcr').removeCls('visible');
			Ext.get('techrealtimepcr').addCls('visible');
			Ext.get('techrealtimepcr').removeCls('hidden');
			Ext.get('techrealtimepcr').addCls('tbuttonselected');
			Ext.get('techboth').addCls('hidden');
			Ext.get('techboth').removeCls('visible');
			Ext.get('techboth').removeCls('tbuttonselected');
			Ext.get('techdigitalpcr').removeCls('tbuttonselected');
			Ext.get('preAmpParnt').addCls('hidden').removeCls('visible');
			instruemntButtonFilter();
		}else if("" + selected.dom.getAttribute("data-expinfo") == "OpenArray"){
			updateExperimentInfo("tubeSel", "OpenArray");
			Ext.get('techdigitalpcr').addCls('hidden');
			Ext.get('techdigitalpcr').removeCls('visible');
			Ext.get('techrealtimepcr').addCls('visible');
			Ext.get('techrealtimepcr').removeCls('hidden');
			Ext.get('techrealtimepcr').addCls('tbuttonselected');
			Ext.get('techboth').addCls('hidden');
			Ext.get('techboth').removeCls('visible');
			Ext.get('techboth').removeCls('tbuttonselected');
			Ext.get('techdigitalpcr').removeCls('tbuttonselected');
			Ext.get('preAmpParnt').addCls('hidden').removeCls('visible');
			instruemntButtonFilter();
		}else if("" + selected.dom.getAttribute("data-expinfo") == "Chips"){ 
			updateExperimentInfo("tubeSel", "Chips");
			Ext.get('welltubeselector').removeCls('hidden');
			Ext.get('formatAmplification').removeCls('hidden');
			Ext.get('techdigitalpcr').addCls('visible');
			Ext.get('techdigitalpcr').removeCls('hidden');
			Ext.get('techrealtimepcr').addCls('hidden');
			Ext.get('techrealtimepcr').removeCls('visible');
			Ext.get('techdigitalpcr').addCls('tbuttonselected');
			Ext.get('techboth').addCls('hidden');
			Ext.get('techboth').removeCls('visible');
			Ext.get('techboth').removeCls('tbuttonselected');
			Ext.get('techrealtimepcr').removeCls('tbuttonselected');
			Ext.get('preAmpParnt').addCls('hidden').removeCls('visible');
			updateExperimentInfo("technology", "DigitalPCR");
			instruemntButtonFilter();
			//techDigitalPCR();
			//instruemntButtonFilter();
		}
        //commented on 14/05/2014
        //processOutputList();
    };
	/*hari 13/10/2014 completed*/
	var technologyselector = function (selected) {
		var selectObj = selected.dom.getAttribute("data-expinfo").toString();
		var techboth = $( "#techboth" ).hasClass( "tbuttonselected" );
		var techrealtimepcr = $( "#techrealtimepcr" ).hasClass( "tbuttonselected" );
        if (techboth) {	
            updateExperimentInfo("technology", "Both");
        } else if (techrealtimepcr) {	
            updateExperimentInfo("technology", "RealTimePCR");
        } else {
            updateExperimentInfo("technology", "DigitalPCR");
        }
		instruemntButtonFilter();
        //commented on 14/05/2014
        //processOutputList();
    };
    var platetubeselectHandler = function (selected) {
        var selectObj = selected.dom.getAttribute("data-expinfo").toString();
        if (selectObj == "96-well") {
            updateExperimentInfo("equipment", "96-well");
        } else if (selectObj == "384-well") {
            updateExperimentInfo("equipment", "384-well");
        } else {
            updateExperimentInfo("equipment", "Tube");
        }
		
       /* if (isIPad) {
            if ("" + selected.dom.getAttribute("data-expinfo") == "96-well") {
                Ext.get('tooltip').addCls('visible');
                Ext.get('tooltip').removeCls('hidden');
                if (getExperimentInfo('type') == 'Genotyping') {
                    Ext.get('tooltiptxt').update("Reaction volume: 25uL");
                } else {
                    Ext.get('tooltiptxt').update("Reaction volume: 20uL");
                }
                Ext.get('tooltip').dom.style.top = (selected.dom.offsetTop - 60) + "px";
                Ext.get('tooltip').dom.style.left = (selected.getX() - 50) + "px";
            } else if ("" + selected.dom.getAttribute("data-expinfo") == "384-well") {
                Ext.get('tooltip').addCls('visible');
                Ext.get('tooltip').removeCls('hidden');
                if (getExperimentInfo('type') == 'Genotyping') {
                    Ext.get('tooltiptxt').update("Reaction volume: 5uL");
                } else {
                    Ext.get('tooltiptxt').update("Reaction volume: 10uL");
                }
                Ext.get('tooltip').dom.style.top = (selected.dom.offsetTop - 60) + "px";
                Ext.get('tooltip').dom.style.left = (selected.getX() - 50) + "px";
            }
        }*/
		instruemntButtonFilter();
        //commented on 14/05/2014
        //processOutputList();
    };
    var speciesselecHandler = function (selected) {
        var selectObj = selected.dom.getAttribute("data-expinfo").toString();
        if (selectObj == "Human") {
            updateExperimentInfo("species", "Human");
            removeReferanceItem('digitalreferenceassay');
            removeReferanceItem('referenceassay');
            addReferanceAssay("Human");
        } else if (selectObj == "Mouse") {
            updateExperimentInfo("species", "Mouse");
            removeReferanceItem('digitalreferenceassay');
            removeReferanceItem('referenceassay');
            addReferanceAssay("Mouse");
        } else {
            updateExperimentInfo("species", "Rat");
        }
        //commented on 14/05/2014
        //processOutputList();
    };
    /*var throughputSelectHandler = function (selected) {
        Ext.get('openarrayinstrument').addCls('visible');
        Ext.get('openarrayinstrument').removeCls('hidden');
        Ext.get('openarrayinstrumentselector').addCls('visible');
        Ext.get('openarrayinstrumentselector').removeCls('hidden');
        if ("" + selected.dom.getAttribute("data-expinfo") == "All") {
            updateExperimentInfo("throughput", "All");
            currMode = "All";
        } else if ("" + selected.dom.getAttribute("data-expinfo") == "High") {
            updateExperimentInfo("throughput", "High");
            currMode = "High";
        } else {
            updateExperimentInfo("throughput", "Low");
            currMode = "Low";
            Ext.get('openarrayinstrument').addCls('hidden');
            Ext.get('openarrayinstrument').removeCls('visible');
            Ext.get('openarrayinstrumentselector').addCls('hidden');
            Ext.get('openarrayinstrumentselector').removeCls('visible');
        }
        if (isIPad) {
            /*if ("" + selected.dom.getAttribute("data-expinfo") == "High") {
                Ext.get('tooltip').addCls('visible');
                Ext.get('tooltip').removeCls('hidden');
                Ext.get('tooltiptxt').update("TaqMan Array and OpenArray options; 1000's of reactions");
                Ext.get('tooltip').dom.style.top = (selected.dom.offsetTop - 60) + "px";
                Ext.get('tooltip').dom.style.left = (selected.getX() - 50) + "px";
            } else if ("" + selected.dom.getAttribute("data-expinfo") == "Low") {
                Ext.get('tooltip').addCls('visible');
                Ext.get('tooltip').removeCls('hidden');
                Ext.get('tooltiptxt').update("Individual Tube and Plate options; a small number of reactions");
                Ext.get('tooltip').dom.style.top = (selected.dom.offsetTop - 60) + "px";
                Ext.get('tooltip').dom.style.left = (selected.getX() - 50) + "px";
            }*/
       /* }
       //commented on 14/05/2014
        //processOutputList();
    };*/
    var openarrayinstrumentSelectHandler = function (selected) {
        /*if ("" + selected.dom.getAttribute("data-expinfo") == "QuantStudio") {
            updateExperimentInfo("openarrayinstrument", "QuantStudio");
        } else {
            updateExperimentInfo("openarrayinstrument", "NTCycler");
        }*/
        updateExperimentInfo("openarrayinstrument", selected.dom.getAttribute("data-expinfo"));
		//commented on 14/05/2014
        //processOutputList();
    };
    if (!isIPad) {
        /* Ext.get('throughputselector').select('span').on('mouseover', function (e) {
            var selected = Ext.get(e.target);
            if ("" + selected.dom.getAttribute("data-expinfo") == "High") {
                Ext.get('tooltip').addCls('visible');
                Ext.get('tooltip').removeCls('hidden');
                Ext.get('tooltiptxt').update("TaqMan Array and OpenArray options; 1000's of reactions");
                Ext.get('tooltip').dom.style.top = (selected.dom.offsetTop - 60) + "px";
                Ext.get('tooltip').dom.style.left = (selected.getX() - 50) + "px";
            } else if ("" + selected.dom.getAttribute("data-expinfo") == "Low") {
                Ext.get('tooltip').addCls('visible');
                Ext.get('tooltip').removeCls('hidden');
                Ext.get('tooltiptxt').update("Individual Tube and Plate options; a small number of reactions");
                Ext.get('tooltip').dom.style.top = (selected.dom.offsetTop - 60) + "px";
                Ext.get('tooltip').dom.style.left = (selected.getX() - 50) + "px";
            }
        });*/
        /*Ext.get('welltubeselector').select('span').on('mouseover', function (e) {
            var selected = Ext.get(e.target);
            if ("" + selected.dom.getAttribute("data-expinfo") == "96-well") {
                Ext.get('tooltip').addCls('visible');
                Ext.get('tooltip').removeCls('hidden');
                if (getExperimentInfo('type') == 'Genotyping') {
                    Ext.get('tooltiptxt').update("Reaction volume: 25uL");
                } else {
                    Ext.get('tooltiptxt').update("Reaction volume: 20uL");
                }
                Ext.get('tooltip').dom.style.top = (selected.dom.offsetTop - 60) + "px";
                Ext.get('tooltip').dom.style.left = (selected.getX() - 50) + "px";
            } else if ("" + selected.dom.getAttribute("data-expinfo") == "384-well") {
                Ext.get('tooltip').addCls('visible');
                Ext.get('tooltip').removeCls('hidden');
                if (getExperimentInfo('type') == 'Genotyping') {
                    Ext.get('tooltiptxt').update("Reaction volume: 5uL");
                } else {
                    Ext.get('tooltiptxt').update("Reaction volume: 10uL");
                }
                Ext.get('tooltip').dom.style.top = (selected.dom.offsetTop - 60) + "px";
                Ext.get('tooltip').dom.style.left = (selected.getX() - 50) + "px";
            }
        });*/
    }
    /*Ext.get('throughputselector').select('span').on('mouseout', function (e) {
        Ext.get('tooltip').addCls('hidden');
        Ext.get('tooltip').removeCls('visible');
    });*/
    /*Ext.get('welltubeselector').select('span').on('mouseout', function (e) {
        Ext.get('tooltip').addCls('hidden');
        Ext.get('tooltip').removeCls('visible');
    });*/
    var sortbyHandler = function (selected) {
        var selectObj = selected.dom.getAttribute("data-sortby").toString();
        if (selectObj == "Price") {
            outputList.sort('totalcost', 'ASC');
            displaySortedList();
            sortedBy = 1;
            displayChart();
        } else {
            outputList.sort('noofhours', 'ASC');
            displaySortedList();
            sortedBy = 0;
            displayChart();
        }
    };
    createToggleButtonSet('exptypeselector', expTypeSelectHandler);
	createToggleButtonSet('cpsConsumablesSelector', cpsConsumablesSelectHandler);/*Sankar 25/02/2015*/
	createToggleButtonSet('csplateassaytypeselector', expCSPlatingAssaySelectHandler);/*hari 05/01/2015*/
    createToggleButtonSet('tubeMethod', expTubeMethodSelectHandler);/*hari 13/10/2014*/
    createToggleButtonSet('expmethodselector', expMethodSelectHandler);
    createToggleButtonSet('welltubeselector', platetubeselectHandler);
    createToggleButtonSet('expmethodselector1', expMethodSelectHandler);
    createToggleButtonSet('welltubeselector1', platetubeselectHandler);
    createToggleButtonSet('speciesselector', speciesselecHandler);
//    createToggleButtonSet('throughputselector', throughputSelectHandler);
    createToggleButtonSet('openarrayinstrumentselector', openarrayinstrumentSelectHandler);
    createToggleButtonSet('sortby', sortbyHandler);
	createToggleButtonSet('technologyselector', technologyselector);
    Ext.get('no_of_targets').on('keyup', function (e) {
        var targets = Ext.get('no_of_targets').dom.value;
        if (isNumber(targets)) {
            updateExperimentInfo("nooftargets", targets);
        }
    });
    Ext.get('no_of_samples').on('keyup', function (e) {
        var samples = Ext.get('no_of_samples').dom.value;
        if (isNumber(samples)) {
           updateExperimentInfo("noofsamples", samples);
        }
    });
    Ext.get('no_of_replicates').on('keyup', function (e) {
        var replicates = Ext.get('no_of_replicates').dom.value;
        if (isNumber(replicates)) {
            updateExperimentInfo("noofreplicates", replicates);
            updateExperimentInfo("noofsubarrays", replicates);
        }
    });
    Ext.get('no_of_referance_targets').on('keyup', function (e) {
        var replicates = Ext.get('no_of_referance_targets').dom.value;
        if (isNumber(replicates)) {
           updateExperimentInfo("noofreftargets", replicates);
        }
    });
    Ext.get('no_of_referance_targets1').on('keyup', function (e) {
        var targets = Ext.get('no_of_referance_targets1').dom.value;
        if (targets == 0) {
            var targets = 1;
        }
        if (isNumber(targets)) {
           updateExperimentInfo("noofreftargets", targets);
           if( getExperimentInfo("isCustomPlatingCalc") ){
				 processCustomPlating();
			} else {
				processOutputList();
			}
        }
    });
    Ext.get('no_of_targets1').on('keyup', function (e) {
        var targets = Ext.get('no_of_targets1').dom.value;
        if (targets == 0) {
            var targets = 1;
        }
        if (isNumber(targets)) {
           updateExperimentInfo("nooftargets", targets);		   
           if( getExperimentInfo("isCustomPlatingCalc") ){
				 processCustomPlating();
			} else {
				processOutputList();
			}
        }
    });
    Ext.get('no_of_samples1').on('keyup', function (e) {
        var samples = Ext.get('no_of_samples1').dom.value;
        if (samples == 0) {
            var samples = 1;
        }
        if (isNumber(samples)) {
            updateExperimentInfo("noofsamples", samples);
			if( getExperimentInfo("isCustomPlatingCalc") ){
				 processCustomPlating();
			} else {
				processOutputList();
			}
        }
    });
	Ext.get('no_of_INVtargets1').on('keyup', function (e) {
        var no_of_INVtargets1 = Number(Ext.get('no_of_INVtargets1').dom.value);
        //var no_of_CUSMOtargets1 = Number(Ext.get('no_of_CUSMOtargets1').dom.value); Madhu asked to remove this on 06-10-2015
        if (no_of_INVtargets1 == 0) {
            var no_of_INVtargets1 = 1;
        }
		/*if (no_of_CUSMOtargets1 == 0) {
            var no_of_CUSMOtargets1 = 1;
        }*/
		var nooftargets = no_of_INVtargets1 ;//+ no_of_CUSMOtargets1;
        if (isNumber(no_of_INVtargets1)) {            
			if( getExperimentInfo("isCustomPlatingCalc") ){
				updateExperimentInfo("nooftargets", nooftargets);
				processCustomPlating();
			} 
        }
    });
	Ext.get('no_of_CUSMOtargets1').on('keyup', function (e) {
        var no_of_INVtargets1 = Number(Ext.get('no_of_INVtargets1').dom.value);
        var no_of_CUSMOtargets1 = Number(Ext.get('no_of_CUSMOtargets1').dom.value);
        if (no_of_INVtargets1 == 0) {
            var no_of_INVtargets1 = 1;
        }
		if (no_of_CUSMOtargets1 == 0) {
            var no_of_CUSMOtargets1 = 1;
        }
		
        if (isNumber(no_of_INVtargets1)) {            
			if( getExperimentInfo("isCustomPlatingCalc") ){
				if(!getExperimentInfo("isCPSoamiRNA")){
					var nooftargets = no_of_INVtargets1 ;//+ no_of_CUSMOtargets1;
					updateExperimentInfo("nooftargets", nooftargets);
				} else {
					var nooftargets = no_of_CUSMOtargets1;
					updateExperimentInfo("noofcsptargets", nooftargets);
				}
				
				processCustomPlating();
			} 
        }
    });
    Ext.get('no_of_replicates1').on('keyup', function (e) {
        var replicates = Ext.get('no_of_replicates1').dom.value;
        if (replicates == 0) {
            var replicates = 1;
        }
        if (isNumber(replicates)) {
           updateExperimentInfo("noofreplicates", replicates);
           updateExperimentInfo("noofsubarrays", replicates);
			if( getExperimentInfo("isCustomPlatingCalc") ){
				 processCustomPlating();
			} else {
				processOutputList();
			}
        }
    });
    Ext.get('pair_of_primers').on('keyup', function (e) {
        var replicates = Ext.get('pair_of_primers').dom.value;
        if (isNumber(replicates)) {
		//Commented on 14/05/2014
            processOutputList();
        }
    });
    Ext.get('perc_primers_redesigned').on('keyup', function (e) {
        var replicates = Ext.get('perc_primers_redesigned').dom.value;
        if (isNumber(replicates)) {
			//Commented on 14/05/2014
            processOutputList();
        }
    });
    Ext.get('hourly_labour').on('keyup', function (e) {
        var replicates = Ext.get('hourly_labour').dom.value;
        if (isNumber(replicates)) {
			//Commented on 14/05/2014
           processOutputList();
        }
    });
    Ext.get('no_of_hours').on('keyup', function (e) {
        var replicates = Ext.get('no_of_hours').dom.value;
        if (isNumber(replicates)) {
			//Commented on 14/05/2014
            processOutputList();
        }
    });
    Ext.get('assayperc').on('keyup', function (e) {
        var value = Ext.get('assayperc').dom.value.replace('%', '');
		
		
        if (isNumber(value)) {
			if(value > 50){
				Ext.get('assayperc').dom.value = 50;
			}
			processOutputList();
        }
    });
    Ext.get('masterperc').on('keyup', function (e) {
        var value = Ext.get('masterperc').dom.value.replace('%', '');
        if (isNumber(value)) {
			if(value > 50){
				Ext.get('masterperc').dom.value = 50;
			}
			processOutputList();
        }
    });
    Ext.get('plateperc').on('keyup', function (e) {
        var value = Ext.get('plateperc').dom.value.replace('%', '');
        if (isNumber(value)) {
			if(value > 50){
				Ext.get('plateperc').dom.value = 50;
			}
			processOutputList();
        }
    });
    Ext.get('assayperc').on('blur', function (e) {
        var value = Ext.get('assayperc').dom.value.replace('%', '');
        value = getMaxValue(value);
        if (isNumber(value)) {
            Ext.get('assayperc').dom.value = value + "%";
        } else {
            Ext.get('assayperc').dom.value = "0%";
        }
    });
    Ext.get('masterperc').on('blur', function (e) {
        var value = Ext.get('masterperc').dom.value.replace('%', '');
        value = getMaxValue(value);
        if (isNumber(value)) {
            Ext.get('masterperc').dom.value = value + "%";
        } else {
            Ext.get('masterperc').dom.value = "0%";
        }
    });
    Ext.get('plateperc').on('blur', function (e) {
        var value = Ext.get('plateperc').dom.value.replace('%', '');
        value = getMaxValue(value);
        if (isNumber(value)) {
            Ext.get('plateperc').dom.value = value + "%";
        } else {
            Ext.get('plateperc').dom.value = "0%";
        }
    });
    Ext.get('accessoriesperc').on('blur', function (e) {
        var value = this.dom.value.replace('%', '');
        value = getMaxValue(value);
        if (isNumber(value)) {
            this.dom.value = value + "%";
        } else {
            this.dom.value = "0%";
        }
    });
    Ext.get('openarrayperc').on('blur', function (e) {
        var value = this.dom.value.replace('%', '');
        value = getMaxValue(value);
        if (isNumber(value)) {
            this.dom.value = value + "%";
        } else {
            this.dom.value = "0%";
        }
    });
    Ext.get('preamprtperc').on('blur', function (e) {
        var value = this.dom.value.replace('%', '');
        value = getMaxValue(value);
        if (isNumber(value)) {
            this.dom.value = value + "%";
        } else {
            this.dom.value = "0%";
        }
    });
    Ext.get('no_of_targets').on('blur', function (e) {
        var targets = Ext.get('no_of_targets').dom.value;
        if (isNumber(targets)) {
            updateExperimentInfo("nooftargets", targets);
        } else {
            Ext.get('no_of_targets').dom.value = "1";
        }
    });
    Ext.get('no_of_samples').on('blur', function (e) {
        var samples = Ext.get('no_of_samples').dom.value;
        if (isNumber(samples)) {
           updateExperimentInfo("noofsamples", samples);
        } else {
            Ext.get('no_of_samples').dom.value = "1";
        }
    });
    Ext.get('no_of_replicates').on('blur', function (e) {
        var replicates = Ext.get('no_of_replicates').dom.value;
        if (isNumber(replicates)) {
           updateExperimentInfo("noofreplicates", replicates);
           updateExperimentInfo("noofsubarrays", replicates);
        } else {
            Ext.get('no_of_replicates').dom.value = "1";
        }
    });
    Ext.get('no_of_targets1').on('blur', function (e) {
        var targets = Ext.get('no_of_targets1').dom.value;
        if (targets == 0) {
            var targets = 1;
        }
        if (isNumber(targets)) {
           updateExperimentInfo("nooftargets", targets);
			if( getExperimentInfo("isCustomPlatingCalc") ){
				 processCustomPlating();
			} else {
				processOutputList();
			}
        } else {
            Ext.get('no_of_targets1').dom.value = "1";
        }
    });
    Ext.get('no_of_samples1').on('blur', function (e) {
        var samples = Ext.get('no_of_samples1').dom.value;
        if (samples == 0) {
            var samples = 1;
        }
        if (isNumber(samples)) {
           updateExperimentInfo("noofsamples", samples);
			if( getExperimentInfo("isCustomPlatingCalc") ){
				 processCustomPlating();
			} else {
				processOutputList();
			}
        } else {
            Ext.get('no_of_samples1').dom.value = "0";
        }
    });
    Ext.get('no_of_replicates1').on('blur', function (e) {
        var replicates = Ext.get('no_of_replicates1').dom.value;
        if (replicates == 0) {
            var replicates = 1;
        }
        if (isNumber(replicates)) {
          updateExperimentInfo("noofreplicates", replicates);
          updateExperimentInfo("noofsubarrays", replicates);
			if( getExperimentInfo("isCustomPlatingCalc") ){
				 processCustomPlating();
			} else {
				processOutputList();
			}
        } else {
            Ext.get('no_of_replicates1').dom.value = "0";
        }
    });
    Ext.get('pair_of_primers').on('blur', function (e) {
        var replicates = Ext.get('pair_of_primers').dom.value;
        if (isNumber(replicates)) {
			//Commented on 14/05/2014
           // processOutputList();
        } else {
            Ext.get('pair_of_primers').dom.value = "0";
        }
    });
    Ext.get('perc_primers_redesigned').on('blur', function (e) {
        var replicates = Ext.get('perc_primers_redesigned').dom.value;
        if (isNumber(replicates)) {
			//Commented on 14/05/2014
           // processOutputList();
        } else {
            Ext.get('perc_primers_redesigned').dom.value = "0";
        }
    });
    Ext.get('hourly_labour').on('blur', function (e) {
        var replicates = Ext.get('hourly_labour').dom.value;
        if (isNumber(replicates)) {
			//Commented on 14/05/2014
          //  processOutputList();
        } else {
            Ext.get('hourly_labour').dom.value = "0";
        }
    });
    Ext.get('no_of_hours').on('blur', function (e) {
        var replicates = Ext.get('no_of_hours').dom.value;
        if (isNumber(replicates)) {
			//Commented on 14/05/2014
           // processOutputList();
        } else {
            Ext.get('no_of_hours').dom.value = "0";
        }
    });
	Ext.get('cscalcprices').on('click', function (e) {
		//Ext.get('delayjsonloading').removeCls('dispNone');
		//Ext.get('delayjsonloading').addCls('dispBlck');
		
		var invAssayVal =  Number(Ext.get('csplate_no_of_invassays').dom.value); 
		//var cusMtoAssayVal =  Number(Ext.get('csplate_no_of_custommto').dom.value); Madhu asked to remove this on 06-10-2015
		var sampleAssayVal =  Number(Ext.get('csplate_no_of_samples').dom.value); 
		var replicatesAssayVal =  Number(Ext.get('csplate_no_of_replicates').dom.value);
		var totTarget = invAssayVal ; //+ cusMtoAssayVal;
		
		//updateExperimentInfo("noofcsptargets", cusMtoAssayVal); Madhu asked to remove this on 06-10-2015
		updateExperimentInfo("noofinvptargets", invAssayVal);
		updateExperimentInfo("nooftargets", totTarget);
		updateExperimentInfo("noofsamples", sampleAssayVal);
		updateExperimentInfo("noofreplicates", replicatesAssayVal);
		updateExperimentInfo("noofsubarrays", replicatesAssayVal);
		updateExperimentInfo("type", getExperimentInfo("csPlatingAssayVal"));
		
		if( getExperimentInfo("cpsConsumableType") == "openarray" ){
			if( totTarget <= 224 ){
				showSecondStepCSPValidaton();
			}else{
				Ext.Msg.alert('Invalid Values', 'Maximum target size is 224');
			}
		}else{
			showSecondStepCSPValidaton();
		}
		
	});
    Ext.get('calcprices').on('click', function (e) {	
		Ext.get('delayjsonloading').removeCls('dispNone');
		Ext.get('delayjsonloading').addCls('dispBlck');
		Ext.get('viewTab').addCls('hidden').removeCls('visible');
        if (validateFirstStep()) {
            var targets = Ext.get('no_of_targets').dom.value;
            var samples = Ext.get('no_of_samples').dom.value;
            var replicates = Ext.get('no_of_replicates').dom.value;
            var subarrays = replicates;
            updateExperimentInfo("nooftargets", targets);
            updateExperimentInfo("noofsamples", samples);
            updateExperimentInfo("noofreplicates", replicates);
            updateExperimentInfo("noofsubarrays", subarrays);
			
			// Loading Json files when calculate price button clicked
			if (!haveEverythingNeeded()){				
				showLoading(true);
				loadModels();
				//delayjsonloading();		
				
			}
			
            showSecondStep();
            //processOutputList(1);
        }
		
    });
    Ext.get('pgxcalcprices').on('click', function (e) {
		//Ext.get('delayjsonloading').removeCls('dispNone');
		//Ext.get('delayjsonloading').addCls('dispBlck');
		Ext.get('viewTab').addCls('hidden').removeCls('visible');
		var generateQuoteFor = $('input[name=generateQuoteFor]:radio:checked').val();
		updateExperimentInfo("generateQuoteFor", generateQuoteFor);
		e.preventDefault();
		/*if(isValidIstrumrntsforPGX()){
	          showPGxSecondStep();
		}else{
			alert("Please enter the necessary input values.");		
		}*/
		var PGxreturnval = isValidIstrumrntsforPGX();		
			if(PGxreturnval == true){				
				showPGxSecondStep();
			} else {
				alert(PGxreturnval);
			}
			loadPGxDownloadify1();
			loadPGxDownloadify();
    });
    
    Ext.get("tabbarTab1").on('click', function (e) {
		$("#errtarget").html("");
		if($("#cpsbtn").hasClass('tbuttonselected')){
			Ext.get("viewTab").addCls('hidden').removeCls('visible');
		} else {
			Ext.get("viewTab").addCls('visible').removeCls('hidden');
		}
		
		updateExperimentInfo("formatFilter", '');
		updateExperimentInfo("isOtherFormat", "NO");
		updateExperimentInfo("isOtherMMFormat", "NO");
		
		Ext.get('editinputs').addCls('hidden');
		Ext.get('editinputs').removeCls('visible');
		
		Ext.get('editinputsCPS').addCls('hidden');
		Ext.get('editinputsCPS').removeCls('visible');	
				
		Ext.get('detailoverview').addCls('visible');
		Ext.get('detailoverview').removeCls('hidden');		
		
        managetab("stepone", activetabid, 'tabbar');
        e.preventDefault();
    });
    
    Ext.get("pgxtabbarTab1").on('click', function (e) {		
		$(".currencyDrop").show();
		Ext.get('viewTab').addCls('visible').removeCls('hidden');
        managetab("stepone", activetabid, 'pgxtabbar');
		/*if($("#pgxbtn").hasClass('pgxtbuttonselected')){
			$("#viewTab").addCls('hidden').removeCls('visible');
		} else {
			$("#viewTab").addCls('visible').removeCls('hidden');
		}*/
        e.preventDefault();
    });
	
	
    
    Ext.get("tabbarTab2").on('click', function (e) {
		Ext.get('viewTab').addCls('hidden').removeCls('visible');
		$("#errtarget").html("");
		if( !getExperimentInfo("isCustomPlatingCalc") ){
			updateExperimentInfo("isOtherFormat", "NO");
			updateExperimentInfo("isOtherMMFormat", "NO");
			Ext.get('editinputs').addCls('hidden');
			Ext.get('editinputs').removeCls('visible');	
			Ext.get('detailoverview').addCls('visible');
			Ext.get('detailoverview').removeCls('hidden');							
			managetab("steptwo", activetabid, 'tabbar');
			Ext.get('delayjsonloading').removeCls('dispNone');
			Ext.get('delayjsonloading').addCls('dispBlck');
			if (validateFirstStep()) {
				var targets = Ext.get('no_of_targets').dom.value;
				var samples = Ext.get('no_of_samples').dom.value;
				var replicates = Ext.get('no_of_replicates').dom.value;
				var subarrays = replicates;
				updateExperimentInfo("nooftargets", targets);
				updateExperimentInfo("noofsamples", samples);
				updateExperimentInfo("noofreplicates", replicates);
				updateExperimentInfo("noofsubarrays", subarrays);
				if (!haveEverythingNeeded()){				
					showLoading(true);
					loadModels();
					//delayjsonloading();				
				}
				showSecondStep();
				//processOutputList(1);
			}
		} else{
			Ext.get('editinputsCPS').addCls('hidden');
			Ext.get('editinputsCPS').removeCls('visible');	
			Ext.get('detailoverview').addCls('visible');
			Ext.get('detailoverview').removeCls('hidden');
			//updateExperimentInfo("nooftargets", ( Number(Ext.get('no_of_CUSMOtargets1').dom.value) + Number(Ext.get('no_of_INVtargets1').dom.value) ) ); Madhu asked to remove this on 06-10-2015
			//updateExperimentInfo("nooftargets", ( Number(Ext.get('no_of_CUSMOtargets1').dom.value) ) );
			updateExperimentInfo("nooftargets", ( Number(Ext.get('no_of_INVtargets1').dom.value) ) );
			//updateExperimentInfo("noofcsptargets", Ext.get('no_of_CUSMOtargets1').dom.value); Madhu asked to remove this on 06-10-2015
			updateExperimentInfo("noofinvptargets", Ext.get('no_of_INVtargets1').dom.value);
			updateExperimentInfo("noofsamples", Ext.get('no_of_samples1').dom.value);
			updateExperimentInfo("noofreplicates", Ext.get('no_of_replicates1').dom.value);
			showSecondStepCsPlating();
		}
        e.preventDefault();
    });
    Ext.get("pgxtabbarTab2").on('click', function (e) {
        e.preventDefault();
        //showPGxSecondStep();
		/*if(isValidIstrumrntsforPGX()){
			managetab("pgxreviewquote", activetabid, 'pgxtabbar');			
	        showPGxSecondStep();
		}else{
			managetab("stepone", activetabid, 'pgxtabbar');			
			alert("Please enter the necessary input values.");		
		}*/
		var PGxreturnval = isValidIstrumrntsforPGX();
		if(PGxreturnval == true){
			managetab("pgxreviewquote", activetabid, 'pgxtabbar');			
	        showPGxSecondStep();
		} else {
			managetab("stepone", activetabid, 'pgxtabbar');			
			alert(PGxreturnval);
		}
    });
    
    Ext.get("tabbarTab3").on('click', function (e) {
		Ext.get('viewTab').addCls('hidden').removeCls('visible');
		if(enableDetailPage){
			managetab("details", activetabid, 'tabbar');        	
		}
		e.preventDefault();        
    });
    
     Ext.get("pgxtabbarTab3").on('click', function (e) {
		managetab("pgxquotedelivery", activetabid, 'pgxtabbar');  		
		e.preventDefault();        
    });
	
	/*Ext.get("sendquotespn").on('click', function (e) {
		managetab("pgxquotedelivery", activetabid, 'pgxtabbar');   
		e.preventDefault();        
    });
    
	Ext.get("sendquotespn1").on('click', function (e) {
		managetab("pgxquotedelivery", activetabid, 'pgxtabbar');   
		e.preventDefault();        
    });*/


    Ext.get("tabbar").select('a').each(function (e) {
        var hidetab = Ext.get(e).dom.getAttribute("rel");
        Ext.get(hidetab).removeCls('visible');
        Ext.get(hidetab).addCls('hidden');
    });
	
	
	Ext.get('costMenu').on('click', function (e) {
		if(getExperimentInfo("type") == "Mutation Detection"){
			Ext.get('reftargets').addCls('visible').removeCls('hidden');
		} else {
			Ext.get('reftargets').addCls('hidden').removeCls('visible');
		}
		
		Ext.get('needHelpDiv').addCls('visible').removeCls('hidden');
		Ext.get('replicatesDiv').addCls('visible').removeCls('hidden');
		Ext.get('chooseFromat').addCls('visible').removeCls('hidden');
		Ext.get('select_species').addCls('visible').removeCls('hidden');
		Ext.get('chemistrySection').addCls('visible').removeCls('hidden');
		Ext.get('consumablesection').addCls('visible').removeCls('hidden');
		Ext.get('speciesselector').addCls('visible').removeCls('hidden');
		Ext.get('cpsbtn').addCls('visible').removeCls('hidden');
		Ext.get('curnandcalbtn').addCls('visible').removeCls('hidden');
		Ext.get('currencydivpop').addCls('visible').removeCls('hidden');
		//Ext.get('expBorderDiv').addCls('hidden').removeCls('visible');	
		//Ext.get('inputsBorderDiv').removeCls('inputsBorderDiv');
		if($("#pgxbtn").hasClass('pgxtbuttonselected')){
			Ext.get('DesiredFormat').addCls('hidden').removeCls('visible');	
			//Ext.get('currencydivpop').addCls('hidden').removeCls('visible');	
			Ext.get('curnandcalbtn').addCls('hidden').removeCls('visible');	
			Ext.get('pgxcurnandcalbtn').addCls('visible').removeCls('hidden');	
		} else {
			Ext.get('DesiredFormat').addCls('visible').removeCls('hidden');	
			//Ext.get('currencydivpop').addCls('visible').removeCls('hidden');	
			Ext.get('curnandcalbtn').addCls('visible').removeCls('hidden');	
			Ext.get('pgxcurnandcalbtn').addCls('hidden').removeCls('visible');	
		}
		Ext.get('headerTab').addCls('visible').removeCls('hidden');	
		Ext.get('referralSectionDiv').addCls('hidden').removeCls('visible');	
		Ext.get('ReferralMenu').addCls('tabNonActive').removeCls('tabAcitive');	
		Ext.get('costMenu').addCls('tabAcitive').removeCls('tabNonActive');	
	});
	
	Ext.get('ReferralMenu').on('click', function (e) {
		Ext.get('needHelpDiv').addCls('hidden').removeCls('visible');
		Ext.get('reftargets').addCls('hidden').removeCls('visible');
		Ext.get('replicatesDiv').addCls('hidden').removeCls('visible');
		Ext.get('chooseFromat').addCls('hidden').removeCls('visible');
		Ext.get('select_species').addCls('hidden').removeCls('visible');
		Ext.get('chemistrySection').addCls('hidden').removeCls('visible');
		Ext.get('consumablesection').addCls('hidden').removeCls('visible');
		Ext.get('speciesselector').addCls('hidden').removeCls('visible');
		Ext.get('cpsbtn').addCls('hidden').removeCls('visible');
		Ext.get('curnandcalbtn').addCls('hidden').removeCls('visible');
		Ext.get('DesiredFormat').addCls('hidden').removeCls('visible');	
		Ext.get('currencydivpop').addCls('hidden').removeCls('visible');	
		Ext.get('headerTab').addCls('hidden').removeCls('visible');
		Ext.get('referralSectionDiv').addCls('visible').removeCls('hidden');
		Ext.get('ReferralMenu').addCls('tabAcitive').removeCls('tabNonActive');
		Ext.get('costMenu').addCls('tabNonActive').removeCls('tabAcitive');	
		//Ext.get('expBorderDiv').addCls('visible').removeCls('hidden');	
		//Ext.get('inputsBorderDiv').addCls('inputsBorderDiv');	
		
		if($("#pgxbtn").hasClass('pgxtbuttonselected')){
			Ext.get('pgxcurnandcalbtn').addCls('hidden').removeCls('visible');	
			Ext.get('selectInstrumentDrpdwn').addCls('hidden').removeCls('visible');	
		} else {
			Ext.get('pgxcurnandcalbtn').addCls('visible').removeCls('hidden');	
			Ext.get('selectInstrumentDrpdwn').addCls('visible').removeCls('hidden');	
		}
	});

	loadDownloadify();
	loadPGxDownloadify1();
	loadPGxDownloadify();
    managetab("stepone", "stepone", 'tabbar');
	//managetab("steptwo", "steptwo");
	//managetab("details", "details");
	/*
	var viewdetails = Ext.get('viewdetails');
	 viewdetails.on('click', function (e) {
		ViewDetails();
	 });*/
    var mailLink = Ext.get('maillink');
    mailLink.on('click', function (e) {
        if(!Development)
		clearMailFields();
		
		
		
        Ext.get('mailpopup').addCls('visible');
        Ext.get('mailpopup').removeCls('hidden');
        //Ext.get('mailpopup').dom.style.top = (mailLink.dom.offsetTop + 30) + "px";
        //Ext.get('mailpopup').dom.style.left = (mailLink.dom.offsetLeft - 370) + "px";
		
		Ext.get('mailpopup').dom.style.top = "110px";
		Ext.get('mailpopup').dom.style.left = "480px";
		
        //var windowHeight = document.documentElement.clientHeight;
        var windowWidth = document.documentElement.clientWidth;
        //var popupHeight = (document.getElementById('mailsuccespopup').style.height).replace('px','');
        var popupWidth = (document.getElementById('mailsuccespopup').style.width).replace('px', '');
        //Ext.get('mailsuccespopup').dom.style.top = (windowHeight/2 - popupHeight/2) + "px";
        Ext.get('mailsuccespopup').dom.style.left = (windowWidth / 2 - popupWidth / 2) + "px";
        Ext.get('mailsuccespopup').addCls('hidden');
        Ext.get('mailsuccespopup').removeCls('visible');
    });
	
	/*var pgx_maillink = Ext.get('pgx_maillink');
	pgx_maillink.on('click', function (e) { 
        if(!Development)
		clearMailFields();
		
		
		
        Ext.get('PGxmailpopup').addCls('visible');
        Ext.get('PGxmailpopup').removeCls('hidden');
        //Ext.get('mailpopup').dom.style.top = (mailLink.dom.offsetTop + 30) + "px";
        //Ext.get('mailpopup').dom.style.left = (mailLink.dom.offsetLeft - 370) + "px";
		
		Ext.get('PGxmailpopup').dom.style.top = "550px";
		Ext.get('PGxmailpopup').dom.style.left = "480px";
		
        //var windowHeight = document.documentElement.clientHeight;
        var windowWidth = document.documentElement.clientWidth;
        //var popupHeight = (document.getElementById('mailsuccespopup').style.height).replace('px','');
        var popupWidth = (document.getElementById('mailsuccespopup').style.width).replace('px', '');
        //Ext.get('mailsuccespopup').dom.style.top = (windowHeight/2 - popupHeight/2) + "px";
        Ext.get('mailsuccespopup').dom.style.left = (windowWidth / 2 - popupWidth / 2) + "px";
        Ext.get('mailsuccespopup').addCls('hidden');
        Ext.get('mailsuccespopup').removeCls('visible');
    });*/
	
    var mailpopupclose = Ext.get('mailpopupclose');
    mailpopupclose.on('click', function (e) {
        Ext.get('mailpopup').addCls('hidden');
        Ext.get('mailpopup').removeCls('visible');
    });
	
	var PGxmailpopupclose = Ext.get('PGxmailpopupclose');
    PGxmailpopupclose.on('click', function (e) {
        Ext.get('PGxmailpopup').addCls('hidden');
        Ext.get('PGxmailpopup').removeCls('visible');
    });
	
    var CurrencyToolName = "currency";
    //var regCurrency = Ext.util.Cookies.get(CurrencyToolName);
    var regCurrency = getCookie(CurrencyToolName);
    var currencyObj = Ext.get(CurrencyToolName).dom;
    var currParts = ''; 
	
    if (!regCurrency) {
        regCurrency = currencyObj.options[0].value;
        //var nowCookies = new Date();
        //var  expiryCookies = new Date(nowCookies.getTime() + 365 * 24 * 60 * 60 * 1000);
        //Ext.util.Cookies.set( CurrencyToolName, regCurrency, expiryCookies);
        setCookie(CurrencyToolName, regCurrency, 30);
    }
    currParts = regCurrency.split("-");
    currencyObj.value = regCurrency;
    region = currParts[0];
    currency = currParts[1];
	
    Ext.get(CurrencyToolName).on('change', function (e) { 
        regCurrency = currencyObj.options[currencyObj.selectedIndex].value;
		//Ext.util.Cookies.set( CurrencyToolName, regCurrency );
        setCookie(CurrencyToolName, regCurrency, 30);
        currParts = regCurrency.split("-");
        region = currParts[0];
        currency = currParts[1];
    });
    //Ext.get("showsyberinfo").update('Show SYBR Information');
    Ext.get('checkboxshowsyberinfo').dom.checked = true;
    var SYBRObj = Ext.get("sybrinformation");
    //SYBRObj.addCls('hidden');
    //SYBRObj.removeCls('visible');
    Ext.get("showsyberinfo").on('click', function (e) {
        var syberbtnvalue = document.getElementById("showsyberinfo").innerHTML;
        if (syberbtnvalue == "Hide SYBR Information") {
            this.removeCls('selected');
            SYBRObj.addCls('hidden');
            SYBRObj.removeCls('visible');
            this.update('Show SYBR Information');
            Ext.get('checkboxshowsyberinfo').dom.checked = false;
			processOutputList(1);
        } else {
            this.addCls('selected');
            SYBRObj.removeCls('hidden');
            SYBRObj.addCls('visible');
            this.update('Hide SYBR Information');
            Ext.get('checkboxshowsyberinfo').dom.checked = true;
			processOutputList(1);
        }
    });
    Ext.get("checkboxshowsyberinfo").on('click', function (e) {
        var syberbtnvalue = document.getElementById("showsyberinfo").innerHTML;
        var textshowsyberinfo = Ext.get("showsyberinfo");
        if (syberbtnvalue == "Hide SYBR Information") {
            textshowsyberinfo.removeCls('selected');
            SYBRObj.addCls('hidden');
            SYBRObj.removeCls('visible');
            textshowsyberinfo.update('Show SYBR Information');
			Ext.get('checkboxshowsyberinfo').dom.checked = false;
			processOutputList(1);
        } else {
            textshowsyberinfo.addCls('selected');
            SYBRObj.removeCls('hidden');
            SYBRObj.addCls('visible');
            textshowsyberinfo.update('Hide SYBR Information');
			Ext.get('checkboxshowsyberinfo').dom.checked = true;
			processOutputList(1);
        }
		//displaySortedList();
    });
    var newsortbyObj = Ext.get("newsortby").dom;
    Ext.get("newsortby").on('change', function (e) {
        var selectObjValue = newsortbyObj.options[newsortbyObj.selectedIndex].value;
        if (selectObjValue == "Price") {
            outputList.sort('totalcost', 'ASC');
            //displaySortedList();
			displayByInstruemnt();
            sortedBy = 1;
            displayChart();
        } else {
            outputList.sort('noofhours', 'ASC');
            //displaySortedList();
			displayByInstruemnt();
            sortedBy = 0;
            displayChart();
        }
    });
//    Ext.get("NeedHelp").on('click', function (e) {
 //       return false;
//    });
    //alert(Ext.get("openarrayinstrumentselector").select('span').getAt(0).dom.getAttribute("data-expinfo"))
    var ins = 0;
    Ext.get("openarrayinstrumentselector").select('span').each(function (e) {
        if (ins == 0) updateExperimentInfo("openarrayinstrument", Ext.get(e).dom.getAttribute("data-expinfo"));
        ins++;
    });
    forceNumericPercentDecimalOnly('no_of_targets1');
    forceNumericPercentDecimalOnly('no_of_referance_targets1');
    forceNumericPercentDecimalOnly('no_of_samples1');
    forceNumericPercentDecimalOnly('no_of_replicates1');
    forceNumericPercentDecimalOnly('preampchk');
    forceNumericPercentDecimalOnly('assayperc');
    forceNumericPercentDecimalOnly('masterperc');
    forceNumericPercentDecimalOnly('plateperc');
    forceNumericPercentDecimalOnly('accessoriesperc');
    forceNumericPercentDecimalOnly('openarrayperc');
    forceNumericPercentDecimalOnly('preamprtperc');
    forceNumericPercentDecimalOnly('accessoriesperc');
    forceNumericPercentDecimalOnly('openarrayperc');
    forceNumericPercentDecimalOnly('preamprtperc');
    forceNumericPercentDecimalOnly('pair_of_primers');
    forceNumericPercentDecimalOnly('perc_primers_redesigned');
    forceNumericPercentDecimalOnly('hourly_labour');
    forceNumericPercentDecimalOnly('no_of_hours');
    showLoading(false);
	
	if(Development){
		
		var d = new Date();
		var d 	= new Date();
		var fd 	= d.getFullYear() + "_" + + (d.getMonth()+1) + "_" +  d.getDate() + "_" + d.getHours()+ "_" + d.getMinutes() + "_" + d.getSeconds();
		
		
		
		Ext.get('emails').dom.value = 'test@gmail.com';
		Ext.get('from').dom.value = 'test';
		Ext.get('msg').dom.value = 'test';
		Ext.get('subject').dom.value = 'Test mail ' + fd;
	}
	
	instruemntButtonFilter();
	//Added by softsmith -  to show the Assay type selection during a QS3D selection in Digital PCR
	Ext.get('QS3D').on('click', function (e) {
        Ext.get('digitalrefnameassay').removeCls('hidden');
		Ext.get('digitalreferenceassay').removeCls('hidden');
		Ext.get('digitalQS3DApplicable').removeCls('hidden');
    });
    
    Ext.get('ntcycler').on('click', function (e) {
        Ext.get('digitalrefnameassay').addCls('hidden');
		Ext.get('digitalreferenceassay').addCls('hidden');
		Ext.get('digitalQS3DApplicable').addCls('hidden');
    });
    
    Ext.get('quantstudio').on('click', function (e) {
        Ext.get('digitalrefnameassay').addCls('hidden');
		Ext.get('digitalreferenceassay').addCls('hidden');
		Ext.get('digitalQS3DApplicable').addCls('hidden');
    });
	
	 Ext.get('techboth').on('click', function (e) {
		updateExperimentInfo("technology", "Both");
		techBoth();
    });
	
	Ext.get('techrealtimepcr').on('click', function (e) {
		updateExperimentInfo("technology", "RealTimePCR");
		techRealTimePCR();
    });
	
	Ext.get('techdigitalpcr').on('click', function (e) {
		updateExperimentInfo("technology", "DigitalPCR");
		techDigitalPCR();
    });
	
	/*setInterval(function(){
		loadModels();
	},300);*/   
});

function changeDisc(id, operation) {
    var value = Ext.get(id).dom.value.replace('%', '');
    if (value > 50) {
        value = 50;
    }
    if (isNumber(value)) {
        if (operation == "-" && (parseFloat(value) - 2.5) >= 0) {
            Ext.get(id).dom.value = ((parseFloat(value) - 2.5) + "%");
        } else if (operation == "+" && (parseFloat(value) + 2.5) <= 50) {
            Ext.get(id).dom.value = ((parseFloat(value) + 2.5) + "%");
        }
    }
    processOutputList();
}

function showSecondStepCSPValidaton(){
	if(getExperimentInfo("noofinvptargets") == 0 ){
		Ext.MessageBox.confirm('Confirm', 'Are all assays non MGB Assays(royalty bearing assays)?',  function(btn) {
			if (btn === 'yes') {
				startCsPlatingStep();
			} else {
				//Ext.get('delayjsonloading').addCls('dispNone');
				//Ext.get('delayjsonloading').removeCls('dispBlck');
				return false;
			}
		});
	}else{
		startCsPlatingStep();
	}
}
function showSecondStepCsPlating(){
	//Ext.get('detailoverview').addCls('visible');
	//Ext.get('detailoverview').removeCls('hidden');
	 Ext.get('exptype').update(getExperimentInfo("csPlatingAssayVal"));
	 Ext.get('detailexptype').update(getExperimentInfo("type"));
	Ext.get('changesearch').on('click', function (e) {		
	  updateExperimentInfo("formatFilter", '');
	  if( getExperimentInfo("isCustomPlatingCalc") ){
			updateExperimentInfo("type", "Custom Plating");
	  }
	  showFirstStep();
	  if($("#cpsbtn").hasClass('tbuttonselected')){
		Ext.get("viewTab").addCls('hidden').removeCls('visible');
	  } else {
		Ext.get("viewTab").addCls('visible').removeCls('hidden');
	  }
	});
	managetab("steptwo", activetabid, 'tabbar');
	Ext.get('delayjsonloading').removeCls('dispNone');
	Ext.get('delayjsonloading').addCls('dispBlck');
	// Ext.get('no_of_CUSMOtargets1').dom.value = getExperimentInfo("noofcsptargets"); Madhu asked to remove this on 06-10-2015
	Ext.get('no_of_INVtargets1').dom.value =  getExperimentInfo("noofinvptargets");
	Ext.get('no_of_samples1').dom.value =  getExperimentInfo("noofsamples");
	Ext.get('no_of_replicates1').dom.value =  getExperimentInfo("noofreplicates");

	/*	
	if (!haveEverythingNeeded()){				
		showLoading(true);
		loadModels();
		delayjsonloading();				
	}*/
	if (haveEverythingNeeded()) {
        processCustomPlating();
    } else {
        isSecondStepInitiated = true;
        showLoading(true);
    }
	
}
function startCsPlatingStep(){
	// Loading Json files when calculate price button clicked
	//getExperimentInfo("type")
	if (!haveEverythingNeeded()){				
		showLoading(true);
		loadModels();
		//delayjsonloading();				
	}
	showSecondStepCsPlating();
}

function showSecondStep() {
	//$('#overlay').css('display','none');
	if( !getExperimentInfo("isCustomPlatingCalc") ){
		updateExperimentInfo("isOtherFormat", "NO");
		updateExperimentInfo("isOtherMMFormat", "NO");
		Ext.get('editinputs').addCls('hidden');
		Ext.get('editinputs').removeCls('visible');	
		Ext.get('detailoverview').addCls('visible');
		Ext.get('detailoverview').removeCls('hidden');							
		managetab("steptwo", activetabid, 'tabbar');
		Ext.get('delayjsonloading').removeCls('dispNone');
		Ext.get('delayjsonloading').addCls('dispBlck');
		/*if (validateFirstStep()) {
			var targets = Ext.get('no_of_targets').dom.value;
			var samples = Ext.get('no_of_samples').dom.value;
			var replicates = Ext.get('no_of_replicates').dom.value;
			var subarrays = replicates;
			updateExperimentInfo("nooftargets", targets);
			updateExperimentInfo("noofsamples", samples);
			updateExperimentInfo("noofreplicates", replicates);
			updateExperimentInfo("noofsubarrays", subarrays);
			if (!haveEverythingNeeded()){				
				showLoading(true);
				loadModels();
				delayjsonloading();				
			}
			//showSecondStep();
			//processOutputList(1);
		}*/
		
		Ext.get('details').removeCls('visible');
		Ext.get('details').addCls('hidden');
		if (haveEverythingNeeded()) {
			startSecondStep();
		} else {
			isSecondStepInitiated = true;
			showLoading(true);
		}
	} else {
		Ext.get('editinputsCPS').addCls('hidden');
		Ext.get('editinputsCPS').removeCls('visible');	
		Ext.get('detailoverview').addCls('visible');
		Ext.get('detailoverview').removeCls('hidden');
		
		showSecondStepCsPlating();
	}
}

function startSecondStep() {
	managetab("steptwo", "stepone", 'tabbar');
    Ext.get('changesearch').on('click', function (e) {
		updateExperimentInfo("formatFilter", '');
        showFirstStep();
    });
    Ext.get('currency').on('change', function (e) {
        var currencyObj = Ext.get('currency').dom;
        var regCurrency = currencyObj.options[currencyObj.selectedIndex].value;
        var currParts = regCurrency.split("-");
        region = currParts[0];
        currency = currParts[1];
        //commented on 14/05/2014
        //processOutputList();
        
    });
    updateSecondStepDetails();
	Ext.get('delayjsonloading').addCls('dispNone');
	Ext.get('delayjsonloading').removeCls('dispBlck');
}

function updateSecondStepDetails() {
    if (getExperimentInfo("type") == 'Copy Number') {
        Ext.get('exptype').update('Copy Number Variation');
        Ext.get('detailexptype').update('Copy Number Variation');
    } else {
        Ext.get('exptype').update(getExperimentInfo("type"));
        Ext.get('detailexptype').update(getExperimentInfo("type"));		
    }
    if (getExperimentInfo("nooftargets") == 0) {
        var nomtragets = 1;
    } else {
        var nomtragets = getExperimentInfo("nooftargets");
    }
    if (getExperimentInfo("noofreftargets") == 0) {
        var nomreftragets = 1;
    } else {
        var nomreftragets = getExperimentInfo("noofreftargets");
    }
    if (getExperimentInfo("noofsamples") == 0) {
        var nomsamples = 1;
    } else {
        var nomsamples = getExperimentInfo("noofsamples");
    }
    if (getExperimentInfo("noofreplicates") == 0) {
        var nomplicat = 1;
    } else {
        var nomplicat = getExperimentInfo("noofreplicates");
    }
	
	var openArrayInst = getExperimentInfo("openarrayinstrument");
	if(openArrayInst == "QuantStudio"){
		openArrayInst = "QuantStudio 12K Flex";
	} else if(openArrayInst == "7900HT"){
		openArrayInst = "7900 HT";
	} else if(openArrayInst == "7500Fast"){
		openArrayInst = "7500 Fast";
	} else if(openArrayInst == "StepOnePlus"){
		openArrayInst = "StepOne Plus";
	} else if(openArrayInst == "NTCycler"){
		openArrayInst = "NT Cycler";
	} else if(openArrayInst == "QS6"){
		openArrayInst = "QuantStudio 6";
	} else if(openArrayInst == "QS7"){
		openArrayInst = "QuantStudio 7";
	} else if(openArrayInst == "QS5"){
		openArrayInst = "QuantStudio 5";
	} else if(openArrayInst == "QS3"){
		openArrayInst = "QuantStudio 3";
	} else {
		openArrayInst = openArrayInst;
	}
	Ext.get('openarrayinstrumentdiv').update(openArrayInst);
    Ext.get('overview').update(nomtragets + " targets &nbsp; &nbsp;" + nomsamples + " samples &nbsp; &nbsp;" + nomplicat + " replicates &nbsp; &nbsp;");
    Ext.get('detailoverview').update(nomtragets + " targets " + nomsamples + " samples " + nomplicat + " replicates");
    selectTbutton('expmethodselector1', getExperimentInfo('method'));
    selectTbutton('welltubeselector1', getExperimentInfo('equipment'));
    Ext.get('no_of_replicates1').dom.value = nomplicat;
    Ext.get('no_of_samples1').dom.value = nomsamples;
    Ext.get('no_of_targets1').dom.value = nomtragets;
    Ext.get('no_of_referance_targets1').dom.value = nomreftragets;
	var formatFilter = getExperimentInfo("formatFilter");
	if(formatFilter != undefined && formatFilter != ''){
		listHtml = "";
		showEditButton();
		composeOutPutHtml(formatFilter, false)
	} else {
		processOutputList();
	}
    //Comment by SS 
    //displayChart();
}

function showFirstStep() {
    //Ext.get('steptwo').removeCls('visible');
    //Ext.get('steptwo').addCls('hidden');
    //Ext.get('stepone').addCls('visible');
	Ext.get('viewTab').addCls('visible');
	Ext.get('viewTab').removeCls('hidden');
    managetab("stepone", "steptwo", 'tabbar');
    updateStepOneDetails();
    return false;
}

function updateStepOneDetails() {
    selectTbutton('exptypeselector', getExperimentInfo('type'));
    selectTbutton('expmethodselector', getExperimentInfo('method'));
    selectTbutton('welltubeselector', getExperimentInfo('equipment'));
	selectTbutton('technologyselector', getExperimentInfo('technology'));
    Ext.get('no_of_replicates').dom.value = getExperimentInfo("noofreplicates");
    Ext.get('no_of_samples').dom.value = getExperimentInfo("noofsamples");
    Ext.get('no_of_targets').dom.value = getExperimentInfo("nooftargets");
}

function selectTbutton(buttonSetCont, info) {
    Ext.get(buttonSetCont).select('span').each(function (e) {
        if (Ext.get(e).dom.getAttribute("data-expinfo") == info) {
            Ext.get(buttonSetCont).select('span').each(function (e1) {
                Ext.get(e1).removeCls('tbuttonselected');
            });
            var selected = Ext.get(e);
            selected.addCls('tbuttonselected');
        }
    });
}

function createToggleButtonSet(buttonSetCont, selectHandler) {
    Ext.get(buttonSetCont).select('span').on('click', function (e) {
        Ext.get(buttonSetCont).select('span').each(function (e1) {
            Ext.get(e1).removeCls('tbuttonselected');
        });
        if (e.target.tagName == "DIV" || e.target.tagName == "div") {
            var selected = Ext.get(e.target).findParent("span.tbutton", 2, true);
            selected.addCls('tbuttonselected');
        } else if (e.target.tagName == "IMG" || e.target.tagName == "img") {
            var selected = Ext.get(e.target).findParent("span.tbutton", 3, true);
            selected.addCls('tbuttonselected');
        } else {
            var selected = Ext.get(e.target);
            selected.addCls('tbuttonselected');
        }
        selectHandler(selected);
    });
}

function resetTbutton(buttonSetCont, info) {
    Ext.get(buttonSetCont).select('span').each(function (e) {
        if (Ext.get(e).dom.getAttribute("data-expinfo") == info) {
            var selected = Ext.get(e);
            selected.addCls('tbuttonselected');
        } else {
            Ext.get(e).removeCls('tbuttonselected');
        }
    });
}

function getExperimentInfo(name) {
    return experimentInfo.getAt(0).get(name);
}

function updateExperimentInfo(name, value) {
    experimentInfo.getAt(0).set(name, value);
    // experimentInfo.sync();
}

function isNumber(inputStr) {
    if ((!inputStr && (parseInt(inputStr) != 0)) || (inputStr.length == 0)) return false;
    if ((parseInt(inputStr) == 0)) return true;
    return !isNaN(parseFloat(inputStr)) && isFinite(parseFloat(inputStr));
}

function validateFirstStep() {
    var status1 = true;
    var msg1 = "";
    if (getExperimentInfo("type") == "") {
        msg1 += "Experiment type ";
        status1 = false;
    }
    if (getExperimentInfo("method") == "") {
        msg1 += "Experiment method ";
        status1 = false;
    }
    if (getExperimentInfo("equipment") == "") {
        msg1 += "Experiment equipment";
        status1 = false;
    }
    if (!(status1)) {
        if (!status1) {
            msg1 = "Please select " + msg1 + "\n";
        }
        alert(msg1);
    }
    return status1;
}

function rotateSpinner(id, operation, updateObj) {
    var value = isNumber(Ext.get(id).dom.value) ? parseInt(Ext.get(id).dom.value) : 0;
    if (operation == 'down') {
        Ext.get(id).dom.value = value != 0 ? value - 1 : 0;
    } else {
        Ext.get(id).dom.value = value + 1;
    }
    if (Ext.get(id).dom.value == 0) {
        Ext.get(id).dom.value = 1;
    }
    if (updateObj != null) {
        updateExperimentInfo(updateObj, Ext.get(id).dom.value);
        if (updateObj == "noofreplicates") {
            updateExperimentInfo("noofsubarrays", Ext.get(id).dom.value);
        }
    }
	if( getExperimentInfo("isCustomPlatingCalc") ){
		toUpdateCSPRoSpinner();
	}else{
		processOutputList();
	}
}

function changeTab(tab) {
    Ext.get(tab).addCls('selected');
    Ext.get(tab + 'cont').addCls('visible');
    Ext.get(tab + 'cont').removeCls('hidden');
    if (tab == 'tab1') {
        Ext.get('tab2').removeCls('selected');
        Ext.get('tab2cont').removeCls('visible');
        Ext.get('tab2cont').addCls('hidden');
        displayChart();
        chartDisplayed = true;
    } else {
        Ext.get('tab1').removeCls('selected');
        Ext.get('tab1cont').removeCls('visible');
        Ext.get('tab1cont').addCls('hidden');
        chartDisplayed = false;
    }
}

function changeDetailsTab(tab) {
    Ext.get(tab).addCls('selected');
    Ext.get(tab + 'cont').addCls('visible');
    Ext.get(tab + 'cont').removeCls('hidden');
    if (tab == 'dtab1') {
        Ext.get('dtab2').removeCls('selected');
        Ext.get('dtab2cont').removeCls('visible');
        Ext.get('dtab2cont').addCls('hidden');
        displayChart();
    } else {
        Ext.get('dtab1').removeCls('selected');
        Ext.get('dtab1cont').removeCls('visible');
        Ext.get('dtab1cont').addCls('hidden');
    }
}

function setCursorPosition(obj, pos) {
    if (obj != null) {
        if (obj.createTextRange) {
            var range = obj.createTextRange();
            range.move('character', pos);
            range.select();
        } else {
            if (obj.selectionStart) {
                obj.focus();
                obj.setSelectionRange(pos, pos);
            } else obj.focus();
        }
    }
}

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 null;
    else return results[1];
}

function addZoneCurrencies(zone) {
	if( getExperimentInfo("isCustomPlatingCalc") ){
		if (zone == 'NA' || zone == 'na') {
			addCurrencyItem('NA-USD', 'NA-USD');
			//addCurrencyItem('NA-CAD', 'NA-CAD');
		} else if (zone == 'EMEA' || zone == 'emea') {  
			addCurrencyItem('EMEA-EUR', 'EMEA-EUR'); 
		} else {
			addCurrencyItem('NA-USD', 'NA-USD');
			addCurrencyItem('EMEA-EUR', 'EMEA-EUR');
			//addCurrencyItem('NA-CAD', 'NA-CAD');
		}
	} else {	
		if (zone == 'NA' || zone == 'na') {
			addCurrencyItem('NA-USD', 'NA-USD');
			addCurrencyItem('NA-CAD', 'NA-CAD');
			addCurrencyItem('NA-BRL', 'NA-BRL');
			addCurrencyItem('NA-DSTUSD', 'NA-DSTUSD');
		} else if (zone == 'EMEA' || zone == 'emea') {  
			addCurrencyItem('EMEA-EUR', 'EMEA-EUR');
			addCurrencyItem('EMEA-CHF', 'EMEA-CHF');
			addCurrencyItem('EMEA-CZK', 'EMEA-CZK');
			addCurrencyItem('EMEA-DKK', 'EMEA-DKK');
			addCurrencyItem('EMEA-GBP', 'EMEA-GBP');
			addCurrencyItem('EMEA-HUF', 'EMEA-HUF');
			addCurrencyItem('EMEA-PLN', 'EMEA-PLN');
			addCurrencyItem('EMEA-NOK', 'EMEA-NOK');
			addCurrencyItem('EMEA-SEK', 'EMEA-SEK');
			addCurrencyItem('EMEA-ZAR', 'EMEA-ZAR');
			addCurrencyItem('EMEA-DSTEUR', 'EMEA-DSTEUR');
			addCurrencyItem('EMEA-MEUSD', 'EMEA-MEUSD');
			addCurrencyItem('EMEA-AFRUSD', 'EMEA-AFRUSD');
		} else if (zone == 'APAC' || zone == 'apac') {
			addCurrencyItem('APAC-AUD', 'APAC-AUS');
        //addCurrencyItem('APAC-USD', 'APAC-USD'); Lini asked to remove this from list on 06-03-2015
			addCurrencyItem('APAC-KRW', 'APAC-KRW');
			addCurrencyItem('APAC-NZD', 'APAC-NZD');
			addCurrencyItem('APAC-SGD', 'APAC-SGD');
			addCurrencyItem('APAC-INR', 'APAC-INR');
			addCurrencyItem('APAC-CNY', 'APAC-CNY');
			addCurrencyItem('APAC-JPY', 'APAC-JPY');
			addCurrencyItem('APAC-HKPR_HKD', 'APAC-HKPR');
			addCurrencyItem('APAC-TWPR_TWD', 'APAC-TWPR');
			addCurrencyItem('APAC-CNDVE_USD', 'APAC-CNDVE');
			addCurrencyItem('APAC-AB_TWD', 'APAC-ABTWD');
			addCurrencyItem('APAC-AB_HKD', 'APAC-ABHKD');
			addCurrencyItem('APAC-C1_USD', 'APAC-ABC1USD');
		} else {		
			addCurrencyItem('NA-USD', 'NA-USD');
			addCurrencyItem('NA-CAD', 'NA-CAD');
			addCurrencyItem('NA-BRL', 'NA-BRL');
			addCurrencyItem('NA-DSTUSD', 'NA-DSTUSD');
			//addCurrencyItem('EMEA-USD', 'EMEA-USD');
			addCurrencyItem('EMEA-EUR', 'EMEA-EUR');
			addCurrencyItem('EMEA-CHF', 'EMEA-CHF');
			addCurrencyItem('EMEA-CZK', 'EMEA-CZK');
			addCurrencyItem('EMEA-DKK', 'EMEA-DKK');
			addCurrencyItem('EMEA-GBP', 'EMEA-GBP');
			addCurrencyItem('EMEA-HUF', 'EMEA-HUF');
			addCurrencyItem('EMEA-PLN', 'EMEA-PLN');
			addCurrencyItem('EMEA-NOK', 'EMEA-NOK');
			addCurrencyItem('EMEA-SEK', 'EMEA-SEK');
			addCurrencyItem('EMEA-ZAR', 'EMEA-ZAR');
			addCurrencyItem('EMEA-DSTEUR', 'EMEA-DSTEUR');
			addCurrencyItem('EMEA-MEUSD', 'EMEA-MEUSD');
			addCurrencyItem('EMEA-AFRUSD', 'EMEA-AFRUSD');
			addCurrencyItem('APAC-AUD', 'APAC-AUS');
			//addCurrencyItem('APAC-HKD', 'APAC-HKD');
        //addCurrencyItem('APAC-USD', 'APAC-USD');Lini asked to remove this from list on 06-03-2015
			addCurrencyItem('APAC-KRW', 'APAC-KRW');
			addCurrencyItem('APAC-NZD', 'APAC-NZD');
			addCurrencyItem('APAC-SGD', 'APAC-SGD');
			addCurrencyItem('APAC-INR', 'APAC-INR');
        //addCurrencyItem('APAC-THB', 'APAC-THB'); Lini asked to remove this from list on 06-03-2015
			addCurrencyItem('APAC-CNY', 'APAC-CNY');
			addCurrencyItem('APAC-JPY', 'APAC-JPY');
			addCurrencyItem('APAC-HKPR_HKD', 'APAC-HKPR');
			addCurrencyItem('APAC-TWPR_TWD', 'APAC-TWPR');
			addCurrencyItem('APAC-CNDVE_USD', 'APAC-CNDVE');
			addCurrencyItem('APAC-AB_TWD', 'APAC-ABTWD');
			addCurrencyItem('APAC-AB_HKD', 'APAC-ABHKD');
			addCurrencyItem('APAC-C1_USD', 'APAC-ABC1USD');
		}
	}
}

function addCurrencyItem(Text, Value) {
    var opt = document.createElement("option");
    var currencyObj = Ext.get('currency').dom;
    currencyObj.options.add(opt);
    opt.text = Text;
    opt.value = Value;
    
   /* var opt1 = document.createElement("option");
    var currencyObj1 = Ext.get('pgxcurrency').dom;
    currencyObj1.options.add(opt1);
    opt1.text = Text;
    opt1.value = Value;*/
}

function pgxsamplecomboxoption(comboID, appId, filtercond) {//pgxsamplecombobox
	 	removeReferanceItem(comboID);
	 	if( comboID == "pgxsamplecombobox" ){
		 	addReferanceItem('per day', 'days', comboID);
    	    addReferanceItem('per week', 'weeks', comboID);
        	addReferanceItem('per month', 'months', comboID);
			addReferanceItem('per year', 'years', comboID);
        }else if(comboID == "pgxsnpopenarrayformat" ){
        	addReferanceItem('QuantStudio 12K', 'QuantStudio 12K', comboID);
    	    addReferanceItem('QuantStudio 7', 'QuantStudio 7', comboID);
        	addReferanceItem('QuantStudio 6', 'QuantStudio 6', comboID);
        	//addReferanceItem('ViiA7', 'ViiA7', comboID);
        }else if(comboID == "pgxsnpformatneed" ){
			if(filtercond == 'ALL' || filtercond == 'QuantStudio 12K'){
				addReferanceItem('OpenArray-26 assays', 'OpenArray-26 assays', comboID);
				addReferanceItem('OpenArray-60 assays', 'OpenArray-60 assays', comboID);
				addReferanceItem('OpenArray-120 assays', 'OpenArray-120 assays', comboID);
				addReferanceItem('OpenArray-180 assays', 'OpenArray-180 assays', comboID);
				addReferanceItem('OpenArray-240 assays', 'OpenArray-240 assays', comboID);
				//addReferanceItem('Low Density Array', 'Low Density Array', comboID); Madhu asked to remove
				addReferanceItem('96-well Standard', '96-well Standard', comboID);
				addReferanceItem('96-well Fast', '96-well Fast', comboID);
				addReferanceItem('384-well', '384-well', comboID);
			}else if(filtercond == 'QuantStudio 7' || filtercond == 'ViiA7'){
				//addReferanceItem('Low Density Array', 'Low Density Array', comboID);  Madhu asked to remove
				addReferanceItem('96-well Standard', '96-well Standard', comboID);
				addReferanceItem('96-well Fast', '96-well Fast', comboID);
				addReferanceItem('384-well', '384-well', comboID);	
			}else if(filtercond == 'QuantStudio 6'){
				addReferanceItem('96-well Standard', '96-well Standard', comboID);
				addReferanceItem('96-well Fast', '96-well Fast', comboID);
				addReferanceItem('384-well', '384-well', comboID);
			}
        }else if( comboID == "pgxcnainstruments" ){
        	addReferanceItem('Same instrument as SNP analysis', 'Same instrument as SNP analysis', comboID);
			addReferanceItem('QuantStudio 12K', 'QuantStudio 12K', comboID);
			addReferanceItem('QuantStudio 7', 'QuantStudio 7', comboID);
			addReferanceItem('QuantStudio 6', 'QuantStudio 6', comboID);
			//addReferanceItem('ViiA7', 'ViiA7', comboID);
        }else if( comboID == "pgxcnainstrumentsneedtouse" ){
        	addReferanceItem('Same block as SNP analysis', 'Same block as SNP analysis', comboID);
			addReferanceItem('96-well Standard', '96-well Standard', comboID);
			addReferanceItem('96-well Fast', '96-well Fast', comboID);
			addReferanceItem('384-well', '384-well', comboID);
        }else if( comboID == "pgxintallation_installneed"){
	        //addReferanceItem('None', 'None', comboID);
        	addReferanceItem('IQ/OQ/IPV', 'IQ/OQ/IPV', comboID); 
    	    addReferanceItem('IQ/OQ', 'IQ/OQ', comboID);
    	    addReferanceItem('OQ/IPV', 'OQ/IPV', comboID);
			addReferanceItem('OQ/PQ', 'OQ/PQ', comboID);
        }else if( comboID == "pgxintallation_maintenance" ){
        	addReferanceItem('None', 'None', comboID);
        	addReferanceItem('AB Complete service', 'AB Complete service', comboID);
    	    addReferanceItem('Priority Response Time', 'Priority Response Time', comboID);
    	    addReferanceItem('AB Assurance service', 'AB Assurance service', comboID);
        }else if( comboID == "pgxintallation_addtraining" ){
        	//addReferanceItem('None', 'None', comboID);
        	/*addReferanceItem('Basic Training - half day - no starter kit', 'Basic Training', comboID);
    	    addReferanceItem('Advance Training - half day', 'Advance Training', comboID);
    	    addReferanceItem('Advanced OpenArray Training', 'Advanced OpenArray', comboID);*/			
			addReferanceItem('Novice Customer Training', 'Novice Customer Training', comboID)
			addReferanceItem('Regular customer training', 'Regular customer training', comboID);;
        }else if( comboID == "pgx_delivery_methodcombo" ){
        	addReferanceItem('EMail', 'EMail', comboID);
    	    addReferanceItem('Phone', 'Phone', comboID);
        }else if( comboID == "pgxsnpassaytype" ){
        	addReferanceItem('Pre-designed', 'Pre-designed', comboID);
    	    addReferanceItem('Custom', 'Custom', comboID); 
        }else if( comboID == "pgxcnvassaytype" ){
        	addReferanceItem('Pre-designed', 'Pre-designed', comboID);
    	    addReferanceItem('Custom Plus', 'Custom Plus', comboID);
			addReferanceItem('Custom', 'Custom', comboID);
        }
}
function addAssayForApplication(value, appId) {
	 if (value == 'Human' && appId == 'Digital PCR') {
	 	removeReferanceItem('digitalreferenceassay');
	 	
	 	addReferanceItem('TaqMan Gene Expression Assays', 'TaqMan Gene Expression Assays', 'digitalreferenceassay');
        addReferanceItem('TaqMan Copy Number Reference Assay RNAse P', 'TaqMan Copy Number Reference Assay RNAse P', 'digitalreferenceassay');
        addReferanceItem('TaqMan Copy Number Reference Assay TERT', 'TaqMan Copy Number Reference Assay TERT', 'digitalreferenceassay');
	 }
}

function addReferanceAssay(value) {
    if (value == 'Human') {
        removeReferanceItem('referenceassay');
        addReferanceItem('RNase P', 'TaqMan Copy Number Reference Assay RNAse P', 'referenceassay');
        addReferanceItem('TERT', 'TaqMan Copy Number Reference Assay TERT', 'referenceassay');
    } else if (value == 'Mouse') {
        removeReferanceItem('referenceassay');
        addReferanceItem('TFRC', 'TaqMan Copy Number Reference Assay,Mouse,TFRC', 'referenceassay');
        addReferanceItem('TERT', 'TaqMan Copy Number Reference Assay,Mouse,TERT', 'referenceassay');
    }
}

function addReferanceItem(Text, Value, addDOMId) {
    var opt = document.createElement("option");
    var assObj = Ext.get(addDOMId).dom;
    assObj.options.add(opt);
    opt.text = Text;
    opt.value = Value;
}

function removeReferanceItem(removeId) {
//alert(removeId);
    //var assObj = Ext.get('referenceassay').dom;
    document.getElementById(removeId).options.length = 0;
    //assObj.removeChild(assObj);
}

function trim(value) {
    return String(value).replace(/^(\s*\S.*\S)(\s*)$(?!\n)/m, "$1").replace(/^(\s*)(?=\S)/m, "");
}

function showAll() {
    Ext.get('openarrayinstrument').addCls('visible');
    Ext.get('openarrayinstrument').removeCls('hidden');
    Ext.get('openarrayinstrumentselector').addCls('visible');
    Ext.get('openarrayinstrumentselector').removeCls('hidden');
	updateExperimentInfo("tubeSel", "All");
    updateExperimentInfo("throughput", "All");
    //Ext.get('thruall').addCls('tbuttonselected');
    //Ext.get('thruhigh').removeCls('tbuttonselected');
   // Ext.get('thrulow').removeCls('tbuttonselected');
    currMode = "All";
    isFixed = null;
	//Commented on 14/05/2014
    processOutputList(1);
}

function managetab(currenttabid, lasttabid, tabbarid) { 

    activetabid = currenttabid;
    Ext.get(lasttabid).removeCls('visible');
    Ext.get(lasttabid).addCls('hidden');
    // Ext.get(lasttabid).dom.style.display = 'none'; //New Code Feb2013 By Developer2
    Ext.get(currenttabid).removeCls('hidden');
    Ext.get(currenttabid).addCls('visible');
    // Ext.get(currenttabid).dom.style.display = 'block'; //New Code Feb2013 By Developer2
    Ext.get(tabbarid).select('a').each(function (e) {
        Ext.get(e).removeCls('active'); //New Code Feb2013 By Developer2
        Ext.get(e).findParent('li', 2, true).removeCls('active'); //New Code Feb2013 By Developer2
        var tab = currenttabid;
        if (Ext.get(e).dom.getAttribute("rel") == tab) {
            Ext.get(e).addCls('active'); //New Code Feb2013 By Developer2
            Ext.get(e).findParent('li', 2, true).addCls('active'); //New Code Feb2013 By Developer2
        }
    });
    //alert(document.getElementById('tabbar').innerHTML);
	scrollWindow();
}

function setCookie(c_name, value, exdays) {
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + exdays);
    var c_value = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString());
    document.cookie = c_name + "=" + c_value;
}

function getCookie(c_name) {
    var i, x, y, ARRcookies = document.cookie.split(";");
    for (i = 0; i < ARRcookies.length; i++) {
        x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("="));
        y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
        x = x.replace(/^\s+|\s+$/g, "");
        if (x == c_name) {
            return unescape(y);
        }
    }
}

function getMaxValue(value) {
    var returnv = value;
    if (value > 50) {
        returnv = 50;
    }
    return returnv;
}

function forceNumericPercentDecimalOnly(elementID) {
    var input = document.getElementById(elementID);
    var inputString = input.value;
    input.onkeydown = function (event) {
		event = event || window.event;		 
		var key =  ('which' in event) ? event.which : event.keyCode;
		
        //document.getElementById('getkeykode').innerHTML = inputString;
        /* numeric inputs can come from the keypad or the numeric row at the top */
        if (key == 110 || key == 190 || key == 8 || key == 9 || key == 46 || (key >= 35 && key <= 40) || (key >= 48 && key <= 57) || (key >= 96 && key <= 105)) {
            return true;
        } else {
            event.preventDefault();
            return false;
        }
    }
}

function resetInstruemntButton(){
	
	Ext.get('anyinstrument').removeCls('tbuttonselected');
	Ext.get('quantstudio').removeCls('tbuttonselected');
	Ext.get('7900ht').removeCls('tbuttonselected');
	Ext.get('7500fast').removeCls('tbuttonselected');
	Ext.get('7500').removeCls('tbuttonselected');
	Ext.get('steponeplus').removeCls('tbuttonselected');
	Ext.get('viia7').removeCls('tbuttonselected');
	//Ext.get('ntcycler').removeCls('tbuttonselected');
	Ext.get('7300').removeCls('tbuttonselected');
	Ext.get('7000').removeCls('tbuttonselected');
	Ext.get('other').removeCls('tbuttonselected');
	
	
	Ext.get('anyinstrument').removeCls('visible');
	Ext.get('quantstudio').removeCls('visible');
	Ext.get('7900ht').removeCls('visible');
	Ext.get('7500fast').removeCls('visible');
	Ext.get('7500').removeCls('visible');
	Ext.get('steponeplus').removeCls('visible');
	Ext.get('viia7').removeCls('visible');
	//Ext.get('ntcycler').removeCls('visible');
	Ext.get('7300').removeCls('visible');
	Ext.get('7000').removeCls('visible');
	Ext.get('other').removeCls('visible');
	
	/*Ext.get('anyinstrument').addCls('hidden');
	Ext.get('quantstudio').addCls('hidden');
	Ext.get('7900ht').addCls('hidden');
	Ext.get('7500fast').addCls('hidden');
	Ext.get('7500').addCls('hidden');
	Ext.get('steponeplus').addCls('hidden');
	Ext.get('viia7').addCls('hidden');
	Ext.get('ntcycler').addCls('hidden');
	Ext.get('7300').addCls('hidden');
	Ext.get('7000').addCls('hidden');
	Ext.get('other').addCls('hidden');*/
}

function onMethodFast(){
	Ext.get('anyinstrument').addCls('visible');
	Ext.get('quantstudio').addCls('visible');
	Ext.get('7900ht').addCls('hidden');
	Ext.get('7500fast').addCls('hidden');
	Ext.get('steponeplus').addCls('hidden');
	Ext.get('viia7').addCls('hidden');
	Ext.get('other').addCls('visible');
	
	Ext.get('anyinstrument').removeCls('hidden');
	Ext.get('quantstudio').removeCls('hidden');
	Ext.get('7900ht').removeCls('hidden');
	Ext.get('7500fast').removeCls('hidden');
	Ext.get('steponeplus').removeCls('hidden');
	Ext.get('viia7').removeCls('hidden');
	Ext.get('other').removeCls('hidden');
}

function onMethodStandard(){
	Ext.get('anyinstrument').addCls('visible');
	Ext.get('quantstudio').addCls('visible');
	Ext.get('7900ht').addCls('visible');
	Ext.get('7500fast').addCls('visible');
	Ext.get('7500').addCls('visible');
	Ext.get('steponeplus').addCls('visible');
	Ext.get('viia7').addCls('visible');
	//Ext.get('ntcycler').addCls('visible');
	Ext.get('7300').addCls('visible');
	Ext.get('7000').addCls('visible');
	Ext.get('other').addCls('visible');
	
	Ext.get('anyinstrument').removeCls('hidden');
	Ext.get('quantstudio').removeCls('hidden');
	Ext.get('7900ht').removeCls('hidden');
	Ext.get('7500fast').removeCls('hidden');
	Ext.get('7500').removeCls('hidden');
	Ext.get('steponeplus').removeCls('hidden');
	Ext.get('viia7').removeCls('hidden');
	//Ext.get('ntcycler').removeCls('hidden');
	Ext.get('7300').removeCls('hidden');
	Ext.get('7000').removeCls('hidden');
	Ext.get('other').removeCls('hidden');
}

function well384(){	
	
	Ext.get('anyinstrument').addCls('visible');
	Ext.get('anyinstrument').removeCls('hidden');
	
	Ext.get('quantstudio').addCls('visible');
	Ext.get('quantstudio').removeCls('hidden');
	
	Ext.get('7900ht').removeCls('visible');
	Ext.get('7900ht').addCls('hidden');
	
	Ext.get('7500fast').removeCls('visible');
	Ext.get('7500fast').addCls('hidden');
	
	Ext.get('7500').removeCls('visible');
	Ext.get('7500').addCls('hidden');
	
	Ext.get('steponeplus').addCls('visible');
	Ext.get('steponeplus').removeCls('hidden');
	
	Ext.get('viia7').addCls('visible');
	Ext.get('viia7').removeCls('hidden');
	
	//Ext.get('ntcycler').removeCls('visible');
	//Ext.get('ntcycler').addCls('hidden');
	
	Ext.get('7300').removeCls('visible');
	Ext.get('7300').addCls('hidden');
	
	Ext.get('7000').removeCls('visible');
	Ext.get('7000').addCls('hidden');
	
	Ext.get('other').addCls('visible');
	Ext.get('other').removeCls('hidden');
	
}

function well96(){
	Ext.get('anyinstrument').addCls('visible');
	Ext.get('anyinstrument').removeCls('hidden');
	
	Ext.get('quantstudio').addCls('visible');
	Ext.get('quantstudio').removeCls('hidden');
	
	Ext.get('7900ht').addCls('visible');
	Ext.get('7900ht').removeCls('hidden');
	
	Ext.get('7500fast').addCls('visible');
	Ext.get('7500fast').removeCls('hidden');
	
	Ext.get('7500').addCls('visible');
	Ext.get('7500').removeCls('hidden');
	
	Ext.get('steponeplus').addCls('visible');
	Ext.get('steponeplus').removeCls('hidden');
	
	Ext.get('viia7').addCls('visible');
	Ext.get('viia7').removeCls('hidden');
	
	//Ext.get('ntcycler').addCls('visible');
	//Ext.get('ntcycler').removeCls('hidden');
	
	Ext.get('7300').addCls('visible');
	Ext.get('7300').removeCls('hidden');
	
	Ext.get('7000').addCls('visible');
	Ext.get('7000').removeCls('hidden');
	
	Ext.get('other').addCls('visible');
	Ext.get('other').removeCls('hidden');
}

/*var ins = [];
	
	ins = 
	[
		{
			'InstrumentID' : 'anyinstrument',
			'types' : [{'type':"Gene Expression"},{'type':"miRNA"}],
			'equipments':[{'equipment':"96-well"},{'equipment':"384-well"}],
			'methods':[{'method':"Fast"},{'method':"Standard"}]
		}
	]
	
insModel = buildModel('listOfInstruments', ins);*/
function tochangecurrencycombobox(type){ //pgxcurrency
	getCookie("currency")
	if(type == 'PGx'){
		if(document.getElementById("nonpgxcurrency") == null){
			document.getElementById("currency").setAttribute("id", "nonpgxcurrency");
			document.getElementById("pgxcurrency").setAttribute("id", "currency");
		}
	}else{
		if(document.getElementById("nonpgxcurrency") != null){
			document.getElementById("currency").setAttribute("id", "pgxcurrency");
			document.getElementById("nonpgxcurrency").setAttribute("id", "currency");
		}
	}
	 Ext.get("currency").on('change', function (e) {
		var currencyObj = Ext.get('currency').dom;
        var regCurrency = currencyObj.options[currencyObj.selectedIndex].value;
		console.log("change "+regCurrency);
        setCookie("currency", regCurrency, 30);
        var currParts = regCurrency.split("-");
		console.log("get cookie " + getCookie("currency"));		
        region = currParts[0];
        currency = currParts[1];
    });
}
function instruemntButtonFilter(){
	
	var type 		= getExperimentInfo("type");
	var equipment 	= getExperimentInfo("equipment");
	var method 		= getExperimentInfo("method");
	var technology	= getExperimentInfo("technology");
	var currentType = defaultInstruemntID;
	var dButtonID	= "anyinstrument";
	var consumableVal = getExperimentInfo("tubeSel");
	var consumTubeArray = [];
	
	if( consumableVal === "All" ){
		consumTubeArray = ['anyinstrument', 'quantstudio', '7900ht', '7500', '7500fast', 'steponeplus', 'viia7', '7300', '7000', 'QS6', 'QS7', 'QS3', 'QS5',  'QS3D', 'other'];
		Ext.get('techboth').addCls('tbuttonselected');
		Ext.get('techdigitalpcr').removeCls('tbuttonselected');
		Ext.get('techrealtimepcr').removeCls('tbuttonselected');
	}else if( consumableVal === "Tube" ){
		consumTubeArray = ['anyinstrument', 'quantstudio', '7900ht', '7500', '7500fast', 'steponeplus', 'viia7', '7300', '7000', 'QS6', 'QS7', 'QS3', 'QS5', 'other'];
		Ext.get('techboth').removeCls('tbuttonselected');
		Ext.get('techdigitalpcr').removeCls('tbuttonselected');
		Ext.get('techrealtimepcr').addCls('tbuttonselected');
	}else if( consumableVal === "TAPFast" ){
		consumTubeArray = ['anyinstrument', 'quantstudio', '7900ht', '7500fast', 'steponeplus', 'viia7', 'QS6', 'QS7', 'QS3', 'QS5', 'other'];
		Ext.get('techboth').removeCls('tbuttonselected');
		Ext.get('techdigitalpcr').removeCls('tbuttonselected');
		Ext.get('techrealtimepcr').addCls('tbuttonselected');
	}else if( consumableVal === "TAPStandard" ){
		consumTubeArray = ['anyinstrument', 'quantstudio', '7900ht', '7500', 'steponeplus', 'viia7', '7300', '7000', 'QS6', 'QS7', 'QS3', 'QS5', 'other'];
		Ext.get('techboth').removeCls('tbuttonselected');
		Ext.get('techdigitalpcr').removeCls('tbuttonselected');
		Ext.get('techrealtimepcr').addCls('tbuttonselected');
	}else if( consumableVal === "TAC" ){
		consumTubeArray = ['anyinstrument', 'quantstudio', '7900ht', 'viia7', 'QS7', 'other'];
		Ext.get('techboth').removeCls('tbuttonselected');
		Ext.get('techdigitalpcr').removeCls('tbuttonselected');
		Ext.get('techrealtimepcr').addCls('tbuttonselected');
	}else if( consumableVal === "OpenArray" ){
		consumTubeArray = ['anyinstrument', 'quantstudio', 'other' ];
		Ext.get('techboth').removeCls('tbuttonselected');
		Ext.get('techdigitalpcr').removeCls('tbuttonselected');
		Ext.get('techrealtimepcr').addCls('tbuttonselected');
	}else if( consumableVal === "Chips" ){
		consumTubeArray = ['QS3D'];
		Ext.get('techboth').removeCls('tbuttonselected');
		Ext.get('techdigitalpcr').addCls('tbuttonselected');
		Ext.get('techrealtimepcr').removeCls('tbuttonselected');
	}
	
	
	Ext.get('openarrayinstrument').update('Instrument');
	
	if(type == "Gene Expression"){
		Ext.get('Tube').addCls('visible');		
		Ext.get('Chips').addCls('visible');
		Ext.get('OpenArray').addCls('visible');
		Ext.get('TAC').addCls('visible');
		//Ext.get('All').addCls('hidden');
		Ext.get('TAPFast').addCls('visible');
		Ext.get('TAPStandard').addCls('visible');
		Ext.get('TAC').addCls('hidden');			
		
		Ext.get('Tube').removeCls('hidden');
		Ext.get('Chips').removeCls('hidden');
		Ext.get('OpenArray').removeCls('hidden');
		Ext.get('TAC').removeCls('hidden');
		//Ext.get('All').removeCls('visible');
		Ext.get('TAPFast').removeCls('hidden');
		Ext.get('TAPStandard').removeCls('hidden');
		
		if(equipment == "96-well" && method == "Fast"){ 
			var techdigitalpcr = $( "#techdigitalpcr" ).hasClass( "tbuttonselected" ); 			
			if(techdigitalpcr){ 
				currentType = "QS3D";
				dButtonID	= "QS3D";
				//Ext.get('QS3D').addCls('visible');
				Ext.get('anyinstrument').addCls('hidden');
				Ext.get('quantstudio').addCls('hidden');
				Ext.get('7900ht').addCls('hidden');
				Ext.get('7500fast').addCls('hidden');
				Ext.get('7500').addCls('hidden');
				Ext.get('steponeplus').addCls('hidden');
				Ext.get('viia7').addCls('hidden');
				//Ext.get('ntcycler').addCls('hidden');
				Ext.get('7300').addCls('hidden');
				Ext.get('7000').addCls('hidden');
				Ext.get('other').addCls('hidden');				
				Ext.get('QS6').addCls('hidden');
				Ext.get('QS7').addCls('hidden');
				Ext.get('QS3').addCls('hidden');
				Ext.get('QS5').addCls('hidden');
				
				Ext.get('anyinstrument').removeCls('visible');
				Ext.get('quantstudio').removeCls('visible');
				Ext.get('7900ht').removeCls('visible');
				Ext.get('7500fast').removeCls('visible');
				Ext.get('7500').removeCls('visible');
				Ext.get('steponeplus').removeCls('visible');
				Ext.get('viia7').removeCls('visible');
				//Ext.get('ntcycler').removeCls('visible');
				Ext.get('7300').removeCls('visible');
				Ext.get('7000').removeCls('visible');
				Ext.get('other').removeCls('visible');		
				Ext.get('QS6').removeCls('visible');
				Ext.get('QS7').removeCls('visible');
				Ext.get('QS3').removeCls('visible');
				Ext.get('QS5').removeCls('visible');

			} else {
				if($.inArray( 'anyinstrument',consumTubeArray ) != -1 ){
					Ext.get('anyinstrument').addCls('visible');
					Ext.get('anyinstrument').removeCls('hidden');
				} else {
					Ext.get('anyinstrument').addCls('hidden');
					Ext.get('anyinstrument').removeCls('visible');
				}
				
				if($.inArray( 'quantstudio',consumTubeArray ) != -1 ){
					Ext.get('quantstudio').addCls('visible');					
					Ext.get('quantstudio').removeCls('hidden');
				} else {
					Ext.get('quantstudio').addCls('hidden');
					Ext.get('quantstudio').removeCls('visible');
				}
					
				if($.inArray( '7900ht',consumTubeArray ) != -1 ){
					Ext.get('7900ht').addCls('visible');
					Ext.get('7900ht').removeCls('hidden');
				} else {
					Ext.get('7900ht').addCls('hidden');
					Ext.get('7900ht').removeCls('visible');
				}
					
				if($.inArray( '7500fast',consumTubeArray ) != -1 )	{
					Ext.get('7500fast').addCls('visible');
					Ext.get('7500fast').removeCls('hidden');
				} else {
					Ext.get('7500fast').addCls('hidden');
					Ext.get('7500fast').removeCls('visible');
				}
					
				if($.inArray( 'steponeplus',consumTubeArray ) != -1 )	{
					Ext.get('steponeplus').addCls('visible');
					Ext.get('steponeplus').removeCls('hidden');
				} else {
					Ext.get('steponeplus').addCls('hidden');
					Ext.get('steponeplus').removeCls('visible');
				}
					
				if($.inArray( 'viia7',consumTubeArray ) != -1 )	{	
					Ext.get('viia7').addCls('visible');
					Ext.get('viia7').removeCls('hidden');
				} else {
					Ext.get('viia7').addCls('hidden');
					Ext.get('viia7').removeCls('visible');
				}
					 
				if($.inArray( 'other',consumTubeArray ) != -1 )	{		
					Ext.get('other').addCls('visible');
					Ext.get('other').removeCls('hidden');
				} else {
					Ext.get('other').addCls('hidden');
					Ext.get('other').removeCls('visible');
				}
					
				if($.inArray( 'QS6',consumTubeArray ) != -1 )	{					
					Ext.get('QS6').addCls('visible');
					Ext.get('QS6').removeCls('hidden');
				} else {
					Ext.get('QS6').addCls('hidden');
					Ext.get('QS6').removeCls('visible');
				}
					
				if($.inArray( 'QS7',consumTubeArray ) != -1 )	{
					Ext.get('QS7').addCls('visible');
					Ext.get('QS7').removeCls('hidden');
				} else {
					Ext.get('QS7').addCls('hidden');
					Ext.get('QS7').removeCls('visible');
				}
				
				if($.inArray( 'QS3',consumTubeArray ) != -1 )	{
					Ext.get('QS3').addCls('visible');
					Ext.get('QS3').removeCls('hidden');
				} else {
					Ext.get('QS3').addCls('hidden');
					Ext.get('QS3').removeCls('visible');
				}
				
				if($.inArray( 'QS5',consumTubeArray ) != -1 )	{
					Ext.get('QS5').addCls('visible');
					Ext.get('QS5').removeCls('hidden');
				} else {
					Ext.get('QS5').addCls('hidden');
					Ext.get('QS5').removeCls('visible');
				}
				
				if($.inArray( 'QS3D',consumTubeArray ) != -1 )	{
					Ext.get('QS3D').addCls('visible');
					Ext.get('QS3D').removeCls('hidden');
				} else {
					Ext.get('QS3D').addCls('hidden');
					Ext.get('QS3D').removeCls('visible');
				}
				
				
				Ext.get('7500').removeCls('visible');
				//Ext.get('ntcycler').removeCls('visible');
				Ext.get('7300').removeCls('visible');
				Ext.get('7000').removeCls('visible');
			}
		}
		if(equipment == "384-well" && method == "Fast"){
			var techdigitalpcr = $( "#techdigitalpcr" ).hasClass( "tbuttonselected" ); 
			if(techdigitalpcr){
				currentType = "QS3D";
				dButtonID	= "QS3D";
				//Ext.get('QS3D').addCls('visible');
				Ext.get('anyinstrument').addCls('hidden');
				Ext.get('quantstudio').addCls('hidden');
				Ext.get('7900ht').addCls('hidden');
				Ext.get('7500fast').addCls('hidden');
				Ext.get('7500').addCls('hidden');
				Ext.get('steponeplus').addCls('hidden');
				Ext.get('viia7').addCls('hidden');
				//Ext.get('ntcycler').addCls('hidden');
				Ext.get('7300').addCls('hidden');
				Ext.get('7000').addCls('hidden');
				Ext.get('other').addCls('hidden');				
				Ext.get('QS6').addCls('hidden');
				Ext.get('QS7').addCls('hidden');				
				Ext.get('QS5').addCls('hidden');				
				Ext.get('QS3').addCls('hidden');				
				
				Ext.get('anyinstrument').removeCls('visible');
				Ext.get('quantstudio').removeCls('visible');
				Ext.get('7900ht').removeCls('visible');
				Ext.get('7500fast').removeCls('visible');
				Ext.get('7500').removeCls('visible');
				Ext.get('steponeplus').removeCls('visible');
				Ext.get('viia7').removeCls('visible');
				//Ext.get('ntcycler').removeCls('visible');
				Ext.get('7300').removeCls('visible');
				Ext.get('7000').removeCls('visible');
				Ext.get('other').removeCls('visible');		
				Ext.get('QS6').removeCls('visible');
				Ext.get('QS7').removeCls('visible');
				Ext.get('QS3').removeCls('visible');
				Ext.get('QS5').removeCls('visible');

			} else {
				if($.inArray( 'anyinstrument',consumTubeArray ) != -1 )	{
					Ext.get('anyinstrument').addCls('visible');
					Ext.get('anyinstrument').removeCls('hidden');
				} else {
					Ext.get('anyinstrument').addCls('hidden');
					Ext.get('anyinstrument').removeCls('visible');
				}
					
				if($.inArray( 'quantstudio',consumTubeArray ) != -1 )	{	
					Ext.get('quantstudio').addCls('visible');
					Ext.get('quantstudio').removeCls('hidden');
				} else {
					Ext.get('quantstudio').addCls('hidden');
					Ext.get('quantstudio').removeCls('visible');
				}
				
				if($.inArray( '7900ht',consumTubeArray ) != -1 ){	
					Ext.get('7900ht').addCls('visible');
					Ext.get('7900ht').removeCls('hidden');
				} else {
					Ext.get('7900ht').addCls('hidden');
					Ext.get('7900ht').removeCls('visible');
				}
					
				if($.inArray( 'viia7',consumTubeArray ) != -1 ){
					Ext.get('viia7').addCls('visible');
					Ext.get('viia7').removeCls('hidden');
				} else {
					Ext.get('viia7').addCls('hidden');
					Ext.get('viia7').removeCls('visible');
				}
					
				if($.inArray('other',consumTubeArray ) != -1 ){
					Ext.get('other').addCls('visible');
					Ext.get('other').removeCls('hidden');
				} else {
					Ext.get('other').addCls('hidden');
					Ext.get('other').removeCls('visible');
				}
				
				if($.inArray('QS6',consumTubeArray ) != -1 ){
					Ext.get('QS6').addCls('visible');
					Ext.get('QS6').removeCls('hidden');
				} else {
					Ext.get('QS6').addCls('hidden');
					Ext.get('QS6').removeCls('visible');
				}
					
				if($.inArray('QS7',consumTubeArray ) != -1 ){
					Ext.get('QS7').addCls('visible');
					Ext.get('QS7').removeCls('hidden');
				} else {
					Ext.get('QS7').addCls('hidden');
					Ext.get('QS7').removeCls('visible');
				}
				
				if($.inArray('QS3',consumTubeArray ) != -1 ){
					Ext.get('QS3').addCls('visible');
					Ext.get('QS3').removeCls('hidden');
				} else {
					Ext.get('QS3').addCls('hidden');
					Ext.get('QS3').removeCls('visible');
				}
				
				if($.inArray('QS5',consumTubeArray ) != -1 ){
					Ext.get('QS5').addCls('visible');
					Ext.get('QS5').removeCls('hidden');
				} else {
					Ext.get('QS5').addCls('hidden');
					Ext.get('QS5').removeCls('visible');
				}
					
				Ext.get('7500fast').removeCls('visible');
				Ext.get('7500').removeCls('visible');
				Ext.get('steponeplus').removeCls('visible');
				//Ext.get('ntcycler').removeCls('visible');
				Ext.get('7300').removeCls('visible');
				Ext.get('7000').removeCls('visible');
			}
			//Ext.get('QS3D').removeCls('visible');
		}
		
		if(equipment == "96-well" && method == "Standard"){
			var techdigitalpcr = $( "#techdigitalpcr" ).hasClass( "tbuttonselected" ); 
			if(techdigitalpcr){
				currentType = "QS3D";
				dButtonID	= "QS3D";
				//Ext.get('QS3D').addCls('visible');
				
				Ext.get('anyinstrument').addCls('hidden');
				Ext.get('quantstudio').addCls('hidden');
				Ext.get('7900ht').addCls('hidden');
				Ext.get('7500fast').addCls('hidden');
				Ext.get('7500').addCls('hidden');
				Ext.get('steponeplus').addCls('hidden');
				Ext.get('viia7').addCls('hidden');
				//Ext.get('ntcycler').addCls('hidden');
				Ext.get('7300').addCls('hidden');
				Ext.get('7000').addCls('hidden');
				Ext.get('other').addCls('hidden');				
				Ext.get('QS6').addCls('hidden');
				Ext.get('QS7').addCls('hidden');
				Ext.get('QS3').addCls('hidden');
				Ext.get('QS5').addCls('hidden');
				
				Ext.get('anyinstrument').removeCls('visible');
				Ext.get('quantstudio').removeCls('visible');
				Ext.get('7900ht').removeCls('visible');
				Ext.get('7500fast').removeCls('visible');
				Ext.get('7500').removeCls('visible');
				Ext.get('steponeplus').removeCls('visible');
				Ext.get('viia7').removeCls('visible');
				//Ext.get('ntcycler').removeCls('visible');
				Ext.get('7300').removeCls('visible');
				Ext.get('7000').removeCls('visible');
				Ext.get('other').removeCls('visible');				
				Ext.get('QS6').removeCls('visible');
				Ext.get('QS7').removeCls('visible');
				Ext.get('QS3').removeCls('visible');
				Ext.get('QS5').removeCls('visible');
			} else {					
				if($.inArray('anyinstrument',consumTubeArray ) != -1 ){
					Ext.get('anyinstrument').addCls('visible');
					Ext.get('anyinstrument').removeCls('hidden');
				} else {
					Ext.get('anyinstrument').addCls('hidden');
					Ext.get('anyinstrument').removeCls('visible');
				}
				
				if($.inArray('quantstudio',consumTubeArray ) != -1 ){
					Ext.get('quantstudio').addCls('visible');
					Ext.get('quantstudio').removeCls('hidden');
				} else {
					Ext.get('quantstudio').addCls('hidden');
					Ext.get('quantstudio').removeCls('visible');
				}
					
				if($.inArray('7900ht',consumTubeArray ) != -1 ){
					Ext.get('7900ht').addCls('visible');
					Ext.get('7900ht').removeCls('hidden');
				} else {
					Ext.get('7900ht').addCls('hidden');
					Ext.get('7900ht').removeCls('visible');
				}
					
				if($.inArray('7500',consumTubeArray ) != -1 ){
					Ext.get('7500').addCls('visible');
					Ext.get('7500').removeCls('hidden');
				} else {
					Ext.get('7500').addCls('hidden');
					Ext.get('7500').removeCls('visible');
				}
					
				if($.inArray('steponeplus',consumTubeArray ) != -1 ){
					Ext.get('steponeplus').addCls('visible');
					Ext.get('steponeplus').removeCls('hidden');
				} else {
					Ext.get('steponeplus').addCls('hidden');
					Ext.get('steponeplus').removeCls('visible');
				}
					
				if($.inArray('viia7',consumTubeArray ) != -1 ){
					Ext.get('viia7').addCls('visible');
					Ext.get('viia7').removeCls('hidden');
				} else {
					Ext.get('viia7').addCls('hidden');
					Ext.get('viia7').removeCls('visible');
				}
					
				/*if($.inArray('ntcycler',consumTubeArray ) != -1 ){
					Ext.get('ntcycler').addCls('visible');
					Ext.get('ntcycler').removeCls('hidden');
				} else {
					Ext.get('ntcycler').addCls('hidden');
					Ext.get('ntcycler').removeCls('visible');
				}*/
					
				if($.inArray('7300',consumTubeArray ) != -1 ){
					Ext.get('7300').addCls('visible');
					Ext.get('7300').removeCls('hidden');
				} else {
					Ext.get('7300').addCls('hidden');
					Ext.get('7300').removeCls('visible');
				}
					
				if($.inArray('7000',consumTubeArray ) != -1 ){
					Ext.get('7000').addCls('visible');
					Ext.get('7000').removeCls('hidden');
				} else {
					Ext.get('7000').addCls('hidden');
					Ext.get('7000').removeCls('visible');
				}
					
				if($.inArray('other',consumTubeArray ) != -1 ){
					Ext.get('other').addCls('visible');
					Ext.get('other').removeCls('hidden');
				} else {
					Ext.get('other').addCls('hidden');
					Ext.get('other').removeCls('visible');
				}
				
				if($.inArray('QS6',consumTubeArray ) != -1 ){
					Ext.get('QS6').addCls('visible');
					Ext.get('QS6').removeCls('hidden');
				} else {
					Ext.get('QS6').addCls('hidden');
					Ext.get('QS6').removeCls('visible');
				}
				
				if($.inArray('QS7',consumTubeArray ) != -1 ){
					Ext.get('QS7').addCls('visible');
					Ext.get('QS7').removeCls('hidden');
				} else {
					Ext.get('QS7').addCls('hidden');
					Ext.get('QS7').removeCls('visible');
				}
				
				if($.inArray('QS5',consumTubeArray ) != -1 ){
					Ext.get('QS5').addCls('visible');
					Ext.get('QS5').removeCls('hidden');
				} else {
					Ext.get('QS5').addCls('hidden');
					Ext.get('QS5').removeCls('visible');
				}
				
				if($.inArray('QS3',consumTubeArray ) != -1 ){
					Ext.get('QS3').addCls('visible');
					Ext.get('QS3').removeCls('hidden');
				} else {
					Ext.get('QS3').addCls('hidden');
					Ext.get('QS3').removeCls('visible');
				}
				
				if($.inArray('7500fast',consumTubeArray ) != -1 ){
					Ext.get('7500fast').addCls('visible');
					Ext.get('7500fast').removeCls('hidden');
				} else {
					Ext.get('7500fast').addCls('hidden');
					Ext.get('7500fast').removeCls('visible');
				}
				
				if($.inArray('QS3D',consumTubeArray ) != -1 ){
					Ext.get('QS3D').addCls('visible');
					Ext.get('QS3D').removeCls('hidden');
				} else {
					Ext.get('QS3D').addCls('hidden');
					Ext.get('QS3D').removeCls('visible');
				}
			}
			//Ext.get('QS3D').removeCls('visible');
			/*if(technology == "RealTimePCR"){
				Ext.get('QS3D').addCls('hidden');
				Ext.get('QS3D').removeCls('visible');
			}*/
		}
		
		if(equipment == "384-well" && method == "Standard"){
			var techdigitalpcr = $( "#techdigitalpcr" ).hasClass( "tbuttonselected" ); 
			if(techdigitalpcr){
				currentType = "QS3D";
				dButtonID	= "QS3D";
				//Ext.get('QS3D').addCls('visible');
				Ext.get('anyinstrument').addCls('hidden');
				Ext.get('quantstudio').addCls('hidden');
				Ext.get('7900ht').addCls('hidden');
				Ext.get('7500fast').addCls('hidden');
				Ext.get('7500').addCls('hidden');
				Ext.get('steponeplus').addCls('hidden');
				Ext.get('viia7').addCls('hidden');
				//Ext.get('ntcycler').addCls('hidden');
				Ext.get('7300').addCls('hidden');
				Ext.get('7000').addCls('hidden');
				Ext.get('other').addCls('hidden');				
				Ext.get('QS6').addCls('hidden');
				Ext.get('QS7').addCls('hidden');	
				Ext.get('QS3').addCls('hidden');	
				Ext.get('QS5').addCls('hidden');	
				
				Ext.get('anyinstrument').removeCls('visible');
				Ext.get('quantstudio').removeCls('visible');
				Ext.get('7900ht').removeCls('visible');
				Ext.get('7500fast').removeCls('visible');
				Ext.get('7500').removeCls('visible');
				Ext.get('steponeplus').removeCls('visible');
				Ext.get('viia7').removeCls('visible');
				//Ext.get('ntcycler').removeCls('visible');
				Ext.get('7300').removeCls('visible');
				Ext.get('7000').removeCls('visible');
				Ext.get('other').removeCls('visible');			
				Ext.get('QS6').removeCls('visible');
				Ext.get('QS7').removeCls('visible');
				Ext.get('QS3').removeCls('visible');
				Ext.get('QS5').removeCls('visible');
			} else {
				if($.inArray('anyinstrument',consumTubeArray ) != -1 ){
					Ext.get('anyinstrument').addCls('visible');
					Ext.get('anyinstrument').removeCls('hidden');
				} else {
					Ext.get('anyinstrument').addCls('hidden');
					Ext.get('anyinstrument').removeCls('visible');
				}
					
				if($.inArray('quantstudio',consumTubeArray ) != -1 ){
					Ext.get('quantstudio').addCls('visible');
					Ext.get('quantstudio').removeCls('hidden');
				} else {
					Ext.get('quantstudio').addCls('hidden');
					Ext.get('quantstudio').removeCls('visible');
				}
					
				if($.inArray('7900ht',consumTubeArray ) != -1 ){
					Ext.get('7900ht').addCls('visible');
					Ext.get('7900ht').removeCls('hidden');
				} else {
					Ext.get('7900ht').addCls('hidden');
					Ext.get('7900ht').removeCls('visible');
				}
					
				if($.inArray('viia7',consumTubeArray ) != -1 ){
					Ext.get('viia7').addCls('visible');
					Ext.get('viia7').removeCls('hidden');
				} else {
					Ext.get('viia7').addCls('hidden');
					Ext.get('viia7').removeCls('visible');
				}
					
				/*if($.inArray('ntcycler',consumTubeArray ) != -1 ){
					Ext.get('ntcycler').addCls('visible');
					Ext.get('ntcycler').removeCls('hidden');
				} else {
					Ext.get('ntcycler').addCls('hidden');
					Ext.get('ntcycler').removeCls('visible');
				}*/
					
				if($.inArray('other',consumTubeArray ) != -1 ){
					Ext.get('other').addCls('visible');
					Ext.get('other').removeCls('hidden');
				} else {
					Ext.get('other').addCls('hidden');
					Ext.get('other').removeCls('visible');
				}
					
				if($.inArray('QS6',consumTubeArray ) != -1 ){
					Ext.get('QS6').addCls('visible');
					Ext.get('QS6').removeCls('hidden');
				} else {
					Ext.get('QS6').addCls('hidden');
					Ext.get('QS6').removeCls('visible');
				}
					
				if($.inArray('QS7',consumTubeArray ) != -1 ){
					Ext.get('QS7').addCls('visible');
					Ext.get('QS7').removeCls('hidden');
				} else {
					Ext.get('QS7').addCls('hidden');
					Ext.get('QS7').removeCls('visible');
				}
				
				if($.inArray('QS3',consumTubeArray ) != -1 ){
					Ext.get('QS3').addCls('visible');
					Ext.get('QS3').removeCls('hidden');
				} else {
					Ext.get('QS3').addCls('hidden');
					Ext.get('QS3').removeCls('visible');
				}
				
				if($.inArray('QS5',consumTubeArray ) != -1 ){
					Ext.get('QS5').addCls('visible');
					Ext.get('QS5').removeCls('hidden');
				} else {
					Ext.get('QS5').addCls('hidden');
					Ext.get('QS5').removeCls('visible');
				}
				
				if($.inArray( 'QS3D',consumTubeArray ) != -1 )	{
					Ext.get('QS3D').addCls('visible');
					Ext.get('QS3D').removeCls('hidden');
				} else {
					Ext.get('QS3D').addCls('hidden');
					Ext.get('QS3D').removeCls('visible');
				}
				
				Ext.get('7500fast').removeCls('visible');
				Ext.get('7500').removeCls('visible');
				Ext.get('steponeplus').removeCls('visible');	
				Ext.get('7300').removeCls('visible');
				Ext.get('7000').removeCls('visible');				
			}
		}
	}
	
	if(type == "miRNA" || type == "Genotyping"){
		if(type == "miRNA"){
			Ext.get('Tube').addCls('visible');		
			Ext.get('Chips').addCls('visible');
			Ext.get('OpenArray').addCls('visible');
			Ext.get('TAC').addCls('visible');
			//Ext.get('All').addCls('hidden');
			Ext.get('TAPFast').addCls('hidden');
			Ext.get('TAPStandard').addCls('hidden');
			Ext.get('TAC').addCls('hidden');			
			
			Ext.get('Tube').removeCls('hidden');
			Ext.get('Chips').removeCls('hidden');
			Ext.get('OpenArray').removeCls('hidden');
			Ext.get('TAC').removeCls('hidden');
			//Ext.get('All').removeCls('visible');
			Ext.get('TAPFast').removeCls('visible');
			Ext.get('TAPStandard').removeCls('visible');			
		}
		if(type == "Genotyping"){
			Ext.get('Tube').addCls('visible');		
			Ext.get('Chips').addCls('visible');
			Ext.get('OpenArray').addCls('visible');
			Ext.get('TAC').addCls('hidden');
			//Ext.get('All').addCls('hidden');
			Ext.get('TAPFast').addCls('hidden');
			Ext.get('TAPStandard').addCls('hidden');
			Ext.get('TAC').addCls('hidden');			
			
			Ext.get('Tube').removeCls('hidden');
			Ext.get('Chips').removeCls('hidden');
			Ext.get('OpenArray').removeCls('hidden');
			Ext.get('TAC').removeCls('visible');
			//Ext.get('All').removeCls('visible');
			Ext.get('TAPFast').removeCls('visible');
			Ext.get('TAPStandard').removeCls('visible');			
		}
		var techdigitalpcr = $( "#techdigitalpcr" ).hasClass( "tbuttonselected" );	
				
		if(equipment == "96-well"){ 
			if(techdigitalpcr){ 
				currentType = "QS3D";
				dButtonID	= "QS3D";
				//Ext.get('QS3D').addCls('visible');
				Ext.get('anyinstrument').addCls('hidden');
				Ext.get('quantstudio').addCls('hidden');
				Ext.get('7900ht').addCls('hidden');
				Ext.get('7500fast').addCls('hidden');
				Ext.get('7500').addCls('hidden');
				Ext.get('steponeplus').addCls('hidden');
				Ext.get('viia7').addCls('hidden');
				//Ext.get('ntcycler').addCls('hidden');
				Ext.get('7300').addCls('hidden');
				Ext.get('7000').addCls('hidden');
				Ext.get('other').addCls('hidden');				
				Ext.get('QS6').addCls('hidden');
				Ext.get('QS7').addCls('hidden');
				Ext.get('QS3').addCls('hidden');
				Ext.get('QS5').addCls('hidden');

				Ext.get('anyinstrument').removeCls('visible');
				Ext.get('quantstudio').removeCls('visible');
				Ext.get('7900ht').removeCls('visible');
				Ext.get('7500fast').removeCls('visible');
				Ext.get('7500').removeCls('visible');
				Ext.get('steponeplus').removeCls('visible');
				Ext.get('viia7').removeCls('visible');
				//Ext.get('ntcycler').removeCls('visible');
				Ext.get('7300').removeCls('visible');
				Ext.get('7000').removeCls('visible');
				Ext.get('other').removeCls('visible');				
				Ext.get('QS6').removeCls('visible');
				Ext.get('QS7').removeCls('visible');
				Ext.get('QS3').removeCls('visible');
				Ext.get('QS5').removeCls('visible');
			} else {
				if($.inArray('anyinstrument',consumTubeArray ) != -1 ){
					Ext.get('anyinstrument').addCls('visible');
					Ext.get('anyinstrument').removeCls('hidden');
				} else {
					Ext.get('anyinstrument').addCls('hidden');
					Ext.get('anyinstrument').removeCls('visible');
				}
					
				if($.inArray('quantstudio',consumTubeArray ) != -1 ){
					Ext.get('quantstudio').addCls('visible');
					Ext.get('quantstudio').removeCls('hidden');
				} else {
					Ext.get('quantstudio').addCls('hidden');
					Ext.get('quantstudio').removeCls('visible');
				}
					
				if($.inArray('7900ht',consumTubeArray ) != -1 ){
					Ext.get('7900ht').addCls('visible');
					Ext.get('7900ht').removeCls('hidden');
				} else {
					Ext.get('7900ht').addCls('hidden');
					Ext.get('7900ht').removeCls('visible');
				}
					
				if($.inArray('7500fast',consumTubeArray ) != -1 ){
					Ext.get('7500fast').addCls('visible');
					Ext.get('7500fast').removeCls('hidden');
				} else {
					Ext.get('7500fast').addCls('hidden');
					Ext.get('7500fast').removeCls('visible');
				}
				
				if($.inArray('7500',consumTubeArray ) != -1 ){
					Ext.get('7500').addCls('visible');
					Ext.get('7500').removeCls('hidden');
				} else {
					Ext.get('7500').addCls('hidden');
					Ext.get('7500').removeCls('visible');
				}
					
				if($.inArray('steponeplus',consumTubeArray ) != -1 ){
					Ext.get('steponeplus').addCls('visible');
					Ext.get('steponeplus').removeCls('hidden');
				} else {
					Ext.get('steponeplus').addCls('hidden');
					Ext.get('steponeplus').removeCls('visible');
				}
					
				if($.inArray('viia7',consumTubeArray ) != -1 ){
					Ext.get('viia7').addCls('visible');
					Ext.get('viia7').removeCls('hidden');
				} else {
					Ext.get('viia7').addCls('hidden');
					Ext.get('viia7').removeCls('visible');
				}
					
				/*if($.inArray('ntcycler',consumTubeArray ) != -1 ){
					Ext.get('ntcycler').addCls('visible');
					Ext.get('ntcycler').removeCls('hidden');
				} else {
					Ext.get('ntcycler').addCls('hidden');
					Ext.get('ntcycler').removeCls('visible');
				}*/
					
				if($.inArray('7300',consumTubeArray ) != -1 ){
					Ext.get('7300').addCls('visible');
					Ext.get('7300').removeCls('hidden');
				} else {
					Ext.get('7300').addCls('hidden');
					Ext.get('7300').removeCls('visible');
				}
					
				if($.inArray('7000',consumTubeArray ) != -1 ){
					Ext.get('7000').addCls('visible');
					Ext.get('7000').removeCls('hidden');
				} else {
					Ext.get('7000').addCls('hidden');
					Ext.get('7000').removeCls('visible');
				}
					
				if($.inArray('other',consumTubeArray ) != -1 ){
					Ext.get('other').addCls('visible');
					Ext.get('other').removeCls('hidden');
				} else {
					Ext.get('other').addCls('hidden');
					Ext.get('other').removeCls('visible');
				}
				
				if($.inArray('QS6',consumTubeArray ) != -1 ){
					Ext.get('QS6').addCls('visible');
					Ext.get('QS6').removeCls('hidden');
				} else {
					Ext.get('QS6').addCls('hidden');
					Ext.get('QS6').removeCls('visible');
				}
					
				if($.inArray('QS7',consumTubeArray ) != -1 ){
					Ext.get('QS7').addCls('visible');
					Ext.get('QS7').removeCls('hidden');
				} else {
					Ext.get('QS7').addCls('hidden');
					Ext.get('QS7').removeCls('visible');
				}
				
				if($.inArray('QS3',consumTubeArray ) != -1 ){
					Ext.get('QS3').addCls('visible');
					Ext.get('QS3').removeCls('hidden');
				} else {
					Ext.get('QS3').addCls('hidden');
					Ext.get('QS3').removeCls('visible');
				}
				
				if($.inArray('QS5',consumTubeArray ) != -1 ){
					Ext.get('QS5').addCls('visible');
					Ext.get('QS5').removeCls('hidden');
				} else {
					Ext.get('QS5').addCls('hidden');
					Ext.get('QS5').removeCls('visible');
				}
				
				if($.inArray( 'QS3D',consumTubeArray ) != -1 )	{
					Ext.get('QS3D').addCls('visible');
					Ext.get('QS3D').removeCls('hidden');
				} else {
					Ext.get('QS3D').addCls('hidden');
					Ext.get('QS3D').removeCls('visible');
				}
			}
		}
		if(equipment == "384-well"){
			if(techdigitalpcr){
				currentType = "QS3D";
				dButtonID	= "QS3D";
				//Ext.get('QS3D').addCls('visible');
				Ext.get('anyinstrument').addCls('hidden');
				Ext.get('quantstudio').addCls('hidden');
				Ext.get('7900ht').addCls('hidden');
				Ext.get('7500fast').addCls('hidden');
				Ext.get('7500').addCls('hidden');
				Ext.get('steponeplus').addCls('hidden');
				Ext.get('viia7').addCls('hidden');
				//Ext.get('ntcycler').addCls('hidden');
				Ext.get('7300').addCls('hidden');
				Ext.get('7000').addCls('hidden');
				Ext.get('other').addCls('hidden');				
				Ext.get('QS6').addCls('hidden');
				Ext.get('QS7').addCls('hidden');
				Ext.get('QS3').addCls('hidden');
				Ext.get('QS5').addCls('hidden');
				
				Ext.get('anyinstrument').removeCls('visible');
				Ext.get('quantstudio').removeCls('visible');
				Ext.get('7900ht').removeCls('visible');
				Ext.get('7500fast').removeCls('visible');
				Ext.get('7500').removeCls('visible');
				Ext.get('steponeplus').removeCls('visible');
				Ext.get('viia7').removeCls('visible');
				//Ext.get('ntcycler').removeCls('visible');
				Ext.get('7300').removeCls('visible');
				Ext.get('7000').removeCls('visible');
				Ext.get('other').removeCls('visible');				
				Ext.get('QS6').removeCls('visible');
				Ext.get('QS7').removeCls('visible');
				Ext.get('QS3').removeCls('visible');
				Ext.get('QS5').removeCls('visible');
			} else {
				if($.inArray('anyinstrument',consumTubeArray ) != -1 ){
					Ext.get('anyinstrument').addCls('visible');
					Ext.get('anyinstrument').removeCls('hidden');
				} else {
					Ext.get('anyinstrument').addCls('hidden');
					Ext.get('anyinstrument').removeCls('visible');
				}
					
				if($.inArray('quantstudio',consumTubeArray ) != -1 ){
					Ext.get('quantstudio').addCls('visible');
					Ext.get('quantstudio').removeCls('hidden');
				} else {
					Ext.get('quantstudio').addCls('hidden');
					Ext.get('quantstudio').removeCls('visible');
				}
					
				if($.inArray('7900ht',consumTubeArray ) != -1 ){
					Ext.get('7900ht').addCls('visible');
					Ext.get('7900ht').removeCls('hidden');
				} else {
					Ext.get('7900ht').addCls('hidden');
					Ext.get('7900ht').removeCls('visible');
				}

				if($.inArray('viia7',consumTubeArray ) != -1 ){
					Ext.get('viia7').addCls('visible');
					Ext.get('viia7').removeCls('hidden');
				} else {
					Ext.get('viia7').addCls('hidden');
					Ext.get('viia7').removeCls('visible');
				}
					
				/*if($.inArray('ntcycler',consumTubeArray ) != -1 ){
					Ext.get('ntcycler').addCls('visible');
					Ext.get('ntcycler').removeCls('hidden');
				} else {
					Ext.get('ntcycler').addCls('hidden');
					Ext.get('ntcycler').removeCls('visible');
				}*/
				
				if($.inArray('other',consumTubeArray ) != -1 ){
					Ext.get('other').addCls('visible');
					Ext.get('other').removeCls('hidden');
				} else {
					Ext.get('other').addCls('hidden');
					Ext.get('other').removeCls('visible');
				}
				
				if($.inArray('QS6',consumTubeArray ) != -1 ){
					Ext.get('QS6').addCls('visible');
					Ext.get('QS6').removeCls('hidden');
				} else {
					Ext.get('QS6').addCls('hidden');
					Ext.get('QS6').removeCls('visible');
				}
					
				if($.inArray('QS7',consumTubeArray ) != -1 ){
					Ext.get('QS7').addCls('visible');
					Ext.get('QS7').removeCls('hidden');
				} else {
					Ext.get('QS7').addCls('hidden');
					Ext.get('QS7').removeCls('visible');
				}
				
				if($.inArray('QS3',consumTubeArray ) != -1 ){
					Ext.get('QS3').addCls('visible');
					Ext.get('QS3').removeCls('hidden');
				} else {
					Ext.get('QS3').addCls('hidden');
					Ext.get('QS3').removeCls('visible');
				}
				
				if($.inArray('QS5',consumTubeArray ) != -1 ){
					Ext.get('QS5').addCls('visible');
					Ext.get('QS5').removeCls('hidden');
				} else {
					Ext.get('QS5').addCls('hidden');
					Ext.get('QS5').removeCls('visible');
				}
				
				if($.inArray( 'QS3D',consumTubeArray ) != -1 )	{
					Ext.get('QS3D').addCls('visible');
					Ext.get('QS3D').removeCls('hidden');
				} else {
					Ext.get('QS3D').addCls('hidden');
					Ext.get('QS3D').removeCls('visible');
				}
				
				Ext.get('7300').removeCls('visible');
				Ext.get('7000').removeCls('visible');
				Ext.get('7500fast').removeCls('visible');
				Ext.get('7500').removeCls('visible');
				Ext.get('steponeplus').removeCls('visible');
				//Ext.get('QS3D').addCls('visible');
			}
		}
	}
	
	if(type == "Digital PCR"){ 
		Ext.get('anyinstrument').removeCls('visible');
		Ext.get('quantstudio').addCls('visible');
		Ext.get('7900ht').removeCls('visible');
		Ext.get('7500fast').removeCls('visible');
		Ext.get('7500').removeCls('visible');
		Ext.get('steponeplus').removeCls('visible');
		Ext.get('viia7').removeCls('visible');
		//Ext.get('ntcycler').addCls('visible');
		Ext.get('7300').removeCls('visible');
		Ext.get('7000').removeCls('visible');
		Ext.get('other').removeCls('visible');	
		
		Ext.get('QS6').removeCls('visible');
		Ext.get('QS7').removeCls('visible');
		Ext.get('QS3').removeCls('visible');
		Ext.get('QS5').removeCls('visible');
		Ext.get('QS3D').addCls('hidden');
		Ext.get('QS3D').removeCls('visible');
		             
		currentType = "QuantStudio";
		dButtonID	= "quantstudio";	
	}
	if(type == "Copy Number" || type == "Mutation Detection"){ 
		var techboth = $( "#techboth" ).hasClass( "tbuttonselected" );
		var techdigitalpcr = $( "#techdigitalpcr" ).hasClass( "tbuttonselected" );
		var techrealtimepcr = $( "#techrealtimepcr" ).hasClass( "tbuttonselected" );
		
		Ext.get('Tube').addCls('visible');		
		Ext.get('Chips').addCls('visible');
		//Ext.get('All').addCls('hidden');
		Ext.get('TAPFast').addCls('hidden');
		Ext.get('TAPStandard').addCls('hidden');
		Ext.get('TAC').addCls('hidden');
		Ext.get('OpenArray').addCls('hidden');
		
		Ext.get('Tube').removeCls('hidden');
		Ext.get('Chips').removeCls('hidden');
		//Ext.get('All').removeCls('visible');
		Ext.get('TAPFast').removeCls('visible');
		Ext.get('TAPStandard').removeCls('visible');
		Ext.get('TAC').removeCls('visible');
		Ext.get('OpenArray').removeCls('visible');
		
		if(equipment == "96-well"){	
			
			if(techrealtimepcr){
				//Ext.get('ntcycler').addCls('hidden');
				Ext.get('7300').addCls('hidden').removeCls('visible');
				Ext.get('7000').addCls('hidden').removeCls('visible');
			}
			if(techdigitalpcr){
				currentType = "QS3D";
				dButtonID	= "QS3D";
				//Ext.get('QS3D').addCls('visible');
				//Ext.get('QS3D').removeCls('hidden');
				Ext.get('anyinstrument').addCls('hidden');
				Ext.get('viia7').addCls('hidden');
				Ext.get('quantstudio').addCls('hidden');
				Ext.get('7900ht').addCls('hidden');
				Ext.get('7500fast').addCls('hidden');
				Ext.get('7500').addCls('hidden');
				Ext.get('steponeplus').addCls('hidden');
				Ext.get('QS6').addCls('hidden');
				Ext.get('QS7').addCls('hidden');			
				Ext.get('QS3').addCls('hidden');			
				Ext.get('QS5').addCls('hidden');			
				//Ext.get('ntcycler').addCls('hidden');
				Ext.get('7300').addCls('hidden').removeCls('visible');
				Ext.get('7000').addCls('hidden').removeCls('visible');
				Ext.get('other').addCls('hidden');				
			} else {
				if($.inArray('anyinstrument',consumTubeArray ) != -1 ){
					Ext.get('anyinstrument').addCls('visible');
					Ext.get('anyinstrument').removeCls('hidden');
				} else {
					Ext.get('anyinstrument').addCls('hidden');
					Ext.get('anyinstrument').removeCls('visible');
				}
					
				if($.inArray('quantstudio',consumTubeArray ) != -1 ){
					Ext.get('quantstudio').addCls('visible');
					Ext.get('quantstudio').removeCls('hidden');
				} else {
					Ext.get('quantstudio').addCls('hidden');
					Ext.get('quantstudio').removeCls('visible');
				}
					
				/*if($.inArray('ntcycler',consumTubeArray ) != -1 ){
					Ext.get('ntcycler').addCls('visible');
					Ext.get('ntcycler').removeCls('hidden');
				} else {
					Ext.get('ntcycler').addCls('hidden');
					Ext.get('ntcycler').removeCls('visible');
				}*/
				
				if($.inArray('7900ht',consumTubeArray ) != -1 ){
					Ext.get('7900ht').addCls('visible');
					Ext.get('7900ht').removeCls('hidden');
				} else {
					Ext.get('7900ht').addCls('hidden');
					Ext.get('7900ht').removeCls('visible');
				}

				if($.inArray('viia7',consumTubeArray ) != -1 ){
					Ext.get('viia7').addCls('visible');
					Ext.get('viia7').removeCls('hidden');
				} else {
					Ext.get('viia7').addCls('hidden');
					Ext.get('viia7').removeCls('visible');
				}
					
				if($.inArray('7500fast',consumTubeArray ) != -1 ){
					Ext.get('7500fast').addCls('visible');
					Ext.get('7500fast').removeCls('hidden');
				} else {
					Ext.get('7500fast').addCls('hidden');
					Ext.get('7500fast').removeCls('visible');
				}
				
				if($.inArray('7500',consumTubeArray ) != -1 ){
					Ext.get('7500').addCls('visible');
					Ext.get('7500').removeCls('hidden');
				} else {
					Ext.get('7500').addCls('hidden');
					Ext.get('7500').removeCls('visible');
				}
					
				if($.inArray('steponeplus',consumTubeArray ) != -1 ){
					Ext.get('steponeplus').addCls('visible');
					Ext.get('steponeplus').removeCls('hidden');
				} else {
					Ext.get('steponeplus').addCls('hidden');
					Ext.get('steponeplus').removeCls('visible');
				}
					
				if($.inArray('QS6',consumTubeArray ) != -1 ){
					Ext.get('QS6').addCls('visible');
					Ext.get('QS6').removeCls('hidden');
				} else {
					Ext.get('QS6').addCls('hidden');
					Ext.get('QS6').removeCls('visible');
				}
					
				if($.inArray('QS7',consumTubeArray ) != -1 ){
					Ext.get('QS7').addCls('visible');
					Ext.get('QS7').removeCls('hidden');
				} else {
					Ext.get('QS7').addCls('hidden');
					Ext.get('QS7').removeCls('visible');
				}
				
				if($.inArray('QS3',consumTubeArray ) != -1 ){
					Ext.get('QS3').addCls('visible');
					Ext.get('QS3').removeCls('hidden');
				} else {
					Ext.get('QS3').addCls('hidden');
					Ext.get('QS3').removeCls('visible');
				}
				
				if($.inArray('QS5',consumTubeArray ) != -1 ){
					Ext.get('QS5').addCls('visible');
					Ext.get('QS5').removeCls('hidden');
				} else {
					Ext.get('QS5').addCls('hidden');
					Ext.get('QS5').removeCls('visible');
				}
				
				if($.inArray('QS3D',consumTubeArray ) != -1 ){
					Ext.get('QS3D').addCls('visible');
					Ext.get('QS3D').removeCls('hidden');
				} else {
					Ext.get('QS3D').addCls('hidden');
					Ext.get('QS3D').removeCls('visible');
				}
				
				//Ext.get('ntcycler').removeCls('visible');
				Ext.get('7300').removeCls('visible');
				Ext.get('7000').removeCls('visible');
				Ext.get('other').removeCls('visible');	
			}
			
		}
		if(equipment == "384-well"){
			if(techrealtimepcr){
				//Ext.get('ntcycler').addCls('hidden');
				Ext.get('7300').addCls('hidden').removeCls('visible');
				Ext.get('7000').addCls('hidden').removeCls('visible');
			}
			if(techdigitalpcr){
				Ext.get('QS3D').addCls('hidden');
				currentType = "QS3D";
				dButtonID	= "QS3D";
				//Ext.get('QS3D').addCls('visible');
				//Ext.get('QS3D').removeCls('hidden');
				Ext.get('anyinstrument').addCls('hidden');
				Ext.get('viia7').addCls('hidden');
				Ext.get('quantstudio').addCls('hidden');
				Ext.get('7900ht').addCls('hidden');
				Ext.get('7500fast').addCls('hidden');
				Ext.get('7500').addCls('hidden');
				Ext.get('steponeplus').addCls('hidden');
				Ext.get('QS6').addCls('hidden');
				Ext.get('QS7').addCls('hidden');			
				Ext.get('QS3').addCls('hidden');			
				Ext.get('QS5').addCls('hidden');			
				//Ext.get('ntcycler').addCls('hidden');
				Ext.get('7300').addCls('hidden').removeCls('visible');
				Ext.get('7000').addCls('hidden').removeCls('visible');
				Ext.get('other').addCls('hidden');
			} else {	
				if($.inArray('anyinstrument',consumTubeArray ) != -1 ){
					Ext.get('anyinstrument').addCls('visible');
					Ext.get('anyinstrument').removeCls('hidden');
				} else {
					Ext.get('anyinstrument').addCls('hidden');
					Ext.get('anyinstrument').removeCls('visible');
				}
					
				if($.inArray('quantstudio',consumTubeArray ) != -1 ){
					Ext.get('quantstudio').addCls('visible');
					Ext.get('quantstudio').removeCls('hidden');
				} else {
					Ext.get('quantstudio').addCls('hidden');
					Ext.get('quantstudio').removeCls('visible');
				}
					
				if($.inArray('7900ht',consumTubeArray ) != -1 ){
					Ext.get('7900ht').addCls('visible');
					Ext.get('7900ht').removeCls('hidden');
				} else {
					Ext.get('7900ht').addCls('hidden');
					Ext.get('7900ht').removeCls('visible');
				}

				if($.inArray('viia7',consumTubeArray ) != -1 ){
					Ext.get('viia7').addCls('visible');
					Ext.get('viia7').removeCls('hidden');
				} else {
					Ext.get('viia7').addCls('hidden');
					Ext.get('viia7').removeCls('visible');
				}
					
				if($.inArray('7500fast',consumTubeArray ) != -1 ){
					Ext.get('7500fast').addCls('visible');
					Ext.get('7500fast').removeCls('hidden');
				} else {
					Ext.get('7500fast').addCls('hidden');
					Ext.get('7500fast').removeCls('visible');
				}
				
				if($.inArray('7500',consumTubeArray ) != -1 ){
					Ext.get('7500').addCls('visible');
					Ext.get('7500').removeCls('hidden');
				} else {
					Ext.get('7500').addCls('hidden');
					Ext.get('7500').removeCls('visible');
				}
					
				if($.inArray('steponeplus',consumTubeArray ) != -1 ){
					Ext.get('steponeplus').addCls('visible');
					Ext.get('steponeplus').removeCls('hidden');
				} else {
					Ext.get('steponeplus').addCls('hidden');
					Ext.get('steponeplus').removeCls('visible');
				}
					
				if($.inArray('QS6',consumTubeArray ) != -1 ){
					Ext.get('QS6').addCls('visible');
					Ext.get('QS6').removeCls('hidden');
				} else {
					Ext.get('QS6').addCls('hidden');
					Ext.get('QS6').removeCls('visible');
				}
					
				if($.inArray('QS7',consumTubeArray ) != -1 ){
					Ext.get('QS7').addCls('visible');
					Ext.get('QS7').removeCls('hidden');
				} else {
					Ext.get('QS7').addCls('hidden');
					Ext.get('QS7').removeCls('visible');
				}	

				if($.inArray('QS3',consumTubeArray ) != -1 ){
					Ext.get('QS3').addCls('visible');
					Ext.get('QS3').removeCls('hidden');
				} else {
					Ext.get('QS3').addCls('hidden');
					Ext.get('QS3').removeCls('visible');
				}
				
				if($.inArray('QS5',consumTubeArray ) != -1 ){
					Ext.get('QS5').addCls('visible');
					Ext.get('QS5').removeCls('hidden');
				} else {
					Ext.get('QS5').addCls('hidden');
					Ext.get('QS5').removeCls('visible');
				}
					
				//Ext.get('ntcycler').removeCls('visible');
				Ext.get('7300').removeCls('visible');
				Ext.get('7000').removeCls('visible');
				Ext.get('other').removeCls('visible');	
			}
		}
		
		if($.inArray('anyinstrument',consumTubeArray ) != -1 ){
			Ext.get('anyinstrument').addCls('visible');
			Ext.get('anyinstrument').removeCls('hidden');
		} else {
			Ext.get('anyinstrument').addCls('hidden');
			Ext.get('anyinstrument').removeCls('visible');
		}
			
		if($.inArray('quantstudio',consumTubeArray ) != -1 ){
			Ext.get('quantstudio').addCls('visible');
			Ext.get('quantstudio').removeCls('hidden');
		} else {
			Ext.get('quantstudio').addCls('hidden');
			Ext.get('quantstudio').removeCls('visible');
		}
			
		/*if($.inArray('ntcycler',consumTubeArray ) != -1 ){
			Ext.get('ntcycler').addCls('visible');
			Ext.get('ntcycler').removeCls('hidden');
		} else {
			Ext.get('ntcycler').addCls('hidden');
			Ext.get('ntcycler').removeCls('visible');
		}*/
		
		if($.inArray('7900ht',consumTubeArray ) != -1 ){
			Ext.get('7900ht').addCls('visible');
			Ext.get('7900ht').removeCls('hidden');
		} else {
			Ext.get('7900ht').addCls('hidden');
			Ext.get('7900ht').removeCls('visible');
		}

		if($.inArray('viia7',consumTubeArray ) != -1 ){
			Ext.get('viia7').addCls('visible');
			Ext.get('viia7').removeCls('hidden');
		} else {
			Ext.get('viia7').addCls('hidden');
			Ext.get('viia7').removeCls('visible');
		}
			
		if($.inArray('7500fast',consumTubeArray ) != -1 ){
			Ext.get('7500fast').addCls('visible');
			Ext.get('7500fast').removeCls('hidden');
		} else {
			Ext.get('7500fast').addCls('hidden');
			Ext.get('7500fast').removeCls('visible');
		}
		
		if($.inArray('7500',consumTubeArray ) != -1 ){
			Ext.get('7500').addCls('visible');
			Ext.get('7500').removeCls('hidden');
		} else {
			Ext.get('7500').addCls('hidden');
			Ext.get('7500').removeCls('visible');
		}
			
		if($.inArray('steponeplus',consumTubeArray ) != -1 ){
			Ext.get('steponeplus').addCls('visible');
			Ext.get('steponeplus').removeCls('hidden');
		} else {
			Ext.get('steponeplus').addCls('hidden');
			Ext.get('steponeplus').removeCls('visible');
		}
			
		if($.inArray('QS6',consumTubeArray ) != -1 ){
			Ext.get('QS6').addCls('visible');
			Ext.get('QS6').removeCls('hidden');
		} else {
			Ext.get('QS6').addCls('hidden');
			Ext.get('QS6').removeCls('visible');
		}
			
		if($.inArray('QS7',consumTubeArray ) != -1 ){
			Ext.get('QS7').addCls('visible');
			Ext.get('QS7').removeCls('hidden');
		} else {
			Ext.get('QS7').addCls('hidden');
			Ext.get('QS7').removeCls('visible');
		}
		
		if($.inArray('QS3',consumTubeArray ) != -1 ){
			Ext.get('QS3').addCls('visible');
			Ext.get('QS3').removeCls('hidden');
		} else {
			Ext.get('QS3').addCls('hidden');
			Ext.get('QS3').removeCls('visible');
		}
		
		if($.inArray('QS5',consumTubeArray ) != -1 ){
			Ext.get('QS5').addCls('visible');
			Ext.get('QS5').removeCls('hidden');
		} else {
			Ext.get('QS5').addCls('hidden');
			Ext.get('QS5').removeCls('visible');
		}
		
		if($.inArray('QS3D',consumTubeArray ) != -1 ){
			Ext.get('QS3D').addCls('visible');
			Ext.get('QS3D').removeCls('hidden');
		} else {
			Ext.get('QS3D').addCls('hidden');
			Ext.get('QS3D').removeCls('visible');
		}
	}
	
	updateExperimentInfo("openarrayinstrument", currentType);
	if(currentType == "QuantStudio"){		
		Ext.get("openarrayinstrumentselector").select('span').each(function (e) {			
			Ext.get(e).removeCls('tbuttonselected');			
		});
		Ext.get(dButtonID).addCls('tbuttonselected');
	}else{
		resetTbutton("openarrayinstrumentselector", currentType);
	}
	
	
	
	/*
	Ext.get('anyinstrument').addCls('tbuttonselected');
	Ext.get('quantstudio').removeCls('tbuttonselected');
	Ext.get('7900ht').removeCls('tbuttonselected');
	Ext.get('7500fast').removeCls('tbuttonselected');
	Ext.get('7500').removeCls('tbuttonselected');
	Ext.get('steponeplus').removeCls('tbuttonselected');
	Ext.get('viia7').removeCls('tbuttonselected');
	Ext.get('ntcycler').removeCls('tbuttonselected');
	Ext.get('7300').removeCls('tbuttonselected');
	Ext.get('7000').removeCls('tbuttonselected');
	Ext.get('other').removeCls('tbuttonselected');*/
	
	
	
	updateContMessage();
}

function updateContMessage(){
	var contMessage = "";
	var type 		= getExperimentInfo("type");
	if(type == "Gene Expression"){
		contMessage += "Some TaqMan Array Plates, Cards or OpenArray product options were not included because the number of targets specified is higher than what is supported by those products.<br >";
		contMessage += "Here are the maximum number of tagrets supported by plates, cards and arrays:<br >";
		contMessage += "Plates - Custom: 96<br >";
		contMessage += "Plates - Fixed : 96<br >";
		contMessage += "Cards - Custom: 384<br >";
		contMessage += "Cards - Fixed : 384<br >";
		contMessage += "OpenArray - Custom: 224<br >";
		contMessage += "OpenArray - Fixed Panels: 828";
	}
	
	if(type == "Genotyping"){
		contMessage += "Some TaqMan OpenArray product options were not included because the number of targets specified is higher than what is supported by those products.<br >";
		contMessage += "Here are the maximum number of targets supported by OpenArray for Genotyping:<br >";
		contMessage += "Custom: 256<br >";
		contMessage += "Fixed Panels: 164";
	}
	
	if(type == "miRNA"){
		contMessage += "Some TaqMan Array and OpenArray product options were not included because the number of targets specified is higher than what is supported by those products.<br >";
		contMessage += "Here are the maximum number of targets supported:<br >";
		contMessage += "Cards - TaqMan Array Human MicroRNA B Cards v3.0 - 377<br >";
		contMessage += "Cards - TaqMan Array Human MicroRNA A+B Cards set v3.0 - 754<br >";
		contMessage += "Cards - TaqMan Array Rodent MicroRNA A+B Cards set v3.0 - 641<br >";
		contMessage += "Cards - TaqMan Array Rodent MicroRNA B Cards set v3.0 - 306<br >";
		contMessage += "Cards - Custom TaqMan Array MicroRNA  - 384<br >";
		contMessage += "OpenArray - Fixed Human Panels: 754<br >";
		contMessage += "OpenArray - Fixed Rodent Panels:750<br >";
		
		/*contMessage += "Cards - TaqMan Human Array MIRNA Cards:377<br >";
		contMessage += "Cards - Fixed Human Panels:754<br >";
		contMessage += "Cards - Fixed Mouse Panels:641<br >";
		contMessage += "OpenArray - Fixed Human Panels: 754<br >";
		contMessage += "OpenArray - Fixed Rodent Panels:750<br >";
		contMessage += "Cards - Custom TaqMan Cards:384"*/
	}
	
	if(type == "Digital PCR"){
		contMessage += "Some TaqMan OpenArray product options were not included because the number of targets specified is higher than what is supported by those products.<br >";
		contMessage += "Here are the maximum number of targets supported by OpenArray for Digital:<br >";
		contMessage += "Custom: 224<br >";
	}
	
	
	Ext.get('contMessage').update(contMessage);
		
	contMessage = '';
}

function scrollWindow(){
  window.scrollTo(0,190)
}

function uniqueArray(a) {
    a.sort();
    for (var i = 1; i < a.length;) {
        if (a[i - 1] == a[i]) {
            a.splice(i, 1);
        } else {
            i++;
        }
    }
    return a;
}

function isValueInArray(val, arr) {
    inArray = false;
    for (i = 0; i < arr.length; i++)
    if (val == arr[i]) inArray = true;
    return inArray;
}

function getVolumeDiscount(pno){
	newpartno = pno;
	//console.log('newpartno' + newpartno);
	var rec2 = outputList.findRecord('pno', newpartno, 0, false, false, true);	
	VolumeDiscounts = rec2 ? parseFloat(rec2.get('volumediscount')) : 0;
	
	return VolumeDiscounts;
}

function getProductLink(title,url){	
	var r = title;
	if(url.length > 0) r = "<a target='_blank' href='" + url + "'>"+title+"</a>";	
	return r;
}

var objPopupWindow 		= null;
var objPopupContent 	= null;
var speed				= 500;
var popOpened			= false;
var originalHeight		= Array();
var originalWidth		= Array();

Ext.onReady(function () {
	/*Ext.get('NeedHelpStepOne').on('click', function (e) {				
		ShowPopupWindow()	
		e.preventDefault();
	});			
	Ext.get('CloseHelpTextStepOne').on('click', function (e) {
		HideMask();				
		e.preventDefault();
	});
	
	Ext.get('TopHelpTextStepOne').on('click', function (e) {
		Ext.get('HelpTextStepOneContent').scrollTo('top', 0);
		e.preventDefault();
	});
	*/
	
	/*var els=Ext.query(".HelpText"), ret=[];
	for(i=0;i<els.length;i++)
	{
		alert(els[i].getWidth())
		
		ret.push(els[i].getWidth());
	}*/
	
	Ext.select('.PopupBtn').each(function(el){
		var p = el.getAttribute("rel");
		var thisobj = Ext.get(p);
		originalWidth[p] = thisobj.getWidth();
		originalHeight[p] = thisobj.getHeight();				
		thisobj.addCls('hidden');
		thisobj.removeCls('visible');				
		el.on('click', function (e) {
			if(!popOpened) {ShowPopupWindow(e.target);}
			e.preventDefault();
		})
	}); 
	
	scrollList('HelpTextStepOneList','HelpTextStepOneContent');
	Ext.get('mask').addCls('hidden');
	Ext.get('mask').removeCls('visible');
	Ext.get("mask").dom.style.opacity = 0;
	
	
	//for tesing enable this
	//ShowPopupWindow(Ext.get('NeedHelpStepTwo').dom); 
	
	window.onresize = function() {center()}
});

function scrollList(list,content){
	Ext.get(list).select('a').on('click', function (e) {
		//console.log(Ext.get(e.target).getAttribute("rel"))
		var off = Ext.get(Ext.get(e.target).getAttribute("rel")).dom.offsetTop;
		//console.log(Ext.get(Ext.get(e.target).getAttribute("rel")).dom.offsetTop)
		Ext.get(content).scrollTo('top', off-15, true);
		e.preventDefault();
	});
}
function ShowPopupWindow(obj){
	ShowMask();
	popOpened = true;
	objPopupWindow = Ext.get(obj).getAttribute("rel");
	Ext.get(objPopupWindow).addCls('visible');
	Ext.get(objPopupWindow).removeCls('hidden');
	center(objPopupWindow)
	Ext.get(objPopupWindow).animate({
		duration: speed,
		to: {
			opacity: 1
		}						
	});
}
function HidePopup(){
	Ext.get(objPopupWindow).animate({
		duration: speed,
		to: {
			opacity: 0
		},
		listeners: {						
			afteranimate: function() {										
				// Execute my custom method after the animation
				Ext.get(objPopupWindow).addCls('hidden');
				Ext.get(objPopupWindow).removeCls('visible');
				popOpened = false;							
			},
			scope: this
		}
	});
}
function ShowMask(){
	Ext.get('mask').addCls('visible');
	Ext.get('mask').removeCls('hidden');				
	Ext.get('mask').animate({
		duration: speed,
		to: {
			opacity: 0.8
		}
	});
}
function HideMask(){
	Ext.get('mask').animate({
		duration: speed,
		to: {
			opacity: 0
		},
		listeners: {						
			afteranimate: function() {
				// Execute my custom method after the animation
				Ext.get('mask').addCls('hidden');
				Ext.get('mask').removeCls('visible');
			},
			scope: this
		}
	});
	HidePopup()
}

function CloseHelpText(){
	HideMask();
}
function TopHelpText(obj){
	objPopupContent = Ext.get(obj).getAttribute("rel");
	Ext.get(objPopupContent).scrollTo('top', 0, true);
	return false;
}

function center(obj) {
	
	if(!objPopupWindow) return false;
	
	var thisobj = Ext.get(objPopupWindow);
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;	
	var newPopupWindowWidth  = (windowWidth - 100);
	var newPopupWindowHeight  = (windowHeight - 100);
	
	var popupWidth = originalWidth[objPopupWindow];
	if(popupWidth <= newPopupWindowWidth){
		newPopupWindowWidth = popupWidth;				
	}
	thisobj.dom.style.width = newPopupWindowWidth + "px";
	
	var popupHeight = originalHeight[objPopupWindow];
	
	if(popupHeight <= newPopupWindowHeight){
		newPopupWindowHeight = popupHeight;
		thisobj.down('.TopHelpText').addCls('hidden');
		thisobj.down('.TopHelpText').removeCls('visible');				
	}else{				
		thisobj.down('.TopHelpText').removeCls('hidden');
		thisobj.down('.TopHelpText').addCls('visible');
	}			
	thisobj.dom.style.height = newPopupWindowHeight + "px";
	
	thisobj.dom.style.left = ((windowWidth/2) - (newPopupWindowWidth/2)) + "px";
	thisobj.dom.style.top = ((windowHeight/2) - (newPopupWindowHeight/2)) + "px";
}
function dump(arr, level) {
	var dumped_text = "";
	if (!level) level = 0;
	//The padding given at the beginning of the line.
	var level_padding = "";
	for (var j = 0; j < level + 1; j++) level_padding += "    ";
	if (typeof (arr) == 'object') { //Array/Hashes/Objects 
		for (var item in arr) {
			var value = arr[item];
			if (typeof (value) == 'object') { //If it is an array,
				dumped_text += level_padding + "'" + item + "' ...\n";
				dumped_text += dump(value, level + 1);
			} else {
				dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
			}
		}
	} else { //Stings/Chars/Numbers etc.
		dumped_text = "===>" + arr + "<===(" + typeof (arr) + ")";
	}
	return dumped_text;
}


function dump(arr, level) {
    var dumped_text = "";
    if (!level) level = 0;
    //The padding given at the beginning of the line.
    var level_padding = "";
    for (var j = 0; j < level + 1; j++) level_padding += "    ";
    if (typeof (arr) == 'object') { //Array/Hashes/Objects 
        for (var item in arr) {
            var value = arr[item];
            if (typeof (value) == 'object') { //If it is an array,
                dumped_text += level_padding + "'" + item + "' ...\n";
                dumped_text += dump(value, level + 1);
            } else {
                dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
            }
        }
    } else { //Stings/Chars/Numbers etc.
        dumped_text = "===>" + arr + "<===(" + typeof (arr) + ")";
    }
    return dumped_text;
}
/*$j(window).load(function() {
	//Ext.get("documentloaded").addCls("hidden");
	$j("#documentloaded").fadeOut("slow").removeClass("windowlaoding");
});
*/

function getDateTime(delimiter){
	if(!delimiter) delimiter = "_";
	var d = new Date();
	var d 	= new Date();
	var fd 	= d.getFullYear() + delimiter + + (d.getMonth()+1) + delimiter +  d.getDate() + delimiter + d.getHours()+ delimiter + d.getMinutes() + delimiter + d.getSeconds();
}

function removeSpecialCharacters(string){	
	string = string.replace(/#trademark#/g, '');
	string = string.replace(/#reg#/g, '');	
	string = string.replace(/&#8482;/g, '');
	string = string.replace(/&#174;/g, '');
	string = string.replace(/&reg;/g, '');	
	string = string.replace(/\u00AE/g, '');	
	string = string.replace(/\u2122/g, '');
	string = string.replace(/&nbsp;/g, ' ');
	
	return string;
}

function cpsSecondPageInputUpdates(){
	//updateExperimentInfo("nooftargets", ( Number(Ext.get('no_of_CUSMOtargets1').dom.value) + Number(Ext.get('no_of_INVtargets1').dom.value) ) ); Madhu asked to remove this on 06-10-2015
	updateExperimentInfo("nooftargets", ( Number(Ext.get('no_of_CUSMOtargets1').dom.value) ) );
	//updateExperimentInfo("noofcsptargets", Ext.get('no_of_CUSMOtargets1').dom.value); Madhu asked to remove this on 06-10-2015
	updateExperimentInfo("noofinvptargets", Ext.get('no_of_INVtargets1').dom.value);
	updateExperimentInfo("noofsamples", Ext.get('no_of_samples1').dom.value);
	updateExperimentInfo("noofreplicates", Ext.get('no_of_replicates1').dom.value);
	showSecondStepCsPlating();
}

function gettarget(getval) {
    var target = document.getElementById("no_of_targets1").value;
    if (target == 0) {
        document.getElementById("no_of_targets1").value = 1;
    }
    var samples = document.getElementById("no_of_samples1").value;
    if (samples == 0) {
        document.getElementById("no_of_samples1").value = 1;
    }
    var replicates = document.getElementById("no_of_replicates1").value;
    if (replicates == 0) {
        document.getElementById("no_of_replicates1").value = 1;
    }
    var target0 = document.getElementById("no_of_targets").value;
    if (target0 == 0) {
        document.getElementById("no_of_targets").value = 1;
    }
    var samples0 = document.getElementById("no_of_samples").value;
    if (samples0 == 0) {
        document.getElementById("no_of_samples").value = 1;
    }
    var replicates0 = document.getElementById("no_of_replicates").value;
    if (replicates0 == 0) {
        document.getElementById("no_of_replicates").value = 1;
    }
    var no_of_pgxsamples0 = document.getElementById("no_of_pgxsamples").value;
    if (no_of_pgxsamples0 == 0) {
        document.getElementById("no_of_pgxsamples").value = 1;
    }
}


function loadDownloadify(){
	var currencyArr = ["EUR", "CZK", "GBP", "PLN", "KRW", "CNY", "JPY"];
	Downloadify.create('downloadify',{
		filename: function(){
			var d 	= new Date();
			var fd 	= d.getFullYear() + "_" + + (d.getMonth()+1) + "_" +  d.getDate() + "_" + d.getHours()+ "_" + d.getMinutes() + "_" + d.getSeconds();
			return "product_list_"+fd+".csv";
		},
		data: function(){ 
				CSVHTML = "";
							
				var rec = outputList.findRecord('pno', currentpno, 0, false, false, true);	
				var nomtragets = getExperimentInfo("nooftargets");
				var nomsamples = getExperimentInfo("noofsamples");
				var nomplicat = getExperimentInfo("noofreplicates");
				var title = rec.get('title');	
				title = title.replace("<sup>&reg;</sup>&nbsp;", ' ');
				title = title.replace("<sup>&reg;</sup>", ' ');
				title = title.replace("&trade;", ' ');
				title = title.replace("&nbsp;", ' ');
				title = title.replace(/ï¿½/gi, ' ');
				CSVHTML += title;
				CSVHTML += "\n";
				CSVHTML += getExperimentInfo("type") +" - "+ getExperimentInfo("openarrayinstrument");
				CSVHTML += "\n";
				CSVHTML += getExperimentInfo("method") + " Chemistry - "+ nomtragets + " targets - "+  nomsamples +" samples - "+ nomplicat +" replicates ";
				CSVHTML += "\n";
				CSVHTML += "\n";
				CSVHTML += "Product,";
				CSVHTML += "Type,";
				CSVHTML += "Part number,";
				CSVHTML += "Quantity,";
				CSVHTML += "Price,";
				CSVHTML += "Volume Discount,";
				CSVHTML += "Total Discount,";
				CSVHTML += "Net Price";
				CSVHTML += "\n";
				for (var i = 0; i < detailspageinfo.getCount(); i++) {
					var e = detailspageinfo.getAt(i);
					if (e.get('quantity') > 0) {
						CSVHTML +=  '"'+removeSpecialCharacters(e.get('product'))+'",';
						CSVHTML +=  '"'+e.get('type')+'",';
						CSVHTML +=  '"'+e.get('partnumber')+'",';
						CSVHTML +=  '"'+e.get('quantity')+'",';
						if(jQuery.inArray(currency, currencyArr) !== -1){
							CSVHTML +=  '"'+roundNumber(e.get('unitprice'), 2)+'",';
						} else {
							CSVHTML +=  '"'+convertCurrency(roundNumber(e.get('unitprice'), 2), region + "-" + currency)+'",';
						}						
						CSVHTML +=  '"'+e.get('volumediscount2')+'",';
						CSVHTML +=  '"'+e.get('discount')+'",';
						if(jQuery.inArray(currency, currencyArr) !== -1){
							CSVHTML +=  '"'+roundNumber(e.get('netprice'), 2)+'"';
						} else {
							CSVHTML +=  '"'+convertCurrency(roundNumber(e.get('netprice'), 2), region + "-" + currency)+'"';
						}
						//CSVHTML +=  '"'+ "&#165"+ roundNumber(e.get('netprice'), 2)+'"';
						CSVHTML += "\n";
					}
				}
				CSVHTML += "\n";
				CSVHTML += "\n";
				CSVHTML += ",,,,,,Total Cost,";
				if(jQuery.inArray(currency, currencyArr) !== -1){
					var totcost = document.getElementById('productlisttotalcost').innerHTML;
					totcost = totcost.split(".")[0];
					totcost = totcost.replace(/[^\d]/g, "");
					CSVHTML +=  '"'+totcost+'",';
				} else {
					CSVHTML += '"'+document.getElementById('productlisttotalcost').innerHTML + '"';
				}
				
				CSVHTML += "\n";
				CSVHTML += "\n";
				if(jQuery.inArray(currency, currencyArr) !== -1){
					CSVHTML += "Note: Prices mentioned above are based on "+ region +" region and "+ currency + " currency type.";
					CSVHTML += "\n";
				}
			return CSVHTML ;
		},
		onComplete: function(){ alert('Your File Has Been Downloaded!'); 
		},
		onCancel: function(){ alert('You have cancelled the saving of this file.'); 
		},
		onError: function(){ //alert('You must put something in the File Contents or there will be nothing to save!'); 
		},
		swf: 'media/downloadify.swf',
		downloadImage: 'images/save-product-list.png',
		width: 127,
		height: 26,
		transparent: true,
		append: false
	});
}



function loadPGxDownloadify1(){
	if(getExperimentInfo("generateQuoteFor") == "Instruments and reagents"){
		var DNA = ["Instrument","Consumables","Reagents"];		
	} else {
		var DNA = ["Consumables","Reagents"];
	}
	var blocklist = ["DNAExtraction","SNP","CNV"];
	Downloadify.create('pgx_downloadify1',{
		filename: function(){
			var d 	= new Date();
			var fd 	= d.getFullYear() + "_" + + (d.getMonth()+1) + "_" +  d.getDate() + "_" + d.getHours()+ "_" + d.getMinutes() + "_" + d.getSeconds();
			return "Quote_Summary_"+fd+".csv";
		},
		data: function(){ 
			CSVHTML = "";
			CSVHTML += "Instrument,";				
			CSVHTML += "Part number,";
			//CSVHTML += "Description,";
			CSVHTML += "Quantity,";
			CSVHTML += "Unit Price,";
			CSVHTML += "Volume Discount,";
			CSVHTML += "Unit Sell Price,";
			CSVHTML += "Total Sell Price";
			CSVHTML += "\n";
			for(var bi=0; bi < blocklist.length; bi++){
				
				var blockid = blocklist[bi];
				//alert(blockid);
				
				
				for (var k = 0; k < DNA.length; k++) {	
					
					if(blockid == 'DNAExtraction') {
						if(DNA[k] == 'Instrument') {
							if(getExperimentInfo("generateQuoteFor") == "Instruments and reagents"){
								var MLength = 2;
								var IdVal = 'MagMAXInstru';
								var Title = 'MagMax Instrument';  
								var JVal =0;
							}
						} else if (DNA[k] == 'Consumables') {
							var MLength = 3;
							var IdVal = 'MagMAXCons';
							var Title = 'MagMax Consumables';
							var JVal =0;
						}  else if (DNA[k] == 'Reagents') {
							var MLength = 2;
							var IdVal = 'MagMAXReag';
							var Title = 'MagMax Reagents';
							var JVal =0;
						} 
						 
					} else if (blockid == 'SNP') {
						if(DNA[k] == 'Instrument') {
							if(getExperimentInfo("generateQuoteFor") == "Instruments and reagents"){
								var MLength = 2;
								var IdVal = 'MagMAXInstru';
								var Title = 'SNP Instrument'; 
								var JVal =1;
							}
						} else if (DNA[k] == 'Consumables') {
							var pgxopenarraycalctypeobj = Ext.get("pgxsnpformatneed").dom;
							var selectpgxsnpopenarrayInstValue = pgxopenarraycalctypeobj.options[pgxopenarraycalctypeobj.selectedIndex].value;
							
							/*if(selectpgxsnpopenarrayInstValue.indexOf("OpenArray") == 0 ){
								var MLength = 3;
							} else {
								var MLength = 3;
							}*/					
							var MLength = 3;							
							var IdVal = 'MagMAXCons';
							var Title = 'SNP Consumables';
							var JVal =1;
						}  else if (DNA[k] == 'Reagents') {
							var MLength = 3;var IdVal = 'MagMAXReag';
							var Title = 'SNP Reagents';
							var JVal =1;
						} 
					}  else if (blockid == 'CNV') {
						if(DNA[k] == 'Instrument') {
							if(getExperimentInfo("generateQuoteFor") == "Instruments and reagents"){
								var MLength = 2;
								var IdVal = 'MagMAXInstru';
								var Title = 'CNV Instrument';  
								var JVal =1;
							}
						} else if (DNA[k] == 'Consumables') {
							var MLength = 2;
							var IdVal = 'MagMAXCons';
							var Title = 'CNV Consumables';
							var JVal =1;
						}  else if (DNA[k] == 'Reagents') {
							var MLength = 4;var IdVal = 'MagMAXReag';
							var Title = 'CNV Reagents';
							var JVal =1;
						} 
					}					
						
						
						CSVHTML += Title+",";
						CSVHTML += "\n";						
					
					for (var j = JVal; j < MLength; j++) {					
							CSVHTML +=  '"'+removeSpecialCharacters($("#"+blockid+"-"+IdVal+"_instrument_"+j).text())+'",';
							CSVHTML +=  '"'+$("#"+blockid+"-"+IdVal+"_partno_"+j).text()+'",';
							//CSVHTML +=  '"'+$("#"+blockid+"-"+IdVal+"_desc_"+j).text()+'",';
							CSVHTML +=  '"'+$("#"+blockid+"-"+IdVal+"_qty_"+j).val()+'",';
							CSVHTML +=  '"'+$("#"+blockid+"-"+IdVal+"_unitprice_"+j).text()+'",';
							CSVHTML +=  '"'+$("#"+blockid+"-"+IdVal+"_discper_"+j).val()+'",';
							CSVHTML +=  '"'+$("#"+blockid+"-"+IdVal+"_unitsellprice_"+j).text()+'",';
							CSVHTML +=  '"'+$("#"+blockid+"-"+IdVal+"_totalprice_"+j).text()+'"';
							CSVHTML += "\n";					
					}	
					//CSVHTML += "\n";
				}
				CSVHTML += "\n";
				//CSVHTML += "\n";
			
			}			
			
			if(getExperimentInfo("generateQuoteFor") == "Instruments and reagents"){
				// Service Plan and Training
				
				var pgxsnpopenarraycalctypeobj = Ext.get("pgxsnpopenarrayformat").dom;
				var selectpgxsnpopenarrayObjValue = pgxsnpopenarraycalctypeobj.options[pgxsnpopenarraycalctypeobj.selectedIndex].value;	
				
				var pgxcnvopenarraycalctypeobj = Ext.get("pgxcnainstruments").dom;
				var selectpgxcnvopenarrayObjValue = pgxcnvopenarraycalctypeobj.options[pgxcnvopenarraycalctypeobj.selectedIndex].value;	
				
				var pgxintallation_maintenanceobj = Ext.get("pgxintallation_maintenance").dom;
				var selectpgxintallation_maintenanceObjValue = pgxintallation_maintenanceobj.options[pgxintallation_maintenanceobj.selectedIndex].value;
				
				var pgxintallation_addtrainingobj = Ext.get("pgxintallation_addtraining").dom;
				var selectpgxintallation_addtrainingObjValue = pgxintallation_addtrainingobj.options[pgxintallation_addtrainingobj.selectedIndex].value;
				
				var pgxintallationinstallneedobj = Ext.get("pgxintallation_installneed").dom;
				var pgxintallationinstallneedValue = pgxintallationinstallneedobj.options[pgxintallationinstallneedobj.selectedIndex].value;
	
				/*if(selectpgxcnvopenarrayObjValue == "Same instrument as SNP analysis" ){
					selectpgxcnvopenarrayObjValue = selectpgxsnpopenarrayObjValue;
				}*/
				if(selectpgxintallation_maintenanceObjValue == "None"){
					var SNPServiceMsg = "Did not select any Service plan";
					var CNVServiceMsg = "Did not select any Service plan";
				}
				if(selectpgxintallation_addtrainingObjValue == "None"){
					var SNPTrainingMsg = "Did not select any Training method";
					var CNVTrainingMsg = "Did not select any Training method";
				}
	
				CSVHTML += "Service Plan and Training,";
				CSVHTML += "\n";				
				CSVHTML += selectpgxsnpopenarrayObjValue+",";
				CSVHTML += "Part number,";
				CSVHTML += "Qty,";
				CSVHTML += "Unit List Price,";
				CSVHTML += "% discount,";
				CSVHTML += "Unit Sell Price,";
				CSVHTML += "Total Sell Price,";
				CSVHTML += "\n";
				
				//Installation Instrument section
				if(selectpgxsnpopenarrayObjValue == "QuantStudio 12K"){
					var start = 19;
					var end = 30;
				} else if(selectpgxsnpopenarrayObjValue == "QuantStudio 7"){
					var start = 10;
					var end = 18;
				} else if(selectpgxsnpopenarrayObjValue == "QuantStudio 6"){
					var start = 1;
					var end = 9;
				}
				for (var ins = start; ins <end; ins++ ){					
					if(pgxintallationinstallneedValue != "None"){ 						
						if( $("#IqOqIpvdesc"+ins+"").text() == ''){  }
						else {
							CSVHTML += $("#IqOqIpvdesc"+ins+"").text().replace(/,/g, '')+",";
							CSVHTML += $("#IqOqIpvpartno"+ins+"").text().replace(/,/g, '')+",";
							CSVHTML += $("#IqOqIpv_qty_"+ins+"").val().replace(/,/g, '')+",";
							CSVHTML += $("#IqOqIpv_unitprice_"+ins+"").text().replace(/,/g, '')+",";
							CSVHTML += $("#IqOqIpv_discper_"+ins+"").val().replace(/,/g, '')+",";
							CSVHTML += $("#IqOqIpv_unitsellprice_"+ins+"").text().replace(/,/g, '')+",";
							CSVHTML += $("#IqOqIpv_totalprice_"+ins+"").text().replace(/,/g, '')+",";
							CSVHTML += "\n";
						}
					} 
				}
				if(pgxintallationinstallneedValue == "None") {
					CSVHTML += "Did not select any Training method.,";
				}
				
				//SNP & CNV Service section
				if(selectpgxintallation_maintenanceObjValue != "None"){
					CSVHTML += $("#SNPserviceplan").text().replace(/,/g, '')+",";
					CSVHTML += $("#SNPserviceplanpartno").text().replace(/,/g, '')+",";
					CSVHTML += $("#SNPservice_qty_1").val().replace(/,/g, '')+",";
					CSVHTML += $("#SNPservice_unitprice_1").text().replace(/,/g, '')+",";
					CSVHTML += $("#SNPservice_discper_1").val().replace(/,/g, '')+",";
					CSVHTML += $("#SNPservice_unitsellprice_1").text().replace(/,/g, '')+",";
					CSVHTML += $("#SNPservice_totalprice_1").text().replace(/,/g, '')+",";
					CSVHTML += "\n";
				} 				
				if(selectpgxintallation_maintenanceObjValue == "None") {
					CSVHTML += "Did not select any Service plan.,";
				}
				
				if(selectpgxcnvopenarrayObjValue != "Same instrument as SNP analysis"){
					if(selectpgxcnvopenarrayObjValue != selectpgxsnpopenarrayObjValue){
						//CSVHTML += "\n";
						//CSVHTML += "\n";
						CSVHTML += selectpgxcnvopenarrayObjValue+",";
						CSVHTML += ",";
						CSVHTML += ",";
						CSVHTML += ",";
						CSVHTML += ",";
						CSVHTML += ",";
						CSVHTML += ",";
						CSVHTML += "\n";
						
						if(selectpgxcnvopenarrayObjValue == "QuantStudio 12K"){
							var start = 19;
							var end = 30;
						} else if(selectpgxcnvopenarrayObjValue == "QuantStudio 7"){
							var start = 10;
							var end = 18;
						} else if(selectpgxcnvopenarrayObjValue == "QuantStudio 6"){
							var start = 1;
							var end = 9;
						}
						for (var ins = start; ins <end; ins++ ){					
							if(pgxintallationinstallneedValue != "None"){ 						
								if( $("#IqOqIpvdesc"+ins+"").text() == ''){  }
								else {
									CSVHTML += $("#IqOqIpvdesc"+ins+"").text().replace(/,/g, '')+",";
									CSVHTML += $("#IqOqIpvpartno"+ins+"").text().replace(/,/g, '')+",";
									CSVHTML += $("#IqOqIpv_qty_"+ins+"").val().replace(/,/g, '')+",";
									CSVHTML += $("#IqOqIpv_unitprice_"+ins+"").text().replace(/,/g, '')+",";
									CSVHTML += $("#IqOqIpv_discper_"+ins+"").val().replace(/,/g, '')+",";
									CSVHTML += $("#IqOqIpv_unitsellprice_"+ins+"").text().replace(/,/g, '')+",";
									CSVHTML += $("#IqOqIpv_totalprice_"+ins+"").text().replace(/,/g, '')+",";
									CSVHTML += "\n";
									
								}
							} 
						}
						if(pgxintallationinstallneedValue == "None") {
							CSVHTML += "Did not select any Training method.,";
						}
					
						if(selectpgxintallation_maintenanceObjValue != "None"){
							CSVHTML += $("#CNVserviceplan").text().replace(/,/g, '')+",";
							CSVHTML += $("#CNVserviceplanpartno").text().replace(/,/g, '')+",";
							CSVHTML += $("#CNVservice_qty_1").val().replace(/,/g, '')+",";
							CSVHTML += $("#CNVservice_unitprice_1").text().replace(/,/g, '')+",";
							CSVHTML += $("#CNVservice_discper_1").val().replace(/,/g, '')+",";
							CSVHTML += $("#CNVservice_unitsellprice_1").text().replace(/,/g, '')+",";
							CSVHTML += $("#CNVservice_totalprice_1").text().replace(/,/g, '')+",";
							CSVHTML += "\n";
						} 				
						if(selectpgxintallation_maintenanceObjValue == "None") {
							CSVHTML += "Did not select any Service plan.,";
						}
					}
				}
				//Training section
				CSVHTML += "\n";				
				CSVHTML += "Training,";				
				CSVHTML += "\n";
				
				for (var t = 1; t <6; t++ ){
					if(selectpgxintallation_addtrainingObjValue != "None"){
						CSVHTML += $("#Training_title_"+t+"").text().replace(/,/g, '')+",";
						if(t == 1){
							CSVHTML += $("#Training_pno_"+t+"").text().replace(/,/g, '')+"-"+$("#Training_pno2_"+t+"").text().replace(/,/g, '')+",";
						} else {
							CSVHTML += $("#Training_pno_"+t+"").text().replace(/,/g, '')+",";
						}
						CSVHTML += $("#Training_qty_"+t+"").val().replace(/,/g, '')+",";
						CSVHTML += $("#Training_unitprice_"+t+"").text().replace(/,/g, '')+",";
						CSVHTML += $("#Training_discper_"+t+"").val().replace(/,/g, '')+",";
						CSVHTML += $("#Training_unitsellprice_"+t+"").text().replace(/,/g, '')+",";
						CSVHTML += $("#Training_totalprice_"+t+"").text().replace(/,/g, '')+",";
						CSVHTML += "\n";
					} 
				}
				if(selectpgxintallation_addtrainingObjValue == "None") {
					CSVHTML += "Did not select any Training method.,";
				}
			}	
				CSVHTML += "\n";
				CSVHTML += "\n";			
				
					
				/*// Customer Information
				HTML += "\n";
				HTML += "\n";
				
				var pgx_delivery_methodval = Ext.get("pgx_delivery_methodcombo").dom.value;
				pgx_delivery_methodval=(pgx_delivery_methodval=='')?"-":pgx_delivery_methodval;
				var pgx_customeby = Ext.get("pgx_customeby_id").dom.value;
				pgx_customeby=(pgx_customeby=='')?"-":pgx_customeby;
				var pgx_salesrepby = Ext.get("pgx_salesrepby_id").dom.value;
				pgx_salesrepby=(pgx_salesrepby=='')?"-":pgx_salesrepby;
				var pgx_account_number = Ext.get("pgx_account_number").dom.value;
				pgx_account_number=(pgx_account_number=='')?"-":pgx_account_number;
				var pgx_original_quote_no = Ext.get("pgx_original_quote_no").dom.value;
				pgx_original_quote_no=(pgx_original_quote_no=='')?"-":pgx_original_quote_no;
				var pgx_attention_to = Ext.get("pgx_attention_to").dom.value;
				pgx_attention_to=(pgx_attention_to=='')?"-":pgx_attention_to;
				var pgx_institution = Ext.get("pgx_institution").dom.value;
				pgx_institution=(pgx_institution=='')?"-":pgx_institution;
				var pgx_department = Ext.get("pgx_department").dom.value;
				pgx_department=(pgx_department=='')?"-":pgx_department;
				var pgx_building = Ext.get("pgx_building").dom.value;
				pgx_building=(pgx_building=='')?"-":pgx_building;
				var pgx_address = Ext.get("pgx_address").dom.value;
				pgx_address=(pgx_address=='')?"-":pgx_address;
				var pgx_city_state = Ext.get("pgx_city_state").dom.value;
				pgx_city_state=(pgx_city_state=='')?"-":pgx_city_state;
				var pgx_zipcode = Ext.get("pgx_zipcode").dom.value;
				pgx_zipcode=(pgx_zipcode=='')?"-":pgx_zipcode;
				var pgx_phone = Ext.get("pgx_phone").dom.value;
				pgx_phone=(pgx_phone=='')?"-":pgx_phone;
				var pgx_extention = Ext.get("pgx_extention").dom.value;
				pgx_extention=(pgx_extention=='')?"-":pgx_extention;
				var pgx_email = Ext.get("pgx_email").dom.value;
				pgx_email=(pgx_email=='')?"-":pgx_email;
				var pgx_fax = Ext.get("pgx_fax").dom.value;
				pgx_fax=(pgx_fax=='')?"-":pgx_fax;
				
				
				HTML += "Quote Delivery Information";
				HTML += "\n";
				HTML += "\n";
				HTML += "Delivery Method,";
				HTML += pgx_delivery_methodval+",";
				HTML += "\n";
				HTML += "Send to customer by,";
				HTML += pgx_customeby+",";
				HTML += "\n";
				HTML += "Send to sales rep by,";
				HTML += pgx_salesrepby+",";
				HTML += "\n";
				HTML += "Account number,";
				HTML += pgx_account_number+",";
				HTML += "\n";
				HTML += "Original quote number (if applicable),";
				HTML += pgx_original_quote_no+",";
				HTML += "\n";
				HTML += "Attention to,";
				HTML += pgx_attention_to+",";
				HTML += "\n";
				HTML += "Institution,";
				HTML += pgx_institution+",";
				HTML += "\n";
				HTML += "Department,";
				HTML += pgx_department+",";
				HTML += "\n";
				HTML += "Building,";
				HTML += pgx_building+",";
				HTML += "\n";
				HTML += "Address,";
				HTML += pgx_address+",";
				HTML += "\n";
				HTML += "City-State,";
				HTML += pgx_city_state+",";
				HTML += "\n";
				HTML += "Zipcode,";
				HTML += pgx_zipcode+",";
				HTML += "\n";
				HTML += "Phone,";
				HTML += pgx_phone+",";
				HTML += "\n";
				HTML += "Extention,";
				HTML += pgx_extention+",";
				HTML += "\n";
				HTML += "E-mail,";
				HTML += pgx_email+",";
				HTML += "\n";
				HTML += "Fax,";
				HTML += pgx_fax+",";
				HTML += "\n";
				
				HTML += "\n";
				HTML += "\n";*/
				
				
				// Quote Summary
				CSVHTML += "Quote Summary";
				CSVHTML += "\n";
				CSVHTML += "\n";
				CSVHTML += "DNA Extraction,";
				CSVHTML += $("#quotesummary_DNAExtraction").html().replace(/,/g, '')+","+",";
				CSVHTML += "\n";
				CSVHTML += "SNP Analysis,";
				CSVHTML += $("#quotesummary_SNP").html().replace(/,/g, '')+","+",";
				CSVHTML += "\n";
				CSVHTML += "CNV Analysis,";
				CSVHTML += $("#quotesummary_CNV").html().replace(/,/g, '')+","+",";
				CSVHTML += "\n";
				//HTML += "Software,";
				//HTML += $("#quotesummary_software1").html().replace(/,/g, '')+","+",";
				//HTML += "\n";
				if(getExperimentInfo("generateQuoteFor") == "Instruments and reagents"){
					CSVHTML += "Training,";
					CSVHTML += $("#quotesummary_training1").html().replace(/,/g, '')+","+",";
					CSVHTML += "\n";
					CSVHTML += "Service,";
					CSVHTML += $("#quotesummary_service1").html().replace(/,/g, '')+","+",";
					CSVHTML += "\n";
				}
				CSVHTML += "Total,";
				CSVHTML += $("#quotesummary_total1").html().replace(/,/g, '')+","+",";
				CSVHTML += "\n";
				CSVHTML += "Cost per sample,";
				CSVHTML += $("#quotesummary_costpersample1").html().replace(/,/g, '')+","+",";
				CSVHTML += "\n";
				CSVHTML += "\n";
				
									
			return CSVHTML ;
		},
		onComplete: function(){ //alert('Your File Has Been Saved!'); 
		},
		onCancel: function(){ //alert('You have cancelled the saving of this file.'); 
		},
		onError: function(){ //alert('You must put something in the File Contents or there will be nothing to save!'); 
		},
		swf: 'media/downloadify.swf',
		downloadImage: 'images/exportProducts.png',
		width: 127,
		height: 26,
		transparent: true,
		append: false
	});
}

function loadPGxDownloadify(){
	var blocklist = ["DNAExtraction","SNP","CNV"];
	if(getExperimentInfo("generateQuoteFor") == "Instruments and reagents"){
		var DNA = ["Instrument","Consumables","Reagents"];
	} else {
		var DNA = ["Consumables","Reagents"];
	}
	Downloadify.create('pgx_downloadify',{
		filename: function(){
			var d 	= new Date();
			var fd 	= d.getFullYear() + "_" + + (d.getMonth()+1) + "_" +  d.getDate() + "_" + d.getHours()+ "_" + d.getMinutes() + "_" + d.getSeconds();
			return "Quote_Summary_"+fd+".csv";
		},
		data: function(){ 
			CSVHTML = "";
			CSVHTML += "Instrument,";				
			CSVHTML += "Part number,";
			//CSVHTML += "Description,";
			CSVHTML += "Quantity,";
			CSVHTML += "Unit Price,";
			CSVHTML += "Volume Discount,";
			CSVHTML += "Unit Sell Price,";
			CSVHTML += "Total Sell Price";
			CSVHTML += "\n";
			for(var bi=0; bi < blocklist.length; bi++){
				
				var blockid = blocklist[bi];
				//alert(blockid);
				
				
				for (var k = 0; k < DNA.length; k++) {	
					
					if(blockid == 'DNAExtraction') {
						if(DNA[k] == 'Instrument') {
							if(getExperimentInfo("generateQuoteFor") == "Instruments and reagents"){
								var MLength = 2;
								var IdVal = 'MagMAXInstru';
								var Title = 'MagMax Instrument';  
								var JVal =0;
							}
						} else if (DNA[k] == 'Consumables') {
							var MLength = 3;
							var IdVal = 'MagMAXCons';
							var Title = 'MagMax Consumables';
							var JVal =0;
						}  else if (DNA[k] == 'Reagents') {
							var MLength = 2;
							var IdVal = 'MagMAXReag';
							var Title = 'MagMax Reagents';
							var JVal =0;
						} 
						 
					} else if (blockid == 'SNP') {
						if(DNA[k] == 'Instrument') {
							if(getExperimentInfo("generateQuoteFor") == "Instruments and reagents"){
								var MLength = 2;
								var IdVal = 'MagMAXInstru';
								var Title = 'SNP Instrument'; 
								var JVal =1;
							}
						} else if (DNA[k] == 'Consumables') {
							var pgxopenarraycalctypeobj = Ext.get("pgxsnpformatneed").dom;
							var selectpgxsnpopenarrayInstValue = pgxopenarraycalctypeobj.options[pgxopenarraycalctypeobj.selectedIndex].value;
							
							/*if(selectpgxsnpopenarrayInstValue.indexOf("OpenArray") == 0 ){
								var MLength = 3;
							} else {
								var MLength = 3;
							}*/					
							var MLength = 3;							
							var IdVal = 'MagMAXCons';
							var Title = 'SNP Consumables';
							var JVal =1;
						}  else if (DNA[k] == 'Reagents') {
							var MLength = 3;var IdVal = 'MagMAXReag';
							var Title = 'SNP Reagents';
							var JVal =1;
						} 
					}  else if (blockid == 'CNV') {
						if(DNA[k] == 'Instrument') {
							if(getExperimentInfo("generateQuoteFor") == "Instruments and reagents"){
								var MLength = 2;
								var IdVal = 'MagMAXInstru';
								var Title = 'CNV Instrument';  
								var JVal =1;
							}
						} else if (DNA[k] == 'Consumables') {
							var MLength = 2;
							var IdVal = 'MagMAXCons';
							var Title = 'CNV Consumables';
							var JVal =1;
						}  else if (DNA[k] == 'Reagents') {
							var MLength = 4;var IdVal = 'MagMAXReag';
							var Title = 'CNV Reagents';
							var JVal =1;
						} 
					}					
						
						
						CSVHTML += Title+",";
						CSVHTML += "\n";						
					
					for (var j = JVal; j < MLength; j++) {					
							CSVHTML +=  '"'+removeSpecialCharacters($("#"+blockid+"-"+IdVal+"_instrument_"+j).text())+'",';
							CSVHTML +=  '"'+$("#"+blockid+"-"+IdVal+"_partno_"+j).text()+'",';
							//CSVHTML +=  '"'+$("#"+blockid+"-"+IdVal+"_desc_"+j).text()+'",';
							CSVHTML +=  '"'+$("#"+blockid+"-"+IdVal+"_qty_"+j).val()+'",';
							CSVHTML +=  '"'+$("#"+blockid+"-"+IdVal+"_unitprice_"+j).text()+'",';
							CSVHTML +=  '"'+$("#"+blockid+"-"+IdVal+"_discper_"+j).val()+'",';
							CSVHTML +=  '"'+$("#"+blockid+"-"+IdVal+"_unitsellprice_"+j).text()+'",';
							CSVHTML +=  '"'+$("#"+blockid+"-"+IdVal+"_totalprice_"+j).text()+'"';
							CSVHTML += "\n";					
					}	
					//CSVHTML += "\n";
				}
				CSVHTML += "\n";
				//CSVHTML += "\n";
			
			}			
			
			if(getExperimentInfo("generateQuoteFor") == "Instruments and reagents"){
				// Service Plan and Training
				
				var pgxsnpopenarraycalctypeobj = Ext.get("pgxsnpopenarrayformat").dom;
				var selectpgxsnpopenarrayObjValue = pgxsnpopenarraycalctypeobj.options[pgxsnpopenarraycalctypeobj.selectedIndex].value;	
				
				var pgxcnvopenarraycalctypeobj = Ext.get("pgxcnainstruments").dom;
				var selectpgxcnvopenarrayObjValue = pgxcnvopenarraycalctypeobj.options[pgxcnvopenarraycalctypeobj.selectedIndex].value;	
				
				var pgxintallation_maintenanceobj = Ext.get("pgxintallation_maintenance").dom;
				var selectpgxintallation_maintenanceObjValue = pgxintallation_maintenanceobj.options[pgxintallation_maintenanceobj.selectedIndex].value;
				
				var pgxintallation_addtrainingobj = Ext.get("pgxintallation_addtraining").dom;
				var selectpgxintallation_addtrainingObjValue = pgxintallation_addtrainingobj.options[pgxintallation_addtrainingobj.selectedIndex].value;
				
				var pgxintallationinstallneedobj = Ext.get("pgxintallation_installneed").dom;
				var pgxintallationinstallneedValue = pgxintallationinstallneedobj.options[pgxintallationinstallneedobj.selectedIndex].value;
	
				/*if(selectpgxcnvopenarrayObjValue == "Same instrument as SNP analysis" ){
					selectpgxcnvopenarrayObjValue = selectpgxsnpopenarrayObjValue;
				}*/
				if(selectpgxintallation_maintenanceObjValue == "None"){
					var SNPServiceMsg = "Did not select any Service plan";
					var CNVServiceMsg = "Did not select any Service plan";
				}
				if(selectpgxintallation_addtrainingObjValue == "None"){
					var SNPTrainingMsg = "Did not select any Training method";
					var CNVTrainingMsg = "Did not select any Training method";
				}
	
				CSVHTML += "Service Plan and Training,";
				CSVHTML += "\n";				
				CSVHTML += selectpgxsnpopenarrayObjValue+",";
				CSVHTML += "Part number,";
				CSVHTML += "Qty,";
				CSVHTML += "Unit List Price,";
				CSVHTML += "% discount,";
				CSVHTML += "Unit Sell Price,";
				CSVHTML += "Total Sell Price,";
				CSVHTML += "\n";
				
				//Installation Instrument section
				if(selectpgxsnpopenarrayObjValue == "QuantStudio 12K"){
					var start = 19;
					var end = 30;
				} else if(selectpgxsnpopenarrayObjValue == "QuantStudio 7"){
					var start = 10;
					var end = 18;
				} else if(selectpgxsnpopenarrayObjValue == "QuantStudio 6"){
					var start = 1;
					var end = 9;
				}
				for (var ins = start; ins <end; ins++ ){					
					if(pgxintallationinstallneedValue != "None"){ 						
						if( $("#IqOqIpvdesc"+ins+"").text() == ''){  }
						else {
							CSVHTML += $("#IqOqIpvdesc"+ins+"").text().replace(/,/g, '')+",";
							CSVHTML += $("#IqOqIpvpartno"+ins+"").text().replace(/,/g, '')+",";
							CSVHTML += $("#IqOqIpv_qty_"+ins+"").val().replace(/,/g, '')+",";
							CSVHTML += $("#IqOqIpv_unitprice_"+ins+"").text().replace(/,/g, '')+",";
							CSVHTML += $("#IqOqIpv_discper_"+ins+"").val().replace(/,/g, '')+",";
							CSVHTML += $("#IqOqIpv_unitsellprice_"+ins+"").text().replace(/,/g, '')+",";
							CSVHTML += $("#IqOqIpv_totalprice_"+ins+"").text().replace(/,/g, '')+",";
							CSVHTML += "\n";
						}
					} 
				}
				if(pgxintallationinstallneedValue == "None") {
					CSVHTML += "Did not select any Training method.,";
				}
				
				//SNP & CNV Service section
				if(selectpgxintallation_maintenanceObjValue != "None"){
					CSVHTML += $("#SNPserviceplan").text().replace(/,/g, '')+",";
					CSVHTML += $("#SNPserviceplanpartno").text().replace(/,/g, '')+",";
					CSVHTML += $("#SNPservice_qty_1").val().replace(/,/g, '')+",";
					CSVHTML += $("#SNPservice_unitprice_1").text().replace(/,/g, '')+",";
					CSVHTML += $("#SNPservice_discper_1").val().replace(/,/g, '')+",";
					CSVHTML += $("#SNPservice_unitsellprice_1").text().replace(/,/g, '')+",";
					CSVHTML += $("#SNPservice_totalprice_1").text().replace(/,/g, '')+",";
					CSVHTML += "\n";
				} 				
				if(selectpgxintallation_maintenanceObjValue == "None") {
					CSVHTML += "Did not select any Service plan.,";
				}
				
				if(selectpgxcnvopenarrayObjValue != "Same instrument as SNP analysis"){
					if(selectpgxcnvopenarrayObjValue != selectpgxsnpopenarrayObjValue){
						//CSVHTML += "\n";
						//CSVHTML += "\n";
						CSVHTML += selectpgxcnvopenarrayObjValue+",";
						CSVHTML += ",";
						CSVHTML += ",";
						CSVHTML += ",";
						CSVHTML += ",";
						CSVHTML += ",";
						CSVHTML += ",";
						CSVHTML += "\n";
						
						if(selectpgxcnvopenarrayObjValue == "QuantStudio 12K"){
							var start = 19;
							var end = 30;
						} else if(selectpgxcnvopenarrayObjValue == "QuantStudio 7"){
							var start = 10;
							var end = 18;
						} else if(selectpgxcnvopenarrayObjValue == "QuantStudio 6"){
							var start = 1;
							var end = 9;
						}
						for (var ins = start; ins <end; ins++ ){					
							if(pgxintallationinstallneedValue != "None"){ 						
								if( $("#IqOqIpvdesc"+ins+"").text() == ''){  }
								else {
									CSVHTML += $("#IqOqIpvdesc"+ins+"").text().replace(/,/g, '')+",";
									CSVHTML += $("#IqOqIpvpartno"+ins+"").text().replace(/,/g, '')+",";
									CSVHTML += $("#IqOqIpv_qty_"+ins+"").val().replace(/,/g, '')+",";
									CSVHTML += $("#IqOqIpv_unitprice_"+ins+"").text().replace(/,/g, '')+",";
									CSVHTML += $("#IqOqIpv_discper_"+ins+"").val().replace(/,/g, '')+",";
									CSVHTML += $("#IqOqIpv_unitsellprice_"+ins+"").text().replace(/,/g, '')+",";
									CSVHTML += $("#IqOqIpv_totalprice_"+ins+"").text().replace(/,/g, '')+",";
									CSVHTML += "\n";
									
								}
							} 
						}
						if(pgxintallationinstallneedValue == "None") {
							CSVHTML += "Did not select any Training method.,";
						}
					
						if(selectpgxintallation_maintenanceObjValue != "None"){
							CSVHTML += $("#CNVserviceplan").text().replace(/,/g, '')+",";
							CSVHTML += $("#CNVserviceplanpartno").text().replace(/,/g, '')+",";
							CSVHTML += $("#CNVservice_qty_1").val().replace(/,/g, '')+",";
							CSVHTML += $("#CNVservice_unitprice_1").text().replace(/,/g, '')+",";
							CSVHTML += $("#CNVservice_discper_1").val().replace(/,/g, '')+",";
							CSVHTML += $("#CNVservice_unitsellprice_1").text().replace(/,/g, '')+",";
							CSVHTML += $("#CNVservice_totalprice_1").text().replace(/,/g, '')+",";
							CSVHTML += "\n";
						} 				
						if(selectpgxintallation_maintenanceObjValue == "None") {
							CSVHTML += "Did not select any Service plan.,";
						}
					}
				}
				//Training section
				CSVHTML += "\n";				
				CSVHTML += "Training,";				
				CSVHTML += "\n";
				
				for (var t = 1; t <6; t++ ){
					if(selectpgxintallation_addtrainingObjValue != "None"){
						CSVHTML += $("#Training_title_"+t+"").text().replace(/,/g, '')+",";
						if(t == 1){
							CSVHTML += $("#Training_pno_"+t+"").text().replace(/,/g, '')+"-"+$("#Training_pno2_"+t+"").text().replace(/,/g, '')+",";
						} else {
							CSVHTML += $("#Training_pno_"+t+"").text().replace(/,/g, '')+",";
						}
						CSVHTML += $("#Training_qty_"+t+"").val().replace(/,/g, '')+",";
						CSVHTML += $("#Training_unitprice_"+t+"").text().replace(/,/g, '')+",";
						CSVHTML += $("#Training_discper_"+t+"").val().replace(/,/g, '')+",";
						CSVHTML += $("#Training_unitsellprice_"+t+"").text().replace(/,/g, '')+",";
						CSVHTML += $("#Training_totalprice_"+t+"").text().replace(/,/g, '')+",";
						CSVHTML += "\n";
					} 
				}
				if(selectpgxintallation_addtrainingObjValue == "None") {
					CSVHTML += "Did not select any Training method.,";
				}
			}	
				CSVHTML += "\n";
				CSVHTML += "\n";			
				
					
				/*// Customer Information
				CSVHTML += "\n";
				CSVHTML += "\n";
				
				var pgx_delivery_methodval = Ext.get("pgx_delivery_methodcombo").dom.value;
				pgx_delivery_methodval=(pgx_delivery_methodval=='')?"-":pgx_delivery_methodval;
				var pgx_customeby = Ext.get("pgx_customeby_id").dom.value;
				pgx_customeby=(pgx_customeby=='')?"-":pgx_customeby;
				var pgx_salesrepby = Ext.get("pgx_salesrepby_id").dom.value;
				pgx_salesrepby=(pgx_salesrepby=='')?"-":pgx_salesrepby;
				var pgx_account_number = Ext.get("pgx_account_number").dom.value;
				pgx_account_number=(pgx_account_number=='')?"-":pgx_account_number;
				var pgx_original_quote_no = Ext.get("pgx_original_quote_no").dom.value;
				pgx_original_quote_no=(pgx_original_quote_no=='')?"-":pgx_original_quote_no;
				var pgx_attention_to = Ext.get("pgx_attention_to").dom.value;
				pgx_attention_to=(pgx_attention_to=='')?"-":pgx_attention_to;
				var pgx_institution = Ext.get("pgx_institution").dom.value;
				pgx_institution=(pgx_institution=='')?"-":pgx_institution;
				var pgx_department = Ext.get("pgx_department").dom.value;
				pgx_department=(pgx_department=='')?"-":pgx_department;
				var pgx_building = Ext.get("pgx_building").dom.value;
				pgx_building=(pgx_building=='')?"-":pgx_building;
				var pgx_address = Ext.get("pgx_address").dom.value;
				pgx_address=(pgx_address=='')?"-":pgx_address;
				var pgx_city_state = Ext.get("pgx_city_state").dom.value;
				pgx_city_state=(pgx_city_state=='')?"-":pgx_city_state;
				var pgx_zipcode = Ext.get("pgx_zipcode").dom.value;
				pgx_zipcode=(pgx_zipcode=='')?"-":pgx_zipcode;
				var pgx_phone = Ext.get("pgx_phone").dom.value;
				pgx_phone=(pgx_phone=='')?"-":pgx_phone;
				var pgx_extention = Ext.get("pgx_extention").dom.value;
				pgx_extention=(pgx_extention=='')?"-":pgx_extention;
				var pgx_email = Ext.get("pgx_email").dom.value;
				pgx_email=(pgx_email=='')?"-":pgx_email;
				var pgx_fax = Ext.get("pgx_fax").dom.value;
				pgx_fax=(pgx_fax=='')?"-":pgx_fax;
				
				
				HTML += "Quote Delivery Information";
				HTML += "\n";
				HTML += "\n";
				HTML += "Delivery Method,";
				HTML += pgx_delivery_methodval+",";
				HTML += "\n";
				HTML += "Send to customer by,";
				HTML += pgx_customeby+",";
				HTML += "\n";
				HTML += "Send to sales rep by,";
				HTML += pgx_salesrepby+",";
				HTML += "\n";
				HTML += "Account number,";
				HTML += pgx_account_number+",";
				HTML += "\n";
				HTML += "Original quote number (if applicable),";
				HTML += pgx_original_quote_no+",";
				HTML += "\n";
				HTML += "Attention to,";
				HTML += pgx_attention_to+",";
				HTML += "\n";
				HTML += "Institution,";
				HTML += pgx_institution+",";
				HTML += "\n";
				HTML += "Department,";
				HTML += pgx_department+",";
				HTML += "\n";
				HTML += "Building,";
				HTML += pgx_building+",";
				HTML += "\n";
				HTML += "Address,";
				HTML += pgx_address+",";
				HTML += "\n";
				HTML += "City-State,";
				HTML += pgx_city_state+",";
				HTML += "\n";
				HTML += "Zipcode,";
				HTML += pgx_zipcode+",";
				HTML += "\n";
				HTML += "Phone,";
				HTML += pgx_phone+",";
				HTML += "\n";
				HTML += "Extention,";
				HTML += pgx_extention+",";
				HTML += "\n";
				HTML += "E-mail,";
				HTML += pgx_email+",";
				HTML += "\n";
				HTML += "Fax,";
				HTML += pgx_fax+",";
				HTML += "\n";
				
				HTML += "\n";
				HTML += "\n";*/
				
				
				// Quote Summary
				CSVHTML += "Quote Summary";
				CSVHTML += "\n";
				CSVHTML += "\n";
				CSVHTML += "DNA Extraction,";
				CSVHTML += $("#quotesummary_DNAExtraction").html().replace(/,/g, '')+","+",";
				CSVHTML += "\n";
				CSVHTML += "SNP Analysis,";
				CSVHTML += $("#quotesummary_SNP").html().replace(/,/g, '')+","+",";
				CSVHTML += "\n";
				CSVHTML += "CNV Analysis,";
				CSVHTML += $("#quotesummary_CNV").html().replace(/,/g, '')+","+",";
				CSVHTML += "\n";
				//CSVHTML += "Software,";
				//CSVHTML += $("#quotesummary_software1").html().replace(/,/g, '')+","+",";
				//CSVHTML += "\n";
				if(getExperimentInfo("generateQuoteFor") == "Instruments and reagents"){
					CSVHTML += "Training,";
					CSVHTML += $("#quotesummary_training1").html().replace(/,/g, '')+","+",";
					CSVHTML += "\n";
					CSVHTML += "Service,";
					CSVHTML += $("#quotesummary_service1").html().replace(/,/g, '')+","+",";
					CSVHTML += "\n";
				}
				CSVHTML += "Total,";
				CSVHTML += $("#quotesummary_total1").html().replace(/,/g, '')+","+",";
				CSVHTML += "\n";
				CSVHTML += "Cost per sample,";
				CSVHTML += $("#quotesummary_costpersample1").html().replace(/,/g, '')+","+",";
				CSVHTML += "\n";
				CSVHTML += "\n";
				
									
			return CSVHTML ;
		},
		onComplete: function(){ //alert('Your File Has Been Saved!'); 
		},
		onCancel: function(){ //alert('You have cancelled the saving of this file.'); 
		},
		onError: function(){ //alert('You must put something in the File Contents or there will be nothing to save!'); 
		},
		swf: 'media/downloadify.swf',
		downloadImage: 'images/exportProducts.png',
		width: 127,
		height: 26,
		transparent: true,
		append: false
	});
}

Ext.onReady(function () {
	if(!Development){
		Ext.Ajax.request({
			url: 'content.php?ContentType=header',
			success: function (response, opts) {
				//document.getElementById('header-content').innerHTML = response.responseText
			},
			failure: function (response, opts) {
				console.log('server-side failure with status code ' + response.status);
			}
		});
		Ext.Ajax.request({
			url: 'content.php?ContentType=footer',
			success: function (response, opts) {
				//document.getElementById('footer-content').innerHTML = response.responseText
			},
			failure: function (response, opts) {
				console.log('server-side failure with status code ' + response.status);
			}
		});
		//createDateField();
	}
	
})
function isValidIstrumrntsforPGX(){
	var pgxcnainstrumentsneedtouseobj = Ext.get("pgxcnainstrumentsneedtouse").dom;
	var selectpgxcnainstObjValue = pgxcnainstrumentsneedtouseobj.options[pgxcnainstrumentsneedtouseobj.selectedIndex].value;

	var pgxopenarraycalctypeobj = Ext.get("pgxsnpformatneed").dom;
	var selectpgxsnpopenarrayInstValue = pgxopenarraycalctypeobj.options[pgxopenarraycalctypeobj.selectedIndex].value;
	
	var pgxsamples = Ext.get('no_of_pgxsamples').dom.value;
	var no_of_reagentsmonths = Ext.get('no_of_reagentsmonths').dom.value;
	var pgxsnpsample = Ext.get('pgxsnpsample').dom.value;
	var pgxcnasample = Ext.get('pgxcnasample').dom.value;
	
	/*if((selectpgxcnainstObjValue === "Same block as SNP analysis" )
			&&(selectpgxsnpopenarrayInstValue.indexOf("OpenArray") === 0 || selectpgxsnpopenarrayInstValue === "Low Density Array" ) ){
			return false;*/
			
	if(no_of_reagentsmonths == 0 || no_of_reagentsmonths == '' || (isNaN(no_of_reagentsmonths))){
		return "Either invalid sample value or empty value in Experimental information section";
	}
	
	if(selectpgxsnpopenarrayInstValue.indexOf("OpenArray") == -1){
		if(pgxsnpsample == 0 || pgxsnpsample == '' || (isNaN(pgxsnpsample))){
			return "Invalid SNP sample value";
		}
	}	
	if(pgxcnasample == 0 || pgxcnasample == '' || (isNaN(pgxcnasample))){
		return "Invalid CNA sample value";
	}
	if(selectpgxsnpopenarrayInstValue.indexOf("OpenArray") === 0 && selectpgxcnainstObjValue === "Same block as SNP analysis" ){
		//return false;
		return "Please change the format in CNV section.";
	}else {
		return true;	
	}
	
	
	return true;
}
function createDateField(){
	Ext.create('Ext.form.DateField', {
        id:'pgx_customeby_date',
        format: 'm/d/Y',
        renderTo:'pgx_customeby_datediv'
    });
}
window.onload = function () {
    /*Ext.get("documentloaded").fadeOut({
		callback: Ext.get("documentloaded").removeCls('windowlaoding')
	});*/
	
    Ext.get("documentloaded").removeCls('windowlaoding');
	
};

function checkSNPformat(){
	var pgxopenarraycalctypeobj = Ext.get("pgxsnpformatneed").dom;
	var selectpgxsnpopenarrayInstValue = pgxopenarraycalctypeobj.options[pgxopenarraycalctypeobj.selectedIndex].value;
	
	if(selectpgxsnpopenarrayInstValue.indexOf("OpenArray") == 0 ){	
		//$("#pgxsnpsampletr").show();
		 $('[name=pgxcnainstrumentsneedtouse]').val('384-well');
		 $("#assaytype").hide();
	} else {
		 $("#assaytype").show();
		$("#pgxsnpsampletr").show();
		alert("Change format in CNV section");
	}
	var pgxcnainstrumentsobj = Ext.get("pgxcnainstruments").dom;
	var pgxcnainstrumentsValue = pgxcnainstrumentsobj.options[pgxcnainstrumentsobj.selectedIndex].value;
	if(pgxcnainstrumentsValue.indexOf("Same") == 0 ){	
		Ext.get('pgxcnanoofinstruments').dom.value = Ext.get('pgxsnpqsoavalue').dom.value;
		 $("#howmanysnpinstneed").html('How many instruments or blocks do you need?');
	} else {
		$("#howmanysnpinstneed").html('How many instruments do you need?');
		Ext.get('pgxcnanoofinstruments').dom.value = Ext.get('recommended_cnvpgxinstruments').dom.value;
	}
}
function techBoth(){
	updateExperimentInfo("technology", "Both");
	var stdmedthod = $( "#standardmeth" ).hasClass( "tbuttonselected" );
	var selectObj = $( "#ext-gen1015" ).hasClass( "tbuttonselected" );
	var selectObj1 = $( "#ext-gen1016" ).hasClass( "tbuttonselected" );
	Ext.get('techboth').addCls('tbuttonselected');
	Ext.get('techrealtimepcr').removeCls('tbuttonselected');
	Ext.get('techdigitalpcr').removeCls('tbuttonselected');	
	Ext.get('QS3D').removeCls('hidden');
	Ext.get('QS3D').addCls('visible');
	if(selectObj || selectObj1){
		//Ext.get('ntcycler').addCls('hidden');
		Ext.get('7300').addCls('hidden');
		Ext.get('7000').addCls('hidden');			
		//Ext.get('ntcycler').removeCls('visible');
		Ext.get('7300').removeCls('visible');
		Ext.get('7000').removeCls('visible');			
	} else {
		if(stdmedthod){	
			Ext.get('anyinstrument').addCls('visible');		
			Ext.get('quantstudio').addCls('visible');
			Ext.get('7900ht').addCls('visible');		
			Ext.get('7500').addCls('visible');
			Ext.get('steponeplus').addCls('visible');
			Ext.get('viia7').addCls('visible');
			//Ext.get('ntcycler').addCls('visible');
			Ext.get('7300').addCls('visible');
			Ext.get('7000').addCls('visible');
			Ext.get('QS6').addCls('visible');
			Ext.get('QS7').addCls('visible');
			Ext.get('QS3').addCls('visible');
			Ext.get('QS5').addCls('visible');
			Ext.get('QS3D').addCls('visible');
			Ext.get('other').addCls('visible');
					
			Ext.get('anyinstrument').removeCls('hidden');
			Ext.get('quantstudio').removeCls('hidden');
			Ext.get('7900ht').removeCls('hidden');		
			Ext.get('7500').removeCls('hidden');
			Ext.get('steponeplus').removeCls('hidden');
			Ext.get('viia7').removeCls('hidden');
			//Ext.get('ntcycler').removeCls('hidden');
			Ext.get('7300').removeCls('hidden');
			Ext.get('7000').removeCls('hidden');
			Ext.get('QS6').removeCls('hidden');
			Ext.get('QS7').removeCls('hidden');
			Ext.get('QS3').removeCls('hidden');
			Ext.get('QS5').removeCls('hidden');
			Ext.get('QS3D').removeCls('hidden');
			Ext.get('other').removeCls('hidden');
		} else {
			Ext.get('anyinstrument').addCls('visible');		
			Ext.get('quantstudio').addCls('visible');
			Ext.get('7900ht').addCls('visible');		
			Ext.get('7500fast').addCls('visible');
			Ext.get('steponeplus').addCls('visible');
			Ext.get('viia7').addCls('visible');
			//Ext.get('ntcycler').addCls('hidden');
			Ext.get('7300').addCls('hidden').removeCls('visible');
			Ext.get('7000').addCls('hidden').removeCls('visible');
			Ext.get('QS6').addCls('visible');
			Ext.get('QS7').addCls('visible');
			Ext.get('QS3').addCls('visible');
			Ext.get('QS5').addCls('visible');
			Ext.get('QS3D').addCls('visible');
			Ext.get('other').addCls('visible');
					
			Ext.get('anyinstrument').removeCls('hidden');
			Ext.get('quantstudio').removeCls('hidden');
			Ext.get('7900ht').removeCls('hidden');		
			Ext.get('7500fast').removeCls('hidden');
			Ext.get('steponeplus').removeCls('hidden');
			Ext.get('viia7').removeCls('hidden');
			//Ext.get('ntcycler').removeCls('visible');
			Ext.get('7300').removeCls('visible');
			Ext.get('7000').removeCls('visible');
			Ext.get('QS6').removeCls('hidden');
			Ext.get('QS7').removeCls('hidden');
			Ext.get('QS3').removeCls('hidden');
			Ext.get('QS5').removeCls('hidden');
			Ext.get('QS3D').removeCls('hidden');
			Ext.get('other').removeCls('hidden');
		}
	}
}
function techRealTimePCR(){
	updateExperimentInfo("technology", "RealTimePCR");
	var stdmedthod = $( "#standardmeth" ).hasClass( "tbuttonselected" );
	var GeneExpSelected = $( "#ext-gen1012" ).hasClass( "tbuttonselected" );
	var miRNASelected = $( "#ext-gen1013" ).hasClass( "tbuttonselected" );
	var GenotypeSelected = $( "#ext-gen1014" ).hasClass( "tbuttonselected" );
	var CNVselected = $( "#ext-gen1015" ).hasClass( "tbuttonselected" );
	var Mutationselected = $( "#ext-gen1016" ).hasClass( "tbuttonselected" );
	var well96selected = $( "#well96" ).hasClass( "tbuttonselected" );
	var well384selected = $( "#well384" ).hasClass( "tbuttonselected" );
	 
	Ext.get('techrealtimepcr').addCls('tbuttonselected');
	Ext.get('techboth').removeCls('tbuttonselected');
	Ext.get('techdigitalpcr').removeCls('tbuttonselected');
	Ext.get('QS3D').addCls('hidden');
	Ext.get('QS3D').removeCls('visible');
	if(GenotypeSelected && well384selected){
		Ext.get('7500').addCls('hidden');
		Ext.get('steponeplus').addCls('hidden');
		Ext.get('7300').addCls('hidden').removeCls('visible');
		Ext.get('7000').addCls('hidden').removeCls('visible');
	}
	
	if(miRNASelected || Mutationselected){ 
		//Ext.get('ntcycler').addCls('hidden');
		Ext.get('7300').addCls('hidden').removeCls('visible');
		Ext.get('7000').addCls('hidden').removeCls('visible');
		Ext.get('QS3D').addCls('hidden');
	} else if(CNVselected && (well96selected || well384selected)){
		Ext.get('7500').addCls('visible');
		//Ext.get('ntcycler').addCls('hidden');
		Ext.get('7300').addCls('hidden').removeCls('visible');
		Ext.get('7000').addCls('hidden').removeCls('visible');
		Ext.get('QS3D').addCls('hidden');
	} else{
		if(GeneExpSelected && stdmedthod){ 
			Ext.get('anyinstrument').addCls('visible');		
			Ext.get('quantstudio').addCls('visible');
			Ext.get('7900ht').addCls('visible');		
			Ext.get('7500').addCls('visible');
			Ext.get('steponeplus').addCls('visible');
			Ext.get('viia7').addCls('visible');
			//Ext.get('ntcycler').addCls('visible');
			Ext.get('7300').addCls('visible');
			Ext.get('7000').addCls('visible');
			Ext.get('QS6').addCls('visible');
			Ext.get('QS7').addCls('visible');
			Ext.get('QS3').addCls('visible');
			Ext.get('QS5').addCls('visible');
			Ext.get('QS3D').addCls('hidden');
			Ext.get('other').addCls('visible');
					
			Ext.get('anyinstrument').removeCls('hidden');
			Ext.get('quantstudio').removeCls('hidden');
			Ext.get('7900ht').removeCls('hidden');		
			Ext.get('7500').removeCls('hidden');
			Ext.get('steponeplus').removeCls('hidden');
			Ext.get('viia7').removeCls('hidden');
			//Ext.get('ntcycler').removeCls('hidden');
			Ext.get('7300').removeCls('hidden');
			Ext.get('7000').removeCls('hidden');
			Ext.get('QS6').removeCls('hidden');
			Ext.get('QS7').removeCls('hidden');
			Ext.get('QS3').removeCls('hidden');
			Ext.get('QS5').removeCls('hidden');
			Ext.get('QS3D').removeCls('visible');
			Ext.get('other').removeCls('hidden');
		} else {
			Ext.get('anyinstrument').addCls('visible');		
			Ext.get('quantstudio').addCls('visible');
			Ext.get('7900ht').addCls('visible');		
			Ext.get('7500').addCls('hidden');
			Ext.get('steponeplus').addCls('visible');
			Ext.get('viia7').addCls('visible');
			//Ext.get('ntcycler').addCls('hidden');
			Ext.get('7300').addCls('hidden').removeCls('visible');
			Ext.get('7000').addCls('hidden').removeCls('visible');
			Ext.get('QS6').addCls('visible');
			Ext.get('QS7').addCls('visible');
			Ext.get('QS3').addCls('visible');
			Ext.get('QS5').addCls('visible');
			Ext.get('QS3D').addCls('hidden');
			Ext.get('other').addCls('visible');
					
			Ext.get('anyinstrument').removeCls('hidden');
			Ext.get('quantstudio').removeCls('hidden');
			Ext.get('7900ht').removeCls('hidden');		
			Ext.get('7500').removeCls('visible');
			Ext.get('steponeplus').removeCls('hidden');
			Ext.get('viia7').removeCls('hidden');
			//Ext.get('ntcycler').removeCls('visible');
			Ext.get('7300').removeCls('visible');
			Ext.get('7000').removeCls('visible');
			Ext.get('QS6').removeCls('hidden');
			Ext.get('QS7').removeCls('hidden');
			Ext.get('QS3').removeCls('hidden');
			Ext.get('QS5').removeCls('hidden');
			Ext.get('QS3D').removeCls('visible');
			Ext.get('other').removeCls('hidden');
		}
	}
}

function techDigitalPCR(){
	updateExperimentInfo("technology", "DigitalPCR");
	resetTbutton("openarrayinstrumentselector", "QS3D");
	Ext.get('techdigitalpcr').addCls('tbuttonselected');
	Ext.get('techboth').removeCls('tbuttonselected');
	Ext.get('techrealtimepcr').removeCls('tbuttonselected');  
	
	Ext.get('anyinstrument').addCls('hidden');		
	Ext.get('quantstudio').addCls('hidden');
	Ext.get('7900ht').addCls('hidden');
	Ext.get('7500fast').addCls('hidden');
	Ext.get('7500').addCls('hidden');
	Ext.get('steponeplus').addCls('hidden');
	Ext.get('viia7').addCls('hidden');
	//Ext.get('ntcycler').addCls('hidden');
	Ext.get('7300').addCls('hidden').removeCls('visible');
	Ext.get('7000').addCls('hidden').removeCls('visible');
	Ext.get('QS6').addCls('hidden');
	Ext.get('QS7').addCls('hidden');
	Ext.get('QS3').addCls('hidden');
	Ext.get('QS5').addCls('hidden');
	Ext.get('QS3D').addCls('visible');
	Ext.get('QS3D').addCls('tbuttonselected');
	Ext.get('other').addCls('hidden');
			
	Ext.get('anyinstrument').removeCls('visible');
	Ext.get('quantstudio').removeCls('visible');
	Ext.get('7900ht').removeCls('visible');
	Ext.get('7500fast').removeCls('visible');
	Ext.get('7500').removeCls('visible');
	Ext.get('steponeplus').removeCls('visible');
	Ext.get('viia7').removeCls('visible');
	//Ext.get('ntcycler').removeCls('visible');
	Ext.get('7300').removeCls('visible');
	Ext.get('7000').removeCls('visible');
	Ext.get('QS6').removeCls('visible');
	Ext.get('QS7').removeCls('visible');
	Ext.get('QS3').removeCls('visible');
	Ext.get('QS5').removeCls('visible');
	Ext.get('QS3D').removeCls('hidden');
	Ext.get('other').removeCls('visible');
}

if (typeof String.prototype.startsWith != 'function') {
	String.prototype.startsWith = function (str){
		return this.slice(0, str.length) == str;
	};
}

function toUpdateCSPRoSpinner(){
	var invAssayVal =  Number(Ext.get('no_of_INVtargets1').dom.value); 
	//var cusMtoAssayVal =  Number(Ext.get('no_of_CUSMOtargets1').dom.value); Madhu asked to remove this on 06-10-2015
	var totTarget = invAssayVal + cusMtoAssayVal;
	
	//updateExperimentInfo("noofcsptargets", cusMtoAssayVal); Madhu asked to remove this on 06-10-2015
	updateExperimentInfo("noofinvptargets", invAssayVal);
	updateExperimentInfo("nooftargets", totTarget);
	
	processCustomPlating();
}

function quoteForReagent(){
	loadPGxDownloadify1();
	loadPGxDownloadify();
	var generateQuoteFor = $('input[name=generateQuoteFor]:radio:checked').val();
	updateExperimentInfo("generateQuoteFor", generateQuoteFor); 
	if(getExperimentInfo("generateQuoteFor") == "Reagents only"){
		Ext.get('dnaExtDiv').addCls('hidden');
		Ext.get('dnaExtDiv').removeCls('visible');
		Ext.get('snpInstTr').addCls('hidden');
		Ext.get('snpInstTr').removeCls('visible');
		Ext.get('snpAccfilInstTr').addCls('hidden');
		Ext.get('snpAccfilInstTr').removeCls('visible');
		Ext.get('snpEstimatInstDiv').addCls('hidden');
		Ext.get('snpEstimatInstDiv').removeCls('visible');
		Ext.get('cnvInstTr').addCls('hidden');
		Ext.get('cnvInstTr').removeCls('visible');
		Ext.get('cnvEstimateInstDiv').addCls('hidden');
		Ext.get('cnvEstimateInstDiv').removeCls('visible');
		Ext.get('installationTrainingInputDiv').addCls('hidden');
		Ext.get('installationTrainingInputDiv').removeCls('visible');
		Ext.get('seriveTrainingDiv').addCls('hidden');
		Ext.get('seriveTrainingDiv').removeCls('visible');
		Ext.get('InstallationTrainingDiv').addCls('hidden');
		Ext.get('InstallationTrainingDiv').removeCls('visible');
		Ext.get('quotesummServiceTr').addCls('hidden');
		Ext.get('quotesummServiceTr').removeCls('visible');
		Ext.get('quotesummTrainingTr').addCls('hidden');
		Ext.get('quotesummTrainingTr').removeCls('visible');
	} else{
		Ext.get('dnaExtDiv').addCls('visible');
		Ext.get('dnaExtDiv').removeCls('hidden');
		//Ext.get('snpInstTr').addCls('visible');
		Ext.get('snpInstTr').removeCls('hidden');
		//Ext.get('snpAccfilInstTr').addCls('visible');
		Ext.get('snpAccfilInstTr').removeCls('hidden');
		Ext.get('snpEstimatInstDiv').addCls('visible');
		Ext.get('snpEstimatInstDiv').removeCls('hidden');
		//Ext.get('cnvInstTr').addCls('visible');
		Ext.get('cnvInstTr').removeCls('hidden');
		Ext.get('cnvEstimateInstDiv').addCls('visible');
		Ext.get('cnvEstimateInstDiv').removeCls('hidden');
		Ext.get('installationTrainingInputDiv').addCls('visible');
		Ext.get('installationTrainingInputDiv').removeCls('hidden');
		Ext.get('seriveTrainingDiv').addCls('visible');
		Ext.get('seriveTrainingDiv').removeCls('hidden');
		Ext.get('InstallationTrainingDiv').addCls('visible');
		Ext.get('InstallationTrainingDiv').removeCls('hidden');
		//Ext.get('quotesummServiceTr').addCls('visible');
		Ext.get('quotesummServiceTr').removeCls('hidden');
		//Ext.get('quotesummTrainingTr').addCls('visible');
		Ext.get('quotesummTrainingTr').removeCls('hidden');
	}
}
