//######################
// framebuster
//  alert("framebuster script started")
  if (window != top) {
//      alert("window is not top");
//      alert(top.location.href.indexOf("rxs-enterprises"));
      if (top.location.href.indexOf("rxs-enterprises")<0) {
//          alert("rxs-enterprises is negative");
          top.location.href = "http://www.rxs-enterprises.org/attack.aspx";
      }
      else {
//          alert("rxs-enterprises is 0 or more");
//          alert(location.href);
          if (location.href.indexOf("discussion-web")<0) {
//    	      alert("discussion web is less than 0");
              top.location.href = location.href;
          }
      }
  }
//  else {
//      alert("window is top");
//  }
 
//##############################
//Jimco Spawn
function spawnJimcoPopup(url, name, options, h, w, x, y, scaleType)
{
   var windowOptions;
   if (scaleType == 'percent')
   {
     w = (w * screen.availWidth) / 100;
     h = (h * screen.availHeight) / 100;
   }
   if (x == 'center')
   {
     x = (screen.availWidth - w) / 2;
     y = (screen.availHeight - h) / 2;
   }
   windowOptions = options + ',width=' + w + ',height=' + h + ',left=' + x + ',top=' + y;
   newWindow = window.open(url, name, windowOptions);
   newWindow.focus();
}
//#################################
$(document).ready(function() {
// previouspage / closepage
	var Footpage = {
		init: function() {
			var cpy = $("#cpyrt");
			if (cpy.length > 0) {
				var txt = "";
				var wdw = "";
				wdw = window.name;
				if (wdw.length > 0) {
					if ((wdw == "npas") || (wdw == "npa2") || (wdw == "print")) {
						txt = "[&nbsp<a href='javascript:window.close()'>Close this window/tab</a>&nbsp;]<br />";
					}
				}
	  			else {
	    			if (document.referrer.length > 0) {
	      				var lcn = document.referrer;
	      				var dmn = document.domain;
	      				if (lcn.length >= dmn.length && dmn.length > 0) {
	      					var strt = lcn.indexOf(dmn);
	      					if (strt >= 0) {
	        					txt = "[&nbsp;<a href='javascript:history.go(-1)'>Previous Page</a>&nbsp;]<br />";
							}
						}
					}
				}
				var dd = new Date();
	  			var yy = dd.getUTCFullYear();
	  			cpy[0].innerHTML = txt + "&copy;-Copyright&nbsp; 1999-" + yy + "&nbsp; RxS Enterprises.&nbsp; All rights reserved.";
	  		}
		}
	}
	Footpage.init();
	//##########################

// Modify styles to accomodate wide graphics
	var WideGraphs = {
		init:function() {
			var imgs = $("img");
			for (var i = 0, ii = imgs.length; i < ii; i++) {
				//alert(imgs[i].width);
				if (imgs[i].width > 500) {
					if ($('#ctt').css('width')=='71%') {
						$('#left').width('18%');
						$('#ctt').width('80%');
					}
					i = ii+1
				}
			}
		}
	}
	WideGraphs.init();
			
// Force external links to new window - not XHTML compatible
	var ExtLinks = {
		init: function() {
			var links = $("a");
			for (var i = 0, ii = links.length; i < ii; i++) {
				var lkclass = links[i].className;
				if (!((lkclass.length > 0) && (lkclass.indexOf("noicon") > -1))) {
					var lkref = links[i].getAttribute("href");
					if (lkref != null) {
						if (lkref.substring(0,4) == "http" && lkref.indexOf(document.domain) < 0) {
	   						links[i].target = "";
	   						links[i].title = links[i].title + " - Leave this site"; 
	   						if (lkclass.length > 0) {
	   							links[i].className = lkclass + " lvsite";
	   						}
	   						else {
	   							links[i].className = "lvsite";
	   						}
						}
						var lktgt = links[i].target;
						if ((lktgt.length > 0) || (lkref.indexOf(".pdf") > -1)) {
							links[i].title = links[i].title + " - Opens in a new window or tab.";
							if (lktgt.length < 1) {
								links[i].target = "npas"
							}
	   						if (lkclass.length > 0) {
	   							links[i].className = lkclass + " wndw";
	   						}
	   						else {
	   							links[i].className = "wndw";
	   						}
	   					}
					}
				} 
			}
		}
	}
	ExtLinks.init();
	//#################################
	//force #ctt height to same as left border height
	// This goes last in the onload functions since earlier functions may change the page size.
	if ($('#wrap').length < 1) {
	$(window).resize(function() {
		cttresize();
	});
	}
	if ($('#wrap').length < 1) {
	var Cttsize = {
		init: function() {
			cttresize();
		}
	}
	Cttsize.init();	
	}
	//}
});
function cttresize() {
	if ($('#wrap').length < 1) {
		var lfht = $('#left').height() + 20;
		var ctht = $('#ctt').height();
		if (ctht < lfht) {
			$('#ctt').css('height',lfht + 'px');
		}
	}
}
function ctt1resize() {
	if ($('#wrap').length < 1) {
		var lfht = $('#left').height() + 20;
		var ctht = $('#ctt1').height();
		if (ctht < lfht) {
			$('#ctt1').css('height',lfht + 'px');
		}
	}
}

