//Copyright Design Solutions, All rights reserved.
//Any use without express permission from Jeff Margenau at Design Solutions is expressly prohibited.For inquiries, contact Jeff Margenau at j@xmlo.com, 920-568-3468 or by writing Jeff Margenau c/o Design Solutions, 1016 Heth, Fort Atkinson, WI 53538-1216

pic1= new Image(16,16); 
pic1.src="http://nexusnews.us/images/006699_ajax-loader.gif"; 
pic2= new Image(16,16); 
pic2.src="http://nexusnews.us/images/006699_ajax-loader0.gif"; 
var selcol;
var selrow;
var seldivid;
var seldivh;
var seldivw
var replacediv="";
var dragon=0;
var donemifd=0;
var counter=0;
var freemove=0;
var columnvar;
var o;
var rowvar;
var furlid=new Array([],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]);
var textx=new Array([],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]);
for (y=1;y<4;y++){
for (x=1;x<11;x++){
textx[y][x]='empty text cell';furlid[y][x]='';
}}

function Browser() {
 
  var ua, s, i;
 
  this.isIE    = false;
  this.isNS    = false;
  this.version = null;
 
  ua = navigator.userAgent;
 
  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }
 
  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }
 
  // Treat any other "Gecko" browser as NS 6.1.
 
  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}
 
var browser = new Browser();
 
// Global object to hold drag information.

var Drag = {

	obj : null,

	init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper)
	{
		o.onmousedown	= Drag.start;

		o.hmode			= bSwapHorzRef ? false : true ;
		o.vmode			= bSwapVertRef ? false : true ;

		o.root = oRoot && oRoot != null ? oRoot : o ;

		if (o.hmode  && isNaN(parseInt(o.root.style.left  ))) o.root.style.left   = "0px";
		if (o.vmode  && isNaN(parseInt(o.root.style.top   ))) o.root.style.top    = "0px";
		if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right  = "0px";
		if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px";

		o.minX	= typeof minX != 'undefined' ? minX : null;
		o.minY	= typeof minY != 'undefined' ? minY : null;
		o.maxX	= typeof maxX != 'undefined' ? maxX : null;
		o.maxY	= typeof maxY != 'undefined' ? maxY : null;

		o.xMapper = fXMapper ? fXMapper : null;
		o.yMapper = fYMapper ? fYMapper : null;

		o.root.onDragStart	= new Function();
		o.root.onDragEnd	= new Function();
		o.root.onDrag		= new Function();
	},

	start : function(e)
	{
		var o = Drag.obj = this;
		e = Drag.fixE(e);
		var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
		var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
		o.root.onDragStart(x, y);
		
		seldivid=o.root.id;
		o.lastMouseX	= e.clientX;
		o.lastMouseY	= e.clientY;

		if (o.hmode) {
			if (o.minX != null)	o.minMouseX	= e.clientX - x + o.minX;
			if (o.maxX != null)	o.maxMouseX	= o.minMouseX + o.maxX - o.minX;
		} else {
			if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x;
			if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x;
		}

		if (o.vmode) {
			if (o.minY != null)	o.minMouseY	= e.clientY - y + o.minY;
			if (o.maxY != null)	o.maxMouseY	= o.minMouseY + o.maxY - o.minY;
		} else {
			if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y;
			if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y;
		}

		document.onmousemove	= Drag.drag;
		document.onmouseup		= Drag.end;

		return false;
	},

	drag : function(e)
	{
		dragon=1;
		e = Drag.fixE(e);
		o = Drag.obj;
		o.root.style.background="#ffffff";
		if (browser.isIE)o.root.style.zIndex="10";
		if (browser.isNS)o.root.style.zIndex="0";
		//seldivw=o.root.style.right-o.root.style.left;alert(seldivw)
		//seldivh=o.root.style.bottom-o.root.style.top;

		var ey	= e.clientY;
		var ex	= e.clientX;
		var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
		var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
		var nx, ny;

		if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);
		if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);
		if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);
		if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);

		nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
		ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));

		if (o.xMapper)		nx = o.xMapper(y)
		else if (o.yMapper)	ny = o.yMapper(x)

		Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";
		Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";
		Drag.obj.lastMouseX	= ex;
		Drag.obj.lastMouseY	= ey;

		Drag.obj.root.onDrag(nx, ny);
		return false;
	},

	end : function()
	{
		dragon=0
		Drag.obj.root.style.background="#ffffff";
		if(replacediv!=""){
		slidedowndiv=document.getElementById(replacediv)
		sr=slidedowndiv.id.substring(3,slidedowndiv.id.length)
		slidedowndiv.parentNode.insertBefore(Drag.obj, slidedowndiv)
		slidedowndiv.style.background="#ffffff";
		cr=Drag.obj.id.substring(3,Drag.obj.id.length)
		//alert(furlid[cr.substring(0,1)*1][cr.substring(1,2)*1])
	//alert(cr+","+sr.substring(0,1)*1+","+sr.substring(1,2)+","+cr.substring(0,1)*1+","+cr.substring(1,2)*1+","+furlid[cr.substring(0,1)*1][cr.substring(1,2)*1])
callToServerx(cr,sr) 
//callToServerx(cr,sr.substring(0,1)*1,sr.substring(1,2),cr.substring(0,1)*1,cr.substring(1,2)*1,furlid[cr.substring(0,1)*1][cr.substring(1,2)*1]) 
//		} else {
//		if(freemove!=1 || replacediv==""){
		
		}
		Drag.obj.root.style.top=y-4;
		Drag.obj.root.style.left=x-11;
		Drag.obj.root.style.zIndex="1";
		document.onmousemove = null;
		document.onmouseup   = null;
		Drag.obj.root.onDragEnd(	parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]), 
									parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"]));
		Drag.obj = null;
	},

	fixE : function(e)
	{
		if (typeof e == 'undefined') e = window.event;
		if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
		if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
		return e;
	}
}; 


