// JavaScript Document
var allurl=0;



var fontepx=14;
function fonte(type,id){
	
	var id=document.getElementById(id).style;
	
	
	if(type=="sm")
		fontepx++;
		else
		fontepx--;
		
		id.fontSize=fontepx+"px";
		
	
}

function getFaixaetaria(e)
{
	window.location="faixaetaria.php?id_faixa="+e.value;
}

function getcolecoes(e)
{
	window.location="colecao.php?id_colecao="+e.value;

}


function loadPagedefine(page,div)
{
			$.get(page,
			
			{nome: "Marcelo", idade: "23"},
			
			function(data) 
			{
			alert('insert');
			$("#"+div).empty().html(data);
			
			});
			
			
			return false;

}	
	
	
function loadPage(page,alvo)
	{
	
				$.get(page,
				
				{nome: "Marcelo", idade: "23"},
				
				function(data) 
				{
				
				$("#salve"+alvo).empty().html(data);
				
				});
				
				return false;
	
	}	

function d(metod){ return document.getElementById(metod);
	
	}
	
function maction(form,action){
		
		var id=d(form);
		id.action=action;		
	}


function Tchecked(cAll,nameid,type){
	
	var id="";
	
	
	for(var i=0; i<cAll;i++){
		
		id=document.getElementById(nameid+i);
		
		if(type)
			id.checked=true;
			else
			id.checked=false;
			
			
		

		}
}
	
function printT(printp){
		
			var div=document.getElementById("sub"+printp).style;
			div.display="block";
			div.visibility="visible";
			
			var divA=document.getElementById("clique"+printp).style;
			divA.background="#EBECFF";
			divA.color="#000000";
			
			
			var divP="";
			
			for(var i=0;i<allurl;i++)
			{
					if(printp==i) continue;
					
						divP=document.getElementById("sub"+i).style;
						divP.display="none";
						divP.visibility="hidden";
						
						var divB=document.getElementById("clique"+i).style;
							divB.background="#FFFFFF";
							divB.color="#000000";
							
					
			}
			

			
	}
	
	
function cColor(e,n){
	//alert(e);
	
	var idv=document.getElementById('cColor').style;
		idv.background=e;
		
		idv.border='0px';
		idv.padding='0px';
		
		
		if(n==3|| n==4 )
				idv.color="#000000";
			else
				idv.color="#FFFFFF";
				
				
			var idv=document.getElementById('nm').className='header_'+n;
			
			var radio=document.getElementById('radio'+n);
				radio.checked=true;
				radio.value=n;
			
			
			
	
	}


function cColorf(p,n){
	//alert(e);
	
					
			
			
			var radio=document.getElementById('radio'+n);
				radio.checked=true;
				radio.value=n;
			
			
			
	
	}


function llocation(url){window.location=url;}

	
	function cclose(){
			window.close();
		}
	function ReloadNoClose(){
	opener.location.reload();
	}

function alterCSS(){
	
	document.write('<style type="text/css">');
	var css1='.txtTopo{	margin-top:5px;margin-left:20px;color:#FFFFFF;font-size:11px;width:110px;border-right:1px solid #BB1FEF;float:left;padding:3px;}';
		
		document.write(css1);
	document.write('</style>');
	
	}


function janela(paginda, largura,tamanho){
		window.open(paginda,'mensagem_','scrollbars=yes,resizable=yes,width='+largura+'px,height='+tamanho+'px' );
}

function vrIE() {
	var valor = navigator.userAgent;
	var separa = valor.split(" ");
		
		if(navigator.userAgent.indexOf("MSIE")!=-1) {
			for(var i=0; i < separa.length; i++) {
				if(separa[i]=="MSIE") {
					var resultado = separa[i+1];
					return resultado.substr(0,3);
					break;
				}
			}
		}

}

$(function() {  


          $('#login').mouseover(function() {  
             
						
				
			 
			 //$(this).addClass('selectedRow');  
          }).click(function() {
			  
			  
					var form=document.getElementById(this.className);
					form.submit();
					
		
			  });
	   
	   
		  
}); // fim do prrincipal 

function get_segmentos_colecoes(seg,col){
	
	var segmento = '1';
	var tipo     = '999';

	var url  = 'form.php';
	var pars = 'ajax_template=select_segmento&id_tipo='+tipo;
	var ajax = new Ajax.Request(url, {method: 'get', parameters: pars, onLoading: Element.show('spinner_segmento'),onComplete:showResponSegmento});	
	
	var pars = 'ajax_template=select_colecao&id_segmento='+segmento+'&id_tipo='+tipo;
	var ajax = new Ajax.Request(url, {method: 'get', parameters: pars, onLoading: Element.show('spinner_colecao'),onComplete:showResponseColecao});	
}
function get_colecoes(obj_name,obj_name2){
	document.getElementById('select_colecao').innerHTML = '';
	var obj      = document.getElementById(obj_name);
	var segmento = obj[obj.selectedIndex].value;
	var obj      = document.getElementById(obj_name2);
	var tipo     = obj[obj.selectedIndex].value;

	var url  = 'form.php';
	var pars = 'ajax_template=select_colecao&id_segmento='+segmento+'&id_tipo='+tipo;
	var ajax = new Ajax.Request(url, {method: 'get', parameters: pars, onLoading: Element.show('spinner_colecao'),onComplete:showResponseColecao});	
}
function showResponseColecao(originalRequest){
	document.getElementById('select_colecao').innerHTML = originalRequest.responseText;
	Element.hide('spinner_colecao');
}
function get_segmentos(obj_name){
	
	document.getElementById('select_segmento').innerHTML = '';
	var obj         = document.getElementById(obj_name);
	var tipo = obj[obj.selectedIndex].value;

	var url  = 'form.php';
	var pars = 'ajax_template=select_segmento&id_tipo='+tipo;
	
	var ajax = new Ajax.Request(url, {method: 'get', parameters: pars, onLoading: Element.show('spinner_segmento'),onComplete:showResponSegmento});		

}
function showResponSegmento(originalRequest){
	document.getElementById('select_segmento').innerHTML = originalRequest.responseText;
	Element.hide('spinner_segmento');
	get_colecoes('segmento','tipo');
}


function urlbook(idLink,selo)
	{
	if(selo==2)
	{

	 
	 window.location="book.php?id_titulo="+idLink;
	 
	}
	else
	{
		
		var urln="http://www.modernaliteratura.com.br/moderna/book.php?id_titulo="+idLink;	
		window.open(urln,'_blank');
	}
	}

	   
