function ReplaceAll(Str,AFindText,ARepText){
	var raRegExp = new RegExp(AFindText,"g");
    return Str.replace(raRegExp,ARepText);
}

function InitBrowser(){
	if(Ext.isChrome===true){       
        var chromeDatePickerCSS = ".x-date-picker {border-color: #1b376c;background-color:#fff;position: relative;width: 185px;}";
        Ext.util.CSS.createStyleSheet(chromeDatePickerCSS,'chromeDatePickerStyle');
    }
    
    Ext.override(Ext.ux.form.LovCombo, {
    	beforeBlur: Ext.emptyFn
    }); 
}

function InitCnGoogleMap(){
	GPolygon.prototype.containsLatLng = function(latLng) {
	    // Do simple calculation so we don't do more CPU-intensive calcs for obvious misses
	    var bounds = this.getBounds();
	    if (!bounds.containsLatLng(latLng)) {
	        return false;
	    }
	    var numPoints = this.getVertexCount();
	    var inPoly = false;
	    var i;
	    var j = numPoints - 1;
	
	    for (i = 0; i < numPoints; i++) {
	        var vertex1 = this.getVertex(i);
	        var vertex2 = this.getVertex(j);
	
	        if (vertex1.lng() < latLng.lng() && vertex2.lng() >= latLng.lng() || vertex2.lng() < latLng.lng() && vertex1.lng() >= latLng.lng()) {
	            if (vertex1.lat() + (latLng.lng() - vertex1.lng()) / (vertex2.lng() - vertex1.lng()) * (vertex2.lat() - vertex1.lat()) < latLng.lat()) {
	                inPoly = !inPoly;
	            }
	        }
	
	        j = i;
	    }
	
	    return inPoly;
	};
    
	for (rindex = 0; rindex < reviseArray.length; rindex++) {
	    reviseGLatLngArray.push(new GLatLng(reviseArray[rindex][1], reviseArray[rindex][0]));
	}
}

function InitRole(){
    if (Role==3){
    	Ext.getCmp("car-menu").setVisible(false);
		Ext.getCmp("user-menu").setVisible(false);
	}
	if (IsOperator==1){
		Ext.getCmp("toolbar-operate").hide();
		Ext.getCmp("toolbar-manage").hide();
		Ext.getCmp("password-menu").setVisible(false);
		Ext.getCmp("delete-command-selected").setVisible(false);
		Ext.getCmp("delete-command-all").setVisible(false);
	}
	if (Role!=0){
		Ext.getCmp("imei-menu").setVisible(false);
		Ext.getCmp("delete-command-selected").setVisible(false);
		Ext.getCmp("delete-command-all").setVisible(false);
	}
	Ext.getCmp("info-panel").setActiveTab(2);
	Ext.getCmp("info-panel").setActiveTab(0);
}

function UpdateTreeIcon(response){
	var mes = response.responseText;
	var onlinecnt=0;
	var engineoncnt=0;
	var cnodes=Ext.getCmp("car-tree").root.childNodes;
	for(var i=0;i<cnodes.length;i++){
		var cnode=cnodes[i];
		var tnodes=cnode.childNodes;
		for(var j=0;j<tnodes.length;j++){
			var tnode=tnodes[j];
			var canodes=tnode.childNodes;
			for(var k=0;k<canodes.length;k++){
				var canode=canodes[k];
				if (mes.indexOf(','+canode.attributes.cid+',')>=0){
					var iconEl = canode.getUI().rendered ? Ext.get(canode.getUI().getIconEl()) : null;  
					if (iconEl) {  
					    iconEl.removeClass(canode.attributes.iconCls);  
					    iconEl.addClass('caronline');  
					    canode.attributes.iconCls = 'caronline'; 
					}  
					onlinecnt=onlinecnt+1;
				}else if (mes.indexOf(','+canode.attributes.cid+'-caron,')>=0){
					var iconEl = canode.getUI().rendered ? Ext.get(canode.getUI().getIconEl()) : null;  
					if (iconEl) {  
					    iconEl.removeClass(canode.attributes.iconCls);  
					    iconEl.addClass('carengineon');  
					    canode.attributes.iconCls = 'carengineon'; 
					}  
					engineoncnt=engineoncnt+1;
				}else{
					var iconEl = canode.getUI().rendered ? Ext.get(canode.getUI().getIconEl()) : null;  
					if (iconEl) {  
						iconEl.removeClass(canode.attributes.iconCls);  
					    iconEl.addClass('caroffline');  
					    canode.attributes.iconCls = 'caroffline';
					}
				}
			}
		}
	}
	if (Ext.getCmp("car-tree").getLoader().url.indexOf('CarTreeList')>=0){
		Ext.getCmp('tree-online').setText('Online:'+onlinecnt);
		Ext.getCmp('tree-engineon').setText('Engineon:'+engineoncnt);
	}
}

