function TextScroll(scrollname, div_name, up_name, down_name){
    this.div_name = div_name;
    this.name = scrollname;
    this.scrollCursor = 0;
    this.speed = 3;
    this.timeoutID = 0;
    this.div_obj = null;
    this.up_name = up_name;
    this.dn_name = down_name;
	{
      div_obj = $(this.div_name);
      if (div_obj) {
          this.div_obj = div_obj;
          this.div_obj.style.overflow = 'hidden';
      }
      div_up_obj = $(this.up_name);
      div_dn_obj = $(this.dn_name);
      if (div_up_obj && div_dn_obj) {   
        div_up_obj.onmouseover = function() { 
        		eval(scrollname + ".scrollUp();")
        		//TextScroll.prototype.scrollUp();
        };
				div_up_obj.onmouseout = function() { eval(scrollname + ".stopScroll();") };
				
				div_dn_obj.onmouseover = function() { eval(scrollname + ".scrollDown();") };
				div_dn_obj.onmouseout = function() { eval(scrollname + ".stopScroll();") };
      }
	       
	}
	
	this.stopScroll = function() { clearTimeout(this.timeoutID); }
	
	this.scrollUp = function() {
      if (this.div_obj) {
          this.scrollCursor = (this.scrollCursor - this.speed) < 0 ? 0 : this.scrollCursor - this.speed;
          this.div_obj.scrollTop = this.scrollCursor;
          this.timeoutID = setTimeout(this.name + ".scrollUp()", 30);
      }
  }
	    
	this.scrollDown = function() {
		if (this.div_obj) {
			this.scrollCursor += this.speed;
			this.div_obj.scrollTop = this.scrollCursor;
			if (this.div_obj.scrollTop == this.scrollCursor) {
				this.timeoutID = setTimeout(this.name + '.scrollDown()', 30);
			} else {
					this.scrollCursor = this.div_obj.scrollTop;
			}
		}
	}
	
	this.resetScroll = function() {
      if (this.div_obj) {
          this.div_obj.scrollTop = 0;
          this.scrollCursor = 0;
      }
  }
}

SendMail = Class.create();
SendMail.prototype = {
	
	failMessage: 'Send mail request failed! Please, try again later.',
	
	initialize: function() {
		this.url = 'sendmail.php';
  },
  	
 	submitForm: function(frmID) 
 	{
 		var formSerialized = Form.serialize(frmID);
 		new Ajax.Request(this.url, 
	 		Object.extend( 
	 		{ 	
	 			method: 'post', 
	 			encoding: 'utf-8',
	 			parameters: formSerialized,
	 			onSuccess: this.onSuccess.bind(this), 
	 			onFailure: this.onFailure.bind(this)
	 		})
 		);
 	},

	onSuccess: function (transport) 
	{
		var json = transport.responseText.evalJSON();

		this.showMsg(json.msg);
		  		
		if (!json) {	
			this.showMsg(this.failMessage);
			return 0;		
		}
	},

	onFailure: function () { 	
		this.showMsg(this.failMessage);
	},
	
	showMsg: function (text) { 	
		$('frmMsg').innerHTML = text;
	}
}
sendmail = new SendMail();
