function update_schedule_sport(school_id,sport_id)
{
	new Ajax.Updater('divSportSchedule', '/school/home/school_home_sport_schedule?school_id='+school_id+'&sport_id='+sport_id, {asynchronous:true, evalScripts:true,before: function(){ new Effect.Appear('pro');},onComplete:function(){new Effect.Fade('pro'); }});

}


var gotselected=new Array(false,false,false);
var allids=new Array('Sport','Event','Organization');
function change_dropdown_text(obj)
{

	for(i=0;i<allids.length;i++)
	{
		if(obj.id!=allids[i].toLowerCase()+"SelectBox")
		{
			if(!gotselected[i])
			$(allids[i].toLowerCase()+"SelectBox").options[0].text=" - - Not Selected - - ";
		}
		else
		{
			gotselected[i]=true;
			obj.options[0].text=" - - All "+allids[i]+"s - - ";
			obj.options[0].value="-1";
		}

	}
}

function decideTabhm(cond,span)
{
	for(i=1;;i++)
	{
		ele=eval("document.getElementById('"+span+i+"')");
		if(ele==undefined)
			break;
		if(i==cond)
		{
			ele.className='activetabhome';
		}
		else
		{
			ele.className='inactivetabhome';
		}
	}
}




	function switchVideo(cURL,titleTD,fanfare_contributor_name,link)
	{

            var objTypeTag = "application/x-mplayer2"; // The  MIME type to load the WMP plugin in non-IE browsers on Windows
 		    var isWin = navigator.userAgent.toLowerCase().indexOf("windows") != -1
            if (visitorOS != "Windows")
            {
                    if (navigator.appName=="Netscape")
                    {
                            objTypeTag = "audio/mpeg"
                    }
            }

            if(document.getElementById("mediaPlayerMozilla"))
				{
					document.getElementById("mediaPlayerMozilla").innerHTML = '<object align="middle" id="VideoPlayer"  height="240" width="360" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject"><param name="URL" value="' + cURL + '"><param name="type" value="' + objTypeTag + '"><param name="AutoStart" value="True"><param name="showstatusbar" value="false"><param name="enablecontextmenu" value="false"><embed align="middle" autostart="True" height="240" width="360" loop="False"  src="' + cURL + '" type="' + objTypeTag + '" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" id="VideoPlayer" name="VideoPlayer" showstatusbar="0" stretchToFit="true" PlayCount="9999" enablecontextmenu="false" SendPlayStateChangeEvents="true" uiMode="full" currentPosition="' + 0 + '"/>';
				}

                 $('titleTD').innerHTML = "&nbsp;&nbsp;" + titleTD;
				if (Trim(link)=="")
				{
					$('div_anchorPlay').style.display='none';
                }
				else
				{
					$('div_anchorPlay').style.display='block';
					$('anchorPlay').href=link;
				}
                Element.hide("imgDiv");
                Element.show("videoDiv");
				if(isWin)
				{
					document.VideoPlayer.controls.play();
				}
	    }

////////////////////////////////BLOCK TO ADD SPORT, EVENT, ACIVITY, CONTACT CO-ORDINATOR/////////////////////////////////////////
function add_new_roster(schoolid,aoi_id,aoi_type)
	{
		var additional_opt=""
		if ($('school_year') && $('school_year').value !="")
			additional_opt ="&school_year="+$('school_year').value;
		
		if (arguments.length>3) additional_opt = additional_opt + "&player_id="+arguments[3];

		var opt = { method: 'post',
						before: function(){ },
						onComplete: function(t) {
						$('new_sport_roster_div').innerHTML=t.responseText;
						//$('frm_roster_listing').btngetRoster.click();
						//$('roster_jersey_num').focus();
						}
					}
				new Ajax.Request('/school/home/add_new_roster?school_id='+schoolid+'&aoi_id='+aoi_id+'&aoi_type='+aoi_type+additional_opt,opt);
	}

function view_rosters(schoolid,aoi_id,aoi_type)
	{
		 var opt = { method: 'post',
						before: function(){ },
						onComplete: function(t) {
						$('aoi_top_div').style.display='none';
						$('area_of_interest_div').innerHTML=t.responseText;
						$('frm_player_search').btnSearch.click();
						//$('roster_jersey_num').focus();
						}
					}
				new Ajax.Request('/school/home/roster_list?school_id='+schoolid+'&aoi_id='+aoi_id+'&aoi_type='+aoi_type,opt);
	}