function mifd() {
donemifd=1;
for (y=1;y<4;y++){
for (x=1;x<11;x++){
	 if(furlid[y][x]!=""){
	 ifrm = document.createElement("iframe");
   ifrm.id="frame"+furlid[y][x];
   ifrm.name="frame"+furlid[y][x];
   ifrm.setAttribute("src", "rss_feed_generic.php?urlid="+furlid[y][x]);
   ifrm.style.width = "0";
   ifrm.style.height = "0";
   document.getElementById("iframex").appendChild(ifrm);
	 idiv = document.createElement("div");
	 if(x==1&&y==1)idiv.innerHTML='<img alt="Loading..." src="images/006699_ajax-loader.gif" height="16" width="16"  />';
   idiv.id="div"+furlid[y][x];
   idiv.name="div"+furlid[y][x];
	 columnx="column"+y;
	 idiv.style.position='relative';
	 idiv.style.left='0';
	 idiv.style.top='0';
	 idiv.style.zIndex='1';
   idiv.onmouseover = function () {if(dragon==1 && seldivid!=this.id){
this.style.background="#cccccc";
this.style.filter = "alpha(opacity=10)";
//this.style.-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(opacity=10)";
this.style.opacity=".10";
replacediv=this.id
columnvar=y;
rowvar=x;
//PlaceHolder = document.createElement("DIV");
//PlaceHolder.className = "root";
//PlaceHolder.style.backgroundColor = "rgb(225,225,225)";
//PlaceHolder.SourceI = null;
//PlaceHolder.style.height = "200px";
//PlaceHolder.style.width = "100%";
//document.getElementById(replacediv).parentNode.insertBefore(PlaceHolder, document.getElementById(replacediv))
//PlaceHolder.SourceI = document.getElementById(replacediv);
}
}
idiv.onmouseout = function () {if(dragon==1 && seldivid!=this.id)
this.style.background="#ffffff";
this.style.filter = "alpha(opacity=100)";
//this.style.-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(opacity=100)";
this.style.opacity="1";
replacediv=""

}
   document.getElementById(columnx).appendChild(idiv);
	 Drag.init(idiv);
}}}

	 wrok = document.createElement("iframe");
	 wrok.id="wrok";
	 wrok.name="wrok";
	 wrok.style.width="0";
	 wrok.style.height="0";
//   wrok.setAttribute("src", null);
	 document.getElementById("iframex").appendChild(wrok);
}

// addListener(window, 'load', myFunction);
function addListener(element, type, expression, bubbling)
{
	bubbling = bubbling || false;
	
	if(window.addEventListener)	{ // Standard
		element.addEventListener(type, expression, bubbling);
		return true;
	} else if(window.attachEvent) { // IE
		element.attachEvent('on' + type, expression);
		return true;
	} else return false;
}

