function getInfo(id,mod){
	var id=id;
	var mod=mod;
	var div=document.getElementById('fon');
	var size=getPageSize();

	if (div==null){
		div=document.createElement("div");
		div.id='fon';
		document.body.appendChild(div);
	}
    div.style.background='#C0C0C0';
	div.style.width="100%";
	div.style.margin="0";
	div.style.padding="0";
	div.style.textAlign='center';
	div.style.left="0";
	div.style.top="0";
	div.style.position="absolute";
	div.style.zIndex="100";
	div.style.height=size[1];
	div.align='center';

	div.style.opacity = 0;
   	div.style.filter = 'alpha(opacity=' + 0 + ')';

   	div.style.display='block';

	setPlusOpacity(div.id, '8', 1);

	if (div.style.display=='none'){div.style.display='block';}
    var innerDiv=document.getElementById(id);
    if (innerDiv==null){
    	innerDiv=document.createElement("div");
    	innerDiv.id=id;
    	document.body.appendChild(innerDiv);
    	getInfoContent(innerDiv.id,mod);
    }
    innerDiv.style.position="absolute";
    innerDiv.style.zIndex="200";
	innerDiv.style.top=document.body.scrollTop;
	scrolltop=document.body.scrollTop;
	innerDiv.style.width="100%";
	innerDiv.style.height=size[3];
	//innerDiv.style.overflowY="scroll";
	//innerDiv.style.overflowX="hidden";
    //document.body.style.overflowX="hidden";
    //document.body.style.overflowY="hidden";
    innerDiv.onclick=function(){setMinusOpacity(div.id,'8');innerDiv.style.display='none';document.body.style.overflowX="hidden"; document.body.style.overflowY="scroll"; maindiv=document.getElementById('mainDiv');};
    innerDiv.style.display='block';
}

function setPlusOpacity(id, value, step){
	obj=document.getElementById(id);
	if (value>step){
		step++;
		window.setTimeout('setPlusOpacity(\''+id+'\','+value+','+step+')',30);
		obj.style.opacity = step/10;
		obj.style.filter = 'alpha(opacity=' + step*10 + ')';
	}
}

function setMinusOpacity(id,value,step){
	obj=document.getElementById(id);
	if (step==null){
		step=value;
	}
	if (step!=0){
		obj.style.opacity = step/10;
		obj.style.filter = 'alpha(opacity=' + step*10 + ')';
		step--;
		reqTimeout = setTimeout("setMinusOpacity('"+obj.id+"',"+value+","+step+");", 50);
	}else{
		obj.style.display='none';
	}
}


function loadXMLDoc(url, target_id) {
	regtarget=document.getElementById(target_id);
	if(window.XMLHttpRequest) {
		req = new XMLHttpRequest();
	} else if(window.ActiveXObject) {
		req = new ActiveXObject("Microsoft.XMLHTTP");
	}
    if (req){
        req.open("GET", url, false);
        req.send(null);
        reqTimeout = setTimeout("processReqChange();", 10);
    }
}

function processReqChange() {
    if (req.readyState == 4) {
    	clearTimeout(reqTimeout);
        if (req.status == 200) {
            regtarget.innerHTML = req.responseText;
        }else{
        	alert('Не удалось подключиться к серверу!');
        }
    }else{
    	reqTimeout = setTimeout("processReqChange();", 10);
    }
}

var opened=new Array();
function getInfoContent(id,mod){
obj=document.getElementById(id);
obj.style.display='block';
	if(opened[id]!=1){
		obj.innerHTML='<table cellspacing=0 cellpadding=0 width=100% height=100% bgcolor=#ffffff><tr><td align=center><img src="/images/loader.gif"></td></tr></table>';
		loadXMLDoc('/ajax.php?show='+mod+'&id='+id,id);
		opened[id]=1;
	}
}
function  getPageSize(){
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else if (document.documentElement && document.documentElement.scrollHeight > document.documentElement.offsetHeight){ // Explorer 6 strict mode
		xScroll = document.documentElement.scrollWidth;
		yScroll = document.documentElement.scrollHeight;
	} else { // Explorer Mac...would also work in Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}

	var windowWidth, windowHeight;
	if (self.innerHeight) { // all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}

	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else {
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}

	return [pageWidth,pageHeight,windowWidth,windowHeight];
}
function GetImg(id){
	var obj1
	obj1=document.getElementById('photo');
	obj1.innerHTML='<table cellspacing=0 cellpadding=0 width=100% height=100% bgcolor=#ffffff><tr><td align=center><img src="/images/loader.gif"></td></tr></table>';
	obj1.innerHTML='<a href=# onclick="getInfo('+id+',\'photo\');return(false);"><img id=photo src="image.php?src=images/interiors/'+id+'_480x480_1.jpg" style="border:solid 1px #bdc8ae">';
}