function updateSchoolByStateId(dropDownId, state_id){
	
	var added_school=$('added_school').value;
	var opt = { method: 'post',
		before: function(){ new Effect.Appear("pro");},
		onComplete: function(t) {
		updateDropDown(dropDownId,t.responseText);
		new Effect.Fade("pro");
		}
		}
	   new Ajax.Request('/school/home/get_schools_by_state_id?added_school='+added_school+'&state_id='+state_id, opt);
}


function view_game_article_list(game_id,schoolid,aoi_id,aoi_type)
	{

		var opt = { method: 'post',
						before: function(){ },
						onComplete: function(t) {
						$('area_of_interest_div').innerHTML=t.responseText;
						}
					}
				new Ajax.Request('/school/home/game_article_list?game_id='+game_id+'&school_id='+schoolid+'&aoi_id='+aoi_id+'&aoi_type='+aoi_type,opt);

	}
function new_game_video(game_id,schoolid,aoi_id,aoi_type)
	{

		var opt = { method: 'post',
						before: function(){ },
						onComplete: function(t) {
						$('area_of_interest_div').innerHTML=t.responseText;
						}
					}
				new Ajax.Request('/school/home/new_game_video?game_id='+game_id+'&school_id='+schoolid+'&aoi_id='+aoi_id+'&aoi_type='+aoi_type,opt);
	}


function view_game_video_list(game_id,schoolid,aoi_id,aoi_type)
	{

		var opt = { method: 'post',
						before: function(){ },
						onComplete: function(t) {
						$('area_of_interest_div').innerHTML=t.responseText;
						}
					}
				new Ajax.Request('/school/home/game_video_list?game_id='+game_id+'&school_id='+schoolid+'&aoi_id='+aoi_id+'&aoi_type='+aoi_type,opt);

	}
function new_game_article(game_id,schoolid,aoi_id,aoi_type)
	{

		var opt = { method: 'post',
						before: function(){ },
						onComplete: function(t) {
						$('area_of_interest_div').innerHTML=t.responseText;
						}
					}
				new Ajax.Request('/school/home/new_game_article?game_id='+game_id+'&school_id='+schoolid+'&aoi_id='+aoi_id+'&aoi_type='+aoi_type,opt);
	}


function view_game_school_list(game_id,schoolid,aoi_id,aoi_type)
	{

		var opt = { method: 'post',
						before: function(){ },
						onComplete: function(t) {
						$('area_of_interest_div').innerHTML=t.responseText;
						}
					}
				new Ajax.Request('/school/home/game_school_list?game_id='+game_id+'&school_id='+schoolid+'&aoi_id='+aoi_id+'&aoi_type='+aoi_type,opt);

	}
function new_game_school(game_id,schoolid,aoi_id,aoi_type)
	{

		var opt = { method: 'post',
						before: function(){ },
						onComplete: function(t) {
						$('area_of_interest_div').innerHTML=t.responseText;
						}
					}
				new Ajax.Request('/school/home/new_game_school?game_id='+game_id+'&school_id='+schoolid+'&aoi_id='+aoi_id+'&aoi_type='+aoi_type,opt);
	}


function view_game_list(schoolid,aoi_id,aoi_type)
	{
		 var opt = { method: 'post',
						before: function(){ },
						onComplete: function(t) {
						$('aoi_top_div').style.display='none';
						$('area_of_interest_div').innerHTML=t.responseText;
						}
					}
				new Ajax.Request('/school/home/game_schedule_list?school_id='+schoolid+'&aoi_id='+aoi_id+'&aoi_type='+aoi_type,opt);
	}
