$(document).ready(function(){
	// To custom search select field
		$('.custom_select').customStyle();
	// -------------------------------------

	// To default value in search text field
		var search_form_input_default = '';
		var search_form_input_first_click = true;
		
		$('#search_form .input_text').each(function(){
			search_form_input_default = $(this).val();
		});
		var search_form_out = function(){
			if($(this).val()==''){
				$(this).val(search_form_input_default);
				search_form_input_first_click = true;
			}
		};
		$('#search_form .input_text').change(search_form_out);
		$('#search_form .input_text').blur(search_form_out);
		$('#search_form .input_text').click(function(){
			if(search_form_input_first_click){
				search_form_input_first_click = false;
				$(this).val('');
			}
		});
	// -------------------------------------
	$("a[rel^='prettyPhoto']").prettyPhoto();
	
	var SITE = SITE || {};

	SITE.fileInputs = function() {
	  var $this = $(this),
		  $val = $this.val(),
		  valArray = $val.split('\\'),
		  newVal = valArray[valArray.length-1],
		  $button = $this.siblings('.button'),
		  $fakeFile = $this.siblings('.file-holder');
	  if(newVal !== '') {
		$button.text(LANG_INPUT_FILE_SELECTED);
		if($fakeFile.length === 0) {
		  $button.after('<span class="file-holder">' + newVal + '</span>');
		} else {
		  $fakeFile.text(newVal);
		}
	  }
	};
	
	$('.file-wrapper input[type=file]').bind('change focus click', SITE.fileInputs);
	
	// Share this button
	/*$('.st_sharethis_custom').parent().mouseover(function(){
		$(this).find('.st_sharethis_custom').toggleClass("st_sharethis_custom_over");
	});
	$('.st_sharethis_custom').parent().mouseout(function(){
		$(this).find('.st_sharethis_custom').toggleClass("st_sharethis_custom_over");
	});
	$(window).resize(function() {
		if($(window).width()<1150){
			$('#social_media').addClass('tobottom');
			$('#stwrapper').addClass('tobottom');
		}else{
			$('#social_media').removeClass('tobottom');
			$('#stwrapper').removeClass('tobottom');
		}
	});
	if($(window).width()<1150){
		$('#social_media').addClass('tobottom');
		$('#stwrapper').addClass('tobottom');
	}else{
		$('#social_media').removeClass('tobottom');
		$('#stwrapper').removeClass('tobottom');
	}*/
});
