$(document).ready(function(imgLoc,loc){
   // Define div that contains links and add class to each one.
   loc = document.getElementById("link");
   imgLoc = loc.getElementsByTagName("a");
   for(w=0; w<=imgLoc.length; w++){
      $(imgLoc[w]).addClass("locate");
      
   }
   springP(imgLoc,loc);
});

$(document).ready(function(){
   if(document.location.href.indexOf("contact.php")!== -1 || document.location.href.indexOf("contactfinish.php")!== -1){
      if($("#tow").attr("checked")!== "checked"){
         $("#web").hide();
      }
   }
});


function rollover(thisE)
{
    if(!document.getAttribute && document.setAttribute) return
    var regularState = thisE.getAttribute("src")
    var locateDot = regularState.lastIndexOf(".");
    var changeState = regularState.slice(0,locateDot);
    var getExt = regularState.slice(locateDot);
    thisE.setAttribute("src",changeState + "over" + getExt);
    thisE.onmouseout = function(){thisE.setAttribute("src",regularState)
    }
} 


function springP(){

   // On hover, grab attributes changeimg and changetext for image and text swap
   $(".locate").click(function(){
      var img=$(this).attr("changeimg");
      var word=$(this).attr("changetext");
      // swap image in, making it hidden for the fade in effect.
      
      if($("#swapable").is(":hidden")){
         $("#swapable").attr("src",img);
         $("#text").text(word);
         $("#swapable").fadeIn(400);
         $("#text").fadeIn(400);
      }
   });
}





