
var blnobj, height, slider;
height=10;

function displayDesc(ObjectID)
{
    //alert(ObjectID);
    var trid = "tr" + ObjectID;
    var trhid = "trh" + ObjectID;
    var tr;
    tr = document.getElementById(trid); 
    //tr.style.visibility = 'Visible';
    tr.style.display = '';
    tr = document.getElementById(trhid);
    tr.className='CourseInfoTRhover';
        setTimeout(10000);
}


function hideDesc(ObjectID)
{
    //alert(ObjectID);
    var trid = "tr" + ObjectID;
    var trhid = "trh" + ObjectID;
    var tr;
    tr = document.getElementById(trid); 
    //tr.style.visibility = 'hidden';
    tr.style.display = 'none';
    tr = document.getElementById(trhid);
    tr.className='CourseInfoTR';
    setTimeout(10000);

}

function displaySpeakerInfo(FID)
{
    var bln; 
    bln = FID;
    blnobj = document.getElementById(bln);
      //if(height < 100)
    //{ 
   
                      //getElementById(trid);
    //blnobj.style.display = '';
    //blnobj.className='SpeakerDescTRhover';
    //blnobj.style.display = "table-row";
    //clearInterval(slider);
    //slider = setInterval("displaySInfo()",300);
    //blnobj.style.height='5px';
    //blnobj.style.display = '';
    //displaySInfo();
     //}else{
     //   height=10;
    //}
   // alert(blnobj.id);
  
   if(navigator.appName.indexOf("Microsoft") > -1){
        blnobj.style.display = "inline";
   } else {
        blnobj.style.display = "table-row";
   }
}

function displaySInfo()
{

        //clearInterval(slider);
        height = height + 10;
        alert("height: " + height);
        blnobj.style.height = height + "px";
       // blnobj.style.display = '';
         //blnobj.style.display = '';
   
    //blnobj.className='SpeakerDescTRhover';

}
function displaySEInfo()
{
    blnobj.style.height = height + "px";
    blnobj.style.display = '';
    //displaySInfo();
}
function hideSpeakerInfo(FID)
{
    var bln, blnobj; 
    bln = FID;
    blnobj = document.getElementById(bln);
    blnobj.style.display = "none";
   // blnobj.className='SpeakerDescTR';
}

function adjustLayout()  
{  
 // Get natural heights  
 var cHeight = xHeight("content-inner");  
 var lHeight = xHeight("leftcontent");  
// var rHeight = xHeight("rightcontent");  
 
 // Find the maximum height  
// var maxHeight = Math.max(cHeight, Math.max(lHeight, rHeight));  
 var maxHeight = Math.max(cHeight, Math.max(lHeight)); 
 // Assign maximum height to all columns  
 xHeight("content", maxHeight);  
 xHeight("sidebar-left", maxHeight);  
// xHeight("right", maxHeight);  
}


	function ExpandCollapseToggle(a)
	{
		var e=document.getElementById(a);
		if(!e)return true;
		if(e.style.display=="none")
		{
			e.style.display="inline"
		} 
		else 
		{
			e.style.display="none"
		}
		return true;
	}
	
	function Collapse(a)
	{
		var e=document.getElementById(a);
		if(!e)return true;
			e.style.display="none"
		var f=document.getElementById(a+'A');
		if(!f)return true;
			f.style.display="inline"
		var g=document.getElementById(a+'B');
		if(!g)return true;
			g.style.display="none"
		return true;
	}
	
	function Expand(a)
	{
		var e=document.getElementById(a);
		if(!e)
		{
			return true;
		}
		e.style.display="inline"
		var f=document.getElementById(a+'A');
		if(!f)
		{
			return true;
		}
		f.style.display="none"
		var g=document.getElementById(a+'B');
		if(!g)
		{
			return true;
		}
		g.style.display="inline"
		return true;
	}
	
	function validateTestimonial()
	{
	    var temp_obj;
	    temp_obj = document.getElementById('t_name');
	    
	    if (temp_obj.value == '')
	    {
	        alert('Please enter your Name');
	        temp_obj.focus();
	        return false;
	    }
	    
	    temp_obj = document.getElementById('t_address1');
	    if (temp_obj.value == '')
	    {
	        alert('Please enter your Address');
	        temp_obj.focus();
	        return false;
	    }	    
	    
	    temp_obj = document.getElementById('t_phone');
	    if (temp_obj.value == '')
	    {
	        alert('Please enter your Phone Number');
	        temp_obj.focus();
	        return false;
	    }	    
	    
	    if (checkInternationalPhone(temp_obj.value)==false){
		    alert("Please Enter a Valid Phone Number")
		    temp_obj.focus()
		    return false
	    }	    
	    
	    temp_obj = document.getElementById('t_email');
	    if (temp_obj.value == '')
	    {
	        alert('Please enter your EMail Address');
	        temp_obj.focus();
	        return false;
	    }	    
	    
	    if (echeck(temp_obj.value)==false){
		    
		    temp_obj.focus()
		    return false
	    }	    
	    
	    temp_obj = document.getElementById('t_memberid');
	    if (temp_obj.value == '')
	    {
	        alert('Please enter your ADA Member Number');
	        temp_obj.focus();
	        return false;
	    }	    
	    
	    temp_obj = document.getElementById('t_comments');
	    if (temp_obj.value == '')
	    {
	        alert('Please enter your Comments');
	        temp_obj.focus();
	        return false;
	    }	    
	    temp_obj = document.getElementById('todoTestimonial');
	    temp_obj.value = 'submitTestimonial';
	    document.form_testimonial.submit();
	    return true;
    }

