TEST
You are here: Home » TEST
$(document).ready(function () {
$("#testOne").css("cursor", "pointer");
$('#hrefContactUs').click(function () {
/* Reset all the Dlg controls */
$('#txtUserName').val("");
$('#txtUserEmailID').val("");
$('#txtUserPhone').val("");
$('#txtComments').val("");
$("#divModalContactUs").dialog("open");
}); //BtnClick Fn
$('#divModalContactUs').dialog({
modal: true,
title: "Contact Us",
autoOpen: false,
position: 'center',
show: 'fade',
hide: 'fade',
open: function (event, ui) { $(".ui-dialog-titlebar-close").hide(); },
height: 300,
width: 450,
closeOnEscape: true,
resizable: false,
draggable: false,
buttons: {
"Cancel": function () {
$(this).dialog('close');
},
"Submit": function () {
/* Add Validations */
var txtUserName = $.trim($('#txtUserName').val());
var txtUserEmailID = $.trim($('#txtUserEmailID').val());
var txtUserPhone = $.trim($('#txtUserPhone').val());
var pattern1 = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z]{2,4})+$/; //These 2 patterns are needed
var pattern2 = /^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
if (txtUserName == "") {
alert("Please enter your Name");
return false;
}
if (txtUserEmailID == "") {
alert("Please enter your EmailID");
return false;
}
if (!checkReceiverEmailID(txtUserEmailID)) {
alert("Please enter valid Email Address");
return false;
}
/* Form the Json object and send to server */
var EmailTO = {};
var UserName = [];
var UserEmailID = [];
var UserPhone = [];
var Comments = [];
EmailTO["UserName"] = $('#txtUserName').val();
EmailTO["UserEmailID"] = $('#txtUserEmailID').val();
EmailTO["UserPhone"] = $('#txtUserPhone').val();
EmailTO["Comments"] = $('#txtComments').val();
$("#content").mask("Sending Mail...");
$('html, body').animate({ scrollTop: 0 }, 'slow');
$.ajax({
url: baseUrl + 'Summary/SendUserInfo',
type: 'POST',
dataType: 'json',
data: JSON.stringify(EmailTO),
contentType: 'application/json; charset=utf-8',
success: function (data) {
$("#content").unmask();
alert(data);
},
error: function (data) {
$("#content").unmask();
alert('Some unknown Error occured');
}
});
$(this).dialog("close");
} //End btnSend
}//Buttons
}); //dlg
});
function checkReceiverEmailID(inputvalue) {
if (inputvalue == "")
return true; //for optional Recipient's address
if (inputvalue.indexOf(';') == -1)
inputvalue = inputvalue + ";"; //If single id is given, append ;
var arrItems = inputvalue.split(';');
// var pattern1 = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z]{2,4})+$/; //These 2 patterns are needed
// var pattern2 = /^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
var pattern1 = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z]{2,4})+$/; //These 2 patterns are needed
var pattern2 = /^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
for (var i = 0; i < arrItems.length; i++) {
if (arrItems[i].trim() != "")
if (!pattern1.test(arrItems[i].trim()) || !pattern2.test(arrItems[i].trim()) || arrItems[i].split('@').length != 2)
return false;
}
return true;
}
///
Sys.Net.WebRequestManager.add_completedRequest(function (result) {
IsLogonRequired(result.get_responseData());
});
$("*").ajaxComplete(function (e, xhr, settings) {
IsLogonRequired(xhr.responseText);
});
function IsLogonRequired(response_data) {
var data = null;
try {
var data = $.parseJSON(response_data);
}
catch (ex) {
//content is not json so we dont care that jsonParse failed
};
if (data != null && data.LogonRequired != undefined && data.LogonRequired == true)
window.location.href = baseUrl + "Calculator?timeout=1";
};
// tracking from which sites/browsers users land on the FACC calculator
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-4657217-11']);
_gaq.push(['_trackPageview']);
(function () {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();