function UpdateSelected(){
	try{
		var nodes=Ext.getCmp("car-tree").getChecked(); 
		
		if (nodes.length>0){
			Ext.getCmp("command-panel").receiverstore.removeAll(); 
			Ext.getCmp("trace-panel").tracerstore.removeAll(); 
			var Vehicle = Ext.getCmp("command-panel").receiverstore.recordType;	
		    for(var i=0;i<nodes.length;i++){
			    if (nodes[i].attributes.catalog=='car'){
					//Ext.getCmp("command-panel").receiverstore.add([nodes[i].attributes.cid,nodes[i].attributes.plate]);
					if (IsOperator!=1){
						var p = new Vehicle({
							value:nodes[i].attributes.cid,
							text:nodes[i].attributes.text,
							kind:nodes[i].attributes.kind
						});	
						Ext.getCmp("command-panel").receiverstore.insert(Ext.getCmp("command-panel").receiverstore.getCount(),p);
					}
					var q = new Vehicle({
						value:nodes[i].attributes.cid,
						text:nodes[i].attributes.text,
						kind:nodes[i].attributes.kind
					});
					Ext.getCmp("trace-panel").tracerstore.insert(Ext.getCmp("trace-panel").tracerstore.getCount(),q);
				}
			}
			if (nodes.length==1){
				if (IsOperator!=1){
					if (nodes[0].attributes.kind<2){
	       				CommandKind='Tk310';
	       				Ext.getCmp("command-panel").operatecombo.getStore().loadData(Tk310OperateData);
	       			}
	       			else if (nodes[0].attributes.kind>1&&nodes[0].attributes.kind<4){
	       				CommandKind='Tk';
	       				Ext.getCmp("command-panel").operatecombo.getStore().loadData(TkOperateData);
	       			}
	       			else if (nodes[0].attributes.kind==5){
	       				CommandKind='Asc';
	       				Ext.getCmp("command-panel").operatecombo.getStore().loadData(AscOperateData);
	       			}
	       			UpdateCommandMenu();
					Ext.getCmp("command-panel").receivercombo.setValue(nodes[0].attributes.cid);
				}
				//Ext.getCmp("command-panel").receivercombo.fireEvent("select",Ext.getCmp("command-panel").receivercombo,null,-1);
				Ext.getCmp("trace-panel").tracercombo.setValue(nodes[0].attributes.cid);
				Ext.getCmp("trace-panel").tracercombo.fireEvent("select",Ext.getCmp("trace-panel").tracercombo,null,-1);
			}
			else{
				if (IsOperator!=1)
					Ext.getCmp("command-panel").receivercombo.setValue('');
				Ext.getCmp("trace-panel").tracercombo.setValue('');
			}
		}else{
			if (IsOperator!=1)
				Ext.getCmp("command-panel").receiverstore.reload();
			Ext.getCmp("trace-panel").tracerstore.reload();
		}
	}catch(e){
    }
}

