// JavaScript [cfrocel - RODRIGO CELEBRONE]


/*
By   : Rodrigo Celebrone
Desc : função para abrir popup crossbrowser
Ex   : fn_abrepopup(500,500,'/endereco/absoluto/da/pagina.cfm','NomeDaPagina',1); -> 1 para SCROLL
*/
function fnPopUp(_X,_Y,_Page,_Nome,n_){
var popup_largura = window.screen.width;
var popup_altura = window.screen.height;
var popup_x = _X;
var popup_y = _Y;
var _X = _X - 12;/* Subtrair 12 das barras laterais da janela popup */
var _Y = _Y - 56;/* Subtrair 56 da barra do menu iniciar do windows e barras de titulo da janela */
var var_x = (parseInt(popup_largura)/2) - (parseInt(popup_x)/2);// metade do width
var var_y = (parseInt(popup_altura)/2) - (parseInt(popup_y)/2);// metade do height
if(n_ == 1){
		n_ = 'scrollbars=yes';
	}else{
		n_ = null;
	}
window.open(_Page,_Nome,'width='+_X+',height='+_Y+',left='+var_x+',top='+var_y+','+n_);
}

// FUNÇÃO ABRE E FUNÇÃO FECHA MODAL
function fnAbreModal(id,caminhoImg){
	window.document.getElementById('idGrandeImg').src = caminhoImg;
	window.document.getElementById(id).style.display = 'block';
	window.document.getElementById(id).style.visibility = 'visible';
	
}
function fnFechaModal(id){
	window.document.getElementById(id).style.display = 'none';
	window.document.getElementById(id).style.visibility = 'hidden';
}

// MOSTRANDO CAMPOS SELECT CORRETO
function fn_chamaSelect(valor){
	window.location = 'http://www.imagenarte.com.br/index.cfml?tit=admin&vlrItem='+valor;
}
function fn_chamaSelect1(valor){
	window.location = 'http://www.imagenarte.com.br/index.cfml?tit=admin2&vlrItem='+valor;
}
function fn_chamaSelect2(valor){
	window.location = 'http://www.imagenarte.com.br/index.cfml?tit=admin3&vlrItem='+valor;
}
function fn_chamaSelectItem2(vItem,vSubItem){
	window.location = 'http://www.imagenarte.com.br/index.cfml?tit=admin3&vlrItem='+vItem+'&SubItem='+vSubItem;
}
function fnPopulaInput(codigo1,codigo2){
	window.document.forms[0].txtCdgImagem1.value = codigo1;
	window.document.forms[0].txtCdgImagem2.value = codigo2;	
}
function fnMsgDel(nome,id){
	document.getElementById(id).innerHTML = '&raquo; Clique em apagar para remover o produto <strong>'+nome+'</strong>';
}
function fnComprar(){
	var form_pagseguro = 'pagseguro';
	var form_imagenarte = 'imagenarte';
	var campo_imagenarte_cor = 'cor';
	var campo_imagenarte_tamanho = 'tamanho';
	var campo_pagseguro = 'item_descr';
	var id = 'idBtnComprarProd';
	document.forms[form_pagseguro].elements[campo_pagseguro].value += '( Cor: '+document.forms[form_imagenarte].elements[campo_imagenarte_cor].value+' ) - ( Tamanho: '+document.forms[form_imagenarte].elements[campo_imagenarte_tamanho].value+' )';
	document.getElementById(id).click();
}