//change bullets:
function changeBullet(which, language){
	document.images[which].src="images/menu-bullets-" + language + ".gif";
}

function restoreBullet(which,fs){
	//document.images[which].src="images/menu-bullets-gen.gif";
	document.images[which].src="images/" + fs;
}

//aplicar CSS num evento:
//ex: changeCSS(this, 'cssname');
//funciona com multiclasses!
function changeCSS(obj, wichstyle) 
{
	if(wichstyle != "") 
	{ 
		o = document.getElementById(obj)
		o.className = wichstyle;
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function wopen(url, name, w, h)
{
  // Fudge factors for window decoration space.
  // In my tests these work well on all platforms & browsers.
  w += 32;
  h += 96;
  wleft = (screen.width - w) / 2;
  wtop = (screen.height - h) / 2;
  // IE5 and other old browsers might allow a window that is
  // partially offscreen or wider than the screen. Fix that.
  // (Newer browsers fix this for us, but let's be thorough.)
  if (wleft < 0) {
    w = screen.width;
    wleft = 0;
  }
  if (wtop < 0) {
    h = screen.height;
    wtop = 0;
  }
  var win = window.open(url,
    name,
    'width=' + w + ', height=' + h + ', ' +
    'left=' + wleft + ', top=' + wtop + ', ' +
    'location=no, menubar=no, ' +
    'status=no, toolbar=no, scrollbars=no, resizable=no');
  // Just in case width and height are ignored
  win.resizeTo(w, h);
  // Just in case left and top are ignored
  win.moveTo(wleft, wtop);
  win.focus();
}

//change main image:
//init selection:
var selectedThumb = "00";

//global com o totalThumbs:
var totalThumbsB = "1";

//global da largura:
//largura de cada thumb: (71 + separador 7px)
var individualWidth = 78;

//in the beginning, set the selected thumb:
function initThumbEngine(toWhat, totalThumbs) {
	//numero thumbs:
	totalThumbsB = totalThumbs;
	
	//se maior que 1, mostra div
	//(por defeito não mostra)
	
	//thumbsOuterHolder
	toh = document.getElementById("thumbsOuterHolder");
	//thumbsHolder
	th = document.getElementById("thumbsHolder");
	//thumbsBts
	tb = document.getElementById("thumbsBts");
	
	//cálculos:
	if(totalThumbs > 1){
		toh.style.visibility = "visible";

		if(totalThumbs > 6){
			//largura thumbsOuterHolder:
			toh.style.width = '461px';
			
			//mostrar botões:
			tb.style.visibility = "visible";
			
		} else {
			//largura thumbsOuterHolder:
			totalWidth = (individualWidth * totalThumbs) - 7; //último separador (7px)
			toh.style.width =  totalWidth + 'px';
			
			//esconder botões:
			tb.style.visibility = "hidden";
		}
			
	} else {
		toh.style.visibility = "hidden";
		
		//esconder botões:
		tb.style.visibility = "hidden";
	}

  
	selectedThumb = toWhat;
	changeMainImage(toWhat);
}

function changeMainImage(toWhat, NewImg, OldThumb)
{

	//firefox fix:
	myFrm1 = document.getElementById('myFrm');

	//alert(selectedThumb)
	//thumb change
	//current (hide the thumb image):
	document.images["thumb_"+toWhat].src="images/thumbs-invis.gif";
	
	myFrm1.myThumb.value = OldThumb;
	
	//alert("OldThumb=" + myFrm.myThumb.value + "ThumbTrans: " + myFrm.myThumbTransacao.value);
	
	
	//previously clicked:
	//apenas se não for o mesmo
	if (toWhat != selectedThumb)
	{
		//document.images["thumb_"+selectedThumb].src="images/thumbs-" + selectedThumb + ".jpg";
		//document.images["imgPlaceholder"].src="images/img-" + toWhat + ".jpg";
		document.images["thumb_"+selectedThumb].src=myFrm1.myThumbTransacao.value;
		document.images["imgPlaceholder"].src=NewImg;
		myFrm1.myThumbTransacao.value = myFrm1.myThumb.value;
		
	}

	//update the clicked var:
	selectedThumb = toWhat;
}

/*
 * Adds a function into the onload event
 * Usage: addOnLoad(functionName)
 * Or, if you need to pass arguments in the
 * function:
 * addOnLoad(function() {functionName("argument")})
 ex: addOnLoad(function() {clearfix("clearthis");});
*/
function addOnLoad(newFunction) {
    var currentOnLoad = window.onload;
    if (typeof window.onload != "function") {
        window.onload = newFunction;
    }
    else {
        window.onload = function() {
            currentOnLoad();
            newFunction();
        }
    }
}


function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

/* thumb container slide */
function P7AniMagic(el,x,y,a,b,c,s) { //v2.9 PVII-Project Seven Development
 var xx,yy,i,g,elo=el,f="",m=false,d="",pa='px';if(document.layers||window.opera){pa='';}
 
 //cálculo:
  switch (x)
  {
    case "plus":
	//ver os extra (mais de 6 thumbs):
	extraThumbs = totalThumbsB - 6;
	totalWidth = (individualWidth * extraThumbs);
     x = -totalWidth;
      break;
	  case "minus":
     x = '0';
      break;
  }
 
 x=parseInt(x);y=parseInt(y);var t='g.p7Magic=setTimeout("P7AniMagic(\''+elo+'\','; 
 if((g=MM_findObj(el))!=null){d=(document.layers)?g:g.style;}else{return;}
 if(parseInt(s)>0){eval(t+x+','+y+','+a+','+b+','+c+',0)",' + s+')');return;}
 xx=parseInt(d.left);if(isNaN(xx)){if(g.currentStyle){xx=parseInt(g.currentStyle.left);
 }else if(document.defaultView&&document.defaultView.getComputedStyle){
 xx=parseInt(document.defaultView.getComputedStyle(g,"").getPropertyValue("left"));}
 if(isNaN(xx)){xx=0;}}yy=parseInt(d.top);if(isNaN(yy)){if(g.currentStyle){yy=parseInt(g.currentStyle.top);
 }else if(document.defaultView&&document.defaultView.getComputedStyle){
 yy=parseInt(document.defaultView.getComputedStyle(g,"").getPropertyValue("top"));}
 if(isNaN(yy)){yy=0;}}if(c==1){x+=xx;y+=yy;m=true;c=0;}else if(c==2){m=false;
 if(g.p7Magic){clearTimeout(g.p7Magic);}}else{i=parseInt(a);if(g.p7Magic){clearTimeout(g.p7Magic);}
 if(xx<x){xx+=i;m=true;if(xx>x){xx=x;}}if(xx>x){xx-=i;m=true;if(xx<x){xx=x;}}
 if(yy<y){yy+=i;m=true;if(yy>y){yy=y;}}if(yy>y){yy-=i;m=true;if(yy<y){yy=y;}}}
 if(m){d.left=xx+pa;d.top=yy+pa;eval(t+x+','+y+','+a+','+b+','+c+',0)",'+b+')');}
}


//**********************
//HOMEPAGE EFFECT
/*
Script by FPMC at http://jsarchive.8m.com
Submitted to JavaScript Kit (http://javascriptkit.com)
For this and 400+ free scripts, visit http://javascriptkit.com
*/

//set image paths
src = ["images/img-01.jpg", "images/img-02.jpg", "images/img-03.jpg", "images/img-04.jpg", "images/img-05.jpg", "images/img-06.jpg"]

//set duration for each image
duration = 4;

//Please do not edit below
ads=[]; ct=0;
function switchAd() {
var n=(ct+1)%src.length;
if (ads[n] && (ads[n].complete || ads[n].complete==null)) {
document["imgPlaceholder"].src = ads[ct=n].src;
}
ads[n=(ct+1)%src.length] = new Image;
ads[n].src = src[n];
setTimeout("switchAd()",duration*1000);
}
function doLink(){
location.href = url[ct];
}