jQuery(document).ready(function() { // contact form jQuery("form.contact-form #submit").click(function(){ //alert('ok'); var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; var obj = jQuery(this).parents(".contact-form"); var Name = obj.find("input#name").val(); var Email = obj.find("input#email").val(); var Message = obj.find("textarea#message").val(); var sendto = obj.find("input#sendto").val(); Name = Name.replace('Name',''); Email = Email.replace('Email',''); Message = Message.replace('Message',''); //alert('Email:'+Email); if( !obj.find(".noticefailed").length ){ obj.append('
'); } obj.find(".noticefailed").text(""); //alert('Email:'+Email); if(Name ===""){ obj.find(".noticefailed").text("Please enter your name."); return false; } if( !(emailReg.test( Email )) || Email ==='' ) { obj.find(".noticefailed").text("Please enter valid email."); return false; } if(Message === ""){ obj.find(".noticefailed").text("Message is required."); return false; } obj.find(".noticefailed").html(""); obj.find(".noticefailed").append("
");
jQuery.ajax({
type:"POST",
dataType:"json",
url:ct_params.ajaxurl,
data:"Name="+Name+"&Email="+Email+"&Message="+Message+"&sendto="+sendto+"&action=ascreen_contact",
success:function(data){
if(data.error==0){
obj.find(".noticefailed").addClass("noticesuccess").removeClass("noticefailed");
obj.find(".noticesuccess").html(data.msg);
}else{
obj.find(".noticefailed").html(data.msg);
}
jQuery('.loading').remove();obj[0].reset();
},
error:function(){
obj.find(".noticefailed").html("Error.");
obj.find('.loading').remove();
}
});
});
// contact form end
// slider resize
var height_all = jQuery(window).height();
jQuery(".carousel-inner .item").css("height",height_all);
var height_inner = jQuery(".carousel-inner").height();
var height_caption = jQuery(".carousel_caption_warp").height();
var height_indicators = jQuery(".carousel-indicators").height();
var top = (height_inner-height_caption-height_indicators)/2-70;
if(top<0)
{
jQuery(".carousel-caption").css("top",0);
jQuery(".carousel_caption_warp").css("margin-top",0);
}else{
jQuery(".carousel-caption").css("top",0);
jQuery(".carousel_caption_warp").css("margin-top",top+30);
}
jQuery(window).resize(function() {
var height_all = jQuery(window).height();
jQuery(".carousel-inner .item").css("height",height_all);
var height_inner = jQuery(".carousel-inner").height();
var height_caption = jQuery(".carousel_caption_warp").height();
var height_indicators = jQuery(".carousel-indicators").height();
var top = (height_inner-height_caption-height_indicators)/2-70;
if(top<0)
{
jQuery(".carousel-caption").css("top",0);
jQuery(".carousel_caption_warp").css("margin-top",0);
}else{
jQuery(".carousel-caption").css("top",0);
jQuery(".carousel_caption_warp").css("margin-top",top+30);
}
});
// slider resize end
});
");
jQuery.ajax({
type:"POST",
dataType:"json",
url:ct_params.ajaxurl,
data:"Name="+Name+"&Email="+Email+"&Message="+Message+"&sendto="+sendto+"&action=ascreen_contact",
success:function(data){
if(data.error==0){
obj.find(".noticefailed").addClass("noticesuccess").removeClass("noticefailed");
obj.find(".noticesuccess").html(data.msg);
}else{
obj.find(".noticefailed").html(data.msg);
}
jQuery('.loading').remove();obj[0].reset();
},
error:function(){
obj.find(".noticefailed").html("Error.");
obj.find('.loading').remove();
}
});
});
// contact form end
// slider resize
var height_all = jQuery(window).height();
jQuery(".carousel-inner .item").css("height",height_all);
var height_inner = jQuery(".carousel-inner").height();
var height_caption = jQuery(".carousel_caption_warp").height();
var height_indicators = jQuery(".carousel-indicators").height();
var top = (height_inner-height_caption-height_indicators)/2-70;
if(top<0)
{
jQuery(".carousel-caption").css("top",0);
jQuery(".carousel_caption_warp").css("margin-top",0);
}else{
jQuery(".carousel-caption").css("top",0);
jQuery(".carousel_caption_warp").css("margin-top",top+30);
}
jQuery(window).resize(function() {
var height_all = jQuery(window).height();
jQuery(".carousel-inner .item").css("height",height_all);
var height_inner = jQuery(".carousel-inner").height();
var height_caption = jQuery(".carousel_caption_warp").height();
var height_indicators = jQuery(".carousel-indicators").height();
var top = (height_inner-height_caption-height_indicators)/2-70;
if(top<0)
{
jQuery(".carousel-caption").css("top",0);
jQuery(".carousel_caption_warp").css("margin-top",0);
}else{
jQuery(".carousel-caption").css("top",0);
jQuery(".carousel_caption_warp").css("margin-top",top+30);
}
});
// slider resize end
});