// -------------------- General Functions ----------------------
  function popRTF(o, i, s) {var sID = o.document.forms.aspnetForm[i].id; var e =  o.RTE_GetEditorDocument(sID); e.body.innerHTML = s;}
  function bmpFTL(s) {return s.substring(s.lastIndexOf('/') + 1, s.length-4);}
  function strMANIPULATE(s,l) {if (s.length > l) {s = s.substring(1,l) + " <b><font color=blue>.....</font></b>";}; return s;}



	function bmpMouseOver(obj001) {
	  eval(obj001).style.backgroundColor='red';
	
	  for (i=1; i<30; i++) {
	    try {
	      for (n=1; n<30; n++){eval('menu' + i + '_' + n).style.display='none';}
	    }
	    catch (err) {
	      //Error Caught here = alert('error ' + err.number + ' caught');
	    }
	  }
	
	
	    try {
	     for (n=1; n<30; n++){eval(obj001 + '_' + n).style.display='block';}
	    }
	    catch (err) {
	      //Error Caught here = alert('error ' + err.number + ' caught');
	    }
	}
	
	function bmpMouseOver2(sNME) {eval(sNME).style.color='red'}
	
	function bmpMouseOut2() {
	  for (i=1; i<30; i++) {
	    try {
	     for (n=1; n<30; n++){eval('menu' + i + '_' + n).style.color='black';}
	    }
	    catch (err) {
	      //Error Caught here = alert('error ' + err.number + ' caught');
	    }
	  }
	}
	
  function bmpMOver(s) { var o=eval(s); o.name=o.style.backgroundColor; o.style.backgroundColor="#00ffff"; o.style.color='#000000';}
  function bmpMOut(s) { var o=eval(s); o.style.backgroundColor=o.name; o.style.color='#0000ff'; }
  function bpMO(o) {o.style.color='blue';}
  function kpMO(o) {o.style.color='aqua';}

	function onMO(o) {
		if (!o.style.color || o.style.color=="white") {o.style.color="yellow"; o.style.backgroundColor="#de3d09";} 
		else{o.style.color="white"; o.style.backgroundColor="#fb602c";}
	}


  function bmpVH(arrV, arrH) {
  	if (arrH) {for (i=0; i<arrH.length; i++) {eval(arrH[i]).style.display="none";}}
  	if (arrV) {for (i=0; i<arrV.length; i++) {eval(arrV[i]).style.display="block";}}
  }

