function GetObj(id) 
	{ 
    if (document.getElementById) 
        var returnVar = document.getElementById(id); 
    else if (document.all) 
        var returnVar = document.all[id]; 
    else if (document.layers) 
        var returnVar = document.layers[id]; 
    return returnVar; 
	} 


// returns x coordinate of any element
function findPosX(obj){
    var curleft = 0;
    if (obj.offsetParent){
        while (obj.offsetParent){
            curleft += obj.offsetLeft
            obj = obj.offsetParent;
        }
    }
    else if (obj.x)
        curleft += obj.x;
    return curleft;
}

// returns y coordinate of any element
function findPosY(obj){
    var curtop = 0;
    if (obj.offsetParent){
        while (obj.offsetParent){
            curtop += obj.offsetTop
            obj = obj.offsetParent;
        }
    }
    else if (obj.y)
        curtop += obj.y;
    return curtop;
}
function initQuote(){
	var qField = document.getElementById('js-quote');
	var aField = document.getElementById('js-author');
	var n = Math.random();
	var r = Math.round(n*2)+1;
	var q_arr = [
		'Koterra is a very cost-effective way to manage our resources, which helps us be more efficient and provide better service for our customers.',
		'Locator is really great for mapping out my business contacts, getting driving directions and finding nearby businesses quickly and conveniently on my wireless handheld.',
		'Tierravision&#039;s Locator is the best mobile mapping software for businesses that I&#039;ve seen. Conveniently integrating my address lists and contact files with mapping and navigation translates into less time trying to locate customers and more time actually selling.',
		'Koterra is a very cost-effective way to manage our resources, which helps us be more efficient and provide better service for our customers.',
	];
	var a_arr = [
		'Brendan Heatherman<br/>Cingular Wireless Enterprise Sales',
		'Jeff Thacker<br/>Attorney, Heller Ehrman LLP',
		'Julian Bourne<br/> CEO & Founder - ProxPro',
		'Brendan Heatherman<br/>Cingular Wireless Enterprise Sales',
	];

	if(qField && aField){
		qField.innerHTML = q_arr[r];
		aField.innerHTML = a_arr[r];
	};	
};

function centerFlash()
	{
	var point = window.center({width:300,height:235});
	point.x = point.x + 233;
	GetObj('flash').style.top = "90px";
	GetObj('flash').style.left = point.x + "px";
	}
	


function initNavigation()
{
	if (document.images)
	{
		pic10= new Image(110,20);
		pic10.src="_include/img/nav-products-over.gif";
		pic11= new Image(110,20);
		pic11.src="_include/img/nav-technology-over.gif";
		pic12= new Image(110,20);
		pic12.src="_include/img/nav-solutions-over.gif";
		pic13= new Image(110,20);
		pic13.src="_include/img/nav-support-over.gif";
		pic14= new Image(110,20);
		pic14.src="_include/img/nav-partners-over.gif";
		pic15= new Image(110,20);
		pic15.src="_include/img/nav-company-over.gif";
		pic16= new Image(111,20);
		pic16.src="_include/img/nav-buy-online-over.gif";
	}
	var products= document.getElementById('nav-products');
	var technology= document.getElementById('nav-technology');
	var solutions= document.getElementById('nav-solutions');
	var support= document.getElementById('nav-support');
	var partners= document.getElementById('nav-partners');
	var company= document.getElementById('nav-company');
	var buyOnline= document.getElementById('nav-buy-online');
	var productsSub = document.getElementById('nav-products-sub');
	var supportSub = document.getElementById('nav-support-sub');
	var companySub = document.getElementById('nav-company-sub');
	var solutionsSub = document.getElementById('nav-solutions-sub');
	
	products.onmouseover = function(){
		this.firstChild.src="_include/img/nav-products-over.gif";
		productsSub.style.display = 'block';
		productsSub.style.top = (findPosY(this) + (document.all ? 22 : 11)) + 'px';
		productsSub.style.left = findPosX(this) + 'px';
	};
	products.onmouseout = function(){
		this.firstChild.src="_include/img/nav-products.gif";
		productsSub.style.display = 'none';
		//GetObj('flash').style.display = 'block';
	};
	productsSub.onmouseover = function(){
		products.firstChild.src="_include/img/nav-products-over.gif";
		this.style.display = 'block';
		this.style.top = (findPosY(products) + (document.all ? 22 : 11)) + 'px';
		this.style.left = findPosX(products) + 'px';
	};
	productsSub.onmouseout = function(){
		products.firstChild.src="_include/img/nav-products.gif";
		this.style.display = 'none';
	};
	technology.onmouseover = function(){
		this.firstChild.src="_include/img/nav-technology-over.gif";
	};
	technology.onmouseout = function(){
		this.firstChild.src="_include/img/nav-technology.gif";
	};
	solutions.onmouseover = function(){
		this.firstChild.src="_include/img/nav-solutions-over.gif";
		solutionsSub.style.display = 'block';
		solutionsSub.style.top = (findPosY(this) + (document.all ? 22 : 11)) + 'px';
		solutionsSub.style.left = findPosX(this) + 'px';
	};
	solutions.onmouseout = function(){
		this.firstChild.src="_include/img/nav-solutions.gif";
		solutionsSub.style.display = 'none';
	};
	solutionsSub.onmouseover = function(){
		solutions.firstChild.src="_include/img/nav-solutions-over.gif";
		this.style.display = 'block';
		this.style.top = (findPosY(solutions) + (document.all ? 22 : 11)) + 'px';
		this.style.left = findPosX(solutions) + 'px';
	};
	solutionsSub.onmouseout = function(){
		solutions.firstChild.src="_include/img/nav-solutions.gif";
		this.style.display = 'none';
	};
	support.onmouseover = function(){
		this.firstChild.src="_include/img/nav-support-over.gif";
		supportSub.style.display = 'block';
		supportSub.style.top = (findPosY(this) + (document.all ? 22 : 11)) + 'px';
		supportSub.style.left = findPosX(this) + 'px';
	};
	support.onmouseout = function(){
		this.firstChild.src="_include/img/nav-support.gif";
		supportSub.style.display = 'none';
	};
	supportSub.onmouseover = function(){
		support.firstChild.src="_include/img/nav-support-over.gif";
		this.style.display = 'block';
		this.style.top = (findPosY(support) + (document.all ? 22 : 11)) + 'px';
		this.style.left = findPosX(support) + 'px';
	};
	supportSub.onmouseout = function(){
		support.firstChild.src="_include/img/nav-support.gif";
		this.style.display = 'none';
	};
	partners.onmouseover = function(){
		this.firstChild.src="_include/img/nav-partners-over.gif";
	};
	partners.onmouseout = function(){
		this.firstChild.src="_include/img/nav-partners.gif";
	};
	company.onmouseover = function(){
		this.firstChild.src="_include/img/nav-company-over.gif";
		companySub.style.display = 'block';
		companySub.style.top = (findPosY(this) + (document.all ? 22 : 11)) + 'px';
		companySub.style.left = findPosX(this) + 'px';
	};
	company.onmouseout = function(){
		this.firstChild.src="_include/img/nav-company.gif";
		companySub.style.display = 'none';
	};
	companySub.onmouseover = function(){
		company.firstChild.src="_include/img/nav-company-over.gif";
		this.style.display = 'block';
		this.style.top = (findPosY(company) + (document.all ? 22 : 11)) + 'px';
		this.style.left = findPosX(company) + 'px';
	};
	companySub.onmouseout = function(){
		company.firstChild.src="_include/img/nav-company.gif";
		this.style.display = 'none';
	};
	buyOnline.onmouseover = function(){
		this.firstChild.src="_include/img/nav-buy-online-over.gif";
	};
	buyOnline.onmouseout = function(){
		this.firstChild.src="_include/img/nav-buy-online.gif";
	};
}