function UpdateCommandMenu(){
	if (CommandKind!='Tk310'){
		Ext.getCmp("set-interval-menu").setDisabled(true);
		Ext.getCmp("engine-menu").setDisabled(true);
		Ext.getCmp("set-speed-menu").setDisabled(true);
	}else{
		Ext.getCmp("set-interval-menu").setDisabled(false);
		Ext.getCmp("engine-menu").setDisabled(false);
		Ext.getCmp("set-speed-menu").setDisabled(false);
	}
}

function RefreshCarTree(){
	Ext.Ajax.request({
        url: 'OnLineCars',
        success: UpdateTreeIcon,
        //failure: window.location = 'index.html',
        scope: this
    });	
}

function InitTimer(){
	AlarmTimer=setInterval("Ext.getCmp('alarm-panel').store.load()", 30*1000);
	CommandTimer=setInterval("Ext.getCmp('command-status-panel').store.load()", 20*1000);
	CarTreeTimer=setInterval("RefreshCarTree()", 30*1000);
}

function InitVariable(){
	GMap=Ext.getCmp("map-panel").getMap();
	Ext.Window.prototype.addTaskButton=function(button){
    	this.taskButton=button;
	}
}

function ShowVehicleInfo(carid){
	if (!Ext.getCmp("new-car-win"))
		var cwin=new CarWindow();
		
	Ext.getCmp("new-car-win").show();     
    Ext.getCmp("new-car-win").setTitle(getStr(S_EditCar));  
    Ext.getCmp("new-car-win").form.form.reset();
    Ext.getCmp("new-car-win").carid.setValue(carid);
    Ext.getCmp("new-car-win").icondefinepanel.carid=carid;
    Ext.getCmp("new-car-win").LoadData();
}

function ShowLiveTrack(cid,plate){
	var liveWin=new LiveTrackWindow({
    	id:'live-track-'+LiveTrackNum,
    	title:getStr(S_LiveTrack)+' ('+plate+')'	
    }); 
    LiveTrackNum=LiveTrackNum+1;
    liveWin.show();
    liveWin.carcombo.setValue(cid);
    liveWin.carcombo.fireEvent("select",liveWin.carcombo,null,-1);
    var geoPoint= new GLatLng(23,113); 
	liveWin.livemap.getMap().setCenter(geoPoint, 12);	
}

