////////////////////////////////////////////////
//                                            //
// THIS CODE IS COPYRIGHTED BY AR-15.COM      //
//  YOU DO NOT HAVE ANY PERMISSION TO USE,    //
//  MODIFY, COPY, OR DISTRIBUTE THIS CODE     //
//  OR VARIATIONS OF THIS CODE                //
//  IN WHOLE OR IN PART                       //
//  MORE INFORMATION HERE:                    //
//  http://www.ar-15.com/terms.php            //
//                                            //
//  VIOLATORS WILL BE PROSECUTED              //
//                                            //
////////////////////////////////////////////////

var rez_path;
var media_path;
var browserName=navigator.appName; 
if (browserName=="Microsoft Internet Explorer") {
    if (screen.width>1920) {
      rez_path = '2027';
      media_path = '2048';
    } else if (screen.width<=1920 && screen.width>1680) {
      rez_path = '1899';
      media_path = '1920';     
    } else if (screen.width<=1680 && screen.width>1600) {
      rez_path = '1660';   
      media_path = '1680';
    } else if (screen.width<=1600 && screen.width>1440) {
      rez_path = '1579';
      media_path = '1600';
    } else if (screen.width<=1440 && screen.width>1400) {
      rez_path = '1420';
      media_path = '1440';         
    } else if (screen.width<=1400 && screen.width>1280) {
      rez_path = '1379';
      media_path = '1400';   
    } else if (screen.width<=1280 && screen.width>1024) {
      rez_path = '1259';
      media_path = '1280';
    } else if (screen.width<=1024 && screen.width>800) {
      rez_path = '1004';
      media_path = '1024';
      adjust_font = 1;
    } else if (screen.width<=800) {
      rez_path = '778';
      media_path = '800';
      adjust_font = 2;
    } else { // load generic set anyway
      rez_path = '1280';
      media_path = '1259';
    }  
  } else { // non ie browser
    if (screen.width>1920) {
      rez_path = '2048';
    } else if (screen.width<=1920 && screen.width>1680) {
      rez_path = '1920';       
    } else if (screen.width<=1680 && screen.width>1600) {
      rez_path = '1680'; 
    } else if (screen.width<=1600 && screen.width>1440) {
      rez_path = '1600';
    } else if (screen.width<=1440 && screen.width>1400) {
      rez_path = '1440';      
    } else if (screen.width<=1400 && screen.width>1280) {
      rez_path = '1400';
    } else if (screen.width<=1280 && screen.width>1024) {
      rez_path = '1280';
    } else if (screen.width<=1024 && screen.width>800) {
      rez_path = '1024';
      adjust_font = 1;
    } else if (screen.width<=800) {
      rez_path = '800';
      adjust_font = 2;
    } else { // load generic image set
      rez_path = '1280';
    } 
    media_path = rez_path;         
  } 

//initiate globals
var size_counter;
var split_size;
var varsize_counter;
var split_varsize;
var fontsize_counter;
var split_fontsize;
var table_width;
var photo_input_id;

var move_anchor = function () {
    if (location.hash) {
      var hash_loc = location.hash;
      location.hash = hash_loc;
      move_anchor = function () {}
    }
  }

//
// for size regex
//  
size_counter = 1;
function get_size() {
  var find_size = split_size[size_counter];
  var adjusted_size = Math.round(find_size/2048 * table_width);
  // Return the updated count variable.
  size_counter++;
  size_counter++;
  return( adjusted_size );
}  

fontsize_counter = 1;
function get_fontsize() {
    var rec_fontsize = split_fontsize[fontsize_counter]; 
    rec_fontsize = parseFloat(rec_fontsize); 
  if (media_path == 800) {
    var find_fontsize = rec_fontsize +3; 
  } else if (media_path == 1024) {
    var find_fontsize = rec_fontsize +1;
  } else {
    var find_fontsize  = rec_fontsize; 
  }
  var adjusted_fontsize = Math.round(find_fontsize/2048 * table_width);
  // Return the updated count variable.
  fontsize_counter++;
  fontsize_counter++;
  return( adjusted_fontsize );
}  

