function addToFavourites(id) { var request = $.ajax({ url: "/ajax/favourite_breeds.php", type: "POST", data: {action:'add', id : id}, dataType: "html" }); request.done(function(msg) { if (msg=='1') { var button = "#breed_like_button_"+id; $(button).removeClass('breed_like_button_off').addClass('breed_like_button_on'); $(button).html('
Added to favorites
'); $(button).attr('onclick','removeFromFavourites('+id+')'); } }); } /* --------------------------------------------------------------------------------------- */ function removeFromFavourites(id) { var request = $.ajax({ url: "/ajax/favourite_breeds.php", type: "POST", data: {action:'remove', id : id}, dataType: "html" }); request.done(function(msg) { if (msg=='1') { var button = "#breed_like_button_"+id; $(button).removeClass('breed_like_button_on').addClass('breed_like_button_off'); $(button).html('
Add to favorites
'); $(button).attr('onclick','removeFromFavourites('+id+')'); } }); } /* --------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------- */ function resetBreedForm(form_id) { if (form_id=='general') { $(".options_button").removeClass('options_button').addClass('options_button_inactive'); $("#fur1").removeClass("fur_color_1_active").addClass("fur_color_1"); $("#fur2").removeClass("fur_color_2_active").addClass("fur_color_2"); $("#fur3").removeClass("fur_color_3_active").addClass("fur_color_3"); $("#fur4").removeClass("fur_color_4_active").addClass("fur_color_4"); $("#fur5").removeClass("fur_color_5_active").addClass("fur_color_5"); $("#fur6").removeClass("fur_color_6_active").addClass("fur_color_6"); $("#fur7").removeClass("fur_color_7_active").addClass("fur_color_7"); reloadBreedsWithOptions(0); } if(form_id=='behaviour') { $("#intelligence").slider("value", 1, 5); $("#trainability").slider("value", 1, 5); $("#family_friendly").slider("value", 1, 5); $("#dog_friendly").slider("value", 1, 5); $("#guard_dog").slider("value", 1, 5); $("#agressiveness").slider("value", 1, 5); $("#tendency_to_bark").slider("value", 1, 5); $("#amount_of_shedding").slider("value", 1, 5); $("#exercise_needed").slider("value", 1, 5); $("#affection").slider("value", 1, 5); $("#space_needed").slider("value", 1, 5); $("#playfulness").slider("value", 1, 5); $("#energy").slider("value", 1, 5); reloadBreedsWithOptions(0); } else { $(".options_button").removeClass('options_button').addClass('options_button_inactive'); reloadBreedsWithOptions(0); } } /* --------------------------------------------------------------------------------------- */ function updatePosition() { pinMenuToTop(); var scrolltop = $("body").scrollTop(); if (scrolltop==0) { scrolltop = $("html").scrollTop(); } if (scrolltop > 350) { $("#back_to_top").css('display','block'); } else { $("#back_to_top").css('display','none'); } var updating = $("#updating").val(); var stop_loadmore = $("#stop_loadmore").val(); var stop2loadmore = $("#stoploadmore2").length; if(stop2loadmore == 1) {stop_loadmore = 1; }; if ((updating=='0') && (stop_loadmore=='0')) { var screen_height = $("#container_test").height() + 255; $("#screen_height").val(screen_height); var offset_top = $("body").scrollTop(); if (offset_top==0) { offset_top = $("html").scrollTop(); } $("#position").val(offset_top); var percentage = (parseInt(offset_top) / parseInt(screen_height)) * 100; percentage = Math.floor(percentage); if (percentage>70) { $("#updating").val("1"); reloadBreedsWithOptions(1); } } } /* --------------------------------------------------------------------------------------- */ function jumpToTop() { $('html, body').animate({ scrollTop: 0 }, 500); $("#back_to_top").css('display','none'); } /* --------------------------------------------------------------------------------------- */ function hideAttributes(id) { $("#attributes_"+id).stop().animate({top:150}); } /* --------------------------------------------------------------------------------------- */ function filterSelected(id,value) { var div = $("#"+id); $("#stop_loadmore").val(0); if (div.hasClass('options_button_inactive')) { div.removeClass('options_button_inactive').addClass('options_button'); } else if (div.hasClass('options_button')) { div.removeClass('options_button').addClass('options_button_inactive'); } reloadBreedsWithOptions(0); } /* --------------------------------------------------------------------------------------- */ function furColorSelected(id) { var div = $("#fur"+id); if (div.hasClass('fur_color_'+id)) { div.removeClass('fur_color_'+id).addClass('fur_color_'+id+'_active'); } else if (div.hasClass('fur_color_'+id+'_active')) { div.removeClass('fur_color_'+id+'_active').addClass('fur_color_'+id); } reloadBreedsWithOptions(0); } /* --------------------------------------------------------------------------------------- */ function reloadBreedsWithOptions(loadmore) { var intelligence = $("#intelligence").val(); var trainability = $("#trainability").val(); var family_friendly = $("#family_friendly").val(); var dog_friendly = $("#dog_friendly").val(); var guard_dog = $("#guard_dog").val(); var exercise_needed = $("#exercise_needed").val(); var affection = $("#affection").val(); var space_needed = $("#space_needed").val(); var playfulness = $("#playfulness").val(); var energy = $("#energy").val(); var agressiveness = $("#agressiveness").val(); var tendency_to_bark = $("#tendency_to_bark").val(); var amount_of_shedding = $("#amount_of_shedding").val(); var breed_type = ''; if (($("#breed_type_1").hasClass('options_button')) && ($("#breed_type_2").hasClass('options_button'))) { breed_type = 'both'; } else if ($("#breed_type_1").hasClass('options_button')) { breed_type = 'pure'; } else if ($("#breed_type_2").hasClass('options_button')) { breed_type = 'hybrid'; } if (breed_type=='') { breed_type='none' } var breed_size = ''; if ($("#breed_size_1").hasClass('options_button')) { breed_size = breed_size + 'small;'; } if ($("#breed_size_2").hasClass('options_button')) { breed_size = breed_size + 'medium;'; } if ($("#breed_size_3").hasClass('options_button')) { breed_size = breed_size + 'large;'; } if (breed_size=='') { breed_size='none' } var fur_type = ''; if (($("#fur_type_1").hasClass('options_button')) && ($("#fur_type_2").hasClass('options_button'))) { fur_type = 'both'; } else if ($("#fur_type_1").hasClass('options_button')) { fur_type = 'straight'; } else if ($("#fur_type_2").hasClass('options_button')) { fur_type = 'curly'; } if (fur_type=='') { fur_type='none' } var snout_length = ''; if (($("#snout_length_1").hasClass('options_button')) && ($("#snout_length_2").hasClass('options_button'))) { snout_length = 'both'; } else if ($("#snout_length_1").hasClass('options_button')) { snout_length = 'long'; } else if ($("#snout_length_2").hasClass('options_button')) { snout_length = 'short'; } if (snout_length=='') { snout_length='none' } var breed_group = ''; if ($("#breed_group_1").hasClass('options_button')) { breed_group = breed_group + 'herding;'; } if ($("#breed_group_2").hasClass('options_button')) { breed_group = breed_group + 'hound;'; } if ($("#breed_group_3").hasClass('options_button')) { breed_group = breed_group + 'nonsporting;'; } if ($("#breed_group_4").hasClass('options_button')) { breed_group = breed_group + 'sporting;'; } if ($("#breed_group_5").hasClass('options_button')) { breed_group = breed_group + 'terrier;'; } if ($("#breed_group_6").hasClass('options_button')) { breed_group = breed_group + 'toy;'; } if ($("#breed_group_7").hasClass('options_button')) { breed_group = breed_group + 'working;'; } if (breed_group=='') { breed_group='none' } var talents = ''; if ($("#talents_1").hasClass('options_button')) { talents = talents + 'agility;'; } if ($("#talents_2").hasClass('options_button')) { talents = talents + 'carting;'; } if ($("#talents_3").hasClass('options_button')) { talents = talents + 'competitive_obedience;'; } if ($("#talents_4").hasClass('options_button')) { talents = talents + 'guarding;'; } if ($("#talents_5").hasClass('options_button')) { talents = talents + 'herding;'; } if ($("#talents_6").hasClass('options_button')) { talents = talents + 'hunting;'; } if ($("#talents_7").hasClass('options_button')) { talents = talents + 'jogging;'; } if ($("#talents_8").hasClass('options_button')) { talents = talents + 'lure_coursing;'; } if ($("#talents_9").hasClass('options_button')) { talents = talents + 'military_work;'; } if ($("#talents_10").hasClass('options_button')) { talents = talents + 'narcotics_detection;'; } if ($("#talents_11").hasClass('options_button')) { talents = talents + 'obedience;'; } if ($("#talents_12").hasClass('options_button')) { talents = talents + 'police_work;'; } if ($("#talents_13").hasClass('options_button')) { talents = talents + 'racing;'; } if ($("#talents_14").hasClass('options_button')) { talents = talents + 'retrieving;'; } if ($("#talents_15").hasClass('options_button')) { talents = talents + 'search_and_rescue;'; } if ($("#talents_16").hasClass('options_button')) { talents = talents + 'schutzhund;'; } if ($("#talents_17").hasClass('options_button')) { talents = talents + 'sighting;'; } if ($("#talents_18").hasClass('options_button')) { talents = talents + 'sledding;'; } if ($("#talents_19").hasClass('options_button')) { talents = talents + 'tracking;'; } if ($("#talents_20").hasClass('options_button')) { talents = talents + 'tricks;'; } if ($("#talents_21").hasClass('options_button')) { talents = talents + 'watchdog;'; } if ($("#talents_22").hasClass('options_button')) { talents = talents + 'weight_pulling;'; } if (talents=='') { talents='none' } var origins = ''; if ($("#origins_1").hasClass('options_button')) { origins = origins + 'american;'; } if ($("#origins_2").hasClass('options_button')) { origins = origins + 'australian;'; } if ($("#origins_3").hasClass('options_button')) { origins = origins + 'belgian;'; } if ($("#origins_4").hasClass('options_button')) { origins = origins + 'canadian;'; } if ($("#origins_5").hasClass('options_button')) { origins = origins + 'chinese;'; } if ($("#origins_6").hasClass('options_button')) { origins = origins + 'egyptian;'; } if ($("#origins_7").hasClass('options_button')) { origins = origins + 'english;'; } if ($("#origins_8").hasClass('options_button')) { origins = origins + 'french;'; } if ($("#origins_9").hasClass('options_button')) { origins = origins + 'german;'; } if ($("#origins_10").hasClass('options_button')) { origins = origins + 'hungarian;'; } if ($("#origins_11").hasClass('options_button')) { origins = origins + 'irish;'; } if ($("#origins_12").hasClass('options_button')) { origins = origins + 'italian;'; } if ($("#origins_13").hasClass('options_button')) { origins = origins + 'japanese;'; } if ($("#origins_14").hasClass('options_button')) { origins = origins + 'norwegian;'; } if ($("#origins_15").hasClass('options_button')) { origins = origins + 'russian;'; } if ($("#origins_16").hasClass('options_button')) { origins = origins + 'scottish;'; } if ($("#origins_17").hasClass('options_button')) { origins = origins + 'welsh;'; } if (origins=='') { origins='none' } var breed_fur_length = ''; if (($("#breed_fur_length_1").hasClass('options_button')) && ($("#breed_fur_length_2").hasClass('options_button'))) { breed_fur_length = 'both'; } else if ($("#breed_fur_length_1").attr('class')=='options_button') { breed_fur_length = 'short'; } else if ($("#breed_fur_length_2").attr('class')=='options_button') { breed_fur_length = 'long'; } else { breed_fur_length = 'none'; } var fur_color = ''; if ($("#fur1").hasClass('fur_color_1_active')) { fur_color = fur_color+'1;'; } if ($("#fur2").hasClass('fur_color_2_active')) { fur_color = fur_color+'2;'; } if ($("#fur3").hasClass('fur_color_3_active')) { fur_color = fur_color+'3;'; } if ($("#fur4").hasClass('fur_color_4_active')) { fur_color = fur_color+'4;'; } if ($("#fur5").hasClass('fur_color_5_active')) { fur_color = fur_color+'5;'; } if ($("#fur6").hasClass('fur_color_6_active')) { fur_color = fur_color+'6;'; } if ($("#fur7").hasClass('fur_color_7_active')) { fur_color = fur_color+'7;'; } if (fur_color=='') { fur_color = 'none'; } if (loadmore==0) { displayOverlay(); var start = 0; } else { displayLoader(); var start = $("#start").val(); } var request = $.ajax({ url: "/ajax/get_breeds.php", type: "POST", data: { action: 'getListOfBreeds', intelligence: intelligence, trainability: trainability, family_friendly: family_friendly, dog_friendly: dog_friendly, guard_dog: guard_dog, exercise_needed: exercise_needed, affection: affection, space_needed: space_needed, playfulness: playfulness, energy: energy, agressiveness: agressiveness, tendency_to_bark: tendency_to_bark, amount_of_shedding: amount_of_shedding, breed_size: breed_size, breed_type: breed_type, fur_color: fur_color, origins: origins, fur_type: fur_type, talents: talents, breed_group: breed_group, snout_length: snout_length, breed_fur_length: breed_fur_length, start: start }, dataType: "html" }); request.done(function(msg) { if (loadmore==0) { var string=msg.split("[x]"); if (string[0]!='') { $("#stop_loadmore").val(0); $("#breeds_counter").css('display','block'); $("#breeds_counter_number").html(string[0]); } setTimeout(function(){ hideOverlay(); $("#breeds_left").html(string[1]); $("#updating").val(0); if (string[0]!='') { $("#breeds_counter").css('display','none'); } },1500); } else { var string=msg.split("[x]"); hideLoader(); $("#breeds_left").append(string[1]); $("#updating").val(0); } }); } /* --------------------------------------------------------------------------------------- */ function loadPagination() { var start = $("#start").val(); var intelligence = $("#intelligence").val(); var trainability = $("#trainability").val(); var family_friendly = $("#family_friendly").val(); var dog_friendly = $("#dog_friendly").val(); var guard_dog = $("#guard_dog").val(); var exercise_needed = $("#exercise_needed").val(); var affection = $("#affection").val(); var space_needed = $("#space_needed").val(); var playfulness = $("#playfulness").val(); var energy = $("#energy").val(); var agressiveness = $("#agressiveness").val(); var tendency_to_bark = $("#tendency_to_bark").val(); var amount_of_shedding = $("#amount_of_shedding").val(); var breed_type = ''; if (($("#breed_type_1").hasClass('options_button')) && ($("#breed_type_2").hasClass('options_button'))) { breed_type = 'both'; } else if ($("#breed_type_1").hasClass('options_button')) { breed_type = 'pure'; } else if ($("#breed_type_2").hasClass('options_button')) { breed_type = 'hybrid'; } if (breed_type=='') { breed_type='none' } var breed_size = ''; if ($("#breed_size_1").hasClass('options_button')) { breed_size = breed_size + 'small;'; } if ($("#breed_size_2").hasClass('options_button')) { breed_size = breed_size + 'medium;'; } if ($("#breed_size_3").hasClass('options_button')) { breed_size = breed_size + 'large;'; } if (breed_size=='') { breed_size='none' } var breed_group = ''; if ($("#breed_group_1").hasClass('options_button')) { breed_group = breed_group + 'herding;'; } if ($("#breed_group_2").hasClass('options_button')) { breed_group = breed_group + 'hound;'; } if ($("#breed_group_3").hasClass('options_button')) { breed_group = breed_group + 'nonsporting;'; } if ($("#breed_group_4").hasClass('options_button')) { breed_group = breed_group + 'sporting;'; } if ($("#breed_group_5").hasClass('options_button')) { breed_group = breed_group + 'terrier;'; } if ($("#breed_group_6").hasClass('options_button')) { breed_group = breed_group + 'toy;'; } if ($("#breed_group_7").hasClass('options_button')) { breed_group = breed_group + 'working;'; } if (breed_group=='') { breed_group='none' } var fur_type = ''; if (($("#fur_type_1").hasClass('options_button')) && ($("#fur_type_2").hasClass('options_button'))) { fur_type = 'both'; } else if ($("#fur_type_1").hasClass('options_button')) { fur_type = 'straight'; } else if ($("#fur_type_2").hasClass('options_button')) { fur_type = 'curly'; } if (fur_type=='') { fur_type='none' } var snout_length = ''; if (($("#snout_length_1").hasClass('options_button')) && ($("#snout_length_2").hasClass('options_button'))) { snout_length = 'both'; } else if ($("#snout_length_1").hasClass('options_button')) { snout_length = 'short'; } else if ($("#snout_length_2").hasClass('options_button')) { snout_length = 'long'; } if (snout_length=='') { snout_length='none' } var talents = ''; if ($("#talents_1").hasClass('options_button')) { talents = talents + 'agility;'; } if ($("#talents_2").hasClass('options_button')) { talents = talents + 'carting;'; } if ($("#talents_3").hasClass('options_button')) { talents = talents + 'competitive_obedience;'; } if ($("#talents_4").hasClass('options_button')) { talents = talents + 'guarding;'; } if ($("#talents_5").hasClass('options_button')) { talents = talents + 'herding;'; } if ($("#talents_6").hasClass('options_button')) { talents = talents + 'hunting;'; } if ($("#talents_7").hasClass('options_button')) { talents = talents + 'jogging;'; } if ($("#talents_8").hasClass('options_button')) { talents = talents + 'lure_coursing;'; } if ($("#talents_9").hasClass('options_button')) { talents = talents + 'military_work;'; } if ($("#talents_10").hasClass('options_button')) { talents = talents + 'narcotics_detection;'; } if ($("#talents_11").hasClass('options_button')) { talents = talents + 'obedience;'; } if ($("#talents_12").hasClass('options_button')) { talents = talents + 'police_work;'; } if ($("#talents_13").hasClass('options_button')) { talents = talents + 'racing;'; } if ($("#talents_14").hasClass('options_button')) { talents = talents + 'retrieving;'; } if ($("#talents_15").hasClass('options_button')) { talents = talents + 'search_and_rescue;'; } if ($("#talents_16").hasClass('options_button')) { talents = talents + 'schutzhund;'; } if ($("#talents_17").hasClass('options_button')) { talents = talents + 'sighting;'; } if ($("#talents_18").hasClass('options_button')) { talents = talents + 'sledding;'; } if ($("#talents_19").hasClass('options_button')) { talents = talents + 'tracking;'; } if ($("#talents_20").hasClass('options_button')) { talents = talents + 'tricks;'; } if ($("#talents_21").hasClass('options_button')) { talents = talents + 'watchdog;'; } if ($("#talents_22").hasClass('options_button')) { talents = talents + 'weight_pulling;'; } if (talents=='') { talents='none' } var origins = ''; if ($("#origins_1").hasClass('options_button')) { origins = origins + 'american;'; } if ($("#origins_2").hasClass('options_button')) { origins = origins + 'australian;'; } if ($("#origins_3").hasClass('options_button')) { origins = origins + 'belgian;'; } if ($("#origins_4").hasClass('options_button')) { origins = origins + 'canadian;'; } if ($("#origins_5").hasClass('options_button')) { origins = origins + 'chinese;'; } if ($("#origins_6").hasClass('options_button')) { origins = origins + 'egyptian;'; } if ($("#origins_7").hasClass('options_button')) { origins = origins + 'english;'; } if ($("#origins_8").hasClass('options_button')) { origins = origins + 'french;'; } if ($("#origins_9").hasClass('options_button')) { origins = origins + 'german;'; } if ($("#origins_10").hasClass('options_button')) { origins = origins + 'hungarian;'; } if ($("#origins_11").hasClass('options_button')) { origins = origins + 'irish;'; } if ($("#origins_12").hasClass('options_button')) { origins = origins + 'italian;'; } if ($("#origins_13").hasClass('options_button')) { origins = origins + 'japanese;'; } if ($("#origins_14").hasClass('options_button')) { origins = origins + 'norwegian;'; } if ($("#origins_15").hasClass('options_button')) { origins = origins + 'russian;'; } if ($("#origins_16").hasClass('options_button')) { origins = origins + 'scottish;'; } if ($("#origins_17").hasClass('options_button')) { origins = origins + 'welsh;'; } if (origins=='') { origins='none' } var breed_fur_length = ''; if (($("#breed_fur_length_1").hasClass('options_button')) && ($("#breed_fur_length_2").hasClass('options_button'))) { breed_fur_length = 'both'; } else if ($("#breed_fur_length_1").hasClass('options_button')) { breed_fur_length = 'short'; } else if ($("#breed_fur_length_2").hasClass('options_button')) { breed_fur_length = 'long'; } else { breed_fur_length = 'none'; } var fur_color = ''; if ($("#fur1").hasClass('fur_color_1_active')) { fur_color = fur_color+'1;'; } if ($("#fur2").hasClass('fur_color_2_active')) { fur_color = fur_color+'2;'; } if ($("#fur3").hasClass('fur_color_3_active')) { fur_color = fur_color+'3;'; } if ($("#fur4").hasClass('fur_color_4_active')) { fur_color = fur_color+'4;'; } if ($("#fur5").hasClass('fur_color_5_active')) { fur_color = fur_color+'5;'; } if ($("#fur6").hasClass('fur_color_6_active')) { fur_color = fur_color+'6;'; } if ($("#fur7").hasClass('fur_color_7_active')) { fur_color = fur_color+'7;'; } if (fur_color=='') { fur_color = 'none'; } var request = $.ajax({ url: "/ajax/get_breeds.php", type: "POST", data: { action: 'storeVarsInSession', intelligence: intelligence, trainability: trainability, family_friendly: family_friendly, dog_friendly: dog_friendly, guard_dog: guard_dog, exercise_needed: exercise_needed, affection: affection, space_needed: space_needed, playfulness: playfulness, energy: energy, agressiveness: agressiveness, tendency_to_bark: tendency_to_bark, amount_of_shedding: amount_of_shedding, breed_size: breed_size, breed_type: breed_type, fur_color: fur_color, origins: origins, fur_type: fur_type, talents: talents, breed_group: breed_group, snout_length: snout_length, breed_fur_length: breed_fur_length, start: start }, dataType: "html" }); request.done(function(msg) { if (msg==1) { window.location='/dog_search?start='+start; } }); } /* --------------------------------------------------------------------------------------- */ function breedsCloseHeader() { $("#pictures_details_page_title_extra").remove(); $("#breeds_left_header").remove(); }