function SetChecked(val,type) 
{
	dml=document.Form1;
	len = dml.elements.length;
	
	var i=0;
	for( i=0 ; i<len ; i++) 
	{
		if (dml.elements[i].type=='checkbox' && dml.elements[i].value==type) 
			{
				dml.elements[i].checked=val;
			}
	}
}


function SinchronizeLayouts(oSrc, oTgt)
{

	if (oSrc && oTgt) 
		try{
		if ((navigator.appVersion.indexOf('MSIE 5') > 0 || navigator.appVersion.indexOf('MSIE 6') > 0 || navigator.appVersion.indexOf('MSIE 7') > 0)) 
		{
		oTgt.style.width = oSrc.style.pixelWidth;
		}
		else
		{
			oTgt.style.width = oSrc.style.pixelWidth;
			oTgt.style.overflow='auto';
					oTgt.style.width= '100%'; 
					oTgt.style.height= '100%';
					}
		}catch (ex){
		}
}

function SinchronizeToolbar(oSrc, oTB, oTBC)
{
	if (oSrc && oTB && oTBC){
		try{
			oTB.style.width = oTB.style.width = window.parent.page.frameElement.width + 'px';              //oSrc.offsetWidth + 'px';
			if (oTB.offsetWidth < oTBC.offsetWidth) {
			  oTB.style.height = 55 + 'px';
			}else{
			  oTB.style.height = oTBC.offsetWidth > 2 ? 38 + 'px' : 0 + 'px';
			}
		}catch (ex){
		}
	}
}

function openwin_simple(url,w_name,width,height) 
{
		var scr_w = screen.width;
		var scr_h = screen.height;
		var left = ( scr_w - width ) / 2;
		var top =( scr_h - height ) / 2;
		window.open(url,w_name, "height="+height+",width="+width+",top="+top+",left="+left+",scrollbars=yes");
}

// Image Selector

var make_a_images = new Array();
make_a_images[1] = 'images/grid.gif';
make_a_images[2] = 'images/chart.gif';

var chart_type_images = new Array();
chart_type_images["Line"] = 'images/line.gif';
chart_type_images["stacked bar"] = 'images/barchart.gif';
chart_type_images["stacked 3d column"] = 'images/3d.gif';

function SetImageFile(ImageId, anArray, list)
{
		aImage = document.getElementById(ImageId);
		aKey = list.options[list.selectedIndex].value;
		// alert(" aKey " + aKey + " image " + anArray[aKey]);
		aImage.src = anArray[aKey];
}


function getX( oElement ) {
  var iReturnValue = 0;
  while( oElement != null ) {
    iReturnValue += oElement.offsetLeft;
    oElement = oElement.offsetParent;
  }
  return iReturnValue;
}

function getY( oElement ) {
  var iReturnValue = 0;
  while( oElement != null ) {
    iReturnValue += oElement.offsetTop;
    oElement = oElement.offsetParent;
  }
  return iReturnValue;
}


function viewObject(name) { 
		var obj = eval(name),i; 
		if(!obj) {
				alert("\""+name+"\" ia not an object"); return; 
		} 
		var w_Test = open("","Test","width=600,height=500,scrollbars=1"); 
		if(!w_Test) { 
			alert("Cannot open window for "+name); return; 
		} 
		w_Test.document.open(); 
		for(i in obj) w_Test.document.write(name+"."+i+"="+obj[i]+"<br/>"); 
		w_Test.document.close(); 
} 
		
