// To open a popup window
 // To open a popup window
function MM_openBrWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}

// Newsletter Subscription Form
function Newsletter() {
  	mailid = document.newsMail.email
	if (mailid.value == '')
	{
		alert("Please enter E-mail Id");
		mailid.focus()
		return false
	}
	else if (mailid.value.indexOf("@")==-1 || mailid.value.indexOf(".")==-1){
		alert("Invalid E-mail ID")
		mailid.focus()	   
		return false
	}
}

// Feedback form validation
function Feedback() {

	firstName = document.fbForm.txtFirstname
	if (firstName.value == "" || !isNaN(firstName.value))
	{
		alert("Please enter your first name");
		firstName.focus()
		return false		
	}

	lastName = document.fbForm.txtlastname
	if (lastName.value == "" || !isNaN(lastName.value))
	{
		alert("Please enter your last name");
		lastName.focus()
		return false		
	}




	mailid = document.fbForm.txtemail
	if (mailid.value == '')
	{
		alert("Please enter E-mail Id");
		mailid.focus()
		return false
	}
	else if (mailid.value.indexOf("@")==-1 || mailid.value.indexOf(".")==-1){
		alert("Invalid E-mail ID")
		mailid.focus()	   
		return false
	}

	age = document.fbForm.cmbAgeRange
	if (age.options[age.selectedIndex].value == "")
	{
		alert("Please select your age group");
	age.focus()
	return false		
	}	

	sportsAct = document.fbForm.txtsports
	if (sportsAct.value != "" && !isNaN(sportsAct.value))
	{
		alert("Please enter Sports Activities");
		sportsAct.focus()
		return false		
	}

	comments = document.fbForm.txtComments
	if (comments.value == "" || !isNaN(comments.value))
	{
		alert("Please add your comments");
		comments.focus()
		return false		
	}	
	if (document.fbForm.uword.value=="" )
	{
	alert('Enter the code as it is shown');
	document.fbForm.uword.focus();
	return false;
	}
	return jcap();
	
	
}

// Appointments form validation
function Appointment()
{
if (document.frmAppointment.txtFirstName.value=="" || !isNaN(document.frmAppointment.txtFirstName.value))
	{
	alert('Enter FirstName');
	document.frmAppointment.txtFirstName.focus();
	return false;
	}
if (document.frmAppointment.txtSurname.value=="" || !isNaN(document.frmAppointment.txtSurname.value))
	{
	alert('Enter Surname');
	document.frmAppointment.txtSurname.focus();
	return false;
	}
if (document.frmAppointment.txtHomePhoneNumber.value=="" )
	{
	alert('Enter Home Phone No.');
	document.frmAppointment.txtHomePhoneNumber.focus();
	return false;
	}
	
	
if (document.frmAppointment.txtEmailAddress.value=="")
	{
	alert('Enter Email Address');
	document.frmAppointment.txtEmailAddress.focus();
	return false;
	}
	else if (document.frmAppointment.txtEmailAddress.value.indexOf("@")==-1 || document.frmAppointment.txtEmailAddress.value.indexOf(".")==-1){
		alert("Invalid E-mail ID")
		document.frmAppointment.txtEmailAddress.focus()	   
		return false
	}	
	
	if (document.frmAppointment.uword.value=="" )
	{
	alert('Enter the code as it is shown');
	document.frmAppointment.uword.focus();
	return false;
	}
	return jcap();
}

//Random Images

                function getCookie(c_name)
                {
                if (document.cookie.length>0)
                  {
                  c_start=document.cookie.indexOf(c_name + "=")
                  if (c_start!=-1)
                    {
                    c_start=c_start + c_name.length+1
                    c_end=document.cookie.indexOf(";",c_start)
                    if (c_end==-1) c_end=document.cookie.length
                    return unescape(document.cookie.substring(c_start,c_end))
                    }
                  }
                return null
                }

                function randImagesCookie()
                {
                        if(getCookie('name')==null || getCookie('name')=="NaN")
                        {
                                document.cookie="name"+"="+1;
                        }
                        var cimgnum=getCookie('name');
                        if(cimgnum >= 4) {
                                var simgnum=1;
                        } else {
                                var simgnum=parseInt(cimgnum)+1;
                        }
						
						for(i=1; i<=4; i++)
						{
						
	                        var imagename = "cori_header_"+simgnum+"_"+i
	                        document.cookie="name"+"="+simgnum;

							var tmp = eval("document.getElementById('index"+i+"')")
    	                    var picPath="images/"+imagename+".jpg";
	                        tmp.style.backgroundImage="url('"+picPath+"')";
						}
                }


