function setCookie(sName, sValue) {
var today = new Date(), expires = new Date();
if(sValue==""){
expires.setTime(today.getTime() - 3600);
} else {
expires.setTime(today.getTime() + (365*24*60*60*1000));
}
document.cookie = sName + "=" + encodeURIComponent(sValue) + ";expires=" + expires.toGMTString()+"; path=/ ;domain = .tipimail.com";
}
function getCookie(sName) {
var oRegex = new RegExp("(?:; )?" + sName + "=([^;]*);?");
if (oRegex.test(document.cookie)) {
return decodeURIComponent(RegExp["$1"]);
} else {
return null;
}
}
function delCookie(nom) {
setCookie(nom,"")
}
function is_int(value){
if((parseFloat(value) == parseInt(value)) && !isNaN(value)){
return true;
} else {
return false;
}
}
function goToByScroll(id){
// Remove "link" from the ID
id = id.replace("link", "");
if (document.getElementById(id)) {
$('html,body').animate({
scrollTop: $("#"+id).offset().top-70},
'slow');
}
return false;
}
function verifMail(mail){
var reg = new RegExp('^[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*@[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*[\.]{1}[a-z]{2,6}$', 'i');
return(reg.test(mail));
}
function changeprice(value){
if(value!="all"){
$(".tab.premium").find(".price").find(".value").html(value);
$("#pricing").find(".premium").find(".price").animate({opacity: 1});
} else {
$("#pricing").find(".premium").find(".price").animate({opacity: 0});
goToByScroll("contact");
}
return false;
}
function checkFormStore(prd){
$("#formprocess").find("#cdprd").val(prd);
$("#formprocess").submit();
}
function checkContactForm(){
erreur="";
if($("#msg").val().length<10){
erreur='Type your message';
}
if($("#email").val().length == 0){
erreur='Fill in your email address';
}else{
if(!verifMail($("#email").val())){
erreur='Incorrect email';
}
}
if($("#lastname").val().length<2){
erreur='Type your last name';
}
if($("#firstname").val().length<2){
erreur='Type your first name';
}
if(erreur!=""){
swal({ title: 'Error!', text: erreur, type: "error" });
return false;
}
}
function inscriptionBeta(email){
//if email empty
if(email.length == 0){
swal({ title: 'Fill in your email address', text: "", type: "error" });
} else {
if(verifMail(email)){
$.ajax({
type: "POST",
url: '//static.tipimail.com/ws/addbeta.asp',
data: 'mail='+email.toLowerCase()+'&langBeta=EN',
success: function(data){
myTextSuccess = "Congratulations! You are #%X% on our VIP invite list.\nExpect an exclusive invite from us in the next %nb% days.\n\nSpread the word";
splitData = data.split("--");
if(splitData[0]=="OK"){
swal({
title: 'Thanks for signing up',
text: myTextSuccess.replace("%X%", splitData[1]).replace("%nb%", splitData[2]),
html: true,
type: "success"
});
showShare(splitData[1]);
} else if(data=="NOK1") {
swal({ title: 'Email already registered!', text: "", type: "error", html: true });
} else {
swal({ title: 'Incorrect email', text: "", type: "error" });
}
}
});
} else {
swal({ title: 'Incorrect email', text: "", type: "error" });
}
}
}
function addNewsletter(email){
if(email.length == 0){
swal({ title: 'Fill in your email address', text: "", type: "error" });
} else {
if(verifMail(email)){
$.ajax({
type: "POST",
url: 'https://static.tipimail.com/ws/addNewsletter.asp',
data: 'mail='+email.toLowerCase()+'&lang=EN',
success: function(data){
if(data=="OK"){
swal({
title: "Thanks for signing up",
text: "You are now subscribed to our newsletter",
html: true,
type: "success"
});
$("#footer_news_email").val("");
} else if(data=="NOK1") {
swal({ title: "Email already subscribed.", text: "", type: "error", html: true });
} else {
swal({ title: "Invalid email", text: "", type: "error" });
}
}
});
} else {
swal({ title: "Invalid email", text: "", type: "error" });
}
}
return false;
}
function showShare(nb){
txt="I am #%X% in line for a Tipimail beta invite. Join me for an exclusive invite to the new #transactional #emails app! #Tipimail";
txt=encodeURIComponent(txt.replace("%X%", nb));
html='\n\n';
html+='';
html+='
'
html+='
';
$(".sweet-alert").find("p").append(html);
//$(".sweet-alert").find("button.confirm").hide();
}
function popitup(url) {
if(url==""){ return false; }
newwindow=window.open(url,'name','height=400,width=600');
if(window.focus){ newwindow.focus(); }
return false;
}
function checkMobileFormStore(value){
if(value != "more"){
checkFormStore(value);
} else {
goToByScroll('contact');
}
}
function searchFAQ(value){
if( value != "" ){
$.ajax({
type: "POST",
url: '//static.tipimail.com/ws/faq-search.asp',
data: 'word='+value+'&lang=EN',
success: function(data){
createOverlayFaq();
var obj = jQuery.parseJSON(data);
exvalue="";
myHtml="";
$.each(obj, function(key, val){
if(val.c_url != exvalue){ htmltop="