function new_game_schedule(schoolid,aoi_id,aoi_type)
	{
		var additional_opt=""
		
		if (arguments.length>3) additional_opt="&game_id="+arguments[3]

		var opt = { method: 'post',
						before: function(){ },
						onComplete: function(t) {
						$('area_of_interest_div').innerHTML=t.responseText;
						}
					}
				new Ajax.Request('/school/home/new_game_schedule?school_id='+schoolid+'&aoi_id='+aoi_id+'&aoi_type='+aoi_type+additional_opt,opt);
	}

    function delete_roster(roster_id)
	{
		if (confirm('Are you sure you want to Delete? All plays for this roster will be deleted.'))
		{
			$('delete_roster_id').value=roster_id;
			$('frm_roster_listing').btngetRoster.click();
		}

	}

    function update_roster(roster_id)
	{
		new Ajax.Updater('new_sport_roster_div', '/school/home/roster_edit?roster_id='+roster_id, {asynchronous:true, evalScripts:true,before: function(){ new Effect.Appear('pro');},onComplete:function(){new Effect.Fade('pro'); }});

	}

	function refreshSportRosterList(sportId,school_year)
	{
		$('frm_roster_listing').sport_id.value=sportId;
		$('frm_roster_listing').sport_id.value=school_year;
		$('frm_roster_listing').btngetRoster.click();
	}

	function view_edit_aoi(schoolid)
	{
		 fadedDiv(true);
		 divele=document.createElement("div");
		 divele.id="view_edit_aoi_div";
		 divele.className="listViewThHeading";
		 //divele.style.color="#E4E4E4";
		 divele.style.position="absolute";
		 divele.style.top=(document.body.clientHeight/2-170)+"px";
		 divele.style.left=(document.body.clientWidth/2-150)+"px";
		 divele.style.zIndex="100";
		 window.scrollTo(0,0);

			 divele.innerHTML="<b>Loading...</b>";
			 document.body.appendChild(divele);
			 var opt = { method: 'post',
							before: function(){ },
							onComplete: function(t) {

							divele.innerHTML=t.responseText;


							}
						}
					new Ajax.Request('/school/home/edit_aoi_school?school_id='+schoolid,opt);
		}


	function close_edit_aoi(return_val)
	{
		fadedDiv(false);
		document.body.removeChild(document.getElementById('view_edit_aoi_div'));
		
		window.location.reload();


	}
function setbuttonvalue(btnvalue) 
{
//	alert(btnvalue);
	$('button_type').value = btnvalue;
}

function view_add_sports(schoolid)
	{
		 fadedDiv(true);
		 divele=document.createElement("div");
		 divele.id="view_add_sports_div";
		 divele.className="listViewThHeading";
		 //divele.style.color="#E4E4E4";
	     divele.style.zIndex="100";
		 divele.style.position="absolute";
		 divele.style.top=(document.body.clientHeight/2-30)+"px";
		 divele.style.left=(document.body.clientWidth/2-100)+"px";
		 window.scrollTo(0,0);

		 divele.innerHTML="<b>Loading...</b>";
		 document.body.appendChild(divele);
		 var opt = { method: 'post',
						before: function(){ },
						onComplete: function(t) {

						divele.innerHTML=t.responseText;


						}
					}
				new Ajax.Request('/school/home/add_new_sport?school_id='+schoolid,opt);
	}


	function close_add_sport(return_val)
	{
		document.body.removeChild(document.getElementById('view_add_sports_div'));
		fadedDiv(false);
		window.location.reload();


	}

	function close_add_sport_without_refreshing()
	{
		document.body.removeChild(document.getElementById('view_add_sports_div'));
		fadedDiv(false);

	}

