

// generic email function type - html or text
function sendMail(from,to,subject,message,type){
	if(type=="text"){
		sendTextMail(from,to,subject,message);
	}else {
		
		sendHtmlMail(from,to,subject,message);
		
	
	}
}

function sendTextMail(from,to,subject,message){
	
	
}

function sendHtmlMail(from,to,subject,message){
	
	
	var searchAction = cpath.replace("/holidays/","/email/")+"sendHtmlMail";
	var emailParam = '';
	var msg = [];
	
	msg.push(message);
	emailParam+='{ from : "'+from+'", to : "'+to+'", subject : "'+subject+'", message : "'+msg+'"}';
	$.ajax({
	      url: searchAction,
	      type: "POST",
	      contentType: "application/json",
	      data: emailParam,
	      error: function(error){
	        alert('Unexpected Error'+error);
	      },
	      success: function(data){   
	       //alert('SUCCESS');
	       if(data!=null){
	    	   var html='<table width="400px" height=30px><tr><td valign="top" align="center">';
				html+=data+'</td></tr></table>';
	    	   $.prompt(html,{ buttons: { Ok: true } });
	    	      	
	      	}
	      }
	  });
	
}
