hex=255 // Initial color value.

function fadetext(){ 
	if(hex>0) { //If color is not black yet
		hex-=11; // increase color darkness
		document.getElementById("textdiv").style.color="rgb("+hex+","+hex+","+hex+")";
		setTimeout("fadetext()",20); 
	}
	else hex=255 //reset hex value
}

function loadtext(ntab) {
	fadetext();
	var thetext;
	if (ntab==0) {
		thetext="First time patients often assume that seeing a psychiatrist for an evaluation means deciding to take medications. However, an evaluation is exactly that; a thorough review of symptoms, history, and functioning to determine the cause of the problem followed by an integrated holistic approach to restoring optimal health. If I think medications can be helpful, I do not hesitate to make that recommendation but only after going over the pros and cons and carefully reviewing all potential effects and side effects. With the advent of the Internet and T.V. advertising, there is a staggering amount of information and misinformation available. I specialize in cutting through the noise and presenting the state-of-the-art research in a way that is easy to understand. I also believe in integrating nutrition, exercise, meditation, and behavioral technique into a comprehensive treatment plan. Contact me at the phone number below to schedule an initial consultation.";
	} else if(ntab==1) {
		thetext="Some psychiatrists only prescribe medications but some of us do practice psychotherapy. I have trained in psychodynamic psychotherapy, cognitive-behavioral therapy as well as EMDR. Some patients already have a therapist and I am happy to work with your therapist so see how medications might help. Some patients prefer to have medications and therapy from the same person but this is never a requirement. Ultimately, I come up with a plan to suit the needs of my patient. Therapists should feel free to contact me to discuss any of their patients.<p />I have been certified in EMDR which stands for eye-movement desensitization reprocessing. It is a specialized treatment most commonly used to address trauma. I offer EMDR to any patient to whom it may be helpful. It is usually possible to know if it can be helpful within 4 to 5 sessions.";
	} else if(ntab==2) {
		thetext="I am available for interviews for print and for on-air appearances for radio and television. Recent appearances include being quoted in an article about psychiatric treatment in The Wall Street Journal and on-air interviews about forensic stories on Fox News and on WPIX news. Please feel free to contact me at the number below.";	
	} else if(ntab==3) {
		thetext="The stigma of mental illness is the main reason that many people do not seek the treatment they need. It seems a shame that the knowledge to treat depression, anxiety, and other common ailments exists, but people don't access it due to a fear of associated with getting treatment or taking medication. However, when the chromic debilitating disease in question is depression, people suffer in silence and avoid treatment. This problem can be solved through education and an open dialogue about mental illness.<p />Ideally, there will come a time when psychiatric treatment is looked upon just as routine as medical or dental treatment. Everyone will have a psychiatrist starting in childhood for routine checkups to assess sleep, mood, and functioning. Routine visits would be short and entail basic health maintenance. Psychiatrists would also screen for mental illnesses, which when caught early can be treated before they become chronic. Routine visits would also provide an opportunity for people to discuss problems as they arise and get expert advice on possible medical and psychotherapeutic options. Some patients would be referred to specialists for more intense treatment, much as dentists sometimes refer patients to orthodontists or oral surgeons. Such an approach would prevent a tremendous amount of suffering and in some cases literally save lives.";
	}  else if(ntab==4) {
		thetext="<div id='contactinfo'><h3>Phone</h3>Office: 212-721-6823<br /><h3>E-mail</h3>drsaraiya@drsaraiya.com<br /><h3>Mail</h3>200 West 70th Street<br />Suite 16R<br />New York, NY 10023</div>";


//contact form hidden
//<div id='contactform'><h3>Contact form</h3><form method='post' action='sendmail.php' id='theform' ><label>First Name: <input id='firstname' name='firstname' class='formtext' size='30' /></label><br /><label>Last Name: <input id='lastname' name='lastname' class='formtext' size='30' /></label><br /><label>Address: <input class='formtext' id='address' name='address' size='30' /></label><br /><label>E-mail: <input id='email' name='email' class='formtext' size='30' /></label><br /><label>Phone: <input id='phone' name='phone' class='formtext' size='30' /></label><br /><input type='button' value='Send Message' onclick='validateform()' class='formtext' /></form></div>
	}
	
	document.getElementById("textdiv").innerHTML=thetext;
	for (var i=0;i<5;i++) {
		if (i==ntab) {
			document.getElementById("tab"+i).setAttribute("class", "currentpage");
		} else{
			document.getElementById("tab"+i).setAttribute("class", "otherpage");	
		}
	}
}

function validateform() {
	var errormsg="All fields are required";
	if (document.getElementById("firstname").value!="") {
		if (document.getElementById("lastname").value!="") {
			if (document.getElementById("address").value!="") {
				if (document.getElementById("email").value!="") {
					if(validatemail()) {
						if (document.getElementById("phone").value!="") {
							document.getElementById("theform").submit();
							return;
						}
					} else {
						errormsg="Invalid Email Address";
					}
				}
			}
		}
	}

	alert(errormsg);
}

function validatemail() {
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	var address = document.getElementById("email").value;
	if(reg.test(address) == false) {
		return false;
	}
	return true;
}