function view_add_activities(schoolid)
	{
		 //divele=eval("document.getElementById('viewdiv_"+memberid+"_"+schoolid+"')");
		 fadedDiv(true);
		 divele=document.createElement("div");
		 divele.id="view_add_activities_div";
		 divele.className="listViewThHeading";
		 //divele.style.color="#E4E4E4";
		 divele.style.position="absolute";
		 divele.style.zIndex="1000";
		 divele.style.top=(document.body.clientHeight/2-30)+"px";
		 divele.style.left=(document.body.clientWidth/2-100)+"px";
		 window.scrollTo(0,0);

		 divele.innerHTML="<b>Loading...</b>";
		 document.body.appendChild(divele);
		 var opt = { method: 'post',
						before: function(){ },
						onComplete: function(t) {

						divele.innerHTML=t.responseText;


						}
					}
				new Ajax.Request('/school/home/add_new_activity?school_id='+schoolid,opt);
	}





	function close_add_activity(return_val)
	{
		document.body.removeChild(document.getElementById('view_add_activities_div'));
		fadedDiv(false);
		window.location.reload();
	}

	function close_add_activity_without_refreshing()
	{
		document.body.removeChild(document.getElementById('view_add_activities_div'));
		fadedDiv(false);

	}


	function view_add_events(schoolid)
	{
		 //divele=eval("document.getElementById('viewdiv_"+memberid+"_"+schoolid+"')");
		 fadedDiv(true);
		 divele=document.createElement("div");
		 divele.id="view_add_activities_div";
		 divele.className="listViewThHeading";
		 //divele.style.color="#E4E4E4";
		 divele.style.position="absolute";
		 divele.style.zIndex="100";
		 divele.style.top=(document.body.clientHeight/2-30)+"px";
		 divele.style.left=(document.body.clientWidth/2-100)+"px";
		 window.scrollTo(0,0);

		 divele.innerHTML="<b>Loading...</b>";
		 document.body.appendChild(divele);
		 var opt = { method: 'post',
						before: function(){ },
						onComplete: function(t) {

						divele.innerHTML=t.responseText;


						}
					}
				new Ajax.Request('/school/home/add_new_event?school_id='+schoolid,opt);
	}





	function close_add_event(return_val)
	{
		refresh_slider();
		document.body.removeChild(document.getElementById('view_add_activities_div'));
		fadedDiv(false);
		window.location.reload();
	}
	function close_add_event_without_refresh()
	{
		document.body.removeChild(document.getElementById('view_add_activities_div'));
		fadedDiv(false);
	}


	function view_add_contact_coordinator(schoolid)
	{
		 fadedDiv(true);
		 divele=document.createElement("div");
		 divele.id="view_add_contact_coordinator_div";
		 divele.className="listViewThHeading";
		 //divele.style.color="#E4E4E4";
		 divele.style.zIndex="100";
		 divele.style.position="absolute";
		 //divele.style.top=(document.body.clientHeight/2-50)+"px";
		 //divele.style.left=(document.body.clientWidth/2-350)+"px";
		 divele.style.top=(((document.body.clientHeight+document.body.scrollTop)/2)+50)+"px";
		 divele.style.left=(document.body.clientWidth/2-60)+"px";
		 //window.scrollTo(0,0);

		 divele.innerHTML="<b>Loading...</b>";
		 document.body.appendChild(divele);
		 var opt = { method: 'post',
						before: function(){ },
						onComplete: function(t) {
						divele.innerHTML=t.responseText;
						$('member_name').focus();
						}
					}
				new Ajax.Request('/school/home/contact_coordinator?school_id='+schoolid,opt);
	}

	function add_volunteer_coordinator(school_id)
	{
		 var opt = { method: 'post',
						before: function(){ },
						onComplete: function(t)
						{
							if (t.responseText == "success")
							{
								$('school_vol_span').innerHTML="As a Local Coordinator you will be able to modify the content for the School or Team website";
								window.setTimeout("refresh_school_homepage();",1000);

							}
							else if (t.responseText == "failure")
							{
								//alert('Sorry there is already a local cordinator for this school');
							}
						}
					}
		new Ajax.Request('/school/home/add_volunteer_coordinator?school_id='+school_id,opt);
	}

	function refresh_school_homepage()
	{
		window.location.reload();
	}

	function close_add_contact_coordinator(return_val)
	{
		document.getElementById('view_add_contact_coordinator_div').innerHTML="<b>Message has been sent to school coordinator.</b>";
		window.setTimeout("close_add_contact_coordinator_without_refreshing()",1000);
	}
	function close_add_contact_coordinator_without_refreshing()
	{
		document.body.removeChild(document.getElementById('view_add_contact_coordinator_div'));
		fadedDiv(false);
	}

