function IFpopwindow(w,h,url,fname,drag,shield,lf,tp,obname) {
	this.ob = this;
	this.wd = w;
	this.ht = h;
	this.urlPop = (url!="")? url:"/include/msgmaker.asp";
	this.frmname = (fname!="")? fname:"popFrame";
	this.dodrag = drag;
	this.doshield = shield;
	this.wleft = (typeof(lf)!="undefined")? lf:-1;
	this.wtop = (typeof(tp)!="undefined")? tp:-1;
	this.objname = (typeof(obname)!="undefined")? obname:null;
	this.obj = eval("parent."+this.objname);
	
	this.ah = 0;
	this.aw = 0;
	this.limitleft = 0;
	this.limitright = 0;
	this.shadow = false;

	this.popstate = 0;
	
	this.init = renderPopFrame;
	this.popit = popPopup;
	this.getsizes = sizeIWindow;
	this.seturlPop = setPopSource;
	this.closeit = closePopup;
	//this.killme = killPopup;
	this.genShields = generateShield;
	
	this.getsizes();
	this.resizeit = resizePop;
	
	this.init();
	this.seturlPop(this.urlPop);
	return false;
}

function renderPopFrame() {
	var fname = this.frmname;
	var writediv = true;
	
	if(typeof(pstyle)!="undefined")
		if(pstyle.dynaform) writediv = false;
	
	if(writediv) {
		var hstr = "";
		//alert(parseInt(this.ht));
		hstr+= "<iframe name=\""+ fname +"\" id=\""+ fname +"\" src=\"\" scrolling=\"no\" frameborder=\"0\" ";
		hstr+= "width=\""+ this.wd +"\" height=\""+ parseInt(this.ht) +"\" ";
		hstr+= "style=\"position:absolute; visibility:hidden; z-index:300;height:"+ parseInt(this.ht) +"px;width:"+ this.wd +"px;\"></iframe>";
		
		if(document.body.insertAdjacentHTML) document.body.insertAdjacentHTML("afterBegin",hstr)
		else {
			var r = document.body.ownerDocument.createRange();
			r.setStartBefore(document.body);
			var parsedHTML = r.createContextualFragment(hstr);
			document.body.appendChild(parsedHTML);
		}
	}
	else {
		this.resizeit(this.wd,this.ht,this.wleft,this.wtop)
	}

	return false;
}

function popPopup() {
	if(this.popstate == 0) {
		var ndiv = document.getElementById(this.frmname)
		ndiv.style.top = this.wtop+"px";
		ndiv.style.left = this.wleft+"px";
		if(this.doshield==1) this.genShields("up");
		document.getElementById(this.frmname).style.visibility="visible";
		this.popstate = 1;
	}
	return true;;
}

function sizeIWindow() {
	if(!window.innerWidth){this.aw = document.body.clientWidth;this.ah = document.body.clientHeight; }
	else {this.aw = window.innerWidth;this.ah = window.innerHeight;}
  	
	switch(this.wleft) {
		case -1:
			this.wleft = parseInt((this.aw/2)-(this.wd/2));
			break;
		case 1000:
			this.wleft = 0;
			this.wtop = 0;
			break;
		case 2000:
			this.wleft = parseInt((this.aw)-(this.wd));
			this.wtop = 0;
			break;
		case 3000:
			this.wleft = parseInt((this.aw)-(this.wd));
			this.wtop = parseInt((this.ah)-(this.ht));
			break;
		case 4000:
			this.wleft = 0;
			this.wtop = parseInt((this.ah)-(this.ht));
			break;
		default:
			break;
    }
    if(this.wtop==-1) {this.wtop = 35}
    this.limitleft = this.wleft
    this.limitright = this.aw - (this.wleft + this.wd)
    return;
}
function resizePop(nwd,nht,nlf,ntp) {
	//var nframe = document.frames[this.frmname];
	var nframedom = document.getElementById(this.frmname)
	this.wd = nwd;
	this.ht = nht;
	
	nframedom.style.width = this.wd + "px";
	nframedom.style.height = this.ht + "px";
	//alert(nframedom.style.height);
	this.wleft = (typeof(nlf)!="undefined")? nlf:-1;
	this.wtop = (typeof(ntp)!="undefined")? ntp:-1;
	this.getsizes();
	nframedom.style.left = this.wleft;
	nframedom.style.top = this.wtop;
	return;
}

function closePopup(divnum) {
	if(this.doshield) this.genShields("dn");
	document.getElementById(this.frmname).style.visibility="hidden";
	this.popstate = 0;
}

