
//CLASS CONSTRUCTOR-- builds browser information object
function _browserInfo()
{
 var navAppName = navigator.appName.toLowerCase();
 var navUserAgent = navigator.userAgent.toLowerCase();
 if((navAppName.indexOf("microsoft")>=0) && !(navUserAgent.indexOf("opera")>=0)) //if IE
 {
  this.ie = true;
	var start_pos = navUserAgent.indexOf("msie") + 4;
	this.majorVersion = parseInt(navUserAgent.substring(start_pos));
 }
 else if((navUserAgent.indexOf("firefox")>=0)) //if Firefox
 {
  this.firefox = true;
	var start_pos = navUserAgent.indexOf("firefox/") + 8;
	this.majorVersion = parseInt(navUserAgent.substring(start_pos));
 }
 else if((navUserAgent.indexOf("safari")>=0) && !(navUserAgent.indexOf("chrome")>=0)) //if Safari
 {
  this.safari = true;
	var start_pos = navUserAgent.indexOf("version/") + 8;
	this.majorVersion = parseInt(navUserAgent.substring(start_pos));
 }
 else if((navUserAgent.indexOf("chrome")>=0) && (navUserAgent.indexOf("safari")>=0)) //if Chrome
 {
  this.chrome = true;
	var start_pos = navUserAgent.indexOf("chrome/") + 7;
	this.majorVersion = parseInt(navUserAgent.substring(start_pos));
 }
 else if(navUserAgent.indexOf("opera")>=0) //if Opera
 {
  this.opera = true;
	var start_pos = navUserAgent.indexOf("opera") + 6;
	this.majorVersion = parseInt(navUserAgent.substring(start_pos));
 }
 else if((navAppName.indexOf("netscape")>=0) && !(navUserAgent.indexOf("opera")>=0) && !(navUserAgent.indexOf("safari")>=0) && !(navUserAgent.indexOf("firefox")>=0)) //if Netscape 
 {
	this.ns = true;
 }

 //identify platform
 var browserPlatform = navigator.platform.toLowerCase();
 if(browserPlatform.indexOf("wince")>=0) this.isWinCE = true;
 else if(browserPlatform.indexOf("win")>=0) this.isWin = true;
 else if(browserPlatform.indexOf("mac")>=0) this.isMac = true;
 else this.isWin = true; //default to win platform if platform is not identified
}

gBrowser = new _browserInfo();


//------------------------------------------------------------------------------
// NEW BROWSER WINDOW FUNCTIONS BEGIN
//------------------------------------------------------------------------------

