 var viewportwidth;
 var viewportheight;
 
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 if (typeof window.innerWidth != 'undefined')
 {
	  //alert(getScrollerWidth());
	  
	  viewportwidth = window.innerWidth - getScrollerWidth(),
	  viewportheight = window.innerHeight
 }
 // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
 else if (typeof document.documentElement != 'undefined'
	 && typeof document.documentElement.clientWidth !=
	 'undefined' && document.documentElement.clientWidth != 0)
 {
	   viewportwidth = document.documentElement.clientWidth,
	   viewportheight = document.documentElement.clientHeight
 }
 // older versions of IE
 else
 {
	   viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
	   viewportheight = document.getElementsByTagName('body')[0].clientHeight
 }

var tempcolor_newzboardBackground = newzboardBackground.replace("#","pound");
var tempcolor_newzboardText = newzboardText.replace("#","pound");
var tempcolor_newzboardLink = newzboardLink.replace("#","pound");
var tempcolor_newzboardLinkhover = newzboardLinkhover.replace("#","pound");

document.write('<style type="text/css">DIV#newzboard_mainwindow_' + newzboardmyid + ' { position:absolute; z-index:10000; background-color:#000; height:505px; width:850px; top:0px; left:0px; border:1px solid #888; } DIV#newzboard_mainwindow_shadow { position:absolute; z-index:9000; background-color:#000000; filter:alpha(opacity=80);-moz-opacity:.80;opacity:.80; top:0px; left:0px; } DIV#newzboardIframe_' + newzboardmyid + ' A.newzboard_link_color { color:' + newzboardLink + '; font-weight:normal; text-decoration:underline; } DIV#newzboardIframe_' + newzboardmyid + ' A.newzboard_link_color:HOVER { color:' + newzboardLinkhover + '; text-decoration:underline; } DIV#newzboard_mainwindow_' + newzboardmyid + ' A { color:' + newzboardLink + '; } DIV#newzboard_mainwindow_' + newzboardmyid + ' A:HOVER { color:' + newzboardLinkhover + '; }</style>');
document.write('<div id="newzboard_mainwindow_shadow" style="display: none;"></div>');
document.write('<div id="newzboard_mainwindow_' + newzboardmyid + '" style="display: none;"><div onclick="newzboard_closeWindow(\'' + newzboardmyid + '\');" style="background-color:black; color:white; text-align:right; font-size:10px; padding:4px; font-weight:bold; cursor: pointer; font-family:arial;"><span style="color:red;">X</span> Close Window</div><div id="newzboard_newspost_' + newzboardmyid + '"></div></div>');

document.getElementById('newzboard_mainwindow_shadow').style.height = viewportheight + 'px';
document.getElementById('newzboard_mainwindow_shadow').style.width = viewportwidth + 'px';

var newzboardHeight = newzboardHeight - 14;
document.write('<div style=\"padding:0px; float:none; margin:0px auto 0px auto; width:' + newzboardWidth + 'px;\"><div id=\"newzboardIframe_' + newzboardmyid + '\" style=\"position:relative; float:none; height:' + newzboardHeight + 'px; width:' + newzboardWidth + 'px; background-color:' + newzboardBackground +'; text-align:left;\"></div>');
document.write('<iframe width=\"' + newzboardWidth + 'px\" height=\"14px\" style=\"border:0px;\" src =\"http://www.newzboard.com/newsfooter.cfm?id=' + newzboardmyid + '&backgroundcolor=' + tempcolor_newzboardBackground + '&textcolor=' + tempcolor_newzboardText + '&linkcolor=' + tempcolor_newzboardLink + '&linkhovercolor=' + tempcolor_newzboardLinkhover + '\" frameborder=\"0\" scrolling=\"no\" id=\"newzboardIframeFooter\"></iframe></div>');

function sendRequest(id){
    // create <script> element
    var js=document.createElement('script');
    // assign <script> attributes
    js.setAttribute('language','javascript');
    //js.setAttribute('src','http://www.newzboard.com/convertdata.cfm?id=' + id + '&textcolor=' + newzboardText + '&linkcolor=' + newzboardLink + '&linkhovercolor=' + newzboardLinkhover + '&numberOfPosts=' + newzboardNumberOfPosts + '&backgroundcolor=' + newzboardBackground);
	js.setAttribute('src','http://www.newzboard.com/convertdata.cfm?id=' + id + '&textcolor=' + tempcolor_newzboardText + '&numberOfPosts=' + newzboardNumberOfPosts + '&backgroundcolor=' + tempcolor_newzboardBackground);
    // append element to document tree & send GET request
    document.getElementsByTagName('head')[0].appendChild(js);
}

sendRequest(newzboardmyid);

function newzboard_positionWindow(postnewzid){
			
	userScreenWidth = viewportwidth;
	userScreenHeight = viewportheight;
	
	//alert(userScreenWidth + '    ' + userScreenHeight);
	
	/* setTop = ((userScreenHeight - 600)/2) - 100; */
	setTop = ((userScreenHeight - 505)/2);
	setLeft = ((userScreenWidth - 850)/2);
	
	//alert(setTop);
	//alert(setLeft);
	
	top.document.getElementById('newzboard_mainwindow_' + postnewzid).style.top = setTop + 'px';
	top.document.getElementById('newzboard_mainwindow_' + postnewzid).style.left = setLeft + 'px';
	
}

