function FormatNumber(num,decimalNum,bolLeadingZero,bolCommas)
/**********************************************************************
	IN:
		NUM - the number to format
		decimalNum - the number of decimal places to format the number to
		bolLeadingZero - true / false - display a leading zero for
										numbers between -1 and 1
		bolCommas - put commas as number separators.
 
	RETVAL:
		The formatted number!
 **********************************************************************/
{ 
        if (isNaN(parseInt(num))) return "NaN";

	var tmpNum = num;
	var iSign = num < 0 ? -1 : 1;		// Get sign of number
	
	// Adjust number so only the specified number of numbers after
	// the decimal point are shown.
	tmpNum *= Math.pow(10,decimalNum);
	tmpNum = Math.round(Math.abs(tmpNum))
	tmpNum /= Math.pow(10,decimalNum);
	tmpNum *= iSign;					// Readjust for sign
	
	
	// Create a string object to do our formatting on
	var tmpNumStr = new String(tmpNum);

	// See if we need to strip out the leading zero or not.
	if (!bolLeadingZero && num < 1 && num > -1 && num != 0)
		if (num > 0)
			tmpNumStr = tmpNumStr.substring(1,tmpNumStr.length);
		else
			tmpNumStr = "-" + tmpNumStr.substring(2,tmpNumStr.length);
		
	// See if we need to put in the commas
	if (bolCommas && (num >= 1000 || num <= -1000)) {
		var iStart = tmpNumStr.indexOf(".");
		if (iStart < 0)
			iStart = tmpNumStr.length;

		iStart -= 3;
		while (iStart >= 1) {
			tmpNumStr = tmpNumStr.substring(0,iStart) + "," + tmpNumStr.substring(iStart,tmpNumStr.length)
			iStart -= 3;
		}
	}

	return tmpNumStr;		// Return our formatted string!
}


function init(){
	wW = (is.ns)? window.innerWidth-15 : document.body.offsetWidth-20
	wH = (is.ns)? window.innerHeight : document.body.offsetHeight-4

	if(is.ns){
	origWidth=innerWidth;
	origHeight=innerHeight;
	onresize=function(){
		if(innerWidth!=origWidth||innerHeight!=origHeight)
		location.reload()
		}
	}
	Lnada = new DynLayer("LnadaDiv");
	Lnada.moveTo(0,0)
	Lnada.clipTo(0,wW,wH,0);
	Lcuerpo = new DynLayer("LcuerpoDiv");
	Lcuerpo.moveTo(0,0)
		if (is.ns) {
    	if(location.reload)
		Lnada.hide();
	}
    if (is.ie) {
    	if(document.all)
		Lnada.hide();
	}
}
function IP_swapImgRestore() {  
  var i,x,a=document.IP_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function IP_findObj(n, d) {  
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=IP_findObj(n,d.layers[i].document); return x;
}

function IP_swapImage() {  
  var i,j=0,x,a=IP_swapImage.arguments; document.IP_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=IP_findObj(a[i]))!=null){document.IP_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function IP_preloadImages() {  
  var d=document; if(d.images){ if(!d.IP_p) d.IP_p=new Array();
    var i,j=d.IP_p.length,a=IP_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.IP_p[j]=new Image; d.IP_p[j++].src=a[i];}}
}
function carga(){
	IP_preloadImages('../img/tsobre.gif','../img/tsobreact.gif','../img/tsobreactivo.gif','../img/tcatalogo.gif','../img/tcatalogoact.gif','../img/tcatalogoactivo.gif','../img/tpedidos.gif','../img/tpedidosact.gif','../img/tpedidosactivo.gif','../img/trepresenta.gif','../img/trepresentaact.gif','../img/trepresentaactivo.gif','../img/tcalidad.gif','../img/tcalidadact.gif','../img/tcalidadactivo.gif','../img/tcontacto.gif','../img/tcontactoact.gif','../img/tcontactoactivo.gif','../img/fondologotx.gif','../img/logoschroedertx.gif','../img/fondotop.gif','../img/fondcelda.gif','../img/separa.gif','../img/tornillo.gif','../img/tornillod.gif','../img/topinion.gif','../img/topinionact.gif','tabla03_01.gif','tabla03_02.gif','tabla03_03.gif');
}
function OpenVentaNa(P_pagina,N_ancho,N_alto,N_barra,N_amplia) {
		window.open(P_pagina, 'dy', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars='+N_barra+',width='+N_ancho+',height='+N_alto+',left=0,top=110,screenLeft=110,screenTop=110,resizable='+N_amplia+'');
}