window.onload=function()
{
	var body = document.getElementsByTagName('body')[0];
	var quote = document.getElementById('js-quote');
	var author = document.getElementById('js-author');
	initNavigation();
	if(quote && author)initQuote();
	if (body.id=='homepage')
	{
		centerFlash();
		if (document.images)
		{
			pic1= new Image(254,60);
			pic1.src="_include/img/feature-1-over.gif";
			pic2= new Image(254,60);
			pic2.src="_include/img/feature-2-over.gif";
			pic3= new Image(254,60);
			pic3.src="_include/img/feature-3-over.gif";
			pic4= new Image(331,29);
			pic4.src="_include/img/feature-1-swap-top.gif";
			pic5= new Image(331,170);
			pic5.src="_include/img/feature-1-swap-bottom.jpg";
			pic6= new Image(331,29);
			pic6.src="_include/img/feature-2-swap-top.gif";
			pic7= new Image(331,170);
			pic7.src="_include/img/feature-2-swap-bottom.jpg";
			pic8= new Image(331,29);
			pic8.src="_include/img/feature-3-swap-top.gif";
			pic9= new Image(331,170);
			pic9.src="_include/img/feature-3-swap-bottom.jpg";
		}
		// containers
		var cTop = document.getElementById('swap-top');
		var cBottom = document.getElementById('swap-bottom');
		// rollover links
		var swap1 = document.getElementById('swap1');
		var swap2 = document.getElementById('swap2');
		var swap3 = document.getElementById('swap3');
		
		swap1.onmouseover = function(){
			this.firstChild.src='_include/img/feature-1-over.gif';
			cTop.innerHTML='<img src="_include/img/feature-1-swap-top.gif" />';
			cBottom.innerHTML='<img src="_include/img/feature-1-swap-bottom.jpg" />';
			GetObj('flash').style.visibility = 'hidden';
		}
		swap1.onmouseout = function(){
			this.firstChild.src='_include/img/feature-1-up.gif';
			cTop.innerHTML='<img src="_include/img/default-top.gif" />';
			cBottom.innerHTML='<img src="_include/img/default-bottom.jpg" />';
			GetObj('flash').style.visibility = 'visible';
		}
		swap2.onmouseover = function(){
			this.firstChild.src='_include/img/feature-2-over.gif';
			cTop.innerHTML='<img src="_include/img/feature-2-swap-top.gif" />';
			cBottom.innerHTML='<img src="_include/img/feature-2-swap-bottom.jpg" />';
			GetObj('flash').style.visibility = 'hidden';
		}
		swap2.onmouseout = function(){
			this.firstChild.src='_include/img/feature-2-up.gif';
			cTop.innerHTML='<img src="_include/img/default-top.gif" />';
			cBottom.innerHTML='<img src="_include/img/default-bottom.jpg" />';			
			GetObj('flash').style.visibility = 'visible';
		}
		swap3.onmouseover = function(){
			this.firstChild.src='_include/img/feature-3-over.gif';
			cTop.innerHTML='<img src="_include/img/feature-3-swap-top.gif" />';
			cBottom.innerHTML='<img src="_include/img/feature-3-swap-bottom.jpg" />';
			GetObj('flash').style.visibility = 'hidden';
		}
		swap3.onmouseout = function(){
			this.firstChild.src='_include/img/feature-3-up.gif';
			cTop.innerHTML='<img src="_include/img/default-top.gif" />';
			cBottom.innerHTML='<img src="_include/img/default-bottom.jpg" />';			
			GetObj('flash').style.visibility = 'visible';
		}
		
	setTimeout('GetObj(\'flash\').style.display = \"block\";',3000);
	
	}
}