function popitup(url) {
	newwindow=window.open(url,'name','height=601,width=800');
	if (window.focus) {newwindow.focus()}
	return false;
}

function Newsletter() {
	
	firstName = document.form1.Name
	if (firstName.value == "" || !isNaN(firstName.value))
	{
		alert("Please enter your first name");
		firstName.focus()
		return false		
	}

	mailid = document.form1.Email1
	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
	}	
}
// Contact Us form validation
function Training() {
	
	Company = document.Cust.CName
	if (Company.value == "" || !isNaN(Company.value))
	{
		alert("Please enter your company name");
		Company.focus()
		return false		
	}
	
	firstName = document.Cust.txtName
	if (firstName.value == "" || !isNaN(firstName.value))
	{
		alert("Please enter your first name");
		firstName.focus()
		return false		
	}

	mailid = document.Cust.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.Cust.txtMessage
	if (comments.value == "" || !isNaN(comments.value))
	{
		alert("Please add your comments");
		comments.focus()
		return false		
	}	
	if (document.Cust.uword.value=="" )
	{
	alert('Enter the code as it is shown');
	document.Cust.uword.focus();
	return false;
	}
	return jcap();
}

// Contact Us form validation
function Contact2() {
	
	Company = document.abcForm.txtCName
	if (Company.value == "" || !isNaN(Company.value))
	{
		alert("Please enter your company name");
		Company.focus()
		return false		
	}
	
	firstName = document.abcForm.txtName
	if (firstName.value == "" || !isNaN(firstName.value))
	{
		alert("Please enter your first name");
		firstName.focus()
		return false		
	}

	mailid = document.abcForm.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.abcForm.txtMessage
	if (comments.value == "" || !isNaN(comments.value))
	{
		alert("Please add your comments");
		comments.focus()
		return false		
	}	
	if (document.abcForm.uword.value=="" )
	{
	alert('Enter the code as it is shown');
	document.abcForm.uword.focus();
	return false;
	}
	return jcap();
	
	
}
// Contact Us form validation
function Contactus() {
	
	Company = document.cuForm.CName
	if (Company.value == "" || !isNaN(Company.value))
	{
		alert("Please enter your Company name");
		Company.focus()
		return false		
	}
	
	firstName = document.cuForm.txtName
	if (firstName.value == "" || !isNaN(firstName.value))
	{
		alert("Please enter your first name");
		firstName.focus()
		return false		
	}
	Last = document.cuForm.LasttxtName
	if (Last.value == "" || !isNaN(Last.value))
	{
		alert("Please enter your last name");
		Last.focus()
		return false		
	}
	CityAA = document.cuForm.City
	if (CityAA.value == "" || !isNaN(CityAA.value))
	{
		alert("Please enter your City");
		CityAA.focus()
		return false		
	}
	Count = document.cuForm.Country
	if (Count.value == "" || !isNaN(Count.value))
	{
		alert("Please enter your Country");
		Count.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
	}

	if (document.cuForm.uword.value=="" )
	{
	alert('Enter the code as it is shown');
	document.cuForm.uword.focus();
	return false;
	}
	return jcap();
	
	
}
//Home page interactivite
var tabLinks = new Array();
    var contentDivs = new Array();

    function init() {

      // Grab the tab links and content divs from the page
      var tabListItems = document.getElementById('tabs').childNodes;
      for ( var i = 0; i < tabListItems.length; i++ ) {
        if ( tabListItems[i].nodeName == "LI" ) {
          var tabLink = getFirstChildWithTagName( tabListItems[i], 'A' );
          var id = getHash( tabLink.getAttribute('href') );
          tabLinks[id] = tabLink;
          contentDivs[id] = document.getElementById( id );
        }
      }

      // Assign onclick events to the tab links, and
      // highlight the first tab
      var i = 0;

      for ( var id in tabLinks ) {
        tabLinks[id].onclick = showTab;
        tabLinks[id].onfocus = function() { this.blur() };
        if ( i == 0 ) tabLinks[id].className = 'selected';
        i++;
      }

      // Hide all content divs except the first
      var i = 0;

      for ( var id in contentDivs ) {
        if ( i != 0 ) contentDivs[id].className = 'tabContent hide';
        i++;
      }
    }

    function showTab() {
      var selectedId = getHash( this.getAttribute('href') );

      // Highlight the selected tab, and dim all others.
      // Also show the selected content div, and hide all others.
      for ( var id in contentDivs ) {
        if ( id == selectedId ) {
          tabLinks[id].className = 'selected';
          contentDivs[id].className = 'tabContent';
        } else {
          tabLinks[id].className = '';
          contentDivs[id].className = 'tabContent hide';
        }
      }

      // Stop the browser following the link
      return false;
    }

    function getFirstChildWithTagName( element, tagName ) {
      for ( var i = 0; i < element.childNodes.length; i++ ) {
        if ( element.childNodes[i].nodeName == tagName ) return element.childNodes[i];
      }
    }

    function getHash( url ) {
      var hashPos = url.lastIndexOf ( '#' );
      return url.substring( hashPos + 1 );
    }
	
 
// To open a popup window
 // To open a popup window
function MM_openBrWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}

 
// 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;
}
}


// Find a surgeon function

function showCountry(id){
	if(id == 'aus'){
		document.getElementById('aus').style.display = 'block';
		document.getElementById('nz').style.display = 'none';
		document.getElementById('ausImg').src = 'images/australia-on.gif';
		document.getElementById('nzImg').src = 'images/new-zealand-off.gif';
	}
	if(id == 'nz'){
		document.getElementById('aus').style.display = 'none';
		document.getElementById('nz').style.display = 'block';
		document.getElementById('ausImg').src = 'images/australia-off.gif';
		document.getElementById('nzImg').src = 'images/new-zealand-on.gif';
	}
	if(id == 'close'){
		document.getElementById('aus').style.display = 'none';
		document.getElementById('nz').style.display = 'none';
		document.getElementById('ausImg').src = 'images/australia-off.gif';
		document.getElementById('nzImg').src = 'images/new-zealand-off.gif';
	}
}


