YAHOO.namespace("contactUs");

/*function callFunction(){
	YAHOO.contactUs.contactUsDialog.show();
}*/

function initContactUsDialog() {	
	getElement('contactUsDialog').style.display= "block";
	
	var handleSubmit = function() {
		this.submit();
	};
	var handleCancel = function() {
		this.cancel();
		getElement('contactUsForm').reset();		
	};
	var handleSuccess = function(o) {		
    	responseJSON = o.responseText.parseJSON();
    	if (responseJSON.status){
    		alert(responseJSON.msg);
    		getElement('contactUsForm').reset();    		    		
    	}	
    	else
    		alert(responseJSON.msg);    	    	
	};
	var handleFailure = function(o) {
		alert('Server Error!');		
	};	
	
	YAHOO.contactUs.contactUsDialog	= new YAHOO.widget.Dialog("contactUsDialog", 
							{ width : "35em",
							  fixedcenter : true,
							  visible : false, 
							  constraintoviewport : true,							
							  draggable: false,							  
							  modal:true,							  
							  buttons : [	{ text:"Send",		handler:handleSubmit},
								      		{ text:"Cancel", 	handler:handleCancel } ]
							});
	YAHOO.contactUs.contactUsDialog.callback = { success: handleSuccess, failure: handleFailure };
	YAHOO.contactUs.contactUsDialog.render();
	YAHOO.util.Event.addListener("contactUsURL", "click", YAHOO.contactUs.contactUsDialog.show, YAHOO.contactUs.contactUsDialog, true );
}
YAHOO.util.Event.onDOMReady(initContactUsDialog); 
 
function showContactUs() 
{ 
	YAHOO.contactUs.contactUsDialog.show();
}