/* --- Funções velhas do clic --- */

function MM_openBrWindow(theURL,winName,features) {
	window.open(theURL,winName,features);
}

function abrecs1(video,uf){
	window.open("/clicstation/jsp/player_compact_sr.jsp?nomeVideo="+video+"&uf="+uf,"clicStation","width=250,height=300");
}

var oWindow = null;
function openModal( poUrl, poWidth, poHeight,poWindowName, poScroll ){
	var oLeft;
	var oTop;
	var oAttr;
	var oWindowName;
	var Nav4 = ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4));
	var Nav4plus = ((navigator.appName =="Netscape") && (parseFloat(navigator.appVersion) >4.04));
	var Nav5 = ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 5));
	var IE4 =((navigator.appName.indexOf("Microsoft") > -1)) && (parseInt(navigator.appVersion) == 4);
	var IE5 =((navigator.appName.indexOf("Microsoft") > -1)) && (parseInt(navigator.appVersion) == 5);
	var anyIE = (IE4 || IE5);
	var anyNav = (Nav4 || Nav4plus || Nav5);
	var oScroll = true;
	if( poScroll != null ) oScroll = poScroll;
	if(Nav4){
		oLeft = window.screenX + ((window.outerWidth - poWidth) / 2);
		oTop = window.screenY + ((window.outerHeight - poHeight) / 2);
		oAttr = "screenX=" + oLeft + ",screenY=" +oTop + ",location=no,toolbar=no,directories=no,status=no,resizable=no,dependent=yes,width="+ poWidth + ",height=" + poHeight;
	}else{
		oLeft = (screen.width - poWidth) / 2;
		oTop = (screen.height - poHeight) / 2;
		oAttr = "left=" + oLeft + ",top=" + oTop + ",location=no,toolbar=no,directories=no,status=no,resizable=no,width=" + poWidth + ",height=" + poHeight;
	}
	if( oScroll ) oAttr += ",scrollbars=yes"
	if( poWindowName == null ) oWindowName ="modal";
	else oWindowName = poWindowName;
	if( oWindow && oWindow.open ) closeModal();
	oWindow = window.open( poUrl, oWindowName, oAttr );
	oWindow.focus();
}
function closeModal(){
	oWindow.close();
	oWindow = null;
}

function linkVideo(p_video,uf) {
	abrecs1('video/'+p_video,uf);
}

function linkAudio(p_audio,uf) {
	abrecs1('audio/'+p_audio,uf);
}

function linkPdf(id,width,height) {
	window.open('/pdf/'+id, 'Pdf','resizable=yes,location=no,directories=no,status=no,toolbar=no,menubar=no,scrollbars=no,width='+width+',height='+height); 
}

function linkFlash(p_width,p_height,p_file,p_author,p_copyright,p_legend) {
	var popup = null;
	var title_popup = "clicRBS"
	if(!p_file.elements){
		popup = openModal('/clicstation/jsp/map.jsp?pfile=http://www.clicrbs.com.br/flash/'+p_file+'&pwidth='+p_width+'&pheight='+p_height+'&title='+title_popup,p_width,p_height,p_legend);
	}else{
		document.joker.p_comp.value = p_form.p_comp.value;
		document.joker.p_width.value = p_form.p_width.value;
		document.joker.p_height.value = p_form.p_height.value;
		document.joker.p_legend.value = p_form.p_legend.value;
		document.joker.p_author.value = p_form.p_author.value;
		document.joker.p_copyright.value = p_form.p_copyright.value;
		document.joker.p_type.value = "F";
		var v_width = p_width+60;
		var v_heigh = p_height+100;
		popup=window.open("/rbs/html/popup.htm","RBS","resizable=yes,location=no,directories=no,status=no,toolbar=no,menubar=no,scrollbars=no,width="+v_width+",height="+v_height);
	}
}

function linkGaleria (p_type,p_path,p_template,p_gallery_id,p_group_id,p_popup_width,p_popup_height,p_parameters_site,p_site) {
	if (p_site == null || p_site == ' ') p_site = "http://www.clicrbs.com.br";
	var tam = p_path.length;
	if (tam > 0){
		var position = p_path.indexOf("/",0);
		if (position == 0) p_path = p_path.substring(1, tam);
		tam = p_path.length;
		position = p_path.lastIndexOf("/", tam);
		if (position == (tam - 1)) p_path = p_path.substring(0, position);
	}
	if (p_site.indexOf("clicrbs") != -1) {
		p_path = p_path+"/jsp";
	}
	if (p_type == "1"){
		document.location.href = p_site+"/"+p_path+"/default.jsp?uf=1&local=1&newsID=DYNAMIC%2Cgaleria.GalleryDelivery%2CphotosGalleryXml&pg=1&template="+p_template+"&groupid="+p_group_id+"&galeriaid="+p_gallery_id+p_parameters_site;
	}else{
		var pagina = "http://www.clicrbs.com.br/jsp/default_galeria.jsp?uf=1&local=1&template=1552.dwt&ids=null&initial=null&playsshow=false&b=1&arquivo_xml=galeria_"+p_gallery_id+"_"+p_group_id+".xml"+p_parameters_site;
		MM_openBrWindow(pagina,'Galeria','scrollbars=no,menubar=no,status=no,width=730,height=538');
	}

}

function linkImagem(p_width,p_height,p_file,p_author,p_copyright,p_legend) {
	var popup=null;
	popup=openModal("/jsp/rt.jsp?rootdir=/shared&width="+p_width+"&height="+p_height+"&file="+p_file+"&author="+escape(p_author)+"&copyright="+escape(p_copyright)+"&legend="+escape(p_legend)+"&template=24.dwt",p_width+100,p_height+100,"Imagem");
}

function linkPopup(p_cat,p_tem,p_width,p_height,p_url) {
	 if (p_width==0 && p_height==0){
        popup=window.open('/jsp/popup.jsp?catgid='+p_cat+'&template='+p_tem+'.dwt&p_url='+p_url, 'PopUP');
     }else{
        popup=window.open('/jsp/popup.jsp?catgid='+p_cat+'&template='+p_tem+'.dwt&p_url='+p_url, 'PopUP', 'resizable=yes,location=no,directories=no,status=no,toolbar=no,menubar=no,scrollbars=yes,width='+p_width+',height='+p_height);
	}
}

function OpenPopup(p_url,p_window,p_width,p_height) {
	window.open(p_url, p_window, 'resizable=yes,location=no,directories=no,status=no,toolbar=no,menubar=no,scrollbars=no,width='+p_width+',height='+p_height);	
}

// ----- Fale conosco + FAQ
function OpenPopupRodape(tipo, centralid) { 
	if (tipo==1) {
	duvida = "http://www.clicrbs.com.br/atendimento/jsp/default.jsp?template=2856.dwt&newsID=DYNAMIC,atendimento.AtendimentoDataServer,getDuvidas&idcentral="+centralid+"&logo=clic&dominio=clic&idcategoria=370";
		window.open( duvida,'Duvidas', 'resizable=no,location=no,directories=no,status=no,toolbar=no,menubar=no,scrollbars=yes, width=656, height=520');
	} else if (tipo==2) {
		fale = "http://www.clicrbs.com.br/atendimento/jsp/default.jsp?template=2855.dwt&newsID=DYNAMIC,atendimento.AtendimentoDataServer,getFaleConosco&idcentral="+centralid+"&logo=clic&dominio=clic";
		window.open( fale,'Fale', 'resizable=no,location=no,directories=no,status=no,toolbar=no,menubar=no,scrollbars=yes, width=656, height=520');
	}
}





















