// JavaScript Document for CommonUtils start here

function SelectAllCheckboxes(spanChk) { // this function will check or uncheck checkbox(es)   
   var oItem = spanChk.children; // Added as ASPX uses SPAN for checkbox
   var theBox= (spanChk.type=="checkbox") ? 
        spanChk : spanChk.children.item[0];
   xState=theBox.checked;
   elm=theBox.form.elements;

   for(i=0;i<elm.length;i++)
     if(elm[i].type=="checkbox" && elm[i].id!=theBox.id) {
       if(elm[i].checked!=xState) elm[i].click();
     }
}

function getID(sObjID) {
    var obj=document.getElementById(sObjID);
    return (obj!=null)?(obj):(null);
}

function getXmlNodeVal(xmlNode,fieldName,index) { /* get the value of an xml */
   var I = (typeof(index)=='number') ?  index:0
   try { return xmlNode.getElementsByTagName(fieldName)[I].firstChild.nodeValue } catch(e) { return '' } 
}

// JavaScript Document for CommonUtils end here

function showDiv(divID) {
	getID("divHome").style.display = "none";
	getID("divStopSnoringTips").style.display = "none";
	getID("divDealingWithSnorer").style.display = "none";
	getID("divSnoringProducts").style.display = "none";
	getID("divSnoringCausesAndInformation").style.display = "none";	
	getID("divSnoringDisorder").style.display = "none";
	getID("divStopSnoringSurgery").style.display = "none";
	getID("divAntiSnoringDevices").style.display = "none";	
	getID("divHowToManageSnorer").style.display = "none";
	getID("divProductsSoldToStopSnoring").style.display = "none";	
	getID("divTipsToHaltSnoring").style.display = "none";		

	if (divID=="divHome") { getID("divHome").style.display = ""; }
	else if (divID=="divStopSnoringTips") { getID("divStopSnoringTips").style.display = ""; }
	else if (divID=="divDealingWithSnorer") { getID("divDealingWithSnorer").style.display = ""; }
	else if (divID=="divSnoringProducts") { getID("divSnoringProducts").style.display = ""; }
	else if (divID=="divSnoringCausesAndInformation") { getID("divSnoringCausesAndInformation").style.display = ""; }	
	else if (divID=="divSnoringDisorder") { getID("divSnoringDisorder").style.display = ""; }
	else if (divID=="divStopSnoringSurgery") { getID("divStopSnoringSurgery").style.display = ""; }
	else if (divID=="divAntiSnoringDevices") { getID("divAntiSnoringDevices").style.display = ""; }
	else if (divID=="divHowToManageSnorer") { getID("divHowToManageSnorer").style.display = ""; }	
	else if (divID=="divProductsSoldToStopSnoring") { getID("divProductsSoldToStopSnoring").style.display = ""; }
	else if (divID=="divTipsToHaltSnoring") { getID("divTipsToHaltSnoring").style.display = ""; }
}