function wordCounterType(id, maxlimit){

	var field = document.getElementById(id);
	var cntfield = document.getElementById(id+"_Count");
	
	var words = field.value.split(" ");
	
	var tempstr ="";
	var r = 0;
	var z;
	
	for ( z = 0 ; z < words.length  ; z++) {
		if (words[z].length > 0 || ( words[z].length == 0 && words[z].charCodeAt(1) == 13 ) ){
			r++;
		}
	}
	cntfield.value=r;

}


function wordCounter(id, maxlimit){

	var field = document.getElementById(id);	
	var words = field.value.split(" ");
	
	var tempstr ="";
	var r = 0;
	var z;
	
	for ( z = 0 ; z < words.length  ; z++) {
		if (words[z].length > 0 || ( words[z].length == 0 && words[z].charCodeAt(1) == 13 ) ){
			r++;
		}
	}

	if (r >  maxlimit){
		return false;
	}
	
	return true;
}


function ValidatePracticeForm()
{
        var temp_obj;
        
        
	    temp_obj = document.getElementById('PracName');	    
	    if (temp_obj.value == '')
	    {
	        alert('Please enter your Practice Name');
	        temp_obj.focus();
	        return false;
	    }
	         
	    temp_obj = document.getElementById('NumofStaff');	    
	    if (temp_obj.value == '')
	    {
	        alert('Please enter Number of Staff');
	        temp_obj.focus();
	        return false;
	    }
	    
	    temp_obj = document.getElementById('StaffList');	    
	    if (temp_obj.value == '')
	    {
	        alert('Please enter Names/Titles of Staff:');
	        temp_obj.focus();
	        return false;
	    }	    
	    	           
	    temp_obj = document.getElementById('PracAddress');	    
	    if (temp_obj.value == '')
	    {
	        alert('Please enter Address');
	        temp_obj.focus();
	        return false;
	    }
	    	   
	    	    	            
        temp_obj = document.getElementById('PracPhone');        
	    if (checkInternationalPhone(temp_obj.value)==false){
		    alert("Please Enter a Valid Phone Number");
		    temp_obj.focus();
		    return false;
	    }	
	            
	    temp_obj = document.getElementById('PracEmail');
	    if (temp_obj.value == '')
	    {
	        alert('Please enter EMail Address');
	        temp_obj.focus();
	        return false;
	    }	
	    
	    if (echeck(temp_obj.value)==false){
		    
		    temp_obj.focus()
		    return false
	    }	    
	    
	    temp_obj = document.getElementById('ContactPerson');	    
	    if (temp_obj.value == '')
	    {
	        alert('Please enter Office Contact Person');
	        temp_obj.focus();
	        return false;
	    }	    
	    temp_obj = document.getElementById('todoCompetition');
	    temp_obj.value = 'submitCompetition';	    
	    document.PracticeForm.submit();
	    return true;	    
	    
}


