"use strict"; function make_auto_table() { var tbl = null; var tr = null; var td = null; var cell_left = null; var cell_top = null; var cell_width = null; var cell_height = null; var blank_img = null; var num_rows = null; var window_width = null; var scroll_height = null; var cells_per_row = null; var cell_counter = null; var i = null; var j = null; var desktop = null; num_rows = 20; cell_width = 360; cell_height = Math.floor(cell_width * 1.294118); //ratio 8.5 x 11 window_width = parseFloat(window.innerWidth); //alert(window_width); cells_per_row = Math.floor((window_width - 30) / cell_width); //alert(cells_per_row); desktop = document.getElementById("desktop"); scroll_height = parseFloat(desktop.scrollHeight); //alert(window_width); cell_counter = 0; tbl = make_tbl(); //tbl.style.opacity = 0; tbl.setAttribute("border", "1"); //tbl.setAttribute("cellpadding", "20"); tbl.setAttribute("cellspacing", "30"); //tbl.setAttribute("width", "100%"); //tbl.style.width = "100%"; //desktop.style.width; tbl.style.position = "absolute"; tbl.style.top = "0"; tbl.style.left = "0"; tbl.id = "grid_table"; //alert(cells_per_row); for (i = 0; i < num_rows; i++) { tr = make_tr(); tbl.appendChild(tr); for (j = 0; j < cells_per_row; j++) { cell_counter++; //if (cell_counter <= cells_per_row) //{ td = make_td(); td.setAttribute("name", "web_window_container"); //td.style.padding = "10px"; //td.style.margin = "10px"; td.style.width = cell_width + "px"; td.style.height = cell_height + "px"; td.style.verticalAlign = "top"; td.style.textAlign = "left"; //td.style.padding = "6px"; td.style.overflow = "visible"; tr.appendChild(td); //td.innerHTML = " "; blank_img = make_img(); blank_img.src = "/images/blank.gif"; blank_img.style.position = "absolute"; blank_img.style.left = parseFloat(td.style.left) + "px"; blank_img.style.top = parseFloat(td.style.top) + "px"; blank_img.style.height = (parseFloat(td.style.height) - 10) + "px"; blank_img.style.width = (parseFloat(td.style.width) - 10) + "px"; //blank_img.style.borderStyle = "solid"; //blank_img.style.borderWidth = "1px"; //blank_img.style.borderColor = "blue"; blank_img.addEventListener("load", function () { //alert(blank_img.offsetLeft); //alert(blank_img.offsetTop); //alert(blank_img.scrollWidth); //alert(blank_img.scrollHeight); //alert(cell_counter); //global_place_window_timer_id = setTimeout("place_window('" + this.id +"');clearTimeout(global_place_window_timer_id);", ((cell_counter + 1) * 550)); //setTimeout(place_window(this), (cell_counter + 1) * 20); //populate_web_windows(); //alert("blank_img has loaded"); }); td.appendChild(blank_img); //alert(blank_img.clientTop); //alert(blank_img.offsetTop); //alert(blank_img.offsetLeft); //alert(blank_img.scrollTop); //document.getElementById("desktop").appendChild(blank_img); //} } } //alert(tbl.outerHTML); document.getElementById("desktop").appendChild(tbl); document.getElementById("desktop").style.height = parseFloat(tbl.scrollHeight) + "px"; global_remove_grid_timer = setTimeout("remove_table();clearTimeout(global_remove_grid_timer);", 2000); //tbl.remove(); //return tbl; cascade_all_windows(); } function make_tbl() { var tbl_obj = null; tbl_obj = document.createElement("table"); return tbl_obj; } function make_tr() { var tr_obj = null; tr_obj = document.createElement("tr"); return tr_obj; } function make_td() { var td_obj = null; td_obj = document.createElement("td"); return td_obj; } function make_img() { var img_obj = null; img_obj = document.createElement("img"); return img_obj; } function place_window(spacer_img) { var img_top = null; var img_left = null; var img_width = null; var img_height = null; var number_of_windows = null; var window_id = null; //var spacer_img = null; //spacer_img = document.getElementById(spacer_img); img_top = spacer_img.offsetTop; img_left = spacer_img.offsetLeft; img_width = parseFloat(spacer_img.style.width); img_height = parseFloat(spacer_img.style.height); spacer_img.style.position = "absolute"; //alert(); spacer_img.outerHTML = "
Top: "+ img_top +" Left: "+ img_left +" Width: " + img_width + " Height: " + img_height + "
"; number_of_windows = parseFloat(get_number_windows()); window_id = "window_000" + number_of_windows.toString(); ////fade_elem_in(window_id); //make_new_window(window_id, img_left, img_top, img_width, img_height, ("Window: " + number_of_windows.toString())); } //function get_number_windows() //{ // var web_windows = null; // var web_window_count = null; // web_windows = document.getElementsByName("web_window"); // web_window_count = parseFloat(web_windows.length); // return web_window_count; //} function remove_table() { var tbl = null; tbl = document.getElementById("grid_table"); tbl.parentNode.removeChild(tbl); //alert(window.scrollY); //grid_table } function populate_table_template() { var tds = null; var tds_count = null; var i = null; tds = document.getElementsByName("web_window_container"); if (tds != null) { for (i = 0; i < tds.length; i++) { } } }