(function($){
////CONFIGURATION
var WIDTH_BOOK=1100; //WIDTH BOOK
var HEIGHT_BOOK=777; //HEIGHT BOOK
var WINDOW_WIDTH; //WIDTH AREA [px]
var WINDOW_HEIGHT; //HEIGHT AREA [px]
var ZOOM_STEP = 0.06 //STEPS SIZE FOR ZOOM
var ZOOM_DOUBLE_CLICK_ENABLED=true; //ENABLED DOUBLE CLICK FOR ZOOM
var ZOOM_DOUBLE_CLICK=1 //ZOOM FOR DOUBLE CLICK
var GOTOPAGE_WIDTH=30; //WIDTH FOR INPUT FIELD
var IS_AS_TEMPLATE=true; //IF THIS TEMPLATE
var TOOL_TIP_VISIBLE=true //TOOLTIP VISIBLE
var SWF_ADDRESS=true; //SWF ADDRESS
var TOOLS_VISIBLE=true //TOOLBAR VISIBLE
if( TOOLS_VISIBLE == true ){
var TOOLS_HEIGHT=60;
}else{
var TOOLS_HEIGHT=0;
}
/* = event ready
--------------------------*/
$(window).ready( function(){
//event resize
$(window).bind('orientationchange resize', function(event){
Book_v5.book_area();
Book_v5.zoomAuto();
Book_v5.book_position();
Book_v5.dragdrop_init();
Book_v5.resize_page()
Book_v5.center($('#v5_lightbox'));
Book_v5.center_icon();
Book_v5.center_icon();
Book_v5.media_queries()
});
//start flipbook
Book_v5.ready();
});
/* = event load
--------------------------*/
$(window).load(function(){
Book_v5.load();
})
/* = set Page
--------------------------*/
setPage=function(nr_) {
if( SWF_ADDRESS == true ){
var results= $('#fb5-deeplinking ul li').eq( nr_-1 );
var address = results.attr('data-address');
setAddress(address);
}else{
$('#fb5-book').turn('page',nr_);
}
};
/* = set Address
--------------------------*/
setAddress=function(address_) {
$.address.value( address_ );
};
/* = show lightbox with video
--------------------------*/
youtube=function(id_,w_,h_) {
var w=w_;
var h=h_;
var id=id_;
$('body').prepend('
');
$(window).trigger('orientationchange');
$("#v5_lightbox").click(function(){
$(this).children().hide();
$(this).remove();
Book_v5.zoomAuto();
})
$("#v5_lightbox").css('display','block');
};
/* = FlipBook v5
--------------------------*/
var Book_v5 = {
toolsHeight:TOOLS_HEIGHT, //tools height
zoom:1, //zoom
page_padding:0.1,
paddingL:0.02,
paddingR:0.02,
paddingT:0.02,
paddingB:0.02,
currentPage:0,
ready: function(){
//preloader start
var preloader_visible="true";
if( preloader_visible=="true"){
$('.fb5-preloader').css('display','block');
}
WINDOW_WIDTH=$('#fb5').width();
WINDOW_HEIGHT=$('#fb5').height();
Book_v5.resize_input_text()
Book_v5.book_area();
$("#fb5").css('opacity','1');
/* SCALE PAGE IN FLIPBOOK /*/
//size default for class .fb5-cont-page-book
$("#fb5 .fb5-cont-page-book").css('width',(WIDTH_BOOK/2)+'px');
$("#fb5 .fb5-cont-page-book").css('height',HEIGHT_BOOK+'px');
$("#fb5 .fb5-cont-page-book").css({'transform-origin':'0 0','-ms-transform-origin':'0 0','-webkit-transform-origin':'0 0'});
//size default for class .page_book
var paddingL=WIDTH_BOOK*this.paddingL;
var paddingR=WIDTH_BOOK*this.paddingR;
var paddingT=WIDTH_BOOK*this.paddingT;
var paddingB=WIDTH_BOOK*this.paddingB;
$("#fb5 .fb5-page-book").css('width',(WIDTH_BOOK/2-(paddingL+paddingR))+'px');
$("#fb5 .fb5-page-book").css('height',(HEIGHT_BOOK-(paddingT+paddingB))+'px');
/* SCALE ABOUT near FLIPBOOK /*/
$("#fb5 #fb5-about").css('width',(WIDTH_BOOK/2)+'px');
$("#fb5 #fb5-about").css('height',HEIGHT_BOOK+'px');
$("#fb5 #fb5-about").css({'transform-origin':'0 0','-ms-transform-origin':'0 0','-webkit-transform-origin':'0 0'});
//run key
this.key_down();
//show and hide full screen icon
if(!$.support.fullscreen){
$('li a.fb5-fullscreen').parent(this).remove();
}
},
load: function(){
//preloader hide
$('.fb5-preloader').css('display','none');
$.address.strict(false)
$('#fb5-container-book').show();
Book_v5.init();
Book_v5.zoomAuto();
Book_v5.book_position();
Book_v5.dragdrop_init();
Navigation_v5.init();
Book_v5.resize_page();
if( TOOLS_VISIBLE == true ){
$("#fb5 #fb5-footer").css('opacity','1');
}
//center icon
Book_v5.center_icon();
Book_v5.center_icon();
Book_v5.media_queries()
},
center_icon:function(){
//icon tools position
var icon=$('#fb5-center');
var all_width=$('#fb5').width();
var left_w=$('#fb5-logo').width();
var center_w=$('#fb5-center').width();
var right_w=$('#fb5-right').width();
var posX=all_width/2-center_w/2;
icon.css('left',posX+'px');
},
media_queries:function (){
//center
var position_center=$('#fb5-center').position();
var xMax_center=position_center.left+$('#fb5-center').width();
var xMin_center=position_center.left
//right
var position_right=$('#fb5-right').position();
var xMin_right=position_right.left;
//left
var position_left=$('#fb5-logo').position();
var xMax_left=position_left.left+$('#fb5-logo').width();
if( xMax_center > xMin_right || xMax_left > xMin_center ){
$('#fb5 #fb5-right,#fb5 #fb5-logo').css('visibility','hidden');
}else{
$('#fb5 #fb5-right,#fb5 #fb5-logo').css('visibility','visible');
}
},
autoMarginB:function(){
return Math.round( $('#fb5').height()*0.02 )
},
autoMarginT:function(){
return Math.round( $('#fb5').height()*0.02 )
},
autoMarginL:function(){
return Math.round( $('#fb5').width()*0.02 )
},
autoMarginR:function(){
return Math.round( $('#fb5').width()*0.02 )
},
init: function() {
//this.on_start = true;
if( SWF_ADDRESS==true ){
/* = jQuery Addresss INIT
--------------------------*/
var current_address=$.address.pathNames();
var results=$('#fb5-deeplinking ul li[data-address='+current_address+']');
var index=results.index();
var nrPage = index+1;
if(!nrPage){
nrPage=1;
}
/* = jQuery Addresss CHANGE
--------------------------*/
$.address.change(function(event) {
var address=event.value;
var results=$('#fb5-deeplinking ul li[data-address='+address+']');
var index=results.index();
var nrPage=index+1;
if(!nrPage){
nrPage=1;
}
$('#fb5-book').turn('page',nrPage);
Book_v5.resize_page();
})
}
$('#fb5-book').turn({
display: 'double',
acceleration: true,
elevation:50,
page:nrPage,
when: {
first: function(e, page) {
$('.fb5-nav-arrow.prev').hide();
},
turned: function(e, page) {
if (page > 1) {
$('.fb5-nav-arrow.prev').fadeIn();
$('#fb5-about').hide();
}
if(page==1){
$('#fb5-about').css('z-index',11);
}
if ( page < $(this).turn('pages') ) {
$('.fb5-nav-arrow.next').fadeIn();
}
Book_v5.resize_page();
if(SWF_ADDRESS==true){
setPage(page);
}
},
turning: function(e, page) {
if (page < 2) {
$('#fb5-about').show();
}else{
$('#fb5-about').css('z-index',5);
}
},
last: function(e, page) {
$('.fb5-nav-arrow.next').hide();
}
}
});
Book_v5.arrows();
},
center: function (lightbox_) {
var iframe=$('iframe',lightbox_);
var old_w=iframe.attr("width");
var old_h=iframe.attr("height");
iframe.css("position","absolute");
var stage_w=$(window).width();
var stage_h=$(window).height();
var delta_w=stage_w-old_w;
var delta_h=stage_h-old_h
if(delta_w225){
height_container=225;
}
cont_thumbs.css('height',height_container+'px');
//position thumbs
var _top=( (area_height/2) - ( (cont_thumbs.outerHeight())/2 ) )
cont_thumbs.css('top',_top+'px');
var summary = 0;
var self = this;
var slider_width = $('#fb5-slider').width();
$('#fb5-slider').append('');
$('#fb5-slider li').each(function() {
li_width = $(this).outerWidth();
summary += li_width;
})
$('#fb5-slider').css('width', summary);
$("#fb5-menu-holder").mousemove(function(e) {
if ( $(this).width() < $("#fb5-slider").width() ) {
var distance = e.pageX - $(this).offset().left;
var percentage = distance / $(this).width();
var targetX = -Math.round(($("#fb5-slider").width() - $(this).width()) * percentage);
$('#fb5-slider').animate({left: [targetX+"px",'easeOutCubic'] }, { queue:false, duration: 200 });
}
});
//////////////////////SWIPE
if(self.events_thumbs!=1){
$('#fb5-all-pages .fb5-container-pages').bind("touchstart", function(e) {
$('#fb5-slider').stop();
//time
self.time_start=new Date().getTime();
self.time_move_old=self.time_start;
//road
self.x_start = e.originalEvent.targetTouches[0].pageX;
self.x_move_old=self.x_start;
});
$('#fb5-all-pages .fb5-container-pages').bind("touchmove", function(e) {
//current round and time
self.x_move = e.originalEvent.targetTouches[0].pageX;
self.time_move=new Date().getTime();
//time - delta
self.delta_t=new Date().getTime()-self.time_move_old;
self.time_move_old=new Date().getTime();
//round- delta
self.delta_s=self.x_move-self.x_move_old;
self.x_move_old=self.x_move;
//set position thumbs
self.current_x=parseInt( $('#fb5-slider').css('left') );
var new_position=self.current_x+self.delta_s;
if(new_position>0){ new_position=0 }
var minX=-summary+WINDOW_WIDTH;
if(new_position0){new_position=0}
var minX=-summary+WINDOW_WIDTH;
if(new_position 5){
$('#fb5-slider').animate({ left:[new_position+"px","easeOutCubic"] },t);
}
e.preventDefault(e);
});
//////////////////////end SWIPE
self.events_thumbs=1;
}
$('#fb5-slider li').click(function() {
self.x_start=null;
self.x_move=null;
$('#fb5-slider').stop();
var page_index = $(this).attr('class');
var tmp = parseInt(page_index);
close_overlay();
setPage(tmp);
//$('#fb5-book').turn('page', tmp);
})
$(document).click(function(e) {
var target = $(e.target);
if ( target.hasClass('fb5-overlay') ) close_overlay();
});
},
book_grab: function() {
if ($.browser.webkit) {
$('#fb5-container-book').css('cursor', '-webkit-grab');
}
if ($.browser.mozilla) {
$('#fb5-container-book').css('cursor', '-moz-grab');
}
if ($.browser.msie) {
$('#fb5-container-book').css('cursor', 'url(../img/openhand.cur)');
}
},
book_grabbing: function() {
if ($.browser.webkit) {
$('#fb5-container-book').css('cursor', '-webkit-grabbing');
}
if ($.browser.mozilla) {
$('#fb5-container-book').css('cursor', '-moz-grabbing');
}
if ($.browser.msie) {
$('#fb5-container-book').css('cursor', 'url(../img/closedhand.cur)');
}
},
book_area: function(){
var width_book=$('#fb5').width();
///if(IS_AS_TEMPLATE==true){
// var height=$(window).height()+"px";
//}else{
//var height=(width_book*HEIGHT_BOOK/WIDTH_BOOK)+this.toolsHeight+"px";
///}
if(IS_AS_TEMPLATE==true){
var height=$(window).height()+"px";
}else{
if( $('#fb5').hasClass('fullScreen') ){
var height=$(window).height()+"px";
}else{
var height=(width_book*HEIGHT_BOOK/WIDTH_BOOK)+this.toolsHeight+"px";
}
}
$("#fb5").css('height',height);
},
///current width book
widthBook: function(){
return $('#fb5-container-book').width();
},
//current height book
heightBook: function(){
return $('#fb5-container-book').height();
},
book_position: function() {
var book_height = this.heightBook();
var book_width = this.widthBook();
var half_height = ( (book_height/2)+this.toolsHeight/2 );
var half_width = ( book_width/2 );
var x=$('#fb5').width()/2-half_width;
var y=$('#fb5').height()/2-half_height;
$('#fb5-container-book').css({ left: x, top:y });
/*footer position/*/
var new_y=book_height+this.autoMarginT()+this.autoMarginB();
//$("#fb5-footer").css({top:new_y+'px'});
//$("#fb5").css('height',new_y+this.toolsHeight);
},
touchstart_book:function(e){
this.book_x = e.originalEvent.touches[0].pageX;
this.book_y = e.originalEvent.touches[0].pageY;
},
touchmove_book:function(e){
//delta x
this.book_x_delta=e.originalEvent.touches[0].pageX-this.book_x;
this.book_x=e.originalEvent.touches[0].pageX;
//delta y
this.book_y_delta=e.originalEvent.touches[0].pageY-this.book_y;
this.book_y=e.originalEvent.touches[0].pageY;
var current_x= parseInt( $('#fb5-container-book').css('left') )
var current_y= parseInt( $('#fb5-container-book').css('top') )
var x=current_x+this.book_x_delta;
var y=current_y+this.book_y_delta;
$('#fb5-container-book').css( {left:x,top:y } );
e.preventDefault();
//var t=e.originalEvent.changedTouches[0].pageX
//alert("move");
},
touchend_book:function(e){
},
drag: function(e) {
var el = $(this);
var dragged = el.addClass('draggable');
$('#fb5-container-book').unbind('mousemove', Book_v5.book_grab);
$('#fb5-container-book').bind('mousemove', Book_v5.book_grabbing);
var d_h = dragged.outerHeight();
var d_w = dragged.outerWidth();
var pos_y = dragged.offset().top + d_h - e.pageY;
var pos_x = dragged.offset().left + d_w - e.pageX;
dragged.parents().on("mousemove", function(e) {
$('.draggable').offset({
top:e.pageY + pos_y - d_h,
left:e.pageX + pos_x - d_w
});
});
e.preventDefault();
},
drop: function() {
Book_v5.book_grab();
$('#fb5-container-book').bind('mousemove', Book_v5.book_grab);
$('#fb5-container-book').removeClass('draggable');
},
checkScrollBook: function () {
var vertical=$('#fb5-book').height() > $("#fb5").height() - this.toolsHeight;
var horizontal=$('#fb5-book').width() > $("#fb5").width() - (this.arrow_width*2);
if ( vertical || horizontal ) {
higherThanWindow = true;
} else {
higherThanWindow = false;
}
return higherThanWindow;
},
dragdrop_init: function() {
this.checkScrollBook();
if ( higherThanWindow == false ) {
//mobile
$('#fb5-container-book').unbind('touchstart', Book_v5.touchstart_book);
$('#fb5-container-book').unbind('touchmove', Book_v5.touchmove_book);
$('#fb5-container-book').unbind('touchend', Book_v5.touchend_book);
$('#fb5-container-book').unbind('mousedown', Book_v5.drag);
$('#fb5-container-book').unbind('mouseup', Book_v5.drop);
$('#fb5-container-book').unbind('mousemove', Book_v5.book_grab);
$('#fb5-container-book').unbind('mousemove', Book_v5.book_grabbing);
$('#fb5-container-book').css('cursor', 'default');
} else {
//mobile
$('#fb5-container-book').bind('touchstart', Book_v5.touchstart_book);
$('#fb5-container-book').bind('touchmove', Book_v5.touchmove_book);
$('#fb5-container-book').bind('touchend', Book_v5.touchend_book);
$('#fb5-container-book').bind('mousedown', Book_v5.drag);
$('#fb5-container-book').bind('mouseup', Book_v5.drop);
$('#fb5-container-book').bind('mousemove', Book_v5.book_grab);
Book_v5.book_grab();
}
Book_v5.resize_page();
},
scaleStart: function() {
//if ( this.on_start == true ) {
this.checkScrollBook();
//this.on_start = false;
//}
},
setSize:function(w_,h_){
$('#fb5-container-book').css({ width:w_, height:h_ });
$('#fb5-book').turn('size',w_,h_);
},
zoomTo:function(zoom_){
this.zoom=zoom_;
var new_width=(WIDTH_BOOK*this.zoom);
var new_height=(HEIGHT_BOOK*this.zoom);
this.setSize(new_width,new_height);
this.scale_arrows()
this.book_position();
Book_v5.dragdrop_init();
Book_v5.resize_page()
},
zoomOriginal:function(){
this.zoomTo(1);
},
scale_arrows:function(){
var HEIGHT_ARROW=136;
var WIDTH_ARROW=34;
var height_arrow=this.heightBook()*0.45;
if( height_arrow > 136 ){
height_arrow=136;
}
var width_arrow= (height_arrow*WIDTH_ARROW)/HEIGHT_ARROW;
this.zoom_arrows=height_arrow/HEIGHT_ARROW;
$('.fb5-nav-arrow').css({'transform':'scale('+this.zoom_arrows+')','-ms-transform':'scale('+this.zoom_arrows+')','-webkit-transform':'scale('+this.zoom_arrows+')'});
},
zoomAuto: function() {
Book_v5.scaleStart();
////resize one
var zoom=this.getAutoZoomBook(0);
this.zoomTo( zoom )
////resize two (with arrow)
this.scale_arrows();
var arrow_width=$('.fb5-nav-arrow').width()*this.zoom_arrows;
this.arrow_width=arrow_width;
var zoom=this.getAutoZoomBook(arrow_width*2);
//calculate optimal zoom
zoom=Math.round(zoom * 100) / 100
var percent=zoom*100;
if(percent%2!=0){
zoom=zoom-0.01;
}
this.zoomTo( zoom )
Book_v5.resize_page()
},
getAutoZoomBook: function(arrow_width_){
var book_width=this.widthBook();
var book_height=this.heightBook();
var screen_width = $("#fb5").width()- ( this.autoMarginL()+this.autoMarginR() + (arrow_width_) );
var screen_height = $("#fb5").height()-this.toolsHeight-( this.autoMarginT()+this.autoMarginB() )
if(screen_width>WIDTH_BOOK){
screen_width=WIDTH_BOOK
}
if(screen_height>HEIGHT_BOOK){
screen_height=HEIGHT_BOOK
}
var scaleW=screen_width/book_width;
var scaleH=screen_height/book_height;
var scale=Math.min(scaleW,scaleH)
var new_width = book_width*scale;
var new_height = book_height*scale;
var auto_zoom= new_width/WIDTH_BOOK
return auto_zoom;
},
zoomIn: function() {
var zoom=this.zoom;
this.zoomTo(zoom+ZOOM_STEP );
},
zoomOut: function() {
this.zoomTo( this.zoom-ZOOM_STEP );
},
resize_page: function (){
/* RESIZE PAGE IN FLIPBOOK /*/
//resize class .fb5-page-book
var page_width=this.widthBook()/2;
var width_current_page=(page_width)
var width_orginal_page= ( WIDTH_BOOK/2 )
var zoom= (width_current_page / width_orginal_page);
$('.fb5-cont-page-book').css({'transform':'scale('+zoom+')','-ms-transform':'scale('+zoom+')','-webkit-transform':'scale('+zoom+')'});
///center class .fb5-page-book
var paddingL=(this.widthBook()*this.paddingL)/zoom;
var paddingT=(this.widthBook()*this.paddingT)/zoom;
$('.fb5-page-book').css({'left':paddingL+'px','top':paddingT+'px'});
/* RESIZE ABOUT IN FLIPBOOK /*/
$('#fb5-about').css({'transform':'scale('+zoom+')','-ms-transform':'scale('+zoom+')','-webkit-transform':'scale('+zoom+')'});
//padding top
var padding_top=(this.heightBook()*0.05);
$('#fb5-about').css('top',padding_top+'px');
//height
var height=(this.heightBook()-( padding_top*2) )/zoom;
$('#fb5-about').css('height',height+'px');
//width
var width=( (this.widthBook()/2)-( this.widthBook()*0.05 ) )/zoom;
$('#fb5-about').css('width',width+'px');
},
resize_font: function($size_original_,path_){
var w=this.widthBook();
var size= ($size_original_*w)/WIDTH_BOOK;
var new_size=Math.round(parseInt(size))+"px";
///$(path_).css('font-size',new_size);
///$(path_).css('line-height',new_size);
$(path_).css('font-size',$size_original_+"px");
$(path_).css('line-height',$size_original_+"px");
}
}
/* = Navigation
--------------------------*/
var Navigation_v5 = {
tooltip: function() {
$('.fb5-menu li').filter(':not(.fb5-goto)').each(function() {
var description = $('a', this).attr('title');
var tooltip = ''+description+'';
$('a', this).removeAttr("title");
$(this).append(tooltip);
});
$('.fb5-menu li').mousemove(function(e) {
var tooltip=$('.fb5-tooltip', this);
var offset = $(this).offset();
var relY = e.pageY - offset.top;
var x2= e.pageX-$('#fb5').offset().left+tooltip.width()
var width_area=$('#fb5').width()
if( (x2+10)>width_area){
var orient="right";
}else{
var orient="left";
}
if(orient=="left"){
var relX = e.pageX - offset.left;
$('#fb5 .fb5-tooltip b').css('left','6px')
}else{
var relX = e.pageX - offset.left-tooltip.width()-5;
$('#fb5 .fb5-tooltip b').css('left',(tooltip.width()+6)+'px')
}
//$('.fb5-tooltip', this).html( x2+" > "+width_area );
$('.fb5-tooltip', this).css({ left: relX, top: relY-45 });
})
$('.fb5-menu li').hover(function() {
$('.fb5-tooltip').stop();
$('.fb5-tooltip', this).fadeIn();
}, function() {
$('.fb5-tooltip').hide();
});
Book_v5.resize_page()
},
///event mouse down in book
book_mouse_down: function(){
$('#fb5-about').css('z-index',5);
},
book_mouse_up: function(e){
var offset = $(this).offset();
var relativeX = (e.pageX - offset.left);
if( relativeX > ( WIDTH_BOOK / 2 ) ){
$('#fb5-about').css('z-index',11);
}
},
init: function() {
// Double Click
if(ZOOM_DOUBLE_CLICK_ENABLED==true){
$('#fb5-container-book').dblclick(function() {
if(Book_v5.checkScrollBook()==false){ //zoom
Book_v5.zoomTo(ZOOM_DOUBLE_CLICK)
}else{
Book_v5.zoomAuto();
$('#fb5-container-book').css('cursor', 'default');
}
});
}
//full screen
$('.fb5-fullscreen').on('click', function() {
$('.fb5-tooltip').hide();
$('#fb5').fullScreen({
'callback': function(isFullScreen){
Book_v5.book_area();
Book_v5.zoomAuto();
Book_v5.center_icon();
if(isFullScreen){
}else{
}
}
});
e.preventDefault();
});
// Home
$('.fb5-home').on('click', function() {
setPage(1);
});
// Zoom Original
$('.fb5-zoom-original').click(function() {
Book_v5.zoomOriginal();
});
// Zoom Auto
$('.fb5-zoom-auto').on('click', function() {
Book_v5.zoomAuto();
});
// Zoom In
$('.fb5-zoom-in').on('click', function() {
Book_v5.zoomIn();
});
// Zoom Out
$('.fb5-zoom-out').on('click', function() {
Book_v5.zoomOut();
});
// All Pages
$('.fb5-show-all').on('click', function() {
$('#fb5-all-pages').
addClass('active').
css('opacity', 0).
animate({ opacity: 1 }, 1000);
Book_v5.all_pages();
return false;
})
// Goto Page
$('#fb5-page-number').keydown(function(e) {
if (e.keyCode == 13) {
setPage( $('#fb5-page-number').val() );
}
});
$('.fb5-goto button').click(function(e) {
setPage( $('#fb5-page-number').val() );
});
// Contact
$('.contact').click(function() {
$('#fb5-contact').addClass('active').animate({ opacity: 1 }, 1000);
contact_form();
clear_on_focus();
return false;
})
//change z-index in about
$('#fb5-book').bind('mousedown',this.book_mouse_down);
$('#fb5-book').bind('mouseup',this.book_mouse_up);
if (Book_v5.isiPhone()) {//for IPhone
$('#fb5-book').bind('touchstart',this.book_mouse_down);
$('#fb5-book').bind('touchend',this.book_mouse_up);
}
//show tooltip for icon
if ( !Book_v5.isiPhone() && TOOL_TIP_VISIBLE==true ) {
this.tooltip();
}
}
}
/* = CONTACT FORM
--------------------------*/
function clear_on_focus() {
$('input[type="text"], input[type="password"], textarea').each( function() {
var startValue = $(this).val();
$.data(this, "startValue", startValue);
this.value=startValue;
})
$('input[type="text"], input[type="password"], textarea').focus(function() {
var startValue = $.data(this, "startValue");
if ( this.value == startValue ) {
this.value = '';
}
});
$('input[type="text"], input[type="password"], textarea').blur(function() {
var startValue = $.data(this, "startValue");
if ( this.value == '' ) {
this.value = startValue;
}
})
}
function close_overlay() {
$('.fb5-overlay').removeClass('active');
}
function contact_form() {
$('#fb5-contact .req').each(function() {
var startValue = $(this).val();
$.data(this, "startValue", startValue);
});
$('#fb5-contact button[type="submit"]').click(function() {
$('#fb5-contact .req').removeClass('fb5-error');
$('#fb5-contact button').fadeOut('fast');
var isError = 0;
// Get the data from the form
var name = $('#fb5-contact #fb5-form-name').val();
var email = $('#fb5-contact #fb5-form-email').val();
var message = $('#fb5-contact #fb5-form-message').val();
// Validate the data
$('#fb5-contact .req').each(function() {
var startValue = jQuery.data(this, "startValue");
if ( ($(this).val() == '') || (this.value == startValue) ) {
$(this).addClass('fb5-error');
isError = 1;
}
});
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
if (reg.test(email)==false) {
$('#fb5-contact #fb5-form-email').addClass('fb5-error');
isError=1;
}
// Terminate the script if an error is found
if (isError == 1) {
$('#fb5-contact button').fadeIn('fast');
return false;
}
$.ajaxSetup ({
cache: false
});
var _email="johnh@goodholidayideas.com";
var dataString = 'name='+ name + '&email=' + email + '&message=' + message+'&_email='+_email;
$.ajax({
type: "POST",
url: "https://www.goodskiguide.com/wp-content/plugins/jquery_flipbook_v5.5/flipbook/php/submit-form-ajax.php",
data: dataString,
success: function(msg) {
// Check to see if the mail was successfully sent
if (msg == 'Mail sent') {
$("#fb5-contact fieldset").hide();
$("#fb5-contact fieldset.fb5-thanks").show();
setTimeout(function() {
close_overlay();
}, 5000);
} else {
$('#fb5-contact button').fadeIn('fast');
alert('The problem with sending it, please try again!');
}
},
error: function(ob,errStr) {
alert('The problem with sending it, please try again.');
}
});
return false;
});
$('#fb5-contact .fb5-close').click(function() {
close_overlay();
})
}
/*
* $ Easing v1.3 - http://gsgd.co.uk/sandbox/$/easing/
*
* Uses the built in easing capabilities added In $ 1.1
* to offer multiple easing options
*/
$.easing["jswing"]=$.easing["swing"];$.extend($.easing,{def:"easeOutQuad",swing:function(a,b,c,d,e){return $.easing[$.easing.def](a,b,c,d,e)},easeInQuad:function(a,b,c,d,e){return d*(b/=e)*b+c},easeOutQuad:function(a,b,c,d,e){return-d*(b/=e)*(b-2)+c},easeInOutQuad:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b+c;return-d/2*(--b*(b-2)-1)+c},easeInCubic:function(a,b,c,d,e){return d*(b/=e)*b*b+c},easeOutCubic:function(a,b,c,d,e){return d*((b=b/e-1)*b*b+1)+c},easeInOutCubic:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b+c;return d/2*((b-=2)*b*b+2)+c},easeInQuart:function(a,b,c,d,e){return d*(b/=e)*b*b*b+c},easeOutQuart:function(a,b,c,d,e){return-d*((b=b/e-1)*b*b*b-1)+c},easeInOutQuart:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b*b+c;return-d/2*((b-=2)*b*b*b-2)+c},easeInQuint:function(a,b,c,d,e){return d*(b/=e)*b*b*b*b+c},easeOutQuint:function(a,b,c,d,e){return d*((b=b/e-1)*b*b*b*b+1)+c},easeInOutQuint:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b*b*b+c;return d/2*((b-=2)*b*b*b*b+2)+c},easeInSine:function(a,b,c,d,e){return-d*Math.cos(b/e*(Math.PI/2))+d+c},easeOutSine:function(a,b,c,d,e){return d*Math.sin(b/e*(Math.PI/2))+c},easeInOutSine:function(a,b,c,d,e){return-d/2*(Math.cos(Math.PI*b/e)-1)+c},easeInExpo:function(a,b,c,d,e){return b==0?c:d*Math.pow(2,10*(b/e-1))+c},easeOutExpo:function(a,b,c,d,e){return b==e?c+d:d*(-Math.pow(2,-10*b/e)+1)+c},easeInOutExpo:function(a,b,c,d,e){if(b==0)return c;if(b==e)return c+d;if((b/=e/2)<1)return d/2*Math.pow(2,10*(b-1))+c;return d/2*(-Math.pow(2,-10*--b)+2)+c},easeInCirc:function(a,b,c,d,e){return-d*(Math.sqrt(1-(b/=e)*b)-1)+c},easeOutCirc:function(a,b,c,d,e){return d*Math.sqrt(1-(b=b/e-1)*b)+c},easeInOutCirc:function(a,b,c,d,e){if((b/=e/2)<1)return-d/2*(Math.sqrt(1-b*b)-1)+c;return d/2*(Math.sqrt(1-(b-=2)*b)+1)+c},easeInElastic:function(a,b,c,d,e){var f=1.70158;var g=0;var h=d;if(b==0)return c;if((b/=e)==1)return c+d;if(!g)g=e*.3;if(h