var box;
YAHOO.namespace("example.container");

		function init() {
			
			if(navigator.appVersion.match("MSIE 6.0")){
				document.getElementById("bd").style.width='490px';
				document.getElementById("bd").style.height='325px';
				document.getElementById("bd").style.padding='30px 15px 15px 15px';
				document.getElementById("bd").style.backgroundImage="url(/annual_report/2007/html/common/images/interface/lightbox.gif)";
				document.getElementById("hd").style.height='0px';
				document.getElementById("hd").style.lineHeight='0px';
				//document.getElementById("hd").style.display="none";
				
				YAHOO.example.container.panel1 = new YAHOO.widget.Panel("panel1", {close:false,height:"376px",width:"518px",zIndex:9999999,iframe :true,fixedcenter:true,constraintoviewport : true,  draggable:true, visible:false,underlay:'shadow'} );
				
				
				document.getElementById("bd2").style.width='475px';
				document.getElementById("bd2").style.height='325px';
				document.getElementById("bd2").style.padding='30px 1px 15px 1px';
				document.getElementById("bd2").style.backgroundImage="url(/annual_report/2007/html/common/images/interface/lightbox_small.gif)";
				document.getElementById("hd2").style.height='0px';
				document.getElementById("hd2").style.lineHeight='0px';
				//document.getElementById("hd").style.display="none";
				
				YAHOO.example.container.panel2 = new YAHOO.widget.Panel("panel2", {close:false,height:"376px",width:"50px",zIndex:9999999,iframe :true,fixedcenter:true,constraintoviewport : true,  draggable:true, visible:false,underlay:'shadow'} );
				
			}
			else{
			
			// Instantiate a Panel from markup
			YAHOO.example.container.panel1 = new YAHOO.widget.Panel("panel1", {close:true,height:"398px",width:"505px",zIndex:9999999,iframe :true,fixedcenter:true,constraintoviewport : true,  draggable:true, visible:false,underlay:'none'} );
			
			document.getElementById("bd2").style.backgroundImage="url(/Theme/COS/files/FinancialReports/AnnualReport2007/common/images/interface/lightbox_small.png)";
			YAHOO.example.container.panel2 = new YAHOO.widget.Panel("panel2", {close:true,height:"398px",width:"505px",zIndex:9999999,iframe :true,fixedcenter:true,constraintoviewport : true,  draggable:true, visible:false,underlay:'none'} );
			}
			YAHOO.example.container.panel1.beforeHideEvent.subscribe(function(){document.getElementById("zuBoxContent").style.overflowY="hidden";});
			//YAHOO.example.container.panel1.render();
			var url = '/annual_report/2007/html/notes/notes.html';
	var ajax = new AjaxDelegate(url, initNotes);
    	ajax.Fetch();
			
		}

		YAHOO.util.Event.addListener(window, "load", init);
		
function initNotes(url, response){
		
		
	var content = document.createElement("div");
	content.id = 'zuBoxContent';
	if(navigator.appVersion.match("MSIE 6.0")){
	content.innerHTML = "<a onclick=\"YAHOO.example.container.panel1.hide()\" style=\"position:absolute; top:1; left:1;\"><img src=\"/annual_report/2007/html/common/images/interface/lightbox_close.gif\" /></a>"+response;
	
	}
	else
	content.innerHTML = response;
	
	YAHOO.example.container.panel1.setBody(content);
	YAHOO.example.container.panel1.render();
/*	
		var child = document.getElementById("zuBoxContent").childNodes;
		for (var i=0; i<child.length; i++){
		//	alert(child[i].nodeName);
			if(child[i].nodeName=="TABLE"){
				child[i].style.width="96%";	
				for (var j=0; j< child[i].childNodes.length; j++){
					//alert(child[i].childNodes[j].nodeName);return;
						if (child[i].childNodes[j].nodeName == "TBODY"){
						
							for (var k=0; k< child[i].childNodes[j].childNodes.length; k++){
								if (child[i].childNodes[j].childNodes[k].nodeName == "TR"){
									for (var l=0; l< child[i].childNodes[j].childNodes[k].childNodes.length; l++){
										if (child[i].childNodes[j].childNodes[k].childNodes[l].nodeName == "TD"){
											for (var m=0; m< child[i].childNodes[j].childNodes[k].childNodes[l].childNodes.length; m++){
												if (child[i].childNodes[j].childNodes[k].childNodes[l].childNodes[m].nodeName == "A"){
													//var anchorMatch = child[i].childNodes[j].childNodes[k].childNodes[l].childNodes[m];
													if(	child[i].childNodes[j].childNodes[k].childNodes[l].childNodes[m].href.match("#note")){
													var note = child[i].childNodes[j].childNodes[k].childNodes[l].childNodes[m].href.substr(child[i].childNodes[j].childNodes[k].childNodes[l].childNodes[m].href.indexOf("#note")+5).split("_");
													var noteParams = note[0];
													if (note[1]){
														noteParams += ", '"+note[1]+"'";
													//alert(noteParams);
														var clickFunc = 'function(){launchNote('+note[0]+',\''+note[1]+'\');return false;};';
													}
														 
													else{
														var clickFunc = 'function(){launchNote('+note[0]+');return false;};';
													}
													if (window.execScript)
														child[i].childNodes[j].childNodes[k].childNodes[l].childNodes[m].onclick = window.execScript(clickFunc);
													else
														child[i].childNodes[j].childNodes[k].childNodes[l].childNodes[m].onclick =eval(clickFunc);
													//alert(child[i].childNodes[j].onclick);
												}							
												}
											}		
							
										}
									}
								}
							}
						}
				}
			}
			else if(child[i].nodeName == "P"){
				for (var j=0; j< child[i].childNodes.length; j++){
						if (child[i].childNodes[j].nodeName == "A"){
							if(	child[i].childNodes[j].href.match("#note")){
								var note = child[i].childNodes[j].href.substr(child[i].childNodes[j].href.indexOf("#note")+5).split("_");
								var noteParams = note[0];
								if (note[1]){
									noteParams += ", '"+note[1]+"'";
								//alert(noteParams);
									var clickFunc = 'function(){launchNote('+note[0]+',\''+note[1]+'\');return false;};';
								}
									 
								else{
									var clickFunc = 'function(){launchNote('+note[0]+');return false;};';
								}
								if (window.execScript)
									child[i].childNodes[j].onclick = window.execScript(clickFunc);
								else
									child[i].childNodes[j].onclick =eval(clickFunc);
								alert(child[i].childNodes[j].onclick);
							}
							
						}
				}
			}
			
			
		}
		var anchors = document.getElementsByTagName('a');
		for(var i=0; i<anchors.length;i++){
			if (anchors[i].href){
				//alert(anchors[i].href);
			}
		}
		
	
	//document.body.innerHTML=document.getElementById("zuBoxContent").innerHTML;
	*/
}


