var currPathname=window.location.pathname;
var arrayPath=currPathname.split("/");
var documentRoot="dmzMetadata";
if(arrayPath.length>2){
var documentRoot=arrayPath[1];
}
var pathname=window.location.protocol+"//"+window.location.host+"/"+documentRoot;
var isOpera=navigator.userAgent.indexOf("Opera")>-1;
var isIE=navigator.userAgent.indexOf("MSIE")>1&&!isOpera;
var isMoz=navigator.userAgent.indexOf("Mozilla/5.")==0&&!isOpera;
var theCurrentDate=new Date();
function initialfocus(){
thisObject=document.forms[0];
for(var i=0;i<thisObject.elements.length;i++){
theElement=thisObject.elements[i];
if(theElement.type=="text"){
thisObject.elements[i].focus();
break;
}
}
}
function sortCol(Arr,colNum){
function Sort(a,b)
{
if(a[col]<b[col])
return-1
if(a[col]>b[col])
return 1
return 0
}
col=colNum
Arr.sort(Sort)
}
function disableForm(theform){
if(document.all||document.getElementById){
for(var i=0;i<theform.length;i++){
var tempobj=theform.elements[i];
tempobj.disabled=true;
}
}
}
function zzChopit(aString,aSubstring)
{
var tmp=""+aString
if(tmp.length==0)return tmp
if(aSubstring.length==0)return tmp
var where
if((where=tmp.indexOf(aSubstring))<0)return tmp
return(tmp.substring(0,where))
}
function zzLopit(aString,aSubstring)
{
var tmp=""+aString
if(tmp.length==0)return tmp
if(aSubstring.length==0)return tmp
var where
if((where=tmp.indexOf(aSubstring))<0)return tmp
return(tmp.substring(where+aSubstring.length,tmp.length))
}
function String_repeat(times){
return(new Array(times+1)).join(this);
}
String.prototype.repeat=String_repeat;
function append(value){
if(this.value.index+value.length>this.size){
value=(this.value.substring(0,this.index)+value).substring(0,this.value.size);
this.size=this.index=value.length;
}
else{
value=this.value.substring(0,this.index)+value;
this.index=value.length;
}
this.value=value+this.value.substring(value.length,this.value.length);
}
function getValue(){
return this.value;
}
function duplicateString(size,chr){
var text='';
for(var i=0;i<size;i++)
text+=chr;
return text;
}
function StringBuffer(size,chr){
this.value=new String(duplicateString(size,chr));
this.size=size;
this.index=0;
this.append=append;
this.toString=getValue;
}
function rewindBack(refPoint,myLevel){
cDate=new Date();
timeStamp="&timestamp="+Date.parse(cDate);
conditions="";
if(refPoint.length>0){
conditions="&myLevel="+myLevel+"&myRefPoint="+refPoint;
}
if(refPoint!=""){
myFormAction=pathname+"/Subject?documenttitle=*"+conditions+timeStamp;
}else{
myFormAction=pathname+"/Homepage";
}
window.location.href=myFormAction;
}
function backLevel(currentBreadCrumbs,buttonTheme){
cDate=new Date();
timeStamp="&timestamp="+Date.parse(cDate);
currentBreadCrumbs="cn="+currentBreadCrumbs.replace(/ \> /g,",cn=");
tempBuffer=new StringBuffer();
tempBuffer.append("");
breadCrumbDetails=new Array();
breadCrumbDetails=currentBreadCrumbs.split(",");
accumCrumbs="";
currentRefPoint=1;
for(var i=0;i<breadCrumbDetails.length;i++){
if(i==0){
accumCrumbs="";
tempCrumb=breadCrumbDetails[i];
if(breadCrumbDetails.length>1){
accumCrumbs=breadCrumbDetails[i];
tempCrumb="";
}
}else{
accumCrumbs=tempCrumb+accumCrumbs+","+breadCrumbDetails[i];
tempCrumb="";
}
currentRefPoint+=1;
param1="&quot;"+accumCrumbs+"&quot;,&quot;"+currentRefPoint+"&quot;";
newBC=zzLopit(breadCrumbDetails[i],"=");
currentSubject=newBC;
if(accumCrumbs==""&&currentRefPoint==2){
newBC="Home &gt;";
}
if(i<breadCrumbDetails.length-1){
tempBuffer.append("<a href=\"javascript:rewindBack("+param1+")\" class=\""+buttonTheme+"\">"+newBC+"</a> &gt; ");
}else if(breadCrumbDetails.length>1){
tempBuffer.append("<a href=\"javascript:rewindBack("+param1+")\" class=\""+buttonTheme+"\">"+newBC+"</a>");
}else if(breadCrumbDetails.length=1){
tempBuffer.append("<a href=\"javascript:rewindBack("+param1+")\" class=\""+buttonTheme+"\">"+newBC+"</a>");
}
}
tempBuffer.append("<br>");
if(accumCrumbs!=""){
}else{
param1="&quot;cn="+currentSubject+"&quot;,&quot;"+currentRefPoint+"&quot;";

tempBuffer="<a href=\"javascript:rewindBack("+param1+")\" class=\""+buttonTheme+"\">"+currentSubject+"</a><br>";
}
return tempBuffer;
}
function mainBackLevel(currentBreadCrumbs,buttonTheme){
cDate=new Date();
timeStamp="&timestamp="+Date.parse(cDate);
currentBreadCrumbs="cn="+currentBreadCrumbs.replace(/ \> /g,",cn=");
tempBuffer=new StringBuffer();
tempBuffer.append("");
breadCrumbDetails=new Array();
breadCrumbDetails=currentBreadCrumbs.split(",");
accumCrumbs="";
currentRefPoint=1;
for(var i=0;i<breadCrumbDetails.length;i++){
if(i==0){
accumCrumbs="";
tempCrumb=breadCrumbDetails[i];
if(breadCrumbDetails.length>1){
accumCrumbs=breadCrumbDetails[i];
tempCrumb="";
}
}else{
accumCrumbs=tempCrumb+accumCrumbs+","+breadCrumbDetails[i];
tempCrumb="";
}
currentRefPoint+=1;
param1="&quot;"+accumCrumbs+"&quot;,&quot;"+currentRefPoint+"&quot;";
newBC=zzLopit(breadCrumbDetails[i],"=");
currentSubject=newBC;
if(accumCrumbs==""&&currentRefPoint==2){
newBC="Home &gt;";
}
if(i<breadCrumbDetails.length-1){
tempBuffer.append("<a href=\"javascript:rewindBack("+param1+")\" class=\""+buttonTheme+"\">"+newBC+"</a> &gt; ");
}else if(breadCrumbDetails.length>1){
tempBuffer.append("<span class=\"breadCrumbEnds\">"+newBC+"</span>");
}else if(breadCrumbDetails.length=1){
tempBuffer.append("<a href=\"javascript:rewindBack("+param1+")\" class=\""+buttonTheme+"\">"+newBC+"</a>");
}
}
tempBuffer.append("<br>");
if(accumCrumbs!=""){
tempBuffer="<span class=\""+buttonTheme+"\"> <b>"+tempBuffer+" </b></span>";
}else{
tempBuffer="<span class=\"firstBreadCrumb\">"+currentSubject+"</span><br>";
}
return tempBuffer;
}
function searchEntryForm(){
document.writeln("<a href=\"javascript:searchDocument()\" class=\"button\">Search</a>");
}
function searchDocument(){
cDate=new Date();
timeStamp="&timestamp="+Date.parse(cDate);
mySearchField=document.forms[0].searchfield.value;
if(mySearchField==""){
alert("Please enter search keyword(s).");
document.forms[0].searchfield.focus();
return;
}
var iChars="!@#$%^&*()+=-[]\\\;,/{}|\:<?";
for(var i=0;i<document.forms[0].searchfield.value.length;i++){
iCharIs=iChars.indexOf(document.forms[0].searchfield.value.charAt(i));
if(iCharIs!=-1){
theChar=iChars.substr(iCharIs,1);
alert("Your keyword has special characters. \n\""+theChar+"\" sign. This is not allowed.\n Please remove them and try again.");
return;
}
}
myCondition="&description="
+mySearchField
;
myFormAction=pathname+"/Search?perform="+myCondition+timeStamp;
alert(myFormAction);
window.location.href=myFormAction;
}
function getHeight(){
var d=document;
var box=new Array("index2leftSide","index2rightSide");
for(x=0;x<box.length;x++){
h=d.getElementById(box[x]).offsetHeight;
for(y=0;y<box.length;y++){
test_h=d.getElementById(box[y]).offsetHeight;
if(h<test_h)h=test_h;
}
}
for(x=0;x<box.length;x++)d.getElementById(box[x]).style.height=h+"px";
if(navigator.userAgent.indexOf("Opera")!=-1){
var versionindex=navigator.userAgent.indexOf("Opera")+6
if(parseInt(navigator.userAgent.charAt(versionindex))>=8){
document.getElementById("watermarkLogo").style.backgroundImage='none';
document.getElementById("watermarkZone").style.display='none';
}
}
}
function indexGetHeight(){
var d=document;
var box=new Array("leftSide","middleSide","rightSide");
for(x=0;x<box.length;x++){
h=d.getElementById(box[x]).offsetHeight;
for(y=0;y<box.length;y++){
test_h=d.getElementById(box[y]).offsetHeight;
if(h<test_h)h=test_h;
}
}
for(x=0;x<box.length;x++)d.getElementById(box[x]).style.height=h+"px";
if(navigator.userAgent.indexOf("Opera")!=-1){
var versionindex=navigator.userAgent.indexOf("Opera")+6
if(parseInt(navigator.userAgent.charAt(versionindex))>=8){
document.getElementById("watermarkLogo").style.backgroundImage='none';
document.getElementById("watermarkZone").style.display='none';
}
}
}
function adjustScreen(){
if(screen.width==800){
document.getElementById("column1").style.fontSize="11px";
document.getElementById("column2").style.fontSize="11px";
document.getElementById("column3").style.fontSize="11px";
document.getElementById("column4").style.fontSize="11px";
document.getElementById("column5").style.fontSize="11px";
document.getElementById("column6").style.fontSize="11px";
}
}
function checkNull4Search(){
if(document.forms[0].description.value==""){
return false;
}
else{
document.forms[0].submit();
}
}
function disableSearch(){
return false;
}


