//set up carousel in hero area on home
if (jQuery('#hero').length > 0) {
	var hero = jQuery('#hero');
	jQuery('#leader').after(hero);
	jQuery('#hero').show(); //.css('display','block');
	
	jQuery('#carousel #loader').fadeOut(2500).remove();
	jQuery('#carousel ul').css('display','block').fadeIn(2500);
}

jQuery(function(){
	if (jQuery('#carousel').length > 0) {
		jQuery('#carousel').infiniteCarousel({
			transitionSpeed : 500,
			displayTime : 5000,
			textholderHeight : .25,
			displayProgressBar : 1
		});
	}
});

jQuery(document).ready(function(){
	
	jQuery('#header-widget form input[type="text"]').focus(function(){
		if (this.value == this.defaultValue){  
            this.value = '';  
        }  
        if(this.value != this.defaultValue){  
            this.select();  
        }
	});
	
	var badBrowser = (/MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32");
	if (badBrowser) {
	  // get all pngs on page
	  jQuery('img[src$=.png]').each(function() {
	    if (!this.complete) {
	      this.onload = function() { fixPng(this) };
	    } else {
	      fixPng(this);
	    }
	  });
	}
	
	// compare browser and rendering engine
	if (  ((jQuery.browser.mozilla) && (parseFloat(jQuery.browser.version) < 1.9)) 
	   || ((jQuery.browser.safari) && (parseFloat(jQuery.browser.version) < 523)) 
	   || ((jQuery.browser.msie) && (parseFloat(jQuery.browser.version) < 7)) 
	   ) { 
			alert('Please upgrade your browser ;-)');
			//$('head > style').append("@import url('css/degradation.css');");
	};
});

function fixPng(png) {
  // get src
  var src = png.src;
  // set width and height
  if (!png.style.width) { png.style.width = jQuery(png).width(); }
  if (!png.style.height) { png.style.height = jQuery(png).height(); }
  // replace by blank image
  png.onload = function() { };
  png.src = blank.src;
  // set filter (display original image)
  png.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
}