///////////////////////////////////////// BLOCK ENDS HERE///////////////////////////////////////////////////////
function decideTabsc(cond,span)
	{

		for(i=1;;i++)
		 {
		  ele=eval("document.getElementById('"+span+i+"')");
		  img_left_id=eval("document.getElementById('img_left_"+i+"')");
		  img_right_id=eval("document.getElementById('img_right_"+i+"')");
		  if(ele==undefined)
			break;
		  if(i==cond)
		  {
			img_left_id.src="/images/gray_tab_left.gif";
			img_right_id.src="/images/gray_tab_right.gif";
			ele.className='school_active_tab';
		  }
		  else
		  {
			img_left_id.src="/images/lblue_left_curve.gif";
			img_right_id.src="/images/lblue_right_curve.gif";
			ele.className='school_deactive_tab';
		  }
		 }
	}

	function decideTabcp(cond,span)
	{
		for(i=1;;i++)
		 {
		  ele=eval("document.getElementById('"+span+i+"')");
		  image_left_id=eval("document.getElementById('image_left_"+i+"')");
		  image_right_id=eval("document.getElementById('image_right_"+i+"')");
		  if(ele==undefined)
			break;
		  if(i==cond)
		  {
			image_left_id.src="/images/blue_tab_left.gif";
			image_right_id.src="/images/blue_tab_right.gif";
			ele.className='school_active_tab';
		  }
		  else
		  {
			image_left_id.src="/images/lblue_left_curve.gif";
			image_right_id.src="/images/lblue_right_curve.gif";
			ele.className='school_deactive_tab';
		  }
		 }
	}


	function dvmsg(i)
	{
		if(typeof(rememberFilter)=="function") rememberFilter();
		var school_id="";
    if(arguments.length>1) school_id=arguments[1];

    if(i== "calendar")
		{

			$('school_information_type').value="calendar"
			new Ajax.Request('/school/home/school_calendar_panel?school_id='+school_id+'&sport_id='+$('sportSelectBox').value+'&event_id='+$('eventSelectBox').value+'&activity_id='+$('activitySelectBox').value, {asynchronous:true, evalScripts:true});
			$('show_more').innerHTML="<a href='/calendar?school_id="+school_id+"' class='orange_bar'>Show More...</a>";
			return false;
		}
		if(i== "announcement")
		{
			$('school_information_type').value="announcement"
			new Ajax.Request('/school/home/school_announcement_panel?school_id='+school_id+'&sport_id='+$('sportSelectBox').value+'&event_id='+$('eventSelectBox').value+'&activity_id='+$('activitySelectBox').value, {asynchronous:true, evalScripts:true});
			$('show_more').innerHTML="<a href='/announcement/list?school_id="+school_id+"' class='orange_bar'>Show More...</a>";

			return false;

		}
		if(i=="news")
		{

			$('school_information_type').value="news"
			new Ajax.Request('/school/home/school_news_panel?school_id='+school_id+'&sport_id='+$('sportSelectBox').value+'&event_id='+$('eventSelectBox').value+'&activity_id='+$('activitySelectBox').value, {asynchronous:true, evalScripts:true});
			$('show_more').innerHTML="<a href='/school/home/news_list?school_id="+school_id+"' class='orange_bar'>Show More...</a>";

			return false;
		}
		if(i=="message")
		{
			$('school_information_type').value="message"
			new Ajax.Request('/school/home/school_topic_panel?school_id='+school_id+'&sport_id='+$('sportSelectBox').value+'&event_id='+$('eventSelectBox').value+'&activity_id='+$('activitySelectBox').value, {asynchronous:true, evalScripts:true});
			$('show_more').innerHTML="<a href='/topic/list?school_id="+school_id+"' class='orange_bar'>Show More...</a>";
			return false;

		}
		if(i== 'poll')
		{
			$('school_information_type').value="poll"
			new Ajax.Request('/school/home/school_poll_panel?school_id='+school_id+'&sport_id='+$('sportSelectBox').value+'&event_id='+$('eventSelectBox').value+'&activity_id='+$('activitySelectBox').value, {asynchronous:true, evalScripts:true});
			$('show_more').innerHTML="<a href='/poll/list?school_id="+school_id+"' class='schoolcls_white'>Show More...</a>";
			return false;
		}
	}


var div_arr=new Array("calendar","announcement","news","topic","poll");
var cnt_autoadvance=1;
var time_out;
function AutoAdvance()
{
  refreshMyStuffpanel(cnt_autoadvance);
	cnt_autoadvance++;
  if(cnt_autoadvance>5)
	{
		cnt_autoadvance=1
	}
time_out=setTimeout("AutoAdvance()",7000);
}

function StopAutoAdvance() {
   if(time_out) {
      clearTimeout(time_out);
      time_out  = 0;
   }


}

