
window.onload = loading;


var flashlink, flashglass, flashimg;

var is_scheme = 0;
function loading()
{


	flashglass = document.getElementById('flashglass');
	flashlink = document.getElementById('flashlink');
	flashlink.style.visibility = 'visible';
	flashlink.onclick = flash_click;
	
	
	flashimg = document.getElementById('flashimg');
	flashimg.onmouseover = img_over;
	flashimg.onmouseout = img_out;
	
	
	if (is_scheme == true) 
	{
		init_scheme();

	}
}


function img_over()
{
	isrc = this.src;
	isrc = str_replace('.jpg', '_over.jpg', isrc);
	this.src = isrc;
}

function img_out()
{
	isrc = this.src;
	isrc = str_replace('_over.jpg', '.jpg', isrc);
	this.src = isrc;
}


function link_over()
{
	this.style.color = '#036488';
	this.style.textDecoration = 'none';
}

function link_out()
{
	this.style.color = '#00aeef';
	this.style.textDecoration = 'underline';
}

function flash_click()
{

	var flashclose = document.getElementById('flashclose');
	flashclose.onclick = flashcloseclick;
	flashclose.onmouseover = link_over;
	flashclose.onmouseout = link_out;

	var flashvars = {};
	var params = {};
	var attributes = {
		loop: "false",
		bgcolor: "#ffffff",
		wmode: "opaque"
	};


	swfobject.embedSWF("ModuleLoader.swf?xml=PanoSalado.xml", "fullflashcontent", "800px", "600px", "10.0.0", flashvars, params, attributes);
	
	
	//var so = new SWFObject("ModuleLoader.swf?xml=PanoSalado.xml", "pano", "800px", "600px", "9", "#ffffff"); 	
	//so.addParam("allowFullScreen","true");
	//so.addParam("allowScriptAccess","sameDomain");
	//so.write("fullflashcontent");

	asizes = getDocumentSize();
	flashglass.style.width = gu(asizes[0]);
	flashglass.style.height = gu(asizes[1]);
	
	acenter = clientCenter();
	var flashblock = document.getElementById('flashblock');
	flashblock.style.display = 'inline';
	
	flashblock.style.left = String(acenter[0] - parseInt(900/2)) + "px";
	flashblock.style.top = String(acenter[1] - 300) + "px";
	
	
	
	flashglass.style.display = 'block';
}

function flashcloseclick()
{
	flashglass.style.display = 'none';
}




function str_replace(search, replace, subject) 
{
	return subject.split(search).join(replace);
}

function closeClick()
{
	img_div.style.display = 'none';
}

function createBack()
{
	if(this.Glass==null)
	{
		this.Glass=document.createElement('DIV');
		this.Glass.id ='img_div';
		with(this.Glass.style)
		{
			display='none'; position='absolute'; height=0; width=0; zIndex=1;
			//if(this.isIE)
			{
				backgroundColor = '#000';
				filter="progid:DXImageTransform.Microsoft.Alpha(Opacity=60, Style=0)";
			}
			//else backgroundImage = 'url('+this.Dir+'alfa40.png)';
		}
		document.body.appendChild(this.Glass);
	}
	
	var sizes = this.getDocumentSize();
	with(this.Glass.style)
	{
		left = 0; top = 0;
		width = gu(sizes[0]);
		height = gu(sizes[1]);
	}
	
	//this.Glass.style.display = show ? 'block' : 'none';
}


function getClientSize(){
	var w = 0;
	var h = 0;
	if(document.compatMode=='CSS1Compat'/* && !window.opera*/){
		w = document.documentElement.clientWidth;
		h = document.documentElement.clientHeight;
	}
	else{
		w = document.body.clientWidth;
		h = document.body.clientHeight;
	}
	return [w, h];
}

function getDocumentSize()
{
	var w = document.body.scrollWidth > document.body.offsetWidth ? document.body.scrollWidth : document.body.scrollWidth;
	var h = document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight;
	return [w, h];
}

function getDocumentScroll()
{
	var l = self.pageXOffset || (document.documentElement && document.documentElement.scrollLeft) || (document.body && document.body.scrollLeft);
	var t = self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop);
	return [l, t];
}

function clientCenter()
{
	var sizes = getClientSize();
	var scroll = getDocumentScroll();

	
	
	x = parseInt(sizes[0]/2)+scroll[0];
	y = parseInt(sizes[1]/2)+scroll[1];

	return [x, y];
}


function gu(num)
{ 
	return parseInt(num)+'px'; 
}
	


