var browserName	=	navigator.appName;
var box_height = scroll_height;
if (header_display == "none") {
	box_height=(box_height+53);
}

qs = location.search.substring(1, location.search.length);
var pair = qs.split('=');
var date = decodeURIComponent(pair[1]);

var parameter = "?type="+type+"&border_color="+border_color+"&link_color="+link_color+"&background="+background+"&header_display="+header_display+"&header_background="+header_background+"&header_color="+header_color+"&topic_font_face="+topic_font_face+"&topic_font_size="+topic_font_size+"&topic_font_color="+topic_font_color+"&desc_font_face="+desc_font_face+"&desc_font_size="+desc_font_size+"&desc_font_color="+desc_font_color+"&heading_font_size="+(topic_font_size+2)+"&page_title="+page_title+"&box_height="+box_height+"&weekly_filename="+weekly_filename+"&archive_filename="+archive_filename+"&datelist_filename="+datelist_filename+"&date="+date;
if (type == 'archive') {
	var srclink = "http://www.workplacefairness.org/wfweekly/js/archive.php"+parameter;
	var scrolling = "no";
} else if (type == 'datelist') {
	var srclink = "http://www.workplacefairness.org/wfweekly/js/archive-dates.php"+parameter;
	var scrolling = "no";
} else {
	var srclink = "http://www.workplacefairness.org/wfweekly/js/weekly.php"+parameter;
	var scrolling = "no";
}

$(function(){
  
  // Keep track of the iframe height.
  var if_height,
  
    // Pass the parent page URL into the Iframe in a meaningful way (this URL could be
    // passed via query string or hard coded into the child page, it depends on your needs).
    src = srclink + '#' + encodeURIComponent( document.location.href ),
    
    // Append the Iframe into the DOM.
    iframe = $( '<iframe " src="' + src + '" width="100%" height="' + box_height + '" scrolling="' + scrolling + '" frameborder="0"><\/iframe>' )
      .appendTo( '#iframe' );
  
  // Setup a callback to handle the dispatched MessageEvent event. In cases where
  // window.postMessage is supported, the passed event will have .data, .origin and
  // .source properties. Otherwise, this will only have the .data property.
  $.receiveMessage(function(e){
    
    // Get the height from the passsed data.
    var h = Number( e.data.replace( /.*if_height=(\d+)(?:&|$)/, '$1' ) );
    
    if ( !isNaN( h ) && h > 0 && h !== if_height ) {
      // Height has changed, update the iframe.
      iframe.height( if_height = h );
    }
    
  // An optional origin URL (Ignored where window.postMessage is unsupported).
  }, 'http://www.workplacefairness.org' );
  
  // And for good measure, let's send a toggle_content message to the child.
  $( '<a href="#">Show / hide Iframe content<\/a>' )
    .appendTo( '#nav' )
    .click(function(){
      $.postMessage( 'toggle_content', src, iframe.get(0).contentWindow );
      return false;
    });
  
});

document.write('<div id="iframe"></div>');