function refreshMyStuff(panel)
{
  if(typeof(rememberFilter)=="function") rememberFilter();
	cnt_autoadvance=panel;

  decideTabSchoolAOIContent(panel,'schoolcalendar');
	$('show_more').style.display='none';
  $('calendar').innerHTML="<div align='center' width='100%' style='background-color:#fff;border:1px solid #000'><img src='/images/loading2.gif' /></div>";
  var school_id=$('school_home_id').value;
  $('school_information_type').value=div_arr[panel-1];
  url='/school/home/school_'+div_arr[panel-1]+'_panel';
  url+='?autoadv='+readCookie('common_panel_disable_autoplay');
  url+='&school_id='+school_id;
  url+='&sport_id='+$('sportSelectBox').value;
  url+='&event_id='+$('eventSelectBox').value;
  url+='&activity_id='+$('activitySelectBox').value;
   var opt = { asynchronous:true,
                    evalScripts:true,
                    method: 'post',
                    onComplete: function(t){$('show_more').style.display='block';}}
  	new Ajax.Request(url,opt);
	//time_out=setTimeout("dvmsgschool();",2000);	 dsingh
//alert('test');
}
function refreshMyStuffpanel(panel)
{

  cnt_autoadvance=panel;
  decideTabSchoolAOIContent(panel,'schoolcalendar');
	$('show_more').style.display='none';
  $('calendar').innerHTML="<div align='center' style='background-color:#fff;border:1px solid #000'><img src='/images/loading2.gif' /></div>";
  var school_id=$('school_home_id').value;
  $('school_information_type').value=div_arr[panel-1];
  url='/school/home/school_'+div_arr[panel-1]+'_panel';
  url+='?autoadv='+readCookie('common_panel_disable_autoplay');
  url+='&school_id='+school_id;
  url+='&sport_id='+$('sportSelectBox').value;
  url+='&event_id='+$('eventSelectBox').value;
  url+='&activity_id='+$('activitySelectBox').value;
   var opt = { asynchronous:true,
                    evalScripts:true,
                    method: 'post',
                    onComplete: function(t){$('show_more').style.display='block';}}
  	new Ajax.Request(url,opt);
	//time_out=setTimeout("dvmsgschool();",2000);	 dsingh
//alert('test');
}

/*function openProfile(member_id)
{
	document.frmProfile.member_id.value=member_id;
	document.frmProfile.submit();
}*/

function change_state_field(country_val)
{
	if (country_val== "2")
	{
		Element.show('state_dropdown');

		$('member_state_field').value="";
		Element.hide('state_textbox');
	}
	else
	{
		$('membet_intState').options[0].selected=true;

		Element.hide('state_dropdown');
		Element.show('state_textbox');
	}
}

function openDivAreaVolunteer(school_id,member_id)
{
 fadedDiv(true);
 divele=document.createElement("div");
 divele.id="schoolAreaVolunteer_div";
 $(divele).className="listViewThHeading";
 divele.style.position="absolute";
  divele.style.zIndex="100";
 divele.style.top=(document.body.clientHeight/2-130)+"px";
 divele.style.left=((document.body.clientWidth/2-200)-120)+"px";
 window.scrollTo(0,0);
 divele.innerHTML="<b>Loading...</b>";
 document.body.appendChild(divele);
 var opt = { method: 'post',
				before: function(){ },
				onComplete: function(t) {divele.innerHTML="<b>"+t.responseText+"</b>";}
			    }
		 new Ajax.Request('/myvootage/new_school_area_volunteer?school_id='+school_id+'&member_id='+member_id,opt);
}
function closeDivAreaVolunteer()
{
	document.body.removeChild(document.getElementById('schoolAreaVolunteer_div'));
	fadedDiv(false);
	alert("Area Volunteer created sucessfully.  Confirmation email, containing login details is sent to the new volunteer. To manage area volunteers of your school, Please go to My Vootage section.")
}
function closeDivAreaVolunteer_without_refresh()
{
	document.body.removeChild(document.getElementById('schoolAreaVolunteer_div'));
	fadedDiv(false);
}
function refresh_slider()
{
	new Ajax.Request('/school/home/refresh_slider');

}
function view_contact_all_coordinators(schoolid)
{
		 fadedDiv(true);
		 divele=document.createElement("div");
		 divele.id="view_contact_all_coordinators_div";
		 divele.className="listViewThHeading";
		 //divele.style.color="#E4E4E4";
		 divele.style.zIndex="100";
		 divele.style.position="absolute";
		 divele.style.top=(((document.body.clientHeight+document.body.scrollTop)/2)+50)+"px";
		 divele.style.left="300px";
		 divele.style.overflow="auto";
		 divele.innerHTML="<b>Loading...</b>";
		 document.body.appendChild(divele);
		 var opt = { method: 'post',
						before: function(){ },
						onComplete: function(t) {
						divele.innerHTML=t.responseText;
						}
					}
				new Ajax.Request('/school/home/contact_all_coordinators?school_id='+schoolid,opt);

}
function close_div_all_coordinators()
{
	document.getElementById('view_contact_all_coordinators_div').innerHTML="<b>Message has been sent to local coordinator.</b>";
	window.setTimeout("close_div_all_coordinators_without_refreshing()",1000);
}
function close_div_all_coordinators_without_refreshing()
{
	document.body.removeChild(document.getElementById('view_contact_all_coordinators_div'));
	fadedDiv(false);
}

