
// Khadmei Consulting - Javascript source
// www.khademiconsulting.com

divid = "containerBody";
frameid = "bodyframe";
minHeight = 300 + "px";
site = 'kha' + 'demi' + 'cons' + 'ulting' + '.' + 'com';


function emlad( usr, sub )
{
	document.write('<a ' + 'href=' + '\"mailto:' + usr + '@' + site + '?subject=' + sub + '\">');
	document.write(usr + '@' + site + '</a>');
}


function changeImage(object, source)
{
	//document.images[object].src = source;
	document.getElementById(object).src = source;
}


function loadFrame(address)
{
	resizeFrame();
	resizeDivs();
}


function changeAddress(address)
{
	/*
	// Load the frame with the new address
	*/
	document.getElementById(frameid).src=address;
}


function resizeFrame()
{
	/*
	// Resize the new frame to match its contents
	*/
	var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1];
	var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0; //extra height in px to add to iframe in FireFox 1.0+ browsers
	var frame=document.getElementById(frameid);
	
	if (frame && !window.opera){
		frame.style.display="block";
			
		if (frame.contentDocument && frame.contentDocument.body.offsetHeight) //ns6 syntax
			frame.height = (frame.contentDocument.body.offsetHeight+FFextraHeight + 30) + "px";
		else if (frame.Document && frame.Document.body.scrollHeight) //ie5+ syntax
			frame.height = (frame.Document.body.scrollHeight + 10) + "px";
	}
	
	/* Adjust frame hight to minimum setting*/
	if( frame.height < minHeight )
		frame.height = minHeight;
}



function resizeDivs()
{
	var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1];
	var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0; //extra height in px to add to iframe in FireFox 1.0+ rowsers

	/* Make DIV container the same height */
	frame = document.getElementById(frameid);
	div = document.getElementById(divid);
	
	if (frame && !window.opera){
		frame.style.display="block";
	
		if (frame.contentDocument && frame.contentDocument.body.offsetHeight) //ns6 syntax
			div.style.height = (frame.contentDocument.body.offsetHeight + FFextraHeight + 50) + "px";
	
		else if (frame.Document && frame.Document.body.scrollHeight) //ie5+ syntax
			div.style.height = (frame.Document.body.scrollHeight + 10) + "px";
	}	
	
	/* Adjust frame hight to minimum setting*/
	if( div.style.height < minHeight )
		div.style.height = minHeight;


	for (i=0; i<div.childNodes.length; i++) {
		div.childNodes[i].style.height = (div.style.height);
	
/*		alert(div.childNodes[i].name);
		node = div.childNodes[i];
		if (node.nodeName=="div") {
			node.style.height = x;
   		}
*/	}

}



function resizeDivs1()
{
	minh = 280;		//minimum heihgt for the body
	div1 = document.getElementById("div1");
	div2 = document.getElementById("div2");
	div3 = document.getElementById("containerBody");
	
	//Find maximum height
	h = div1.style.height; 
	alert(div1.style.height);
	alert(div2.style.height);
	alert(div3.style.height);
	
	
	if( h < div2.style.height ) {
		h = div2.style.height;
	}
	else if( h < minh ) {
		h = minh;
	}	
	
	h = h + 20 + "px"; //add padding
	alert(h);
	
	//Set all divs to the same height
	div1.style.height = h;
	div2.style.height = h;
	div3.style.height = h;
}