// URL BASE

var URL_BASE = location.protocol + '//' + location.host + '/';
		if(location.host == 'www'){
			var pos = location.pathname.indexOf('/', 1);
			URL_BASE += location.pathname.substr(1, pos);
		}else{
			URL_BASE += "";
}

// TARGET VÁLIDO

function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "externo")
     anchor.target = "_blank";
 }
}
window.onload = externalLinks;

jQuery(document).ready(function(){
								
// PRINT FLASH CABEÇALHO

	$('div#cabecalho').media({ 
		width: '100%',
		height: 300,
		autoplay: true,
		src: URL_BASE + 'swf/topo.swf',
		flashvars: {
			'urlBase': URL_BASE + '/'
		},
		params: {
			//wmode: 'transparent',
			menu: false,
			quality: 'high',
			allowScriptAccess: 'sameDomain'
		},
		caption: false
	});
	
	$('div#servicos').media({ 
		width: 771.6,
		height: 305,
		autoplay: true,
		src: URL_BASE + 'swf/servicos.swf',
		flashvars: {
			'urlBase': URL_BASE + '/'
		},
		params: {
			wmode: 'transparent',
			menu: false,
			quality: 'high',
			allowScriptAccess: 'sameDomain'
		},
		caption: false
	});
	
	$('div.mapaSantos').media({ 
		width: 388,
		height: 262,
		autoplay: true,
		src: URL_BASE + 'swf/mapa_santos.swf',
		flashvars: {
			'urlBase': URL_BASE + '/'
		},
		params: {
			menu: false,
			quality: 'high',
			allowScriptAccess: 'sameDomain'
		},
		caption: false
	});
	
	$('div.mapaPG').media({ 
		width: 388,
		height: 262,
		autoplay: true,
		src: URL_BASE + 'swf/mapa_pg.swf',
		flashvars: {
			'urlBase': URL_BASE + '/'
		},
		params: {
			menu: false,
			quality: 'high',
			allowScriptAccess: 'sameDomain'
		},
		caption: false
	});
});