function ValidateEducationForm()
{
        var temp_obj;
        
        
	    temp_obj = document.getElementById('DentistName');	    
	    if (temp_obj.value == '')
	    {
	        alert('Please enter Dentist Name');
	        temp_obj.focus();
	        return false;
	    }
	         

	    
	    	           
	    temp_obj = document.getElementById('PracAddress');	    
	    if (temp_obj.value == '')
	    {
	        alert('Please enter Address');
	        temp_obj.focus();
	        return false;
	    }
	    	   
	    	    	            
        temp_obj = document.getElementById('PracPhone');        
	    if (checkInternationalPhone(temp_obj.value)==false){
		    alert("Please Enter a Valid Phone Number");
		    temp_obj.focus();
		    return false;
	    }	
	            
	    temp_obj = document.getElementById('PracEmail');
	    if (temp_obj.value == '')
	    {
	        alert('Please enter EMail Address');
	        temp_obj.focus();
	        return false;
	    }	
	    
	    if (echeck(temp_obj.value)==false){
		    
		    temp_obj.focus()
		    return false
	    }
	    
        var checked;
        checked = false;
        for(var i=0; i < document.EducationForm.EntryCatagory.length; i++){
            if(document.EducationForm.EntryCatagory[i].checked)
            {
                checked=true;
            }
        }

	    if (checked == false)
	    {
	        temp_obj = document.getElementById('EntryCatagory');
	        alert('Please enter Entry Catagory');
	        temp_obj.focus();
	        return false;
	    }	
	    	
	    	
	    temp_obj = document.getElementById('PresTitle');	    
	    if (temp_obj.value == '')
	    {
	        alert('Please enter Title of presentation');
	        temp_obj.focus();
	        return false;
	    }else{
	        if ((wordCounter('PresTitle', 20))==false){
	            window.alert("You have exceeded the maximum word limit for Title of presentation, please correct this before continuing.");
	            temp_obj.focus();
	            return false;
	        }
	    }	
	    
	    
	    temp_obj = document.getElementById('PresenterBio');	    
	    if (temp_obj.value == '')
	    {
	        alert('Please enter Presenters credentials and bio ');
	        temp_obj.focus();
	        return false;
	    }else{
	        if ((wordCounter('PresenterBio', 70))==false){
	            window.alert("You have exceeded the maximum word limit for Presenters credentials and bio, please correct this before continuing.");
	            temp_obj.focus();
	            return false;
	        }
	    }
	    
	    	    
	
	    temp_obj = document.getElementById('AbstractBackground');	    
	    if (temp_obj.value == '')
	    {
	        alert('Please enter Abstract Background');
	        temp_obj.focus();
	        return false;
	    }else{
	        if ((wordCounter('AbstractBackground', 70))==false){
	            window.alert("You have exceeded the maximum word limit for Abstract Background, please correct this before continuing.");
	            temp_obj.focus();
	            return false;
	        }
	    }	    	    	      
	      
	      
	      
	
	    temp_obj = document.getElementById('AbstractMethod');	    
	    if (temp_obj.value == '')
	    {
	        alert('Please enter Abstract Method');
	        temp_obj.focus();
	        return false;
	    }else{
	        if ((wordCounter('AbstractMethod', 70))==false){
	            window.alert("You have exceeded the maximum word limit for Abstract Method, please correct this before continuing.");
	            temp_obj.focus();
	            return false;
	        }
	    }	
	    
	    
	    temp_obj = document.getElementById('AbstractResult');	    
	    if (temp_obj.value == '')
	    {
	        alert('Please enter Abstract Result');
	        temp_obj.focus();
	        return false;
	    }else{
	        if ((wordCounter('AbstractResult', 70))==false){
	            window.alert("You have exceeded the maximum word limit for Abstract Result, please correct this before continuing.");
	            temp_obj.focus();
	            return false;
	        }
	    }	    
	    
	    

	    temp_obj = document.getElementById('AbstractConclusion');	    
	    if (temp_obj.value == '')
	    {
	        alert('Please enter Abstract Conclusion');
	        temp_obj.focus();
	        return false;
	    }else{
	        if ((wordCounter('AbstractConclusion', 70))==false){
	            window.alert("You have exceeded the maximum word limit for Abstract Conclusion, please correct this before continuing.");
	            temp_obj.focus();
	            return false;
	        }
	    }	


	    temp_obj = document.getElementById('Introduction');	    
	    if (temp_obj.value == '')
	    {
	        alert('Please enter Introduction of presentation material');
	        temp_obj.focus();
	        return false;
	    }else{
	        if ((wordCounter('Introduction', 125))==false){
	            window.alert("You have exceeded the maximum word limit for Introduction of presentation material, please correct this before continuing.");
	            temp_obj.focus();
	            return false;
	        }
	    }	
	    

	    temp_obj = document.getElementById('Overview');	    
	    if (temp_obj.value == '')
	    {
	        alert('Please enter Overview of presentation material');
	        temp_obj.focus();
	        return false;
	    }else{
	        if ((wordCounter('Overview', 125))==false){
	            window.alert("You have exceeded the maximum word limit for Overview of presentation material, please correct this before continuing.");
	            temp_obj.focus();
	            return false;
	        }
	    }	


	    temp_obj = document.getElementById('Purpose');	    
	    if (temp_obj.value == '')
	    {
	        alert('Please enter Purpose and significance of the presentation');
	        temp_obj.focus();
	        return false;
	    }else{
	        if ((wordCounter('Purpose', 150))==false){
	            window.alert("You have exceeded the maximum word limit for Purpose and significance of the presentation, please correct this before continuing.");
	            temp_obj.focus();
	            return false;
	        }
	    }
	    
	
	
	    temp_obj = document.getElementById('ReviewMethod');	    
	    if (temp_obj.value == '')
	    {
	        alert('Please enter Review of methods');
	        temp_obj.focus();
	        return false;
	    }else{
	        if ((wordCounter('ReviewMethod', 150))==false){
	            window.alert("You have exceeded the maximum word limit for Review of methods, please correct this before continuing.");
	            temp_obj.focus();
	            return false;
	        }
	    }	    


	    temp_obj = document.getElementById('ReviewMaterials');	    
	    if (temp_obj.value == '')
	    {
	        alert('Please enter Review of materials');
	        temp_obj.focus();
	        return false;
	    }else{
	        if ((wordCounter('ReviewMaterials', 100))==false){
	            window.alert("You have exceeded the maximum word limit for Review of materials, please correct this before continuing.");
	            temp_obj.focus();
	            return false;
	        }
	    }
	        
	    
	    temp_obj = document.getElementById('ReviewProcedures');	    
	    if (temp_obj.value == '')
	    {
	        alert('Please enter Review of procedures');
	        temp_obj.focus();
	        return false;
	    }else{
	        if ((wordCounter('ReviewProcedures', 100))==false){
	            window.alert("You have exceeded the maximum word limit for Review of procedures, please correct this before continuing.");
	            temp_obj.focus();
	            return false;
	        }
	    }
	    	
	    	
	    temp_obj = document.getElementById('ResultOutcome');	    
	    if (temp_obj.value == '')
	    {
	        alert('Please enter Results/Outcomes');
	        temp_obj.focus();
	        return false;
	    }else{
	        if ((wordCounter('ResultOutcome', 100))==false){
	            window.alert("You have exceeded the maximum word limit for Results/Outcomes, please correct this before continuing.");
	            temp_obj.focus();
	            return false;
	        }
	    }
	    
	    	   
	    	   
	    temp_obj = document.getElementById('Discussion');	    
	    if (temp_obj.value == '')
	    {
	        alert('Please enter Discussion points/next steps/ follow-up');
	        temp_obj.focus();
	        return false;
	    }else{
	        if ((wordCounter('Discussion', 200))==false){
	            window.alert("You have exceeded the maximum word limit for Discussion points/next steps/ follow-up, please correct this before continuing.");
	            temp_obj.focus();
	            return false;
	        }
	    }
	    
	    
	    	   
	    temp_obj = document.getElementById('Refferences');	    
	    if (temp_obj.value == '')
	    {
	        alert('Please enter Refferences');
	        temp_obj.focus();
	        return false;
	    }else{
	        if ((wordCounter('Refferences', 100))==false){
	            window.alert("You have exceeded the maximum word limit for Refferences, please correct this before continuing.");
	            temp_obj.focus();
	            return false;
	        }
	    }	    
	    	    	    	          
	    temp_obj = document.getElementById('todoCompetition');
	    temp_obj.value = 'submitEducationCompetition';	    
	    document.EducationForm.submit();
	    return true;	    
	    
}



