/* lightboxes*/


function lightboxShow(divID, focusID) {
    var lightboxBg, contentHeight, lightboxHeight, windowHeight;
    document.getElementById(divID).style.display = 'block';
    lightboxBg = document.createElement('div');
    contentHeight = document.getElementById('page_container').offsetHeight;
    lightboxHeight = document.getElementById(divID).offsetHeight;
    lightboxBg.setAttribute('id', 'lightbox_bg');
    document.body.appendChild(lightboxBg);
    if (window.innerHeight) {
        windowHeight = window.innerHeight; // not IE
    } else {
        windowHeight = document.documentElement.clientHeight; // IE 6+ standards mode
    }
    if (contentHeight > lightboxHeight) {
        if (contentHeight > windowHeight) {
            document.getElementById('lightbox_bg').style.height = contentHeight + 'px';
        } else {
            document.getElementById('lightbox_bg').style.height = windowHeight + 'px';
        }
    } else {
        if (lightboxHeight > windowHeight) {
            document.getElementById('lightbox_bg').style.height = lightboxHeight + 'px';
        } else {
            document.getElementById('lightbox_bg').style.height = windowHeight + 'px';
        }
    }
    if (focusID) {
        document.getElementById(focusID).focus();
    }
    
    document.body.lbcontentdiv="Test";
}
function lightboxHide(divID) {
    document.getElementById(divID).style.display = 'none';
    document.body.removeChild(document.getElementById('lightbox_bg'));
}

/* contact form */
$(document).ready(function(){
    $('.error').hide();
    $("#contact_btn").click(function(){
     // validate form here
        
        $('.error').hide();
        var first=$("input#first_contact").val();
        if(first==="") {
          $("label#first_contact_error").show();
          $("input#first_contact").focus();
            return false;
        }
        var last=$("input#last_contact").val();
        if(last==="") {
            $("label#last_contact_error").show();
            $("input#last_contact").focus();
              return false;
        }
		
        var email=$("input#email_contact").val();
        if(email==="") {
         $("label#email_contact_error").show();
         $("input#email_contact").focus();
         return false;   
        }
        
        var phone=$("input#phone_contact").val();
        if(phone==="") {
            $("label#phone_contact_error").show();
            $("input#phone_contact").focus();
              return false;
        }
		
		var company=$("input#company_contact").val();
        if(company==="") {
         $("label#company_contact_error").show();
         $("input#company_contact").focus();
         return false;   
        }
		
        
        // two fields not required definition
        var message=$("textarea#message").val();
        
        
        
        var dataString = 'first=' + first + '&last=' + last + '&email=' + email + '&message=' + message + '&company=' + company + '&phone=' + phone;
        // for testing - turn off when working right
        // alert (dataString);return false;
        $.ajax({
            type:  "POST",
            url: "processcontactform.php",
            data:  dataString,
            success:  function() {
             $('#innercontent_contact').html("<img src='/images/checkbox-50.png' align='left' /><h2>Contact Form Submitted!</h2>")         
             .hide()
             .fadeIn(1500, function() {
                $('#innercontent_contact').html("<div class='lb_close_x'><a href='javascript:void(0);' onclick=lightboxHide('contactform');>X</a></div><h1>Thanks for your Interest</h1>")
                .append("<p>Someone will be getting back to you shortly.</p> ")           
              });
              //$('#contact_form').html
            }
        });
      return false;
  });  

});

/* quote form */

$(document).ready(function(){
    $('.error').hide();
    $("#quote_btn").click(function(){
     // validate form here
        
        $('.error').hide();
        var first=$("input#first_quote").val();
        if(first==="") {
          $("label#first_quote_error").show();
          $("input#first_quote").focus();
            return false;
        }
        var last=$("input#last_quote").val();
        if(last==="") {
            $("label#last_quote_error").show();
            $("input#last_quote").focus();
              return false;
        }
		
        var email=$("input#email_quote").val();
        if(email==="") {
         $("label#email_quote_error").show();
         $("input#email_quote").focus();
         return false;   
        }
        
        var phone=$("input#phone_quote").val();
        if(phone==="") {
            $("label#phone_quote_error").show();
            $("input#phone_quote").focus();
              return false;
        }
		
		var company=$("input#company_quote").val();
        if(company==="") {
         $("label#company_quote_error").show();
         $("input#company_quote").focus();
         return false;   
        }
		
        
        // two fields not required definition
        var message=$("textarea#message_quote").val();
        
        
        
        var dataString = 'first=' + first + '&last=' + last + '&email=' + email + '&message=' + message + '&company=' + company + '&phone=' + phone;
        // for testing - turn off when working right
        // alert (dataString);return false;
        $.ajax({
            type:  "POST",
            url: "processquoteform.php",
            data:  dataString,
            success:  function() {
             $('#innercontent_quote').html("<img src='/images/checkbox-50.png' align='left' /><h2>Contact Form Submitted!</h2>")         
             .hide()
             .fadeIn(1500, function() {
                $('#innercontent_contact').html("<div class='lb_close_x'><a href='javascript:void(0);' onclick=lightboxHide('contactform');>X</a></div><h1>Thanks for your Request for a Quote</h1>")
                .append("<p>Someone will be getting back to you shortly and will arrange to meet with you in person to discuss your needs.</p> ")           
              });
              //$('#contact_form').html
            }
        });
      return false;
  });  

});