function opendDivMail_all_coordinators(email_id)
{
	$('div_all_coordinators_email').style.display='block';
	$('coordinator_email_address').value=email_id;
	$('coordinator_emailID').innerHTML=email_id;

}

// These are code for search roster

function check_uncheck_all(val)
{

	for(i=0;i<document.forms["addplayer"].elements.length;i++)
	{
		if(document.forms["addplayer"].elements[i].type=="checkbox")
		{
			if(val==1)
			{
				document.forms["addplayer"].elements[i].checked = true;

			}
			else
			{
				document.forms["addplayer"].elements[i].checked = false;
			}
		}
	}
}

function validate_checkboxes(frm)
{
	$('selected_school_month').value = $('school_month').value;
	$('selected_school_year').value = $('school_year').value;
	var chk_flag = false;
	for(i=0;i<frm.elements.length;i++)
	{
		if(frm.elements[i].type=="checkbox" && frm.elements[i].checked == true)
		chk_flag = true;
	}
	if(!chk_flag)
	{
		alert("Select at least one player");
		return false;
	}

	return true;
}

	// Created by Pavan
    function redirect_back_school(request, school_id)
        {   
            if(request.responseText=='success'){
		alert("Area Volunteer added.");
                closeDivSearchMember();
            }
        }

    function validate_checkboxes_volunteer(frm)
    {
    	var chk_flag = false;
    	for(i=0;i<frm.elements.length;i++)
    	{
    		if(frm.elements[i].type=="checkbox" && frm.elements[i].checked == true)
    		chk_flag = true;
    	}
    	if(!chk_flag)
    	{
    		alert("Select at least one player");
    		return false;
    	}
    
    	return true;
    }
function check_params()
{
 if ($('school_year').value=='')
 {
	//alert('select school year');
	return false;
 } 
 $('div_player_list').innerHTML="<table width=\"100%\"><tr><td align=\"center\" valign=\"middle\"><img src=\"/images/loading2.gif\" border=\"0\" height=\"220\"></td></tr></table>";
 return true;
}

function submit_form(player_id,school_player_id)
{
 $('player_id').value = player_id;
 $('school_player_id').value = school_player_id;
 document.editplayer.submit();
}

// End code for search roster


function renderDiv_aoi(panel,school_id)
	{
	$('aoi_top_div').style.display='block';
	$('area_of_interest_div').innerHTML="<div align='center' style='background-color:#fff;border:1px solid #000'><img src='/images/loading2.gif' /></div>"; 
	 var opt = { method: 'post',
					before: function(){},
					onComplete: function(t) {
					$('area_of_interest_div').innerHTML="<b>"+t.responseText+"</b>";					
					}					
				}				
		new Ajax.Request('/school/home/edit_aoi_school_'+panel+'?school_id='+school_id,opt); 
		$('successMsg').innerHTML='';
	}
function checkUncheckAll_AOI(elements,check_flag) {
		if(check_flag=="yes")
		{

				for(i=0;i<elements.length;i++)
				{


					if (elements[i].type=="checkbox")
						elements[i].checked=true;
				}
		}

		else
		{
			for(i=0;i<elements.length;i++)
				{
					if (elements[i].type=="checkbox")
						elements[i].checked=false;
				}
		}
}

function display_custom_errors(errmsg)
{
	if (errmsg.indexOf('success')==-1)
	{
		alert(errmsg);
	}
	else
	{
	//	alert("Player Added Successfully")
		if (arguments.length>3)
		{
			var schoolid=arguments[1];
			var aoi_id=arguments[2];
			var aoi_type=arguments[3];
			var opt = { method: 'post',
						before: function(){ },
						onComplete: function(t) {
						$('area_of_interest_div').innerHTML=t.responseText;
						$('frm_player_search').btnSearch.click();
						//$('roster_jersey_num').focus();
						}
					}
				new Ajax.Request('/school/home/roster_list?school_id='+schoolid+'&aoi_id='+aoi_id+'&aoi_type='+aoi_type,opt);
		}
	}
}

