window.defaultUrl = ""

$(function(){
	
	if(!empty(s = $(document).find("SCRIPT")))
	{
		window.defaultUrl = s.attr("src").split("js/")[0];
	}
	
	$("#flash-principal").flash({
		id: "flashcontent",
		src: $.url(true) + "main.swf",
		width: "100%",
		height: "100%",
		scale: "noscale",
		wmode: "opaque",
		allowscriptaccess: "always",
		allowfullscreen: "true",
		variables: {
			siteXML: $.url(true) + "xml/site.xml",
			link_NOTICIAS: $.url() + "noticias",
			link_CONTATO: $.url() + "contato",
			link_EXTRANET: $.url() + "extranet_usuarios"
		}
	});
	
});

function ampliar(src, legenda)
{
	var test = window.open($.url(true) + "ampliar.php?src=" + src, "aw", "width=250, height=250,resizable=yes, status");
	if(!teste || teste == undefined)
	{
		alert("Desative seu bloqueador de pop-ups");
	}
}

$.url = function(webroot)
{
	if(!webroot)
	{
		if(window.defaultUrl.indexOf(($ext="app")) > -1)
		{
			$url = window.defaultUrl.split($ext);
			return $url[0] + "index.php?/";
		}
		
		return window.defaultUrl;
	}
	else
	{
		return window.defaultUrl;
	}
}