/* Event Functions */

 

var searcharray=new Array(
					'Silicone Resuscitators','Raos Silicone Resuscitators','Raos Silicone Resuscitators - Adult','Raos Silicone Resuscitators - Large Child','Raos Silicone Resuscitators - Child','Raos Silicone Resuscitators - Infant','Silicone Resuscitators - Accessories & Spares','Raos Reservoir Valve','Corrugated Breathing Tube with Mounts','Raos Reservoir Bag Large','Raos Reservoir Bag Small','Valve Type “L” without Blow Off','Valve Type “L” with Blow Off','Raos Mouth to Mouth Resuscitator',
					'5001','5002','5003','5004','5028','8113','5031','5032','9283','9282',


					'Natural Rubber Resuscitators','E Valve','Circular Paedi All Black Facemask','Corrugated Breathing Tube with Mounts','Natural Rubber Resuscitators - Accessories & Spares','Paedi Valve','Sanjivani Resuscitators','Sanjivani Resuscitators - Adult','Sanjivani Resuscitators - Child','Sanjivani Resuscitators - Paediatric','Snuggy All Black Facemask',
				'5201','5202','5203','8008','8011','8104','8350','8351','8352','8354','8355','9020','9280','9281',


					'Laryngoscopes','A Fibre-Optic Laryngoscope Blade','Macintosh Fibrelite Blades English Profile ','Miller Fibrelite Blades','Fibrelite Lamp','Fibrelite Lamp Key','Trupti Fibrelite Blades Flexible Articulating Tip','Trupti Fibrelite Blades','Green System','Standard Handle','Penlite Handle','Howland Lock','Macintosh Blades American Profile','Macintosh Blades English Profile','Miller Blades','Laryngoscopes Conventional','Trupti Blades Flexible Articulating Tip','Trupti Blades','Macintosh Blades American Profile ','Macintosh Blades English Profile ','Miller Blades','Oxiport Macintosh Blades','Oxiport Miller Blades','Mac-Rao Blades','Chhota Flange Macintosh Blades','Robertshaw Blades','Wisconsin Blades','Phillips Blades','Lamp','Pouch','Howland Lock','Standard Handle','Penlite Handle','Stubby Handle','Trupti Green System Blades','Trupti Green System Blades Macintosh American Profile','Trupti Green System Blades Macintosh English Profile','Disposable Green System Blades','Disposable Green System Blades Macintosh American Profile','Disposable Green System Blades Macintosh English Profile','Disposable Green System Blades Miller Blades',
					'6001','6002','6003','6004M','6005M','6006M','6007M','6008M','6009M','6010M','6014M','6015M','6016M','6017M','6018M','6019M','6020','6020M','6021','6024','6025','6026','6027','6028','6033','6034','6035','6036','6050','6051','6052','6061','6062','6071','6072','6122M','6123M','6124M','6153','6303','6304','6506M','6507M','6508M','6509M','6516M','6517M','6522','6523','6524','6571','6584','6601','6603','6675','6705M','6706','6706M','6707','6708','6708M','6709','6709M','6710','6710M','6711M','6712M','6716','6717','6718','6719','6720','6805','6806','6808','6809','6810','6811','6812','6822','6823','6824','6722','6723','6724','6966','6968','6970','6972','6956','6957','6958','6959','6916','6917','6918','6919','6920',

					
					'Intubation Instruments','LMA Unique - Disposable','SAM (Sanjivani Airway Mask) - Disposable','Guedel Oropharyngeal Airways','Raos Silicone Rubber Airways','Guedel Black Natural Rubber Airways','Guedel airways - Disposable','Nasopharyngeal Silicone Rubber Airways','15mm Raos Tracheal Connectors set in a box','Dr. Talwalkars Fibrelite Stylet & Handle','Dr. Talwalkars Directable Stylet','Malleable Stylets','Adjustable Stop for Stylet','Dr. Talwalkars Bougie','Tube Cleaning Brushes','Magill Forceps','Tooth Protector','15mm x 22mm Double Swivel with port','15mm Modified Ayres “T”','Dr. Janak Mehtas E/T Tube Holding Band',
					'7005','7009','7015','7100','7101','7102','7103','7160','7200','7201','7202','7204','7205','7206','7207','7210','7602','7804','7805','7806','7807','7808','7809','7125G','7125D','7125E','7125F','7125H','7125I','7225A','7225C','7714A','7714B','7714C','7714D','7714E','7714F',
						
					'Anaesthesia & Ventilator Circuits','Bain Circuit','Jackson Rees Paediatric Circuit','Bain Mapleson Circuit','Anaesthesia Circuit Paediatric','Anaesthesia Circuit Adult With 2 Port Wye','Ventilator Circuit Plain Adult','Ventilator Circuit Adult With 1 Water Trap','Ventilator Circuit Adult With 2 Water Trap & Limb','Ventilator Circuit - Paediatric','Ventilator Circuit - Paediatric with 1 water trap','Ventilator Circuit - Paediatric with 2 water trap','Ventilator Circuit Neonatal with 2 water Trap','Magill Semi - Open Circuits','22mm All Plastic Disposable','22mm Plastic & Rubber Reusable','23mm Plastic & Rubber Reusable','23mm Metal & Rubber Reusable','Magill Closed Circuits','22mm All Plastic Disposable','22mm Plastic & Rubber Reusable','23mm Plastic & Rubber Reusable','23mm Metal & Rubber Reusable','Dr. P. K. Sens Weaner (Recovery T) with tubing','Flexible Catheter Mounts','With Double Swivel All Plastic Disposable (APD)','With Double Swivel Plastic & Rubber Reusable (PRR)','With Angle Mount All Plastic Disposable (APD)','With Angle Mount Plastic & Rubber Reusable (PRR)','HME Filter','Hepa Filter','Adult Moisture Trap','Port Neonatal Wye','2 Port Adult Wye','Paediatric Moisture Trap','15/22 Paediatric Angle Mount with Swivel','Spill Valve','2 Port Paediatric Wye',
					'2003','2004','2005','2006','2007','2008','2009','2009DW','2009W','2011','2011DW','2011W','2012DW','2012DW','2013','2014','2019','2026','2027','3030','7022','7024','7042','7044',

						
					'Rubber Accessories','Anatomical with Inflatable Pad','Bag Bleed Valve 8221','Breathing Bags Black','Breathing Bags Green','Circular Paedi','Clearhood','Corrugated Breathing Tubes Black Rubber (Without Mounts)','Corrugated Breathing Tubes Silicone Rubber (Without Mounts)','Head Harness','Mask Ring S.S','Raos Tube Tree 8120','Rendell Baker Soucek','Snuggy Facemask',
					'8008','8009','8010','8011','8014','8015','8016','8017','8030','8031','8032','8033','8036','8038','8039','8044','8045','8046','8052','8053','8055','8057','8059','8061','8072','8101','8102','8103','8104','8107','8110','8111','8120','8221','8300','8301','8302','8303','8304','8305','8350','8351','8352','8353','8354','8201B','8201G','8202B','8202G','8203B','8203G','8204B','8204G','8205B',

						
					'Oxygen Therapy Equipment','Amar Oxygen Regulator with Flow Gauge','BPC Flowmeter Unit','F/A (Fine Adjustment) Valve with Guage & Flowmeter','Flowmeter Unit for F/A Valve','High Concentration Mask (Disposable)','Humidifiers','Jet Ventilator for Bronchoscopy','Nebuliser Mouth Kit','Oxygen Mask - Plain (Disposable)','Oxygen Mask with % Control (Disposable)','Oxygen Mask with Nebuliser (Disposable)','Oxygen Nasal Cannula (Disposable)','Oxygen Pressure Gauge','Raos Oxygen Regulator','Raos Twin Gauge Oxygen Regulator','Spanners & Key','Twin Flowmeter Adaptor',
					'3006','3007','3008','3009','3010','3011','3012','3012','3013','3014','3015','3016','3018','3020','3021','3023','3024','3026','3027','3028','3031','3032','3037','3038','3039','3040','3050','3051','3113',

					
					'Pipeline Accessories','250kg/cm2 High Pressure, Oxygen, Dia 100mm','BPC Flowmeter','BPC Flowmeter - Brass Chrome','BPC Flowmeter - Plastic','Bpc flowmeter (X 2)','Brass elbows','Brass tees','Button cover','Direct Probes','High Pressure Tubing - 6 mm I.D.','Minimum contact gauges & Gas Failure Alarm for pipelines','Pipeline Gas Failure Alarm','Plastic covers for self sealing valves','Plastic saddles','Raos Theatre Vacuum Unit with Trolley','Raos Twin Carry Vacuum Unit with stand','Raos Vacuum Regulators','Raos Vacuum Regulators - 0 to 200mm Hg.','Raos Vacuum Regulators - 0 to 500mm Hg.','Raos Vacuum Regulators - 0 to 760mm Hg.','S Bracket','Safety Jar','Safety key plugs (Schrader type)','Schrader Self Sealing Valves & Accessories','Self sealing valves (Schrader type)','Single pipeline adaptor','Terminal Units','Twin pipeline adaptor','Vacuum units','Vacuum units - 1000ml','Vacuum units - 2000ml','Vacuum units - 4000ml','Vacuum units - 600ml',	
					'1200','1201','1202','1203','1206','1211','1220','1230','1250','1263','1300','3010','3041','3301','3302','3303','3304','3305','3306','3308','3309','3310','3311','3312','3313','3314','3315','3316','3317','3318','3319','3320','3321','3322','3323','3324','3326','3350','3450','3451','3452','3453','3460','3461','3462','3463','3726','3729','3730','3010(X2)',
	
					
					'Gas Anaesthesia Apparatus Components & Accessories','Rotameter Unit (Without Tubes)','Rotameter Tube & Bobbin','Yoke - Economy Model','Yoke - Compact Model','Yoke - Midget','Change Over Unit','Emergency Oxygen Unit','Non Return Valve Assembly','O2Failure Alarm - for Gas Anaesthesia Apparatus','Goldman Halothane Vaporizer - w/o stand','Raos Preset Regulator','Raos Cut Off Regulator','Raos Bulk Cylinder Conversion Units','Bag Mounts','Expiratory Valves - Heidbrink','22 Angle “Wye” w/o Expiratory Valve','Dr. Nawathes Swivel with Expiratory Valve',
					'3700','3600','3500','3601','3602','3612','3613','3652','3653','3650','3651','3654','3655','3656','3604','3606','3603','3607','4002','3625','3629','3675','3676','9023','9200','9202','9028','9050',

					
					'Suctions, Vaporizers & Connectors','Angle Mounts','Catheter Mounts','Circuit Adaptors (Plastic)','Goldman Halothane Vaporizer','Hose Mounts','Plug - In Mounts','Raos Foot Operated Suction Pump','Raos Hand Suction Unit 100 ml Capacity','Raos Hand Suction Unit 40 ml Capacity','Suction & Connectors',
					'1001','1101','1102','4001','4002','9001','9002','9003','9004','9005','9006','9007','9008','9009','9011M','9012','9013','9014','9015','9016','9018','9019','9020','9021','9021F','9021M','9033','9035','9037','9039','9041','9043','9046','9047M','9059'
						);

 

