// JavaScript Document

function contact(mailtoID,rhs,lhs,innerhtml) {
  if(document.getElementById(mailtoID)!=null) {
  document.getElementById(mailtoID).href = 'mailto://' + rhs + '@' + lhs;
  document.getElementById(mailtoID).innerHTML = innerhtml; }
  }
  
function initImage(imageId,interval) { 
  image = document.getElementById(imageId);
  setOpacity(image, 0);
  image.style.display = 'block';
  fadeIn(imageId,0); 
  }

function setOpacity(obj, opacity) {
    opacity = (opacity == 100)?99.999:opacity;
  // IE/Win
    obj.style.filter = "alpha(opacity:"+opacity+")";
  // Safari<1.2, Konqueror
    obj.style.KHTMLOpacity = opacity/100;
  // Older Mozilla and Firefox
    obj.style.MozOpacity = opacity/100;
  // Safari 1.2, newer Firefox and Mozilla, CSS3
    obj.style.opacity = opacity/100;
  }

function fadeIn(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity <= 100) {
      setOpacity(obj, opacity);
      opacity += 10;
      window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 25);  /* fade-in is .25 sec */
      }
    }
  }
    
  function testimonial_window(url, name, w, h) {
     var win = window.open(url,name,'width=' + w + ', height=' + h + ', ' + 'location=no, menubar=no, ' + 'status=no, toolbar=no, scrollbars=no, resizable=no');
     win.resizeTo(w, h);
     win.focus();
     }

//Added by Morgan Ney so JavaScript can be removed from source HTML
window.onload = function(){
  if(!document.getElementById) return false; //Check for browser compliance
  var testLink = document.getElementById("testimonial");
  if(testLink)//To bypass pages that don't use testimonials, in this case testLink = NULL
  {
     testLink.onclick = function(){
        window.open("http://www.swluxurysuites.com/testimonial1.html","twin","width=650,height=580");
	    return false; //disable default behavior of onclick event
     }//End onclick
  }
  var submitLink = document.getElementById("submit");
  if(submitLink)//To only act on the "contact" page, all other pages has submitLink = NULL
  {
	  submitLink.onclick = function(){
		  document.forms[0].submit();
		  return false;
	  }//End onclick
  }
  if(document.getElementById("headerEmail")) contact('headerEmail','info','swluxurysuites.com','SEND EMAIL'); //Only necessary on 'contact' page
  contact('aemail','info','swluxurysuites.com','SEND EMAIL');
  contact('lladdr','communications','lookinglistening.com','send email');
}