function newzboard_positionWindow_shadow(){

	userScreenWidth = viewportwidth;
	userScreenHeight = viewportheight;
	
	//alert(userScreenWidth + '    ' + userScreenHeight);
	
	setTop = ((userScreenHeight - 575)/2) - 100;
	setLeft = ((userScreenWidth - 850)/2);
	
	setTop = setTop + 7;
	setLeft = setLeft - 7;
	
	//alert(setTop);
	//alert(setLeft);
	
	top.document.getElementById('newzboard_mainwindow_shadow').style.top = setTop + 'px';
	top.document.getElementById('newzboard_mainwindow_shadow').style.left = setLeft + 'px';
	
}

function newzboard_closeWindow(postnewzid){
	top.document.getElementById('newzboard_mainwindow_' + postnewzid).style.display = 'none';
	top.document.getElementById('newzboard_mainwindow_shadow').style.display = 'none';
}

function newzboard_openWindow(myid, newspostid, site, posttextcolor, postbackgroundcolor, postnewzid){
	newzboard_positionWindow(postnewzid);
	//newzboard_positionWindow_shadow();
	

//document.getElementById('newzboard_newspost').innerHTML = '<iframe src =\"' + site + '/newspost.cfm?id=' + myid + '&newspostid=' + newspostid + '&textcolor=' + newzboardText + '&linkcolor=' + newzboardLink + '&linkhovercolor=' + newzboardLinkhover + '&numberOfPosts=' + newzboardNumberOfPosts + '&backgroundcolor=' + newzboardBackground + '\" width=\"100%\" height=\"480px\"  frameborder=\"0\"></iframe>';
	 // create <script> element
    var js=document.createElement('script');
    // assign <script> attributes
   js.setAttribute('language','javascript');
    //js.setAttribute('src',site + '/newspost.cfm?id=' + myid + '&newspostid=' + newspostid + '&textcolor=' + newzboardText + '&linkcolor=' + newzboardLink + '&linkhovercolor=' + newzboardLinkhover + '&numberOfPosts=' + newzboardNumberOfPosts + '&backgroundcolor=' + newzboardBackground);
	js.setAttribute('src',site + '/newspost.cfm?id=' + myid + '&newspostid=' + newspostid + '&textcolor=' + posttextcolor + '&numberOfPosts=' + newzboardNumberOfPosts + '&backgroundcolor=' + postbackgroundcolor);
    // append element to document tree & send GET request
    document.getElementsByTagName('head')[0].appendChild(js);
	

	window.scrollTo(0,0);

	document.getElementById('newzboard_mainwindow_' + postnewzid).style.display = 'block';
	document.getElementById('newzboard_mainwindow_shadow').style.display = 'block';

} 

function newzboard_openShareWindow(myid, site, posttextcolor, postbackgroundcolor, postnewzid){
	newzboard_positionWindow(postnewzid);
    var js=document.createElement('script');
    js.setAttribute('language','javascript');
	js.setAttribute('src',site + '/newspost.cfm?id=' + myid + '&textcolor=' + posttextcolor + '&numberOfPosts=' + newzboardNumberOfPosts + '&backgroundcolor=' + postbackgroundcolor + '&shareview&postnewzid=' + postnewzid);
    // append element to document tree & send GET request
    document.getElementsByTagName('head')[0].appendChild(js);
	
	window.scrollTo(0,0);

	document.getElementById('newzboard_mainwindow_' + postnewzid).style.display = 'block';
	document.getElementById('newzboard_mainwindow_shadow').style.display = 'block';
} 

function openBrWindow(theURL,winName,width,height,features) { //v2.0
  
 // Fudge factors for window decoration space.
  // In my tests these work well on all platforms & browsers.
  w = width + 32;
  h = height + 96;

  wleft = (screen.width - w) / 2;
  wtop = (screen.height - h) / 2;
  // IE5 and other old browsers might allow a window that is
  // partially offscreen or wider than the screen. Fix that.
  // (Newer browsers fix this for us, but let's be thorough.)
  if (wleft < 0) {
    w = screen.width;
    wleft = 0;
  }
  if (wtop < 0) {
    h = screen.height;
    wtop = 0;
  }
  var win = window.open(theURL,
    winName,
    'width=' + w + ', height=' + h + ', ' +
    'left=' + wleft + ', top=' + wtop + ', ' +
    features);


  // Just in case width and height are ignored
  win.resizeTo(w, h);
  // Just in case left and top are ignored
  win.moveTo(wleft, wtop);
  win.focus();
  
}

function getScrollerWidth() {
    var scr = null;
    var inn = null;
    var wNoScroll = 0;
    var wScroll = 0;

    // Outer scrolling div
    scr = document.createElement('div');
    scr.style.position = 'absolute';
    scr.style.top = '-1000px';
    scr.style.left = '-1000px';
    scr.style.width = '100px';
    scr.style.height = '50px';
    // Start with no scrollbar
    scr.style.overflow = 'hidden';

    // Inner content div
    inn = document.createElement('div');
    inn.style.width = '100%';
    inn.style.height = '200px';

    // Put the inner div in the scrolling div
    scr.appendChild(inn);
    // Append the scrolling div to the doc
    document.body.appendChild(scr);

    // Width of the inner div sans scrollbar
    wNoScroll = inn.offsetWidth;
    // Add the scrollbar
    scr.style.overflow = 'auto';
    // Width of the inner div width scrollbar
    wScroll = inn.offsetWidth;

    // Remove the scrolling div from the doc
    document.body.removeChild(
        document.body.lastChild);

    // Pixel width of the scroller
    return (wNoScroll - wScroll);
}



















     
