$(document).ready(function(){
   	var tabContainers = $('div.tabs > div');
	$('#slideshow').slideshow({
				timeout: 3000,
				type: 'sequence',
				pauselink: 'pause1',
				pausecallback: function(self){
					self.html('Play')
				},
				playcallback: function(self){
					self.html('Pause');
				}
			});
	tabContainers.hide().filter('#about_content').show();
	$("#holmes_map").hide();
	$("#holmes_map_area").hide();
	$("#ce_king_map_area").hide();
	$("#bryan_map_area").hide();
	$("#ce_king_map").hide();
	$("#bryan_map").hide();
	
	$('#myForm').ajaxForm(function(data) { 
				
			if (data==1){
				$("#failed").hide();
				$("#email_invalid").hide();
                $("#myForm").resetForm();
				$("#myForm").hide();
				$("#success").show();
				
            }
			else if (data==3)
			{
				$("#success").hide();
				$("#failed").hide();
				$("#email_invalid").show();
			}
			else
			{
				$("#email_invalid").hide();
				$("#success").hide();
				$("#failed").show();
			}
				   
            });
	$("#product_click").mouseover(function () {
		         
		$(this).attr("src", "images/products_hover.jpg");
    }).mouseout(function() {                      
		$(this).attr("src", "images/products.jpg");        
	});
	$("#product_click").click(function () {
		tabContainers.hide().filter('#product_content').show();
    });
	$("#forge_click").mouseover(function () {
		         
		$(this).attr("src", "images/forging_hover.jpg");
    }).mouseout(function() {                      
		$(this).attr("src", "images/forging.jpg");        
	});
	$("#forge_click").click(function () {
		tabContainers.hide().filter('#forge_content').show();
    });
	$("#ht_click").mouseover(function () {
		         
		$(this).attr("src", "images/heat_treat_hover.jpg");
    }).mouseout(function() {                      
		$(this).attr("src", "images/heat_treat.jpg");        
	});
	$("#ht_click").click(function () {
		tabContainers.hide().filter('#ht_content').show();
    });
	$("#insp_click").mouseover(function () {
		         
		$(this).attr("src", "images/inspection_hover.jpg");
    }).mouseout(function() {                      
		$(this).attr("src", "images/inspection.jpg");        
	});
	$("#insp_click").click(function () {
		tabContainers.hide().filter('#insp_content').show();
    });
	$("#thread_click").mouseover(function () {
		         
		$(this).attr("src", "images/threading_hover.jpg");
    }).mouseout(function() {                      
		$(this).attr("src", "images/threading.jpg");        
	});
	$("#thread_click").click(function () {
		tabContainers.hide().filter('#thread_content').show();
    });
	$("#dp_click").mouseover(function () {
		         
		$(this).attr("src", "images/drill_pipe_hover.jpg");
    }).mouseout(function() {                      
		$(this).attr("src", "images/drill_pipe.jpg");        
	});
	$("#dp_click").click(function () {
		tabContainers.hide().filter('#dp_content').show();
    });
	
	$("#about_click").mouseover(function () {
		         
		$(this).attr("src", "images/about_us_hover.jpg");
    }).mouseout(function() {                      
		$(this).attr("src", "images/about_us.jpg");        
	});
	$("#about_click").click(function () {
		tabContainers.hide().filter('#about_content').show();
    });
	$("#location_click").mouseover(function () {
		         
		$(this).attr("src", "images/locations_hover.jpg");
    }).mouseout(function() {                      
		$(this).attr("src", "images/locations.jpg");        
	});
	$("#location_click").click(function () {
		tabContainers.hide().filter('#location_content').show();
    });
	$("#quality_click").mouseover(function () {
		         
		$(this).attr("src", "images/quality_hover.jpg");
    }).mouseout(function() {                      
		$(this).attr("src", "images/quality.jpg");        
	});
	$("#quality_click").click(function () {
		tabContainers.hide().filter('#quality_content').show();
    });
	$("#contact_click").mouseover(function () {
		         
		$(this).attr("src", "images/contact_us_hover.jpg");
    }).mouseout(function() {                      
		$(this).attr("src", "images/contact_us.jpg");        
	});
	$("#contact_click").click(function () {
		tabContainers.hide().filter('#contact_content').show();
		
    });
	$("#embeded_contact_click").mouseover(function () {
		         
		$(this).attr("class", "embeded_link_hover");
    }).mouseout(function() {                      
		$(this).attr("class", "embeded_link");        
	});
	$("#embeded_contact_click").click(function () {
		tabContainers.hide().filter('#contact_content').show();
		
    });
	
	$("#holmes_arial").click(function(){
		$("#holmes_map_area").hide();
		$("#ce_king_map_area").hide();
		$("#bryan_map_area").hide();
		$("#ce_king_map").fadeOut("slow");
		$("#bryan_map").fadeOut("slow");
		$("#bryan_arial").animate( { width:"100px"}, 1000 );
		$("#ceking_arial").animate( { width:"100px"}, 1000 );
		$("#holmes_arial").animate( { width:"300px"}, 1000 );
		$("#holmes_map").fadeIn("slow");
	});
	$("#ceking_arial").click(function(){
		$("#holmes_map_area").hide();
		$("#ce_king_map_area").hide();
		$("#bryan_map_area").hide();
		$("#holmes_map").fadeOut("slow");
		$("#bryan_map").fadeOut("slow");
		$("#bryan_arial").animate( { width:"100px"}, 1000 );
		$("#holmes_arial").animate( { width:"100px"}, 1000 );
		$("#ceking_arial").animate( { width:"300px"}, 1000 );
		$("#ce_king_map").fadeIn("slow");
	});
	$("#bryan_arial").click(function(){
		$("#holmes_map_area").hide();
		$("#ce_king_map_area").hide();
		$("#bryan_map_area").hide();
		$("#holmes_map").fadeOut("slow");
		$("#ce_king_map").fadeOut("slow");
		$("#ceking_arial").animate( { width:"100px"}, 1000 );
		$("#holmes_arial").animate( { width:"100px"}, 1000 );
		$("#bryan_arial").animate( { width:"300px"}, 1000 );	
		$("#bryan_map").fadeIn("slow");
	});
	$("#holmes_map").click(function(){
		$("#holmes_arial").hide();
		$("#holmes_map").hide();
		$("#holmes_map_area").show();
		$("#holmes_map_area").jmap('init', {'mapType':'map','mapCenter':[29.677613,-95.379868], 'mapZoom':13, 'mapShowjMapsIcon': false});
		$("#holmes_map_area").jmap('AddMarker', {'pointLatLng': [29.6758, -95.379868],'pointHTML': '<strong style="color:black;">3101 Holmes Rd<br />Houston, TX 77051</strong>'}, function( marker, options){
			
			});

	
	});
	$("#ce_king_map").click(function(){
		$("#ceking_arial").hide();
		$("#ce_king_map").hide();
		$("#ce_king_map_area").show();
		$("#ce_king_map_area").jmap('init', {'mapType':'map','mapCenter':[29.833161331378715,-95.21247625350952], 'mapZoom':13, 'mapShowjMapsIcon': false});
		$("#ce_king_map_area").jmap('AddMarker', {'pointLatLng': [29.833161331378715, -95.21247625350952],'pointHTML': '<strong style="color:black;">7401 C. E. King Parkway<br />Houston, TX 77044</strong>'}, function( marker, options){
			
			});
	
	});
	$("#bryan_map").click(function(){
		$("#bryan_arial").hide();
		$("#bryan_map").hide();
		$("#bryan_map_area").show();
		$("#bryan_map_area").jmap('init', {'mapType':'map','mapCenter':[30.65725857159338,-96.41335487365723], 'mapZoom':12, 'mapShowjMapsIcon': false});
		$("#bryan_map_area").jmap('AddMarker', {'pointLatLng': [30.65725857159338, -96.41335487365723],'pointHTML': '<strong style="color:black;">1700 Independence Avenue<br /> Bryan, TX 77803</strong>'}, function( marker, options){
			
			});
	});
	$("#holmes_map").mouseover(function () {
		         
		$(this).attr("class", "show_map_hover");
		$(this).attr("size", "+1");
    }).mouseout(function() {                      
		$(this).attr("class", "show_map"); 
		$(this).attr("size", "-1");
	});
	$("#ce_king_map").mouseover(function () {
		         
		$(this).attr("class", "show_map_hover");
		$(this).attr("size", "+1");
    }).mouseout(function() {                      
		$(this).attr("class", "show_map"); 
		$(this).attr("size", "-1");
	});
	$("#bryan_map").mouseover(function () {
		         
		$(this).attr("class", "show_map_hover");
		$(this).attr("size", "+1");
    }).mouseout(function() {                      
		$(this).attr("class", "show_map"); 
		$(this).attr("size", "-1");
	});


		return false;
    });
	
	
