/****************************************************************************
* Carrega o banner sem o acton script
****************************************************************************/

if(Browser == undefined)
{
	var Browser = {
		isIE: function(){ return (window.ActiveXObject && document.all && navigator.userAgent.toLowerCase().indexOf("msie") > -1  && navigator.userAgent.toLowerCase().indexOf("opera") == -1) ? true : false; }
	};
}

var Flash = function(movie, id, width, height, initParams)
{
	this.html = "";
	
	this.variables = new Array();
	
	this.flashversion = (typeof initParams != "undefined" && typeof initParams.flashversion != "undefined") ? initParams.flashversion : "7,0,0,0";
	
	this.attributes = {
		"classid": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
		"codebase": "http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab#version=" + this.flashversion,
		"type": "application/x-shockwave-flash"
	};
	
	this.params = { "pluginurl": "http://www.macromedia.com/go/getflashplayer" };
	
	if(movie)
	{
		this.addAttribute("data", movie);
		this.addParameter("movie", movie);
	}
	
	if(id && id != null && (this.id = id)) 
	{
		this.addAttribute("id", this.id);
		this.addAttribute("name", this.id);
	}
	else
	{
		this.id = null;
	}
	
	if(width) this.addAttribute("width", width);
	if(height) this.addAttribute("height", height);
	
	if(initParams != undefined)
	{
		for(var i in initParams) this.addParameter(i.toString(), initParams[i]);
	}
};
Flash.version = "v1.8";

Flash.prototype.getObject = function()
{
	if(this.id == null) return null;
	try
	{
		if(window.document[this.id])
		{
			return window.document[this.id];
		}
		else
		{
			return document.getElementById(window.document[this.id]);
		}
	}
	catch(e) { return null; }
};

Flash.getObjectByExceptions = function(obj, excep)
{
	var tempObj = {};
	for(var i in obj)
	{
		var EOF = false;
		for(var j=0; j<excep.length; j++) if(excep[j] == i.toString()) { EOF = true; break; };
		if(!EOF) tempObj[i] = obj[i];
	}
	return tempObj;
};

Flash.prototype.addAttribute = function(prop, val){ this.attributes[prop] = val; };
Flash.prototype.addParameter = function(prop, val){ this.params[prop] = val; };
Flash.prototype.addVariable = function(prop, val){ this.variables.push([prop, val]); };

Flash.prototype.getFlashVars = function()
{
	for(var i=0, tempString = new Array(); i<this.variables.length; i++) tempString.push(this.variables[i].join("="));
	return tempString.join("&");
};
Flash.prototype.toString = function()
{
	this.params.flashVars = this.getFlashVars();
	if(Browser.isIE())
	{
		//IE
		this.html = "<ob" + "ject";
		var attr = Flash.getObjectByExceptions(this.attributes, ["type", "data"]);
		for(var i in attr) if(i.toString() != "extend") this.html += " " + i.toString() + " = \"" + attr[i] + "\"";
		this.html += "> ";
		var params = Flash.getObjectByExceptions(this.params, ["pluginurl", "extend"]);
		for(var i in params) if(i.toString() != "extend") this.html += "<param name=\"" + i.toString() + "\" value=\"" + params[i] + "\" /> ";
		this.html += " </obj" + "ect>";
	}
	else
	{
		//non-IE
		this.html = "<!--[if !IE]> <--> <obj" + "ect";
		var attr = Flash.getObjectByExceptions(this.attributes, ["classid", "codebase"]);
		for(var i in attr) if(i.toString() != "extend") this.html += " " + i.toString() + " = \"" + attr[i] + "\"";
		this.html += "> ";
		var params = Flash.getObjectByExceptions(this.params, ["extend"]);
		for(var i in params) if(i.toString() != "extend") this.html += "<param name=\"" + i.toString() + "\" value=\"" + params[i] + "\" /> ";
		this.html += " </obj" + "ect> <!--> <![endif]-->";
	}
	return this.html;
};
Flash.prototype.write = Flash.prototype.writeIn = function(w)
{
	if(typeof w == "string" && (w = document.getElementById(w)));
	if( w != null ) { w.innerHTML = this.toString(); }
	else if( w == undefined ) { document.write( this.toString() ); }
    	else { return false; }
};

//automatization functions...
Flash.correctAll = function()
{
	if(!/msie/.test(navigator.userAgent.toLowerCase()) || !document.getElementsByTagName) return false;
	for (var i = 0, objects = document.getElementsByTagName("OBJECT"); i < objects.length;
		(objects[i].outerHTML ? (objects[i].outerHTML = objects[i].outerHTML, objects[i].style.visibility = "visible") : null), i++);
};
Flash.automatic = function(r)
{
	if(r && window.attachEvent)
	{	
		for (var i = 0, objects = document.getElementsByTagName("OBJECT"); i < objects.length; (objects[i].style.visibility = "hidden"), i++);
		window.attachEvent("onload", Flash.correctAll);
		window.attachEvent("onunload", function(){ window.detachEvent("onload", Flash.correctAll); });
	}
	else
	{
		Flash.correctAll();
	}
};

