// Este codigo pega a url e separa os parametros
var opiCssUrl,opiUrlContentView,opiTargetLink,opiTargetLinkUrl,opiParameters,opiEsconder,opiExibir;
var opiIframeWidth,opiIframeHeight,opiMapaWidthHeight,filtroListagem;

opiUrl =  document.location.toString();
opiKey = /\?/i;   
opiStart = opiUrl.search(opiKey); 
if(opiStart>1&&opiUrl.substring(opiStart+1).search("=")>1)
{   
	opiUrl = opiUrl.substring(opiStart+1);   
	opiArrVar = opiUrl.split("&");
	for (i=0;i<opiArrVar.length;i++)
	{
		
		opiExpr= opiArrVar[i].split("=");
		// se vier na URL sobrescreve o opiUrlContentView para permitir navegação em paginas diferentes
		if (opiExpr[0] == 'opiUrlContentView') {
			eval ('var '+opiExpr[0]+' = \''+opiExpr[1]+'\';');
		}
	}
}

// pega a pagina referrer
opiReferrer = encodeURIComponent(document.URL);

//opiExibeMapa='+opiExibeMapa+'&opiExibeDescricao='+opiExibeDescricao+'&opiExibeComentarios='+opiExibeComentarios
if (opiIframeWidth==undefined || opiIframeWidth=='')
	opiIframeWidth='600';

if (opiIframeHeight==undefined || opiIframeHeight =='')
	opiIframeHeight = '900';
	
opiMapaWidthHeight = (opiIframeWidth+'x'+opiIframeHeight);
opiParameters="opiReferrer="+opiReferrer+"&opiIframeWidth="+opiIframeWidth+"&opiIframeHeight="+opiIframeHeight+"&opiCssUrl="+opiCssUrl+"&opiTargetLink="+opiTargetLink+"&opiUrlContentView="+encodeURIComponent(opiUrlContentView)+"&opiTargetLinkUrl="+encodeURIComponent(opiTargetLinkUrl)+"&opiEsconder="+opiEsconder+"&opiExibir="+opiExibir+"&opiMapaWidthHeight="+opiMapaWidthHeight+"&filtroListagem="+filtroListagem;


//opiLocationHostname = '201.6.123.131:83';
opiLocationHostname = '192.168.0.200:83';
opiLocationHostname = 'www.webrun.com.br';


//opiReferrer = window.location.hostname;
document.write('<iframe src="http://'+opiLocationHostname+'/webservices/ondepraticar/api.htm?'+opiParameters+'" width="'+opiIframeWidth+'" height="'+(opiIframeHeight)+'" frameborder="0" scrolling="auto" name="opiIframe"></iframe>');

// zera as variaveis passadas pelo usuario
opiEsconder = undefined;
opiExibir = undefined;
opiCssUrl = undefined;
filtroListagem =  undefined;
opiIframeWidth = undefined; // largura do iframe do mapa
opiIframeHeight =  undefined; // altura do iframe do mapa
opiUrlContentView =  undefined; // define se a pagina deve abrir direto em um mapa específico
opiTargetLink =  undefined; //blank ou top ou nomeJanela // define qual target será usado ao clicar na listagem de mapas encontradas
opiTargetLinkUrl =  undefined; // define qual o link da pagina que será direcionado ao clicar na listagem de mapas encontradas

