jQuery(document).ready(function(){
	if ( jQuery.browser.opera ) {
	}		
	if ( jQuery.browser.msie ) {
		
		if (jQuery.browser.version == '6.0' || jQuery.browser.version == '7.0') {
		}
	} 	
	if ( /chrome/.test( navigator.userAgent.toLowerCase() ) ) {
	} 	
	if ( /safari/.test( navigator.userAgent.toLowerCase() ) ) {
		jQuery('select').each(function () {
			(jQuery(this).parents('span').hasClass('fl') || jQuery(this).parents('span').hasClass('fr')) ? jQuery(this).css({'width':'84px'}) : jQuery(this).css({'width':'219px'});
		});
	} 	

	try {
		Cufon.replace('#Content .main_box .box1 h2, #Content .main_box .box1 h3, #Content .main_box .box2 h3, #Content .main_box .box3 h3', { fontFamily: 'Aller', hover: true });
		Cufon.replace('#HeaderOffer .right h2, #HeaderOffer .right h3, #BoxOffer .left_box_center h3, #BoxOffer .right_box .right_box_center h3, #OfferContent .right_box .right_box_center h3, .Footer .Menu ul li a ', {  fontFamily: 'Aller', textShadow: '1px 1px #0e2334', hover: true });
		Cufon.replace('#Container .Header ul.MainMenu li, #Container .Content h2, #Container .Content ul.Investments li div.About h3', {  fontFamily: 'Aller', textShadow: '1px 1px #233e56', hover: true });
		Cufon.replace('div.landing_page .box1 h2', {  fontFamily: 'Aller', textShadow: '1px 1px #515d27', hover: true });				
	} catch(err) {}
	
	//try {
		if (jQuery('.project').size() > 1) {
			jQuery('#project').before('<h4 id="project_nav"></h4>');
			jQuery('#project').find('h4').each(function () {
				jQuery(this).next('.project').attr('title',jQuery(this).text());
				jQuery(this).remove();
			});
			jQuery('#project').cycle({ 
				fx:     'scrollHorz', 
				speed:  800, 
				timeout: 0, 
				pager:  '#project_nav', 
				pagerAnchorBuilder: function(idx, slide) { 
					return '<a href="#">'+jQuery(slide).attr('title')+'</a>'; 
				}
			});
		}
	//} catch(err) {}
	
	(jQuery('.tools ul').height() > jQuery('.info dl').height()) ? jQuery('.info dl').height(jQuery('.tools ul').height()) : jQuery('.tools ul').height(jQuery('.info dl').height());
	
	try {
		if (jQuery('#gallery img').size() <= 1) {
			thumb = jQuery('#gallery').find('img').first();
			jQuery('#gallery').before('<ul id="gallery_nav"><li><a href="#" class="activeSlide"><img src="'+thumb.attr('src')+'" alt="'+thumb.attr('alt')+'" /></a></li></ul>');
		} else {
			jQuery('#gallery').before('<ul id="gallery_nav" />');
		}
		jQuery('#gallery').cycle({ 
			fx:     'fade', 
			speed:  800, 
			timeout: 0, 
			pager:  '#gallery_nav', 
			pagerAnchorBuilder: function(idx, slide) { 
				thumb = jQuery(slide).find('img').first();
				if (thumb.attr('src')===null) thumb = jQuery(slide);
				return '<li><a href="#"><img src="'+thumb.attr('src')+'" alt="'+thumb.attr('alt')+'" width="99" height="73" /></a></li>'; 
			}
		});
	} catch(err) {}
	
	jQuery('.totop').click(function () {
		scroll(0,0);
		return false;
	});

	
	jQuery('label.hide').hide().each(function () {
		jQuery(this).next('input[type="text"], input[type="password"], textarea, select').val(jQuery(this).html());
		jQuery(this).next('input[type="text"], input[type="password"], textarea, select').attr('rel',jQuery(this).html());
		jQuery(this).hide();
	});
	jQuery('input[type="text"], input[type="password"], textarea').focus(function () {
		if (jQuery(this).val()==jQuery(this).attr('rel')) jQuery(this).val('');
		jQuery(this).removeClass('invalid');
		jQuery(this).addClass('active');
		jQuery(this).parents('p').find('.err').removeClass('err');
		jQuery(this).parents('p').find('.msg').remove();
	});
	jQuery('input[type="text"], input[type="password"], textarea').blur(function () {
		if (jQuery(this).val()=='') jQuery(this).val(jQuery(this).attr('rel'));
		jQuery(this).removeClass('active');
	});

});