// Add an event to the obj given

// event_name refers to the event trigger, without the "on", like click or mouseover

// func_name refers to the function callback when event is triggered

function addEvent(obj,event_name,func_name){

            if (obj.attachEvent){

                        obj.attachEvent("on"+event_name, func_name);

            }else if(obj.addEventListener){

                        obj.addEventListener(event_name,func_name,true);

            }else{

                        obj["on"+event_name] = func_name;

            }

}

 

// Removes an event from the object

function removeEvent(obj,event_name,func_name){

            if (obj.detachEvent){

                        obj.detachEvent("on"+event_name,func_name);

            }else if(obj.removeEventListener){

                        obj.removeEventListener(event_name,func_name,true);

            }else{

                        obj["on"+event_name] = null;

            }

}

 

// Stop an event from bubbling up the event DOM

function stopEvent(evt){

            evt || window.event;

            if (evt.stopPropagation){

                        evt.stopPropagation();

                        evt.preventDefault();

            }else if(typeof evt.cancelBubble != "undefined"){

                        evt.cancelBubble = true;

                        evt.returnValue = false;

            }

            return false;

}

 

// Get the obj that starts the event

function getElement(evt){

            if (window.event){

                        return window.event.srcElement;

            }else{

                        return evt.currentTarget;

            }

}

