defaulColor='#BDD9E6';
curColor='#CDE8F4';
curLinkColor='#F29228';
var flagAlreadyLoaded=false;


function initEvent(){
	if(flagAlreadyLoaded) return;
	flagAlreadyLoaded=true;
	curPageGroup='';
	if(partUrl=/^\/features\/(.+)\//.exec(location.pathname)){
		curSubPageGroup=partUrl[1];
		curPageGroup='features';
		
	}
	if(location.pathname=='/index.html'||location.pathname=='/'||location.pathname=='/homepageduplicate'||location.pathname=='/hp_be_1.html'||location.pathname=='/home2.html'){
		document.documentElement.onmousemove=function(){setDefaultOnTimer('clear');}
		objParentDiv=document.getElementById('parentDiv');
		if (window.addEventListener)
				objParentDiv.addEventListener("mousemove", function(event){event.cancelBubble = true;}, false);
		if (window.attachEvent)
			objParentDiv.attachEvent("onmousemove",function(event){event.cancelBubble = true;});
	}
	setDefaultDescription();;
	arrObjLmtext=document.getElementsByTagName('TD');
	idLmtextMax=0;
	i=0;
	for(key in arrObjLmtext){
		if(arrObjLmtext[key].className=='lmtext'){	
			arrObjLmtext[key].id='idLmtext'+idLmtextMax;
			arrObjLmtext[key].onmouseover=function(){try{changeContent(this);}catch(e){}}
			arrObjLmtext[key].onmouseout=function(event){
				if(location.pathname=='/index.html'||location.pathname=='/'||location.pathname=='/homepageduplicate'||location.pathname=='/hp_be_1.html'||location.pathname=='/home2.html'){
					this.firstChild.nextSibling.nextSibling.style.color=curLinkColor;										
					document.getElementById('learn_more').href=this.lastChild.href;
					document.getElementById('learn_more').parentNode.onclick=function(){window.location=document.getElementById('learn_more').href}
					document.getElementById('learn_more').parentNode.style.cursor='pointer';
					this.firstChild.src=this.firstChild.src.replace(/arrow\.gif$/,'arrow2.gif');
					//document.body.onmousemove();
				}else{
					try{
						setDefaultColor();
					}catch(e){}
				}
				try{
					setDefaultOnTimer(this,event);
				}catch(e){}
			};
			arrObjLmtext[key].valign="center";
			objLink=arrObjLmtext[key].firstChild.nextSibling.nextSibling;
			if(objLink!=null&&objLink.href!=undefined){
				switch (curPageGroup){
					case 'features':					
						re =  new RegExp("^"+location.protocol+"\\/\\/"+location.hostname+'\\/'+curPageGroup+'\\/'+curSubPageGroup+'\\/',"ig");
						if(objLink.href.match(re)){ 
							objLink.style.color=curLinkColor;
							arrObjLmtext[key].bgColor=curColor;
							arrObjLmtext[key].setAttribute('curSubPageGroup','true');
							arrObjLmtext[key].firstChild.src=arrObjLmtext[key].firstChild.src.replace(/\.gif$/i,'2.gif');
						}
						
					break;
					default: break;
				}
			}
			if (window.addEventListener)
					arrObjLmtext[key].addEventListener("mousemove", function(event){event.cancelBubble = true;}, false);
			if (window.attachEvent)
				arrObjLmtext[key].attachEvent("onmousemove",function(event){event.cancelBubble = true;});
			if (window.addEventListener)
					arrObjLmtext[key].parentNode.nextSibling.addEventListener("mousemove", function(event){event.cancelBubble = true;}, false);
			if (window.attachEvent)
				arrObjLmtext[key].parentNode.nextSibling.attachEvent("onmousemove",function(event){event.cancelBubble = true;});
			
			arrObjLmtext[key].style.cursor='pointer';
			idLmtextMax++;
		}
		
		i++;		
	}	
	setDescriptions();
}
function setDefaultDescription(){
	defaultDescriptions= new Array();
	try{
		defaultDescriptions[0]=document.getElementById('header1').innerHTML;
		defaultDescriptions[1]=document.getElementById('header2').innerHTML;
		defaultDescriptions[2]=document.getElementById('text_li').innerHTML;
		if(document.getElementById('learn_more')!==null)
			defaultDescriptions[3]=document.getElementById('learn_more').href;
	}
	catch(e){}
}
function setDescriptions(){
	arrDivDescription=document.getElementsByTagName('DIV');
	number=0;
	arrDescription=new Array();
	for(key in arrDivDescription){
		if(arrDivDescription[key].className=='description'){
			arrDescription[number]=new Array();
			for(i=0;i<arrDivDescription[key].childNodes.length;i++){
				obj=arrDivDescription[key].childNodes[i];
				if(obj.tagName=='H1')
					arrDescription[number][0]=obj.innerHTML;
				if(obj.tagName=='H2')
					arrDescription[number][1]=obj.innerHTML;
				if(obj.tagName=='UL')
					arrDescription[number][2]=obj.innerHTML;
			}
			number++;
		}		
	}
}
function setDefaultOnTimer(action){		
		if(action=='clear'){
			try{
				//document.getElementById('header1').style.fontSize='32px';
				//document.getElementById('header2').style.fontSize='22px';
				document.getElementById('header2').style.color='#587AB2';
				document.getElementById('header1').innerHTML=defaultDescriptions[0];
				document.getElementById('header2').innerHTML=defaultDescriptions[1];
				document.getElementById('text_li').innerHTML=defaultDescriptions[2];
			}
			catch(e){}
			if(location.pathname=='/index.html'||location.pathname=='/'||location.pathname=='/homepageduplicate'||location.pathname=='/hp_be_1.html'||location.pathname=='/home2.html')
				//document.getElementById('learn_more').style.display='none';
				document.getElementById('learn_more').href=defaultDescriptions[3];
				document.getElementById('learn_more').parentNode.onclick=function(){}
				document.getElementById('learn_more').parentNode.style.cursor='default';
			setDefaultColor();
		}
}
function changeContent(obj){
	if(location.pathname=='/index.html'||location.pathname=='/'||location.pathname=='/homepageduplicate'||location.pathname=='/hp_be_1.html'||location.pathname=='/home2.html'){
		document.getElementById('learn_more').style.display='block';
	}
	try{clearTimeout(timerDefault);}catch(e){}
	setDefaultColor();
	obj.bgColor=curColor;
		obj.onclick=function(){
				objLink=obj.firstChild.nextSibling.nextSibling;
				if(objLink!=null&&objLink.getAttribute('target')!='_blank')
					window.location=objLink.href;
			}
	idElem=obj.id.replace(/idLmtext/,'');
	try{
	document.getElementById('header1').style.fontSize='22px';
	document.getElementById('header2').style.fontSize='32px';
	document.getElementById('header2').style.color='#FD7134';
	document.getElementById('header1').innerHTML=arrDescription[idElem][0];
	document.getElementById('header2').innerHTML=arrDescription[idElem][1];
	document.getElementById('text_li').innerHTML=arrDescription[idElem][2];
	}
	catch(e){}
	
}
function setDefaultColor(){
	for(i=0;i<idLmtextMax;i++){		
		if(document.getElementById('idLmtext'+i).childNodes.length!=2){
			
			if(document.getElementById('idLmtext'+i).getAttribute('curSubPageGroup')!='true'){
				document.getElementById('idLmtext'+i).bgColor=defaulColor;
				document.getElementById('idLmtext'+i).firstChild.src=document.getElementById('idLmtext'+i).firstChild.src.replace(/arrow2\.gif$/,'arrow.gif')
				document.getElementById('idLmtext'+i).firstChild.nextSibling.nextSibling.style.color='#3E4E67';
			}
		}
	}
}


if (window.addEventListener){
	window.addEventListener("load", initEvent, false);
}
if (window.attachEvent){
	window.attachEvent("onload",initEvent);
}


