var Site = {

	em: function() {

		document.write('<a href=\'&#109;&#97;&#105;lto&#58;inf&#111;&#64;%6C&#37;69n%6Bo%70&#37;74im&#37;69zer&#37;2E&#98;%65\'>inf&#111;&#64;&#108;ink&#111;p&#116;imize&#114;&#46;be</a>');

	},

	gcf: function(parent) {

		// define parent id
		var parent_id = parent.attr('class');
		parent_id = parent_id.replace(/\D/g,'');

		if(parent_id) {

			jQuery.get(
				'/assets/bin/services.php',
				{a:'gcf',p:parent_id},
				function(html) {

					// append html
					parent.append(html);

					// autoselect first field
					jQuery('input[type="text"]:first',parent).select();

				}
			);

		}

	},

	tsi: function(q,s) {

	    if(q=='focus') { if(jQuery.trim(jQuery('input[name="q"]').val())==s) jQuery('input[name="q"]').attr('value',''); }
	    else { if(jQuery.trim(jQuery('input[name="q"]').val())=='') jQuery('input[name="q"]').attr('value',s); }

	}

};

jQuery(document).ready(function() {

	// home tab in menu
	if(!jQuery('#menu li.home').hasClass('s')) {

		jQuery('#menu li.home a').hover(
			function(){jQuery(this).parent().parent().parent().parent().find('.col1').addClass('s');},
			function(){jQuery(this).parent().parent().parent().parent().find('.col1').removeClass('s');}
		);

	}

	// cufon add fix to our buttons
	jQuery('.button span').css({padding:'11px 10px 0 15px',height:'28px'});
	jQuery('.button.arrow span').css({padding:'15px 10px 0 50px',height:'36px'});
	Cufon.replace('.button,h1,h2,h3,h4,h5,h6');
	Cufon.now();

	// breadcrumbs
	if(jQuery('#breadcrumbs').length) jQuery('#breadcrumbs li:first').addClass('f');

	// search - bind events
	jQuery('input[name="q"]').bind('focus',function(){Site.tsi('focus',LNG.defaultKeyword);});
	jQuery('input[name="q"]').bind('blur',function(){Site.tsi('blur',LNG.defaultKeyword);});

	// autocomplete
	jQuery('input[name="q"]').autocomplete({
		source:'/assets/bin/services.php?action=search&language='+LNG.language,
		minLength:2,
		select: function(event, ui) {
			if(ui.item) jQuery(this).attr('value', ui.item.value).parent().submit();
		}
	});

	// blog - bind event for comments
	/*
	jQuery('.react div').click(function() {

		// empty value
		jQuery(this).html('');

		// only proceed when we don't have a form yet in our parent
		var parent = jQuery(this).parent().parent();
		if(!jQuery('form',parent).length) Site.gcf(parent);

		// remove button
		jQuery(this).parent().remove();

	});
	*/

});	
