var $j = jQuery.noConflict();
$j(document).ready(function(){
$j("#rep-list").change(function() { 
		$j('#rep-holder').find('.active').hide();
		$j('#rep-holder .'+$j('#rep-list option:selected').val()).fadeIn('fast').addClass('active');
	});
	if($j("#rep-list").val() == ""){
		$j('#rep-holder').find('.active').hide();
		$j('#rep-holder .rep-20').fadeIn('fast').addClass('active');
	}
/* !Email a Friend Social Button ============================== */
$j(".socialForm").colorbox({width:"35%", height:"85%", iframe:true});

});




$j(document).ready(function($){
	
	/* !run plugins ============================== */
	$("#phone, #contact-phone").mask("(999) 999-9999",{placeholder:" "});
	$("#fax, #contact-fax").mask("(999) 999-9999",{placeholder:" "});
	
	
	$('select#rep-list').change(function() {
   		var state = $('select#rep-list :selected').text();
   		_gaq.push(['_trackEvent', 'Find A Representative', 'click', state]);
	});
	
	
	$j('#newsletter-email').focus(function(){
		if($j(this).val()==$j(this).attr('title')){
			clearMePrevious = $j(this).val();
			$j(this).val('');
		}
	}).blur(function(){
		if($j(this).val()==''){
			$j(this).val(clearMePrevious);
		}
	});
	

	$j('#search input[type=text]').clearInput({defaultVal: 'Search'});

	/* !rfq form ============================== */
	if($j("#productnumber").val()){
		$j("div.custom").hide();
	};
		
	
	$j("p.customize a").click(function(){
		$j("div.custom").slideDown("fast");
	});
	
	
	$j("#linevoltage").change(function(){
		if($j(this).val()=='Other'){
			$j("#othervoltage").slideDown('fast');
		}else{
			$j("#othervoltage").slideUp('fast').val("");
		}
	});
	
	
	$j("#agencyother").click(function(){
		if($j(this).attr('checked')==true){
			$j("#agencyval").slideDown('fast');
		}else{
			$j("#agencyval").slideUp('fast');
		}
	});
	
	
	$j("#leadlengthother").click(function(){
		if($j(this).attr('checked')==true){
			$j("#leadlengthval").slideDown('fast');
		}else{
			$j("#leadlengthval").slideUp('fast');
		}
	});
		
		
	$j('#primary-nav li').hover(function(){
		$j(this).addClass('hover').children('ul').show();	
	}, function(){
		$j(this).removeClass('hover').children('ul').hide();	
	});
});

	(function($){  
		$.fn.clearInput = function(options) {  
for (var i=0; i<x; i++) {
	
};			settings = jQuery.extend({
				defaultVal: 'Search'
			}, options);
			
			return this.each(function() {
				if($(this).val() == '')
				{
					$(this).val(settings.defaultVal);
				}
				$(this).focus(function(){
					if($(this).val() == settings.defaultVal)
					{
						$(this).val('');
					}
				});
				$(this).blur(function(){
					if($(this).val() == '')
					{
						$(this).val(settings.defaultVal);
					}
				});
			});  
		};  
	})(jQuery);
