// 
//  clegg.js
//  Clegg
//  
//  Created by Craig Hoover on 2010-10-22.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
// 

var $j = jQuery.noConflict();

// 
//  IE select box fix for option list cutoff
//  
(function($j){
	
	$j.fn._ie_select=function(){return $j(this).each(function(){var a=$j(this),o=a.position(),w=a.outerWidth(),h=a.outerHeight(),l=o.left,t=o.top,p=a.parent();p.css({position:'relative'});var c=a.clone(true);$j.data(c,'element',a);c.css({zIndex:100,'width':w,'height':h,'top':t,'left':l,position:'absolute',width:'auto',opacity:0}).attr({id:this.id+'-clone',name:this.name+'-clone'}).change(function(){$j.data(c,'element').val($j(this).val()).trigger('change')});a.before(c).click(function(){c.trigger('click')})})}
	
	if($j.browser.msie)
	{
		$j(function(){ $j('select')._ie_select(); });
	}

})(jQuery);


//
//  clegg.js 
//


var clegg = 
{
    init:function()
    {
        $j('#newsletter-signup label').click(function(){
            $j(this).hide();
            $j(this).next('input').focus();
        });
        
        $j('#newsletter-signup input').focus(function(){
            $j(this).prev('label').hide();          
        }).blur(function(){
            $j(this).val() == '' ?  $j(this).prev('label').show() : $j(this).prev('label').hide();
        });
    }   
}

// home page slideshow
$j(function(){
    $j('.fadein .slide-listing:gt(0)').hide();
    setInterval(function(){
        $j('.fadein div:first-child').fadeOut()
            .next('.slide-listing').fadeIn()
            .end().appendTo('.fadein');}, 
    6000);
});
