//Script gerais CMP - Data 23/02/2010 - 10:30:35
/**
 * @author Guilherme Armin - Círculo Militar do Paraná
 * 
 */
function openRunSwf(id,url,width,height,quality,scale,menu,wmode)
	{
		var classid = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
		var codebase = 'http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=6,0,40,0';
    	var nk = '    ';
		var getFlashA = 'http:\/\/www.macromedia.com\/go\/getflashplayer';
    	var type = 'application\/x-shockwave-flash'
		
		var line1 = '\n<object classid=\"'+classid+'\" id=\"'+id+'\" codebase=\"'+codebase+'\" border=\"0\" width=\"'+width+'px\" height=\"'+height+'px\"'+id+'>' + '\n';
		var line2 = nk + '<param name=\"movie\" value=\"'+url+'\" \/>' + '\n';
		var line3 = nk + '<param name=\"quality\" value=\"'+quality+'\" \/>' + '\n';
		var line4 = nk + '<param name=\"menu\" value=\"'+menu+'\" \/>' + '\n';
		var line5 = nk + '<param name=\"scale\" value=\"'+scale+'\" \/>' + '\n';
		var line6 = nk + '<param name=\"wmode\" value=\"'+wmode+'\" \/>' + '\n';
		var line7 = nk + '<embed src=\"'+url+'\" pluginspage=\"'+getFlashA+'\" type=\"'+type+'\" name=\"'+id+'\" width=\"'+width+'px\" height=\"'+height+' quality=\"'+quality+'\" menu=\"'+menu+'\" wmode=\"'+wmode+'\"><\/object>' + '\n';
		
		this.flash = line1+line2+line3+line4+line5+line6+line7;
	}

function iFrameMake(id,src,width,height,msg)
	{
		line1='\n<iframe id\"'+id+'\" name=\"'+id+'\" src=\"'+src+'\" style=\"width: '+width+'px; height: '+height+'px;\" marginwidth=\"0\" marginheight=\"0\" border=\"0\" frameborder=\"0\">' + '\n';
		line2=msg + '\n';
		line3='<\/iframe>';
		this.struct=line1+line2+line3;
	}

function mostra(camada)
	{
		try {
		$('#'+camada).css('visibility','visible');
		$('#'+camada).css('display','');
		} catch(err1) {}
		try {
		document.getElementById(camada).style.visibility='visible';
		document.getElementById(camada).style.display='';
		} catch(err2) {}
	}
	
function esconde(camada)
	{
		try {
		$('#'+camada).css('visibility','hidden');
		$('#'+camada).css('display','none');
		} catch(err1) {}
		try {
		document.getElementById(camada).style.visibility='hidden';
		document.getElementById(camada).style.display='none';
		} catch(err2) {}
	}

function muda(some,aparece)
	{
		//if (some == "content")
		//{
			//$("#pop").height($(window).height() - 30);
			//$("body").css("overflow-y", "hidden");
		//}
		//else if (some == "popup")
		//{
			//$("body").css("overflow-y", "auto");
		//}
		try {
		$('#'+some).css('visibility','hidden');
		$('#'+some).css('display','none');
		$('#'+aparece).css('visibility','visible');
		$('#'+aparece).css('display','');
		} catch(err1) {}
		try {
		document.getElementById(some).style.visibility='hidden';
		document.getElementById(some).style.display='none';
		document.getElementById(aparece).style.visibility='visible';
		document.getElementById(aparece).style.display='';
		} catch(err2) {}
	}
	
function altera(tabela)
	{
		try {
		$('#'+nomemenu).css('display','none');
		$('#'+tabela).css('display','');
		} catch(err1) {}
		try {
		document.getElementById(nomemenu).style.display='none';
		document.getElementById(tabela).style.display='';
		} catch(err2) {}
		nomemenu = tabela;
	}
	
function addContentById(jQueryId,content)
	{
		try {
		$(jQueryId).html(content);
		} catch(err1) {}
		try {
		if (jQueryId == "#scDiv")
			{document.getElementById("scDiv").innerHTML=content;}
		else if (jQueryId == "#suDiv")
			{document.getElementById("suDiv").innerHTML=content;}
		} catch(err2) {}
	}

function abreJanela(url, titulo, width, height, top, left, scrollbarsYesNo)
	{
		janelaParametros='toolbar=no,location=no,status=no,menubar=no,scrollbars=' + scrollbarsYesNo + ',resizable=no,width=' + width + ',height=' + height;
		window.open(url,titulo,janelaParametros);
	}

function detectBrowser() //Função completa para detectar browser
	{
		var nVer = navigator.appVersion;
		var nAgt = navigator.userAgent;
		var browserName  = navigator.appName;
		var fullVersion  = ''+parseFloat(navigator.appVersion); 
		var majorVersion = parseInt(navigator.appVersion,10);
		var nameOffset,verOffset,ix;

		// In MSIE, the true version is after "MSIE" in userAgent
		if ((verOffset=nAgt.indexOf("MSIE"))!=-1) {
		 browserName = "Microsoft Internet Explorer";
		 fullVersion = nAgt.substring(verOffset+5);
		}
		// In Opera, the true version is after "Opera" 
		else if ((verOffset=nAgt.indexOf("Opera"))!=-1) {
		 browserName = "Opera";
		 fullVersion = nAgt.substring(verOffset+6);
		}
		// In Chrome, the true version is after "Chrome" 
		else if ((verOffset=nAgt.indexOf("Chrome"))!=-1) {
		 browserName = "Chrome";
		 fullVersion = nAgt.substring(verOffset+7);
		}
		// In Safari, the true version is after "Safari" 
		else if ((verOffset=nAgt.indexOf("Safari"))!=-1) {
		 browserName = "Safari";
		 fullVersion = nAgt.substring(verOffset+7);
		}
		// In Firefox, the true version is after "Firefox" 
		else if ((verOffset=nAgt.indexOf("Firefox"))!=-1) {
		 browserName = "Firefox";
		 fullVersion = nAgt.substring(verOffset+8);
		}
		// In most other browsers, "name/version" is at the end of userAgent 
		else if ( (nameOffset=nAgt.lastIndexOf(' ')+1) < (verOffset=nAgt.lastIndexOf('/')) ) 
		{
		 browserName = nAgt.substring(nameOffset,verOffset);
		 fullVersion = nAgt.substring(verOffset+1);
		 if (browserName.toLowerCase()==browserName.toUpperCase()) {
		  browserName = navigator.appName;
		 }
		}
		// trim the fullVersion string at semicolon/space if present
		if ((ix=fullVersion.indexOf(";"))!=-1) fullVersion=fullVersion.substring(0,ix);
		if ((ix=fullVersion.indexOf(" "))!=-1) fullVersion=fullVersion.substring(0,ix);

		majorVersion = parseInt(''+fullVersion,10);
		if (isNaN(majorVersion)) {
		 fullVersion  = ''+parseFloat(navigator.appVersion); 
		 majorVersion = parseInt(navigator.appVersion,10);
		}

		//document.write('Browser name  = '+browserName+'<br>');
		//document.write('Full version  = '+fullVersion+'<br>');
		//document.write('Major version = '+majorVersion+'<br>');
		//document.write('navigator.appName = '+navigator.appName+'<br>');
		//document.write('navigator.userAgent = '+navigator.userAgent+'<br>');
	}
