// Removes leading whitespaces
function LTrim( value ) {
	
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
	
}


// Removes ending whitespaces
function RTrim( value ) {
	
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
	
}

// Removes leading and ending whitespaces
function trimboth( value ) {
	
	return LTrim(RTrim(value));
	
}

// Removes leading and ending whitespaces
function trim( value ) {
	
	return LTrim(RTrim(value));
	
}
//to validate an email address
function validEmail(obj)
	{
		var str=obj.value;
		var a;
		var len=str.length;
		var reg=new RegExp("@");
		var ind=str.search(reg);
		var c,d=0;
		var b=0;
		for(a=0;a<=str.length;a++)
		{
	
			if(str.charAt(a)=="@")
			{
				b++;
			}
			
		}
	
		if(b>1)
			{
				alert("Email Address is not valid.");
				obj.focus();
				return false;
			}
		else
			{
				for(a=0;a<=str.length;a++)
				{
					if(str.charAt(a)==".")
					{
						d=a;
					}
				
				}
				if((ind>d)||(ind==-1)||(d==0)||(ind+1==d)||(d+1==len))
				{
					alert ("Email Address is not valid.");
					obj.focus();
					return false;
				}
				else
				{
					return true;
				}
			}
		
						
	}//function end vaild enmail
	
	
	function validReg(objFrm) {

	if (objFrm.fname.value == '') {
		alert('You need to provide First Name!');
		objFrm.fname.focus();
		return false;
	}
	
	if (objFrm.lname.value == '') {
		alert('You need to provide last name!');
		objFrm.lname.focus();
		return false;
	}
	
	if (objFrm.address.value == '') {
		alert('You need to provide Address!');
		objFrm.address.focus();
		return false;
	}

    if (objFrm.hphone.value == '') {
		alert('You need to provide phone number!');
		objFrm.hphone.focus();
		return false;
	}

	

	
	
	return true;
	
}

function contact_validate(objFrm) {
	
		if (objFrm.name.value == '') {
		alert('You need to provide Name!');
		objFrm.name.focus();
		return false;
	}
	
	if (objFrm.email.value == '') {
		alert('You need to provide Email address!');
		objFrm.email.focus();
		return false;
	}
	else if(!validEmail(objFrm.email)) {
			objFrm.email.focus();
			return false;
	}
	if (objFrm.phone.value == '') {
		alert('You need to provide Phone Number!');
		objFrm.phone.focus();
		return false;
	}

    if (objFrm.comments.value == '') {
		alert('You need to provide Comments!');
		objFrm.comments.focus();
		return false;
	}
	  if (objFrm.security_code.value == '') {
		alert('You need to provide Secuirty Code!');
		objFrm.security_code.focus();
		return false;
	}

	
	return true;
}


function formvalidate(objFrm) {
	
		if (objFrm.name.value == '') {
		alert('You need to provide Name!');
		objFrm.name.focus();
		return false;
	}
	
	if (objFrm.email.value == '') {
		alert('You need to provide Email address!');
		objFrm.email.focus();
		return false;
	}
	else if(!validEmail(objFrm.email)) {
			objFrm.email.focus();
			return false;
	}
	if (objFrm.phone.value == '') {
		alert('You need to provide Phone Number!');
		objFrm.phone.focus();
		return false;
	}

    if (objFrm.comments.value == '') {
		alert('You need to provide Comments!');
		objFrm.comments.focus();
		return false;
	}
	  if (objFrm.security_code.value == '') {
		alert('You need to provide Secuirty Code!');
		objFrm.security_code.focus();
		return false;
	}

	
	return true;
}



/* function for physicians_ochs */
function swapeAction(){
	jLocation = document.getElementById('phylocation').value;
	
	if(jLocation==0){
		alert("Please select Location.");
		return false;
	}
	var arrForms = Array();
	arrForms[1] ='appointmentAnn.html';
	arrForms[2] ='appointmentAnnOchs.html';
	arrForms[3] ='appointmentAnnOchs2.html';
	arrForms[4] ='appointmentAnn3.html';
	arrForms[5] ='appointmentAnnOchs4.html';
	
	
	LocationName = 'https://www.thecentertx.com/appointment/'+arrForms[jLocation];
	window.location.href = LocationName;
	
}
/* function for physicians_page */
function swapeAction1(){
	jLocation = document.getElementById('phylocation').value;
	
	if(jLocation==0){
		alert("Please select Location.");
		return false;
	}
	var arrForms = Array();
	arrForms[1] ='appointmentRayD.html';
	arrForms[2] ='appointmentRay.html';
		
	LocationName = 'https://www.thecentertx.com/appointment/'+arrForms[jLocation];
	window.location.href = LocationName;
	
}

