// JavaScript Document
function test(){
	//var hello=document.getElementById('hello');
	//hello.className='declared';
	
	var empty=document.getElementById('LoadingDetail');
	
	addNode(empty,"Reader of ");
	addNode(empty,"AJAX in Action!");
	
	var child=empty.childNodes;
	for(var i=0; i<child.length ; i++){
		child[i].className='programmed';
	}
	empty.style.border='solid green 2px';
	empty.style.width='452px';
	empty.style.height='373px';
	test1();
	
}

function test1(){
	var testing=document.getElementById('loadC');
	
	testing.src="http://www.pooranee.lk" 
	testing.style.width='452px';
	testing.style.height='373px';
	testing.style.visibility=visible;

}

function test2(){
	var testing=document.getElementById('LoadingDetail');
	
	//testing.src="http://www.pooranee.lk" 
	testing.style.width='0px';
	testing.style.height='0px';
	testing.style.visibility="hidden";

}

function loadPHP(DisNo){
	//alert(DisNo);
	var empty=document.getElementById('LoadingDetail');
	var bname = navigator.appName;
   	//alert(bname);
	if (bname=="Microsoft Internet Explorer"){
		//alert("test");
		addNode(empty,DisNo);
	}
	else{
		//alert(bname);
		addNodeOther(empty,DisNo);
	}
	
	
}
//--------------------------------------------------------------
// For IE
//--------------------------------------------------------------
function addNode(el,DisNo){
   

	//var childEl=document.createElement("iFrame");
	//el.appendChild(childEl);
	
	//var textNode=document.createElement(text);
	//childEl.appendChild(textNode);
	//childEl.frameborder="0";
	//childEl.setAttribute("ID","NenasalaC");
	//childEl.setAttribute("frameborder",0);
	//childEl.setAttribute("allowtransparency","No");
	var childEl = document.getElementById( 'NenasalaC' );
	childEl.src='dis1.php?ID='+ DisNo;
	childEl.width='450px';
	childEl.height='373px';
	childEl.style.visibility="visible";

	//el.appendChild(childEl); 
}

function removeNode(){
	var bname = navigator.appName;
	//alert("ado");
	if (bname=="Microsoft Internet Explorer"){
		var d = document.getElementById( 'NenasalaC' );
		//d.style.position= 'absolute';
		d.style.visibility='hidden';
		d.width='1px';
		}
	else{
		//alert("hai");
		removeNodeOther();
	}	
	
	
	
	
	
	//var empty=document.getElementById('LoadingDetail');
	//empty.style.width='1px';
	//empty.style.border='solid green 2px';
	//d.parentNode.removeChild( d );
}

//--------------------------------------------------------------
// For Other
//--------------------------------------------------------------

function addNodeOther(el,DisNo){
   

	var childEl=document.createElement("iFrame");
	//el.appendChild(childEl);
	
	//var textNode=document.createElement(text);
	//childEl.appendChild(textNode);
	childEl.frameborder="0";
	childEl.setAttribute("id","NenasalaC");
	childEl.setAttribute("frameborder",0);
	childEl.setAttribute("allowtransparency","No");
	//var childEl = document.getElementById( 'NenasalaC' );
	childEl.src='dis1.php?ID='+ DisNo;
	childEl.width='450px';
	childEl.height='373px';
	//childEl.style.visibility="visible";

	el.appendChild(childEl); 
}

function removeNodeOther(){
	var d = document.getElementById( 'NenasalaC' );
	//d.style.position= 'absolute';
	//d.style.visibility='hidden';
	d.parentNode.removeChild( d );
}

//--------------------------------------------------------------
// For other browser ONLOAD
//--------------------------------------------------------------

function remNenasalaC(){
	var bname = navigator.appName;
	if (bname=="Microsoft Internet Explorer"){
		var d = document.getElementById( 'LoadingDetail' );
		d.className='LoadingDetail1';
	}
	else{
		var d = document.getElementById( 'NenasalaC' );
		d.parentNode.removeChild( d );
	}

}
