/*
	variáveis globais
*/
	// variáveis determinantes de browsers
	var isN4  	= (document.layers) ? true : false;
	var isIE  	= (document.all) ? true : false;
	var isDOM 	= (document.getElementById && !document.all) ? true : false;

/*
	openPopup()
	função responsável por abrir novas janelas.
*/
function openPopup(idPopup, url, popupW, popupH){
	window.open(url, idPopup, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=no,copyhistory=no,width=' + popupW + ',height=' + popupH + ',top=55,left=55');
}

function lnkPopup(e, w, h){
	window.open(e.href, '', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=no,copyhistory=no,width=' + w + ',height=' + h + ',top=' + ((screen.height - h) / 2) + ',left=' + ((screen.width - w) / 2));	
	return false;
}


/*
	BasketAdd()
	função responsável por incluir produtos na basket.
*/
function BasketAdd(IdProduct, IdObjectQtdItems, IdObjectQtdBoxes, dsClickSource){
	pageToBack = escape(location.href.substring(location.href.lastIndexOf('/') + 1, location.href.length));
	if ( pageToBack == "" )
	{
		pageToBack  = "default.aspx";
	}
	
	if (isDOM) {
		objectQtyItems = document.getElementById(IdObjectQtdItems);
		objectQtyBoxes = document.getElementById(IdObjectQtdBoxes);
	} else if (isN4) {
		objectQtyItems = document.layers[IdObjectQtdItems];
		objectQtyBoxes = document.layers[IdObjectQtdBoxes];
	} else if (isIE){
		objectQtyItems = document.all[IdObjectQtdItems];
		objectQtyBoxes = document.all[IdObjectQtdBoxes];
	}
	
	if(objectQtyItems != null && objectQtyBoxes != null){
		document.location.href = 'basketadd.aspx?' + 'idproduct=' + IdProduct + '&' + 'qtyItems=' + 
		objectQtyItems.value + '&' + 'qtyBoxes=' + objectQtyBoxes.value + '&' + 'pageToBack=' + pageToBack +
		'&' + 'src=' + dsClickSource ;
	}
	else{
		document.href = 'basket.aspx';
	}
	
	return false;
}
/*
	OpenPopupPrintNews()
	função responsável por abrir a página de impressão.
*/
 function OpenPopupPrintNews(idPageItem)
 {
          windowPrint = window.open('contentprint.aspx?idpageitem=' + idPageItem,'PopupPrintNews','toolbar=yes, scrollbars=yes, status=yes, menubar=yes, width=700, height=450, top=50, left=100');
          windowPrint.focus();
 }
/*
	PrintPage()
	função responsável por chamar a caixa de diálogo do navegador para impressão.
*/
function PrintPage()
{
	var ie_ns = (window.print) ? 1 : 0;
	if (ie_ns)
		window.print();
	else
		alert('Por favor selecione a opcao "Arquivo -> Imprimir" do menu superior para imprimir essa noticia.');
}




function FloatingDescriptionHide()
{
	var divFloating;
	var root;
	var obj;
	root  = document.getElementById('Form1');
	obj = document.getElementById('float');
	if(obj != null)
	{
	  obj.style.display = "none";
	}
//	<div id="pop">
//<a href="#" onclick="document.getElementById('pop').style.display='none';">[Fechar]</a>
//<br />
//	Agora coloque o estilo dessa div.

//</div>

}

function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1)
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

  function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }
