document.write('<script type="text/javascript" src="/scripts/omnik/CallCOM.js"></script>');
/*
 | Browser object
 */
function oBrowser() {
	 d=document;
	 this.agt=navigator.userAgent.toLowerCase();
	 this.major = parseInt(navigator.appVersion);
	 this.dom=(d.getElementById)?1:0; // true for ie6, ns6
	 this.ns=(d.layers);
	 this.ns4up=(this.ns && this.major >=4);
	 this.ns6=(this.dom&&navigator.appName=="Netscape");
	 this.op=(window.opera? 1:0);
	 this.ie=(d.all);
	 this.ie4=(d.all&&!this.dom)?1:0;
	 this.ie4up=(this.ie && this.major >= 4);
	 this.ie5=(d.all&&this.dom);
	 this.win=((this.agt.indexOf("win")!=-1) || (this.agt.indexOf("16bit")!=-1));
	 this.mac=(this.agt.indexOf("mac")!=-1);
}

var oBw = new oBrowser();

function getX(o) {
	return (oBw.ns)?o.left:((o.style.pixelLeft)?o.style.pixelLeft:o.offsetLeft); 
}

function getY(o) { 
	return (oBw.ns)?o.top:((o.style.pixelTop)?o.style.pixelTop:o.offsetTop); 
}

function getPageX(o) {
	var x=0; 
	if(oBw.ns) {
		x=o.pageX; 
	} else {
		while(eval(o)) 
			{ x+=o.offsetLeft; o=o.offsetParent; }
	}
	return x; 
}
function getPageY(o) {
	var y=0;
	if(oBw.ns) {
		y=o.pageY; 
	} else {
		while(eval(o)){
			y+=o.offsetTop; o=o.offsetParent; 
		} 
	}
	return y; 
}


function setX(o,x) {
	if(oBw.ns) { 
		o.left=x;
	} else if(typeof o.style.pixelLeft != 'undefined') {
		o.style.pixelLeft=x;
	} else {
		thisPos = parseInt(x);
		// preventing NS UNcaught Exception Error in strict.dtd mode: converting value to integer in case passed as string
		thisPos += "px";
		o.style.left = thisPos;
	}
}
function setY(o,y) {
	if(oBw.ns) {
		o.top=y;
	} else if(typeof o.style.pixelTop != 'undefined') {
		o.style.pixelTop=y;
	} else {
		thisPos = parseInt(y);			
		// preventing NS UNcaught Exception Error in strict.dtd mode: converting value to integer in case passed as string
		thisPos += "px";
		o.style.top = thisPos;
	}
}



function setLayerLocation(div,href,offx,offy) {
	var e = document.getElementById(div);
	//get position of link
	var x = getPageX(href);
	var y = getPageY(href);
	// check and set there is offset
	x= offx ? x + offx : x;
	y= offy ? y + offy : y;
	//move layer
	setX(e,x)
	setY(e,y); 	
}



function popupTooltip(tip, href, offx, offy, width){
	var e = document.getElementById(tip);
	if (e.className.indexOf('hiddenTip') != -1) {
		hideAllTooltips();
		setLayerLocation(tip,href,offx,offy);		
		e.style.width = width + 'px';		
		var arrowX;
		if (offx > 0) {
			arrowX = offx + 15;
		} else {
			arrowX = 15 - offx;
		}
		var closeX = width + 20;
		e.innerHTML += '<img src="/images/common/tooltips/arrow.gif" style="position: absolute; z-index:10002; left: '+ arrowX + 'px;"/>';
		e.innerHTML += '<img src="/images/common/tooltips/close.gif" style="position: absolute; z-index: 10002; top: 18px; left: ' + closeX + 'px; cursor: pointer;" onClick="hideTooltip(\'' + tip + '\')"/>';
		e.className = 'showTip'; //show layer			
	} else {
		e.className = 'hiddenTip';
	}
		// if current popup is hidden, make sure all others are hidden.
	
}

function hideTooltip(tip){
	var e = document.getElementById(tip);		
	if (e.className.indexOf('showTip') != -1) {
		e.className = 'hiddenTip';
	} 
	
}

function hideAllTooltips(){
	var elms = document.getElementsByTagName('div');
	for (var i =  elms.length-1; i >=0; i--)	{
		if (elms[i].className.indexOf('showTip') != -1)	{
			// if a class contains 'showclass' set to 'hideclass'
			elms[i].className = 'hiddenTip';
		}
	}
}

// JavaScript Document
function swapImages(box, img1, img2){
	//var box = document.getElementById(boxId);
	if (box.src == img1.src) {
		box.src = img2.src;
	} else {
		box.src= img1.src;
	}	
}

function hideObject(id){
	var e = document.getElementById(id);
	e.style.display = 'none';
}

function showObject(id, style){
	var e = document.getElementById(id);
	e.style.display = style;
}

function setTableEvenTr(tid){
	var trs = document.getElementById(tid).getElementsByTagName("tr");	
	for (var i = 0; i < trs.length ;i ++) {		
		if (trs[i].className == "tableheader") {
			continue;
		} else {
			trs[i].className = 'odd';
			i ++ ;
			if ( i < trs.length) {		
				trs[i].className = 'even';
			} else {
				break;
			}
		}
	}	
}

function disableSubmit(f) {
	for (i=1; i<f.elements.length; i++) {
		if (f.elements[i].type == 'button') {
			f.elements[i].disabled = true;
		}
	}
}

function refreshImg(eleId, imgSrc)
{
    document.getElementById(eleId).src=imgSrc + "?" + Math.random();
}
