// >-------------------< INICIO >-------------------< //
	function OpenPic_en(){
		var windowprops = "width=720,height=500,left=150,top=150";
		var URL = "printEn.html";
		abrirPopup(URL,787,450);		
//		window.open(URL, "preview", windowprops);
	}

	function OpenPic(){
		var windowprops = "width=720,height=500,left=150,top=150";
		var URL = "print.html";
		abrirPopup(URL,787,480);		
		//window.open(URL, "preview", windowprops);
	}

function TGNFlash(){
	var urldata = "main.htm?lang=es";
	if(typeof(idioma)!="undefined"){
		if(idioma=="en"){urldata = "main.htm?lang=en";}
	}
	launchwin(urldata,'tgni');
}
function TGNHtml(){
	var parmflash = "";
	if(typeof(nohayflash)!="undefined"){
		if(nohayflash){parmflash="&flash=0";}
	}
	var urldata = "vermain.aspx?urlxml=xml/home.xml&lang=es";
	if(typeof(idioma)!="undefined"){
		if(idioma=="en"){urldata = "vermain.aspx?urlxml=xml.en/home.xml&lang=en";}
	}
	location.href = urldata+parmflash;
}
var toptup;
function launchwin(winurl,winname,winfeatures){
	var noie = (navigator.appVersion.indexOf("MSIE")==-1)?true:false;
	var esChrome = (navigator.appVersion.toLowerCase().indexOf("chrome")>-1)?true:false;
	var esXPSP2 = false;
	//if(typeof(navigator.appMinorVersion)!="undefined"){
	//	esXPSP2 = (navigator.userAgent.indexOf("NT 5.1")!=-1 && navigator.appMinorVersion.indexOf("SP2")!=-1);
	//}
	var _ancho = window.screen.availWidth-7; //-12
	var _alto = window.screen.availHeight+50; //-28
	//if(noie){_ancho-=50;}
	if(esXPSP2){_ancho-=61;}
	if(_ancho>1152){
		_ancho = window.screen.availWidth-12;
		_alto = window.screen.availHeight-80;
	}
	var param = "location=no,directories=no,menubar=no,scrollbars=no,"+
				"resizable=1,toolbar=no,status=1,width="+ _ancho +",height="+ _alto +",top=0,left=0,screenX=0,screenY=0";
	toptup = window.open(winurl,winname,param);
	if(!esChrome){
		toptup.moveTo(0,-22);
		if(_ancho>1152){
			toptup.moveTo(0,window.screen.height/2-_alto/2-21);
		}
		if(noie || esXPSP2){
			toptup.moveTo(window.screen.width/2-_ancho/2,window.screen.height/2-_alto/2-21);
		}
	}
	if(javascript_version > 1)
	{
		setTimeout('toptup.focus();',250);
	}
}
// >-------------------< - >-------------------< //
function abrirPopup4Flash(pagina,ancho,alto){
    var screenw = window.screen.availWidth;
    var screenh = window.screen.availHeight;
	ancho = (ancho!=undefined)?ancho:screenw-15;
	alto = (alto!=undefined)?alto:screenh-80;
    var _posx = screenw/2-ancho/2;
    var _posy = screenh/2-alto/2;
	var titulo = "TGN";
	if(arguments[3]){ titulo = "TGN - " + arguments[3];	}
	if(typeof(window.top.esteW)!=undefined){
		if (window.top.esteW && ! window.top.esteW.closed) {
			window.top.esteW.close();
			window.top.esteW = null;
		}
	}
	var urlPopup = "abrirDoc.htm?urlDoc=" + pagina;
	esteW = window.open(urlPopup, "abrirDok", "width="+ancho+",height="+alto+",center,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,left="+_posx+",top="+_posy);
	esteW.focus();
}
function abrirPopup(pagina,ancho,alto){
	var noie = (navigator.appVersion.indexOf("MSIE")==-1)?true:false;
    //var screenw = window.screen.width;
    //var screenh = window.screen.height;
    var screenw = window.screen.availWidth;
    var screenh = window.screen.availHeight;
	ancho = (ancho!=undefined)?ancho:screenw-15;
	alto = (alto!=undefined)?alto:screenh-80;
    var _posx = screenw/2-ancho/2;
    var _posy = screenh/2-alto/2;
	var titulo = "TGN";
	if(arguments[3]){ titulo = "TGN - " + arguments[3];	}
	if(typeof(window.top.esteW)!=undefined){
		if (window.top.esteW && ! window.top.esteW.closed) {
			window.top.esteW.close();
			window.top.esteW = null;
		}
	}
	noie = true;
	if(noie){
		esteW = window.open(pagina, "totup", "width="+ancho+",height="+alto+",center,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,left="+_posx+",top="+_posy);
	} else {
		esteW = window.open("", "totup", "width="+ancho+",height="+alto+",center,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,left="+_posx+",top="+_posy);
		esteW.document.writeln('<html>');
		esteW.document.writeln('<head>');
		esteW.document.writeln(' <title>'+titulo+'</title>');
		esteW.document.writeln('</head>');
		esteW.document.writeln('<frameset rows="100%,*" frameborder="NO" border="0" framespacing="0">');
		esteW.document.writeln(' <frame name="pagina" src="'+pagina+'" scrolling="yes" frameborder="NO" noresize>');
		esteW.document.writeln('<noframes>');
		esteW.document.writeln('<body bgcolor="#EFEFEF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">');
		esteW.document.writeln(' ');
		esteW.document.writeln('</body>');
		esteW.document.writeln('</noframes>');
		esteW.document.writeln('</html>');
	}
	esteW.focus();
}
function abrirLink(urlDok){
	location.href = urlDok;
}
function abrirLink4Flash(urlDok,ancho,alto){
	location.href = urlDok;
	//abrirPopup(urlDok,ancho,alto);
	return true;
}
function contactenos(lang){
	var urlparams = "";
	var pathlang = "xml";
	if(location.href.indexOf("flash=0")>-1){ urlparams +="&flash=0"; }
	if(lang!=undefined){ urlparams +="&lang="+lang; }
	if(lang=="en"){ pathlang = "xml.en"; }
	location.href="vermain.aspx?urlxml="+pathlang+"/contactenos.xml"+urlparams;
}
function imprimirPopup(){
	alert(esteW);
}
function irPortal(){
	window.open("https://www.tgn.com.ar/portalcompras/", "portalwin", "");
}
function abrirVentanaFX(u,n,w,h,f){
	try {
		if(typeof(self[n])!=undefined){
			var WO = (
					d=document,
					WW=WH=100,
					s=screen,
					ws=s?1:0,
					sw=ws?s.width:800,
					sh=ws?s.height:640,
					x=(sw-WW)/2,
					y=(sh-WH)/2,
					l=(sw-w)/2,
					t=(sh-h)/2,
					s='width='+WW+',height='+WH+',top='+y+',screeny='+y+',left='+x+',screenx='+x,
					s+=(d.layers)?',resizable':'',
					s+=(!f||f=='')?'':','+f,
					W=self[n]=window.open('',n,s),
					(W&&!W.closed)?1:0
					);
			W.focus();
			while(WW!=w||WH!=h){
				if(WO&&WW<w){W.moveTo((sw-WW)/2,(sh-WH)/2);
				W.resizeTo(WW,WH);
				WW*=1.3}if(WO&&WW>w){WW=w;
				W.moveTo((sw-WW)/2,(sh-WH)/2);
				W.resizeTo(WW,WH)}if(WO&&WH<h){W.moveTo((sw-WW)/2,(sh-WH)/2);
				W.resizeTo(WW,WH);
				WH*=1.3}if(WO&&WH>h){WH=h;
				W.moveTo((sw-WW)/2,(sh-WH)/2);
				W.resizeTo(WW,WH)}
			}
			if(d.layers){
				W.outerHeight=h;W.outerWidth=w;
			}
			W.moveTo(l,t);
			W.document.location=u;
			W.focus();
		} else {
			self[n].focus();
		}
	}
	catch (e) {
		w -= 12;
		h -= 4;
		window.open(u, "tgnonline", "width="+w+",height="+h+",resizable=0");
	}
}

