function captchaReload(param){
	$('#formCaptcha').click(function () { $('#formCaptcha').attr('src', param + "?" + Math.floor(Math.random()*100) );return false; });
	$('#reloadLink').click(function () { $('#formCaptcha').attr('src',param + "?" + Math.floor(Math.random()*100) );return false; });
}

var CSSHelper = {
	init: function() {
		CSSHelper.leftNavigationFix();
	},
	leftNavigationFix: function() {
		jQuery('#left-navigation-container').each(function(i, jLeftNavigation) {

			jQuery(this, jLeftNavigation).find('ul.vertical li:last, ul.vertical ul li:last').css({
				backgroundImage: 'none'
			});
		});
	}
}

var SelectboxReplace = {
  init: function() {
	jQuery('.select select.replaceMe').each(function(i, jSelect) {
	  SelectboxReplace.replace(jSelect);
	});
  },
  replace: function(obj) {
	var orginalWidth =jQuery(obj).width();
	xhtml = jQuery('<div class="select-replace"><div class="opener"><span>'+jQuery(obj).find('option:selected').html()+'</span></div><div class="layer"><ul> </ul></div>');
	jQuery(obj).find('option').each(function(i, jOption) {
	  jQuery(xhtml).find('.layer ul').append('<li class="noBorder" title="'+jQuery(jOption).val()+'">'+jQuery(jOption).html()+'</li>');
	  
	});
	
	jQuery(obj).after(xhtml);
	jQuery(obj).after('<input type="hidden" name="'+jQuery(obj).attr('name')+'" value="'+jQuery(obj).find('option:selected').val()+'" />');
	
	jQuery(obj).parent().find('.select-replace li').click(function() {
	  if (jQuery(obj).hasClass('navigationElement')) {
		window.location.href = jQuery(this).attr('title');
	  } else {
		jQuery(this).parent().parent().parent().find('.opener span').html(jQuery(this).html())
		jQuery(this).parent().parent().parent().parent().find('input').val(jQuery(this).attr('title'));
	  }
	});
	
	jQuery(obj).parent().find('.select-replace').click(function() {
	  jQuery(this).find('.layer').toggle(); 
	});
	
	jQuery(obj).parent().find('.select-replace').css({
	  width: orginalWidth+'px'
	});
	jQuery(obj).remove();
  }
}

jQuery(document).ready(function() {	
	CSSHelper.init();
	SelectboxReplace.init();
	jQuery(".faqList").each(function(i, jOption) {
		jQuery(jOption).simpleFAQ({showOnlyOne: true,allowSearch: false});
	});
    // skip complete setup due to slider component
    Shadowbox.init({ skipSetup:true});
});
