function findPosX(obj)
{
var curleft = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curleft += obj.offsetLeft
obj = obj.offsetParent;
}
}
else if (obj.x)
{
curleft += obj.x;
}
return curleft;
}function findPosY(obj)
{
var curtop = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curtop += obj.offsetTop
obj = obj.offsetParent;
}
}
else if (obj.y)
{
curtop += obj.y;
}
return curtop;
}function isEven(value)
{
if (value%2 == 0)
return true;
else
return false;
}function matchCoords(ItemToMove,Destination)
{
pWidth = document.body.offsetWidth;
if(pWidth <= '800')
{
document.body.style.textAlign = 'left';
document.getElementById('PageContainer').style.marginLeft = '5';
}
else
{
document.getElementById('PageContainer').style.marginLeft = 'auto';
document.getElementById('PageContainer').style.marginRight = 'auto';
document.body.style.textAlign = 'center';
}var moveObj = document.getElementById(ItemToMove);
var destObj = document.getElementById(Destination);
moveObj.style.visibility = "hidden";
var destTopCoord = findPosY(destObj);
var destLeftCoord = findPosX(destObj);
moveObj.style.left = destLeftCoord;
moveObj.style.top = destTopCoord;
moveObj.style.visibility = "visible";}
function showHide(el,showonly,hideonly)
{
var elObj = document.getElementById(el);
if(elObj.style.display == "none")
{
elObj.style.display = "";
highZ++;
elObj.style.zIndex = highZ;
}
else
{
elObj.style.display = "none";
}
if(showonly)
{
elObj.style.display = "";
highZ++;
elObj.style.zIndex = highZ;
}
if(hideonly)
{
elObj.style.display = "none";
}
}
function getDocHeight(doc)
{
var docHt = 0,sh,oh;
if (doc.height) docHt = doc.height;
else if (doc.body)
{
if (doc.body.scrollHeight) docHt = sh = doc.body.scrollHeight;
if (doc.body.offsetHeight) docHt = oh = doc.body.offsetHeight;
if (sh && oh) docHt = Math.max(sh,oh);
}
return docHt;
}function setIframeHeight(iframeName)
{
var iframeWin = window.frames[iframeName];
var iframeEl = document.getElementById? document.getElementById(iframeName):document.all? document.all[iframeName]:null;
if ( iframeEl && iframeWin )
{
iframeEl.style.height = "auto";
var docHt = getDocHeight(iframeWin.document);
if (docHt) iframeEl.style.height = docHt + 30 + "px";
}
}function loadIframe(iframeName,url)
{
if ( window.frames[iframeName] )
{
window.frames[iframeName].location = url;  
return false;
}
else return true;
}function swapImgRestore()
{
var i,x,a=document.sr;for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}function findObj(n,d)
{
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=findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n);return x;
}function swapImage()
{
var i,j=0,x,a=swapImage.arguments;document.sr=new Array;for(i=0;i<(a.length-2);i+=3)
if ((x=findObj(a[i]))!=null){document.sr[j++]=x;if(!x.oSrc) x.oSrc=x.src;x.src=a[i+2];}
}function goToURL()
{
var i,args=goToURL.arguments;document.returnValue = false;
for (i=0;i<(args.length-1);i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}function spawnWindow(theURL,winName,features,posX,posY)
{
myWindow=window.open(theURL,winName,features);
if (!myWindow.opener) myWindow.opener = self;
myWindow.focus();
if(posX || posY)
{
myWindow.moveTo(posX,posY);
}
}function jumpMenu(targ,selObj,restore)
{
if(selObj.options[selObj.selectedIndex].value != "#")
{
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
}
if (restore) selObj.selectedIndex=0;
}function Highlight(e)
{
if(e)
{
if(e.className == "listeven")
{
e.className = "listevensel";
}
else if(e.className == "listodd")
{
e.className = "listoddsel";
}
}
}function Unhighlight(e)
{
if(e)
{
if(e.className == "listevensel")
{
e.className = "listeven";
}
else if(e.className == "listoddsel")
{
e.className = "listodd";
}
}
}function Toggle(e)
{
if(e.checked)
{
Highlight(e);
}
else
{
Unhighlight(e);
}
}function moveUpList(listField)
{
if ( listField.length == -1)
{
alert("There are no values which can be moved!");
}
else
{
var selected = listField.selectedIndex;
if (selected == -1)
{
alert("You must select an entry to be moved!");
}
else
{
if ( listField.length == 0 )
{
alert("There is only one entry!\nThe one entry will remain in place.");
}
else
{
if ( selected == 0 )
{
alert("The first entry in the list cannot be moved up.");
}
else
{
var moveText1 = listField[selected-1].text;
var moveText2 = listField[selected].text;
var moveValue1 = listField[selected-1].value;
var moveValue2 = listField[selected].value;
listField[selected].text = moveText1;
listField[selected].value = moveValue1;
listField[selected-1].text = moveText2;
listField[selected-1].value = moveValue2;
listField.selectedIndex = selected-1;
}
}
}
}
}function moveDownList(listField)
{
if ( listField.length == -1)
{
alert("There are no values which can be moved!");
}
else
{
var selected = listField.selectedIndex;
if (selected == -1)
{
alert("You must select an entry to be moved!");
}
else
{
if ( listField.length == 0 )
{
alert("There is only one entry!\nThe one entry will remain in place.");
}
else
{
if ( selected == listField.length-1 )
{
alert("The last entry in the list cannot be moved down.");
}
else
{
var moveText1 = listField[selected+1].text;
var moveText2 = listField[selected].text;
var moveValue1 = listField[selected+1].value;
var moveValue2 = listField[selected].value;
listField[selected].text = moveText1;
listField[selected].value = moveValue1;
listField[selected+1].text = moveText2;
listField[selected+1].value = moveValue2;
listField.selectedIndex = selected+1;
}
}
}
}
}function SelectMoveRows(SS1,SS2,move)
{
var SelID='';
var SelText='';
var ItemExists='';
for (i=SS1.options.length - 1;i>=0;i--)
{
if (SS1.options[i].selected == true)
{
SelID=SS1.options[i].value;
SelText=SS1.options[i].text;
for (j = 0;j < SS2.options.length;j++)
{
if( (SelID == SS2.options[j].value) && (SelText == SS2.options[j].text) )
{
ItemExists = 1;
}
}
if(ItemExists != 1)
{
var newRow = new Option(SelText,SelID);
SS2.options[SS2.length]=newRow;
}
if(move)
{
SS1.options[i]=null;
}
}
}
}function SelectSort(SelList)
{
var ID='';
var Text='';
for (x=0;x < SelList.length - 1;x++)
{
for (y=x + 1;y < SelList.length;y++)
{
if (SelList[x].text > SelList[y].text)
{
ID=SelList[x].value;
Text=SelList[x].text;
SelList[x].value=SelList[y].value;
SelList[x].text=SelList[y].text;
SelList[y].value=ID;
SelList[y].text=Text;
}
}
}
}function ConfirmSelect(SelList)
{
for (x=0;x < SelList.length;x++)
{
SelList.options[x].selected = true
}
}
function newImgWindow(img,winName,features,sizeX,sizeY,posX,posY) 
{
var winstr = "<html><title></title><body leftmargin=0 topmargin=0 bgcolor=black scroll=no onBlur=window.close()>";
winstr+='<img src=\"'+img+'\"></body></html>';
myWindow = window.open("",winName,features)
myWindow.document.open();
myWindow.document.write(winstr);
if (!myWindow.opener)
{
myWindow.opener = self;
}
myWindow.focus();if(posX || posY)
{
myWindow.moveTo(posX,posY);
}
myWindow.document.close();
}
function showHide(el)
{
var elObj = document.getElementById(el);
if(elObj.style.display == "none")
{
elObj.style.display = "";
}
else
{
elObj.style.display = "none";
}
}
function setCookie(name,value,expires,path,domain,secure)
{
var curCookie = name + "=" + escape(value) +
((expires) ? ";expires=" + expires.toGMTString() :"") +
((path) ? ";path=" + path :"") +
((domain) ? ";domain=" + domain :"") +
((secure) ? ";secure" :"");
document.cookie = curCookie;
}