function AddMarker(map,rd){
	var geoPoint= new GLatLng(rd.get('latitude'),rd.get('longitude'));
	if (map.getCurrentMapType() == G_NORMAL_MAP){
		geoPoint=reviseChinaLatLng(geoPoint);
	}
	//map.clearOverlays();
	var icon = new GIcon();
	icon.image = "Icon/"+rd.get('icon');	
	icon.iconSize = new GSize(48, 48);
	icon.iconAnchor = new GPoint(20, 20);
	icon.infoWindowAnchor =new GPoint(20,10);
	//var marker = new GMarker(geoPoint,{icon:icon});
	var alarm=false;
	if (rd.get('alarmtext')!='')
		alarm=true;
	var fence=false;
	if (rd.get('alarmtext').indexOf('In Fence Alarm')>=0||rd.get('alarmtext').indexOf('Out Fence Alarm')>=0)
		fence=true;
	var route=false;
	if (rd.get('alarmtext').indexOf('Divert Alarm')>=0)
		route=true;
	var marker = new google.maps.LabelMarker(geoPoint,{labelText:rd.get('plate'),direct:rd.get('sdirect'),alarm:alarm,fence:fence,route:route,icon:icon});
	GEvent.addListener(marker,'mouseover',function(){
		var info='';
		if (IsOperator!=1)
			info = '<div style="height:180px; width:300px;"><font size="3"><B>Vehicle ID:'+rd.get('cid')+'<br>'+getStr(S_Plate)+':'+rd.get('plate')
				+'</B></font><hr color="red" /><table style="font-size:12px"><tr><td width="80">'+getStr(S_Latitude)+':</td><td>'+rd.get('latitude')+'</td></tr><tr><td>'+getStr(S_Longitude)+':</td><td>'+rd.get('longitude')
				//+'</td></tr><tr><td>'+getStr(S_Alarm)+':</td><td>'+rd.get('alarmtext')+'</td></tr><tr><td>'+getStr(S_Status)+':</td><td>'+rd.get('statustext')
				+'</td></tr><tr><td>'+getStr(S_Status)+':</td><td>'+rd.get('statustext')+'&nbsp'+rd.get('alarmtext')
				+'</td></tr><tr><td>'+getStr(S_Speed)+':</td><td>'+Math.round(rd.get('speed')*Math.pow(10, 2))/Math.pow(10, 2)+'Km/h'
				+'</td></tr><tr><td>'+getStr(S_ReceiveTime)+':</td><td>'+rd.get('lasttime')+'</td></tr><tr><td>'+getStr(S_Address)+':</td><td>'+rd.get('address')+'</td></tr>'
				+'<tr><td colspan="2"><a onclick="javascript:ShowVehicleInfo('+rd.get('carid')+');" href="#">'+getStr(S_VehicleInfo)+'</a>&nbsp;&nbsp;<a onclick="javascript:ShowLiveTrack(\''+rd.get('cid')+'\',\''+rd.get('plate')+'\');" href="#">'+getStr(S_LiveTrack)+'</a></td></tr></table></div>';
		else
			info = '<div style="height:180px; width:300px;"><font size="3"><B>Vehicle ID:'+rd.get('cid')+'<br>'+getStr(S_Plate)+':'+rd.get('plate')
				+'</B></font><hr color="red" /><table style="font-size:12px"><tr><td width="80">'+getStr(S_Latitude)+':</td><td>'+rd.get('latitude')+'</td></tr><tr><td>'+getStr(S_Longitude)+':</td><td>'+rd.get('longitude')
				//+'</td></tr><tr><td>'+getStr(S_Alarm)+':</td><td>'+rd.get('alarmtext')+'</td></tr><tr><td>'+getStr(S_Status)+':</td><td>'+rd.get('statustext')
				+'</td></tr><tr><td>'+getStr(S_Status)+':</td><td>'+rd.get('statustext')+'&nbsp'+rd.get('alarmtext')
				+'</td></tr><tr><td>'+getStr(S_Speed)+':</td><td>'+Math.round(rd.get('speed')*Math.pow(10, 2))/Math.pow(10, 2)+'Km/h'
				+'</td></tr><tr><td>'+getStr(S_ReceiveTime)+':</td><td>'+rd.get('lasttime')+'</td></tr><tr><td>'+getStr(S_Address)+':</td><td>'+rd.get('address')+'</td></tr>'
				+'<tr><td colspan="2"><a onclick="javascript:ShowLiveTrack(\''+rd.get('cid')+'\',\''+rd.get('plate')+'\');" href="#">'+getStr(S_LiveTrack)+'</a></td></tr></table></div>';
		marker.openInfoWindowHtml(info);
	});
	map.addOverlay(marker);
	//map.panTo(geoPoint);
}

