$.extend({ myDialog: function(str){ var dialog = "#" + str; $(dialog).dialog({ autoOpen: true, resizable: false, draggable: false, width: "auto", height: "auto", modal: true }); } }); $(document).ready(function(){ // Selects $(".select-content").width($(".select-content").prev().width()); $(".select").live("click",function(e){ e.stopPropagation(); $(this).next().width($(this).width()-1); $(this).addClass("selected"); $(this).next().addClass("show"); }); $(".select-option").live("click",function(e) { $(this).parent().nextAll(".select-option-value:first").attr("rel",$(this).attr("rel")); $(this).parent().nextAll(".select-option-value:first").val($(this).val()).trigger("change"); $(this).parent().prev().html("" + $(this).val()); }); $(document).live("click",function(e) { $(".select").each(function(index,item){ $(item).removeClass("selected"); $(item).next().removeClass("show"); }); }); // Placeholding inputs $(".placeholding-input").live("keyup",function(){ if($(this).children("input").is("input")) { if($(this).children("input").val().length > 0) { $(this).addClass("hasome"); } else { $(this).removeClass("hasome"); } } else if($(this).children("textarea").is("textarea")){ if($(this).children("textarea").val().length > 0) { $(this).addClass("hasome"); } else { $(this).removeClass("hasome"); } } }); $(".placeholder").live("click",function(){ $(this).prev().trigger("class").trigger("focus"); }); // Fancybox $("a.pdf").live("click", function(){ $.fancybox({ hideOnOverlayClick: false, overlayShow: false, titleShow: false, padding: 0, width: 1000, height: 750, href: this.href, type: "iframe" }); return false; }); $("a.youtube").live("click", function(){ $.fancybox({ hideOnOverlayClick: false, overlayShow: false, titleShow: false, padding: 0, width: 640, height: 385, href: this.href, type: "youtube", autoScale: false }); return false; }); $("a.image").live("click",function(e){ $.fancybox({ hideOnOverlayClick: false, overlayShow: false, titleShow: false, href: this.href, padding: 0 }); return false; }); $("a.gallery").fancybox({ hideOnOverlayClick: false, overlayShow: false, titleShow: false, href: this.href, padding: 0 }); $("a.full-image").live("click",function(e){ $.fancybox({ hideOnOverlayClick: false, overlayShow: false, titleShow: false, href: this.href, padding: 0, titleShow: true, titlePosition: "over", title: $(this).next().html() }); return false; }); $("a.map").live("click",function(e){ $.fancybox({ hideOnOverlayClick: false, overlayShow: false, autoScale: false, width: 800, height: 600, padding: 0, href: this.href, type: "iframe", titleShow: false }); return false; }); });