function fade_in(div){
	document.getElementById('black_bg').style.height = sizes(1) + 'px';
	new Effect.Appear('black_bg',{from:0.0,to:0.60});
	setTimeout('show_div("' + div + '")', 300);
}

function fade_out(div){
	var obj = document.getElementById(div);
	obj.style.display = 'none';
	new Effect.Fade('black_bg',{from:0.60,to:0.0});
}

function show_div(div){
	var obj = document.getElementById(div);
	obj.style.top = 75 + scrollOffset() + 'px';
	obj.style.display = 'block';
	add_sifr();
}

function add_sifr(){
	sIFR.replace({
		selector: 'h1',
		src: 'swf/sifr.swf',
		highsrc: 'swf/sifr.swf',
		wmode: 'transparent',
		forceSingleLine: true,
		css: {
			'.sIFR-root' : { 'color': '#fefefe', 'font-size': '20px' }
		}
	});
}

function sizes(type){
	if( window.innerHeight && window.scrollMaxY ) // Firefox 
	{
		pageWidth = window.innerWidth + window.scrollMaxX;
		pageHeight = window.innerHeight + window.scrollMaxY;
	}
	else {
		if( document.body.scrollHeight > document.body.offsetHeight ) // all but Explorer Mac
		{
		pageWidth = document.body.scrollWidth;
		pageHeight = document.body.scrollHeight;
		}
		else // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		{ pageWidth = document.body.offsetWidth + document.body.offsetLeft; 
		  pageHeight = document.body.offsetHeight + document.body.offsetTop; 
		}
	}
	
	if(type==0)
		return pageWidth;
	else
		return pageHeight;
}

function scrollOffset(){
	var x,y;
	
	if (self.pageYOffset) // all except Explorer
	{
		x = self.pageXOffset;
		y = self.pageYOffset;
	}
	else if (document.documentElement && document.documentElement.scrollTop)
		// Explorer 6 Strict
	{
		x = document.documentElement.scrollLeft;
		y = document.documentElement.scrollTop;
	}
	else if (document.body) // all other Explorers
	{
		x = document.body.scrollLeft;
		y = document.body.scrollTop;
	}	
	
	return y;
}

// BIDDING PROJECTS
function fade_in_form(div, proj_name){
	document.getElementById('black_bg').style.height = sizes(1) + 'px';
	new Effect.Appear('black_bg',{from:0.0,to:0.60});
	setTimeout('show_form("' + div + '", "' + proj_name + '")', 300);
}

function show_form(div, name){
	var obj = document.getElementById(div);
	obj.style.top = 75 + scrollOffset() + 'px';
	obj.style.display = 'block';
	document.bid_form.project_name.value = name;
	add_sifr();
}
