﻿var ContactUsRelatedForm=new Class({
	Extends:GeneratedForm,
	options:{
		onSending:function (e) {
			$("preloader").setStyle("display","block");
		},
		onSent:function (e) {
		    $("preloader").setStyle("display", "none");
		    e.cancel = true;
		    $("fg-form-ContactUsRelated").getElement(".fg-fields").innerHTML = e.html;
		    $("fg-form-ContactUsRelated").getElement(".fg-buttons").innerHTML = "<div class='button2' onclick='Lightbox.hide()'>close</div>";
		    $("fg-form-ContactUsRelated").getElement(".fg-body").innerHTML = "";
		},
		onInitialize:function(){
//			var formButton = $("content-related-wrap").getElement(".contactRelatedButton");
			
			
//			var mySlide = new Fx.Tween('fg-form-ContactUsRelated',{duration:'short'});
//			var collapseHeight = 0;
//			var extraHeight = $("fg-form-ContactUsRelated").getElements(".fg-field").length *12;
//			var expandHeight = $("fg-form-ContactUsRelated").offsetHeight+extraHeight;
//			mySlide.start('height',collapseHeight+'px');
//				
//			var list=new Element('div');
//			list.className = "lightbox-close";
//			list.id = "lightbox-close";
//			$("fg-form-ContactUsRelated").adopt(list);
//			
//			var closeButton = $("fg-form-ContactUsRelated").getElement(".lightbox-close");
//			if(closeButton){
//				closeButton.addReplacingEvent('click', function(e){
//					mySlide.start('height',collapseHeight+'px');				
//				});
//			 }
			 
			
//			if(formButton){
//				var arrImg=new Element("img").set("src","/images/arrows/arr3.gif");
//				arrImg.className = "CUarrow";
//				formButton.addReplacingEvent('click', function(e){
//					if($("fg-form-ContactUsRelated").getStyle("visibility")=="hidden"){
//						$("fg-form-ContactUsRelated").setStyle("visibility","visible");
//					}

//					if($("fg-form-ContactUsRelated").offsetHeight < 10){
//							
//							mySlide.start('height',expandHeight+'px');
//						}
//						else{
//						
//							mySlide.start('height',collapseHeight+'px');
//						}
//				});
//				formButton.getElement(".content-block-body").adopt(arrImg);
//			}
		}
	}
});