varsize_counter = 1;
function get_varsize() {
  var find_varsize = split_varsize[varsize_counter];
  varsize_counter++;
  var find_adjust = split_varsize[varsize_counter];
  var adjusted_varsize = Math.round(find_varsize/2048 * table_width - find_adjust);
  if (adjusted_varsize < 0) {
    adjusted_varsize = 0;
  }
  // Return the updated count variable.
  varsize_counter++;
  varsize_counter++;
  return( adjusted_varsize );
}
 
 function record_editor(field_name) {
        storage_name = field_name+'_storage';
        if (typeof(form_state) == 'undefined') {
        } else if (form_state=="1") { 
          current = parent.frames[0].document.body.innerHTML;         
            document.getElementById(storage_name).innerHTML=current;
        }
 }
 function share_editor() {
    current = parent.frames[0].document.body.innerHTML;         
    document.getElementById('editor_field').innerHTML=current;
 } 
 
  function retrieve_editor(field_name) {
        storage_name = field_name+'_storage';
        current = document.getElementById(storage_name);
        if(current!=null){ 
          current = document.getElementById(storage_name).innerHTML;
          if (current!=null){
            parent.frames[0].document.getElementById('editor_div').innerHTML = current;
          }
        }        
  }   
 
 function record_input(field_name) {
        storage_name = field_name+'_storage';
        if (typeof(form_state) == 'undefined') {
        } else if (form_state=="1") { 
          current = document.getElementById(field_name).value;          
            document.getElementById(storage_name).innerHTML=current;
        }
 }
 function record_select(field_name) {
        storage_name = field_name+'_storage';
        if (typeof(form_state) == 'undefined') {
        } else if (form_state=="1") { 
            for (var i=0; i < document.register[field_name].length; i++) {
              if (document.register[field_name].options[i].selected) {
                document.getElementById(storage_name).innerHTML=document.register[field_name].options[i].value;
              }
            }            
        }
 }

 function record_radio(field_name) {
        storage_name = field_name+'_storage';
        if (typeof(form_state) == 'undefined') {
        } else if (form_state=="1") {        
            for (var i=0; i < document.register[field_name].length; i++) {
              if (document.register[field_name][i].checked) {
                document.getElementById(storage_name).innerHTML=document.register[field_name][i].value;
              }
            }
        }
 }
 function record_checkbox(field_name) {
        storage_name = field_name+'_storage';
        if (typeof(form_state) == 'undefined') {
        } else if (form_state=="1") {        
        var checked_boxes = '';
            for (var i=0; i < document.register[field_name].length; i++) {
              if (document.register[field_name][i].checked) {
                if (checked_boxes) {
                  checked_boxes += document.register[field_name][i].value+'#';
                } else {
                  checked_boxes += '#'+document.register[field_name][i].value+'#';
                }                
              }
            }
            document.getElementById(storage_name).innerHTML=checked_boxes;
        }
 } 

 function retrieve_input(field_name) {
        storage_name = field_name+'_storage';
        current = document.getElementById(storage_name);
        if(current!=null){ 
          current = document.getElementById(storage_name).innerHTML;
          if (current!=null){
            document.getElementById(field_name).value = current;
          }
        }        
  }    
 function retrieve_select(field_name) {
        storage_name = field_name+'_storage';
        current = document.getElementById(storage_name);
        if(current!=null){ 
          current = document.getElementById(storage_name).innerHTML;
          if (current!=null){
            for (var i=0; i < document.register[field_name].length; i++) {
              if (document.register[field_name].options[i].value == current) {
                document.register[field_name].options[i].selected = true;
              }
            }          
          }
        }        
  }
 function retrieve_radio(field_name) {
        storage_name = field_name+'_storage';
        current = document.getElementById(storage_name);
        if(current!=null){ 
          current = document.getElementById(storage_name).innerHTML;
          if (current!=null){                 
            for (var i=0; i < document.register[field_name].length; i++) {
              if (document.register[field_name][i].value == current) {
                document.register[field_name][i].checked = true;
              }
            }
          }
        }
 }
 function retrieve_checkbox(field_name) {
        storage_name = field_name+'_storage';
        current = document.getElementById(storage_name);
        if(current!=null){ 
          current = document.getElementById(storage_name).innerHTML;
          if (current!=null){ 
            var check_array = document.getElementById(storage_name).innerHTML;
            for (var i=0; i < document.register[field_name].length; i++) { 
              var check_value = document.register[field_name][i].value;
              var check_regex = new RegExp("#"+check_value+"#");
              var test_check = check_array.match(check_regex);
              if (test_check) {
                document.register[field_name][i].checked = true;
              }              
            }
          }
        }
 }    
    
  // Editor Menu & Top Buttons
     function editorOver(on,text,font,height,color,clLeft,clTop,clRight,clBot,overID) {
        sub_title(text,font,height,color);  
        var img_id = overID;
        whichEl = document.getElementById(img_id).style;        
        //if (!on) { whichEl.visibility = "hidden"; return }    
        if (!on) {
          whichEl.clip = "rect(" + 1 + " " + 2 + " " + 2 + " " + 1 + ")";
          whichEl.visibility = "visible";
          return 
        }  
        whichEl.clip = "rect(" + clTop + " " + clRight + " " + clBot + " " + clLeft + ")";      
        whichEl.visibility = "visible";
    }      
    
             

      

            function submit_form()  {
          document.getElementById ('register').submit() ;
        }     
             
    

  onload = onresize = function info () {
   
    
  
if(document.body.clientWidth){
  str = " "; 
}
document.getElementById("background").innerHTML=str;  
document.getElementById("display2").innerHTML=str;

  if(document.body.clientWidth){
  table_width = document.body.clientWidth;
    if (table_width < 788) {
      table_width = 788;
    }
  var header_height = table_width * .197265625;
  var offset_height = 382/2048 * table_width;
  var col_width = table_width * (341/2048);
  header_height = Math.round(header_height);
  col_width = Math.round(col_width);
  var table_height = document.body.clientHeight;
  logo_width = (368/2048) * table_width;
  logo_width = Math.round(logo_width);
  forum_title_width = (846.68/2048 * table_width) - 33;
  
  var middle_width = table_width - (col_width * 2);
  var div_width = middle_width * .98;
  var r_col_pos = col_width + middle_width;
  var content_html = document.getElementById('pagedata').innerHTML;
  
  var col_item_width = col_width - (70/2048 * table_width);
  var right_offset = middle_width+col_width+ (55/2048 * table_width);
  var right_v_offset = (324/2048 * table_width);
  var menu_border = Math.round(16/2048 * table_width);
  var col_content_width = col_item_width - (menu_border * 2);
  
  var css_standard_font = Math.round(table_width/100);
  var css_title_font = Math.round(table_width/75);
  var css_huge_font = Math.round(table_width/50);
 
  //any output that needs to run through sizer after here 
   
  //menu items  
  replaceWith = "<span style='position:relative;left:0;top:0;z-index:30;'><img name='top_left_border' border=0 src=\"images/menu_top_left.gif\" WIDTH="+ menu_border +" HEIGHT="+ menu_border +"><img name='top_border' border=0 src=\"images/menu_top_border.gif\" WIDTH="+ col_content_width +" HEIGHT="+ menu_border +"><img name='top_right_border' border=0 src=\"images/menu_top_right.gif\" WIDTH="+ menu_border  +" HEIGHT=" +menu_border+"></span>";
  replaceWith += "<div style='position:relative;left:0;top:0;z-index:30;margin: 0px 0px 0px 0px;height: 1%;'><div style='background: url(/images/menu_background.gif); background-repeat: repeat;width: 100%;height: 100%;'><div style='margin: 0px "+menu_border+"px 0px "+menu_border+"px;width: "+(col_content_width - 1)+";height: 100%;z-index:50;'><!--27=FFFFFF-->$2<!--cs-->";
  replaceWith += "</div><span style='position:absolute;left:0;top:0;z-index:40;overflow: hidden;width: 100%;height: 100%;'><img name='left_border' border=0 src=\"images/menu_left_border.gif\" width="+ menu_border +" height='100%'></span><span style='position:absolute;left:"+(menu_border+col_content_width)+";top:0;z-index:40;height: 100%;'><img name='right_border' border=0 src=\"images/menu_right_border.gif\" WIDTH="+ menu_border +" height='100%'></span></div></div>";
  content_html = content_html.replace(/(<!--menu_header=+?)([\S\s]*?)-->/g, replaceWith);    
  replaceWith = "<div style='position:relative;left:0;top:0;z-index:30;margin: 0px 0px 0px 0px;height: 1%;'><div style='background: url(/images/menu_background2.gif); background-repeat: repeat;width: 100%;height: 100%;'><div style='margin: 0px "+menu_border+"px 0px "+menu_border+"px;width:"+(col_content_width-(menu_border*2))+";height: 100%;z-index:50;'>";
  content_html = content_html.replace(/<!--class=menu_follower-->/g, replaceWith);
  replaceWith = "</div><span style='position:absolute;left:0;top:0;z-index:40;overflow: hidden;width: 100%;height: 100%;'><img name='left_border2' border=0 src=\"images/menu_left_border2.gif\" width="+ menu_border +" height='100%'></span><span style='position:absolute;left:"+(menu_border+col_content_width)+";top:0;z-index:40;height: 100%;'><img name='right_border2' border=0 src=\"images/menu_right_border2.gif\" WIDTH="+ menu_border +" height='100%'></span></div></div><span style='position:relative;left:0;top:0;z-index:30;'><img name='bottom_left_border' border=0 src=\"images/menu_bottom_left.gif\" WIDTH="+ menu_border  +" HEIGHT="+ menu_border +"><img name='bottom_border' border=0 src=\"images/menu_bottom_border.gif\" width="+ col_content_width +" height="+ menu_border +"><img name='bottom_right_border' border=0 src=\"images/menu_bottom_right.gif\" width="+ menu_border  +" height=" +menu_border+"></span>";
  content_html = content_html.replace(/<!--end=menu_follower-->/g, replaceWith);   
  replaceWith = "<div style='position:relative;left:0;top:0;z-index:30;'><img src='images/pixel.gif' height="+Math.round(16/2048 * table_width)+" border=0></div>";
  content_html = content_html.replace(/<!--class=table-spacer2-->/g, replaceWith);   
  
  replaceWith = '<span style="position:absolute;left:-size-658-size-;top:-size-65-size-;z-index:60;display:none;cursor: crosshair;font-size: '+css_standard_font +'px;" id="color_menu" name="color_menu">';
   replaceWith += '<img src="editor/color_menu.gif" border="0" usemap="#color_map">';
	replaceWith += '</span>';     
  replaceWith += '<span style="position:absolute;left:0;top:0;z-index:51;display:none;background-color: #8e8e8e;overflow: hidden;width: '+Math.round(226/2048 * table_width) +'px;height: -size-515-size-px;font-size: '+css_standard_font +'px;" id="emocon_menu" name="emocon_menu">';
   replaceWith += '<img src="images/'+media_path+'/emocons/war.gif" height=-size-64-size- width=-size-64-size- border="0" onclick="doEmocon('+"'"+'../images/'+media_path+'/emocons/war.gif'+"'"+')"><img src="images/'+media_path+'/emocons/zban.gif" height=-size-64-size- width=-size-128-size- border="0" onclick="doEmocon('+"'"+'../images/'+media_path+'/emocons/zban.gif'+"'"+')">';
   replaceWith += '<img src="images/'+media_path+'/emocons/punk.gif" height=-size-64-size- width=-size-64-size- border="0" onclick="doEmocon('+"'"+'../images/'+media_path+'/emocons/punk.gif'+"'"+')"><img src="images/'+media_path+'/emocons/wizard.gif" height=-size-64-size- width=-size-64-size- border="0" onclick="doEmocon('+"'"+'../images/'+media_path+'/emocons/wizard.gif'+"'"+')"><img src="images/'+media_path+'/emocons/pirate.gif" height=-size-64-size- width=-size-64-size- border="0" onclick="doEmocon('+"'"+'../images/'+media_path+'/emocons/pirate.gif'+"'"+')">';
   replaceWith += '<img src="images/'+media_path+'/emocons/cool.gif" height=-size-27-size- width=-size-27-size- border="0" onclick="doEmocon('+"'"+'../images/'+media_path+'/emocons/cool.gif'+"'"+')"><img src="images/'+media_path+'/emocons/cyclops.gif" height=-size-27-size- width=-size-27-size- border="0" onclick="doEmocon('+"'"+'../images/'+media_path+'/emocons/cyclops.gif'+"'"+')"><img src="images/'+media_path+'/emocons/smile.gif" height=-size-27-size- width=-size-27-size- border="0" onclick="doEmocon('+"'"+'../images/'+media_path+'/emocons/smile.gif'+"'"+')">';
	 replaceWith += '<img src="images/'+media_path+'/emocons/sad.gif" height=-size-27-size- width=-size-27-size- border="0" onclick="doEmocon('+"'"+'../images/'+media_path+'/emocons/sad.gif'+"'"+')"><img src="images/'+media_path+'/emocons/wounded.gif" height=-size-27-size- width=-size-27-size- border="0" onclick="doEmocon('+"'"+'../images/'+media_path+'/emocons/wounded.gif'+"'"+')"><img src="images/'+media_path+'/emocons/wink.gif" height=-size-27-size- width=-size-27-size- border="0" onclick="doEmocon('+"'"+'../images/'+media_path+'/emocons/wink.gif'+"'"+')">';
   replaceWith += '<img src="images/'+media_path+'/emocons/grouchy.gif" height=-size-27-size- width=-size-27-size- border="0" onclick="doEmocon('+"'"+'../images/'+media_path+'/emocons/grouchy.gif'+"'"+')"><img src="images/'+media_path+'/emocons/angry.gif" height=-size-27-size- width=-size-27-size- border="0" onclick="doEmocon('+"'"+'../images/'+media_path+'/emocons/angry.gif'+"'"+')"><img src="images/'+media_path+'/emocons/alien.gif" height=-size-27-size- width=-size-27-size- border="0" onclick="doEmocon('+"'"+'../images/'+media_path+'/emocons/alien.gif'+"'"+')">';
   replaceWith += '<img src="images/'+media_path+'/emocons/dunno.gif" height=-size-27-size- width=-size-27-size- border="0" onclick="doEmocon('+"'"+'../images/'+media_path+'/emocons/dunno.gif'+"'"+')"><img src="images/'+media_path+'/emocons/shocked.gif" height=-size-27-size- width=-size-27-size- border="0" onclick="doEmocon('+"'"+'../images/'+media_path+'/emocons/shocked.gif'+"'"+')"><img src="images/'+media_path+'/emocons/speechless.gif" height=-size-27-size- width=-size-27-size- border="0" onclick="doEmocon('+"'"+'../images/'+media_path+'/emocons/speechless.gif'+"'"+')">';
   replaceWith += '<img src="images/'+media_path+'/emocons/wtf.gif" height=-size-27-size- width=-size-27-size- border="0" onclick="doEmocon('+"'"+'../images/'+media_path+'/emocons/wtf.gif'+"'"+')"><img src="images/'+media_path+'/emocons/happy.gif" height=-size-27-size- width=-size-27-size- border="0" onclick="doEmocon('+"'"+'../images/'+media_path+'/emocons/happy.gif'+"'"+')">';
  replaceWith += '</span>';   	
  replaceWith += "<span id='editorUp' name='editorUp' style='position:absolute;left:-size-230-size-;top:0;z-index:21;background-color: #aaaaaa;vertical-align: top;width: "+Math.round(1107/2048 * table_width -31) +"px;height: -size-65-size-px;margin: 0px; padding: 0px;'>";  
	 replaceWith +=	'<img alt="Editor Buttons" src="images/'+media_path+'/editor_buttons.gif" width='+Math.round(955/2048 * table_width)+' height='+Math.round(65/2048 * table_width)+' usemap="#editorMenu" border=0>';
  replaceWith += '</span>';
  replaceWith += "<span id='editorOver' name='editorOver' style='position:absolute;left:-size-230-size-;top:0;z-index:21;background-color: #aaaaaa;display: none;vertical-align: top;width: "+Math.round(1107/2048 * table_width -31) +"px;height: -size-65-size-px;margin: 0px; padding: 0px;'>";  	 
   replaceWith +=	'<img alt="Editor Buttons On" src="images/'+media_path+'/editor_buttons_on.gif" width='+Math.round(955/2048 * table_width)+' height='+Math.round(65/2048 * table_width)+' usemap="#editorMenu" border=0>';
  replaceWith += '</span>';
  replaceWith += "<span id='editor_span' name='editor_span' style='position:absolute;left:-size-230-size-;top:-size-65-size-;z-index:20;display: inline;background-color: #8e8e8e;vertical-align: top;width: "+Math.round(1107/2048 * table_width -31) +"px;height: -size-450-size-px;margin: 0px; padding: 0px;'>";  	  
	replaceWith += '<iframe id="$2" name="$2" width='+Math.round(1107.68/2048 * table_width - 31)+' height="-size-400-size-" SRC="editor/blank10.html" frameborder=0 allowTransparency="true" style="background-color: transparent;"></iframe>';
  replaceWith += '</span>';
  replaceWith += "<span id='upload_span' name='upload_span' style='position:absolute;left:-size-230-size-;top:-size-65-size-;z-index:20;display: none;background-color: #8e8e8e;vertical-align: top;width: "+Math.round(1107/2048 * table_width -31) +"px;height: -size-450-size-px;margin: 0px; padding: 0px;'>";  	  
	replaceWith += '<iframe width='+Math.round(1107.68/2048 * table_width - 31)+' height="-size-400-size-" SRC="editor/upload.php?s=&r='+rez_path+'" frameborder=0 allowTransparency="true" style="background-color: transparent;"></iframe>';
  replaceWith += '</span>';  
  replaceWith += "<span style='position:absolute;left:-size-230-size-;top:-size-465-size-;z-index:20;background-color: #aaaaaa;vertical-align: top;width: "+Math.round(1107/2048 * table_width -31) +"px;height: -size-50-size-px;margin: 0px; padding: 0px;'>";  	 
	 replaceWith += '<img alt="Toggle Mode" src="editor/mode.gif" width='+Math.round(35/2048 * table_width)+' height='+Math.round(35/2048 * table_width)+' onClick="doToggleView()">&nbsp;&nbsp;&nbsp;';
  replaceWith += '</span>'; 
  replaceWith += "<span style='position:absolute;left:-s-1137-s-31-s-;top:-size-465-size-;z-index:21;vertical-align: top;width: "+Math.round(200/2048 * table_width) +"px;height: -size-50-size-px;margin: 0px; padding: 0px;'>";  	 
	 replaceWith += '<!--media_btn=editor_submit.gif#base=editor_submit#h=javascript:submit_form()#w=200#h=50#sub=Click here to submit this form-->';
  replaceWith += '</span>';   
    content_html = content_html.replace(/(<!--wysiwyg=+?)([\S]*?)-->/g, replaceWith);   
 
  // <!--landscape_im=hash#i=img_link#a=align-->
  replaceWith = '<a href="http://www.ar-15.com/o.php?i=$2" target="blank" rel="landscape"><img src="$4$5'+media_path+'$7" border="0" width=-size-240-size- height=-size-180-size- align="$9"></a>';
  content_html = content_html.replace(/(<!--landscape_im=+?)([\S\s]*?)(#i=)([\S\s]*?)(_)([0-9]+)(\.jpg)(#a=)([\S\s]*?)-->/g, replaceWith);      
    
  // <!--portrait_im=hash#i=img_link#align-->
  replaceWith = '<a href="http://www.ar-15.com/o.php?i=$2" target="blank" rel="portrait"><img src="$4$5'+media_path+'$7" border="0" width=-size-180-size- height=-size-240-size- align="$9"></a>';
  content_html = content_html.replace(/(<!--portrait_im=+?)([\S\s]*?)(#i=)([\S\s]*?)(_)([0-9]+)(\.jpg)(#a=)([\S\s]*?)-->/g, replaceWith);    
             
  // <!--gap=-size-left pos-size#t=top os#h=height#w=width-->
  replaceWith = "<span style='position:absolute;left:$2;top:-size-$4-size-;z-index:50;background: #D6D6D6;display: table-cell;width: -size-$8-size-px;height: -size-$6-size-px;margin: 0px; padding: 0px;'>"
  content_html = content_html.replace(/(<!--gap=+?)([\S]*?)(#t={1})([0-9.]*?)(#h={1})([0-9.]*?)(#w={1})([0-9.]*?)-->/g, replaceWith); 
 
  // <!--rez_img=name#w=-size-width-size-#h=height#id=id-->
  replaceWith = "<img border=0 src='images/"+rez_path+"/$2' width=$4 height=-size-$6-size- id='$8' name='$8'>"
  content_html = content_html.replace(/(<!--rez_img=+?)([\S]*?)(#w={1})([\S]*?)(#h={1})([0-9.]*?)(#id={1})([\S]*?)-->/g, replaceWith); 
  
  // <!--rez_img=name#w=-size-width-size-#h=height-->
  replaceWith = "<img border=0 src='images/"+rez_path+"/$2' width=$4 height=-size-$6-size->"
  content_html = content_html.replace(/(<!--rez_img=+?)([\S]*?)(#w={1})([\S]*?)(#h={1})([0-9.]*?)-->/g, replaceWith); 
  
  // <!--media_img=name#w=width#h=height-->
  replaceWith = "<img border=0 src='images/"+media_path+"/$2' width=-size-$4-size- height=-size-$6-size->"
  content_html = content_html.replace(/(<!--media_img=+?)([\S]*?)(#w={1})([0-9.]*?)(#h={1})([0-9.]*?)-->/g, replaceWith);  
  
  // <!--media_btn=name#base=base_name#h=link/to/script.php#w=width#h=height#sub=subtitle-->
  replaceWith = "<a href='$6' border=0><img border=0 name='$4' id='$4' src='images/"+media_path+"/$2' width=-size-$8-size- height=-size-$10-size- onMouseOver=\"this.src = 'images/"+media_path+"/$4_on.gif'; sub_title('$12',85,25,'5757dd');\" onMouseOut=\"this.src = 'images/"+media_path+"/$4.gif'; sub_title('',85,25,'5757dd');\"></a>"
  content_html = content_html.replace(/(<!--media_btn=+?)([\S]*?)(#base={1})([\S]*?)(#h={1})([\S]*?)(#w={1})([0-9.]*?)(#h={1})([0-9.]*?)(#sub={1})([\S\s]*?)-->/g, replaceWith); 
  
  // <!--adj_btn=name#base=base_name#h=link/to/script.php#w=-s-width-s-adjust-s-#h=-s-100-s-3-s-#sub=subtitle#id=id-->
  replaceWith = "<a href='$6' border=0><img border=0 name='$14' id='$14' src='images/"+media_path+"/$2' width=$8 height=$10 onMouseOver=\"this.src = 'images/"+media_path+"/$4_on.gif'; sub_title('$12',85,25,'5757dd');\" onMouseOut=\"this.src = 'images/"+media_path+"/$4.gif'; sub_title('',85,25,'5757dd');\"></a>"
  content_html = content_html.replace(/(<!--adj_btn=+?)([\S]*?)(#base={1})([\S]*?)(#h={1})([\S]*?)(#w={1})([\S]*?)(#h={1})([\S]*?)(#sub={1})([\S\s]*?)(#id={1})([\S]*?)-->/g, replaceWith);   
 
  //dynamic, abs placed cell w/o background use -s-width-s-31-s- to adjust 31
  // <!--abs_td=left_pos#t=top_pos#w=cell width#h=cell height#lh=line height#t=text align#v=v align-->
  replaceWith = "<span style='position:absolute;left:$2px;top:$4px;z-index:25;display: table-cell;line-height: -size-$10-size-px;text-align: $12;vertical-align: $14;width: $6px;height: -size-$8-size-px;margin: 0px; padding: 0px;'>";
  content_html = content_html.replace(/(<!--abs_td=+?)([\S]*?)(#t={1})([\S]*?)(#w={1})([\S]*?)(#h={1})([0-9.]*?)(#lh={1})([0-9.]*?)(#t={1})([\S]*?)(#v={1})([\S]*?)-->/g, replaceWith);       
  
  //dynamic, abs placed cell w/o background use -s-width-s-31-s- to adjust 31
  // <!--abs_td=left_pos#w=cell width#h=cell height#lh=line height#t=text align#v=v align-->
  replaceWith = "<span style='position:absolute;left:$2px;top:0px;z-index:25;display: table-cell;line-height: -size-$8-size-px;text-align: $10;vertical-align: $12;width: $4px;height: -size-$6-size-px;margin: 0px; padding: 0px;'>";
  content_html = content_html.replace(/(<!--abs_td=+?)([\S]*?)(#w={1})([\S]*?)(#h={1})([0-9.]*?)(#lh={1})([0-9.]*?)(#t={1})([\S]*?)(#v={1})([\S]*?)-->/g, replaceWith);       

  //dynamic, right aligned abs placed cell w/o background use -s-width-s-31-s- to adjust 31
  // <!--rabs_td=-size-left_pos-size-#t=top_pos#w=-size-width-size-#h=cell height#lh=line height#t=text align#v=v align-->
  replaceWith = "<span style='position:absolute;right:$2px;top:-size-$4-size-px;z-index:25;display: table-cell;line-height: -size-$10-size-px;text-align: $12;vertical-align: $14;width: $6px;height: -size-$8-size-px;margin: 0px; padding: 0px;'>";
  content_html = content_html.replace(/(<!--rabs_td=+?)([\S]*?)(#t={1})([0-9.]*?)(#w={1})([\S]*?)(#h={1})([0-9.]*?)(#lh={1})([0-9.]*?)(#t={1})([\S]*?)(#v={1})([\S]*?)-->/g, replaceWith);       

  //dynamic, abs. placed cell with background use -s-width-s-31-s- to adjust 31
  // <!--bg_td=-size-left_pos-size-#w=-size-cell width-size-#h=cell height#lh=line height#t=text align#v=v align#b=background-->
  replaceWith = "<span style='position:absolute;left:$2px;top:0px;z-index:10;background: #$14;display: table-cell;line-height: -size-$8-size-px;text-align: $10;vertical-align: $12;width: $4px;height: -size-$6-size-px;margin: 0px; padding: 0px;overflow: hidden;'>";
  content_html = content_html.replace(/(<!--bg_td=+?)([\S]*?)(#w={1})([\S]*?)(#h={1})([0-9.]*?)(#lh={1})([0-9.]*?)(#t={1})([\S]*?)(#v={1})([\S]*?)(#b={1})([\S]*?)-->/g, replaceWith);       

  //dynamic, rel. placed cell with background & 100% height use -s-width-s-31-s- to adjust 31
  // <!--tall_td=-size-left_pos-size-#w=-size-cell width-size-#t=text align#v=v align#b=background-->
  replaceWith = "<span style='position:relative;left:$2px;top:0px;z-index:21;background: #$10;display: table-cell;overflow: hidden;text-align: $6;vertical-align: $8;width: $4px;height: 100%;margin: 0px; padding: 0px;'>";
  content_html = content_html.replace(/(<!--tall_td=+?)([\S]*?)(#w={1})([\S]*?)(#t={1})([\S]*?)(#v={1})([\S]*?)(#b={1})([\S]*?)-->/g, replaceWith);       

  //dynamic, rel. placed cell with background & set height use -s-width-s-31-s- to adjust 31
  // <!--wide_td=-size-left_pos-size-#w=-size-cell width-size-#t=text align#v=v align#b=background-->
  replaceWith = "<span style='position:relative;left:$2px;top:0px;z-index:10;background: #$12;display: block;text-align: $8;vertical-align: $10;width: $4px;height: -size-$6-size-;margin: 0px; padding: 0px;overflow: hidden;'>";
  content_html = content_html.replace(/(<!--wide_td=+?)([\S]*?)(#w={1})([\S]*?)(#h={1})([0-9.]*?)(#t={1})([\S]*?)(#v={1})([\S]*?)(#b={1})([\S]*?)-->/g, replaceWith);       
  
  // <!--full_td=height-->
  replaceWith = "<span style='position:absolute;left:0;top:0;z-index:10;display: block;width: "+Math.round(1338.68/2048 * table_width - 31) +"px;height: -size-$2-size-px;margin: 0px; padding: 0px;'>"
  content_html = content_html.replace(/(<!--full_td=+?)([0-9.]*?)-->/g, replaceWith);  
  
  // <!--rel_td=height-->
  replaceWith = "<span style='position:relative;left:0;top:0;z-index:10;display: block;width: "+Math.round(1338.68/2048 * table_width - 31) +"px;height: -size-$2-size-px;margin: 0px; padding: 0px;'>"
  content_html = content_html.replace(/(<!--rel_td=+?)([0-9.]*?)-->/g, replaceWith);     
  
  // <!--fill_td-->
  replaceWith = "<span style='position:relative;left:0;top:0;z-index:10;display: block;width: "+Math.round(1338.68/2048 * table_width - 31) +"px;height: 100%;margin: 0px; padding: 0px;'>"
  content_html = content_html.replace(/<!--fill_td-->/g, replaceWith);  
  
  //dynamic image <!--img=save_name#folder=pics_folder#x_size=&size=100&#y_size=&size=100&#name=tagname-->
  replaceWith  = '<img src="media/media/'+"$4"+'/'+media_path +'/'+"$2"+'" width="'+"$6"+'" HEIGHT="'+"$8"+'" id="'+"$10"+'" name="'+"$10"+'" alt="'+"$10"+'">';
  content_html = content_html.replace(/(<!--img={1})([\s\S]*?)(#folder={1})([\s\S]*?)(#x_size={1})([\s\S]*?)(#y_size={1})([\s\S]*?)(#name={1})([\s\S]*?)(-->{1})/g, replaceWith);   

  // font = 21 subtitle = 24 title=27 huge = 41
  //dynamic font replacing
  replaceWith = "<span STYLE='color:#$2;font-family: Arial, Helvetica, sans-serif;font-size: -f-$1-f-px;font-weight: bold;'>";
  content_html = content_html.replace(/<!--([0-9]{2})=([0-9A-Fa-f]*?)-->/g, replaceWith);          

  // font = 21 subtitle = 24 title=27 huge = 41
  //dynamic font replacing
  replaceWith = "<span STYLE='color:#$2;font-family: Arial, Helvetica, sans-serif;font-size: -f-$1-f-px;font-weight: $4;line-height: -size-$6-size-px;margin: -size-$8-size-px; display: block;'>";
  content_html = content_html.replace(/<!--([0-9]{2})=([0-9A-Fa-f]*?)(#s=)([\S]*?)(#lh=)([0-9.]*?)(#m=)([0-9.]*?)-->/g, replaceWith);          

    
  //dont remove
  replaceWith = "</span>";
  content_html = content_html.replace(/<!--cs-->/g, replaceWith);    
  
  //dont remove
  replaceWith = "</div>";
  content_html = content_html.replace(/<!--close=div-->/g, replaceWith);           
  
  //dynamic close
  replaceWith = "</$2>";
  content_html = content_html.replace(/(<!--close=+?)([0-9A-Za-z]*?)-->/g, replaceWith);       
  
  //center content containers   
  replaceWith = "<div STYLE='background: url(/images/top_left.gif) left top no-repeat; '><div STYLE='background:url(/images/top_right.gif) right top no-repeat;'><div STYLE='background:url(/images/left_border.gif) 0px 15px no-repeat;'><div STYLE='background:url(/images/right_border.gif) right 15px no-repeat;'><div STYLE='background:url(/images/bottom_left.gif) left bottom no-repeat;'><div STYLE='background:url(/images/bottom_right.gif) right bottom no-repeat;'><div STYLE='margin: 0px 15px 0px 15px;padding: 0px;border-width: 0px;'><IMG NAME='top_border' BORDER=0 SRC="+'"images/top_border.gif"'+" WIDTH="+ (div_width - 29)  +" HEIGHT='15'><div style='background: #d5d5d5;margin: 0px;padding: 0px;border-width: 0px;'>";
  content_html = content_html.replace(/<!--class=content-->/g, replaceWith);
  replaceWith = "<div STYLE='background: url(/images/title_top_left.gif) left top no-repeat; '><div STYLE='background:url(/images/title_top_right.gif) right top no-repeat;'><div STYLE='background:url(/images/title_left_border.gif) 0px 15px no-repeat;'><div STYLE='background:url(/images/title_right_border.gif) right 15px no-repeat;'><div STYLE='margin: 0px 15px 0px 15px;padding: 0px;border-width: 0px;background: #adadad;'><IMG NAME='top_border' BORDER=0 SRC="+'"images/title_top_border.gif"'+" WIDTH="+ (div_width - 29)  +" HEIGHT='15'><div STYLE='background: #adadad;margin: 0px;padding: 0px;border-width: 0px;'>";
  content_html = content_html.replace(/<!--class=header-->/g, replaceWith);  
  replaceWith = "<div STYLE='background:url(/images/left_border.gif) 0px 0px repeat-y;'><div STYLE='background:url(/images/right_border.gif) right 0px repeat-y;'><div STYLE='background:url(/images/bottom_left.gif) left bottom no-repeat;'><div STYLE='background:url(/images/bottom_right.gif) right bottom no-repeat;'><div STYLE='background: #d5d5d5;margin: 0px 15px 0px 15px;padding: 0px;border-width: 0px;width=100%;height=1%'>";
  content_html = content_html.replace(/<!--class=follower-->/g, replaceWith);  
  replaceWith = "</div><IMG NAME='bottom_border' BORDER=0 SRC="+'"images/bottom_border.gif"'+" WIDTH="+ (div_width - 29)  +" HEIGHT='15'></div></div></div></div></div></div></div>";
  content_html = content_html.replace(/<!--end=content-->/g, replaceWith);  
  replaceWith = "</div></div></div></div></div></div>";
  content_html = content_html.replace(/<!--end=header-->/g, replaceWith);   
  replaceWith = "<IMG NAME='bottom_border' BORDER=0 SRC="+'"images/bottom_border.gif"'+" WIDTH="+ (div_width - 29)  +" HEIGHT='15'></div></div></div></div></div>";
  content_html = content_html.replace(/<!--end=follower-->/g, replaceWith);     
  replaceWith = "<div><img src='images/pixel.gif' height=6 width=6></div>";
  content_html = content_html.replace(/<!--class=table-spacer-->/g, replaceWith);      

  //dynamic news <!--news=news#subtitle=subtitle#href=href#align=align-->
  replaceWith = "<span class='news' style='position:relative;left:0;top:0;z-index:50;overflow: hidden;display:block;text-align: $8;width: "+Math.round(424/2048 * table_width) +"px;margin: 0px; padding: 0px;color:#FFFFFF;font-family: Arial, Helvetica, sans-serif;font-size: -f-21-f-px;'>";
  replaceWith += '<a href="news.php" border="0" onMouseOver="sub_title('+"'"+"$4"+"'"+',85,25,'+"'"+'5757dd'+"'"+')" onMouseOut="sub_title('+"'"+''+"'"+',75,50)">$2</a>';
  replaceWith += "</span>";
  content_html = content_html.replace(/(<!--news={1})([\s\S]*?)(#subtitle={1})([\s\S]*?)(#href={1})([\s\S]*?)(#align={1})([\s\S]*?)(-->{1})/g, replaceWith);   
  
  //dynamic news <!--menu=name#subtitle=subtitle#href=href#align=align-->
  replaceWith = "<span class='$10' style='position:relative;left:0;top:0;z-index:50;overflow: hidden;display:block;text-align: $8;width: "+(col_content_width-2)+"px;margin: 0px; padding: 0px;color:#FFFFFF;font-family: Arial, Helvetica, sans-serif;font-size: -f-21-f-px;'>";
  replaceWith += '<a href="$6" border="0" onMouseOver="sub_title('+"'"+"$4"+"'"+',85,25,'+"'"+'5757dd'+"'"+')" onMouseOut="sub_title('+"'"+''+"'"+',75,50)">$2</a>';
  replaceWith += "</span>";
  content_html = content_html.replace(/(<!--menu={1})([\s\S]*?)(#subtitle={1})([\s\S]*?)(#href={1})([\s\S]*?)(#align={1})([\s\S]*?)(#c={1})([\s\S]*?)(-->{1})/g, replaceWith);   
  
  //dynamic content_link <!--link=href#text=text#subtitle=subtitle-->
  replaceWith = "<span class='content_link'>";
  replaceWith += '<a href="$2" border="0" onMouseOver="sub_title('+"'"+"$6"+"'"+',85,25,'+"'"+'5757dd'+"'"+')" onMouseOut="sub_title('+"'"+''+"'"+',75,50)">$4</a>';
  replaceWith += "</span>";
  content_html = content_html.replace(/(<!--link={1})([\s\S]*?)(#text={1})([\s\S]*?)(#subtitle={1})([\s\S]*?)(-->{1})/g, replaceWith);     
  
  //dynamic content_link <!--pl=href#text=text-->
  replaceWith = '<a href="$2" border="0" rel="nofollow" target="blank">$4</a>';
  content_html = content_html.replace(/(<!--pl={1})([\s\S]*?)(#text={1})([\s\S]*?)(-->{1})/g, replaceWith);       
  
  replaceWith = "<img style='position:relative;left:0;top:0;z-index:50;' border=0 src='images/pixel.gif' width="+ (15/2048 * table_width)  +" height="+ (10/2048 * table_width) +">";
  content_html = content_html.replace(/(<!--class=bottom_gap-->)/g, replaceWith);        
  
  //dynamic 661x180 bottom advert replacing
  replaceWith = "<img style='position:relative;left:0;top:0;z-index:50;' border=0 src='images/"+media_path+"/$2' width="+ (661/2048 * table_width - 15)  +" height="+ (180/2048 * table_width - 4) +">";
  content_html = content_html.replace(/(<!--bottom_img={1})([\s\S]*?)(-->{1})/g, replaceWith);       
  
  replaceWith = 'register';
  content_html = content_html.replace(/form_place_holder/g, replaceWith);   
  
  //dynamic normal input replacing
  replaceWith = '<input style="background-color: #AAAAAA;border: 1px solid #000000;font-family: Arial, Helvetica, sans-serif;font-size: '+(Math.round(table_width/65)) +'px" type="$6" name="$2" id="$2" size="$4" value="" onMouseOver="sub_title('+"'"+"$8"+"'"+',85,25,'+"'"+'5757dd'+"'"+')" onMouseOut="sub_title('+"'"+''+"'"+',75,50)">';
  content_html = content_html.replace(/(<!--file=+?)([\S]*?)(#size=+?)([0-9]*?)(#type=+?)([\s\S]*?)(#subtitle=+?)([\s\S]*?)-->/g, replaceWith);       
  
  //dynamic form replacing
  replaceWith = "<form action='$2' method="+'"POST"'+" id='$4' name='$4' style='position:relative;left:0;top:0;z-index:50;margin: 0px;display: block;'>";
  content_html = content_html.replace(/(<!--form={1})([\S]*?)(#name={1})([\S\s]*?)(-->{1})/g, replaceWith);
  
  //dynamic menu input replacing
  replaceWith = '<input style="background-color: #555555;border: 1px solid #000000;color:#DDDDDD;font-family: Arial, Helvetica, sans-serif;font-size: '+(Math.round(table_width/65)) +'px" type="$6" name="$2" id="$2" size="$4" value="" onMouseOver="sub_title('+"'"+"$8"+"'"+',85,25,'+"'"+'5757dd'+"'"+')" onMouseOut="sub_title('+"'"+''+"'"+',75,50)">';
  content_html = content_html.replace(/(<!--menu_input=+?)([\S]*?)(#size=+?)([0-9]*?)(#type=+?)([\s\S]*?)(#subtitle=+?)([\s\S]*?)-->/g, replaceWith);     

  //dynamic select replacing
  <!--select=name#f=font size#b=background#bc=border color#c=color-->
  replaceWith = "<select style='background-color: #$6;border: 1px solid #$8;font-size: -size-$4-size-px;color:#$10;font-family: Arial, Helvetica, sans-serif;' id='$2' name='$2'>";
  content_html = content_html.replace(/(<!--select=+?)([\S\s]*?)(#f={1})([\S\s]*?)(#b={1})([\S]*?)(#bc={1})([\S]*?)(#c={1})([\S]*?)-->/g, replaceWith);  
  
  //dynamic option replacing
  replaceWith = "<option value='$4' selected>$2</option>";
  content_html = content_html.replace(/(<!--option={1})([\s\S]*?)(#value={1})([\s\S]*?)-->/g, replaceWith);   

  //dynamic submit replacing
  replaceWith = "<input style='background-color: #555555;border: 1px solid #000000;color:#DDDDDD;font-family: Arial, Helvetica, sans-serif;font-size: "+(Math.round(table_width/65)) +"px' type='submit' name='$2' id='$2' value='GO'>";
  content_html = content_html.replace(/(<!--submit=+?)([a-zA-Z0-9-_]*?)-->/g, replaceWith);   
      
  
 
  
  split_size=content_html.split("-size-"); 
  size_counter = 1;  
  content_html=( content_html.replace( new RegExp( "(-size-+?)([0-9.]*?)(-size-+?)", "g" ), get_size ) );
    
  split_varsize=content_html.split("-s-"); 
  varsize_counter = 1;  
  content_html=( content_html.replace( new RegExp( "(-s-+?)([0-9.]+?)(-s-+?)([0-9.]+?)(-s-+?)", "g" ), get_varsize ) );    
  
  split_fontsize=content_html.split("-f-"); 
  fontsize_counter = 1;  
  content_html=( content_html.replace( new RegExp( "(-f-+?)([0-9.]*?)(-f-+?)", "g" ), get_fontsize ) );    
  
  
    var reg = /<!--curve_content-->([\S\s]*)<!--end=curve_content-->/;
    var ar = reg.exec(content_html);    
    curve_content_html = ar[1];
    
    var reg = /<!--right_content-->([\S\s]*)<!--end=right_content-->/;
    var ar = reg.exec(content_html);    
    right_html = ar[1];   
    
    var reg = /<!--left_content-->([\S\s]*)<!--end=left_content-->/;
    var ar = reg.exec(content_html);    
    left_html = ar[1];   
    
    var reg = /<!--middle_content-->([\S\s]*)<!--end=middle_content-->/;
    var ar = reg.exec(content_html);    
    content_html = ar[1];      
    
    str="<span ID=top"
      + " STYLE='position:absolute;left:0;top:0;z-index:2'>"    
      + "<IMG NAME='header' BORDER=0 SRC="+'"images/'+rez_path +'/header.jpg"'+" WIDTH="+ table_width  +" height="+ header_height +"></span>";
    str+="<span ID=advertisement"
      + " STYLE='position:absolute;left:"+(491/2048 * table_width)  +";top:"+(16/2048 * table_width) +";z-index:3'>"    
      + '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="'+Math.round(648/2048 * table_width) +'" HEIGHT="'+Math.round(152/2048 * table_width)+'" ALIGN="center">'
      + '<PARAM NAME=movie VALUE="images/'+media_path+'/top_ad.swf">'
      + '<PARAM NAME=quality VALUE=high>'
      + '<PARAM NAME=LOOP VALUE="true">'
      + '<PARAM NAME="wmode" VALUE="Transparent" />'
      + '<EMBED SRC="images/'+media_path+'/top_ad.swf" wmode="Transparent" QUALITY=high WIDTH="'+Math.round(648/2048 * table_width) +'" HEIGHT="'+Math.round(152/2048 * table_width)+'" NAME="top_ad" ALIGN="center" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">'
      + '</EMBED>'
      + '</OBJECT>'      
      + "</span>";      
    str+="<span ID=advertisement2"
      + " STYLE='position:absolute;left:"+(1155/2048 * table_width)  +";top:"+(16/2048 * table_width) +";z-index:3'>"    
      + "<img name='advertisement' border=0 src="+'"images/'+media_path+'/curved_area.gif"'+" width="+ (414/2048 * table_width)  +"></span>";  
    str+="<span ID=advertisement3"
      + " STYLE='position:absolute;left:"+Math.round(1585/2048 * table_width)  +";top:"+Math.round(16/2048 * table_width) +";z-index:3'>"    
      + "<img name='advertisement' border=0 src="+'"images/right_area.gif"'+" width="+ Math.round(447/2048 * table_width) +" height="+ Math.round(204/2048 * table_width) +"></span>";                     
    str+="<span ID='subtitle_area'"
      + " STYLE='position:absolute;left:"+Math.round(1585/2048 * table_width)  +";top:"+Math.round(236/2048 * table_width) +";z-index:3'>"    
      + "<img name='advertisement' border=0 src="+'"images/subtitle_area.gif"'+" width="+ Math.round(447/2048 * table_width) +" height="+ Math.round(73/2048 * table_width) +"></span>";                     
    str+= "<span ID=content_background2"
      + " STYLE='position:absolute;left:0;top:"+ 0 +";z-index:1'>"
      + "<img name='left_col_background' id='left_col_background' border=0 src="+'"images/'+rez_path +'/content_back.jpg"' +" WIDTH="+table_width +" height="+ table_height +"></span>";
      
    str+= "<span ID=middle_content"
      + " STYLE='width: "+div_width +"px;position:absolute;left:"+ (col_width + (middle_width * .01)) +";top:"+offset_height +";z-index:10'>";
    str+= content_html+"\n";       
    str+= "</span>";   
    
    str+= "<span ID='curve_content'"
      + " STYLE='width: "+Math.round(424/2048 * table_width) +"px;height: "+Math.round(181/2048 * table_width) +"px;position:absolute;left:"+ Math.round(1596/2048 * table_width) +";top:"+Math.round(27/2048 * table_width) +";z-index:10;text-align: center;overflow: hidden;'>";
    str+= curve_content_html+"\n";       
    str+= "</span>";    
    
    str+= "<span ID='subtitle_content'"
      + " STYLE='width: "+Math.round(424/2048 * table_width) +"px;height: "+Math.round(50/2048 * table_width) +"px;position:absolute;left:"+ Math.round(1596/2048 * table_width) +";top:"+Math.round(247/2048 * table_width) +";z-index:10;overflow: hidden;'>";    
    str+= "</span>";   
    
    str += "<div ID='left content' STYLE='position:absolute;left:"+Math.round(15/2048 * table_width)+";top:"+offset_height+";z-index:15;width: "+col_item_width +"px;'>";
    str += left_html+"\n";
    str += "</div>";    
    
    str += "<div ID='right content' STYLE='position:absolute;left:"+right_offset+";top:"+(324/2048 * table_width)+";z-index:15;width: "+col_item_width +"px;'>";
    str += right_html+"\n";
    str += "</div>";
    
  //subtitle function
     sub_title = function subtitle(text,font,height,color) {
       html_str = "<span STYLE='color:#"+color+";font-family: Arial, Helvetica, sans-serif;line-height: "+Math.round(height/2048 * table_width) +"px;font-size: "+Math.round(table_width/font) +"px;font-weight: bold;'><center>"+text+"</center></span>";
       document.getElementById("subtitle_content").innerHTML=html_str; 
     }    
    
    arPopups = new Array();
    function setBeginEnd(which,from,to,top,bot,id) {
        arPopups[which] = new Array();
        arPopups[which][0] = from;
        arPopups[which][1] = to;
        arPopups[which][2] = top;
        arPopups[which][3] = bot;  
        arPopups[which][4] = id;      
    }
        //Crop Buttons
              
      
    
    str += "<div id='elMenu' style='position: absolute;top: "+Math.round(232/2048 * table_width)+";left: "+Math.round(491/2048 * table_width)+";z-index:25;width: "+Math.round(635/2048 * table_width)+"px;height: "+Math.round(73/2048 * table_width)+"px;'>";
    str +=     "<div id='elMenuUp' style='position: absolute;top: 0;left: 0;z-index:25;width: "+Math.round(635/2048 * table_width)+"px;height: "+Math.round(73/2048 * table_width)+"px;'>";
    str +=         "<img src='images/"+rez_path+"/top_buttons_off.gif' usemap='#mpMenu' width="+Math.round(635/2048 * table_width)+" height="+Math.round(73/2048 * table_width)+" border=0>";
    str +=     "</div>";
    str +=     "<div id='elMenuOver' style='position: absolute;top: 0;left: 0;z-index:25;visibility: hidden;width: "+Math.round(635/2048 * table_width)+"px;height: "+Math.round(73/2048 * table_width)+"px;'>";
    str +=          "<img src='images/"+rez_path+"/top_buttons_on.gif' usemap='#mpMenu' width="+Math.round(635/2048 * table_width)+" height="+Math.round(73/2048 * table_width)+" border=0>";
    str +=     "</div>";
    str += "</div>";
    
    str += "<div id='Logo' style='position: absolute;top:0;left:0;z-index:25;width: "+logo_width+"px;'>";
    str +=     "<div id='logoOff' style='position: absolute;top: 0;left: 0;z-index:25;width: "+Math.round(368/2048 * table_width)+"px;height: "+Math.round(310/2048 * table_width)+"px;'>";
    str +=         "<img id='logo' src='images/"+rez_path+"/logo.gif' usemap='#topLogo' width="+logo_width+" border=0 name='logo' id='logo'>";
    str +=     "</div>";
    str += "</div>";    
    
    
    str += "<map name='mpMenu'>";
    str +=   "<area shape='RECT' title=\"Home\" alt='Home' coords='0,0 "+Math.round(75/2048 * table_width)+","+Math.round(72/2048 * table_width)+"' HREF='home.php'";
    str +=     'onMouseOver="editorOver(true,\'Home\',60,50,\'5757dd\',0,0,'+Math.round(75/2048 * table_width)+','+Math.round(72/2048 * table_width)+',\'elMenuOver\')" onMouseOut="editorOver(false,\'\',75,50,\'5757dd\',\'\',\'\',\'\',\'\',\'elMenuOver\')">';
    str +=   "<area shape='RECT' title=\"Users\" alt='Users' coords='"+Math.round(87/2048 * table_width)+",0 "+Math.round(169/2048 * table_width)+","+Math.round(72/2048 * table_width)+"' HREF='users.php'";
    str +=     'onMouseOver="editorOver(true,\'Register/Login\',60,50,\'5757dd\','+Math.round(87/2048 * table_width)+',0,'+Math.round(169/2048 * table_width)+','+Math.round(72/2048 * table_width)+',\'elMenuOver\')" onMouseOut="editorOver(false,\'\',75,50,\'5757dd\',\'\',\'\',\'\',\'\',\'elMenuOver\')">';
    str +=   "<area shape='RECT' title=\"Forums\" alt='Forums' coords='"+Math.round(181/2048 * table_width)+",0 "+Math.round(262/2048 * table_width)+","+Math.round(72/2048 * table_width)+"' HREF='forums.php'";
    str +=     'onMouseOver="editorOver(true,\'Forums\',60,50,\'5757dd\','+Math.round(181/2048 * table_width)+',0,'+Math.round(262/2048 * table_width)+','+Math.round(72/2048 * table_width)+',\'elMenuOver\')" onMouseOut="editorOver(false,\'\',75,50,\'5757dd\',\'\',\'\',\'\',\'\',\'elMenuOver\')">';
    str +=   "<area shape='RECT' title=\"Firearms Database - Coming Soon\" alt='Firearms Database' coords='"+Math.round(274/2048 * table_width)+",0 "+Math.round(356/2048 * table_width)+","+Math.round(72/2048 * table_width)+"' HREF='coming_soon.php'";
    str +=     'onMouseOver="editorOver(true,\'Coming Soon\',60,50,\'5757dd\','+Math.round(274/2048 * table_width)+',0,'+Math.round(356/2048 * table_width)+','+Math.round(72/2048 * table_width)+',\'elMenuOver\')" onMouseOut="editorOver(false,\'\',75,50,\'5757dd\',\'\',\'\',\'\',\'\',\'elMenuOver\')">';
    str +=   "<area shape='RECT' title=\"Information Library - Coming Soon\"  alt='Firearms Information Library' coords='"+Math.round(367/2048 * table_width)+",0 "+Math.round(449/2048 * table_width)+","+Math.round(72/2048 * table_width)+"' HREF='coming_soon.php'";
    str +=     'onMouseOver="editorOver(true,\'Coming Soon\',60,50,\'5757dd\','+Math.round(367/2048 * table_width)+',0,'+Math.round(449/2048 * table_width)+','+Math.round(72/2048 * table_width)+',\'elMenuOver\')" onMouseOut="editorOver(false,\'\',75,50,\'5757dd\',\'\',\'\',\'\',\'\',\'elMenuOver\')">';
    str +=   "<area shape='RECT' title=\"Legal Library - Coming Soon\" alt='Legal Library' coords='"+Math.round(460/2048 * table_width)+",0 "+Math.round(542/2048 * table_width)+","+Math.round(72/2048 * table_width)+"' HREF='coming_soon.php'";
    str +=     'onMouseOver="editorOver(true,\'Coming Soon\',60,50,\'5757dd\','+Math.round(460/2048 * table_width)+',0,'+Math.round(542/2048 * table_width)+','+Math.round(72/2048 * table_width)+',\'elMenuOver\')" onMouseOut="editorOver(false,\'\',75,50,\'5757dd\',\'\',\'\',\'\',\'\',\'elMenuOver\')">';
    str +=   "<area shape='RECT' title=\"Store - Coming Soon\" alt='Store' coords='"+Math.round(553/2048 * table_width)+",0 "+Math.round(634/2048 * table_width)+","+Math.round(72/2048 * table_width)+"' HREF='coming_soon.php'";
    str +=     'onMouseOver="editorOver(true,\'Coming Soon\',60,50,\'5757dd\','+Math.round(553/2048 * table_width)+',0,'+Math.round(634/2048 * table_width)+','+Math.round(72/2048 * table_width)+',\'elMenuOver\')" onMouseOut="editorOver(false,\'\',75,50,\'5757dd\',\'\',\'\',\'\',\'\',\'elMenuOver\')">';
    str += "</map>";  

        
               
         
    
    str += "<MAP NAME='topLogo'>";
    str +=   "<AREA SHAPE='POLY' COORDS='0,"+Math.round(308/2048 * table_width)+","+Math.round(184/2048 * table_width)+",0,"+Math.round(368/2048 * table_width)+","+Math.round(308/2048 * table_width)+"' HREF='display.php' ";
    str +=     "onclick="+ '"' +"window.location.href = 'http://www.ar-15.com/display.php'"+ '"' +" onmouseover="+ '"' +"imgAct('logo'); window.status='Change Site Template'; return true"+ '"' +" onmouseout="+ '"' + "imgInact('logo'); window.status=''; return true"+ '"' +">";
    str += "</MAP>";   
    
  } 
document.getElementById("display2").innerHTML=str;
if(document.body.clientWidth){
 
  body_height = document.body.scrollHeight;

  bgstr = "<span ID=content_background"
      + " STYLE='position:absolute;left:0;top:0;z-index:1'>"
      + "<img name='left_col_background' BORDER=0 SRC="+'"images/'+rez_path +'/content_back.jpg"' +" WIDTH="+table_width +" height="+ body_height +" onLoad=move_anchor()></span>"; 
}
document.getElementById("background").innerHTML=bgstr;

   
  
      
  
}

if (document.images) { 
   logoon = new Image();
   logoon.src = "images/"+rez_path +"/logo_on.gif";
   
   logooff = new Image();
   logooff.src = "images/"+rez_path +"/logo.gif";
   
    siconplus = new Image();
    siconplus.src = "images/forum_icons/category_plus_grey.gif";    
    siconminus = new Image();
    siconminus.src = "images/forum_icons/category_minus_grey.gif";     
    miconplus = new Image();
    miconplus.src = "images/forum_icons/sub_plus_grey.gif";    
    miconminus = new Image();
    miconminus.src = "images/forum_icons/sub_minus_grey.gif";               
               
          
}

function imgAct(imgName) {
   if (document.images) {
      document[imgName].src = eval(imgName + "on.src");
   }
}

function imgInact(imgName) {
   if (document.images) {
      document[imgName].src = eval(imgName + "off.src");
   }
}

function get_table_width() {
  return(table_width);
}  
function get_resolution() {
  return(rez_path);
}
function get_media_path() {
  return(media_path);
}  

function get_margin_size() {
  var adjusted_size = Math.round(table_width/250);
  var font_size = adjusted_size+'px';
  return(font_size );
}  