//--------------------< Ou-DI >-------------------------------/
// Script: tg2_std.js
// Version: 1.1
// Dokumentation: tg2_std.htm
// Letzte Aenderung:
// Datum: 03.03.2004
// Name: Frank Merl (onpact AG)

function checkBrowser(){
	this.agt = navigator.userAgent.toLowerCase();
	this.ver = navigator.appVersion;
	this.dom = document.getElementById?1:0;
	this.linux = (this.agt.indexOf("linux")!=-1) ? 1:0;
	this.mac = (this.agt.indexOf("mac")!=-1) ? 1:0;
	this.win = (this.agt.indexOf("win")!=-1) ? 1:0;
	this.ie6 = (this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
	this.ie55 = (this.ver.indexOf("MSIE 5.5")>-1 && this.dom)?1:0;
	this.ie5 = (this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.ie55)?1:0;
	this.ie4 = (document.all && !this.dom) ? 1:0;
	this.ns6 = (this.dom && parseInt(this.ver) >= 5 && this.ver.indexOf("Gecko")>-1) ? 1:0;
	this.ns5 = (this.dom && parseInt(this.ver) >= 5 && !this.ns6 && !this.linux && (this.agt.indexOf('opera')==-1)) ? 1:0;
	this.ns4 = (document.layers) ? 1:0;
	this.nn = ((document.captureEvents) && (!this.dom)) ? 1:0;
	this.mz = (((this.dom) && (!document.all) && (document.documentElement)) && (this.agt.indexOf("safari")==-1)) ? 1:0;
	this.op = ((this.dom) && (this.agt.indexOf('opera')!=-1)) ? 1:0;
	this.kon = ((this.agt.indexOf("konqueror")!=-1) || (this.agt.indexOf("safari")!=-1)) ? 1:0;
	this.bw = (this.ie5 || this.ie4 || this.ns4 || this.ns5 || this.ie55 || this.ie6);
	this.os = (this.ver.indexOf("Macintosh")>-1)? "mac":"pc";
	this.ie = (this.ie5 || this.ie4 || this.ie55 || this.ie6);
	this.ns = (this.ns4 || this.ns5 || this.ns6);
	this.client = (!this.ns4) ? "ie" : "ns";
    this.iemac = (this.mac && this.ie) ? 1:0;
	return this;
}

checkBrowser.prototype.toString = function() {
    return (this.client + "_" + this.os);
}

checkBrowser.prototype.CSSstring = function(country, os) {
    if (!os) os = this.os;
    if (!country) country = 'de';
    return ("style_" + this.client + "_" + os + "_" + country);
}

var is = new checkBrowser();

function isBlockedByCookie(name){
	if (document.cookie) {
		if (document.cookie.lastIndexOf("bmp_" + name) >= 0) {
			return true;
		}
	}
	return false;
}

var popupHandle;

function abrirWinFX(url) {
    screenw = window.screen.width;
    screenh = window.screen.height;
    var sp = new Object();
	sp.name = 'tgnet';
	sp.location = 0;
	sp.top = 'center';
	sp.left = 'center';
	sp.width = 700;
	sp.height = 543;
	sp.width_iemac = -1;
	sp.height_iemac = -1;
	sp.width_nnmac = -1;
	sp.height_nnmac = -1;
	sp.width_ie = -1;
	sp.height_ie = -1;
	sp.width_kon = -1;
	sp.height_kon = -1;
	sp.width_nn = -1;
	sp.height_nn = -1;
	sp.width_mz = -1;
	sp.height_mz = -1;
	sp.menubar = 0;
	sp.status = 0;
	sp.directories 	= 0;
	sp.scrollbars = 0;
	sp.resizable = 0;
	sp.fullscreen = -1;

	//sp.alwaysRaised=true;
	sp.channelmode=true;

    for (i = 1; i < window.abrirWinFX.arguments.length; i++) {
        var a = window.abrirWinFX.arguments[i];
        split = a.indexOf("=");
        if (split != -1) {
            v = a.substring(split + 1, a.length);
            k = a.substring(0, split);
            eval("sp." + k.replace(/ /g,"") + "='" + v.replace(/ /g,"") + "'");
        }
    }
	if (is.nn && sp.width_nn != -1) sp.width = sp.width_nn;
	if (is.nn && sp.height_nn != -1) sp.height = sp.height_nn;
	if (is.mz && sp.width_mz != -1) sp.width = sp.width_mz;
	if (is.mz && sp.height_mz != -1) sp.height = sp.height_mz;
	if (is.ie && sp.width_ie != -1) sp.width = sp.width_ie;
	if (is.ie && sp.height_ie != -1) sp.height = sp.height_ie;
	if (is.kon && sp.width_kon != -1) sp.width = sp.width_kon;
	if (is.kon && sp.height_kon != -1) sp.height = sp.height_kon;
	if (is.iemac && sp.width_iemac != -1) sp.width = sp.width_iemac;
	if (is.iemac && sp.height_iemac != -1) sp.height = sp.height_iemac;
	if (is.mac && is.nn && sp.width_nnmac != -1) sp.width = sp.width_nnmac;
	if (is.mac && is.nn && sp.height_nnmac != -1) sp.height = sp.height_nnmac;
	if (sp.top=="center") sp.top = Math.round((screenh-sp.height) / 2);
	if (sp.left=="center") sp.left = Math.round((screenw-sp.width) / 2);
	n = sp.name;
	sp.name = -1;
	sp.width_nn = -1;
	sp.height_nn = -1;
	sp.width_mz = -1;
	sp.height_mz = -1;
	sp.width_ie = -1;
	sp.height_ie = -1;
	sp.width_kon = -1;
	sp.height_kon = -1;
	sp.width_iemac = -1;
	sp.height_iemac = -1;
	a = "";

    //if (isBlockedByCookie(n)) {
    //    return;
    //}

    if(sp.fullscreen=='yes'){
		sp.width = window.screen.availWidth - 10;
		sp.height = window.screen.availHeight -30;
		sp.top=0;
		sp.left=0;
		sp.fullscreen = -1;
    }

    for (p in sp) if (sp[p] != -1) a += p + "=" + sp[p] + ",";
    a = a.substring(0, a.length - 1);
    /*
    top[n] = window.open(url, n, a + ",alwaysRaised=yes");
    top[n].focus();
    if (!top[n].opener) top[n].opener = window;

	top[n].blur();
	top[n].focus();

	popupHandle = top[n];
	*/

	if (is.mz){

		sp.height += 50;
	}

	abrirVentanaFX(url,n,sp.width,sp.height,a);

    //if (typeof(sp.bmp) != "undefined" ) { // block multiple opening by setting a cookie
    //    document.cookie = "bmp_" + n + "=1;Path=/";
    //}
}

// JavaScript by Dave Lauderdale
// Published at: www.digi-dl.com

function IE(e)
{
	if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3))
	{
		return false;
	}
}
function NS(e)
{
	if (document.layers || (document.getElementById && !document.all))
	{
		if (e.which==2 || e.which==3)
		{
			return false;
		}
	}
}
//document.onmousedown=IE;document.onmouseup=NS;document.oncontextmenu=new Function("return false");
// >-------------------< FOTO-FX >-------------------< //
var paso = 5;
function agrandarFoto(){
	var alto = parseInt(document.getElementById("fototopDIV").style.height);
	if(alto<200){
		alto+=paso;
		document.getElementById("fototopDIV").style.height = alto;
		setTimeout('agrandarFoto()',20);
	}
}
function achicarFoto(){
	document.getElementById("fototopDIV").style.height = 37;
}