function LogOut(btn){
	/*var directions = new GDirections (GMap); 
    var wayPoints = [new GLatLng(51.52039, -0.1485),  new GLatLng(51.5203, -0.1406),  new GLatLng(51.5203, -0.135)];
    //var wayPoints = ["北京市清华园科建大厦","北京市海淀区中关村大街","北京市王府井"]; 
	var polyline=null;
	GEvent.addListener(directions, "addoverlay", function(){ 
    	polyline = directions.getPolyline(); 
    	GEvent.addListener(polyline, "mouseover", function(){
	    	polyline.enableEditing(); 
	    }); 
	    GEvent.addListener(polyline, "mouseout", function(){ 
	    	polyline.disableEditing(); 
	    });
	    GEvent.addListener(polyline, "lineupdated", function(){ 
	    	wayPoints=[];
	    	for (var i=0;i<polyline.getVertexCount();i++)
	    		wayPoints.push(polyline.getVertex(i));
	    	directions.clear();
	    	directions.loadFromWaypoints(wayPoints); 
	    });
	});   
    directions.loadFromWaypoints(wayPoints); */
    //directions.load("from: 500 Memorial Drive, Cambridge, MA to: 4 Yawkey Way, Boston, MA 02215 (Fenway Park)");
	if(btn=="yes")
		window.location = 'index.html';
}

function LoadSkin() {
    var skin = getCookie("skin");
    if (skin == null || skin == "blue") {
        Ext.getCmp("blue-menu").setChecked(true);
        Ext.util.CSS.swapStyleSheet("theme", "Ext/resources/css/xtheme-blue.css");
    }
    else if (skin == "purple") {
        Ext.getCmp("purple-menu").setChecked(true);
        Ext.util.CSS.swapStyleSheet("theme", "Ext/resources/css/xtheme-gray.css");
    }
    else if (skin == "black") {
        Ext.getCmp("black-menu").setChecked(true);
        Ext.util.CSS.swapStyleSheet("theme", "Ext/resources/css/xtheme-darkgray.css");
    }
    else if (skin == "red") {
        Ext.getCmp("red-menu").setChecked(true);
        Ext.util.CSS.swapStyleSheet("theme", "Ext/resources/css/xtheme-red5.css");
    }
    else if (skin == "green") {
        Ext.getCmp("green-menu").setChecked(true);
        Ext.util.CSS.swapStyleSheet("theme", "Ext/resources/css/xtheme-slate.css");
    }
}

function AddTaskButtonForWindow(win) {
	if(!win.taskButton){
       var button = new Ext.Toolbar.Button({
            text: win.title,
            iconCls:win.iconCls,
            listeners:{
               'click':function(){
                     if(win.hidden)
                     win.show();
                     else
                     win.hide();
               }
            }
        });
        Ext.getCmp("menu-toolbar").addButton(button);
        Ext.getCmp("menu-toolbar").doLayout();
        win.addTaskButton(button);
        win.on('close',function(){
	        Ext.getCmp("menu-toolbar").remove(win.taskButton);
	        win.taskButton.destroy();
    	});
    }
    win.hide(win.taskButton.getEl());
}

function GetSingleCommandParam(fieldtype,fieldlabel,width,text,data){
	ParamNum=ParamNum+1;
	if (fieldtype=='textfield'){
		var p=new Ext.form.TextField({
			id:Ext.getCmp("command-panel").operatecombo.getValue()+'-'+ParamNum,
			name:'param',
			labelWidth:60,
			width:width,
			fieldLabel:fieldlabel
		});
		return p;
	}else if (fieldtype=='label'){
		var p=new Ext.form.Label({
			width:width,
			text:text
		});
		return p;
	}else if (fieldtype=='combo'){
	    var s=new Ext.data.ArrayStore({ 
	        fields: ['value', 'text'],
	        data : data
		}); 
		
		var p=new Ext.form.ComboBox({
			id:Ext.getCmp("command-panel").operatecombo.getValue()+'-'+ParamNum,
			editable:false,
			fieldLabel:fieldlabel,
			displayField : 'text', 
    		valueField : 'value',
    		store : s,
    		mode : 'local',
    		width:width,
    		hiddenName:'param',
    		triggerAction : 'all'
		});
		if (data==StatusData){
			p.setValue('2');
		}
		return p;
	}else if (fieldtype=='button'){
		var p=new Ext.Button({
			width:width,
			text:text
		});
		return p;
	}else if (fieldtype=='panel'){
		var p=new Ext.Panel({
			width:width
		});
		return p;
	}
}