//FUNCTION-- creates a new 3/4 browser window for links to other websites throughout site
function openExternalWin(argURL) {
 externalWin = window.open(argURL, null, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=600,height=500');
 if(externalWin != null) externalWin.focus();
}

//------------------------------------------------------------------------------
// NEW BROWSER WINDOW FUNCTIONS END
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
// SCREEN FUNCTIONS BEGIN
//------------------------------------------------------------------------------

//FUNCTION-- returns screen height
function getScreenHeight() {
 return parseInt(screen.height);
}

//------------------------------------------------------------------------------

//FUNCTION-- returns screen width
function getScreenWidth() {
 return parseInt(screen.width);
}

//------------------------------------------------------------------------------

//FUNCTION-- returns height of working area of system's screen, excluding windows taskbar
function getScreenAvailHeight() {
 return parseInt(screen.availHeight);
}

//------------------------------------------------------------------------------

//FUNCTION-- returns width of working area of system's screen, excluding windows taskbar
function getScreenAvailWidth() {
 return parseInt(screen.availWidth);
}

//------------------------------------------------------------------------------
// SCREEN FUNCTIONS END
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
// BROWSER WINDOW FUNCTIONS BEGIN
//------------------------------------------------------------------------------

//FUNCTION-- returns height of browser window
function getBrowserWindowHeight() {
 if(document.all) //ie
 {
	if(checkMode()) return document.documentElement.clientHeight;
	else return document.body.clientHeight;
 }
 else if(isScrollMax()) //mozilla
 {
	if(hasHorizontalScrollbar()) return window.innerHeight-getScrollbarOffSet();
	else return window.innerHeight;
 }
 else return window.innerHeight;
}

//------------------------------------------------------------------------------

//FUNCTION-- returns width of browser window
function getBrowserWindowWidth() {
 if(document.all) //ie
 {
	if(checkMode()) return document.documentElement.clientWidth;
	else return document.body.clientWidth;
 }
 else if(isScrollMax()) //mozilla
 {
	if(hasVerticalScrollbar()) return window.innerWidth-getScrollbarOffSet();
	else return window.innerWidth;
 }
 else if(gBrowser.safari && hasVerticalScrollbar()) //safari
 {
	return window.innerWidth - getScrollbarOffSet();
 }
 else return window.innerWidth;
}

//------------------------------------------------------------------------------
// BROWSER WINDOW FUNCTIONS END
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
// BROWSER BODY/DOCUMENT FUNCTIONS BEGIN
//------------------------------------------------------------------------------

//FUNCTION-- returns height of body
function getBodyHeight() {
 if(document.all) //ie
 {
	if(checkMode()) return document.documentElement.scrollHeight;
	else return document.body.scrollHeight;
 }
 else if(isScrollMax()) //mozilla
 {
	var scrollOffSet = 0;
	if(hasHorizontalScrollbar()) scrollOffSet = getScrollbarOffSet();

	if(hasVerticalScrollbar())	return (window.innerHeight+window.scrollMaxY)-scrollOffSet;
  else return window.innerHeight-scrollOffSet;
 }
 else return document.body.scrollHeight;
}

//------------------------------------------------------------------------------

//FUNCTION-- returns width of body
function getBodyWidth() {
 if(document.all) //ie
 {
	if(checkMode()) return document.documentElement.scrollWidth;
	else return document.body.scrollWidth;
 }
 else if(isScrollMax()) //mozilla
 {
	var scrollOffSet = 0;
	if(hasVerticalScrollbar()) scrollOffSet = getScrollbarOffSet();

	if(hasHorizontalScrollbar())	return (window.innerWidth+window.scrollMaxX)-scrollOffSet;
  else return window.innerWidth-scrollOffSet;
 }
 else return document.body.scrollWidth;
}

//------------------------------------------------------------------------------
// BROWSER BODY/DOCUMENT FUNCTIONS END
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
// BROWSER SCROLLBAR FUNCTIONS BEGIN
//------------------------------------------------------------------------------

//FUNCTION-- determines horizontal scrollbar existence
function hasHorizontalScrollbar() {
 if(!document.all && isScrollMax()) //mozilla
 {
  if(window.scrollMaxX > 0) return true; //has scrollbar
	else return false; //has no scrollbar
 }
 else {alert("Function not supported by browser"); return;}
}

//------------------------------------------------------------------------------

//FUNCTION-- determines vertical scrollbar existence
function hasVerticalScrollbar() {
 if(!document.all && isScrollMax()) //mozilla
 {
  if(window.scrollMaxY > 0) return true; //has scrollbar
	else return false; //has no scrollbar
 }
 else if(gBrowser.safari) //safari
 {
	if(window.innerWidth == getBodyWidth()) return false;
	else return true;
 }
 else {alert("Function not supported by browser"); return;}
}

//------------------------------------------------------------------------------

//FUNCTION-- checks if scrollMaxY and scrollMaxX properties are supported
function isScrollMax() {
 if(window.scrollMaxY >= 0 && window.scrollMaxX >= 0) return true;
 else return false;
}

//------------------------------------------------------------------------------

//FUNCTION-- returns vertical scroll position
function getVerticalScrollPosition() {
 if(window.pageYOffset) {return window.pageYOffset;}
 else if(document.documentElement && document.documentElement.scrollTop) {return document.documentElement.scrollTop;}
 else if(document.body) {return document.body.scrollTop;}
}

//------------------------------------------------------------------------------

//FUNCTION-- returns horizontal scroll position
function getHorizontalScrollPosition() {
 if(window.pageXOffset) {return window.pageXOffset;}
 else if(document.documentElement && document.documentElement.scrollLeft) {return document.documentElement.scrollLeft;}
 else if(document.body) {return document.body.scrollLeft;}
}

//------------------------------------------------------------------------------

//FUNCTION-- returns offset value equal to scrollbar width
function getScrollbarOffSet() {
 if(gBrowser.firefox)
 {
  if(gBrowser.isWin) return 17;
	else if(gBrowser.isMac) return 15;
 }
 else if(gBrowser.safari) {return 15;}
}

//------------------------------------------------------------------------------
// BROWSER SCROLLBAR FUNCTIONS END
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
// BROWSER COMPATMODE FUNCTIONS BEGIN
//------------------------------------------------------------------------------

//FUNCTION-- checks document mode for IE
function checkMode() {
 if(document.all) {return (document.compatMode && document.compatMode != "BackCompat");}
 else {alert("Mode not detected");}
}

//------------------------------------------------------------------------------

//FUNCTION-- sets document mode for IE (documentElement or body based on DOCTYPE used)
function setMode() {
 if(document.all)
 {
	if(checkMode()) {DOCUMENTMODE = document.documentElement;}
	else {DOCUMENTMODE = document.body;}
 }
 else {alert("Unable to set mode");}
}

//------------------------------------------------------------------------------
// BROWSER COMPATMODE FUNCTIONS END
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
// OBJECT POSITIONING FUNCTIONS BEGIN
//------------------------------------------------------------------------------

//FUNCTION-- returns left coordinates for object centering
function getObjectPositionLeft(argScreenWidth, argObjWidth) {
 if(argObjWidth < argScreenWidth)
 {
  var halfScreenWidth = parseInt(argScreenWidth/2);
  var halfObjWidth = parseInt(argObjWidth/2);
  return ((halfScreenWidth-halfObjWidth)+getHorizontalScrollPosition());
 }
 else return 0;
}

//------------------------------------------------------------------------------

//FUNCTION-- returns top coordinates for object centering
function getObjectPositionTop(argScreenHeight, argObjHeight) {
 if(argObjHeight < argScreenHeight)
 {
  var halfScreenHeight = parseInt(argScreenHeight/2);
  var halfObjHeight = parseInt(argObjHeight/2);
  return ((halfScreenHeight-halfObjHeight)+getVerticalScrollPosition());
 }
 else return getVerticalScrollPosition();
}

//------------------------------------------------------------------------------

//FUNCTION-- validate top position
function isValidatePositionTop(argTopPosition, argObjectHeight, argBrowserWindowHeight) {
 if(argTopPosition <= 0 || (argTopPosition+argObjectHeight) > argBrowserWindowHeight) return false;
 else return true;
}

//------------------------------------------------------------------------------

//FUNCTION-- validate left position
function isValidatePositionLeft(argLeftPosition, argObjectWidth, argBrowserWindowWidth) {
 if(argLeftPosition <= 0 || (argLeftPosition+argObjectWidth) > argBrowserWindowWidth) return false;
 else return true;
}

//------------------------------------------------------------------------------
// OBJECT POSITIONING FUNCTIONS END
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
// IMAGE DIALOG BEGIN
//------------------------------------------------------------------------------

//FUNCTION-- loads image dialog
function loadImageCMSDialog(argUrl) {

    function imageLoadHandler() {
        document.getElementById("imageControlsDiv").style.width = imgObj.width + "px";
        document.getElementById("imageContainer").innerHTML = ''; //clear content
        document.getElementById("imageContainer").innerHTML = '<img src="' + argUrl + '" height="' + imgObj.height + '" width="' + imgObj.width + '">';
        imageViewerDialog.m_setWidth(imageViewerDialog.m_getWidth(), false); //set width
        imageViewerDialog.m_showDialog(true);
    }

    function imgErrorHandler() {
        alert("The image you requested failed to load. Please click the OK button and try again.");
    }

    var imgObj = new Image();
    imgObj.onload = imageLoadHandler;
    imgObj.onerror = imgErrorHandler;
    imgObj.src = argUrl;
}

//FUNCTION-- clear image dialog
function clearImageDialog() {
 activeDialog.m_hideDialog(true); //hide dialog
}

//FUNCTION-- shows image controls bar
function showImageControls() {
 document.getElementById("imageControlsDiv").style.display = "block";
}

//FUNCTION-- hides image controls bar
function hideImageControls() {
 document.getElementById("imageControlsDiv").style.display = "none";
}
//------------------------------------------------------------------------------
// IMAGE DIALOG END
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
// CLASS CONSTRUCTORS BEGIN
//------------------------------------------------------------------------------

//CLASS CONSTRUCTOR-- the super class
function Class_Super() {}

//Prototype derive/extend (single inheritance only)
Spawn_Object.prototype = new Class_Super;

//Prototype properties
//Class_Super.prototype.zIndexCounter = 500; //global index counter for all elements in a page

//------------------------------------------------------------------------------

//CLASS CONSTRUCTOR-- creates an generic object
function Spawn_Object(argDivID) {
 this.objDivID = argDivID; //set element ID
}

//------------------------------------------------------------------------------
// CLASS CONSTRUCTORS END
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
// METHODS BEGIN
//------------------------------------------------------------------------------

//METHOD-- init Core properties
function _initCoreProperties() {
 if(this.objDivID)
 {
  this.objCss = document.getElementById(this.objDivID).style; //create reference to [object CSSStyleDeclaration]
  this.objDivElement = document.getElementById(this.objDivID); //create reference to [object HTMLDivElement]
  //eval(this.obj + "=this"); //for methods using setTimeouts, setInterval, or eval's to call itself
 }
 else alert("Element ID Not Found");
}

Class_Super.prototype.m_initCoreProperties = _initCoreProperties;

//------------------------------------------------------------------------------

//METHOD-- set height property of object
function _setHeight(argHeight, argSynch) {
 this.objH = argHeight;
 if(argSynch) this.m_synchHeightProperty(); //synch to element property
}

Class_Super.prototype.m_setHeight = _setHeight;

//------------------------------------------------------------------------------

//METHOD-- set width property of object
function _setWidth(argWidth, argSynch) {
 this.objW = argWidth;
 if(argSynch) this.m_synchWidthProperty(); //synch to element property
}

Class_Super.prototype.m_setWidth = _setWidth;

//------------------------------------------------------------------------------

//METHOD-- get height of element
function _getHeight() {
 return this.objDivElement.offsetHeight;
}

Class_Super.prototype.m_getHeight = _getHeight;

//------------------------------------------------------------------------------

//METHOD-- get width of element
function _getWidth() {
 return this.objDivElement.offsetWidth;
}

Class_Super.prototype.m_getWidth = _getWidth;

//------------------------------------------------------------------------------

//METHOD-- synchs elements height property with objects height property
function _synchHeightProperty() {
 this.objCss.height = this.objH+"px";
}

Class_Super.prototype.m_synchHeightProperty = _synchHeightProperty;

//------------------------------------------------------------------------------

//METHOD-- synchs elements width property with objects width property
function _synchWidthProperty() {
 this.objCss.width = this.objW+"px";
}

Class_Super.prototype.m_synchWidthProperty = _synchWidthProperty;

//------------------------------------------------------------------------------

//METHOD-- set top property of object
function _setTop(argTop) {
 this.objY = argTop; 
 this.m_synchTopProperty();
}

Class_Super.prototype.m_setTop = _setTop;

//------------------------------------------------------------------------------

//METHOD-- set left property of object
function _setLeft(argLeft) {
 this.objX = argLeft; 
 this.m_synchLeftProperty();
}

Class_Super.prototype.m_setLeft = _setLeft;

//------------------------------------------------------------------------------

//METHOD-- get top property of object
function _getTop(argTop) {
 return this.objDivElement.offsetTop; 
}

Class_Super.prototype.m_getTop = _getTop;

//------------------------------------------------------------------------------

//METHOD-- get left property of object
function _getLeft(argLeft) {
 return this.objDivElement.offsetLeft; 
}

Class_Super.prototype.m_getLeft = _getLeft;

//------------------------------------------------------------------------------

//METHOD-- synchs elements top property with objects top property
function _synchTopProperty() {
 if(document.all) {this.objCss.pixelTop = this.objY;}
 else {this.objCss.top = this.objY+"px";} 
}

Class_Super.prototype.m_synchTopProperty = _synchTopProperty;

//------------------------------------------------------------------------------

//METHOD-- synchs elements left property with objects left property
function _synchLeftProperty() {
 if(document.all) {this.objCss.pixelLeft = this.objX;}
 else {this.objCss.left = this.objX+"px";} 
}

Class_Super.prototype.m_synchLeftProperty = _synchLeftProperty;

//------------------------------------------------------------------------------

//METHOD-- sets display property to block
function _displayBlock() {
 this.objCss.display = "block";
}

Class_Super.prototype.m_displayBlock = _displayBlock;

//------------------------------------------------------------------------------

//METHOD-- sets display property to none
function _displayNone() {
 this.objCss.display = "none";
}

Class_Super.prototype.m_displayNone = _displayNone;

//------------------------------------------------------------------------------

//METHOD-- returns display property of object
function _getDisplay() {
 return this.objCss.display;
}

Class_Super.prototype.m_getDisplay = _getDisplay;

//------------------------------------------------------------------------------

//METHOD-- sets background image
function _setBackgroundImage(argImagePath) {
 this.objCss.backgroundImage = "url("+argImagePath+")";
}

Class_Super.prototype.m_setBackgroundImage = _setBackgroundImage;

//------------------------------------------------------------------------------

//METHOD-- sets Alpha background image (IE only)
function _setAlphaImage(argImagePath) {
 if(document.all) this.objCss.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+argImagePath+"', sizingMethod='scale')";
 else this.m_setBackgroundImage(argImagePath);
}

Class_Super.prototype.m_setAlphaImage = _setAlphaImage;

//------------------------------------------------------------------------------

//METHOD-- moves object to new coordinates
function _moveTo(argY, argX) {
 this.objX = parseInt(argX);
 this.objY = parseInt(argY);
 this.m_synchTopProperty();
 this.m_synchLeftProperty();
}

Class_Super.prototype.m_moveTo = _moveTo;

//------------------------------------------------------------------------------

//METHOD-- sets height and width of mask
function _setMask() {
 this.m_setHeight(50, true);
 this.m_setWidth(50, true);
 
 //get height
 var theWindowHeight = getBrowserWindowHeight();
 var theBodyHeight = getBodyHeight();
  
 //get width
 var theWindowWidth = getBrowserWindowWidth();
 var theBodyWidth = getBodyWidth();
 
 //alert("Window: " + theWindowHeight + " " + theWindowWidth + "\n" + "Body: " + theBodyHeight + " " + theBodyWidth + "\n" + window.scrollMaxY);

 //set mask height
 if(theWindowHeight >= theBodyHeight) {this.m_setHeight(theWindowHeight, true);}
 else {this.m_setHeight(theBodyHeight, true);}

 //set mask width
 if(theWindowWidth >= theBodyWidth) {this.m_setWidth(theWindowWidth, true);}
 else {this.m_setWidth(theBodyWidth, true);}
 
 this.m_displayBlock(); //display the mask
}

Class_Super.prototype.m_setMask = _setMask;

//------------------------------------------------------------------------------

//METHOD-- centers an object vertically and horizontally within the browser window
function _centerObj(argPageWidth) {
 var theBrowserWinWidth = getBrowserWindowWidth();
 var theBrowserWinHeight = getBrowserWindowHeight();
 
 if(argPageWidth != false) //if website is fixed width (not liquid)
 {
	if(theBrowserWinWidth > argPageWidth) theBrowserWinWidth = argPageWidth;
 }
 
 var leftPosition = getObjectPositionLeft(theBrowserWinWidth, this.objW);

 if(this.fixedTop) {var topPosition = 0;}
 else var topPosition = getObjectPositionTop(theBrowserWinHeight, this.objH);
 
 if(this.offSetHeight) this.m_moveTo((topPosition + this.offSetHeight), leftPosition);
 else this.m_moveTo(topPosition, leftPosition);
}

Class_Super.prototype.m_centerObj = _centerObj;

//------------------------------------------------------------------------------
// METHODS END
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
// DIALOG BEGIN
//------------------------------------------------------------------------------

//FUNCTION-- perform mask initialization
function initMask(argID, argImage) {
 var maskObj;
 if(document.all)
 {
  maskObj = new Spawn_Object(argID+"Iframe");
  maskObj.m_initCoreProperties();
 }
 else 
 {
  maskObj = new Spawn_Object(argID+"Div");
  maskObj.m_initCoreProperties();
  maskObj.m_setAlphaImage(argImage);
 }
 maskObj.m_setHeight(50, true);
 maskObj.m_setWidth(50, true);
 maskObj.m_setTop(0);
 maskObj.m_setLeft(0);
 return maskObj; //return mask object
}

//------------------------------------------------------------------------------

//METHOD-- init dailog properties
function _initDialogProperties(argMask, argDialogType) {
 this.m_initCoreProperties();
 this.m_setHeight(this.m_getHeight(), false);
 this.m_setWidth(this.m_getWidth(), false);
 this.m_setTop(0);
 this.m_setLeft(-2000);
 if(argMask) this.mask = argMask;
 this.dialogType = argDialogType;
 this.objInit = true;
}

Spawn_Object.prototype.m_initDialogProperties = _initDialogProperties;

//------------------------------------------------------------------------------

//METHOD-- show Dialog
function _showDialog() {
 if(this.mask) this.mask.m_setMask();
 this.m_setHeight(this.m_getHeight(), false);
 this.m_centerObj(false);
 activeDialog = this; //sets active dialog
}

Spawn_Object.prototype.m_showDialog = _showDialog;

//------------------------------------------------------------------------------

//METHOD-- hide Dialog
function _hideDialog() {
 this.m_moveTo(0, -2000);
 activeDialog = null; //clear active dialog
 if(this.mask) this.mask.m_displayNone();
}

Spawn_Object.prototype.m_hideDialog = _hideDialog;

//------------------------------------------------------------------------------

//METHOD-- adjust dialog position and mask dimensions when window is resized
function adjustDialog() {
 if(activeDialog)
 {
  if(activeDialog.mask && activeDialog.mask.m_getDisplay() == "block") activeDialog.mask.m_setMask(); //if dialog has mask and is showing
  activeDialog.m_setHeight(activeDialog.m_getHeight(), false);
  activeDialog.m_centerObj(false);
 }
}

//------------------------------------------------------------------------------

//METHOD-- sets various resource properties
function _setResource(argLink, argMetric, argTarget) {
 if(this.objInit)
 { 
  if(activeDialog) activeDialog.m_hideDialog(); //hide current dialog
  if(isObject(argLink)) {this.url = argLink.href;} //set url href
  else {this.url = argLink;} //set url string
  if(argMetric) this.metric = argMetric; //set metric
  if(argTarget) this.target = argTarget; //set target for url [if no arg open new window | if arg load existing window]

  switch(this.dialogType)
  {
   case "siteExit": //leaving site dialog
    this.m_showDialog();
    break;
   case "generalInfo": //general info dialog
    this.m_showDialog();
    break;
   case "imageInfo": //image info dialog
    this.m_showDialog();
    break;
   default:
    alert("_setResource: dialogType NOT FOUND");
  }
 }
}

Spawn_Object.prototype.m_setResource = _setResource;

//------------------------------------------------------------------------------

//METHOD-- sets various resource properties
function _loadResource() {
 if(this.objInit)
 {
  if(activeDialog) activeDialog.m_hideDialog(); //hide current dialog
  switch(this.dialogType)
  {
   case "siteExit": //general resource
    if(!this.target) openExternalWin(this.url); //load in new window
    else window.location.href = this.url; //load in current window
    break;
   case "generalInfo": //general info resource
    break;
   case "imageInfo": //image info resource
    break;
   default:
    alert("_showDialog: dialogType NOT FOUND");
  }
 }
}

Spawn_Object.prototype.m_loadResource = _loadResource;

//------------------------------------------------------------------------------
// DIALOG END
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
// FUNCTIONS BEGIN
//------------------------------------------------------------------------------

//FUNCTION-- validate if object
function isObject(argObjType) {
 if(typeof(argObjType) == "object") return true;
 else return false;
}

//------------------------------------------------------------------------------

//FUNCTION-- adds onload events
function addOnLoadEvent(func) {
 var oldonload = window.onload;
 if(typeof window.onload != "function") {window.onload = func;}
 else {window.onload = function() {if(oldonload) {oldonload();} func();}}
}

//------------------------------------------------------------------------------
// FUNCTIONS END
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
// DIALOG BEGIN
//------------------------------------------------------------------------------

//message1Dialog = new Spawn_Object("message1DialogDiv");
//message2Dialog = new Spawn_Object("message2DialogDiv");
imageViewerDialog = new Spawn_Object("imageViewerDiv");

//FUNCTION-- init dailogs
function initDialogs() {
    var grayMask = initMask("mask01", "/images/whiteAlpha.png"); //initialize mask

    //message1Dialog.m_initDialogProperties(grayMask, "siteExit"); //init common dialog properties [mask=mask object or null | dialogType=string]
    //message2Dialog.m_initDialogProperties(grayMask, "generalInfo"); //init common dialog properties [mask=mask object or null | dialogType=string]
    imageViewerDialog.m_initDialogProperties(grayMask, "imageInfo"); //init common dialog properties [mask object or null | dialogType=string]
    imageViewerDialog.fixedTop = true;

    activeDialog = null;
    window.onresize = adjustDialog;
}

//------------------------------------------------------------------------------
// DIALOG END
//------------------------------------------------------------------------------