/* quote formend */

/* wpg form start */


$(document).ready(function(){
    $('.error').hide();
    $("#wpg_btn").click(function(){
     // validate form here
        
        $('.error').hide();
        var first=$("input#first_wpg").val();
        if(first==="") {
          $("label#first_wpg_error").show();
          $("input#first_wpg").focus();
            return false;
        }
        var last=$("input#last_wpg").val();
        if(last==="") {
            $("label#last_wpg_error").show();
            $("input#last_wpg").focus();
              return false;
        }
		
        var email=$("input#email_wpg").val();
        if(email==="") {
         $("label#email_wpg_error").show();
         $("input#email_wpg").focus();
         return false;   
        }
        
        var phone=$("input#phone_wpg").val();
        if(phone==="") {
            $("label#phone_wpg_error").show();
            $("input#phone_wpg").focus();
              return false;
        }
		
		var company=$("input#company_wpg").val();
        if(company==="") {
         $("label#company_wpg_error").show();
         $("input#company_wpg").focus();
         return false;   
        }
		
        
        // two fields not required definition
        var message=$("textarea#message_wpg").val();
        
        
        
        var dataString = 'first=' + first + '&last=' + last + '&email=' + email + '&message=' + message + '&company=' + company + '&phone=' + phone;
        // for testing - turn off when working right
        // alert (dataString);return false;
        $.ajax({
            type:  "POST",
            url: "processwpgform.php",
            data:  dataString,
            success:  function() {
             $('#innercontent_wpg').html("")         
             .hide()
             .fadeIn(1500, function() {
                $('#innercontent_wpg').html("<img src='/images/checkbox-50.png' align='left' /><h1>Thank you!</h1><div class='lb_close_x'><a href='javascript:void(0);' onclick=lightboxHide('wpgform');>X</a></div><h1>Thanks for your Request for our Web Planning Guide</h1>")
                .append("<p style='text-align:center;'><img src='images/wpg-cover-200.gif' class='img_center' /><br /><a href='http://www.yourgreatwebsite.com/dl/wpg.pdf'>Click Here to Download Now</a></p> ")           
              });
              //$('#contact_form').html
            }
        });
      return false;
  });  

});



/* wpg form end */

/* sliders for home page */
$(document).ready(function(){
	$('#cwd_link').click(function() {
	  $('#cwd').slideToggle('slow');
	  if($('#cwd').is(":visible")) {
	    $('#cwd_link').html('-');
	  }
	  if($('#cwd').is(":hidden")) {
	  $('#cwd_link').html('+');
	  }
	});
	
	$('#econ_link').click(function() {
	  $('#econ').slideToggle('slow');
	  if($('#econ').is(":visible")) {
	    $('#econ_link').html('-');
	  }
	  if($('#econ').is(":hidden")) {
	  $('#econ_link').html('+');
	  }
	});
	$('#hosting_link').click(function() {
	  $('#hosting').slideToggle('slow');
	  if($('#hosting').is(":visible")) {
	    $('#hosting_link').html('-');
	  }
	  if($('#hosting').is(":hidden")) {
	  $('#hosting_link').html('+');
	  }
	});
	
	$('#prog_link').click(function() {
	  $('#prog').slideToggle('slow');
	  if($('#prog').is(":visible")) {
	    $('#prog_link').html('-');
	  }
	  if($('#prog').is(":hidden")) {
	  $('#prog_link').html('+');
	  }
	});
	if($('#ecom').is(":hidden")) {
	  $('#ecom_link').html('+');
	  }
	$('#ecom_link').click(function() {
	  $('#ecom').slideToggle('slow');
	  if($('#ecom').is(":visible")) {
	    $('#ecom_link').html('-');
	  }
	  
	});
		$('#cms_link').click(function() {
	  $('#cms').slideToggle('slow');
	  if($('#cms').is(":visible")) {
	    $('#cms_link').html('-');
	  }
	  if($('#cms').is(":hidden")) {
	  $('#cms_link').html('+');
	  }
	});
	
		$('#seo_link').click(function() {
	  $('#seo').slideToggle('slow');
	  if($('#seo').is(":visible")) {
	    $('#seo_link').html('-');
	  }
	  if($('#seo').is(":hidden")) {
	  $('#seo_link').html('+');
	  }
	});	
});

 
