/*-----------------------------------------------------------------------------
Web Site:			Commodas

CteatedDate:		19.03.2009
Autor:				DasgaF

$Revision: 177 $

$LastChangedDate: 2009-10-21 16:52:54 +0600 (Wed, 21 Oct 2009) $
$LastChangedBy: annag $
-----------------------------------------------------------------------------*/

function setOnFocus(keywords, control) {
    if (control.value == keywords) {
        control.value = ''; 
    }
 }

 function setOnBlur(keywords, control) {
     if (control.value == '') {
         control.value = keywords; 
     }
 }
 
// Setting equal height of blocks
// by Sergei T.

(function($){
	$.fn.setEqualBlocksHeight = function(count){
		if (count == 'all' || count > this.length) count = this.length;
		count = parseInt(count);
		if (count > 1)
		{
			this.css({height:'auto', 'min-height':0});
			for (var i=1; i<=this.length; i+=count)
			{
				var sameH = 0;
				for (var j=0; j<=count-1; j++)
				{
					if (this.get(i+j-1))
					{
						var blockH = this.eq(i+j-1).height();
						sameH = ( blockH > sameH) ? (sameH = blockH) : sameH
					}
				}
				for (var j=0; j<=count-1; j++)
				{
					if (this.get(i+j-1))
					{
						this.eq(i+j-1).css({'min-height': sameH});
						if (jQuery.browser.msie && jQuery.browser.version == '6.0') this.eq(i+j-1).height(sameH)
					}
				}
				
			}
		};
		if (count == 1) this.css({height:'auto', 'min-height':0});
		return this
	};
})(jQuery);


jQuery(document).ready(function(){
	// set the same height of all primary navigation items
    jQuery('.primary-nav ul li a').setEqualBlocksHeight('all');
});


