function addFlash(_src,_w,_h){
	var novoHtml = '';
 	novoHtml += '  <OBJECT height="'+_h+'" width="'+_w+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
	novoHtml += '  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ';
	novoHtml += '  wmode="transparent" ALIGN="">';
	novoHtml += '    <PARAM NAME="movie"   VALUE="'+_src+'">';
	novoHtml += '    <PARAM NAME="quality" VALUE="high">';
	novoHtml += '    <PARAM NAME="wmode"   VALUE="transparent">';
	novoHtml += '    <PARAM NAME="bgcolor" VALUE="#FFFFFF">';
	novoHtml += '    <EMBED wmode="transparent" src="'+_src+'" pluginspage="http://www.macromedia.com/go/getflashplayer" height="'+_h+'" width="'+_w+'"></EMBED>';
	novoHtml += '  </OBJECT>';
  document.write(novoHtml);
}




function getfileextension(inputId) { 
	var fileinput = inputId; 
	if (!fileinput ) { return ""; }
	else {
		if (fileinput.length == 0) { return ""; }
		else {
			var dot = fileinput.lastIndexOf("."); 
			if (dot == -1 ) { return ""; }
			else {
				var extension = fileinput.substr(dot,fileinput.length); 
				return extension; 
			}
		}
	}
}


function renderBanner2(input, link, width, height) {
	if (getfileextension(input) == '.swf') { addFlash(input, width, height); } 
	else { document.write('<a href="'+link+'"><img src="'+input+'" width="'+width+'" height="'+height+'" /></a>'); }
}

function renderBanner3(input, link, width, height) {
	if (getfileextension(input) == '.swf') { addFlash(input, width, height); } 
	else { document.write('<a href="'+link+'" target="_blank"><img src="'+input+'" width="'+width+'" height="'+height+'" /></a>'); }
}


function fncEsconderBanner()
{
  document.getElementById("bannerzao").style.display = 'none';
}

function open_center(url, name, params, Wwidth, Wheight) {
    Swidth = screen.width;
    Sheight = screen.height;

    Wleft = Math.floor((Swidth / 2) - (Wwidth / 2) - 8);
    Wtop = Math.floor((Sheight / 2) - (Wheight / 2) - 20);

    params = params+",left="+Wleft+",top="+Wtop+",width="+Wwidth+",height="+Wheight;

    window.open(url, name, params);
}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function URLDecode(txtEncoded) {
   // Replace + with ' '
   // Replace %xx with equivalent character
   // Put [ERROR] in output if %xx is invalid.
   var HEXCHARS = "0123456789ABCDEFabcdef";
   var plaintext = "";
   var i = 0;
   if (txtEncoded > '') {
     while (i < txtEncoded.length) {
         var ch = txtEncoded.charAt(i);
  	   if (ch == "+") {
  	       plaintext += " ";
  		   i++;
  	   } else if (ch == "%") {
  			if (i < (txtEncoded.length-2)
  					&& HEXCHARS.indexOf(txtEncoded.charAt(i+1)) != -1
  					&& HEXCHARS.indexOf(txtEncoded.charAt(i+2)) != -1 ) {
  				plaintext += unescape( txtEncoded.substr(i,3) );
  				i += 3;
  			} else {
  				alert( 'Bad escape combination near ...' + txtEncoded.substr(i) );
  				plaintext += "%[ERROR]";
  				i++;
  			}
  		} else {
  		   plaintext += ch;
  		   i++;
  		}
  	} // while
  }
  return plaintext;
};

function GetQueryString(strParam) {
  hu = window.location.search.substring(1);

  gy = hu.split("&");

  for (i=0;i<gy.length;i++) {
    ft = gy[i].split("=");
    if (ft[0] == strParam) {
      return ft[1];
    }
  }
}

function addFav(){
    var url      = "http://www.famem.org.br";
    var title    = "FAMEM - Federação dos Municípios do Estado do Maranhão";
    if (window.sidebar) window.sidebar.addPanel(title, url,"");
    else if(window.opera && window.print){
        var mbm = document.createElement('a');
        mbm.setAttribute('rel','sidebar');
        mbm.setAttribute('href',url);
        mbm.setAttribute('title',title);
        mbm.click();
    }
    else if(document.all){window.external.AddFavorite(url, title);}
}

window.addEvent('domready',function(){
	var nS1 = new noobSlide({
		box: $('links2slide'),
		mode: 'vertical',
		interval: 10000,
		items: [0,1],
		size: 330,
		autoPlay: true,
		addButtons: {
			previous: $('prev1'),
			next: $('next1')
		}
	});
	
	var nS2 = new noobSlide({
		box: $('slide2rotate'),
		items: $$('#slide2rotate a'),
		size: 480,
		interval: 10000,
		autoPlay: true,
		handles: $$('#selectnews li'),
		onWalk: function(currentItem,currentHandle){
			this.handles.removeClass('active');
			currentHandle.addClass('active');
		}
	});
	
	var nS3 = new noobSlide({
		box: $('links3slide'),
		items: $$('#links3slide span'),
		size: 90,
		interval: 20000,
		mode: 'vertical',
		autoPlay: true,
		handles: $$('#selectlink li'),
		onWalk: function(currentItem,currentHandle){
			this.handles.removeClass('active');
			currentHandle.addClass('active');
		}
	});
	
	var nS4 = new noobSlide({
		box: $('slidegaleria'),
		items: [0,1,2,3],
		size: 190,
		addButtons: {
			previous: $('prev2'),
			next: $('next2')
		}
	});
	
	var nS5 = new noobSlide({
		box: $('syslide'),
		items: [0,1],
		size: 725,
		interval: 20000,
		autoPlay: true,
		addButtons: {
			previous: $('prev3'),
			next: $('next3')
		}
	});
	
	var nS6 = new noobSlide({
		box: $('obslide'),
		mode: 'vertical',
		interval: 5000,
		items: [0,1,2],
		size: 50,
		autoPlay: true,
		addButtons: {

		}
	});
	
	var nS6 = new noobSlide({
		box: $('conslide'),
		mode: 'vertical',
		interval: 5000,
		items: [0,1,2],
		size: 50,
		autoPlay: true,
		addButtons: {

		}
	});
	
	var nS6 = new noobSlide({
		box: $('slide2dest'),
		interval: 10000,
		items: [0,1,2],
		size: 270,
		autoPlay: true,
		addButtons: {
			previous: $('prevdest'),
			next: $('nextdest')
		}
	});
	
	var nS666 = new noobSlide({
		box: $('slidesix'),
		//mode: 'vertical',
		interval: 10000,
		items: $$('#slidesix a'),
		size: 190,
		autoPlay: true,
		addButtons: {
			previous: $('prevsix'),
			next: $('nextsix')
		}
	});
	

	
	
});

