// SmallBizWebs.com JavaScript Document
// Copyright SmallBizWebs.com, A Division of The JBI Company, Inc.
// All Rights Reserved, contact SmallBizWebs.com for licensing information.
//
// ===========================
// Code loaded in Head Section
// ===========================
//
// Standard MM code functions
// This section only, copyright Adobe Systems Incorporated
//
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
//
// SmallBizWebs.com custom code functions
// Copyright SmallBizWebs.com, All Rights Reserved
//
// =======================
// Code for No Right-Click
// =======================
//
var rcMsg="All content is protected by copyright\nand images contain digital watermarks\nfor tracking purposes.";
function click(e) {
	if (document.all) {
		if (event.button==2||event.button==3) {
		alert(rcMsg);
		return false;
		}
	}
	if (document.layers) {
		if (e.which == 3) {
		alert(rcMsg);
		return false;
		}
	}
}

if (document.layers) {
	document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
//
// ===========================
// Code for Slideshow function
// ===========================
//
// SBW_StartSlideshow(picDir,picName,picType,numPics,picDelay)
// SBW_StartSlideshow('images','HdrPic','jpg','3','3.5');
//
var nextPic = 2;
function SBW_PicTransition(picDir,picName,picType,numPics) {
	if (document.all) SlideshowPic.filters(0).Apply();
	picPhoto = picDir + '/' + picName + nextPic + '.' + picType;
	nextPic++;
	if (nextPic > numPics) nextPic = 1;
	document.images.SlideshowPic.src=picPhoto;
	if (document.all) SlideshowPic.filters(0).Play();
}
function SBW_StartSlideshow(picDir,picName,picType,numPics,picDelay) {
// Preload images
	var thisCode = "MM_preloadImages(";
	for (idxPic = 1; idxPic <= numPics; idxPic++) {
		thisCode += "'" + picDir + "/" + picName + idxPic + "." + picType + "'";
		if (idxPic < numPics) {
			thisCode += ",";
		}
	}
	thisCode += ");";
	eval(thisCode);
// Loop slideshow
	picInterval = window.setInterval("SBW_PicTransition('"+picDir+"','"+picName+"','"+picType+"','"+numPics+"')",picDelay*1000);
}
//
// ==============================
// Code for Header Slideshow only
// ==============================
//
// SBW_HdrStartSlideshow(picDir,picName,picType,numPics,picDelay)
// SBW_HdrStartSlideshow('images','HdrPic','jpg','3','3.5');
//
var nextHdrPic = 2;
function SBW_HdrPicTransition(picDir,picName,picType,numPics) {
	if (document.all) HdrSlideshowPic.filters(0).Apply();
	picPhoto = picDir + '/' + picName + nextHdrPic + '.' + picType;
	nextHdrPic++;
	if (nextHdrPic > numPics) nextHdrPic = 1;
	document.images.HdrSlideshowPic.src=picPhoto;
	if (document.all) HdrSlideshowPic.filters(0).Play();
}
function SBW_HdrStartSlideshow(picDir,picName,picType,numPics,picDelay) {
// Preload images
	var thisCode = "MM_preloadImages(";
	for (idxPic = 1; idxPic <= numPics; idxPic++) {
		thisCode += "'" + picDir + "/" + picName + idxPic + "." + picType + "'";
		if (idxPic < numPics) {
			thisCode += ",";
		}
	}
	thisCode += ");";
	eval(thisCode);
// Loop slideshow
	picInterval = window.setInterval("SBW_HdrPicTransition('"+picDir+"','"+picName+"','"+picType+"','"+numPics+"')",picDelay*1000);
}
//
// ====================
// SBW_initParam v1.0
// ====================
//
// var stuff = SBW_initParam(stuff,'initvalue');
//
function SBW_initParam(parm,dflt) {
	if (typeof dflt == 'undefined' || dflt == 'undefined' || dflt == null) dflt = '';
	if (typeof parm == 'undefined' || parm == 'undefined' || parm == null || parm == '') parm = dflt;
	return parm;
}
//
// =====================
// SBW_validateForm v1.1
// =====================
//
// onSubmit="return SBW_validateForm(this,'none')"
//
function SBW_validateForm(theForm,showErr) {
  var errors='';
	showErr = SBW_initParam(showErr,'');
	if (theForm.email.value == "" || theForm.email.value == "E-Mail Address") {
    errors = '- Your E-Mail address is required.\n' + errors;
	  if (showErr == 'focus') {
	    theForm.email.focus();
		}
  } else {
    var re = /^([A-Z0-9_-]+[A-Z0-9\._-]*@)([A-Z0-9-]+\.)+(([A-Z]{2,4}|museum)$)/i;
    if (!re.test(theForm.email.value)) {
      errors = '- Your E-Mail must be a valid address.\n' + errors;
	  if (showErr == 'focus') {
		    theForm.email.focus();
			}
    }
  }
  if (errors) {
  alert('Please correct the following error:\n\n'+errors);
  return (false);
  }
  else return (true);
}
//
// ==================
// SBW_dispEmail v1.0
// ==================
//
// SBW_dispEmail('Jane','click to E-mail Jane','Inquiry From Website','<p>','</p>');
function SBW_dispEmail(addr,disp,subj,prex,postx) {
	var eMail = '';
	var theDomain = '@YoungquistOnline.com';
	var addr = SBW_initParam(addr);
	var disp = SBW_initParam(disp);
	var subj = SBW_initParam(subj,'Inquiry From YoungquistHomes.com Website');
	var xtra = SBW_initParam(xtra);
	var prex = SBW_initParam(prex);
	var postx = SBW_initParam(postx);
//
	if (disp == '') disp = addr + theDomain;
	if (subj == '') {
		eMail = '<a href="mailto:' + addr + theDomain + '">' + disp + '</a>';
	}
	else {
		eMail = '<a href="mailto:' + addr + theDomain + '?subject=' + escape(subj) + '">' + disp + '</a>';
	}
//
	document.write(prex + eMail + postx);
	return true;
}
