/* redirect to form */
function school_info(school) {window.location.href='/campus/school_info.php?abbrv='+school;}

/* validate email address */
function echeck(str) {
  var at="@";
  var dot=".";
  var lat=str.indexOf(at);
  var lstr=str.length;
  var ldot=str.indexOf(dot);
  if (str.indexOf(at)==-1){
     alert("Invalid E-mail");
     return false;}
  if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
     alert("Invalid E-mail");
     return false;}
  if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
      alert("Invalid E-mail");
      return false;}
   if (str.indexOf(at,(lat+1))!=-1){
      alert("Invalid E-mail");
      return false;}
   if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
      alert("Invalid E-mail");
      return false;}
   if (str.indexOf(dot,(lat+2))==-1){
      alert("Invalid E-mail");
      return false;}
   if (str.indexOf(" ")!=-1){
      alert("Invalid E-mail");
      return false;}
   return true;
}

/* Process Career Coach Forms */
function process(form) {
   var key1 = form.subject.value;
   if (key1 == '' || key1 == 'Subject') {
      alert("Subject Required");
      form.subject.select();
      return false;}
   var key2 = form.question.value;
   if (key2 == '' || key2 == 'Question') {
      alert("Question Required");
      form.question.select();
      return false;}
   var key3 = form.email.value;
   if (key3 == '' || key3 == 'Email Address') {
      alert("Email Required");
      form.email.select();
      return false;}
	var email_ID = form.email.value;
	if (echeck(email_ID)==false) {
		form.email.value = "";
		form.email.select();
		return false;}
	return true;
}
/* new code by pp */
function showhidecp(id,imgid,len)
{ 
	if(len > 0)
	{
		var obj 	 = document.getElementById(imgid); 
		var imgurl	 = (obj.src).split('/');
		var urllen	 = imgurl.length;
		var imgind   = urllen-1;
		for(var i=0;i<len;i++)
		{
			if(imgid == 'shimgcamp')
			{
				var objID    = "state"+ i;
				var objimgID = "stateimg"+ i;	
			}
			else if(imgid == 'shimgprog')
			{
				var objID    = "cat"+ i;
				var objimgID = "catimg"+ i;
			}
			
			if (document.getElementById)
			{ 
				var objInner = document.getElementById(objID);				
				if (imgurl[imgind] == "expandAll.gif")
				{ 						
					objInner.style.display = ""; 				
					document.getElementById(objimgID).src='/campus/img/bullet_down_4x7.gif';	
					document.getElementById(imgid).src='/campus/img/collapseAll.gif';		
				}
				else 
				{ 
					
					objInner.style.display = "none"; 
					document.getElementById(objimgID).src='/campus/img/bullet_4x7.gif';
					document.getElementById(imgid).src='/campus/img/expandAll.gif';
				} 
		 	} 			
		}
	}
} 



function showhideblurb(id,imgid){ 
	if (document.getElementById){ 
		obj = document.getElementById(id); 
		if (obj.style.display == "none"){ 
			obj.style.display = ""; 
			document.getElementById(imgid).style.display = "none";		
		} else { 
			obj.style.display = "none"; 
			document.getElementById(imgid).style.display = "";
		} 
	} 
} 


function showhide(id,imgid){ 
	if (document.getElementById){ 
		obj = document.getElementById(id); 
		if (obj.style.display == "none"){ 
		obj.style.display = ""; 
		document.getElementById(imgid).src='/campus/img/bullet_down_4x7.gif';	
			
		} else { 
		obj.style.display = "none"; 			
		document.getElementById(imgid).src='/campus/img/bullet_4x7.gif';	
		} 
	} 
} 

/* end */