
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function add_player() {
  var ni = document.getElementById( 'extra_players' );
  childCount = ni.childNodes.length;
  /* alert( "Children = "+childCount ); */
  var newdiv = document.createElement( 'div' );
  var playernum = childCount+2;
  var divIdName = 'player_'+playernum+'_div';
  newdiv.setAttribute( 'id', divIdName );
  var data = 'Player Name: <input name="player_'+playernum+'_name" /><br/>'+
	'Class of: <input name="player_'+playernum+'class" /><br/>'+
	'Primary Position: <input size="4" name="player_'+playernum+'_position1" /><br/>'+
	'Secondary Position: <input size="4" name="player_'+playernum+'_position2" /><br/>'+ 
	'<textarea name="player_'+playernum+'_highlights", rows="4", cols="80", style="width:70%", onclick="this.value =\'\'" />List any awards a player might have received and any stats</textarea><br/><br/>';
	/* Element Number '+num+' has been added! <a href=\'#\' onclick=\'removeElement('+divIdName+')\'>Remove the div "'+divIdName+'"</a>'; */
  newdiv.innerHTML = data;
  ni.appendChild( newdiv );
}

function video_read_more(){
	var data = 'Package A) \n  Send us your film where we can edit it and put together a video for you. It will take about two weeks to put together the video, edit it and get it back to you. We will then post your video to our website for college coaches to look at. The cost for this service is $299. Send your video tape to: \n\n\tWisconsin Baseball Report \n\tP.O. Box 370248 \n\tMilwaukee, WI 53237 \n\nPackage B) \n  When registering for our ID camps if you do not have a professionally done video, we can make one for you. We take film at our camp. It will take about two weeks to put together the video, edit it and get it back to you. We will then post your video to our website. The cost of this service is $599.';
	alert( data );
}

function validate(form_id,email,phone) {
	var em_reg = /^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/;
	var ph_reg = /^(\+\d)*\s*(\(\d{3}\)\s*)*\d{3}(-{0,1}|\s{0,1})\d{2}(-{0,1}|\s{0,1})\d{2}$/; 
	var address = document.forms[form_id].elements[email].value;
	var number = document.forms[form_id].elements[phone].value;
	if( address == '' ){
		alert('Email field cannot be blank');
		return false;
	}
	if( number == '' ){
		alert('Phone field cannot be blank');
		return false;
	}
	if( em_reg.test(address) == false ) {
      alert('Invalid Email Address');
      return false;
   }
   if( ph_reg.test(number) == false ) {
      alert('Invalid Phone Number ( example: (123) 123-1234 )');
      return false;
   }
   return true;
}

function alert_feedback( d ){
	if( d ) 
		alert( d );
}