function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail Address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail Address")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail Address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail Address")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

 		 return true					
	}





/**
 * DHTML phone number validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */

// Declaring required variables
var digits = "0123456789";
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "()- ";
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validWorldPhoneChars = phoneNumberDelimiters + "+";
// Minimum no of digits in an international phone no.
var minDigitsInIPhoneNumber = 10;

function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}
function trim(s)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not a whitespace, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (c != " ") returnString += c;
    }
    return returnString;
}
function stripCharsInBag(s, bag)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1){
            returnString += c;
        }
    }
    return returnString;
}

function checkInternationalPhone(strPhone){
    var bracket=3;
    strPhone=trim(strPhone);
    if(strPhone.indexOf("+")>1) return false;
    if(strPhone.indexOf("-")!=-1)bracket=bracket+1;
    if(strPhone.indexOf("(")!=-1 && strPhone.indexOf("(")>bracket)return false;
    var brchr=strPhone.indexOf("(");
    if(strPhone.indexOf("(")!=-1 && strPhone.charAt(brchr+4)!=")")return false;
    if(strPhone.indexOf("(")==-1 && strPhone.indexOf(")")!=-1)return false;    
    s=stripCharsInBag(strPhone,validWorldPhoneChars);
    return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}

function SubmitTest(SID)
{
    var temp_obj;
     
    
	    temp_obj = document.getElementById('Concepts');	    
	    if (temp_obj.value == '')
	    {
	        alert('Please summarize 3 key concepts from the reading ');
	        temp_obj.focus();
	        return false;
	    }else{
	        if ((wordCounter('Concepts', 200))==false){
	            window.alert("You have exceeded the maximum word limit for Question 1, please correct this before continuing.");
	            temp_obj.focus();
	            return false;
	        }
	    }
	    
	    
	    temp_obj = document.getElementById('Relevancy');	    
	    if (temp_obj.value == '')
	    {
	        alert('Please describe how the information in this reading is relevant to your professional effectiveness. What, if anything, will you do differently as a result of this reading?');
	        temp_obj.focus();
	        return false;
	    }else{
	        if ((wordCounter('Relevancy', 200))==false){
	            window.alert("You have exceeded the maximum for Question 2, please correct this before continuing.");
	            temp_obj.focus();
	            return false;
	        }
	    }	 
	    
	    
	    temp_obj = document.getElementById('Enhancement');	    
	    if (temp_obj.value == '')
	    {
	        alert('Please describe how will the information in this session enhance your practice, i.e., improved profitability, teamwork, or clinical skills?');
	        temp_obj.focus();
	        return false;
	    }else{
	        if ((wordCounter('Enhancement', 200))==false){
	            window.alert("You have exceeded the maximum for Question 3, please correct this before continuing.");
	            temp_obj.focus();
	            return false;
	        }
	    }		       
	         
	         
	    temp_obj = document.getElementById('Questions');	    
	    if (temp_obj.value == '')
	    {
	        alert('Please list two questions that you have from the reading that you would like to discuss further.');
	        temp_obj.focus();
	        return false;
	    }else{
	        if ((wordCounter('Questions', 200))==false){
	            window.alert("You have exceeded the maximum for Question 4, please correct this before continuing.");
	            temp_obj.focus();
	            return false;
	        }
	    }
	    	            
    
	if (window.confirm("Are you sure you want to submit this test?\nYou will not be able to edit any answer once your test will be submitted.")){
		document.CourseTestForm.SID.value = SID;
		document.CourseTestForm.todo.value = "Submit Test";
		document.CourseTestForm.submit();
	}         
    
     
}


function openViewAccount(CID)
{
    window.open('accountDetail.asp?CID='+CID, '', 'toolbar=0,location=0, directories=0, status=0, menubar=0,scrollbars=1,width=550,height=300');
    
}

function MergeAccount(CIDKeep, CIDRemove)
{

    if (CIDKeep > 0 && CIDRemove > 0)
    {
		document.MergeAccountForm.todoMergeAccount.value = "MergeAccount";
		document.MergeAccountForm.CIDKeep.value = CIDKeep;
		document.MergeAccountForm.CIDRemove.value = CIDRemove;
		document.MergeAccountForm.submit();
    }else{
        return false;
    }
    
    
}