// BMI Calculator
function converttometers(ht)
{
    return (ht/100);
}
function calculatebmi(ht,wt)
{
return (wt/Math.pow(ht,2));
}
function btnCalcbmi()
{
if (document.frmbmi.txtheight.value != '')
{
	var ht=converttometers(document.frmbmi.txtheight.value);
	var wt=document.frmbmi.txtweight.value;
	var bmi=Math.round(calculatebmi(ht,wt));
	document.frmbmi.txtbmi.value=parseInt(bmi);
	
	if (parseInt(bmi) <19) 
document.frmbmi.comment.value = "Underweight";
if (parseInt(bmi) >=19 && parseInt(bmi) <=25) 
document.frmbmi.comment.value = "Desirable";
if (parseInt(bmi) >=26 && parseInt(bmi) <=29) 
document.frmbmi.comment.value = "Prone to health risks";
if (parseInt(bmi) >=30 && parseInt(bmi) <=40) 
document.frmbmi.comment.value = "Obese";
if (parseInt(bmi) >40) 
document.frmbmi.comment.value = "Extremely obese";
	
}
else 
{
	alert("Please enter your weight and height");
	return false;
}
}


// Contact Us form validation
function Contactus() {
	
	firstName = document.cuForm.txtName
	if (firstName.value == "" || !isNaN(firstName.value))
	{
		alert("Please enter your first name");
		firstName.focus()
		return false		
	}

	mailid = document.cuForm.txtEmail
	if (mailid.value == '')
	{
		alert("Please enter E-mail Id");
		mailid.focus()
		return false
	}
	else if (mailid.value.indexOf("@")==-1 || mailid.value.indexOf(".")==-1){
		alert("Invalid E-mail ID")
		mailid.focus()	   
		return false
	}

	comments = document.cuForm.txtMessage
	if (comments.value == "" || !isNaN(comments.value))
	{
		alert("Please add your comments");
		comments.focus()
		return false		
	}	
	if (document.cuForm.uword.value=="" )
	{
	alert('Enter the code as it is shown');
	document.cuForm.uword.focus();
	return false;
	}
	return jcap();
	
	
}



var sites=new Array(); 
sites[0]="book-total-hip-replacement-history.html";     
sites[1]="book-total-hip-replacement-necessary.html";
sites[2]="book-what-total-hip-replacement.html";
sites[3]="book-total-hip-replacement-evaluation.html";
sites[4]="book-total-hip-replacement-decide-surgery.html";
sites[5]="book-total-hip-replacement-proceeding-surgery.html";
sites[6]="book-total-hip-replacement-blood-donation.html";
sites[7]="book-total-hip-replacement-hospital-admission.html";
sites[8]="book-total-hip-replacement-anesthesiologist.html";
sites[9]="book-total-hip-replacement-vascular-imaging.html";
sites[10]="book-total-hip-replacement-operative-permit.html";
sites[11]="book-total-hip-replacement-day-surgery.html";
sites[12]="book-total-hip-replacement-experience-pain.html";
sites[13]="book-total-hip-replacement-physical-therapy.html";
sites[14]="book-total-hip-replacement-going-home.html";
sites[15]="book-total-hip-replacement-follow-up.html";
sites[16]="book-total-hip-replacement-infection-precautions.html";
sites[17]="book-total-hip-replacement-resuming-normal-activities.html";
sites[18]="book-total-hip-replacement-summary.html";



function nextPage(pid) {
	for(i=0;i<sites.length;i++){
		if(i==pid)
		{
			window.location=sites[i+1];
		}
	}
} 

function prevPage(pid) {
	for(i=0;i<sites.length;i++){
		if(i==pid)
		{
		window.location=sites[i-1];
		}
	}
} 


//for Spanish

var spanishsites=new Array(); 
spanishsites[0]="book-total-hip-replacement-history-spanish.html";     
spanishsites[1]="book-total-hip-replacement-necessary-spanish.html";
spanishsites[2]="book-what-total-hip-replacement-spanish.html";
spanishsites[3]="book-total-hip-replacement-evaluation-spanish.html";
spanishsites[4]="book-total-hip-replacement-decide-surgery-spanish.html";
spanishsites[5]="book-total-hip-replacement-proceeding-surgery-spanish.html";
spanishsites[6]="book-total-hip-replacement-blood-donation-spanish.html";
spanishsites[7]="book-total-hip-replacement-hospital-admission-spanish.html";
spanishsites[8]="book-total-hip-replacement-anesthesiologist-spanish.html";
spanishsites[9]="book-total-hip-replacement-vascular-imaging-spanish.html";
spanishsites[10]="book-total-hip-replacement-operative-permit-spanish.html";
spanishsites[11]="book-total-hip-replacement-day-surgery-spanish.html";
spanishsites[12]="book-total-hip-replacement-experience-pain-spanish.html";
spanishsites[13]="book-total-hip-replacement-physical-therapy-spanish.html";
spanishsites[14]="book-total-hip-replacement-going-home-spanish.html";
spanishsites[15]="book-total-hip-replacement-follow-up-spanish.html";
spanishsites[16]="book-total-hip-replacement-infection-precautions-spanish.html";
spanishsites[17]="book-total-hip-replacement-resuming-normal-activities-spanish.html";
spanishsites[18]="book-total-hip-replacement-summary-spanish.html";



function spanishnextPage(spid) {
	for(j=0;j<spanishsites.length;j++){
		if(j==spid)
		{
			window.location=spanishsites[j+1];
		}
	}
} 

function spanishprevPage(spid) {
	for(j=0;j<spanishsites.length;j++){
		if(j==spid)
		{
		window.location=spanishsites[j-1];
		}
	}
} 