// Get the obj that triggers off the event

function getTargetElement(evt){

            if (window.event){

                        return window.event.srcElement;

            }else{

                        return evt.target;

            }

}

// For IE only, stops the obj from being selected

function stopSelect(obj){

            if (typeof obj.onselectstart != 'undefined'){

                        addEvent(obj,"selectstart",function(){ return false;});

            }

}

 

/*    Caret Functions     */

 

// Get the end position of the caret in the object. Note that the obj needs to be in focus first

function getCaretEnd(obj){

            if(typeof obj.selectionEnd != "undefined"){

                        return obj.selectionEnd;

            }else if(document.selection&&document.selection.createRange){

                        var M=document.selection.createRange();

                        try{

                                    var Lp = M.duplicate();

                                    Lp.moveToElementText(obj);

                        }catch(e){

                                    var Lp=obj.createTextRange();

                        }

                        Lp.setEndPoint("EndToEnd",M);

                        var rb=Lp.text.length;

                        if(rb>obj.value.length){

                                    return -1;

                        }

                        return rb;

            }

}

// Get the start position of the caret in the object

function getCaretStart(obj){

            if(typeof obj.selectionStart != "undefined"){

                        return obj.selectionStart;

            }else if(document.selection&&document.selection.createRange){

                        var M=document.selection.createRange();

                        try{

                                    var Lp = M.duplicate();

                                    Lp.moveToElementText(obj);

                        }catch(e){

                                    var Lp=obj.createTextRange();

                        }

                        Lp.setEndPoint("EndToStart",M);

                        var rb=Lp.text.length;

                        if(rb>obj.value.length){

                                    return -1;

                        }

                        return rb;

            }

}