function loader(fid){
cb='circleball'+fid
fr='frame'+fid
document.images[cb].src='images/006699_ajax-loader.gif';
IFrameObj=document.getElementById(fr)
  if (IFrameObj.contentDocument){IFrameDoc = IFrameObj.contentDocument;}
	 else if (IFrameObj.contentWindow){IFrameDoc = IFrameObj.contentWindow.document;}
	  else if (IFrameObj.document) {IFrameDoc = IFrameObj.document;} else {return true;}
IFrameDoc.location.reload();
}

function buildQueryString(theFormName) {
  theForm = document.forms[theFormName];
  var qs = ''
  for (e=0;e<theForm.elements.length;e++) {
    if (theForm.elements[e].name!='') {
      qs+=(qs=='')?'?':'&'
      qs+=theForm.elements[e].name+'='+escape(theForm.elements[e].value)
      }
    }
  return qs
}

var URL
var IFrameDoc
var IFrameObj; // our IFrame object
var IDivObj; // our IDiv object
var IDivDoc
var fid
var theFormName
var cb

function callToServer(theFormName,fdid) {
if (!document.createElement) {return true};
cb='circleball'+fdid
fid='frame'+fdid
URL = 'function_editfeedy.php' + buildQueryString(theFormName);
document.images[cb].src='images/006699_ajax-loader.gif';
IFrameObj=document.getElementById(fid)
  if (IFrameObj.contentDocument) {
    // For NS6
    IFrameDoc = IFrameObj.contentDocument; 
  } else if (IFrameObj.contentWindow) {
    // For IE5.5 and IE6
    IFrameDoc = IFrameObj.contentWindow.document;
  } else if (IFrameObj.document) {
    // For IE5
    IFrameDoc = IFrameObj.document;
  } else {
    return true;
  }
	IFrameDoc.location.replace(URL);
  return false;
}

function callToServerx(urlid,urlidx) {
cb='circleball'+urlid
fid='wrok'
URL = 'function_movefeedx.php?urlid='+urlid+'&urlidx='+urlidx;
IFrameObj=document.getElementById(fid)
  if (IFrameObj.contentDocument) {
    // For NS6
    IFrameDoc = IFrameObj.contentDocument; 
  } else if (IFrameObj.contentWindow) {
    // For IE5.5 and IE6
    IFrameDoc = IFrameObj.contentWindow.document;
  } else if (IFrameObj.document) {
    // For IE5
    IFrameDoc = IFrameObj.document;
  } else {
    return true;
  }
IFrameDoc.location.replace(URL);
  return false;
}

function callToServerxxxx(theFormName,urlidx) {
fid='wrok'
URL = 'function_deletefeedx.php?urlid='+urlidx;
IFrameObj=document.getElementById(fid)
IDivObj=document.getElementById("div"+urlidx)
  if (IFrameObj.contentDocument) {
    // For NS6
    IFrameDoc = IFrameObj.contentDocument; 
  } else if (IFrameObj.contentWindow) {
    // For IE5.5 and IE6
    IFrameDoc = IFrameObj.contentWindow.document;
  } else if (IFrameObj.document) {
    // For IE5
    IFrameDoc = IFrameObj.document;
  } else {
    return true;
  }
IFrameDoc.location.replace(URL);
IDivObj.style.display="none";
  return false;
}


function confirmSubmit()
{
var agree=confirm("This will delete this feed from your page.  Click OK to delete or Cancel to return.");
if (agree)
	return false ;
else
	return false ;
}

function handleResponse(msg) {
}

function rsseditform(fid,sho){
formtype="feedform";
display=sho==0?"none":"block"
dr=formtype+fid
document.getElementById(dr).style.display=display;
}

function rssdeleteform(fid,sho){
formtype="deleteform";
display=sho==0?"none":"block"
dr=formtype+fid
document.getElementById(dr).style.display=display;
}

;furlid[1][1]='20520';furlid[1][2]='20521';furlid[1][3]='20522';furlid[1][4]='20523';furlid[1][5]='20524';furlid[1][6]='20525';furlid[2][1]='20526';furlid[2][2]='20527';furlid[2][3]='20528';furlid[2][4]='20529';furlid[2][5]='20530';furlid[3][1]='20532';furlid[3][2]='20533';furlid[3][3]='20534';furlid[3][4]='20535';furlid[3][5]='20536';furlid[3][6]='20537';furlid[3][7]='20538';furlid[3][8]='20531'