function hidediv(pass) {
var divs = document.getElementsByTagName('div');
for(i=0;i<divs.length;i++){
if(divs[i].id.match(pass)){//if they are 'see' divs
if (document.getElementById) // DOM3 = IE5, NS6
divs[i].style.display="none";// show/hide
else
if (document.layers) // Netscape 4
document.layers[divs[i]].display = 'hidden';
else // IE 4
document.all.hideshow.divs[i].visibility = 'hidden';
}
}
}


function showdiv(pass) {
var divs = document.getElementsByTagName('div');
for(i=0;i<divs.length;i++){
if(divs[i].id.match(pass)){
if (document.getElementById)
divs[i].style.display="block";
else
if (document.layers) // Netscape 4
document.layers[divs[i]].display = 'visible';
else // IE 4
document.all.hideshow.divs[i].visibility = 'visible';
}
}
getHeight();
}

function indexGetHeightc(){
var d=document;
var box=new Array("leftSide","middleSide");
for(x=0;x<box.length;x++){
h=d.getElementById(box[x]).offsetHeight;
for(y=0;y<box.length;y++){
test_h=d.getElementById(box[y]).offsetHeight;
if(h<test_h)h=test_h;
}
}
for(x=0;x<box.length;x++)d.getElementById(box[x]).style.height=h+"px";
if(navigator.userAgent.indexOf("Opera")!=-1){
var versionindex=navigator.userAgent.indexOf("Opera")+6
if(parseInt(navigator.userAgent.charAt(versionindex))>=8){
document.getElementById("watermarkLogo").style.backgroundImage='none';
document.getElementById("watermarkZone").style.display='none';
}
}
}