// sets the caret position to l in the object

function setCaret(obj,l){

            obj.focus();

            if (obj.setSelectionRange){

                        obj.setSelectionRange(l,l);

            }else if(obj.createTextRange){

                        m = obj.createTextRange();                     

                        m.moveStart('character',l);

                        m.collapse();

                        m.select();

            }

}

// sets the caret selection from s to e in the object

function setSelection(obj,s,e){

            obj.focus();

            if (obj.setSelectionRange){

                        obj.setSelectionRange(s,e);

            }else if(obj.createTextRange){

                        m = obj.createTextRange();                     

                        m.moveStart('character',s);

                        m.moveEnd('character',e);

                        m.select();

            }

}

 

/*    Escape function   */

String.prototype.addslashes = function(){

            return this.replace(/(["\\\.\|\[\]\^\*\+\?\$\(\)])/g, '\\$1');

}

String.prototype.trim = function () {

    return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1");

};

/* --- Escape --- */

 

/* Offset position from top of the screen */

function curTop(obj){

            toreturn = 0;

            while(obj){

                        toreturn += obj.offsetTop;

                        obj = obj.offsetParent;

            }

            return toreturn;

}

function curLeft(obj){

            toreturn = 0;

            while(obj){

                        toreturn += obj.offsetLeft;

                        obj = obj.offsetParent;

            }

            return toreturn;

}

/* ------ End of Offset function ------- */

 

/* Types Function */

 

// is a given input a number?

function isNumber(a) {

    return typeof a == 'number' && isFinite(a);

}

 

/* Object Functions */

 

function replaceHTML(obj,text){

            while(el = obj.childNodes[0]){

                        obj.removeChild(el);

            };

            obj.appendChild(document.createTextNode(text));

}

 

