// relativos a mp_menuPubs

/* --------------------------ver no evento window.onload ao final da página
	window.onload=function(){
					for(i = 1; i < 6; i++) {
						var tr = "mp_menuPub_0" + i;
						document.getElementById(tr).style.display = "none";		
				}
			}
*/

_spBodyOnLoadFunctionNames.push("mySlideShow1.play()");
			
			function mp_menupub_alterna (obj2){
				var manipula2 = "mp_menuPub_0" + obj2;
				for (i=1; i<6; i++){
				var manipula3 = "mp_menuPub_0" + i;
					if (manipula2 != manipula3) {
						document.getElementById(manipula3).style.display = 'none';
						
					}			
						if (document.getElementById(manipula2).style.display == 'none') {
							document.getElementById(manipula2).style.display = 'block';
						}else{document.getElementById(manipula2).style.display = 'none';}
				}
			}
	// relativos a mp_banner1
			var numBanner;
			var atualBanner = 1;
			var esteBanner;
			var proxBanner;
			/*-----------ver no evento window.onload ao final da página
window.onload=function(){
				numBanner =  document.getElementById("banner1_").getElementsByTagName("dt").length;
				alert(numBanner);
				for (i=2; i<numBanner; i++){
					var contBanner = "banner1_0" + i;
					document.getElementById(contBanner).style.display="none";
				} 
				atualBanner = 1;
			}
*/
			function proximo(){
				numBanner =  document.getElementById("banner1_").getElementsByTagName("dt").length;

				if (atualBanner < numBanner){
				proxBanner = "banner1_0" + (atualBanner + 1);
				esteBanner = "banner1_0" + (atualBanner);
				
				}else{
					atualBanner = 0; 
					proxBanner = "banner1_0" + (atualBanner+1);
					esteBanner = "banner1_0" + (numBanner);
				}
							
				document.getElementById(esteBanner).style.display="none";
				document.getElementById(proxBanner).style.display="block";
				
				atualBanner = atualBanner+1;	
			}
			function anterior(){
				numBanner =  document.getElementById("banner1_").getElementsByTagName("dt").length;
			
				if (atualBanner == 1){
				proxBanner = "banner1_0" + (numBanner);
				esteBanner = "banner1_0" + (atualBanner);
				atualBanner = numBanner;
				}else{
				
					proxBanner = "banner1_0" + (atualBanner-1);
					esteBanner = "banner1_0" + (atualBanner);
				}
							
				document.getElementById(esteBanner).style.display="none";
				document.getElementById(proxBanner).style.display="block";
				
				atualBanner = atualBanner-1;				
			}
			

			
		window.onload=function(){
			//mp_menuPubs
						for(i = 1; i < 6; i++) {
						var tr = "mp_menuPub_0" + i;
						document.getElementById(tr).style.display = "none";		
				}
			//mp_banner
				numBanner = document.getElementById("banner1_").getElementsByTagName("dt").length;
				//alert(numBanner);
				for (i=2; i<=numBanner; i++){
					var contBanner = "banner1_0" + i;
					document.getElementById(contBanner).style.display="none";
				} 
				atualBanner = 1;
			//mp_loginSISCREA
				document.getElementById("formLoginSISCREA").style.display='none';
			}
			
			
//relativos a mp_loginSISCREA
			function loginSISCREA(){
				var estado = document.getElementById("formLoginSISCREA").style.display;
				if (estado == "block") {
					document.getElementById("formLoginSISCREA").style.display = 'none';
				}
				else {
					document.getElementById("formLoginSISCREA").style.display = 'block';
				}
			}
			//

			//relativos e alternativos ao Banner1
			

