
function checkAttorneyForm() {
	fm = document.forms['getAttorneyForm'];
	var missing = "";
	if (fm.attorney.value == "")
		missing = "Please select an attorney name.";
			
	if (missing != "") {
		alert(missing);
		return false;
	}
	return true;
}
function checkPositionTeamForm() {
	fm = document.forms['positionTeamSearchForm'];
	var missing = "";
	if (fm.position.value == "" && fm.team.value == "")
		missing = "Please select at least a position or a team.";
			
	if (missing != "") {
		alert(missing);
		return false;
	}
	return true;
}
function searchStatsSubmit(criteria,start,operator) {	
	fm = document.forms['searchForm'];
	
	fm.criteria.value = criteria;
	fm.startrow.value = start;
	fm.searchOperator.value = operator;	
	fm.submit();
}
function getRandomImage() {
  var upperLimit = 5;	  
  var imagePath = "wsimages/home-images/";
  var baseName = "header-";
  var imageType = ".jpg";

  var randomNum = Math.round(Math.random()*upperLimit);  
  var fileName = "<img src=" + imagePath + baseName + randomNum + imageType + " id='header-rotate' width='297' length='279' alt='Real Estate' />";	  
  return fileName;
}

function checkSubscribeForm() {
	fm = document.forms['subscribeForm'];
	var missing = "";
	
	var checkflag = true;
	for (i=0; i<fm.length; i++)  {
		if (fm[i].type == "checkbox" && fm[i].checked) {			
			checkflag = false;
		}
	}
	if (checkflag) {
		missing += "You must check at least 1 cyber graham option\n";
	}
	
	if (fm.email.value == "")
		missing += "E-mail is required.";
	else {
		temp = fm.email.value + " ";
		found = temp.search(/[\w\.-]+@([\w-]+\.){1,3}[a-zA-Z]{2,}\s{1}/);
		if (found != 0)
			missing += "E-mail must be in the form username@domain.com"
	}
	if (missing != "") {
		alert(missing);
		return false;
	}
	return true;
}

function checkHomepageSubscribeForm() {
	fm = document.forms['subscribeForm'];
	var missing = "";	
	
	if (fm.email.value == "")
		missing += "E-mail is required.";
	else {
		temp = fm.email.value + " ";
		found = temp.search(/[\w\.-]+@([\w-]+\.){1,3}[a-zA-Z]{2,}\s{1}/);
		if (found != 0)
			missing += "E-mail must be in the form username@domain.com"
	}
	if (missing != "") {
		alert(missing);
		return false;
	}
	return true;
}


/*Rotating Images on Homepage*/
var slideShowSpeed = 3500;
var fadeDuration = 3; 

fadeimgarray = new Array(); 
fadeimgarray[0] = '/wsimages/home-images/header-0.jpg'; 
fadeimgarray[1] = '/wsimages/home-images/header-1.jpg'; 
fadeimgarray[2] = '/wsimages/home-images/header-2.jpg'; 
fadeimgarray[3] = '/wsimages/home-images/header-3.jpg'; 
fadeimgarray[4] = '/wsimages/home-images/header-4.jpg'; 
fadeimgarray[5] = '/wsimages/home-images/header-5.jpg'; 

var t 
var j = 0 

var preLoad = new Array() 
for (i = 0; i < fadeimgarray.length; i++){ 
	preLoad[i] = new Image() 
	preLoad[i].src = fadeimgarray[i] 
} 

function runSlideShow(){ 
	if (document.all){ 
		document.images.SlideShow.style.filter="blendTrans(duration=2)"
		document.images.SlideShow.style.filter="blendTrans(duration=fadeDuration)" 
		document.images.SlideShow.filters.blendTrans.Apply() 
	} 
	document.images.SlideShow.src = preLoad[j].src 
	if (document.all){ 
		document.images.SlideShow.filters.blendTrans.Play() 
	} 
	j = j + 1 
	if (j > (fadeimgarray.length-1)) j=0 
	t = setTimeout('runSlideShow()', slideShowSpeed) 
}
