/* This script and many more are available free online at
The JavaScript Source :: http://javascript.internet.com
Created by: Jeroen Haan :: http://www.haan.net/ */

/* -----------------------------------------------
   Floating layer - v.1
   (c) 2006 www.haan.net
   contact: jeroen@haan.net
   You may use this script but please leave the credits on top intact.
   Please inform us of any improvements made.
   When usefull we will add your credits.
  ------------------------------------------------ */

//x = 20;
x = 0;
//y = 140;
y = 0;

function height_window(){
	if(window.innerHeight) {
		return window.innerHeight;
	}
	//if(document.body.clientHeight) {
	if(document.documentElement.clientHeight) {
		//return document.body.clientHeight;
		return document.documentElement.clientHeight;
	}
		
	return (null);
}
function width_window(){
	if(document.body.clientWidth) {
		return document.body.clientWidth;
	}
	if(window.innerWidth) {
		return window.innerWidth;
	}
	//if(document.body.clientHeight) {
	if(document.documentElement.clientWidth) {
		//return document.body.clientHeight;
		return document.documentElement.clientWidth;
	}
	
		
	return (null);
}
function getScrollTop(){
	if(document.body.scrollTop) {
		return document.body.scrollTop;
	}
	if(document.documentElement.scrollTop) {
		return document.documentElement.scrollTop;
	}
		
	return (null);
}


function setChid(iframe, id_cheque) {
	document.getElementById(iframe).src = "mail_cheque_friend.php?ch_id=" + id_cheque;
}
function setVisible(obj)
{
	obj = document.getElementById(obj);
	//obj.style.visibility = (obj.style.visibility == 'visible') ? 'hidden' : 'visible';
	obj.style.display = (obj.style.display == 'block') ? 'none' : 'block';
	
	document.getElementById('modal').style.visibility = (document.getElementById('modal').style.visibility == 'visible') ? 'hidden' : 'visible';
	var maxHeight = document.getElementById('chkHeight').offsetTop + 100;
	//document.getElementById('modal').style.width = '105%';
	document.getElementById('modal').style.width = width_window() + 'px' ;
    document.getElementById('modal').style.height = maxHeight+'px';
}
function placeIt(obj)
{
	obj = document.getElementById(obj);
	//if (document.body)
	//{
		//theLeft = document.body.scrollLeft;
		theLeft = (document.body.clientWidth - obj.style.width.slice(0,-2)) / 2 ;
		//theTop = document.body.scrollTop;
		//theTop = (height_window() - obj.style.height.slice(0,-2)) / 2 ;
		theTop = getScrollTop() + (height_window() - obj.style.height.slice(0,-2)) / 2 ;
				
	//}
	// else if (document.documentElement)
	// {
		//theLeft = document.documentElement.scrollLeft;
		// theLeft = (document.body.clientWidth - obj.style.width.slice(0,-2)) / 2 ;
		// theTop = document.documentElement.scrollTop;
		//theTop = document.body.scrollTop;
	// }
	
		
	theLeft += x;
	theTop += y;
	obj.style.left = theLeft + 'px' ;
	obj.style.top = theTop + 'px' ;
	setTimeout("placeIt('layer1')",200);
}
window.onscroll = setTimeout("placeIt('layer1')",200);