function launchNote(id, section)
{
	
	
	//document.getElementById("zuBoxContent").innerHTML = response;
	
	
				
	
	//if (navigator.appVersion.match("MSIE")){
			//if(!panelIsOn){
				document.getElementById("zuBoxContent").style.overflowY="scroll";
				document.getElementById("panel1").style.display="block";
				YAHOO.example.container.panel1.show();
			//	panelIsOn = true;
				
			//}
			
			if (section){
			var a = "note"+id+"_"+section
			}
			else
				var a="note"+id;
		var anchorY = YAHOO.util.Dom.getY(a);
		var zuBoxY = YAHOO.util.Dom.getY('zuBoxContent');
		
		var scrollToY = (anchorY-zuBoxY);
		if(navigator.appName == "Netscape" ){
		scrollToY += 5;
		
		}
		else if (navigator.appVersion.match("MSIE 6.0"))
			scrollToY -= 5;
	
		var attributes = {
			scroll: {by: [0,scrollToY] }
		};
		//var anim = new YAHOO.util.Scroll('zuBoxContent', attributes,0.5,YAHOO.util.Easing.easeOut);
		//anim.animate();
	
		var anim = new YAHOO.util.Scroll('zuBoxContent', attributes,0.5,YAHOO.util.Easing.easeOut);
		//anim.onComplete.subscribe(function(){var anim = new YAHOO.util.Scroll('zuBoxContent', attributes,0.5,YAHOO.util.Easing.easeOut);anim.animate();});
		anim.animate();
	
			return false;
			
	
	
	if (section){
		var a = id+section
		var anchorY = YAHOO.util.Dom.getY(a);
		var zuBoxY = YAHOO.util.Dom.getY('zuBoxContent');
		
	
		var attributes = {
			scroll: {by: [0,(anchorY-zuBoxY)] }
		};
		//var anim = new YAHOO.util.Scroll('zuBoxContent', attributes,0.5,YAHOO.util.Easing.easeOut);
		//anim.animate();
	
		var anim = new YAHOO.util.Scroll('zuBoxContent', attributes,0.5,YAHOO.util.Easing.easeOut);
		//anim.onComplete.subscribe(function(){var anim = new YAHOO.util.Scroll('zuBoxContent', attributes,0.5,YAHOO.util.Easing.easeOut);anim.animate();});
		anim.animate();
	}
	
	//YAHOO.util.Dom.setXY('a', pos);

}

function launchGraph(href){
	var graph ="";
	if(navigator.appVersion.match("MSIE 6.0")){
		graph += "<a onclick=\"YAHOO.example.container.panel2.hide()\" style=\"position:absolute; top:1; left:1;\"><img src=\"/annual_report/2007/html/common/images/interface/lightbox_close.gif\" /></a>";
	}
	graph += '<table style="height:338px;padding:0px; margin:0px;"><tr><td style="vertical-align:middle;padding:0px;"><img src="'+href+'" /></td></tr></table>';
	YAHOO.example.container.panel2.setBody(graph);
	YAHOO.example.container.panel2.render();
	document.getElementById("panel2").style.display="block";
	YAHOO.example.container.panel2.show();

	return false;
	
}

function closeBox()
{
	
	//document.getElementById('zuBoxContent').innerHTML="";
	box.style.display = "none";	
	
}
/*
function f_clientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}
*/