 function SelectAllCheckboxes(spanChk)
 {

   // Added as ASPX uses SPAN for checkbox
   var oItem = spanChk.children;
   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 ChangeStyle(me, backColor) 
 {
    var inputs = me.getElementsByTagName("input");
    
    for (var i=0;i<inputs.length;i++)
    {
        if(inputs[i].type == "checkbox")
        {
            if(!inputs[i].checked)
               {
                    me.style.backgroundColor = backColor;
                    i = inputs.length;
               }
        }
    }
    
 }
 
 function ApplyStyle(me, backColor) 
{ 
    var td = me.parentNode; 
    if (td == null) 
        return; 
        
    var tr = td.parentNode;
    if (me.checked)
    { 
       tr.style.backgroundColor = '#D7D7D7'; 
    } 
    else 
    { 
       tr.style.backgroundColor = backColor; 
    } 
}


function expand_contract(obj){
	var temp = obj.parentNode.childNodes[1].style;
	var temp2 = obj.parentNode.childNodes[0].style;
	if (temp.visibility == "hidden") {
		temp.visibility = "visible";
		temp.display = "block";
	}else {
		temp.visibility = "hidden";
		temp.display = "none";
		
	}
}

function rollover()
{
  if(!document.getElementById || !document.createTextNode){return;}
  var n=document.getElementById('nav');
  if(!n){return;}
  var lis=n.getElementsByTagName('li');
  for (var i=0;i<lis.length;i++)
  {
    lis[i].onmouseover=function()
    {
      this.className=this.className?'cur':'over';
    }
    lis[i].onmouseout=function()
    {
       this.className=this.className=='cur'?'cur':'';
    }
  }
}
window.onload=rollover;


function loadPreview(url) 
{
    var load = window.open(url,'','scrollbars=yes,menubar=no,height=600,width=800,resizable=yes,toolbar=no,location=no,status=no');
}

function loadHelp(fileName) 
{
    var load = window.open('/WoodbridgeDermatologyAndLaserCenterCMS/Help.aspx?id='+fileName,'','scrollbars=yes,menubar=no,height=600,width=800,resizable=yes,toolbar=no,location=no,status=no');
}

function querySt(ji) {
	hu = window.location.search.substring(1);
	gy = hu.split("&");
	for (i=0;i<gy.length;i++) {
		ft = gy[i].split("=");
		if (ft[0] == ji) {
			return ft[1];
		}
	}
}

function displayAd(queryStringVariable, queryStringValue, adGenericText, adSpecificText) 
{ 

	// assign text to be printed - i.e. generic ad
	var adText = adGenericText;

	//Parse the current page's querystring
	//var qs = new Querystring()
	var actualQueryStringValue = querySt(queryStringVariable)

	// if exists and has requested value, assign text to be printed - specific ad
	if(actualQueryStringValue == queryStringValue)
		adText = adSpecificText;

	// write out text
	document.write(adText);

}
