function init(){
	initRolloverImages();
}


function PopupQTVR(sPicURL) {
     window.open( "/templates/qtvr/popupQTVR.htm?"+sPicURL, "", "HEIGHT=480,WIDTH=480");
}

function PopupQTVRPortrait(sPicURL) {
     window.open( "/templates/qtvr/popupQTVRPortrait.htm?"+sPicURL, "", "HEIGHT=590,WIDTH=380");
}


function PopupPicLarge(sPicURL) {
     window.open( "/templates/images/crosby/regions/popup.htm?"+sPicURL, "",  
     "resizable=1,HEIGHT=740,WIDTH=1000");
}



//
// DOM rollover script
// apply "rollover" class to an image,(or input type="image")
// will swap for image with "_over" appended to the filename
//
function initRolloverImages(){
	var i;
	preLoadImgs = [];
	rolloverImages=document.getElementsByTagName("img");
	rolloverInputs=document.getElementsByTagName("input");
	rolloverTags=[]
	for(i in rolloverImages){
		rolloverTags.push(rolloverImages[i]);
	}
	for(i in rolloverInputs){
		rolloverTags.push(rolloverInputs[i]);
	}
	for(i in rolloverTags){
		tag = rolloverTags[i]
		if(tag.className == "rollover"){
			src = new String(tag.src)
			tag.setAttribute("outSrc" , src);
			ext = src.match(/(\.)([^\.]*$)/)[2];
			regEx = new RegExp("\."+ext, "i")  
			tag.setAttribute("overSrc" , src.replace(regEx, "_over."+ext));
			preLoadImgs[i] = new Image();
			preLoadImgs[i].src = tag.getAttribute("overSrc");
			tag.onmouseover = function() {
				this.src = this.getAttribute("overSrc");
				}
			tag.onmouseout = function() {
				this.src = this.getAttribute("outSrc");
				}
		}
	}

}




//clears the cursor current field of default to accept user input
function clearDefault(el) {
  		if (el.defaultValue==el.value) el.value = ""
}


function validate(f){

  requiredFields=new Array("name","email","comments")
  errors=""
  for(i=0;i<requiredFields.length;i++){
    if(f[requiredFields[i]].value==""){
      errors+="The "+requiredFields[i]+" field is empty\n";
      f[requiredFields[i]].style.backgroundColor = "#fcc";
      f[requiredFields[i]].onchange=function(){
        this.style.backgroundColor="#fff";
        }
      }
    }
  emailPattern=/^([\.a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/
  email=String(f.email.value)
  if(!email.match(emailPattern)&&email!=""){
    errors+="You have entered an invalid E-mail address\n";
      f.email.style.backgroundColor = "#fcc";
      f.email.onchange=function(){
        this.style.backgroundColor="#fff";
        }
    }

  if(errors!=""){
    errors="Your form has the following errors (shown in red)\n\n"+errors;
    alert(errors)
    return false;
    }
  else {
    return true;
    }


  }
  
  
  
  
  
  
  