// ----------------- Number Functions ----------------------------
  function fmt00(i) {return (i < 10) ? '0'+i : ((i < 100) ? i : i)}
  function fmt000(i) {return (i < 10) ? '00'+i : ((i < 100) ? '0'+i : i)}
  function bmpFR(s) {return s.replace(/,/g, '#').replace(/\./g, ',').replace(/#/g, '.')}
  function FComma(SS) { 
	var T='', S=String(SS), L=S.length-1, C, j, P = S.indexOf('.')-1
	if (P<0) P=L
	for (j=0; j<=L; j++) {
		T+=C=S.charAt(j)
		if ((j < P) && ((P-j)%3 == 0) && (C != '-')) T+=',' 
	}
	return T 
  }
// ----------------- Date Functions ----------------------------
  function calcDATEDIFF(s, f) {return f.getMonth() - s.getMonth() + ((s.getFullYear() - f.getFullYear()) * 12);}
  function dateDDMMYYYY(d) {return d.getDate() + "-" + dateMMM(d.getMonth()) + "-" + d.getFullYear();}
  function dateMMMYYYY(d) {return dateMMM(d.getMonth()) + "-" + d.getFullYear();}
  function dateMMM(n) {var m = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"); return m[n];}
  function dateXMM(s) { var m = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"); 
  									for (n=0; n<12; n++) {t=eval("/" + m[n] + "/i"); if (s.match(t)) {return n;}} return s;}
//  									for (n=0; n<12; n++) {if (m[n]==s) {return n;}}}
  function dateWSS(d) {return d.getDate() + "/" + d.getMonth() + "/" + d.getFullYear();}
  function dateCON1(s) {var dvArr = s.split('/'); return d = new Date(parseInt(dvArr[2], 10), parseInt(dvArr[1], 10) - 1, parseInt(dvArr[0], 10));}
  function dateCON2(s) {var dvArr = s.split('-'); return d = new Date(parseInt(dvArr[2], 10), dateXMM(dvArr[1]), parseInt(dvArr[0], 10));}
  function getDaysInMonth(m, y) {		
	switch(m) {
		case 1: case 3: case 5: case 7: case 8: case 10: case 12: return 31;
		case 4: case 6: case 9: case 11: return 30;
		case 2: if (((y% 4)==0) && ((y% 100)!=0) || ((y% 400)==0)) return 29; else return 28;
	}
  }				
function formatDATE(dateIN) {return dateDDMMYYYY(dateIN)}
function dateConverter(_from) {return dateCON2(_from)}

// ----------------- General Functions ----------------------------
  function bmpEscape(s) {s=escape(s); return s.replace(/\%/gi, "%25")}
  function bmpUnescape(s) {s = s.replace(/\%25/gi, "%"); return unescape(s)}
  function bmpRemoveTag(s, t) {
  	var m = eval("/<" + t + "[^<]+>/gi"); s = s.replace(m, ""); 
  	var m = eval("/<[^<]+" + t + ">/gi"); s = s.replace(m,'');
  	var m = eval("/<" + t + ">/gi"); return s.replace(m,'');
  }
  function bmpRemoveTags(s, arrT) {if (arrT) {for (i=0; i<arrT.length; i++) {s = bmpRemoveTag(s, arrT[i])}; return s.replace(/^\s*|\s(?=\s)|\s*$/g, '')}}
  function strREPLACE(s) {return bmpRemoveTags(s, ["DIV", "FONT", "TABLE", "TBODY", "TR", "TD", "IMG", "EM", "STRONG", "NOBR", "P", "A", "UL", "LI", "BR"])}

function resizeME() {
	var iframe = mainContent.document;
	var ch=(+document.body.clientHeight); var tm=(+document.body.topMargin); var bm=(+document.body.topMargin);
	var cw=(+document.body.clientWidth); var lm=(+document.body.leftMargin); var rm=(+document.body.rightMargin);

	iheight = (iframe.body.scrollHeight + 20) + 'px'; 
//	iwidth = (iframe.body.scrollWidth + 17) + 'px';

	iframe=document.getElementById('mainContent');			
	iframe.style.height = iheight;
//	iframe.style.width = iwidth;

////    eval(frame).height = document.getElementById("mainContent").document.body.scrollHeight + 'px';
////    eval(frame).height = mainContent.document.body.scrollHeight + 'px';
}

  function resizeIframe(iframe) { 
/*		var iframe = document.getElementById(sframe);
		var ch=(+document.body.clientHeight); var tm=(+document.body.topMargin); var bm=(+document.body.topMargin);
		var cw=(+document.body.clientWidth); var lm=(+document.body.leftMargin); var rm=(+document.body.rightMargin);		
*/
 		var iheight = (+iframe.document.body.scrollHeight+15); 
//   	iframe.style.height = iheight + "px";
   	document.getElementById(iframe.name).style.height = iheight + "px";
  }
 
//   	iframe.style.height = ch +"px"; 
//	 document.getElementById('frame').onload = resizeIframe; 
//	 window.onresize = resizeIframe; 


function resizeDIV(o) {
/*
	var th=0;
//	 		var o = document.getElementsByTagName("TABLE"); var o2 = document.getElementById('LeftNavigationAreaCell'); var th=0;
//				for (n=0;n<6;n++) {var t=document.getElementById("bmpTABLE"+n); if (t.style.display=="block") {th+=(+t.clientHeight)}}
//			try {var t=document.getElementById("bpNavBar"); th+=(+t.childNodes[0].clientHeight);} catch (err) {}
//			try {var t=document.getElementById("bpHead"); th+=(+t.childNodes[0].clientHeight);} catch (err) {}
//			var tn=(+o[0].clientHeight)-(+o2.parentNode.parentNode.parentNode.parentNode.clientHeight);
//				var s=""; for (n=0;n<25;n++) {s+= n + ":" + o[n].clientHeight + "\n"}; alert(s);
	
	var tn=0;
	var dh=0; //var oH=iframe.getElementsByName("bmpH");
//	  		dh = oH[0].clientHeight;
/*	for (n=0; n<oH.length; n++) {
		if (oH[n].parentNode.parentNode.parentNode.parentNode.parentNode.style.display=="block") {dh+=(+oH[n].clientHeight)}
	}*/

	var ch=(+document.body.clientHeight); var tm=(+document.body.topMargin); var bm=(+document.body.bottomMargin);
	var cw=(+document.body.clientWidth); var lm=(+document.body.leftMargin); var rm=(+document.body.rightMargin);
//	var ln=(+document.getElementById('LeftNavigationAreaCell').clientWidth);
	
//	var tbh=tm+bm+th+dh+tn+34;		//34px is the empty space at the bottom of the iframe that I do not currently control?	
	var tbh=tm+bm+34;		//34px is the empty space at the bottom of the iframe that I do not currently control?	
	var ht=(ch-tbh)+'px';

//alert(ht);

	o.style.height=ht;
}

function moveME() {
  arg=moveME.arguments;
  for (i=1; i<(arg.length); i++) {if (eval(arg[i]).style.display=='block'){liv=i;}}

  d=arg[0];
  switch(d) {
    case 0 : liv++; if (liv>3) {liv=3}; break;
    case -1 : liv--; if (liv<1) {liv=1}; break;
    default : liv=d; break;
  }
  for (i=1; i<(arg.length); i++) {eval(arg[i]).style.display='none';}
  eval(arg[liv]).style.display='block';

  prev.style.display='block'; 
  mve1a.style.display='block';
  mve2a.style.display='block'; 
  mve3a.style.display='block';
  mve1b.style.display='none';
  mve2b.style.display='none'; 
  mve3b.style.display='none';
  next.style.display='block'; 

  eval('mve' + liv + 'a').style.display='none';
  eval('mve' + liv + 'b').style.display='block';

  switch(liv) {
    case 1: prev.style.display='none'; break;
    case 3: next.style.display='none'; break;
  }
}

function bmpClick(sURL, obj001) {
  try {
	  for (i=1; i<30; i++) {eval('menu' + i).style.color='white';}
  }
  catch (err) {
     //Error Caught here = alert('error ' + err.number + ' caught');
  }
  eval(obj001).style.color='black';
  mainContent.location=sURL;
}

function bmpMouseOut() {
  try {
     for (i=1; i<30; i++) {eval('menu' + i).style.backgroundColor='#006699';}
  }
  catch (err) {
     //Error Caught here = alert('error ' + err.number + ' caught');
  }
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function bpPopUp(sBody, sTitle) {
    var pwin = window.open("", "kpWindow");
	pwin.moveTo(20,20);

	if (!sTitle) {var inHTML = sBody}
	else {var inHTML="<html><head><title>" + sTitle + "</title></head><body>" + sBody + "</body></html>"}

//    pwin = (pwin.contentWindow) ? pwin.contentWindow : (pwin.contentDocument.document) ? pwin.contentDocument.document : pwin.contentDocument;
    pwin.document.open();
    pwin.document.write(inHTML);
    pwin.document.close();
}

/*
window.open ("http://www.javascript-coder.com","mywindow","status=1,toolbar=1");

status  The status bar at the bottom of the window. 
toolbar  The standard browser toolbar, with buttons such as Back and Forward. 
location  The Location entry field where you enter the URL. 
menubar  The menu bar of the window 
directories  The standard browser directory buttons, such as What's New and What's Cool 
resizable Allow/Disallow the user to resize the window. 
scrollbars  Enable the scrollbars if the document is bigger than the window 
height Specifies the height of the window in pixels. (example: height='350') 
width  Specifies the width of the window in pixels. 

*/
