/*
	(c) 2007-2008 | http://olegrorovin.spb.ru/
	Author - Oleg Korovin (mail@olegrorovin.spb.ru)
*/

var Contacts = {
	
	elPopupLayer		: null,
	elBox					: null,
	
 /******************************************************************************/
	showForm			: function(event,sPopupLayer,sBox){
		var oThis = this;
		
		oThis.elPopupLayer = $(sPopupLayer);
		oThis.elBox = $(sBox);
		
		oThis.reSend();
				
		Veil.show(oThis.elPopupLayer,1)
	},
	

 /***************************************/
	send			: function(event,elForm){
		var oThis = this;
		
		Styles.removeClass(elForm , 'CheckError');
		
		if( !checkForm(elForm) ){
			Styles.addClass(elForm , 'CheckError');
		 	return false;
		}
		
		var 
			mInp = elForm.elements,
			oValues = {};
		
		for(var i=0,l=mInp.length;i<l;i++){
			if(
				mInp[i].type != 'checkbox' ||
				mInp[i].checked
			){
				oValues[mInp[i].name] = mInp[i].value;
			}
		}
				
		sendRequest( getUrl(elForm.action) , oValues, 25, function(res,text){
			if(res && res.complete){
				var elTable = elForm.parentNode;
				Styles.hide(elTable);
				Styles.show(elTable.parentNode.lastChild);
				elForm.reset();
			}
			else{
//				winPopup.close();
			}
		});
	},

 /***************************************/
	reSend			: function(elThis){
		Styles.show(this.elBox.firstChild);
		Styles.hide(this.elBox.lastChild);
		initInputPlaceholder();
	},
	
	a : 'a'
}