/* function for physicians_potluri */
function swapeAction3(){
	jLocation = document.getElementById('phylocation').value;
	
	if(jLocation==0){
		alert("Please select Location.");
		return false;
	}
	var arrForms = Array();
	arrForms[1] ='appointmentVinayaP.html';
	arrForms[2] ='appointmentVinayaP2.html';
	arrForms[3] ='appointmentVinaya.html';
		
	LocationName = 'https://www.thecentertx.com/appointment/'+arrForms[jLocation];
	window.location.href = LocationName;
	
}
/* function for physicians_ganesha */
function swapeAction4(){
	jLocation = document.getElementById('phylocation').value;
	
	if(jLocation==0){
		alert("Please select Location.");
		return false;
	}
	var arrForms = Array();
	arrForms[1] ='appointmentPrasanthi.html';
			
	LocationName = 'https://www.thecentertx.com/appointment/'+arrForms[jLocation];
	window.location.href = LocationName;
	
}
/* function for physicians_ross */
function swapeAction5(){
	jLocation = document.getElementById('phylocation').value;
	
	if(jLocation==0){
		alert("Please select Location.");
		return false;
	}
	var arrForms = Array();
	arrForms[1] ='appointmentMross2.html';
	arrForms[2] ='appointmentMross.html';
	arrForms[3] ='appointmentRoss.html';
	arrForms[4] ='appointmentMross3.html';
				
	LocationName = 'https://www.thecentertx.com/appointment/'+arrForms[jLocation];
	window.location.href = LocationName;
	
}
/* function for physicians_ross */
function swapeAction6(){
	jLocation = document.getElementById('phylocation').value;
	
	if(jLocation==0){
		alert("Please select Location.");
		return false;
	}
	var arrForms = Array();
	arrForms[1] ='appointmentShadan.html';
	arrForms[2] ='appointmentShadanM.html';
					
	LocationName = 'https://www.thecentertx.com/appointment/'+arrForms[jLocation];
	window.location.href = LocationName;
	
}
/* function for physicians_xiong */
function swapeAction7(){
	jLocation = document.getElementById('phylocation').value;
	
	if(jLocation==0){
		alert("Please select Location.");
		return false;
	}
	var arrForms = Array();
	arrForms[1] ='appointmentHenry.html';
						
	LocationName = 'https://www.thecentertx.com/appointment/'+arrForms[jLocation];
	window.location.href = LocationName;
	
}
/* function for physicians_ready */
function swapeAction8(){
	jLocation = document.getElementById('phylocation').value;
	
	if(jLocation==0){
		alert("Please select Location.");
		return false;
	}
	var arrForms = Array();
	arrForms[1] ='appointmentBibas.html';
	arrForms[2] ='appointmentBibas2.html';
						
	LocationName = 'https://www.thecentertx.com/appointment/'+arrForms[jLocation];
	window.location.href = LocationName;
	
}
/* function for physicians_young */
function swapeAction9(){
	jLocation = document.getElementById('phylocation').value;
	
	if(jLocation==0){
		alert("Please select Location.");
		return false;
	}
	var arrForms = Array();
	arrForms[1] ='appointmentRobyn.html';
	arrForms[2] ='appointmentRobynR.html';
						
	LocationName = 'https://www.thecentertx.com/appointment/'+arrForms[jLocation];
	window.location.href = LocationName;
	
}
/* function for physicians_gonzalez */
function swapeAction10(){
	jLocation = document.getElementById('phylocation').value;
	
	if(jLocation==0){
		alert("Please select Location.");
		return false;
	}
	var arrForms = Array();
	arrForms[1] ='appointmentGus.html';
							
	LocationName = 'https://www.thecentertx.com/appointment/'+arrForms[jLocation];
	window.location.href = LocationName;
	
}
/* function for physicians_cavey */
function swapeAction11(){
	jLocation = document.getElementById('phylocation').value;
	
	if(jLocation==0){
		alert("Please select Location.");
		return false;
	}
	var arrForms = Array();
	arrForms[1] ='appointmentMathew.html';
	arrForms[2] ='appointmentCavey.html';
							
	LocationName = 'https://www.thecentertx.com/appointment/'+arrForms[jLocation];
	window.location.href = LocationName;
	
}
/* function for physicians_lanasa */
function swapeAction12(){
	jLocation = document.getElementById('phylocation').value;
	
	if(jLocation==0){
		alert("Please select Location.");
		return false;
	}
	var arrForms = Array();
	arrForms[1] ='appointmentPeter.html';
								
	LocationName = 'https://www.thecentertx.com/appointment/'+arrForms[jLocation];
	window.location.href = LocationName;
	
}
/* function for physicians_kim */
function swapeAction14(){
	jLocation = document.getElementById('phylocation').value;
	
	if(jLocation==0){
		alert("Please select Location.");
		return false;
	}
	var arrForms = Array();
	arrForms[1] ='appointmentKimB.html';
	arrForms[2] ='appointmentKimw.html';
								
	LocationName = 'https://www.thecentertx.com/appointment/'+arrForms[jLocation];
	window.location.href = LocationName;
	
}
/* function for physicians_mandell */
function swapeAction15(){
	jLocation = document.getElementById('phylocation').value;
	
	if(jLocation==0){
		alert("Please select Location.");
		return false;
	}
	var arrForms = Array();
	arrForms[1] ='appointmentLance.html';
								
	LocationName = 'https://www.thecentertx.com/appointment/'+arrForms[jLocation];
	window.location.href = LocationName;
	
}
/* function for physicians_skiba */
function swapeAction16(){
	jLocation = document.getElementById('phylocation').value;
	
	if(jLocation==0){
		alert("Please select Location.");
		return false;
	}
	var arrForms = Array();
	arrForms[1] ='appointmentMary.html';
	arrForms[2] ='appointmentMaryA.html';
								
	LocationName = 'https://www.thecentertx.com/appointment/'+arrForms[jLocation];
	window.location.href = LocationName;
	
}
/* function for physicians_vasques */
function swapeAction17(){
	jLocation = document.getElementById('phylocation').value;
	
	if(jLocation==0){
		alert("Please select Location.");
		return false;
	}
	var arrForms = Array();
	arrForms[1] ='appointmentVasques.html';
									
	LocationName = 'https://www.thecentertx.com/appointment/'+arrForms[jLocation];
	window.location.href = LocationName;
	
}

