
var image_index_slideshow_current=0;$(document).ready(function(){if($("#index_image_slideshow_1").length>0){setTimeout('index_slideshow_next()',3000);}$(".rc").corner("5px");});function index_slideshow_next(){image_index_slideshow_current=image_index_slideshow_current==images_index_slideshow.length-1?0:++image_index_slideshow_current;if(image_index_slideshow_current%2==0){$("#index_image_slideshow_1").fadeOut(600,function(){$("#index_image_slideshow_1").attr("src",images_index_slideshow[image_index_slideshow_current]);});$("#index_image_slideshow_2").fadeIn(1500);$("#index_image_slideshow_1").fadeIn(1500);}else{$("#index_image_slideshow_2").fadeOut(600,function(){$("#index_image_slideshow_2").attr("src",images_index_slideshow[image_index_slideshow_current]);});}setTimeout('index_slideshow_next()',3000);}function register_add_child(event_id,i){$("#add_child_"+event_id+"_"+i).hide();++i;$("#add_child_"+event_id+"_"+i).show();$("#register_child_"+event_id+"_"+i).show();}function register_add_child_event_logo(event_logo,i){$("#add_child_"+event_logo+"_"+i).hide();++i;$("#add_child_"+event_logo+"_"+i).show();$("#register_child_"+event_logo+"_"+i).show();}function register_and_pay_art_lab(event_logo){var programs="";$(".program_"+event_logo).each(function(){if($(this).attr("checked")){programs+=$(this).val()+",";}});programs=programs==""?"":programs.substr(0,programs.length-1);var terms_agreed=$("#terms_agreed_"+event_logo).attr("checked")?"yes":"no";var children_names='';var children_ages='';$(".k_child_name_"+event_logo).each(function(){children_names+=$.trim($(this).val())+'{}';});$(".k_child_age_"+event_logo).each(function(){children_ages+=$.trim($(this).val())+'{}';});$.post("/",{task:"register_event",first_name:$("#gmt_first_name_"+event_logo).val(),last_name:$("#gmt_last_name_"+event_logo).val(),address:$("#gmt_address_"+event_logo).val(),city:$("#gmt_city_"+event_logo).val(),province:$("#gmt_province_"+event_logo).val(),country:$("#gmt_country_"+event_logo).val(),postal_code:$("#gmt_postal_code_"+event_logo).val(),email:$("#gmt_email_"+event_logo).val(),phone:$("#gmt_phone_"+event_logo).val(),children_names:children_names,children_ages:children_ages,comments:$("#gmt_comments_"+event_logo).val(),programs:programs,terms_agreed:terms_agreed},function(data){data=$.trim(data);if(data.substr(0,5)=='ERROR'){alert(data.substr(5));}else if(data.substr(0,7)=='FORWARD'){window.location='thank_you';}else{$("#invoice_"+event_logo).val(data);$("#transfer_paypal").show();$("#paypal_"+event_logo).submit();}});}function register_and_pay(event_id){var programs=event_id;var terms_agreed=$("#terms_agreed_"+event_id).attr("checked")?"yes":"no";var children_names='';var children_ages='';$(".child_name_"+event_id).each(function(){children_names+=$.trim($(this).val())+'{}';});$(".k_child_age_"+event_id).each(function(){children_ages+=$.trim($(this).val())+'{}';});$.post("/",{task:"register_event",first_name:$("#gmt_first_name_"+event_id).val(),last_name:$("#gmt_last_name_"+event_id).val(),address:$("#gmt_address_"+event_id).val(),city:$("#gmt_city_"+event_id).val(),province:$("#gmt_province_"+event_id).val(),country:$("#gmt_country_"+event_id).val(),postal_code:$("#gmt_postal_code_"+event_id).val(),email:$("#gmt_email_"+event_id).val(),phone:$("#gmt_phone_"+event_id).val(),children_names:children_names,children_ages:children_ages,comments:$("#gmt_comments_"+event_id).val()+" Print Size: "+$("#os_1_"+event_id).val(),programs:programs,terms_agreed:terms_agreed},function(data){data=$.trim(data);if(data.substr(0,5)=='ERROR'){alert(data.substr(5));}else if(data.substr(0,7)=='FORWARD'){window.location='thank_you';}else if(data.substr(0,4)=='FULL'){alert("This workshop is full. We have recorded your registration. If a spot becomes available, we will get in touch with you. Thank you.");}else{$("#invoice_"+event_id).val(data);$("#transfer_paypal").show();$("#paypal_"+event_id).submit();}});}function assign_print(amount,event_id,new_display){$("#amount_"+event_id).val(amount);$("#on_1_"+event_id).val("Size");var name_="print_size_name_"+event_id;var size_display=$("input[name='print_size_name_"+event_id+"']").val();size_display=size_display.replace("_"," by ");$("#os_1_"+event_id).val(new_display);}function request_submit(){$.post("/",{task:"contact_us",name:$("#request_name").val(),email:$("#request_email").val(),message:$("#request_message").val()},function(data){data=$.trim(data);if(data=='ok'){$("#request_name").val('');$("#request_email").val('');$("#request_message").val('');alert("Thank you. Your message has been sent. We will answer shortly.");}else{alert(data);}});};function mailing_list_submit(){$.post("ajax.php",{task:"mailing_list",name:$("#mailing_list_name").val(),email:$("#mailing_list_email").val(),comment:$("#mailing_list_comment").val()},function(data){data=$.trim(data);if(data=='ok'){$("#mailing_list_name").val('');$("#mailing_list_email").val('');$("#mailing_list_comment").val('');alert("Thank you for joining our mailing list.");}else{alert(data);}});};function adjust_total(event_logo){$("#registration_form_"+event_logo).show();$("#button_register_"+event_logo).hide();var description_invoice=new Array();var child_invoice=new Array();var workshops=0;var total=0;$(".program_"+event_logo).each(function(){if($(this).attr("checked")){++workshops;description_invoice.push($(this).next().html());}});var children=0;$(".k_child_name_"+event_logo).each(function(){var ext=$(this).attr("id").substr(15);if($.trim($(this).val())!=""){++children;child_invoice.push($(this).val());}});var event_price=workshops*children<5?parseInt($.trim($("#price_regular_"+event_logo).html())):parseInt($.trim($("#price_discount_"+event_logo).html()));total=parseInt(children)*parseInt(workshops)*parseInt(event_price);var children_=children==1?"child":"children";var workshops_=workshops==1?"workshop":"workshops";var total_string=total+" ("+children+" "+children_+" for "+workshops+" "+workshops_+" at $"+event_price+" a piece)";$("#total_"+event_logo).html(total_string);$("#amount_"+event_logo).val(total);var i=1;$(".hidden_"+event_logo).val('');for(var c=1;c<=children;++c){for(var w=1;w<=workshops;++w){$("#paypal_"+event_logo+" input[name='tax_rate_"+i+"']").val(13);$("#paypal_"+event_logo+" input[name='amount_"+i+"']").val(event_price);$("#paypal_"+event_logo+" input[name='item_name_"+i+"']").val($.trim($("#item_name_display_"+event_logo).html()));$("#paypal_"+event_logo+" input[name='on0_"+i+"']").val("Date");$("#paypal_"+event_logo+" input[name='os0_"+i+"']").val(description_invoice[w-1]);$("#paypal_"+event_logo+" input[name='on1_"+i+"']").val("Child");$("#paypal_"+event_logo+" input[name='os1_"+i+"']").val(child_invoice[c-1]);++i;}}if(workshops>0&&children==0){$("#at_least_one_"+event_logo).show();}else{$("#at_least_one_"+event_logo).hide();}}function move_pictures_band(direction,width){var pos="";if($.browser.msie){pos=$("#pictures_band_img").css('background-position-x')+" "+$("#pictures_band_img").css('background-position-y');}else{pos=$("#pictures_band_img").css('backgroundPosition');}var temp=pos.split(" ");var x=parseInt($.trim(temp[0]).slice(0,-2));x+=direction=="left"?100:-100;if(x>=0){x=0;$("#pictures_band_left").hide();}else{$("#pictures_band_left").show();}var min_pos=-width+750;if(x<=min_pos){x=min_pos;$("#pictures_band_right").hide();}else{$("#pictures_band_right").show();}$("#pictures_band_img").css('background-position',x+'px '+temp[1]);}function ss_submit_form(){$("#ss_form_feedback").html('').hide();$.post("/",{task:"ss_register_draw",name:$("#ss_name").val(),email:$("#ss_email").val(),phone:$("#ss_phone").val(),mailing_list:$("#ss_mailing_list").attr("checked")?"yes":"no"},function(data){data=$.trim(data);if(data==""){$("#ss_form").hide();$("#ss_form_thank_you").show();}else{$("#ss_form_feedback").html(data).show();}});}
