// JavaScript Document
    function getDocHeight(doc) {
        var docHt = 0, sh, oh;
        if (doc.height) {
            docHt = doc.height;
        }
        else if (doc.body) {
            if (doc.body.scrollHeight) docHt = sh = doc.body.scrollHeight;
            if (doc.body.offsetHeight) docHt = oh = doc.body.offsetHeight;
            if (sh && oh) docHt = Math.max(sh, oh);
        }

        if (docHt < 460)
            docHt = 460;
            
        return docHt + 20;
    } 
    
    function setiframeHeight(iframeName) {
        var iframeWin = window.parent.frames[iframeName];
        var iframeEl = parent.document.getElementById ? parent.document.getElementById(iframeName) : parent.document.all ? parent.document.all[iframeName] : null;
        if (iframeEl && iframeWin) {
            iframeEl.style.height = "auto"; // helps resize (for some) if new doc shorter than previous
            var docHt = getDocHeight(iframeWin.document);
            // need to add to height to be sure it will all show
            if (docHt) iframeEl.style.height = docHt + "px";
        }
    }

    function resizeiframe() {
        var path = window.parent.location.toString();
        var domain = "http://www.ctmelectronica.com.ar";

        if (path.toLowerCase().indexOf(domain.toString() + "/") >= 0) {
            domain = "http://www.ctmelectronica.com.ar/";
        }

        if ((path == domain) ||
            (path.toLowerCase().indexOf("index.htm") > 0) ||
            (path.toLowerCase().indexOf(domain + "?") >= 0)) {
            setiframeHeight('content');
            window.parent.scroll(0, 0);
        }
        else {
            var queries = path.substring(path.indexOf(domain.toString()) + domain.toString().length);
            
            if(queries.toString().toLowerCase().indexOf("?") > 0) {
                var aux = queries.toString().substring(0, queries.toString().indexOf("?")) + "&" + queries.toString().substring(queries.toString().indexOf("?") + 1);
                queries = aux;
            }

            if (queries != "/") {
                window.parent.location = "http://www.ctmelectronica.com.ar/?path=" + queries;
            }
        }
    }

    function loadiframe() {
        var path = window.parent.location.toString();
        
        if (path.toLowerCase().indexOf("?path=") > 0) {
            var iframeref = path.substring(0, path.indexOf("?path="));

            if (path.toLowerCase().indexOf("&") > 0) {
                iframeref = iframeref + path.substring(path.indexOf("?path=") + 6, path.indexOf("&"));
			}
			else {
			    iframeref = iframeref + path.substring(path.indexOf("?path=") + 6);
			}
						
            document.getElementById('content').src = iframeref;
        }
    }
    
	function openClose(theID) {
		if (document.getElementById(theID).style.display == "block") { 
			document.getElementById(theID).style.display = "none"; 
		}
		else { 
			document.getElementById(theID).style.display = "block"; 
		} 
	}
