// JavaScript Document

function open_cont(i){
dimentions = pageDimensions();
//document.getElementById('html').style.overflow = 'hidden';
document.getElementById('holder_table').style.height = dimentions[1]+'px';
//document.getElementById('BG_div').style.height = dimentions[1]+'px';
//document.getElementById('popHTM').style.height = dimentions[1]+'px';

	document.getElementById('BG_div').style.visibility = 'visible';
	document.getElementById('popHTM').style.visibility = 'visible';
	ajaxFunction_cont(i)
	
	fadeInBG(0);
}


function close_cont(i){
//document.getElementById('html').style.overflow = 'visible';
	document.getElementById('holder_table').style.visibility = 'hidden';
	document.getElementById('popHTM').style.visibility = 'hidden';
	document.getElementById('popHTM').innerHTML = '';
	
	fadeOutBG(i);	
}

function fadeOutBG(i)
{

setTrans("BG_div",i * 10);


	i --;
	if (i >= 1) {
		setTimeout("fadeOutBG(" + i + ")",10);
		}else{document.getElementById('BG_div').style.visibility = 'hidden';}
}

function fadeInBG(i)
{

setTrans("BG_div",i * 10);


	i ++;
	if (i <= 7) {
		setTimeout("fadeInBG(" + i + ")",10);
		}else{document.getElementById('holder_table').style.visibility = 'visible';}
}

function setTrans(id,amount) {
	element = document.getElementById(id);
	
	if (navigator.appName.indexOf("Netscape")!=-1 && parseInt(navigator.appVersion)>=5) {
		element.style.MozOpacity = amount / 100;
	} else if (navigator.appName.indexOf("Microsoft")!= -1 && parseInt(navigator.appVersion)>=4) {
		element.style.filter = 'alpha(opacity=' + amount + ')';
	}	
}


function ajaxFunction_cont(cont){
       var ajaxRequest;  // The variable that makes Ajax possible!
       try{
              // Opera 8.0+, Firefox, Safari
              ajaxRequest = new XMLHttpRequest();
       } catch (e){
              // Internet Explorer Browsers
              try{
                     ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
              } catch (e) {
                     try{
                           ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
                     } catch (e){
                           // Something went wrong
                          alert("Your browser does not support xml requests, please upgrade.");

                           return false;
                     }
              }
       }

       // Create a function that will receive data sent from the server
       ajaxRequest.onreadystatechange = function(){

              if(ajaxRequest.readyState == 4){
document.getElementById('popHTM').innerHTML = ajaxRequest.responseText;
                     
              }
       }
       

       var queryString = "?cont=" + cont;

       ajaxRequest.open("GET", "switch_fade_content.php" + queryString, true);

       ajaxRequest.send(null); 
	 
}
/*
function pageDimensions() {
	winH2 = (document.body.offsetHeight > document.body.scrollHeight) ? document.body.offsetHeight : document.body.scrollHeight;
	winH = document.documentElement.clientHeight-3;
	
	//if (winH2 >= winH) {
	//	winH = winH2;
		//winH = document.body.clientHeight;
	//}

	winW = document.body.clientWidth;
					
	d = new Array(2);
	d[0] = winW;
	d[1] = winH;
	
	return d;
}
*/
function resize_win(){
dimentions = pageDimensions();
document.getElementById('holder_table').style.height = dimentions[1]+'px';
//document.getElementById('BG_div').style.height = dimentions[1]+'px';		
}

function resize_win(){
dimentions = pageDimensions();
document.getElementById('holder_table').style.height = dimentions[1]+'px';
//document.getElementById('BG_div').style.height = dimentions[1]+'px';		
}

window.onresize =  resize_win;




// JavaScript Document