function Flash2HTML(){
	var lang = "es";
	if(arguments[0]!="undefined"){ lang = arguments[0]; }
	idioma = lang;
	var ir2HTML = (location.href.indexOf("vermain")>-1)?false:true;
	if(ir2HTML){
		var main = window.opener;
		main.idioma = idioma;
		main.TGNHtml();
		main.focus();
		self.close();
	} else {
		location.href = "";
		TGNFlash();
	}
}
function flashfix(){
	if (document.getElementsByTagName)
	{
		obj = document.getElementsByTagName("object"); 
		for (var i=0; i < obj.length; i++) {obj[i].outerHTML = obj[i].outerHTML;}
	} 
}
function dw(txtCode){
	document.write(txtCode);
}
function getUrlParametros(){
	var parametros = {};
	var paramsArr = location.href.split('?');
	if(paramsArr.length>1){
		parametros = {};
		var req = paramsArr[1].split('&');
		for(var i=0; i<req.length; i++){
			parametros[req[i].split('=')[0]] = req[i].split('=')[1];
		}
	}
	return parametros;
}
function trim(text){
	var start=0;
	var end=text.length-1;
	while (text.charCodeAt(start)==32 && start<end){
		start++;
	}
	while (text.charCodeAt(end)==32 && end>start){
		end--;
	}
	return text.substring(start,end+1);
}
function verify_email(em){
	arroba=false;
	punto=false;
	right=false;
	for (var i=1;i<em.length-3;i++){
		if (em.substring(i,i+1)=='@'){
			pos=i
			arroba=true;
			break;
		}
	}
	if (arroba){
		for (var i=arroba;i<em.length-1;i++){
			if (em.substring(i,i+1)=='.'){
				right=true;
				punto=true;
				break;
			}
		}
	}
	return right;
}
function PoliticaPrivacidad(lang){
	var urlparams = "";
	var pathlang = "xml";
	if(location.href.indexOf("flash=0")>-1){ urlparams +="&flash=0"; }
	if(lang!=undefined){ urlparams +="&lang="+lang; }
	if(lang=="en"){ pathlang = "xml.en"; }
	location.href="vermain.aspx?urlxml=xml/politica_de_privacidad.xml"+urlparams;
}
function FormLineaTransparente(lang){
	var urlparams = "";
	var pathlang = "xml";
	if(location.href.indexOf("flash=0")>-1){ urlparams +="&flash=0"; }
	if(lang!=undefined){ urlparams +="&lang="+lang; }
	if(lang=="en"){ pathlang = "xml.en"; }
	location.href="vermain.aspx?urlxml="+ pathlang +"/form_linea_transparente.xml"+urlparams;
}

function LineaTransparenteTerminosCondiciones(lang)
{
	var urlText = "LineaTransparenteTerminosCondiciones.html";
	if(lang=="en")
	{
		urlText = "LineaTransparenteTerminosCondiciones.en.html";
	}
	abrirPopup(urlText,787,450);
}