/*Javascript Library by anders.turesson@edgeguide.com. All rights reserved */
/* ******************************************************************
This is Edgeguide's standard javascript library. It should be used in
all projects and it should be includen in all pages. Remove explanations
from this file before implementing in for a customer.
****************************************************************** */
// Check for browser version
var ie4 = (document.all) ? true : false;
var ns4 = (document.layers) ? true : false;
var ns6 = (document.getElementById && !document.all) ? true : false;
//openWin function. Opens a popup window (no toolbars, menubar etc)
// calling syntax: openWin('http://www.edgeguide.com','newwindowname',300,200,'yes')
// yes makes the window scollable, no disables scrollbars
function openWin(URL,name,width,height,scroll) {
self.name = "main";
newWin = window.open(URL,name,
'width='+width+',height='+height+',status=no,toolbar=no,menubar=no,scrollbars='+scroll);
newWin.focus();
}
//popUp function. Opens a popup window with a message
// calling syntax: popUp('Your message goes here','width=200,height=200,left=80,top=80,screenX=80,screenY=80')
// where width and height is the size and left,top,screenX,screenY is the position of the popup window for both IE and NN
function popUp(message,props) {
msg=window.open('','msg',props);
msg.document.write('
');
msg.document.write('');
msg.document.write('');
msg.document.write('',message,'');
msg.document.write('');
}
// Trims spaces from a textfield. Syntax:
function trim(field) {
while(''+field.value.charAt(0)==' ')field.value=field.value.substring(1,field.value.length);
while(''+field.value.charAt(field.value.length-1)==' ')field.value=field.value.substring(0,field.value.length-1);
}
// HideLayer. Syntax: hidelayer('yourlayername')
function hidelayer(lay) {
if (ie4) {document.all[lay].style.visibility = "hidden";}
if (ns4) {document.layers[lay].visibility = "hide";}
if (ns6) {document.getElementById([lay]).style.display = "none";}
}
// ShowLayer. Syntax: hidelayer('yourlayername')
function showlayer(lay) {
if (ie4) {document.all[lay].style.visibility = "visible";}
if (ns4) {document.layers[lay].visibility = "show";}
if (ns6) {document.getElementById([lay]).style.display = "block";}
}
// WriteToLayer. Syntax: writetolayer('yourlayername','the text you want in the layer')
function writetolayer(lay,txt) {
if (ie4) {
document.all[lay].innerHTML = txt;
}
if (ns4) {
document[lay].document.write(txt);
document[lay].document.close();
}
if (ns6) {
over = document.getElementById([lay]);
range = document.createRange();
range.setStartBefore(over);
domfrag = range.createContextualFragment(txt);
while (over.hasChildNodes()) {
over.removeChild(over.lastChild);
}
over.appendChild(domfrag);
}
}
// Highlight a table row. IE only. Syntax hiLightTR(this,'#cccccc');" onMouseout="hiLightTR(this,'#ffffff');"
function hiLightTR(tr, changeTo) {
tr.className = changeTo;
}
// Expand layer in IE. If NS4, open remote controll window.
// Syntax: expandIt('layername','remotecontrolurl,40,100')
function expandIt(whichEl,URL,width,height) {
if (ns4) {openWin(URL,'remotecontroll',width,height,'no');} else
if (document.all[whichEl].style.display == "none") {document.all[whichEl].style.display = "";}
else {document.all[whichEl].style.display = "none";}
}
// Show AltText for links. Make sure the following code is on the page:
//
// Syntax: onMouseOver="showAlt('Some text','#cccccc','300')" onMouseOut="hideAlt()"
var old,skn,iex=(document.all),yyy=-1000;
function initAltText(xx,yy) {
Xoffset=xx;
Yoffset=yy;
if (ns4) skn=document.AltText
else if (ns6) skn=document.getElementById("AltText").style
else if (ie4) skn=document.all.AltText.style
if(ns4)document.captureEvents(Event.MOUSEMOVE);
else{
skn.visibility="visible"
skn.display="none"
}
document.onmousemove=get_mouse;
}
function showAlt(msg,bak,width){
var content="