fls = document.getElementsByTagName("object");
for (var a = 0; a < fls.length; a++){fls[a].outerHTML = fls[a].outerHTML;}

ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false

function WindowOnload(f) {
	var prev=window.onload;
	window.onload=function(){ if(prev)prev(); f(); }
}

function timeZone() {
    var now = new Date()
    var tzo = (now.getTimezoneOffset()/60)*(-1); 
    return tzo;
}

function redirectInitialPage() {
    var scrH = screen.height;
    var scrW = screen.width;
    var scrC = screen.colorDepth;
    var scrRef = "";
    
    if (document.referrer&&document.referrer!="") {
        scrRef = document.referrer;
    }

    window.location="web/index.aspx?sc=" + scrH + "." + scrW + "." + scrC + "." + timeZone() + "&httpref=" + scrRef;
}

function setScreenValues() {
    var scrH = screen.height;
    var scrW = screen.width;
    var scrC = screen.colorDepth;

    setCookie("dbdScrH",scrH,0)
    setCookie("dbdScrW",scrH,0)
    setCookie("dbdScrC",scrH,0)
    setCookie("dbdScrTZ",timeZone(),0)
    
    alert(getCookie("dbdScrH"));
}

function setCookie(c_name,value,expiredays) {
    var today = new Date();
    var expire = new Date();
    if (expiredays==null || expiredays==0) expiredays=1;
    expire.setTime(today.getTime() + 3600000*24*expiredays);
    document.cookie = c_name+"="+escape(value) + ";expires="+expire.toGMTString();
}

function getCookie(c_name) {
    if (document.cookie.length>0) {
        c_start=document.cookie.indexOf(c_name + "=")
        if (c_start!=-1) { 
            c_start=c_start + c_name.length+1 
            c_end=document.cookie.indexOf(";",c_start)
            if (c_end==-1)
                c_end=document.cookie.length
                return unescape(document.cookie.substring(c_start,c_end))
            } 
        }
    return ""
}

/* 
AnchorPosition.js
Author: Matt Kruse
Last modified: 10/11/02

DESCRIPTION: These functions find the position of an <A> tag in a document,
so other elements can be positioned relative to it.

COMPATABILITY: Netscape 4.x,6.x,Mozilla, IE 5.x,6.x on Windows. Some small
positioning errors - usually with Window positioning - occur on the 
Macintosh platform.

FUNCTIONS:
getAnchorPosition(anchorname)
  Returns an Object() having .x and .y properties of the pixel coordinates
  of the upper-left corner of the anchor. Position is relative to the PAGE.

getAnchorWindowPosition(anchorname)
  Returns an Object() having .x and .y properties of the pixel coordinates
  of the upper-left corner of the anchor, relative to the WHOLE SCREEN.

NOTES:

1) For popping up separate browser windows, use getAnchorWindowPosition. 
   Otherwise, use getAnchorPosition

2) Your anchor tag MUST contain both NAME and ID attributes which are the 
   same. For example:
   <A NAME="test" ID="test"> </A>

3) There must be at least a space between <A> </A> for IE5.5 to see the 
   anchor tag correctly. Do not do <A></A> with no space.
*/ 

// getAnchorPosition(anchorname)
//   This function returns an object having .x and .y properties which are the coordinates
//   of the named anchor, relative to the page.
function getAnchorPosition(anchorname) {
	// This function will return an Object with x and y properties
	var useWindow=false;
	var coordinates=new Object();
	var x=0,y=0;
	// Browser capability sniffing
	var use_gebi=false, use_css=false, use_layers=false;
	if (document.getElementById) { use_gebi=true; }
	else if (document.all) { use_css=true; }
	else if (document.layers) { use_layers=true; }
	// Logic to find position
 	if (use_gebi && document.all) {
		x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
		y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
		}
	else if (use_gebi) {
		var o=document.getElementById(anchorname);
		x=AnchorPosition_getPageOffsetLeft(o);
		y=AnchorPosition_getPageOffsetTop(o);
		}
 	else if (use_css) {
		x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
		y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
		}
	else if (use_layers) {
		var found=0;
		for (var i=0; i<document.anchors.length; i++) {
			if (document.anchors[i].name==anchorname) { found=1; break; }
			}
		if (found==0) {
			coordinates.x=0; coordinates.y=0; return coordinates;
			}
		x=document.anchors[i].x;
		y=document.anchors[i].y;
		}
	else {
		coordinates.x=0; coordinates.y=0; return coordinates;
		}
	coordinates.x=x;
	coordinates.y=y;
	return coordinates;
	}

