<!-- Begin

function loadSearch1() {
	$.ajax({
	type: "GET",
	url: "./php/projects2.php",
	cache: false,
	beforeSend: function(html) 
	{
  	  document.getElementById("insert_search").innerHTML = ''; 
	  // $("#update1").show();
	  $('#update1').removeClass('hide');
	  $("#update1").html('Call GPE Engineering Contractors Today!');	               
      },
	success: function(html)
	{
	  // $("#insert_search").show();
	  $('#update1').addClass('show');
	  $("#insert_search").append(html);
	  // $("#update1").hide();
	  $('#update1').addClass('hide');
	  $(function() {
		$('a[href^="http://"]')  .attr("target", "_blank");
		$('a[href^="http://gpeeng.com"]')  .attr("target", "_self");
		$('a[href^="http://www.gpeeng.com"]')  .attr("target", "_self");
	  });
	}
	});
}

function init()
{
  // BEG rel="external"
  if (!document.getElementsByTagName) return; 
  var anchors = document.getElementsByTagName("a"); 
  for (var i=0; i<anchors.length; i++) { 
    var anchor = anchors[i]; 
    if (anchor.getAttribute("href") && 
        anchor.getAttribute("rel") == "external") 
      anchor.target = "_blank"; 
  } 
  // END rel="external"
  // BEG add2Favs
  document.getElementById('add2Favs').onclick = function() {
    var titlef = document.title;
    var urlf = location.href;
    if (window.sidebar) { 
      window.sidebar.addPanel(titlef, urlf,""); 
    } 
    else if( document.all ) {
      window.external.AddFavorite( urlf, titlef);
    } 
    else if( window.opera && window.print ) {
      return true;
    }
    return false;
  }
  // END add2Favs
  // BEG add2Favs2
  document.getElementById('add2Favs2').onclick = function() {
    var titlef = document.title;
    var urlf = location.href;
    if (window.sidebar) { 
      window.sidebar.addPanel(titlef, urlf,""); 
    } 
    else if( document.all ) {
      window.external.AddFavorite( urlf, titlef);
    } 
    else if( window.opera && window.print ) {
      return true;
    }
    return false;
  }
  // END add2Favs2
  // BEG add2Social
  document.getElementById('add2Social').onclick = function() {
    var titlef = document.title;
    var urlf = location.href;
	  // window.location = 'http://www.tagenie.com/submit.php?url='+encodeURIComponent(urlf)+'&amp;title='+encodeURIComponent(titlef)+'';
	  window.open('http://www.addthis.com/bookmark.php?v=250&username=&url='+encodeURIComponent(urlf)+'&title='+encodeURIComponent(titlef)+'','_blank');  
    return false;
  }
  // END add2Social
  // BEG add2Social2
  document.getElementById('add2Social2').onclick = function() {
    var titlef = document.title;
    var urlf = location.href;
	  // window.location = 'http://www.tagenie.com/submit.php?url='+encodeURIComponent(urlf)+'&amp;title='+encodeURIComponent(titlef)+'';
	  window.open('http://www.addthis.com/bookmark.php?v=250&username=&url='+encodeURIComponent(urlf)+'&title='+encodeURIComponent(titlef)+'','_blank');  
    return false;
  }
  // END add2Social2
  // *** MAIN DISPLAY
  if ( document.getElementById('engineering-contractors-miami-overlay') ) 
  {
    document.getElementById('engineering-contractors-miami-overlay').className='hide';
    // document.getElementById('engineering-contractors-miami-florida').className='show';
    document.getElementById('preload1').className='invisible';
  }
  // *** MAIN DISPLAY
  // BEG formInit 
  if ( document.getElementById('Contact') )
  {
  document.getElementById('Contact').onsubmit = function () {
    return check_it(this)
  }
  document.getElementById('Message_Text').onclick = function () {
    var defaultText = 'Your questions or comments can be entered here...';
    if ( this.value == defaultText ){ this.value = ''; }
  }
  document.forms["Contact"].Contact_Name.focus()
  }
  // END formInit
  // Begin UPDATE1
  if ( document.getElementById('ajax-query-1') )
  {
  $(function() {
  $(document).ready(function() {
      loadSearch1();
      setInterval("loadSearch1()",30000);
  });
  });
  }
  // END UPDATE1
}
window.onload = init;

// Begin LOADING
function loading1()
{
  document.write('<object type="application/x-shockwave-flash" data="c.swf?path=loading.swf" width="80" height="40">\n');
  document.write('<param name="movie" value="c.swf?path=loading.swf">\n');
  document.write('<param name="quality" value="high">\n');
  document.write('<param name="bgcolor" value="transparent">\n');
  document.write('<param name="wmode" value="transparent">\n');
  document.write('<img src="./images/clear.gif" width="80" height="40" alt=""/></object>\n');
}
// End LOADER

// Begin DISABLE-ENTER
function checkCR(evt) {
    var evt  = (evt) ? evt : ((event) ? event : null);
    var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
    if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
}
document.onkeypress = checkCR; // attach the function to the onkeypress event
// End DISABLE-ENTER

sfFocus = function() { 
  var sfEls1 = document.getElementsByTagName("input"); 
  for (var i=0; i<sfEls1.length; i++) { 
    if(sfEls1[i].getAttribute("type") != "checkbox") {
      sfEls1[i].onfocus=function() { this.className="sfFocus"; } 
      sfEls1[i].onblur=function() { this.className="formbox"; } 
    } 
  } 
  var sfEls2 = document.getElementsByTagName("select"); 
  for (var i=0; i<sfEls2.length; i++) { 
    sfEls2[i].onfocus=function() { this.className="sfFocus"; } 
    sfEls2[i].onblur=function() { this.className="formbox"; } 
  } 
  var sfEls3 = document.getElementsByTagName("textarea"); 
  for (var i=0; i<sfEls3.length; i++) { 
    sfEls3[i].onfocus=function() { this.className="sfFocus"; } 
    sfEls3[i].onblur=function() { this.className="formbox"; } 
  } 
} 
if (window.attachEvent) window.attachEvent("onload", sfFocus); 
function check_it(the_form){
    var illegalChars1= /[\(\)\<\>\,\;\:\\\/\"\@\[\]]/
    if (the_form.Contact_Name.value.match(illegalChars1)) {
        alert('Contact name contains illegal characters');
        the_form.Contact_Name.focus();
        return false;    
    }
    var illegalChars2= /[\(\)\<\>\,\;\:\\\/\"\[\]]/
    if (the_form.email.value.match(illegalChars2)) {
        alert('The email address contains illegal characters');
        the_form.email.focus();
        return false;    
    }
    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(the_form.email.value))) { 
        alert('Please enter a valid email address');
        the_form.email.focus();
        return false;    
    }
    if(the_form.email.value != the_form.email_confirm.value){
        alert('Email address does not match Email Confirm.');
        the_form.email.focus();
        return false;
    }
    var illegalChars3= /[\<\>\\\/\[\]]/
    if (the_form.Message_Text.value.match(illegalChars3)) {
        alert('Message text contains illegal characters');
        the_form.Message_Text.focus();
        return false;    
    }
    var checkdigit4 = parseInt(the_form.checkdigit1.value)+ parseInt(the_form.checkdigit2.value);
    if(parseInt(the_form.checkdigit3.value) != checkdigit4 ){
        alert('Invalid Spam Check Digit.');
        the_form.checkdigit3.focus();
        return false;
   }
   return true;
}