var mySlideList1 = ['/crea/imagens/banner1.png','/crea/imagens/banner2.png','/crea/imagens/banner3.png','/crea/imagens/banner4.png']
		var mySlideShow1 = new SlideShow(mySlideList1, 'first', 2500, "mySlideShow1");
		
		function SlideShow(slideList, image, speed, name){
			this.slideList = slideList;
			this.image = image;
			this.speed = speed;
			this.name = name;
			this.current = 0;
			this.timer = 0;
		}
		
		function switchImage(imgName, imgSrc){
			if(document.images){
				if(imgSrc != "none"){
					document.images[imgName].src=imgSrc;
					
				}
			}
		}
		function SlideShow_play(){
			with(this){
				if(current++ == slideList.length -1)current = 0;
				switchImage(image, slideList[current]);
				clearTimeout(timer);
				timer = setTimeout(name+'.play()',speed);
				
			}
		}
		

	function SlideShow_stop(){
		with(this){
		clearTimeout(timer); //limpa o tempo
		timer = 0;
}
}		
function SlideShow_next(){
	with(this){
		if(current++ == slideList.length -1)current = 0;
		switchImage(image, slideList[current]);
		clearTimeout(timer);
	}
}
		
		SlideShow.prototype.stop = SlideShow_stop;
		SlideShow.prototype.play = SlideShow_play;
		SlideShow.prototype.next = SlideShow_next;

        function formatText(index, panel) {
		  return index + "";
	    }
	    



   
    
//document.onreadystatechange = function (){
//	if (document.readyState == "complete"){	mySlideShow1.play();	}
//}


//if (window.addEventListener) window.addEventListener("load", mySlideShow1.play() ,false );
	


//if (window.addEventListener)
// window.addEventListener("load", function(){alert('Your homework')}, false); //invoke function	


_spBodyOnLoadFunctionNames.push("IsAuthenticatedUser('s4-ribbonrow')");

function IsAuthenticatedUser(obj)
{
	var el = document.getElementById(obj);
	if(typeof _spUserId == "undefined")
	{
		el.style.display = 'none';		
	}
	else
	{
		el.style.display = '';
	}	
}

function toggle(obj)
{
	var el = document.getElementById(obj);
	if( el.style.display != 'none')
	{
		el.style.display = 'none';
	}	
	else
	{
		el.style.display = '';		
	}	
}

function OpenWindow(path)
{
	window.open(path, 'RunItRemote', 'resizable=yes,scrollbars=no,menubar=no,status=no,location=no,toolbar=no,width=1000,height=600');
}
		


function AbrePopup(url,w,h,sb,tb,rz,n){	n = n==""?"Janela":n;	window.open(url,n,"width="+w+",height="+h+",scrollbars="+sb+",toolbars="+tb+",rezise="+rz);}


function geraBannerFlash()
		{
			// JAVASCRIPT VARS
			// cache buster
			var cacheBuster = "?t=" + Date.parse(new Date());
			// stage dimensions		
			var stageW = "500";//"100%";
			var stageH = "120";//"100%";
			
			
			// ATTRIBUTES
			var attributes = {};
			attributes.id = 'FlabellComponent';
			attributes.name = 'FlabellComponent';

			// PARAMS
			var params = {};
			params.bgcolor = "#ffffff";
			params.menu = "false";
			params.scale = 'noScale';
			params.wmode = "opaque";
			params.allowfullscreen = "true";
			params.allowScriptAccess = "always";			
			
			
			/* FLASH VARS */
			var flashvars = {};
			
			/// if commented / delete these lines, the component will take the stage dimensions defined 
			/// above in "JAVASCRIPT SECTIONS" section or those defined in the settings xml
			flashvars.componentWidth = stageW;
			flashvars.componentHeight = stageH;
			
			/// path to the content folder(where the xml files, images or video are nested)
			/// if you want to use absolute paths(like "http://domain.com/images/....") then leave it empty("")			
			flashvars.pathToFiles = "";
			
			// path to content XML
			flashvars.xmlPath = "http://Demeter:83/Style Library/FlashBanner/banner/xml/banner.xml";
			
			
			/** EMBED THE SWF**/
			swfobject.embedSWF("http://Demeter:83/Style Library/FlashBanner/preview.swf"+cacheBuster, attributes.id, stageW, stageH, "9.0.124", "js/expressInstall.swf", flashvars, params, attributes);
		}
		
		
	
