
function showDialog(name)
{
	var dlgCommon = dojo.widget.byId(name);
	if(dlgCommon != null)
		dlgCommon.show();
	hideFlashDivs();
	return true;
}

function hideDialog(name)
{
	showFlashDivs();
	var dlgCommon = dojo.widget.byId(name);
	if(dlgCommon != null)
		dlgCommon.hide();
	return true;
}

function hideFlashDivs()
{
	var news = dojo.byId('news');
	if (news != null) news.style.display="none";
}

function showFlashDivs()
{
	var news = dojo.byId('news');
	if (news != null) news.style.display="block";
}


function openPopup(link){
	var image_height = 400;
	var image_width = 400;
	var top = (screen.height - image_height) /2;
	var left = (screen.width - image_width) /2;
	//window.open(link,"resizable=no");
	window.open(link,"picture","resizable=no, width="+image_width+", height="+image_height+", top="+top +", left="+left);
}

function replaceOnClick(id, link)
{
	var element = document.getElementById(id);
	if(element){
		document.getElementById(id).attributes["onclick"].value = "openPopup('"+link+"')";
	}
}




function showDialog(name)
{
	var dlgCommon = dojo.widget.byId(name);
	dlgCommon.show();
	hideFlashDivs();
	return true;
}

function hideDialog(name)
{
	showFlashDivs();
	var dlgCommon = dojo.widget.byId(name);
	dlgCommon.hide();
	return true;
}


function hideFlashDivs()
{
	var logo = dojo.byId('logo');
	var news = dojo.byId('news');
	if (logo != null) logo.style.display="none";
	if (news != null) news.style.display="none";
}

function showFlashDivs()
{
	var logo = dojo.byId('logo');
	var news = dojo.byId('news');
	if (logo != null) logo.style.display="block";
	if (news != null) news.style.display="block";
}

// Llega por paramtro el nombre de la imagen chica
function updateImagenMediana(image)
{
	dojo.byId('IMG_FotoMediana').src = image;
	return true;
}

function updateProductName(name)
{
	dojo.byId('ProductName').innerHTML = name;
	return true;
}

function productsNavGo(section, action)
{
	var form = document.getElementById('FormNavProductos');
	form.section.value = section;
	form.action.value = action;

	var action2 = document.getElementById(action);
	form.action2.value = action2.options[action2.selectedIndex].value;

	form.submit();
	return true;
}

function openDialog(dialog_id)
{
	if(!dijit.byId(dialog_id)){
		dojo.parser.parse(dojo.byId(dialog_id+'Container'));
	}
	if(dijit.byId(dialog_id)){
		dijit.byId(dialog_id).show();
	} else {
		alert('No existe un dialog con id "'+dialog_id+'" o no está \ncontenido por un div con id "'+dialog_id+'Container"');
	}
}

