/*-----------------------------------------------------------------------------
Web Site:			TiTech

CteatedDate:		19.03.2009
Autor:				DasgaF

$Revision: 1296 $

$LastChangedDate: 2010-08-27 17:34:00 +0600 (Fri, 27 Aug 2010) $
$LastChangedBy: sergeit $
-----------------------------------------------------------------------------*/

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');

	// set the same height of all News/Case Studies items on the homepage
    jQuery('#homepage .gray-line-block .news-data').setEqualBlocksHeight('all');
    
    jQuery('span.btn_submit').hover(function(){
    		jQuery(this).addClass('btn_submit_hover')
    	},function(){
    		jQuery(this).removeClass('btn_submit_hover')
    	}
    );
});

jQuery(function(){

  is = function( t){
  var u = navigator.userAgent.toLowerCase();
  return (u.indexOf( t)!=-1)
  };
		if(is('mac') && is('firefox'))
					{jQuery('html').addClass('mac-ff');}

});

