/* 2004 Copyright Genetrack Biolabs Inc. ALL RIGHTS RESERVED */
/* This .JS file contains global functions for genexdiagnostics.com */

/* This fuction pops up an external link (i.e. target="_blank"). */
function winSub(url,x,y,bln,scr) { 
	window.open(url,'','width=' + x + ',height=' + y + ',scrollbars=' + scr + ',top=50,left=50,resizable=' + bln + ',menubar=' + bln + ',toolbar=' + bln + ',status=' + bln + ',location=' + bln);
}

function hideOnLoad() {
var hideQ = 11;
	for (var i=1; i <= hideQ; i++) {
	var q = document.getElementById('Q' + i);
    if(q != null) q.style.display = "none";
    document.getElementById('A' + i).style.display = "none";
		}
}

function hideAll() {
	var sa = document.getElementById("chkViewAll");
    var ch = sa.checked;
    hideQuestions(ch);
    }

function hideQuestions(checked) {
    var faqEntryCount = 11;
	
    	for (var i=1; i<=faqEntryCount; i++) {
	    	var marker = document.getElementById("marker" + i);
            if (checked == true)
            	expandQuestion("marker" + i, "Q" + i, "A" + i);
            else
            	collapseQuestion("marker" + i, "Q" + i, "A" + i);
            }
   
    if (checked == false) {
		var sa = document.getElementById("chkViewAll");
	    sa.checked = false;
        }
}

function hideQuestion(tName, qName, aName) {
	var marker = document.getElementById(tName);
	if (marker == null) return;

	var ans = document.getElementById(aName);
    if (ans == null) return;
                    
	var que = document.getElementById(qName);
    if (ans.style.display == '') {
    	if (que != null) que.style.display = 'none';
	    
		ans.style.display = 'none';
	    var sa = document.getElementById("chkViewAll");
	    sa.checked = false;
   }
   else {
	    if (que != null) que.style.display = '';
	    ans.style.display = '';
        }
}

function expandQuestion(tName, qName, aName) {
	var marker = document.getElementById(tName);
    if (marker == null) return;
    
	var ans = document.getElementById(aName);
    if (ans == null) return;
    
	var que = document.getElementById(qName);
    if (que != null) que.style.display = '';
    
	ans.style.display = '';
}

function collapseQuestion(tName, qName, aName) {
	var marker = document.getElementById(tName);
    if (marker == null) return;
    
	var ans = document.getElementById(aName);
    if (ans == null) return;
    
	var que = document.getElementById(qName);
    if (que != null) que.style.display = 'none';
    
	ans.style.display = 'none';
}
