/*--------------------- Funtion to toggle sigle Q&A ------------------*/


function hideAnswer(id){
	var myobj= document.getElementById(id);
	myobj.style.display = "none";
}
	function toggleAnswer(ansObj,obj){
		if (document.getElementById(ansObj).style.display == "block")
		{
			document.getElementById(ansObj).style.display = "none";
			obj.className='questionLink';
		}
		else
		{	document.getElementById(ansObj).style.display = "block";
			obj.className='questionLinkMinus';
		}
			}

/*--------------------- Funtion to Show/Hide Topic Q&As ------------------*/

function toggleShowAll(topicNo,objid){
	answerOptionList=document.getElementById(topicNo).getElementsByTagName('div');
	if(objid.innerHTML=='Show all')
	{
		for(var i=0;i<answerOptionList.length;i++)
		{
			if(answerOptionList[i].className=='answerDiv')
			{
				document.getElementById(topicNo+'_ans'+(i+1)).style.display="block";
				document.getElementById(topicNo+'_qtn'+(i+1)).className='questionLinkMinus';
			}
		}
		objid.innerHTML='Hide all';
	}
	else
	{
		for(var i=0;i<answerOptionList.length;i++)
		{
			if(answerOptionList[i].className=='answerDiv')
			{
				document.getElementById(topicNo+'_ans'+(i+1)).style.display="none";
				document.getElementById(topicNo+'_qtn'+(i+1)).className='questionLink';
			}
		}
		objid.innerHTML='Show all';
	}
	
}

/*--------------------- Funtion to Show/Hide All Q&As ------------------*/

function toggleViewAllGlobal(objthis){

    checkAndCallViewOrHide(objthis, 'topic01', document.getElementById('topic01_sa'));
    checkAndCallViewOrHide(objthis, 'topic02', document.getElementById('topic02_sa'));
    checkAndCallViewOrHide(objthis, 'topic03', document.getElementById('topic03_sa'));
    checkAndCallViewOrHide(objthis, 'topic04', document.getElementById('topic04_sa'));
    checkAndCallViewOrHide(objthis, 'topic05', document.getElementById('topic05_sa'));

	if(objthis.innerHTML=='View all Q&amp;A')
	{
		objthis.innerHTML='Hide all Q&amp;A';
	}
	else
	{
		objthis.innerHTML='View all Q&amp;A';				
	}
    
}

/*--------------------- Funtion to crosscheck topic toggle status ------------------*/

function checkAndCallViewOrHide(objthis, currDivId, divAnchObj) {
	if(objthis.innerHTML=='View all Q&amp;A')
	{
		if (divAnchObj.innerHTML=='Show all') {
	       toggleShowAll(currDivId, divAnchObj);
		}
	}
	else
	{
		if (divAnchObj.innerHTML=='Hide all') {
	       toggleShowAll(currDivId, divAnchObj);
		}
	}
}















function defaultValue() {
	
	$('#firstName').each(function() {
	    var default_value = 'First Name';
	    $(this).focus(function() {
	        if(this.value == default_value) {
	            this.value = '';
	        }
	    });
	    $(this).blur(function() {
	        if(this.value == '') {
	            this.value = default_value;
	        }
	    });
	});
	
	$('#lastName').each(function() {
	    var default_value = 'Last Name';
	    $(this).focus(function() {
	        if(this.value == default_value) {
	            this.value = '';
	        }
	    });
	    $(this).blur(function() {
	        if(this.value == '') {
	            this.value = default_value;
	        }
	    });
	});
	
	$('#npiNumber').each(function() {
	    var default_value = 'National Provider Identification Number';
	    $(this).focus(function() {
	        if(this.value == default_value) {
	            this.value = '';
	        }
	    });
	    $(this).blur(function() {
	        if(this.value == '') {
	            this.value = default_value;
	        }
	    });
	});
	
	$('#email').each(function() {
	    var default_value = 'E-mail Address';
	    $(this).focus(function() {
	        if(this.value == default_value) {
	            this.value = '';
	        }
	    });
	    $(this).blur(function() {
	        if(this.value == '') {
	            this.value = default_value;
	        }
	    });
	});
}

function slDefaultValue() {
	if (document.getElementById("slLicense").value==''){
		document.getElementById("slLicense").value='State License Number';
	}
	$('#slLicense').each(function() {
	    var default_value = 'State License Number';
	    $(this).focus(function() {
	        if(this.value == default_value) {
	            this.value = '';
	        }
	    });
	    $(this).blur(function() {
	        if(this.value == '') {
	            this.value = default_value;
	        }
	    });
	});
}

function getRightFields(hcpType) {
	if (hcpType=='HCP') {
		show('hcpOnly');
		hide('notHcp');
	}else if (hcpType=='CGV' || hcpType=='PAT'){
		show('notHcp');
		hide('hcpOnly');
	}
}

function onloadCheck(){
	var pat = document.getElementById('userPat');
	var cgv = document.getElementById('userCgv');
	var hcp = document.getElementById('userHcp');
	if(pat.checked == true || cgv.checked == true) {
		userSelected = true;
		show('notHcp');
		hide('hcpOnly');
	}else if(hcp.checked == true) {
		show('hcpOnly');
		hide('notHcp');
	}else {
		pat.checked = true;
		show('notHcp');
		hide('hcpOnly');
	}
}

function show(id1)
	{	
		var obj = document.getElementById(id1);
		obj.style.display ="block";
	}
	
function hide(id1)
	{	
		var objj = document.getElementById(id1);
		objj.style.display ="none";
	}
	
	var ObjVar = null;
function popupWindow(strUrl) 
	{
		if (ObjVar == null || ObjVar.closed) {
			ObjVar = window.open(strUrl, "_blank", "top=0, left=0, location=1, toolbar=1, menubar=1, resizable=1, scrollbars=1, status=1, width=785, height=570");
		} else {
			ObjVar.focus();
	}
	}
	
		
		
		function popupWindow1(strUrl) 
	{
		
			window.open(strUrl, "_blank", "top=0, left=0, location=1, toolbar=1, menubar=1, resizable=1, scrollbars=1, status=1, width=785, height=570");
		
	}
function callDisclaimerExitSecure() {
		tb_show("", 'exit1_secure.html?KeepThis=true&TB_iframe=true&height=142&width=418&modal=true', false);
	}
	
	
	function callDisclaimerExit() {
		tb_show("", 'exit1.html?KeepThis=true&TB_iframe=true&height=142&width=418&modal=true', false);
	}	