$(function(){$('#newsletter_form').submit(function(){$.ajaxSetup({error:function(){alert('There was an error submitting your email');}});var buttonText=$('#newsletter_submit input').val();$('#newsletter_error').hide();$('#newsletter_followup').hide();$('#newsletter_submit input').replaceWith('<img src="/images/ajax-loader.gif" alt="Loading..." />');$.post($('#newsletter_form').attr('action'),{'newsletter[email]':$('#newsletter_email').val()},function(data,textStatus)
{if(data.error)
{$('#newsletter_submit img').replaceWith('<input type="submit" value="'+buttonText+'" />');$('#newsletter_error').show();$('#newsletter_error').html(data.error);}
else if(data.success)
{window.location=$('#redirect_url').val();}},'json');return false;});if(typeof $().sSelect=='function')
{$('#culture_culture').sSelect();$("select.jsdropdown, #register-form select[multiple!=true]").sSelect({ddMaxHeight:'85px'});$('.cosForm.dl .border select').sSelect({ddMaxHeight:'85px'});$('#container .press-mid-content .cosForm select').sSelect({ddMaxHeight:'85px'});}});$(document).ready(function(){$("#user_signin_form").validate({submitHandler:function(form){$.ajaxSetup({error:function(){alert('There was an error logging you in');}});var buttonText=$('#user_signin_submit input').val();$('#user_signin_error').hide();$('#user_signin_submit input').replaceWith('<img src="/images/ajax-loader.gif" alt="Loading..." />');$.post($('#user_signin_form').attr('action'),{'signin[username]':$('#ajax-username').val(),'signin[password]':$('#ajax-password').val(),'login_form_submitted':$('#login_form_submitted').val()},function(data,textStatus)
{if(data.error)
{$('#user_signin_submit img').replaceWith('<input type="submit" id="user_signin_submit" title="'+buttonText+'" value="'+buttonText+'" />');$('#user_signin_error').show();$('#user_signin_error').html(data.error);$('#user_signin_msg').hide();}
else if(data.success)
{window.location=$('#redirect_url').val();}},'json');return false;}});var accordion_context=$('#accordion_wrapper');var accordion_head=$('.btn_toggle',$(accordion_context));if(accordion_head.length!=0){$(accordion_context).addClass('js');$(accordion_head).click(function(){$(this).siblings('.btn_clear').animate({'opacity':'toggle'},'slow');$(this).parent().next().animate({'opacity':'toggle','height':'toggle'},'slow');$(this).parent().parent().toggleClass("open");$(this).parent().parent().toggleClass("closed");return false;});}
var filter_form=$('#filter_form select');if(filter_form.length!=0){$(filter_form).change(function(){$('#filter_form').submit();});}
inputBtnContext=$('body.cos');if(inputBtnContext.length!=0){$('.btn input').hover(function(){$(this).addClass('rollover');},function(){$(this).removeClass('rollover');});}
jQuery('div.cat_carousel .tab a').click(function(){var tab=jQuery(this).attr('rel');jQuery('.tab-content').hide();jQuery(this).parent().parent().find('.selected').removeClass('selected');jQuery(this).parent().addClass('selected');jQuery('#'+tab).show();jQuery('#'+tab+' .jcarousel-list').css({width:'auto'});return false;});jQuery('div.cat_carousel .tab a:first').trigger('click');});function slideVillageChooserOpen()
{if($('#villagechooser:animated').length>0){return false;}
_village_chooser=$('#villagechooser');_village_chooser.addClass('open');$('#cos-header .our-websites').addClass('open');_village_chooser.show('slide',{direction:'up'},1000);$('#villageChooserLink').unbind('click').click(function(){slideVillageChooserClosed();return false});}
function slideVillageChooserClosed()
{if($('#villagechooser:animated').length>0){return false;}
_village_chooser.removeClass('open');$('#cos-header .our-websites').removeClass('open');_village_chooser.hide('slide',{direction:'up'},1000);$('#villageChooserLink').unbind('click').click(function(){slideVillageChooserOpen();return false});}
function handleVillageChooser(linkUrl,loadingTxt){$('#villageChooserContainer a').hide();$('#villageChooserContainer').append(unescape('%3Cspan id="villageChooserLoading"%3E'+loadingTxt+'%3C/span%3E'));$('#villageChooserLoading').effect("pulsate",{times:10},1000);$('#villagechooser').load(linkUrl,{},function(){$('#villageChooserLoading').remove();$('#villageChooserContainer a').show();slideVillageChooserOpen()});}
Array.prototype.inArray=function(value){var i;for(i=0;i<this.length;i++){if(this[i]===value){return true;}}
return false;};