function AddCommandParam(panel,fieldtype,fieldlabel,column,text,data) {
	if (column==1){
		var p=new Ext.Panel({
			layout:'form'
		});
		p.add(GetSingleCommandParam(fieldtype[0],fieldlabel,100,text,data));
	}else if (column==2){
		var p=new Ext.Panel({
			layout:'column'
		});
		p.add({
			columnWidth:.73,
			layout:'form',
			labelWidth:60,
			items:GetSingleCommandParam(fieldtype[0],fieldlabel,80,text,data)
		});
		p.add({
			columnWidth:.27,
			items:GetSingleCommandParam(fieldtype[1],fieldlabel,38,text,data)
		});		
	}
	panel.add(p);
}

function MapLatLngToRealLatLng(value){
	var ilat=parseInt(value);
	var flat=Math.abs(value-ilat)*60;
	flat=flat.toFixed(4);
	if (Math.abs(flat/10)<1)
		flat='0'+flat;
	var nvalue=new String(ilat)+flat;
	return nvalue;
}

function ResendCommand(id,cid,protocol,operate,param){
	if (protocol==0||protocol==1)
		protocol='Tk310';
	if (protocol==2||protocol==3)
		protocol='Tk';
	if (protocol==5)
		protocol='Asc';
	Ext.Ajax.request({
		url: 'SendCommand?kind=resend&id='+id+'&cids='+cid+'&protocol='+protocol+'&operate='+operate+'&params='+param,
		success: function(){Ext.getCmp("command-status-panel").store.reload();},
		failure: function(){alert('Fial!');}
	});
}

function DrawCircle(map,latlng,radius){
    var d2r = Math.PI/180;
    var r2d = 180/Math.PI;
    var Clat = (radius/3963)*r2d;
    var Clng = Clat/Math.cos(latlng.lat()*d2r);
    var Cpoints = [];
    for (var i=0; i < 33; i++)
    {
        var theta = Math.PI * (i/16);
        Cy = latlng.lat() + (Clat * Math.sin(theta));
        Cx = latlng.lng() + (Clng * Math.cos(theta));
        var P = new GPoint(Cx,Cy);
        Cpoints.push(P);
    }
    var circle = new GPolygon(Cpoints,"#FF0000",2,0.8,"#00FF00",0.5);
    map.addOverlay(circle);
}

function orderOfCreation(marker,b){
	return 1;
}

function SearchOnlineTree(status){
	if (status=='')
		CarTreeUrl='CarTreeList';
	else
    	CarTreeUrl='SearchCarTree?status='+status;
    if (CarTreeUrl=='CarTreeList')
		Ext.getCmp("car-tree").getLoader().url=CarTreeUrl+'?companyids='+CompanyIds+','+'&teamids='+TeamIds+','+'&carids='+CarIds+',';
	else
		Ext.getCmp("car-tree").getLoader().url=CarTreeUrl+'&companyids='+CompanyIds+','+'&teamids='+TeamIds+','+'&carids='+CarIds+',';
    Ext.getCmp("car-tree").getRootNode().reload();
}

function ChangePassword(btn, text){
	if (btn=='ok'){
		if (text!=''){
			Ext.Ajax.request({
				url: 'ModifyPassword?userid='+UserId+'&password='+text,
				success: function(){alert('Success!');},
				failure: function(){alert('Fial!');}
			});
		}
	}
}

