//var path = document.location.pathname;

var path = document.location.pathname;
var dir = path.substr(path.indexOf('/', 0), path.lastIndexOf('/'));

function FWFindLayer(lay)
{
	if (lay)
	{
		if (document.layers) 
			return document[lay];
		else if (document.getElementById)
			return document.getElementById(lay).style;
		else if (document.all) 
			return document.all[lay].style;
	}
	return null;
}


function FWShowHideLayerFade(lay, vis, ch)
{
	if (ch && lay != "") 
	{
		vis = (vis) ? "visible" : "hidden";
		var obj = FWFindLayer(lay);
		if (obj && obj.visibility != vis) 
		{
			if(vis == "visible")
			{
				obj.visibility = vis;
				new Effect.Appear(lay, {duration:0.5, delay:null});
			}
			else
			{
				new Effect.Fade(lay, {duration:0.5, delay:null, afterFinish:function(){obj.visibility = vis}});
			}
		} 
	}
}


function FWStripFileFromFilterString(filterString)
{
	var start,end;
	var strSrc = "src='";
	var strRes = "";

	start = filterString.indexOf(strSrc);

	if(start != -1)
	{
		start += strSrc.length;
		
		end = filterString.indexOf("',",start);
		if(end != -1)
		{
			strRes = filterString.substring(start,end);
		}
	}

	return strRes;
}


var fwIsNetscape = navigator.appName == 'Netscape';


fwLoad = new Object;
function FWLoad(image)
{
	if (!document.images)
		return null;
	if (!fwLoad[image])
	{
		fwLoad[image]=new Image;
		fwLoad[image].src=image;
	}
	return fwLoad[image].src;
}


fwRestore = new Object;
function FWRestore(msg,chain) 
{
	if (document.images) 
		for (var i in fwRestore)
		{
			var r = fwRestore[i];
			if (r && (!chain || r.chain==chain) && r.msg==msg)
			{
				r.src = FWLoad(r.old);
				fwRestore[i]=null;
			}
		}
}


function FWLSwap(name,msg,newImg,layer,chain,trigger) 
{
	var r = fwRestore[name];
	if (document.images && (!r || r.msg < msg)) 
	{
		var uselayers = fwIsNetscape && document.layers && layer != '';
		var hld;
		if (uselayers)
			hld = document.layers[layer].document;
		else
			hld = document;

	}
}


function FWCallHit(func,targNum,msg)
{
	if(func)
		for (var i in func)
			func[i](targNum,msg);
}
function FW_Hit(frameset,chain,targNum,msg)
{
	if (frameset && frameset.length)
		for (var i=0 ; i <frameset.length ; i++)
		{
			try
			{
				FW_Hit(frameset[i].frames,chain,targNum,msg);
				FWCallHit(top["FT_"+chain],targNum,msg);
				FWCallHit(frameset[i].window["FT_"+chain],targNum,msg);
			}
			catch(err)
			{
			}
		}
	else
		FWCallHit(window["FT_"+chain],targNum,msg);
}


fwHit = new Object;
function FWSlave(frameset,chain,targNum,msg)
{
	if (msg==1) fwHit[chain]=targNum;
	FW_Hit(frameset,chain,targNum,1);
}

function FWSRestore(frameset,chain)
{
	var hit=fwHit[chain];
	if (hit)
		FW_Hit(frameset,chain,hit,0);
	fwHit[chain]=null;
}

function FWPreload()
{
	FWLoad("XCLAIM_ROOT_DIR+'Resources/index1.jpeg");
}
document.write("<style type=\"text/css\">");
document.write("#popup  { -moz-opacity: .999999;overflow:visible;z-index:100; }");
document.write(".style2 { text-align:center; margin-top:0px; margin-bottom:0.1px;z-index:10; }");
document.write("<\/style>");


//<![CDATA[
var usingIEFix = false;
//]]></script>

//<![CDATA[
usingIEFix = true;
//]]></script>


document.write('<div id="popup" style="position:fixed; left:0px; top:0px; right:0px; bottom:-1px;  background-image:url('+XCLAIM_ROOT_DIR+'Resources/80_black.png); overflow:hidden;z-index:1000000; display:none;">');
document.write('<div class="style2">&nbsp;</div>');
document.write('<div class="style2"><a href="javascript:void(0);" onclick="FWSlave(top.frames,\'Indigo\',0,-1);"><img src="'+XCLAIM_ROOT_DIR+'Resources/top_stripe_silver.png" border="0" width="857" height="50" alt="" style="vertical-align:baseline"/></a></div>');
document.write('<div  id="popup_frame"  class="style2"><iframe name="custom_iframe" id="custom_iframe" frameborder="0" scrolling="auto"></iframe></div>');
document.write('</div>');

var offset_before = document.viewport.getScrollOffsets() 
var TOPY = offset_before.top; 

window.onscroll = scrollEvent;
function scrollEvent() {
  
  if (document.getElementById ('popup').style.display  == ""){
  window.scrollTo(0,TOPY);
  }

  if (document.getElementById ('popup_mapa').style.display  == ""){
  window.scrollTo(0,TOPY);
  }
 
//   alert(document.getElementById ('popup_mapa').style.display ); 

}

function FWImage_Indigo(chain,msg)
{
	if (chain==1)
		FWShowHideLayerFade("popup",msg,msg);
	else 
		FWShowHideLayerFade("popup",!msg,msg);
}
window.FT_Indigo=new Object;
window.FT_Indigo['0']=FWImage_Indigo;




function custom_modal_iframe (src, width, height,swap_1, swap_2, swap_3)
{

  document.getElementById ('custom_iframe').width  = width ;
  document.getElementById ('custom_iframe').height  = height ;
  document.getElementById ('custom_iframe').src  = src ;
  setTimeout('FWRestore(2,\'Indigo\');FWSlave(top.frames,\'Indigo\',1,2);FWLSwap(\'item1'+swap_1+'\',2,\''+swap_3+'\',\'item1\',\'Indigo\',1)',0);

TOPY = document.viewport.getScrollOffsets().top; 

}
