function home_img(){
	var myimages=new Array()
    //specify random images below. You can have as many as you wish
    myimages[1]="pho_home01.jpg"
    myimages[2]="pho_home02.jpg"
    myimages[3]="pho_home03.jpg"
	var ry=Math.floor(Math.random()*myimages.length)
	if (ry==0)
	ry=1
		document.write('<img src="images/'+myimages[ry]+'" alt="" title="Summit Bicycles is committed to the highest level of quality and value in service, repair, selection of bicycles and accessories in the San Francisco Bay Area." usemap="#Map" /><map name="Map" id="Map"><area shape="rect" coords="501,334,661,357" href="bayarea/index.html" alt="Click To Join" /></map>');
}

sfHover = function() {
	// Support the standard nav without a class of nav.
	var el = document.getElementById("nav");
	if(!/\bnav\b/.test(el.className) && el.tagName == "UL")
		setHover(el);

	// Find all unordered lists.
	var ieNavs = document.getElementsByTagName('ul');
	for(i=0; i<ieNavs.length; i++) {
		var ul = ieNavs[i];
		// If they have a class of nav add the menu hover.
		if(/\bnav\b/.test(ul.className))
			setHover(ul);
	}

}

function setHover(nav) {
	var ieULs = nav.getElementsByTagName('ul');
	if (navigator.appVersion.substr(22,3)!="5.0") {
		// IE script to cover <select> elements with <iframe>s
		for (j=0; j<ieULs.length; j++) {
			var ieMat=document.createElement('iframe');
			if(document.location.protocol == "https:")
				ieMat.src="//0";
			else if(window.opera != "undefined")
				ieMat.src="";
			else
			ieMat.src="javascript:false";
			ieMat.scrolling="no";
			ieMat.frameBorder="0";
			ieMat.style.width="148px";
			ieMat.style.height=ieULs[j].offsetHeight+"px";
			ieMat.style.zIndex="-1";
			ieULs[j].insertBefore(ieMat, ieULs[j].childNodes[0]);
			ieULs[j].style.zIndex="101";
		}
		// IE script to change class on mouseover
		var ieLIs = nav.getElementsByTagName('li');
		for (var i=0; i<ieLIs.length; i++) if (ieLIs[i]) {
			// Add a sfhover class to the li.
			ieLIs[i].onmouseover=function() {
				if(!/\bsfhover\b/.test(this.className))
					this.className+=" sfhover";
			}
			ieLIs[i].onmouseout=function() {
				if(!this.contains(event.toElement))
					this.className=this.className.replace(' sfhover', '');
			}
		}
	} 
	else 
	{
		// IE 5.0 doesn't support iframes so hide the select statements on hover and show on mouse out.
		// IE script to change class on mouseover
		var ieLIs = document.getElementById('nav').getElementsByTagName('li');
		for (var i=0; i<ieLIs.length; i++) if (ieLIs[i]) {
//			ieLIs[i].onmouseover=function() {this.className+=" sfhover";hideSelects();}
//			ieLIs[i].onmouseout=function() {this.className=this.className.replace(' sfhover', '');showSelects()}
			ieLIs[i].onmouseover=function() {this.className+=" sfhover";}
			ieLIs[i].onmouseout=function() {this.className=this.className.replace(' sfhover', '');}			
		}
	}
}

// If IE 5.0 hide and show the select statements.
function hideSelects(){
	var oSelects=document.getElementsByTagName("select");
	for(var i=0;i<oSelects.length;i++)
		oSelects[i].className+=" hide";
}

function showSelects(){
	var oSelects=document.getElementsByTagName("select");
	for(var i=0;i<oSelects.length;i++)
		oSelects[i].className=oSelects[i].className.replace(" hide","");
}

// Run this only for IE.
//if (window.attachEvent) window.attachEvent('onload', sfHover);
if (document.all&&document.getElementById) window.onload=sfHover;
// end


function popup(mypage, myname, w, h, scroll,tool,stat) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable,toolbar='+tool+',status='+stat+''
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) 
		{ 
			win.window.focus(); 
		}
}

//Validate Email

function emailCheck (emailStr)
{
	var emailPat=/^(.+)@(.+)$/
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
	var validChars="\[^\\s" + specialChars + "\]"
	var quotedUser="(\"[^\"]*\")"
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	var atom=validChars + '+'
	var word="(" + atom + "|" + quotedUser + ")"
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
	var matchArray=emailStr.match(emailPat)
	if (matchArray==null) {
		alert("Please input a valid Email Address (check @ and .'s). Thank You.")
		return false
	}
	var user=matchArray[1]
	var domain=matchArray[2]

	if (user.match(userPat)==null) {
	    alert("The username doesn't seem to be valid. Please input a valid Email Address. Thank You")
	    return false
	}

	var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null) {
		  for (var i=1;i<=4;i++) {
			    if (IPArray[i]>255) {
			        alert("Destination IP address is invalid! Please input a valid Email Address. Thank You.")
					return false
			    }
		    }
	    return true
	}

	var domainArray=domain.match(domainPat)
	if (domainArray==null) {
		alert("The domain name doesn't seem to be valid. Please input a valid Email Address. Thank You.")
	    return false
	}
	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	var len=domArr.length
	if (domArr[domArr.length-1].length<2 ||
	    domArr[domArr.length-1].length>3) {
	   alert("The address must end in a three-letter domain, or two letter country. Please input a valid Email Address. Thank You.")
	   return false
	}

	if (len<2) {
	   var errStr="This address is missing a hostname. Please input a valid Email Address. Thank You."
	   alert(errStr)
	   return false
	}

	return true;
}

function trim(str)
{
    str.replace(/^\s*/, '').replace(/\s*$/, '');
	return str;
}