var movieName ="menumovie";
var movieRoll ="menuroll";
var javapageno = 0;
var javachapno = 0;
function openbrwindow(urlname)
{
	window.open(urlname,'_blank');
}
function testroll(num)
{

}
function rollMovie(movieRoll) 
{
  if (navigator.appName.indexOf ("Microsoft") !=-1) 
  {
	return window[movieRoll];
  }
  else 
  {
  	return document.embeds[movieRoll];
  }
}
function thisMovie(movieName) {
  if (navigator.appName.indexOf ("Microsoft") !=-1) 
  {
    return window[movieName];
  }	
  else 
  {
    return document.embeds[movieName];
  }
}
function currentpage(no)
{
	javapageno = no;
	if((no >= 0) && (no <= 3))
	{
		javachapno = 1;
	}
	else if(no == 4)
	{
		javachapno = 2;
	}
	else if(no == 5)
	{
		javachapno = 3;
	}
	else if(no >= 6)
	{
		javachapno = 4;
	}
	else if(no == 7)
	{
		javachapno = 5;
	}
	
	/*else if(no == 10)
	{
		javachapno = 6;
	}*/
}
function sendvaluestoflash()
{
}
function menuposition()
{
	if(navigator.appName.indexOf("Netscape")==0)
	{
		var h = ((window.innerWidth - 780)/2)+22
		if(window.innerWidth<=800)
		{
			if(h < 0)
				h = 22;
			h = findPosX(document.getElementById('calc')) + 16
			var t = '<div id="Layer1" style=\"position:absolute; left:'+h+'px; top:145px; z-index:1 width:10px; height:361px;background:transparent;" onMouseOver="hidelayer()" ><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="162" height="251"><param name="wmode" value="transparent"><param name="movie" value="_images/menu_submenu_roll.swf?flashchapno='+javachapno+'"><param name="quality" value="high"><embed src="_images/menu_submenu_roll.swf?flashchapno='+javachapno+'" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="162" height="251"></embed></object></div>';
			t = t + '<div id="Layer2" style="position:absolute; left:'+h+'px; top:145px; z-index:1 width:10px; height:361px;background:transparent;" onMouseOut="showlayer()"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="351" height="251"><param name="wmode" value="transparent"><param name="movie" value="_images/menu_submenu.swf?menu='+javachapno+'&flashpageno='+javapageno+'"><param name="quality" value="high"><embed src="_images/menu_submenu.swf?menu='+javachapno+'&flashpageno='+javapageno+'" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="351" height="251"></embed></object></div>';
			document.getElementById('temp').innerHTML = t;
		}
		else if(window.innerWidth>800)
		{
			var h = ((window.innerWidth - 780)/2)+22
			h = findPosX(document.getElementById('calc')) + 16
			var t = '<div id="Layer1" style=\"position:absolute; left:'+h+'px; top:145px; z-index:1 width:10px; height:361px;background:transparent;" onMouseOver="hidelayer()" ><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="162" height="251"><param name="wmode" value="transparent"><param name="movie" value="_images/menu_submenu_roll.swf?flashchapno='+javachapno+'"><param name="quality" value="high"><embed src="_images/menu_submenu_roll.swf?flashchapno='+javachapno+'" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="162" height="251"></embed></object></div>';
			t = t + '<div id="Layer2" style="position:absolute; left:'+h+'px; top:145px; z-index:1 width:10px; height:361px;background:transparent;" onMouseOut="showlayer()"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="351" height="251"><param name="wmode" value="transparent"><param name="movie" value="_images/menu_submenu.swf?menu='+javachapno+'&flashpageno='+javapageno+'"><param name="quality" value="high"><embed src="_images/menu_submenu.swf?menu='+javachapno+'&flashpageno='+javapageno+'" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="351" height="251"></embed></object></div>';
			document.getElementById('temp').innerHTML = t;
		}
	}
	else
	{
		//alert("3")
		var h = ((document.body.clientWidth - 780)/2)+20;
		if(document.body.clientWidth<=780)
		{
			//alert("4")
			if(h < 0)
				h = 20;
			h = findPosX(document.getElementById('calc')) + 20	
			var t = '<div id="Layer1" style=\"position:absolute; left:'+h+'px; top:145px; z-index:1 width:10px; height:361px;background:transparent;" onMouseOver="hidelayer()" ><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="162" height="251"><param name="wmode" value="transparent"><param name="movie" value="_images/menu_submenu_roll.swf?flashchapno='+javachapno+'"><param name="quality" value="high"><embed src="_images/menu_submenu_roll.swf?flashchapno='+javachapno+'" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="162" height="251"></embed></object></div>';
			t = t + '<div id="Layer2" style="position:absolute; left:'+h+'px; top:145px; z-index:1 width:10px; height:361px;background:transparent;" onMouseOut="showlayer()"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="351" height="251"><param name="wmode" value="transparent"><param name="movie" value="_images/menu_submenu.swf?menu='+javachapno+'&flashpageno='+javapageno+'"><param name="quality" value="high"><embed src="_images/menu_submenu.swf?menu='+javachapno+'&flashpageno='+javapageno+'" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="351" height="251"></embed></object></div>';
			document.getElementById('temp').innerHTML = t;
		} 
		else if(document.body.clientWidth>780)
		{
		//	alert("5")
		//alert("executed");
			var h = ((document.body.clientWidth - 780)/2)+20
			h = findPosX(document.getElementById('calc')) + 20
			var t = '<div id="Layer1" style=\"position:absolute; left:'+h+'px; top:145px; z-index:1 width:10px; height:361px;background:transparent;" onMouseOver="hidelayer()" ><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="162" height="251"><param name="wmode" value="transparent"><param name="movie" value="_images/menu_submenu_roll.swf?flashchapno='+javachapno+'"><param name="quality" value="high"><embed src="_images/menu_submenu_roll.swf?flashchapno='+javachapno+'" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="162" height="251"></embed></object></div>';
			//<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" name=\"menuroll\" id=\"menuroll\" width=\"162\" height=\"251\"><param name=\"movie\" value=\"_images/menu_submenu_roll.swf?flashchapno="+javachapno+"\"><param name=\"wmode\" value=\"transparent\"><param name=\"quality\" value=\"high\"><embed src=\"_images/menu_submenu_roll.swf?flashchapno="+javachapno+"\" quality=\"high\" wmode=\"transparent\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" name=\"menuroll\" width=\"162\" height=\"251\"></embed></object></div>";
		//h=300;		
			t = t + '<div id="Layer2" style="position:absolute; left:'+h+'px; top:145px; z-index:1 width:10px; height:361px;background:transparent;" onMouseOut="showlayer()"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="351" height="251"><param name="wmode" value="transparent"><param name="movie" value="_images/menu_submenu.swf?menu='+javachapno+'&flashpageno='+javapageno+'"><param name="quality" value="high"><embed src="_images/menu_submenu.swf?menu='+javachapno+'&flashpageno='+javapageno+'" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="351" height="251"></embed></object></div>';
			
			//<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" name=\"menumovie\" id=\"menumovie\" width=\"351\" height=\"251\"><param name=\"movie\" value=\"_images/menu_submenu.swf?menu="+javachapno+"&flashpageno="+javapageno+"\"><param name=\"wmode\" value=\"transparent\"><param name=\"quality\" value=\"high\"><embed src=\"_images/menu_submenu.swf?menu="+javachapno+"&flashpageno="+javapageno+"\" quality=\"high\" wmode=\"transparent\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\"  name=\"menumovie\" width=\"351\" height=\"251\"></embed></object></div>";
			document.getElementById('temp').innerHTML = t;
		}
//		alert(navigator.appName.indexOf ("Microsoft"))
		if(navigator.appName.indexOf ("Microsoft") != 0)
		{
			document.getElementById("Layer2").style.visibility="visible";
			document.getElementById("Layer1").style.visibility="hidden";
		}
		else
		{
			document.getElementById("Layer2").style.visibility="visible";
			document.getElementById("Layer1").style.visibility="hidden";
		}
		pagerefresh();
	}
}
function hidelayer()
{
	document.getElementById("Layer1").style.visibility="hidden";
	document.getElementById("Layer2").style.visibility="visible";
}
function showlayer()
{
	document.getElementById("Layer2").style.visibility="hidden";
	document.getElementById("Layer1").style.visibility="visible";
}
function pagerefresh()
{
	//alert("refresh")
	if(navigator.appName.indexOf("Netscape")==0)
	{
		window.refresh;
	}

}
	function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

  function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }
  
	function fncProfile(frm)
	{
  		var f=eval(frm);     
		if(frm == 'frmMentor'){ 
			var j_salute    = f.mt_salute;
			var j_firstname = f.mt_firstname;
			var j_lastname  = f.mt_lastname;
			var j_suffix    = f.mt_suffix;  
			var j_street    = f.mt_street;
			var j_city      = f.mt_city;
			var j_state     = f.mt_state;
			var j_zip 	    = f.mt_zip;
			var j_country   = f.mt_country;			
			var j_phone     = f.mt_phone;
			var j_email     = f.mt_email;
			var j_degcert   = f.mt_degcert;
			var j_degbba    = f.mt_degbba;
			var j_degmta    = f.mt_degmta;
			var j_degphd    = f.mt_degphd;
			var j_year      = f.mt_year;
			var j_concentrate = f.mt_concentrate;
			var j_individ   = f.mt_individ;
			var j_curremp   = f.mt_curremp;
			var j_jobtitle  = f.mt_jobtitle;
			var j_jobdesc   = f.mt_jobdesc;
	 	   	
 		    if(j_salute.value.length==0){
				alert("Please select the prefix");
				j_salute.focus();
				return false;				
			}
			else if(j_firstname.value.length==0){
				alert("Please enter the first name");
				j_firstname.focus();
				return false;								
 			}
			else if(j_lastname.value.length==0){
				alert("Please enter the last name");
				j_lastname.focus();
				return false;								
 			}
			else if(j_street.value.length==0){
				alert("Please enter the street name");
				j_street.focus();
				return false; 								
 			}
			else if(j_city.value.length==0){
				alert("Please enter the city");
				j_city.focus();
				return false; 								
 			}
			else if(j_state.value.length==0){
				alert("Please enter name of the state");
				j_state.focus();
				return false; 								
 			}
			else if(j_zip.value.length==0){
				alert("Please enter the zip code");
				j_zip.focus();
				return false; 								
 			} 
			else if(j_country.value.length==0){
				alert("Please select the country");
				j_country.focus();
				return false; 								
 			}
 			else if(j_phone.value.length==0){
				alert("Please enter the phone number");
				j_phone.focus();
				return false;								
 			}   
			else if(j_email.value.length==0){
				alert("Please enter the email address");
				j_email.focus();
				return false;								
 			}
			else if((j_degcert.checked==false)&&(j_degbba.checked==false)&&(j_degmta.checked==false)&&(j_degphd.checked==false))
		    {  
				alert("Please select attained degree");
				j_degcert.focus();
				return false;
  		    }
			else if(j_year.value.length==0){
				alert("Please enter the graduation year");
				j_year.focus();
				return false;								
 			} 
			else if((j_concentrate[0].checked ==false) && (j_concentrate[1].checked ==false) && (j_concentrate[2].checked ==false) && (j_concentrate[3].checked ==false) && (j_concentrate[4].checked ==false)){
				alert("Please enter the concentration");
				j_concentrate[0].focus();
				return false;	
			} 												
			else if(j_curremp.value.length==0){
				alert("Please enter the company name");
				j_curremp.focus();		
				return false;				
 			}
			else if(j_jobtitle.value.length==0){
				alert("Please enter the job title");
				j_jobtitle.focus();			
				return false;				
 			}
			else if(j_jobdesc.value.length==0){
				alert("Please enter the job description");
				j_jobdesc.focus();		
				return false;				
 			} 
			
			if(emailCheck(j_email.value)==false){
			   	alert("Invalid email address! Please re-enter again");			   
				j_email.focus();
				return false; 
		    }   
 			
			if(j_concentrate[4].checked==true){  
				if(j_individ.value.length==0)
				{
					alert("Please enter the individualized studies");
					j_individ.focus();
					return false;
				}
			}			
  			if(j_jobdesc.value.length>500)
			{
				alert("Please enter the characters below 500")
				j_jobdesc.focus();
				return false;	
			}
			f.flagStatus.value="Y";						
			f.action = 'mentor-profile.php'; 			
		}
		else if(frm == 'frmStudent'){ 
			//CCCCCCCCCCCCCC			
			var j_salute    = f.st_salute;
			var j_firstname = f.st_firstname;
			var j_lastname  = f.st_lastname;
			var j_suffix    = f.st_suffix;  
			var j_street    = f.st_street;
			var j_city      = f.st_city;
			var j_state     = f.st_state;
			var j_zip 	    = f.st_zip;    
			var j_country   = f.st_country; 
			var j_phone     = f.st_phone;
			var j_email     = f.st_email;
 			var j_deg	    = f.st_deg 
			var j_year      = f.st_year;
			var j_concentrate = f.st_concentrate;
			var j_individ   = f.st_individ;  
			var j_profess   = f.st_profess;
	 	   	
 		    if(j_salute.value.length==0){
				alert("Please select the prefix");
				j_salute.focus();
				return false;				
			}
			else if(j_firstname.value.length==0){
				alert("Please enter the first name");
				j_firstname.focus();
				return false;								
 			}
			else if(j_lastname.value.length==0){
				alert("Please enter the last name");
				j_lastname.focus();
				return false;								
 			}
 			else if(j_street.value.length==0){
				alert("Please enter the street name");
				j_street.focus();
				return false; 								
 			}
			else if(j_city.value.length==0){
				alert("Please enter the city");
				j_city.focus();
				return false; 								
 			}
			else if(j_state.value.length==0){
				alert("Please enter name of the state");
				j_state.focus();
				return false; 								
 			}
			else if(j_zip.value.length==0){
				alert("Please enter the zip code");
				j_zip.focus();
				return false; 								
 			} 
			else if(j_country.value.length==0){
				alert("Please select the country");
				j_country.focus();
				return false; 								
 			}
 			else if(j_phone.value.length==0){
				alert("Please enter the phone number");
				j_phone.focus();
				return false;								
 			}   
			else if(j_email.value.length==0){
				alert("Please enter the email address");
				j_email.focus();
				return false;								
 			}  
			else if((j_deg[0].checked==false)&&(j_deg[1].checked==false)&&(j_deg[2].checked==false)&&(j_deg[3].checked==false))
		    {  
				alert("Please select attained degree");
			 	j_deg[0].focus();
				return false;
  		    }
	 		else if(j_year.value.length==0){
				alert("Please enter the graduation year");
				j_year.focus();
				return false;								
 			} 
			else if(j_profess.value.length==0){
				alert("Please enter the profession");
				j_profess.focus();		
				return false;				
 			} 
			
			if(emailCheck(j_email.value)==false){
			   	alert("Invalid email address! Please re-enter again");			   
				j_email.focus();
				return false; 
		    }   
 			
			if(j_concentrate[4].checked==true){  
				if(j_individ.value.length==0)
				{
					alert("Please enter the individualized studies");
					j_individ.focus();
					return false;
				}
			}			
  			if(j_profess.value.length>500)
			{
				alert("Please enter the characters below 500")
				j_profess.focus();
				return false;	
			}  
			f.flagStatus.value="Y";
			f.action = 'student-profile.php'; 
			
		}	 
		
  }
  
 //-----------------------
 function emailCheck(emailStr) {
/* The following pattern is used to check if the entered e-mail address
   fits the user@domain format.  It also is used to separate the username
   from the domain. */
//   emailStr.replace(/^\s+|\s+$/g,"");
var emailPat=/^(.+)@(.+)$/;

/* The following string represents the pattern for matching all special
   characters.  We don't want to allow special characters in the address. 
   These characters include ( ) < > @ , ; : \ " . [ ]    */

var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";

/* The following string represents the range of characters allowed in a 
   username or domainname.  It really states which chars aren't allowed. */

var validChars="\[^\\s" + specialChars + "\]";

/* The following pattern applies if the "user" is a quoted string (in
   which case, there are no rules about which characters are allowed
   and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
   is a legal e-mail address. */

var quotedUser="(\"[^\"]*\")";

/* The following pattern applies for domains that are IP addresses,
   rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
   e-mail address. NOTE: The square brackets are required. */

var ipDomainPat="/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/";

/* The following string represents an atom (basically a series of
   non-special characters.) */

var atom=validChars + '+';

/* The following string represents one word in the typical username.
   For example, in john.doe@somewhere.com, john and doe are words.
   Basically, a word is either an atom or quoted string. */

var word="(" + atom + "|" + quotedUser + ")";

// The following pattern describes the structure of the user

var userPat=new RegExp("^" + word + "(\\." + word + ")*$");

/* The following pattern describes the structure of a normal symbolic
   domain, as opposed to ipDomainPat, shown above. */

var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

/* Finally, let's start trying to figure out if the supplied address is
   valid. */

/* Begin with the coarse pattern to simply break up user@domain into
   different pieces that are easy to analyze. */
var matchArray=emailStr.match(emailPat);

if (matchArray==null) {

  /* Too many/few @'s or something; basically, this address doesn't
     even fit the general mould of a valid e-mail address. */

//	alert("Email address seems incorrect (check @ and .'s)");
	return false
}

var user=matchArray[1]
var domain=matchArray[2]

// See if "user" is valid 

if (user.match(userPat)==null) {
    // user is not valid
//    alert("The username doesn't seem to be valid.");
    return false
}

/* if the e-mail address is at an IP address (as opposed to a symbolic
   host name) make sure the IP address is valid. */

var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
    // this is an IP address
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
//	        alert("Destination IP address is invalid!");
		return false
	    }
    }
    return true
}

// Domain is symbolic name
var domainArray=domain.match(domainPat)
if (domainArray==null) {
//	alert("The domain name doesn't seem to be valid.");
    return false
}

/* domain name seems valid, but now make sure that it ends in a
   three-letter word (like com, edu, gov) or a two-letter word,
   representing country (uk, nl), and that there's a hostname preceding 
   the domain or country. */

/* Now we need to break up the domain to get a count of how many atoms
   it consists of. */ 

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) {
   // the address must end in a two letter or three letter word.
//   alert("The address must end in a three-letter domain, or two letter country.");
   return false
}

// Make sure there's a host name preceding the domain.
if (len<2) {
   var errStr="This address is missing a hostname!"
//   alert(errStr);
   return false
}

// If we've gotten this far, everything's valid!
return true;
}
 
 
 //-----------------------
