<!--
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 MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function MM_validateFormThroughId() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateFormThroughId.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.id; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function MM_validateFormProperly() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateFormProperly.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.id; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  if(document.MM_returnValue == true) 
  document.MM_returnValue = (errors == '');
}

// taking the id instead of the name ( val.id instead of val.name)
function MM_validateFormById() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateFormById.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.id; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  if(document.MM_returnValue == true) // in case the verifyPassword function returned true
  // which means no password confirmation error 
  document.MM_returnValue = (errors == '');
}

// taking the id instead of the name ( val.id instead of val.name)
function MM_validateFormByID() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateFormByID.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.id; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function MM_validateFormSampleLessons() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateFormSampleLessons.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.id; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  
   if(document.MM_returnValue == true) 
  document.MM_returnValue = (errors == '');
  
}

// function that verifies the password and the confirm password 
function verifyPassword(password, passwordConfirmation)
{
	if(password == passwordConfirmation) {
	document.MM_returnValue = true;
	}
	else {
		alert('The password and the password confirmation are different.');
		document.MM_returnValue = false;
		}
	
}

// function that verifies that the user has selected the first selection in the class_pictures_submission.php file 
function ensureSelection(checkbox){
	
	if(checkbox.checked == false) {
	alert('Permission is required in order for your child\'s photo to be posted.  All acceptable photos will be posted in Class Pictures.  A few will also be posted in the slide show.');
	document.MM_returnValue = false;
	}
	else 
	document.MM_returnValue = true;
}