function UpdateCarParam(kind){
	if (kind!=0&&kind!=1){
    	Ext.getCmp("new-car-win").quart.setVisible(false);
    	Ext.getCmp("new-car-win").quart.getEl().up('.x-form-item').setDisplayed(false); 
    	Ext.getCmp("new-car-win").minfuel.setVisible(false);
    	Ext.getCmp("new-car-win").minfuel.getEl().up('.x-form-item').setDisplayed(false);
    	Ext.getCmp("new-car-win").maxfuel.setVisible(false);
    	Ext.getCmp("new-car-win").maxfuel.getEl().up('.x-form-item').setDisplayed(false);
    	Ext.getCmp("new-car-win").fuelkindcombo.setVisible(false);
    	Ext.getCmp("new-car-win").fuelkindcombo.getEl().up('.x-form-item').setDisplayed(false); 
    	Ext.getCmp("new-car-win").temperature.setVisible(false);
    	Ext.getCmp("new-car-win").temperature.getEl().up('.x-form-item').setDisplayed(false); 
    	Ext.getCmp("new-car-win").mintemperature.setVisible(false);
    	Ext.getCmp("new-car-win").mintemperature.getEl().up('.x-form-item').setDisplayed(false);
    	Ext.getCmp("new-car-win").maxtemperature.setVisible(false);
    	Ext.getCmp("new-car-win").maxtemperature.getEl().up('.x-form-item').setDisplayed(false);
    	Ext.getCmp("new-car-win").uptemperature.setVisible(false);
    	Ext.getCmp("new-car-win").uptemperature.getEl().up('.x-form-item').setDisplayed(false);
    	Ext.getCmp("new-car-win").downtemperature.setVisible(false);
    	Ext.getCmp("new-car-win").downtemperature.getEl().up('.x-form-item').setDisplayed(false);
    }else{
    	Ext.getCmp("new-car-win").quart.setVisible(true);
    	Ext.getCmp("new-car-win").quart.getEl().up('.x-form-item').setDisplayed(true); 
    	Ext.getCmp("new-car-win").minfuel.setVisible(true);
    	Ext.getCmp("new-car-win").minfuel.getEl().up('.x-form-item').setDisplayed(true);
    	Ext.getCmp("new-car-win").maxfuel.setVisible(true);
    	Ext.getCmp("new-car-win").maxfuel.getEl().up('.x-form-item').setDisplayed(true);
    	Ext.getCmp("new-car-win").fuelkindcombo.setVisible(true);
    	Ext.getCmp("new-car-win").fuelkindcombo.getEl().up('.x-form-item').setDisplayed(true);
    	Ext.getCmp("new-car-win").temperature.setVisible(true);
    	Ext.getCmp("new-car-win").temperature.getEl().up('.x-form-item').setDisplayed(true); 
    	Ext.getCmp("new-car-win").mintemperature.setVisible(true);
    	Ext.getCmp("new-car-win").mintemperature.getEl().up('.x-form-item').setDisplayed(true);
    	Ext.getCmp("new-car-win").maxtemperature.setVisible(true);
    	Ext.getCmp("new-car-win").maxtemperature.getEl().up('.x-form-item').setDisplayed(true);
    	Ext.getCmp("new-car-win").uptemperature.setVisible(true);
    	Ext.getCmp("new-car-win").uptemperature.getEl().up('.x-form-item').setDisplayed(true);
    	Ext.getCmp("new-car-win").downtemperature.setVisible(true);
    	Ext.getCmp("new-car-win").downtemperature.getEl().up('.x-form-item').setDisplayed(true);
    }
    if (kind!=4){
    	Ext.getCmp("new-car-win").mcc.setVisible(false);
    	Ext.getCmp("new-car-win").mcc.getEl().up('.x-form-item').setDisplayed(false); 
    	Ext.getCmp("new-car-win").mnc.setVisible(false);
    	Ext.getCmp("new-car-win").mnc.getEl().up('.x-form-item').setDisplayed(false);
    }else{
    	Ext.getCmp("new-car-win").mcc.setVisible(true);
    	Ext.getCmp("new-car-win").mcc.getEl().up('.x-form-item').setDisplayed(true); 
    	Ext.getCmp("new-car-win").mnc.setVisible(true);
    	Ext.getCmp("new-car-win").mnc.getEl().up('.x-form-item').setDisplayed(true);
    }
}
