
var res = screen.width;
var winVue = null

var strDomain = "wisdommatrix"
var strDomainSuffix = "com"
var strTag1 = "mail"
var strTag2 = "to:"
var strSeparator = "@"

function getObjectStyle(obj) {
	var theObj
	if (document.layers) {
		if (typeof obj == "string") {
			// just one layer deep
			return document.layers[obj]
		} else {
			// can be a nested layer
			return obj
		}
	}
	if (document.all) {
		if (typeof obj == "string") {
			return document.all(obj).style
		} else {
			return obj.style
		}
	}
	if (document.getElementById) {
		if (typeof obj == "string") {
			return document.getElementById(obj).style
		} else {
			return obj.style
		}
	}
	return null
}

function getObjectImage(objname) {
	// this function looks for images within a layer
	var theObj
	if (typeof objname == "string") {
		// first look for image object in images array
		if (document.images) {
			for (i=0; i<document.images.length; i++) {
				if (document.images[i].name == objname) {
					return document.images[i]
				}
			}
		}
		// if they are layers, look for it in the layers
		if (document.layers) {
			for (i=0; i<document.layers.length; i++) {
				var theLayer = document.layers[i]
				for (j=0; j<theLayer.document.images.length; j++) {
	        		whichImage = theLayer.document.images[j];
					if (whichImage.name == objname) {
						return whichImage
					}
	             }
	         }
		}
	}
	return null
}

function getObject(obj, objtype) {
	return true
	// this still need to be developed
	var theObj
	if (document.layers) {
		for (i=0; i<document.layers.length; i++) {
			theObj = document.layers[i];
			if (theObj.id.indexOf(obj) != -1) {
				return whichEl
			}
		}
	}
	if (document.all) {
		if (document.all) {
			var objTable = document.all.tags();
			for (i=0; i<objTable.length; i++) {
				whichEl = objTable(i);
				 if (whichEl.id == obj) {
				 		return whichEl
				}
            }
        }
	}
	if (document.getElementById) {
		 document.getElementById(obj)
	}
	return null
}

function getEmail() {
	document.write('<a href="mailto:contactrequest@wisdommatrix.com">Contact Us</a>')
}

function getEmailFooter() {
	//document.write('<a href="mailto:contactrequest@wisdommatrix.com" class="light">Contact Us</a>')
	var strEmail = "contactrequest"
	document.write('<a class="light" href="' + strTag1 + strTag2 + strEmail + strSeparator + strDomain + "." + strDomainSuffix + '">Contact Us</a>')
}

	
function openVUE() {
	// find width of screen
	var aw = (screen.availWidth);
	var ah = (screen.availHeight);
	//var vuePath = "../vue/default.asp"
	var vuePath = "http://www.wisdommatrix.com/vue/"
	
	varFeatures = "width=" + aw + ",height=" + ah + ",scrollbars=Yes,resizable=Yes"
	varFeatures = varFeatures + ",toolbar=Yes,location=Yes,directories=Yes,status=1,menubar=Yes"
	
	if (!winVue || !winVue.open || winVue.closed ) {
 		winVue = window.open(vuePath,"VUEWindow", varFeatures);
	}	
	
	winVue.moveTo(0,0);
	winVue.focus()
  	return false
}

function goto_portfolio() {
	xPage = document.frmCategory.categories.options[document.frmCategory.categories.selectedIndex].value
	document.location = xPage
}

function show_qualifier(varLayer) {
	var theObj = getObjectStyle(varLayer)
	if (theObj != null) {
		theObj.visibility = "visible"
	}
}

function hide_qualifier(varLayer) {
	var theObj = getObjectStyle(varLayer)
	if (theObj != null) {
		theObj.visibility = "hidden"
	}
}

function PositionPopup(strImage,strLayer) {

	var varLeft = 0

	// get position of image to align popup underneath	
	var varImage = document.images[strImage]

	if (document.layers) {
		varPos = varImage.x
		document[strLayer].left = varPos - varLeft
	} else if (document.all) {
		varPos = getRealLeft(varImage)
		document.all[strLayer].style.left = varPos - varLeft
	} else if (document.getElementById) {
		varPos = varImage.offsetLeft
		var obj = document.getElementById(strLayer)
		if (obj != null) {
			obj.style.left = varPos
		}
	}
}

function getRealLeft(varObj) {
	xPos = varObj.offsetLeft;
	tempEl = varObj.offsetParent;
  	while (tempEl != null) {
		xPos += tempEl.offsetLeft;
  		tempEl = tempEl.offsetParent;
  	}
	return xPos;
}

function getRealTop(varObj) {
	yPos = varObj.offsetTop
	tempEl = varObj.offsetParent;
  	while (tempEl != null) {
		yPos += tempEl.offsetTop;
  		tempEl = tempEl.offsetParent;
  	}
	return yPos;	
}