function AbreJanela(aURL,nomeJanela,features) { 
	window.open(aURL,nomeJanela,features); 
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


		$(document).ready(function() {
			/*
			*   Examples - images
			*/

			/*$("a#modelo1").fancybox();*/
			$("a#modelo1").fancybox({
				'overlayColor'		: '#999',
			});


			$("a#modelo2").fancybox({
				'overlayShow'	: false,
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic'
			});

			$("a#modelo3").fancybox({
				'transitionIn'	: 'none',
				'transitionOut'	: 'none'	
			});

			$("a#modelo4").fancybox({
				'opacity'		: true,
				'overlayShow'	: false,
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'none'
			});

			$("a#modelo5").fancybox();

			$("a#modelo6").fancybox({
				'titlePosition'		: 'outside',
				'overlayColor'		: '#000',
				'overlayOpacity'	: 0.9
			});

			$("a#modelo7").fancybox({
				'titlePosition'	: 'inside'
			});

			$("a#modelo8").fancybox({
				'titlePosition'	: 'over'
			});

			$("a[rel=modelo_group]").fancybox({
				'transitionIn'		: 'over',
				'transitionOut'		: 'over',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">Foto ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});
			$("a[rel=modelo_group2]").fancybox({
				'transitionIn'		: 'over',
				'transitionOut'		: 'over',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">Foto ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});
			$("a[rel=modelo_group3]").fancybox({
				'transitionIn'		: 'over',
				'transitionOut'		: 'over',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">Foto ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});
			$("a[rel=modelo_group4]").fancybox({
				'transitionIn'		: 'over',
				'transitionOut'		: 'over',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">Foto ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});
			$("a[rel=modelo_group5]").fancybox({
				'transitionIn'		: 'over',
				'transitionOut'		: 'over',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">Foto ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});
			$("a[rel=modelo_group6]").fancybox({
				'transitionIn'		: 'over',
				'transitionOut'		: 'over',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">Foto ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});

			/*
			*   Examples - various
			*/

			$("#various1").fancybox({
				'titlePosition'		: 'inside',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			});

			$("#various2").fancybox();

			$("#various3").fancybox({
				'width'				: '75%',
				'height'			: '75%',
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe'
			});

			$("#various4").fancybox({
				'padding'			: 0,
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			});
		});
function fecharPeca(id) {
	if(document.getElementById(id).style.display=="none") {
		document.getElementById(id).style.display = "inline";
	}
	else {
		document.getElementById(id).style.display = "none";
	}
}

function checa_formBolsa(formBolsa){
	if (formBolsa.nome.value == ""){
		alert("Por favor preencha o campo nome.");
		document.formBolsa.nome.focus();
		return (false);
	}
	if (formBolsa.endereco.value == ""){
		alert("Por favor preencha o campo endereco.");
		document.formBolsa.endereco.focus();
		return (false);
	}
	if (formBolsa.cidade.value == ""){
		alert("Por favor preencha o campo cidade.");
		document.formBolsa.cidade.focus();
		return (false);
	}
	if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(formBolsa.email_bolsa.value))) { 
        alert("Por favor preencha o campo email.");
        document.formBolsa.email_bolsa.focus() 
        return (false) 
    }
	if (formBolsa.telefone.value == ""){
		alert("Por favor preencha o campo telefone.");
		document.formBolsa.telefone.focus();
		return (false);
	}
	if (formBolsa.escola.value == ""){
		alert("Por favor preencha o campo escola.");
		document.formBolsa.escola.focus();
		return (false);
	}
	if (formBolsa.serie.value == ""){
		alert("Por favor preencha o campo serie.");
		document.formBolsa.serie.focus();
		return (false);
	}
	return (true);
}	

function checa_formContato(formContato){
	if (formContato.nome.value == ""){
		alert("Por favor preencha o campo nome.");
		document.formContato.nome.focus();
		return (false);
	}
	if (formContato.endereco.value == ""){
		alert("Por favor preencha o campo endereco.");
		document.formContato.endereco.focus();
		return (false);
	}
	if (formContato.cep.value == ""){
		alert("Por favor preencha o campo cep.");
		document.formContato.cep.focus();
		return (false);
	}
	if (formContato.cidade.value == ""){
		alert("Por favor preencha o campo cidade.");
		document.formContato.cidade.focus();
		return (false);
	}
	if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(formContato.email.value))) { 
        alert("Por favor preencha o campo email.");
        document.formContato.email.focus() 
        return (false) 
    }
	if (formContato.telefone.value == ""){
		alert("Por favor preencha o campo telefone.");
		document.formContato.telefone.focus();
		return (false);
	}
	if (formContato.mensagem.value == ""){
		alert("Por favor preencha o campo mensagem.");
		document.formContato.mensagem.focus();
		return (false);
	}
	return (true);
}	