/* function for physicians_page */
function swapeAction18(){
	jLocation = document.getElementById('phylocation').value;
	
	if(jLocation==0){
		alert("Please select Location.");
		return false;
	}
	var arrForms = Array();
	arrForms[1] ='appointmentArtim.html';
		
	LocationName = 'https://www.thecentertx.com/appointment/'+arrForms[jLocation];
	window.location.href = LocationName;
	
}

/* function for physicians_friess */
function swapeAction19(){
	jLocation = document.getElementById('phylocation').value;
	
	if(jLocation==0){
		alert("Please select Location.");
		return false;
	}
	var arrForms = Array();
	arrForms[1] ='appointmentFriess2.html';
	arrForms[2] ='appointmentFriess.html';
								
	LocationName = 'https://www.thecentertx.com/appointment/'+arrForms[jLocation];
	window.location.href = LocationName;
	
}
function swapeAction20(){
	jLocation = document.getElementById('phylocation').value;
	
	if(jLocation==0){
		alert("Please select Location.");
		return false;
	}
	var arrForms = Array();
	arrForms[1] ='appointmentGaryYoung.html';
									
	LocationName = 'https://www.thecentertx.com/appointment/'+arrForms[jLocation];
	window.location.href = LocationName;
	
}

function swapeAction21(){
	jLocation = document.getElementById('phylocation').value;
	
	if(jLocation==0){
		alert("Please select Location.");
		return false;
	}
	var arrForms = Array();
	arrForms[1] ='appointmentGonzalez2.html';
	arrForms[2] ='appointmentGonzalez.html';
									
	LocationName = 'https://www.thecentertx.com/appointment/'+arrForms[jLocation];
	window.location.href = LocationName;
	
}


function newsletterValidate(objForm){
	
	if(trimboth(objForm.name.value)=='' || objForm.name.value =='Enter your name'){
		alert("Please enter Your Name.");
		objForm.name.focus();
		return false;
	}
	
	if(trimboth(objForm.email.value)=='' || objForm.email.value=='Enter your email'){
		alert("Please enter Your Email.");
		objForm.email.focus();
		return false;
	}else if(!validEmail(objForm.email)) {
			objForm.email.focus();
			return false;
	}
	
}

function popwin(page) {
	faqWin=window.open(page,'OnlineText','copyhistory=no,menubar=no,location=no,toolbar=no,status=yes,resizable=no,scrollbars=yes,width=550,height=550,top=0,left=0'); 
	faqWin.focus();
}