// function that verifies that the user has entered two identical emails   
function verifyEmail(email,emailConfirmation){
	
	if(email == emailConfirmation) {
	document.MM_returnValue = true;
	}
	else {
		alert('The email and email confirmation are different.');
		document.MM_returnValue = false;
		}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

// function that highlights the label of the page in which we are right now 
// this function is called on the load of the page
// developped by mKamaredine 06-16-2006

function highlight_Label(){
	//retreiving the last position of the character / in the URL
	// since we want to retreive only the page name like contact.php
	// we will be getting the element having id ex: contact.php and changing its style's background to the color we want : #990000
	// and changing its text color to white 
	if(window.document.getElementById(document.URL.substr(document.URL.lastIndexOf('/') + 1,document.URL.length))) {
    window.document.getElementById(document.URL.substr(document.URL.lastIndexOf('/') + 1,document.URL.length)).style.backgroundColor='#BBBBBB';
	window.document.getElementById(document.URL.substr(document.URL.lastIndexOf('/') + 1,document.URL.length)+'.href').style.color='#000000';
	}	
}

// function that opens two links at a time
function openTwoLinks(link1,link2){
	window.open(link1,'_blank');
	//window.open(link2,'_blank');
	}
//-->

/* function used in the ccs_music_class page in order to change the Rhythm, Song and Tonal button selection */
function setDivCSS(){
args=setDivCSS.arguments;
window.document.getElementById(args[0]).className ='ccs-com-menu-selected';
//window.document.getElementById(args[0] + "-inner").className ='special-inner-div-white';
window.document.getElementById(args[0]).onmouseout=function(){this.className='ccs-com-menu-selected';};
window.document.getElementById(args[0] + 'Href').className ='ccs-com-menu-selected';

for(i=1; i<args.length; i++) { 

if(i<3) { 
window.document.getElementById(args[i]).className='ccs-com-menu';
//window.document.getElementById(args[i] + "-inner").className ='special-inner-div';
window.document.getElementById(args[i]).onmouseout=function(){this.className='ccs-com-menu';};
window.document.getElementById(args[i] + 'Href').className='ccs-com-menu';
}
else {
window.document.getElementById(args[i]).className='ccs-com-menu-red';
window.document.getElementById(args[i]).onmouseout=function(){this.className='ccs-com-menu-red';};
window.document.getElementById(args[i] + 'Href').className='ccs-com-menu-red';
} // end else

} // end for 
} // end function 

function setLiCSS(){
	args=setLiCSS.arguments;
	window.document.getElementById(args[0]).className ='actbuttons act_selected';
	window.document.getElementById(args[0]).onmouseout=function(){this.className='actbuttons act_selected';};

	window.document.getElementById(args[1]).className='actbuttons';
	window.document.getElementById(args[1]).onmouseout=function(){this.className='actbuttons';};
	window.document.getElementById(args[2]).className='actbuttons';
	window.document.getElementById(args[2]).onmouseout=function(){this.className='actbuttons';};

	reset_sa_buttons();
} // end function

function reset_sa_buttons(){
	var sa0 = window.document.getElementById('specialActivity0');	
	if (sa0 != null) { sa0.className ='sa_button'; }
	var sa1 = window.document.getElementById('specialActivity1');	
	if (sa1 != null) { sa1.className ='sa_button'; }
	var sa2 = window.document.getElementById('specialActivity2');	
	if (sa2 != null) { sa2.className ='sa_button'; }
}

function set_sa_button(button_number) {
	reset_sa_buttons();

	if (button_number == 0) {
		window.document.getElementById('specialActivity0').className = 'sa_button sa_button_selected';
	} else if(button_number == 1) {
		window.document.getElementById('specialActivity1').className = 'sa_button sa_button_selected';
	} else if(button_number == 2) {
		window.document.getElementById('specialActivity2').className = 'sa_button sa_button_selected';
	} 

	//Reset the regular activity buttons if they are set.
	window.document.getElementById('rhythmActivity').className='actbuttons';
	window.document.getElementById('rhythmActivity').onmouseout=function(){this.className='actbuttons';};
	window.document.getElementById('tonalActivity').className='actbuttons';
	window.document.getElementById('tonalActivity').onmouseout=function(){this.className='actbuttons';};
	window.document.getElementById('song').className='actbuttons';
	window.document.getElementById('song').onmouseout=function(){this.className='actbuttons';};
}

function setSpecialActivityCSS(){
args=setSpecialActivityCSS.arguments;
// retreiving the number of special activities retreived from the function arguments
var nbrSpecialActivities = args[args.length - 1];

window.document.getElementById(args[0]).className ='ccs-com-menu-red-selected';
window.document.getElementById(args[0]).onmouseout=function(){this.className='ccs-com-menu-red-selected';};
window.document.getElementById(args[0] + 'Href').className ='ccs-com-menu-red-selected';

for(i=1; i<(args.length - 1); i++) { 
if(i<nbrSpecialActivities) { 
window.document.getElementById(args[i]).className='ccs-com-menu-red';
window.document.getElementById(args[i]).onmouseout=function(){this.className='ccs-com-menu-red';};
window.document.getElementById(args[i] + 'Href').className='ccs-com-menu-red';
}
else { 
window.document.getElementById(args[i]).className='ccs-com-menu';
window.document.getElementById(args[i] + "-inner").className ='special-inner-div';
window.document.getElementById(args[i]).onmouseout=function(){this.className='ccs-com-menu';};
window.document.getElementById(args[i] + 'Href').className='ccs-com-menu';
} // end else 
} // end for 
} // end function 

// function to open in a new window 
function getToOsc(){
	if(document.frm_enroll.enroll[0].checked)
	//window.open('catalog/create_account.php','_blank');
	window.open('https://www.comechildrensing.com/catalog/create_account.php','_blank');
	else if(document.frm_enroll.enroll[1].checked)
	window.open('https://www.comechildrensing.com/catalog/login.php','_blank');
}

/* function that sets the menuright items selection in the homepage */
function selectMenuRight(){
	//retreiving the last position of the character / in the URL
	// since we want to retreive only the page name like free_sample_lessons.php
	// we will be getting the element having id ex: free_sample_lessons.php and changing its style's background to the color we want : #CC0000
	// and changing its text color to white 
	if(window.document.getElementById(document.URL.substr(document.URL.lastIndexOf('/') + 1,document.URL.length))) {
    window.document.getElementById(document.URL.substr(document.URL.lastIndexOf('/') + 1,document.URL.length)).style.backgroundColor='#CC0000';
	window.document.getElementById(document.URL.substr(document.URL.lastIndexOf('/') + 1,document.URL.length)).style.color='#f2e405';
	    window.document.getElementById(document.URL.substr(document.URL.lastIndexOf('/') + 1,document.URL.length)).style.borderColor='#f2e405';
	}	
}

/* function that confirmes the delete before deleting */
function deleteConfirmation(record,delete_path){
var s="Are you sure you want to delete this record ("+record+")";
if(confirm(s)){
window.location=delete_path;
}
}

/* function that confirmes the action Confirmation*/
function actionConfirmation(action,visitor,action_path){
var s="Are you sure you want to "+action+" this visitor ("+visitor+")";
if(confirm(s)){
window.location=action_path;
}
}

/* function that opens a popup window */
function openWindow(url) {
popupWin=window.open(url,'remote','width=640,height=480,top=100,left=100')
}
