 
var checkedvalues;
 
function storeCheckedValues(radioObj)
{
 if(!radioObj)
 
  return;
 var radioLength = radioObj.length;
 
 checkedvalues = new Array(radioLength);
 for(var i = 0; i < radioLength; i++) {
  //check only radios
  //store old values in temporary array checkedvalues
  checkedvalues[i] = radioObj[i].checked;
 }
}
 
function setCheckedValue(radioObj) {
 //alert('setCheckedValue' + ' ' + newValue);
 if(!radioObj)
 
  return;
 var radioLength = radioObj.length;

//to keep the checked values of other layers, create an array

 for(var i = 0; i < radioLength; i++) {
  
  if (radioObj[i].type=='checkbox') {
   //alert(radioObj[i].type + '  ' + radioObj[i].value);
   //alert(checkedvalues[i]);
   radioObj[i].checked = checkedvalues[i];
   
  }
   
 }
 return false;
 
}

function resetToBegin()
{
	var url = document.location + "";
  
  //if ((width == -1) || (height == -1)) 
  //{
  //  var clientWidth = (document.all) ? document.body.clientWidth:window.innerWidth;
  //  var clientHeight = (document.all) ? document.body.clientHeight:window.innerHeight;
  
  //  url += "?MAP_WIDTH=" + (clientWidth-390) + "&MAP_HEIGHT=" + (clientHeight-110);
  
  //alert(url);
  
  document.location.href=url;
}


function getInnerHeight()
{
  clientHeight = (document.all) ? document.body.clientHeight:window.innerHeight;

  return(clientHeight);
}
  
function setSize()
{
  var url = document.location + "";
  var width = url.indexOf('MAP_WIDTH=');
  var height = url.indexOf('MAP_HEIGHT=');
  
  if ((width != -1) || (height != -1)) 
  {
    var oldurl = url.split('?MAP_WIDTH=');
    var clientWidth = (document.all) ? document.body.clientWidth:window.innerWidth;
    var clientHeight = (document.all) ? window.innerHeight:document.body.clientHeight;

    newurl = oldurl[0] + "?MAP_WIDTH=" + (clientWidth-290) + "&MAP_HEIGHT=" + (clientHeight-100);

    document.location.replace(newurl);
  }
}
 
function SwitchLayer(anId)
{
	var anElem = document.getElementById(anId);

	if(anElem.style.display == "none"){
		anElem.style.display = "block";
	}else{
		anElem.style.display = "none";
	}
}
  	
function UpdateHiddenVisible(anId,aHidden)
{
	var anElem = document.getElementById(anId);

	if(anElem.style.display == "none"){
		aHidden.value="false";
	}else{
		aHidden.value="true";
	}
}
	
function getRow(rowName)
{
  return document.getElementById(rowName);
}
  
function selectLayer(szLayerName)
{
  var i = 0;
  
  if (szLayerName == "" || getRow('layer_'+szLayerName) == null)
  {
    return;
  }
  //pass selection onto SelectLayers widget
  CWCSelectLayer( szLayerName, true );

  while (oRow=getRow('layer_'+LegendTemplateGetLayerName( i )))
  {
   //alert('gevonden: layer_'+LegendTemplateGetLayerName( i ));
   
    oRow.className = 'rowNormal';
    i++;
  }
  //set divs on selected row
  getRow('layer_'+szLayerName).className = 'rowSelect';
}

function myOnLoad()
{
  CWC2OnLoadFunction()
}

