/*
html = 
<script>
carregaflash("{$SITE_ABSURL}imagens/flash.swf", 750, 155, "http", "yes", "cabecalho");
</script>
*/

function trim(str) { 
	return str.replace(/^\s+|\s+$/, ''); 
}
function RetornaValorCSS(strRGB){
	strRGB = strRGB.replace("rgb(", "")
	strRGB = strRGB.replace(")","")
	var arrValor = strRGB.split(",");
	var strRetorno = "#";
	for (i=0;i<arrValor.length;i++){
		strRetorno += dec2hex(parseFloat(trim(arrValor[i])));
	}
	return strRetorno;
}
function dec2hex(n){
	var hex = "0123456789ABCDEF";
	var mask = 0xf;
	var retstr = "";
	while(n != 0) {
		retstr = hex.charAt(n&mask) + retstr;
		n >>>= 4;
	}
	return retstr.length == 0 ? "00" : retstr;
}
function carregaflash(arquivo, largura, altura, protocolo, semCache, divId){
    var strAntiCache;
	var dtmData;
	var strObject;
	
	dtmData = new Date();
	strAntiCache = dtmData.getDate()+ '' +dtmData.getMonth()+ '' +dtmData.getYear()+ '' +dtmData.getHours()+ '' +dtmData.getMinutes()+ '' +dtmData.getSeconds();
	
	if( protocolo == null || protocolo == '' ){
		protocolo = "http://";
	}
	
	if( semCache != null && semCache != '' ){
		if(arquivo.indexOf('?') == -1)
			arquivo+='?antiCache='+strAntiCache;
		else
			arquivo+='&antiCache='+strAntiCache;
	}
	
	protocolo = protocolo.toLowerCase();
	
	strObject = '<OBJECT classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="' + protocolo + 'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=	,0,0,0" WIDTH="' + largura + '" HEIGHT="' + altura + '" ALIGN="middle"><PARAM NAME=movie VALUE="' + arquivo +'"><PARAM NAME=loop VALUE=false><PARAM NAME=quality VALUE=best><PARAM NAME=wmode VALUE=transparent><PARAM NAME=wmode VALUE=transparent><PARAM NAME=bgcolor VALUE=#FFFFFF><EMBED src="' + arquivo + '" quality="best" bgcolor="#FFFFFF" wmode="transparent" WIDTH="' + largura + '" HEIGHT="' + altura + '" ALIGN="middle" ALLOWSCRIPTACCESS="sameDomain" TYPE="application/x-shockwave-flash" PLUGINSPAGE="' + protocolo + 'www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>';
	
	if(divId == null || divId == ''){
	    document.write(strObject);
	}else{
	    document.getElementById(divId).innerHTML = strObject;
	}
}
