
function displayPlusimage(textDivId,imageId,divId,imgPath)
{
	var divHeight = $("#"+textDivId).height();
	//alert(divHeight);
	var target = $("#"+imageId);
	if(divHeight>18)
	{
		target.attr({src: imgPath+"/images/plus.gif"});
		//alert(divId);
		$("#"+divId).css({'height':'18px','overflow':'hidden'});
	}
	else
	{
		target.attr({src: imgPath+"/images/spacer.gif"});
	}
}
var flag=0;
function showContent(divId,imageId,imgPath)
{
  var arr = divId.split("_");
  var cntObj = $("#"+divId);
  var plusObj = $("#"+imageId);
  if(flag==0){
  	plusObj.attr({src: imgPath+"/images/minus.gif"});
  	cntObj.hide();
  	flag=1;
  	var cntObj = $("#"+arr[0]+"_"+flag);
  	cntObj.show();
  }
  else{
  	plusObj.attr({src: imgPath+"/images/plus.gif"});
  	cntObj.show();
  	cntObj.css({'height':'18px','overflow':'hidden'});
  	var cntObj = $("#"+arr[0]+"_"+flag);
  	cntObj.hide();
  	flag=0;
  }

}

function siteLoginSubmit(psychId,clientId,screener)
{
	var email = trim(document.frmSiteLogin.email.value);
	var pwd = trim(document.frmSiteLogin.pwd.value);

	var email_error_msg_1 = "Please enter a valid email";
	var email_error_msg_2 = "Please enter a password";
	var email_error_msg_3 = "You have entered an incorrect username or password"
	$("#email_err").hide();
	if(!isemail(email))
	{
		$("#email_err").text(email_error_msg_1);
		$("#email_err").show();
		document.frmSiteLogin.email.focus();
		return;
	}
	$("#pwd_err").hide();
	if(isEmpty(pwd) || pwd == "Password")
	{
		$("#pwd_err").text(email_error_msg_2);
		$("#pwd_err").show();
		document.frmSiteLogin.pwd.focus();
		return;
	}
	//alert(psychId+"  "+clientId+"  "+screener)
	$.post("sitelogincheck.htm",{
		email:email,
		pwd:pwd,
		psychId:psychId,
		clientId:clientId,
		screener:screener
		},function(data){
		
		eval(data);	
		//alert(obj.status);
		if(obj.status == "yes"){
		  var usertype=obj.usertype;
		//  alert(usertype);
				if(usertype == 'psychologist')
				{
				    document.location.href="psychmyaccount.htm";
				 }		
			    if(usertype == 'client')
				{			  
				  //alert("clienthomepage");
				  document.location.href="psychclienthomepage.htm";
				}		
	 }
	 else if(obj.status == "screener"){
		 
		 document.location.href="clientscreener.htm?userid="+psychId+"&clientId="+clientId;
	 }
	 else
	 {
	 	$("#email_err").text(email_error_msg_3);
		$("#email_err").show();		
	 }
	},"html");
	
	/*$("#loginerrmsg").hide();
	$.post("psychreglogincheck.htm",{email:email,pwd:pwd},function(data){
		eval(data);
		if(obj.status == "no"){	
			
			$("#loginerrmsg").text(email_error_msg_3);
			$("#loginerrmsg").show();	
		}
		else
		{
			parent.document.location.href="psychsignuppage.htm";						
		}
	}, "html" );*/
}

function showLoginBox(psychId,clientId,screener)
{
	$.post("incpsychlogin.htm",{
		psychId:psychId,
		clientId:clientId,
		screener:screener
	},function(data){
			//alert(data);
			$("#loginbox").html(data);
		}, "html" );
}


function testing()
{
   //alert("Testing");	
   
 }
 
 
 
