/*
  Custom ready function
  This should be used to reposition elements or to define and use custom functions
*/
$(document).ready(function(){

	$('#form_final').append($('#form_temp'));
	$('#header').prepend($('#header_temp'));
//	$('#promo').append($('#promo_temp'));
	$('#promo').prepend($('#promo_temp'));
	$('#samples').append($('#samples_temp'));
	$('#right_col').append($('#right_col_temp'));

    // homepage image rollovers
    if( $('#samples_temp').length == 1 ){
    	$('.roll').hover(function(){
    		var num = 1;
    		var th = $(this).attr('id');
    		var pos = th.lastIndexOf('-');
    				num = th.substring(pos+1)
    				$('#main_img').attr('src', './images/cabinets/site_kitchen'+num+'.jpg');
    	});	
    }

    
	// append clear fix to each ul with floated children 
    $('.content-right ul, .sitemap ul, .home_articles ul, .state_articles ul').each(function(){
        $(this).append('<div class="clear0"><!--ie--></div>');   
    });
    
    
    // attach to_digits() to zip code keyup event
	$('#zip, #PC').bind('keyup', function(){
		to_digits( $(this).attr('id'), true );
	});

	// attach to_digits() to phone number blur event
	$('#HP').bind('blur', function(){
		to_digits( $(this).attr('id'), true );
	});

    // footer only has 2 links on form pages!
	if( $('.footer .nav a').length == 2 ){
		$('.footer .nav a').bind('click', function(){
			window.open( $(this).attr('href'),
						'form_pop_up',
						'width=300, height=300, status=0, toolbar=0, location=1, menubar=0, directories=0, resizable=1, scrollbars=1');
			return false;
		});
	}
	

});//ready



