$(document).ready(function(){var notvalid="Validation code is not correct";if($("#sendReq").length>0){$(".emsg a").click(function(){$(".emsg a").empty().hide();$("#sendReq").children("div").fadeIn("slow");return false});$("form#sendReq").submit(function(){$("#dest, #name, #email, #message").css("background-color","#fff");if($("#dest").val()!="Choose Destination"&&$("#name").val()!=""&&$("#email").val()!=""&&$("#message")!=""){var zzz=$("#valid").val();var tok=$("input[@name=token]").val();$.ajax({url:"/destinationwedding/validate/"+zzz,type:"get",success:function(rs){$captcha_valid=rs;if($captcha_valid){$("form#sendReq").css({background:"transparent url('images/form_loader.gif') 50% 110px no-repeat"}).children().fadeOut("fast");$.ajax({url:"destinationwedding/req/2008",type:"post",data:{dest:$("select[@name=dest]").val(),name:$("#name").val(),email:$("#email").val(),contact:$("#contact").val(),message:$("#message").val(),valid:zzz,token:tok},success:function(rs){if(rs=="success"){$(".emsg a").empty().append("Message Sent. We will contact you shortly.").fadeIn("fast");$("form#sendReq").each(function(){this.reset()})}else{$(".emsg a").empty().append("There is a problem with our messaging system. Please try again later.").fadeIn("fast")}}});$.ajax({url:"/destinationwedding/make_captcha_img/"+tok+"/ajax",success:function(captcha){data=captcha.split("|");$(".captcha").attr("src",data[0])}});return false}else{alert("Validation code is not correct");$("#valid").val("").css("background-color","#f6efc2");$.ajax({url:"/destinationwedding/make_captcha_img/"+tok+"/ajax",success:function(captcha){data=captcha.split("|");$(".captcha").attr("src",data[0])}});return false}}})}else{if($("#dest").val()=="Choose Destination"){$("#dest").css("background-color","#f6efc2")}if($("#name").val()==""){$("#name").css("background-color","#f6efc2")}if($("#email").val()==""){$("#email").css("background-color","#f6efc2")}if($("#message").val()==""){$("#message").css("background-color","#f6efc2")}}return false})}if($("#catlist").length>0){var status=false;$("a#showcat").click(function(){if(!status){$("ul#catlist").animate({height:"show",opacity:"show"},"fast").css("z-index","999");status=true}return false});$("ul#catlist").hover(function(){},function(){$("ul#catlist").animate({opacity:1},1000).slideUp("fast");status=false;return false})}if($("#monthselect").length>0){var status=false;$("a#archive").click(function(){if(!status){$("div#monthselect").animate({height:"show",opacity:"show"},"fast");status=true}return false});$("a#closemsel").click(function(){$("div#monthselect").slideUp("fast");status=false;return false});$("a#viewsel").click(function(){y=$("select.yearsel option:selected").attr("value");m=$("select.monthsel option:selected").attr("value");if(y>0&&m>0){location.href=("/photoblog/archive/"+y+"/"+m)}return false})}if($("#cbox").length>0&&$("#ebox").length>0){$("form#sendPage").hide();$("form#sendComm").css("height","170px");$("a#cbox").click(function(){$("form")[0].reset();$("#cbox img").attr({src:"/images/act_on.gif"});$("#ebox img").attr({src:"/images/act_off.gif"});$("form#sendPage").hide();$("form#sendComm").css("height","170px").fadeIn("fast");return false});$("a#ebox").click(function(){$("form")[1].reset();$("#cbox img").attr({src:"/images/act_off.gif"});$("#ebox img").attr({src:"/images/act_on.gif"});$("form#sendComm").hide();$("form#sendPage").css("height","170px").fadeIn("fast");return false});$("form#sendComm").submit(function(){$("#sendComm .author, #sendComm .msg").css("background-color","#fff");if($("#sendComm #author").val()!=""&&$("#sendComm #msg").val()!=""){urltitle=$("#sendComm .urltitle").val();token=$("#sendComm .token").val();zzz=$("#sendComm .valid").val();$.ajax({url:"/couple/validate/"+zzz,type:"get",success:function(rs){$captcha_valid=rs;if($captcha_valid){$("#messages").css({background:"#1a1a1a url('/images/message_loader.gif') 50% no-repeat"}).empty();$.ajax({url:"/couple/send_comment/ajax",type:"post",data:{blogid:$("#sendComm .blogid").val(),author:$("#sendComm #author").val(),web:$("#sendComm #web").val(),msg:$("#sendComm #msg").val(),urltitle:$("#sendComm .urltitle").val(),token:$("#sendComm .token").val(),valid:$("#sendComm .valid").val()},dataType:"html",success:function(data){$("form")[0].reset();$("form#sendComm input:not('.sendz')").css("background-color","#fff");$(".msgtop span").empty().html(data);$("#messages").load("/couple/show_comment/"+urltitle+"/"+token+"/ajax").css({background:"#1a1a1a"});$.ajax({url:"/couple/make_captcha_img/"+token+"/ajax",success:function(captcha){data=captcha.split("|");$(".captcha").attr("src",data[0]);$(".hint").val(data[1])}})}})}else{alert("Validation code is not correct");$("#sendComm .valid").val("").css("background-color","#f6efc2");$.ajax({url:"/couple/make_captcha_img/"+token+"/ajax",success:function(captcha){data=captcha.split("|");$(".captcha").attr("src",data[0]);$(".hint").val(data[1])}});return false}}})}else{if($("#author").val()==""){$("#author").css("background-color","#f6efc2")}if($("#msg").val()==""){$("#msg").css("background-color","#f6efc2")}}return false});$("form#sendPage").submit(function(){if($("#mail1").val()!=""||$("#mail2").val()!=""||$("#mail3").val()!=""||$("#mail4").val()!=""||$("#mail5").val()!=""){urltitle=$("#sendPage .urltitle").val();token=$("#sendPage .token").val();zzz=$("#sendPage .valid").val();$.ajax({url:"/couple/validate/"+zzz,type:"get",success:function(rs){$captcha_valid=rs;if($captcha_valid){$("#sendPage").children().fadeOut("slow");$("#sendPage").css({background:"transparent url('/images/form_loader.gif') 50% no-repeat"});$.ajax({url:"/couple/send_page/ajax",type:"post",data:{mail1:$("#sendPage #mail1").val(),mail2:$("#sendPage #mail2").val(),mail3:$("#sendPage #mail3").val(),mail4:$("#sendPage #mail4").val(),mail5:$("#sendPage #mail5").val(),token:$("#sendPage .token").val(),valid:$("#sendPage .valid").val(),urltitle:$("#sendPage .urltitle").val()},dataType:"html",success:function(data){$("#sendPage").css({background:"transparent"}).html(data)}})}else{alert(notvalid);$("#sendPage .valid").val("").css("background-color","#f6efc2");$.ajax({url:"/couple/make_captcha_img/"+token+"/ajax",success:function(captcha){data=captcha.split("|");$(".captcha").attr("src",data[0]);$(".hint").val(data[1])}});return false}}})}else{alert("At least one address cannot be empty")}return false})}if($("#sendMail").length>0){$("form#sendMail").submit(function(){if($("#name").val()!=""||$("#email").val()!=""||$("#message").val()!=""){token=$("#sendMail .token").val();zzz=$("#sendMail .valid").val();$.ajax({url:"/contact/validate/"+zzz,type:"get",success:function(rs){$captcha_valid=rs;if($captcha_valid){$("#form_block").css({background:"transparent url('/images/message_loader.gif') 50% no-repeat"}).children().fadeOut("slow");$.ajax({url:"/contact/send_msg/ajax",type:"post",data:{mail1:$("#sendMail #name").val(),mail2:$("#sendMail #email").val(),mail3:$("#sendMail #message").val(),token:$("#sendMail .token").val(),valid:$("#sendMail .valid").val(),reception:$("#sendMail #reception").val()},dataType:"html",success:function(x){x='<a href="contact" title="back">'+x+"</a> ";$("#form_block").css({background:"transparent"});$("#form_result").html(x).fadeIn("fast")}})}else{alert(notvalid);$("#sendMail .valid").val("").css("background-color","#f6efc2");$.ajax({url:"/contact/make_captcha_img/"+token+"/ajax",success:function(captcha){data=captcha.split("|");$(".captcha").attr("src",data[0]);$(".hint").val(data[1])}});return false}}})}else{alert("Please complete the form before submitting.")}return false})}if($(".jcarousel, .jcarousel2").length>0){$("#navi-left a").addClass("disabled");if($(".jcarousel").length>0){Svisible=3;Sscroll=3}else{Svisible=4;Sscroll=4}$(".slide").jCarouselLite({btnNext:"#navi-right a",btnPrev:"#navi-left a",visible:Svisible,scroll:Sscroll,easing:"easeinout",speed:1000,circular:false});$(".slide ul li").css({background:"transparent url('../images/frame_carousel.gif') no-repeat"});$(".slide a").click(function(){src=$(this).attr("href");dim=$(this).children().attr("class").split("x");width=dim[1];height=dim[2];fr_width=eval(dim[1])+34;fr_height=eval(dim[2])+34;p_height=$("#showcase_img .frame img").attr("height");$("#showcase_img .frame p").css({height:p_height+"px"});$("#showcase_img .frame img").fadeOut("fast",function(){$("#showcase_img .frame").animate({width:fr_width+"px",height:fr_height+"px"},200);$("#showcase_img .frame p").animate({width:width+"px",height:height+"px"},200);$("#showcase_img img").css({width:width+"px",height:height+"px"}).attr("src",src).load(function(){$(this).fadeIn("fast")})});return false})}});