/**************  GLOBAL JS  ****************  */
var jQ = jQuery.noConflict();	

(function(jQ) {
	jQ(document).ready(function() {
	
	// pop up form box
	jQ("#qualify").colorbox({inline:true, href:"#inquire"});
	
	jQ("#uverse").colorbox({inline:true, href:"#uverseForm"});
	
	
// cycle header
	jQ('#rotation').before("<ul id='pager-nav'></ul>").cycle({ 
		fx:     'fade', 
		speed:  800, 
		timeout: 8000,  
		pager: '#pager-nav',
		// callback fn that creates a thumbnail to use as pager anchor 
		pagerAnchorBuilder: function(idx, slide) { 
			return '<li><a href="#">' + (slide.title) + '</a></li>';
		}
	});
		
  });   
  // form 

	
var jQ = jQuery.noConflict();
	jQ(document).ready(function() { 

	jQ("#contact").validate();
	//jQ("#phone").mask("(999) 999-9999");
	//jQ("#myPhone").hide();
	jQ("input:radio").change(function() {
		if (jQ('input:radio[name=member]:checked').val() == 'Yes') {
		jQ("#myPhone").show();
		} else {
		jQ("#myPhone").hide();
		}
	});	
	var options = { 
		target:    '#result',
		success:      showResponse,
		clearForm: true
		}; 
		jQ('#contact').ajaxForm(options); 
			
		});
										
	jQ.fn.clearForm = function() {
	return this.each(function() {
		var type = this.type, tag = this.tagName.toLowerCase();
		if (tag == 'form')
			return jQ(':input',this).clearForm();
		if (type == 'text' || type == 'password' || tag == 'textarea')
			this.value = '';
		else if (type == 'checkbox' || type == 'radio')
			this.checked = false;
		else if (tag == 'select')
			this.selectedIndex = -1;
		});
	}; 
	function showResponse(responseText, statusText, xhr, $form)  { 
		jQ('#result').html(responseText); 
	} 
})(jQuery);


