﻿// JScript File

var editForm = function(){
	var formData;
	var netData = { txtFname: '', txtLname: '' };	
	
	return {
        isValid: function(){ return formData.isValid(); },
	    getValues: function(){
	        var tmp = this.getValues2().split('&');
	        var vF = new Array(), vFi = 0;
	        
	        for (var i = 0; i < tmp.length; i++) {
	            var fn = tmp[i].split('=');
	            if (fn[0].substring(0,3) == 'ext') vF[vFi++] = tmp[i];
	        } return Ext.urlDecode(vF.join('&'));
	    },
	    
		getValues2: function(asString){
            var fs = Ext.lib.Ajax.serializeForm(document.forms[0]);
            if(asString == true) return fs;
            return fs; //Ext.urlDecode(fs);
		},
		setValues: function(arr){ formData.setValues(arr); },
		init: function() {
			Ext.QuickTips.init();

			Ext.form.Field.prototype.msgTarget = 'side';
			formData = new Ext.form.Form({ labelAlign: 'left', labelWidth: 55, buttonAlign: 'right' });

			formData.container( {id:'cf'},
				new Ext.form.TextField({ fieldLabel:'שם מלא', name:'txtFname', allowBlank:false , width:'150' , height:'19' }),
				new Ext.form.TextField({ fieldLabel:'אימייל', name:'txtEmail', vtype: 'email', allowBlank:false , width:'150', height:'19' }),
				new Ext.form.TextField({ fieldLabel:'טלפון', name:'txtPhone' , width:'150', height:'19' }),
				//new Ext.form.TextField({ fieldLabel:'שם משפחה', name:'txtLname' }),
				new Ext.form.TextField({ fieldLabel:'נושא', name:'txtSubject' , width:'150', height:'19' }),
				new Ext.form.TextArea({ fieldLabel:'<br/>כתבו<br/>אלינו' , height:'100', width: '214', style: 'margin-top: 1.3em;', name:'txtMsg' })
				
//				new Ext.form.ComboBo({ listAlign:'tr-br?', fieldLabel:'נושא הפנייה', value: 'info@metropolinet.co.il',
//					store: new Ext.data.SimpleStore({
//                        fields: ['value', 'text'],
//                        data : [
//                            ['info@metropolinet.co.il','פנייה כללית'],
//                            ['shivuk@metropolinet.co.il','שיווק'],
//                            ['account@metropolinet.co.il','גזברות'],
//                            ['gvia@metropolinet.co.il','גביה'],
//                            ['ksafim@metropolinet.co.il','כספים 2000']
//                        ]
//                    }),
//                    editable:false, valueField:'value', displayField:'text', mode: 'local', name:'subject',
//					triggerAction: 'all', hiddenName: 'txtSubject', allowBlank:false
//				}),

//				new Ext.form.TextArea({ fieldLabel:'כתוב אלינו', height:'100', width: '244', name:'txtMsg' })
			);
		    
			formData.applyIfToFields({ width: 250 });
			formData.render('form-ct4');
			//Ext.get('fsHeader').insertAfter(Ext.get('cf').child('legend'));
		}
	};
}();
