$('html').addClass('hidden');function iPhoneAlert(){if((navigator.userAgent.match(/iPhone/i))||(navigator.userAgent.match(/iPod/i))){var question=confirm("Would you like to view the iPhone-optimized version of our site?");if(question){window.location="http://iphone.rachelgalley.com"}else{$.ajax({type:"POST",url:"http://www.rachelgalley.com/iphone-redirect.php",data:"iphone=no"})}}}function slideSwitchDesign(){var active=$('#bc_design_images p:visible');active.fadeOut(1500);if(active.next().length){active.next().fadeIn(1500)}else{$('#bc_design_images p:first').fadeIn(1500)}}function slideSwitchInspire(){var active=$('#bc_inspire_images p:visible');active.fadeOut(1500);if(active.next().length){active.next().fadeIn(1500)}else{$('#bc_inspire_images p:first').fadeIn(1500)}}function slideSwitch(){var active=$('#homepage_main .hmain_image:visible');active.fadeOut(1500);if(active.next().length){active.next().fadeIn(1500)}else{$('#homepage_main .hmain_image:first').fadeIn(1500)}}function slideSwitchTwo(){var active=$('#homepage_promo .hpromo_image:visible');active.fadeOut(1500);if(active.next().length){active.next().fadeIn(1500)}else{$('#homepage_promo .hpromo_image:first').fadeIn(1500)}}function share_item(dest,id){$.ajax({type:"POST",url:"http://www.rachelgalley.com/share_counter.php",data:"site="+dest+"&item_id="+id+"&share=yarp",success:function(msg){}});return false}$(document).ready(function(){$('.basket_qty_input').keydown(function(event){if(!(event.keyCode==8||event.keyCode==46||(event.keyCode>=35&&event.keyCode<=40)||(event.keyCode>=48&&event.keyCode<=57)||(event.keyCode>=96&&event.keyCode<=105))){event.preventDefault()}});$('.autocomplete_off').attr('autocomplete','off');$('select[name=os4]').change(function(){var price=$(this).find('option:selected').text().split(' ');price2=price[price.length-1].substring(1);$('input[name=amount]').val(price2)});if($('#bc_design_images').length){$('#bc_design_images p:first').delay(700).fadeIn(1000);$(function(){setInterval("slideSwitchDesign()",6000)})}if($('#bc_inspire_images').length){$('#bc_inspire_images p:first').delay(1000).fadeIn(1000);$(function(){setInterval("slideSwitchInspire()",6800)})}if($('#homepage_main').length){$('#homepage_main .hmain_image:first').delay(1000).fadeIn(1000);$(function(){setInterval("slideSwitch()",7000)})}if($('#homepage_promo').length){$('#homepage_promo .hpromo_image:first').delay(700).fadeIn(1000);$(function(){setInterval("slideSwitchTwo()",7500)})}(function($){var imgList=[];$.extend({preload:function(imgArr,option){var setting=$.extend({init:function(loaded,total){},loaded:function(img,loaded,total){},loaded_all:function(loaded,total){}},option);var total=imgArr.length;var loaded=0;setting.init(0,total);for(var i in imgArr){imgList.push($("<img />").attr("src",imgArr[i]).load(function(){loaded++;setting.loaded(this,loaded,total);if(loaded==total){setting.loaded_all(loaded,total)}}))}}})})(jQuery);screenshotPreview();$('.expand_press').live('click',function(){var self=$(this);self.parents('div.press_subcat').css('height','100%');self.removeClass().addClass('contract_press').text('View less');return false});$('.contract_press').live('click',function(){var self=$(this);self.parents('div.press_subcat').css('height',370);self.removeClass().addClass('expand_press').text('View All');return false});$('#collection_items').fadeIn();$('#collections_grid').fadeIn();$('div.more_photos').show();$('#size_image').show();$('input#submit_button').hide();$('div.pouch').show();$('#sort_buttons').show();$('#sort_buttons a').click(function(){var dt=$(this).attr('href').split('-');if(dt[3]=='col'){$('#collection_items').fadeOut(100,function(){$.ajax({url:"http://www.rachelgalley.jbg/includes/price_sort.php",type:"POST",data:'direction='+dt[1]+'&id='+dt[2]+'&db_name='+dt[0],dataType:'html',success:function(ret){$('#collection_items').html(ret).fadeIn(500)}})})}else if(dt[3]=='prod'){$('#collection_items').fadeOut(100,function(){$.ajax({url:"http://www.rachelgalley.jbg/includes/price_sort.php",type:"POST",data:'direction='+dt[1]+'&id='+dt[2]+'&prod='+dt[0],dataType:'html',success:function(ret){$('#collection_items').html(ret).fadeIn()}})})}return false});$(function(){var tabContainers=$('div.tabs .stockists_table');$('div.tabs ul.tabNavigation a').click(function(){tabContainers.hide().filter(this.hash).show();return false}).filter(':first').click()});if($('a.zoom1').length){$("a.zoom1").fancybox({'overlayOpacity':0.5,'overlayColor':'#000'});$('a.sizes').fancybox({'overlayOpacity':0.5,'overlayColor':'#000'})}$('div.more_photos a').click(function(){$('a#first').click();return false})});this.screenshotPreview=function(){xOffset=60;yOffset=80;$("a.screenshot").hover(function(e){this.t=this.title;this.title="";var c=(this.t!="")?"<br/>"+this.t:"";$("body").append("<p id='screenshot'><img src='"+this.rel+"' alt='url preview' />"+c+"</p>");$("#screenshot").css("top",(e.pageY-xOffset)+"px").css("left",(e.pageX+yOffset)+"px").css('z-index',100).fadeIn("fast")},function(){this.title=this.t;$("#screenshot").remove()});$("a.screenshot").mousemove(function(e){$("#screenshot").css("top",(e.pageY-xOffset)+"px").css("left",(e.pageX+yOffset)+"px")})};function submitForm(str){alert(str);document.str.submit()}function clearForm(){document.searchForm.searchInput.value=""}function clearSignup(){$('input[name=ea]').val('')}
