
function getStyle(name)
{
  if (document.getElementById)
  {
	return document.getElementById(name).style;
  }
  else if (document.all)
  {
	return document.all[name].style;
  }
  else if (document.layers)
  {
   	return document.layers[name];
  }
  return null;
}

 function toggleLayer( whichLayer )//for css Hide
{
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}

function toggleBoxes() {

	for(var i=0; i < inputs.length; i++) {

		if(inputs[i].getAttribute('type')=='checkbox') {
			
			if(inputs[i].style.display=='none') {
				inputs[i].style.display='inline';
			} else {
				inputs[i].style.display='none';
			}
		}
	}
}



function showCheckBoxes() { 
     
    //get all the input fields on the page 
    inputs = document.getElementsByTagName('input'); 

    //cycle trough the input fields 
    for(var i=0; i < inputs.length; i++) { 

        //check if the input is a checkbox 
        if(inputs[i].getAttribute('type') == 'checkbox') { 
             
            //show the checkbox 
            inputs[i].style.display='block'; 
        } 
    } 
} 


function hideCheckBoxes() { 
     
    //get all the input fields on the page 
    inputs = document.getElementsByTagName('input'); 

    //cycle trough the input fields 
    for(var i=0; i < inputs.length; i++) { 

        //check if the input is a checkbox 
        if(inputs[i].getAttribute('type') == 'checkbox') { 
             
            //hide the checkbox 
            inputs[i].style.display='none'; 
        } 
    } 
} 



 function hideLayer( whichLayer )//for when we don't want it to toggle
{
  var vis;
  vis= getStyle(whichLayer);
  // if the style.display value is blank we try to figure it out here
  //if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    //vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = 'none';
}


function showLayer( whichLayer )//for when we don't want it to toggle
{
  var vis;
  vis= getStyle(whichLayer);
  // if the style.display value is blank we try to figure it out here
  //if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    //vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = 'block';
}


function hideRow( whichRow )//for when we don't want it to toggle
{
  hideLayer(whichRow);
}

function showRow( whichRow )//for when we don't want it to toggle
{
  var vis;
  vis= getStyle(whichRow);
  // if the style.display value is blank we try to figure it out here
  //if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    //vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = '';
}

function toggleDiv(id,flagit) {
    if (flagit=="1"){
        if (document.layers) document.layers[''+id+''].visibility = "show"
        else if (document.all) document.all[''+id+''].style.visibility = "visible"
        else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "visible"
    }
    else
    if (flagit=="0"){
        if (document.layers) document.layers[''+id+''].visibility = "hide"
        else if (document.all) document.all[''+id+''].style.visibility = "hidden"
        else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "hidden"
    }
}

 function toggle_s_mode(totalCount,mode)//for css Hide of select boxes
{
	for (var i=0; i < totalCount; i++){
		if (mode=='hide')
		{
		     if (i!='')
		     {
		     hideLayer('box'+ i );
		     }
         }else{
		 	 if (i!='')
		     {
		     showLayer('box'+ i );
		     }
		 
		 }
 	}
}

 function layerExtract( toggleCode,mode )//for css Hide
{
	//extract the row numbers from the togglecode and assign them to variables
	var layerNumber=toggleCode.split(',');//',' is the delimiter	
	for (var i=0; i < layerNumber.length; i++){
		if (mode=='hide')
		{
		     if (layerNumber[i]!='')
		     {
		     hideRow('row'+ layerNumber[i] );
		     }
         }else{
		 	 if (layerNumber[i]!='')
		     {
		     showRow('row'+ layerNumber[i] );
		     }
		 }
 	}
}

function fastchoices()
{
    toggleLayer('fastchoice_new');
    toggleLayer('fastchoice_style');
}

function fastchoiceitem(everythingName,lns,showOrHide)
{
    toggleLayer(everythingName);
    toggleLayer('showNew');
    toggleLayer('showChanged');
    toggleLayer('showAcres');
    toggleLayer('showSingleFamily');
    toggleLayer('showCondo');
    layerExtract(lns,showOrHide);
}

function newChoiceItem(showOrHide)
{
    fastchoiceitem('showEverything',notNewListingLNs,showOrHide);
}
function changedChoiceItem(showOrHide)
{
    fastchoiceitem('showEverythingb',notChngListingLNs,showOrHide);
}
function acreageChoiceItem(showOrHide)
{
    fastchoiceitem('showEverythingc',notAcrListingLNs,showOrHide);
}
function singleStyChoiceItem(showOrHide)
{
    fastchoiceitem('showEverythingSTY',notSingleFamilyListingLNs,showOrHide);
}
function condoStyChoiceItem(showOrHide)
{
    fastchoiceitem('showEverythingSTYb',notCondoListingLNs,showOrHide);
}