// getAnchorWindowPosition(anchorname)
//   This function returns an object having .x and .y properties which are the coordinates
//   of the named anchor, relative to the window
function getAnchorWindowPosition(anchorname) {
	var coordinates=getAnchorPosition(anchorname);
	var x=0;
	var y=0;
	if (document.getElementById) {
		if (isNaN(window.screenX)) {
			x=coordinates.x-document.body.scrollLeft+window.screenLeft;
			y=coordinates.y-document.body.scrollTop+window.screenTop;
			}
		else {
			x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
			y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
			}
		}
	else if (document.all) {
		x=coordinates.x-document.body.scrollLeft+window.screenLeft;
		y=coordinates.y-document.body.scrollTop+window.screenTop;
		}
	else if (document.layers) {
		x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
		y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
		}
	coordinates.x=x;
	coordinates.y=y;
	return coordinates;
	}

// Functions for IE to get position of an object
function AnchorPosition_getPageOffsetLeft (el) {
	var ol=el.offsetLeft;
	while ((el=el.offsetParent) != null) { ol += el.offsetLeft; }
	return ol;
	}
function AnchorPosition_getWindowOffsetLeft (el) {
	return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft;
	}	
function AnchorPosition_getPageOffsetTop (el) {
	var ot=el.offsetTop;
	while((el=el.offsetParent) != null) { ot += el.offsetTop; }
	return ot;
	}
function AnchorPosition_getWindowOffsetTop (el) {
	return AnchorPosition_getPageOffsetTop(el)-document.body.scrollTop;
	}

function gotoMenuItem(selElement) {
	location.href = document.getElementById(selElement).href;
}

function gotoSelectItem(selElement) {
	selLink = selElement.options[selElement.selectedIndex].value
    window.location = selLink
}

function printPage() {
   if (window.print) {
      agree = confirm('Would you like to print this page now?');
      if (agree) window.print(); 
   }
}

function NewPopWindowSet(mypage,myname,w,h,scroll,tool,resize){
	myname='name'
	var winl = 50;
	var wint = 50;
	var settings  ='height='+h+',';
		settings +='width='+w+',';
		settings +='top='+wint+',';
		settings +='left='+winl+',';
		settings +='scrollbars='+scroll+',';
		settings +='toolbar='+tool+',';
		settings +='resizable='+resize;
		win=window.open(mypage,myname,settings);
	if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}

function goto_SocialBookmark(link) {
	var thisUrl = encodeURIComponent(location.href);
	var thisTitle = encodeURIComponent(document.title);
	if (link != "#") {
		link = link.replace("dbdURLofSITE", thisUrl)
		link = link.replace("dbdNAMEofSITE", thisTitle)
		window.open(link)
	} else {
		window.external.AddFavorite(thisUrl,thisTitle)
	}
}