function setPopSource(newurl) {
	var IFrameDoc;
	this.urlPop = newurl;
	var joiner = "";
	
	var IFrameObj = document.getElementById(this.frmname);
	if (document.frames) {// this is for IE5 Mac
		IFrameObj = document.frames[this.frmname];
    }
	if (IFrameObj.contentWindow) {// For IE5.5 and IE6
		IFrameDoc = IFrameObj.contentWindow.document;
	}
	else if (IFrameObj.document) {// For IE5 and 5.5 it seems
		IFrameDoc = IFrameObj.document;
	}
	else {
	    return true;
	}
	if(this.urlPop.indexOf("?") < 0){
		this.urlPop=this.urlPop+"?";
	}
	else {
		joiner = "&";	
	}
	IFrameDoc.location.replace(this.urlPop+joiner+"popobj="+this.objname);
	return false;

}



function generateShield(updn) {
	var hstr = "";
	var selels = document.getElementsByTagName("select")

	if(updn=="up") {
		if(document.getElementById("layerShield")==null) {
			for(var i=0;i<selels.length;i++) {
				selels[i].olddisabled = selels[i].disabled
				selels[i].disabled = true;
			}
			hstr+= "<div id=\"layerShield\" style=\"z-index: 200; position: absolute; top: 0px;left: 0px; visibility: visible; width: 98%; height: 98% ;\">";
			hstr+= "<img src=\"/images/shim.gif\" width=\"100%\" height=\"100%\" border=\"0\"></div>";
			if(document.body.insertAdjacentHTML) document.body.insertAdjacentHTML("BeforeEnd",hstr)
			else {
				var r = document.body.ownerDocument.createRange();
				r.setStartBefore(document.body);
				var parsedHTML = r.createContextualFragment(hstr);
				document.body.appendChild(parsedHTML);
			}
			try {
				parent.frames[0].doShields(1);
				parent.frames[2].doShields(1);
			}catch(e) {}
		}
		this.doshield = true;
	}
	else {
		for(var i=0;i<selels.length;i++) {
			selels[i].disabled = selels[i].olddisabled;
		}
		if(document.getElementById("layerShield")!=null){
			var shnode = document.getElementById("layerShield")
			if(document.body.insertAdjacentHTML) {
				shnode.innerHTML = "";
				shnode.outerHTML = "";
			}
			else {
				document.body.removeChild(shnode)
			}	
		}
		try {
			parent.parent.frames[0].doShields(0);
			parent.parent.frames[2].doShields(0);
		}catch(e) {}
		this.doshield = false;
	}
}


function hoveron(el) {
	el.className = el.className + "hover";
	cancelBubble = true;
}

function hoveroff(el) {
	var c = el.className
	el.className = c.substring(0,c.length-5)
}

function sendmail(user, domain) {
  
  // protocol
  var p = "\u006d\u0061\u0069\u006c\u0074\u006f\u003a";
  
  // usename
  var u = user;
  
  // domain name (host name sans machine name)
  var d = domain ||
          location.host.substring(
            location.host.lastIndexOf(
              ".",
              location.host.lastIndexOf(".") - 1
            ) + 1
          );

  void(top.location = p + u + "\u0040" + d);
  return false;
}
//jeff = \u006A\u0065\u0066\u0066


function setAccordian() {
	var myDivs = document.getElementsByClassName('stretcher');
	var myLinks = document.getElementsByClassName('stretchtoggle');

	var cntr = 1;
	
	myLinks.each(function(tog, i) {
		var sib_i = Element.find(tog.parentNode, 'nextSibling');
		eval("panel_"+cntr+" = new fx.Combo('"+sib_i.id.toString()+"', {height: true, opacity: true, duration: 500});");
		eval("panel_"+cntr+".hide()");
		eval("tog.onclick = function() {dopaneltoggle('panel_"+cntr+"');}");
		tog.onfocus = function() {this.blur();};
		
		var cclose = $("cclose_"+cntr);
		eval("cclose.onclick = function() {dopaneltoggle('panel_"+cntr+"');}");
		cntr++;
	});
	
	clearLoading();
}
function dopaneltoggle(pid) {
	var opid = eval(pid);
	opid.toggle();
}
function clearLoading() {
	try{
	$("loadscreen").style.display = "none";
	}
	catch(e) {}
}
function getSiblingElm(elm, drn) {
	elm = elm.parentnode;
	var strSibling = drn==-1? "previousSibling":"nextSibling";
	while( (elm=elm[strSibling]) && elm.nodeType!= 1){}
	return elm||null;
}