function translate(language) {
	var thisUrl = location.href;
	thisUrl = thisUrl.toLowerCase();
	if (thisUrl.indexOf("aspx") < 0) {
		thisUrl = thisUrl + "index.aspx"
	}
	if (language=="cro" || language=="che" || language=="dan" || language=="fin" || language=="hun" || language=="ice" || language=="nor" || language=="tag" || language=="pol" || language=="rom" || language=="sel" || language=="slo" || language=="swe" || language=="wel" || language=="tur" || language=="ltt"){
		//Croatian = cro
		//Czech = che
		//Danish = dan
		//Finnish = fin
		//Hungarian = hun
		//Icelandic = ice
		//Norwegian = nor
		//Filipino = tag
		//Polish = pol
		//Romanian = rom
		//Serbian = sel
		//Slovenian = slo
		//Swedish = swe
		//Welsh = wel
		//Turkish = tur
		//Latin = ltt
	    window.open('http://www.tranexp.com:2000/Translate/index.shtml?from=eng&to=' + language + '&type=url&url=' + thisUrl);
	} else if (language=="nl" || language=="ru" || language=="el"){
		//Dutch = nl
		//Russian = ru
		//Greek = el
		window.open('http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=en_' + language + '&url=' + thisUrl);
	} else {
	    window.open('http://translate.google.com/translate?u=' + thisUrl + '&langpair=en|' + language + '&hl=en&ie=UTF-8&oe=UTF-8&prev=/language_tools');
	}
}

function goto_Search(object) {
    var searchItem = object.value;
    searchItem = searchItem.replace('+','&plus;');
    if (searchItem != "") {
        for (var x = 1; x <= 10; x++) {
            searchItem = searchItem.replace(' ','+');
        }
        window.location.href = 'search.aspx?q=' + searchItem;
    }
}

function confirmDelete(delUrl,delTitle) {
	if (confirm("Are you sure you want to delete '" + delTitle + "'?")) {
		document.location = delUrl;
	}
}

function confirmAddDup(pageName) {
    var agree=confirm("You already have a page called " + pageName + ", do you want to continue?");
    if (agree)
	    return true ;
    else
	    return false ;
}

function showRows(idName, txtType) {
    if (txtType == 'archiveList') {
        document.getElementById(idName).className = '';
    } else {
        for (var x = 10; x <= 200; x++) {
            try {
                var tempId = idName + x;
                document.getElementById(tempId).className = '';
            }   catch(err) {}
        }
    }
    var tempLinkId = idName + 'ShowHide';
    if (txtType == 'quickStat') {
        document.getElementById(tempLinkId).innerHTML = 'Display Only Top 10 Results';
    } else if (txtType == 'indvEntries') {
        document.getElementById(tempLinkId).innerHTML = 'Hide Individual Entries';
    } else if (txtType == 'archiveList') {
        //Do Nothing
    } else if (txtType == 'preview') {
        document.getElementById(tempLinkId).innerHTML = '<img src="../image/icons/sm_previewMinus.gif" border="0" alt="Hide Individual Entries">';
    }
    document.getElementById(tempLinkId).href = 'javascript:hideRows("' + idName + '", "' + txtType + '");';
}

function hideRows(idName, txtType) {
    if (txtType == 'archiveList') {
        document.getElementById(idName).className = 'hideRows';
    } else {
        for (var x = 10; x <= 200; x++) {
            try {
                var tempId = idName + x;
                document.getElementById(tempId).className = 'hideRows';
            }   catch(err) {}
        }
    }
    var tempLinkId = idName + 'ShowHide';
    if (txtType == 'quickStat') {
        document.getElementById(tempLinkId).innerHTML = 'Display All Results';
    } else if (txtType == 'indvEntries') {
        document.getElementById(tempLinkId).innerHTML = 'Display Individual Entries';
    } else if (txtType == 'archiveList') {
        //Do Nothing
    } else if (txtType == 'preview') {
        document.getElementById(tempLinkId).innerHTML = '<img src="../image/icons/sm_previewPlus.gif" border="0" alt="Display Individual Entries">';
    }
    document.getElementById(tempLinkId).href = 'javascript:showRows("' + idName + '", "' + txtType + '");';  
}

function changeClass(obj, style) {
	obj.className = style; 
}


function ConfirmCancelForm(){
	if (confirm("Are you sure you want to clear the form? Click OK to continue.")) {
		document.aspnetForm.reset();
	}
	return true;
}
