/********************************
	DeCare Dental javascript
	(c) 2007 DeCare Dental
	author: Alan Murphy
	Decare Systems Ireland
	www.decaresystems.ie
********************************/

		//set #content min. height:

function minH(){
 if(document.getElementById){//DOM check
 	//equalize homepage content boxes heights:
	if(document.getElementById('homeCont1')){//homepage test
		b1=document.getElementById('homeCont1');
		b2=document.getElementById('homeCont2');
		b3=document.getElementById('homeCont3');
		h1= b1.offsetHeight;
		h2= b2.offsetHeight;
		h3= b3.offsetHeight;
		if((h1>h2)&&(h1>h3)){//h1 wins
			h1+=10;
			h1+="px";
			b1.style.height = h1;
			b2.style.height = h1;
			b3.style.height = h1;		
		}else if ((h2>h1)&&(h2>h3)){//h2 wins
			h2+=10;
			h2+="px";
			b1.style.height = h2;
			b2.style.height = h2;
			b3.style.height = h2;
		}else if ((h3>h1)&&(h3>h2)){//h3 wins
			h3+=10;
			h3+="px";
			b1.style.height = h3;
			b2.style.height = h3;
			b3.style.height = h3;
		}
	}
 
	//set borders for short pages:
	if(document.getElementById('pageContent')){//"content" div check
		var contObj=document.getElementById('pageContent');
		if (contObj.offsetHeight<455){
			var footerH=455-contObj.offsetHeight;
			document.getElementById('footer').style.paddingTop=footerH+"px";
			contObj.style.height=('455px');
		}else{//re-set borders to fix IE display bug
			contObj.style.borderLeft="#ce5e37 1px solid";
			contObj.style.borderRight="#ce5e37 1px solid";
		}
	}
	
	MM_preloadImages("/images/nav_bg_over.gif","/images/nav_bg_sub_over.gif","/images/sub_dyn_over.gif");//preload nav rollover images
	
	//reset dynamic left menu arrow
	if (document.getElementById("about_sub2"))	document.getElementById("navAffil").className="subLinkDyn1";
	if (document.getElementById("about_sub3"))	document.getElementById("navCareer").className="subLinkDyn1";
	
	if (document.getElementById('about_sub1')) 
	{
		 document.getElementById('navAbout').className="subLink";
	}
	else
	{
		if(document.getElementById("about_sub2_2"))
		{
	 		document.getElementById("navAffil").className="subLinkDyn1";
	 		document.getElementById("navAffil").style.marginLeft="12px";
		}
		if(document.getElementById("about_sub3_3"))
		{
	 		document.getElementById("navCareer").className="subLinkDyn1"; 
	 		document.getElementById("navCareer").style.marginLeft="12px";
		}
	}
	
	if(document.getElementById('capabil_sub1')) document.getElementById('navCapabil').className="subLink";

	if (document.getElementById('products_sub1'))	document.getElementById('prod').className="subLink";		

  }
}

		//flash replace:
function flsh(){
 if(document.getElementById){
	if((document.getElementById('flash').innerHTML) &&(navigator.userAgent.indexOf("Firefox")==-1)){//check for "flash" div, innerHTML, & not Firefox (can't show layers over Flash)
		//DOM- & innerHTML-enabled browsers get the flash object; DOM-enabled but flash-disabled browsers still get the animated gif!!
		document.getElementById('flash').innerHTML='<object type="application/x-shockwave-flash" data="images/banner_4.swf" width="581" height="188"><param name="movie" value="images/banner_4.swf"><param name="wmode" value="transparent"><img src="images/flash_replace.gif" border="0" width="581" height="188" v-align="bottom" alt="A global leader in oral health care management"  title="A global leader in oral health care management"></object>';
	}//else do nothing - Firefox & DOM-disabled browsers just get the animated gif
 }
}

		// image prelaod/swap/restore

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


		//global vars:

var hider1=true;
var hider1_1=true;
var hider1_2=true;
var hider2=true;
var hider2_2=true;
var hider3=true;
var hider3_3=true;

var hiderTab1=true;
var hiderTab2=true;
var hiderTab3=true;
var hiderTab4=true;

var thisName=null;

var timerID1 = null;
var timerID1_1 = null;
var timerID1_2 = null;
var timerID2 = null;
var timerID2_2 = null;
var timerID3=null;
var timerID3_3 = null;

var timerIDTab1 = null;
var timerIDTab2 = null;
var timerIDTab3 = null;
var timerIDTab4 = null;


var timecount = 50;
var timecount2 = 50;
var timecount3 = 50;

var browser=navigator.userAgent.toLowerCase();

		//rollover functions:

function showHide1(thisName,toShow1,thisId1){
	if (hider1 && document.getElementById){
		getLeftPos(thisId1);
		document.getElementById(toShow1).style.top=tHeight;
		aboutHeight=parseInt(tHeight);
		aboutHeight+=36;
		aboutHeight.toString();
		aboutHeight2=aboutHeight+17;
		aboutHeight+="px";
		aboutHeight2+="px";
		document.getElementById(toShow1).style.visibility='visible';
		document.getElementById(thisId1).className="subLinkOver";
		clearTimeout(timerID1);
		timerID1=null;
		hider1=false;
		if(browser.indexOf("msie") != -1 && browser.indexOf("opera") == -1) {   //IE
			if (document.getElementById && document.createElement && document.childNodes){
			   	var iframe=document.createElement("iframe");
				var div=document.getElementById(toShow1);
			   	iframe.id="iShow1";
			   	iframe.src="javascript:false;";
			   	iframe.style.position="absolute";
				iframe.style.width=(div.offsetWidth)+'px';
				iframe.style.height=(div.offsetHeight)+'px';
				iframe.style.top=(div.offsetTop)+'px';
				iframe.style.left=(div.offsetLeft)+'px';
				
			   	document.body.appendChild(iframe);
			}
		}
	}else if(document.getElementById){
		toHide1=toShow1;
		offId1=thisId1;
		timerID1=setTimeout( "hide1()" , timecount);
		hider1=true;
		if(browser.indexOf("msie") != -1 && browser.indexOf("opera") == -1) {   //IE
			if (document.getElementById && document.createElement && document.childNodes){
				var iframe=document.getElementById("iShow1");
			   	document.body.removeChild(iframe);		
			}
		}
	}
}

function showHide1_1(thisName,toShow1_1,thisId1_1){
	if (hider1_1 && document.getElementById){
		getLeftPos(thisId1_1);
		document.getElementById(toShow1_1).style.top=tHeight;
		document.getElementById(toShow1_1).style.visibility='visible';
		document.getElementById(thisId1_1).className="subLinkOver";
		hider1_1=false;
		clearTimeout(timerID1_1);
		timerID1_1 = null;
		if(browser.indexOf("msie") != -1 && browser.indexOf("opera") == -1) {   //IE
			if (document.getElementById && document.createElement && document.childNodes){
			   	var iframe=document.createElement("iframe");
				var div=document.getElementById(toShow1_1);
			   	iframe.id="iShow1_1";
			   	iframe.src="javascript:false;";
			   	iframe.style.position="absolute";
				iframe.style.width=(div.offsetWidth)+'px';
				iframe.style.height=(div.offsetHeight)+'px';
				iframe.style.top=(div.offsetTop)+'px';
				iframe.style.left=(div.offsetLeft)+'px';
				
			   	document.body.appendChild(iframe);
			}
		}
	}else if (document.getElementById){
		toHide1_1=toShow1_1;
		offId1_1=thisId1_1;
		timerID1_1=setTimeout( "hide1_1()" , timecount);
		hider1_1=true;
		if(browser.indexOf("msie") != -1 && browser.indexOf("opera") == -1) {   //IE
			if (document.getElementById && document.createElement && document.childNodes){
				var iframe=document.getElementById("iShow1_1");
			   	document.body.removeChild(iframe);		
			}
		}
	}
}

function showHide1_2(thisName,toShow1_2,thisId1_2){
	if (hider1_2 && document.getElementById){
		getLeftPos(thisId1_2);
		document.getElementById(toShow1_2).style.top=tHeight;
		document.getElementById(toShow1_2).style.visibility='visible';
		document.getElementById(thisId1_2).className="subLinkOver";
		hider1_2=false;
		clearTimeout(timerID1_2);
		timerID1_2=null;
		if(browser.indexOf("msie") != -1 && browser.indexOf("opera") == -1) {   //IE
			if (document.getElementById && document.createElement && document.childNodes){
			   	var iframe=document.createElement("iframe");
				var div=document.getElementById(toShow1_2);
			   	iframe.id="iShow1_2";
			   	iframe.src="javascript:false;";
			   	iframe.style.position="absolute"; 
				iframe.style.width=(div.offsetWidth)+'px';
				iframe.style.height=(div.offsetHeight)+'px';
				iframe.style.top=(div.offsetTop)+'px';
				iframe.style.left=(div.offsetLeft)+'px';
				
			   	document.body.appendChild(iframe);
			}
		}
	}else if (document.getElementById){
		toHide1_2=toShow1_2;
		offId1_2=thisId1_2;
		timerID1_2=setTimeout( "hide1_2()" , timecount);
		hider1_2=true;
		if(browser.indexOf("msie") != -1 && browser.indexOf("opera") == -1) {   //IE
			if (document.getElementById && document.createElement && document.childNodes){
				var iframe=document.getElementById("iShow1_2");
			   	document.body.removeChild(iframe);		
			}
		}
	}
}

function showHide2(thisName,toShow2,thisId2){
	if (hider2 && document.getElementById){
		document.getElementById(toShow2).style.top=aboutHeight;
		document.getElementById(toShow2).style.visibility='visible';
		document.getElementById(thisId2).className="subLinkDyn1Over";
		hider2=false;
		clearTimeout(timerID2);
		timerID2 = null;
		if(browser.indexOf("msie") != -1 && browser.indexOf("opera") == -1) {   //IE
			if (document.getElementById && document.createElement && document.childNodes){
			   	var iframe=document.createElement("iframe");
				var div=document.getElementById(toShow2);
			   	iframe.id="iShow2";
			   	iframe.src="javascript:false;";
			   	iframe.style.position="absolute";
				iframe.style.width=(div.offsetWidth)+'px';
				iframe.style.height=(div.offsetHeight)+'px';
				iframe.style.top=(div.offsetTop)+'px';
				iframe.style.left=(div.offsetLeft)+'px';
				
			   	document.body.appendChild(iframe);
			}
		}
	}else if (document.getElementById){
		toHide2=toShow2;
		offId2=thisId2;
		timerID2=setTimeout( "hide2()" , timecount2);
		hider2=true;
		if(browser.indexOf("msie") != -1 && browser.indexOf("opera") == -1) {   //IE
			if (document.getElementById && document.createElement && document.childNodes){
				var iframe=document.getElementById("iShow2");
			   	document.body.removeChild(iframe);		
			}
		}
	}
}

function showHide3(thisName,toShow3,thisId3){
	if (hider3 && document.getElementById){


		aboutHeight3=parseInt(tHeight);
		aboutHeight3+=36;
		aboutHeight3.toString();
		aboutHeight3+="px";

		document.getElementById(toShow3).style.top=aboutHeight3;
		document.getElementById(toShow3).style.visibility='visible';
		document.getElementById(thisId3).className="subLinkDyn1Over";
		hider3=false;
		clearTimeout(timerID3);
		timerID3 = null;
		if(browser.indexOf("msie") != -1 && browser.indexOf("opera") == -1) {   //IE
			if (document.getElementById && document.createElement && document.childNodes){
			   	var iframe=document.createElement("iframe");
				var div=document.getElementById(toShow3);
			   	iframe.id="iShow3";
			   	iframe.src="javascript:false;";
			   	iframe.style.position="absolute";
				iframe.style.width=(div.offsetWidth)+'px';
				iframe.style.height=(div.offsetHeight)+'px';
				iframe.style.top=(div.offsetTop)+'px';
				iframe.style.left=(div.offsetLeft)+'px';
				
			   	document.body.appendChild(iframe);
			}
		}
	}else if (document.getElementById){
		toHide3=toShow3;
		offId3=thisId3;
		timerID3=setTimeout( "hide3()" , timecount2);
		hider3=true;
		if(browser.indexOf("msie") != -1 && browser.indexOf("opera") == -1) {   //IE
			if (document.getElementById && document.createElement && document.childNodes){
				var iframe=document.getElementById("iShow3");
			   	document.body.removeChild(iframe);		
			}
		}
	}
}

function showHide2_2(thisName,toShow2_2,thisId2_2){
	if (hider2_2 && document.getElementById){
		document.getElementById(toShow2_2).style.visibility='visible';
		document.getElementById(thisId2_2).style.color="#ECEFF7";		
		document.getElementById(thisId2_2).style.backgroundImage="url(/images/sub_dyn_over.gif)";
		hider2_2=false;
		clearTimeout(timerID2_2);
		timerID2_2 = null;
		if(browser.indexOf("msie") != -1 && browser.indexOf("opera") == -1) {   //IE
			if (document.getElementById && document.createElement && document.childNodes){
			   	var iframe=document.createElement("iframe");
				var div=document.getElementById(toShow2_2);
			   	iframe.id="iShow2_2";
			   	iframe.src="javascript:false;";
			   	iframe.style.position="absolute";
				iframe.style.width=(div.offsetWidth)+'px';
				iframe.style.height=(div.offsetHeight)+'px';
				iframe.style.top=(div.offsetTop)+'px';
				iframe.style.left=(div.offsetLeft)+'px';
				
			   	document.body.appendChild(iframe);
			}
		}
	}else if (document.getElementById){
		toHide2_2=toShow2_2;
		offId2_2=thisId2_2;
		timerID2_2=setTimeout( "hide2_2()" , timecount2);
		hider2_2=true;
		if(browser.indexOf("msie") != -1 && browser.indexOf("opera") == -1) {   //IE
			if (document.getElementById && document.createElement && document.childNodes){
				var iframe=document.getElementById("iShow2_2");
			   	document.body.removeChild(iframe);		
			}
		}
	}
}

function showHide3_3(thisName,toShow3_3,thisId3_3){
	if (hider3_3 && document.getElementById){
		document.getElementById(toShow3_3).style.visibility='visible';
		document.getElementById(thisId3_3).style.color="#ECEFF7";		
		document.getElementById(thisId3_3).style.backgroundImage="url(/images/sub_dyn_over.gif)";
		hider3_3=false;
		clearTimeout(timerID3_3);
		timerID3_3 = null;
		if(browser.indexOf("msie") != -1 && browser.indexOf("opera") == -1) {   //IE
			if (document.getElementById && document.createElement && document.childNodes){
				var iframe=document.createElement("iframe");
				var div=document.getElementById(toShow3_3);
			  iframe.id="iShow3_3";
			  iframe.src="javascript:false;";
			  iframe.style.position="absolute";
				iframe.style.width=(div.offsetWidth)+'px';
				iframe.style.height=(div.offsetHeight)+'px';

				//If the user has selected the affiliates link or one of it's sub links
				if(document.getElementById('about_sub2_2') == null)
				{
					if(document.getElementById('ddnOffice') == null)
					{
						div.style.top='206px';
						iframe.style.top='206px';
					}
					else
					{
						div.style.top='186px';
						iframe.style.top='186px';
					}
				}
				else
				{
					iframe.style.top=(div.offsetTop)+'px';
				}	
				
				iframe.style.left=(div.offsetLeft)+'px';
			  document.body.appendChild(iframe);
			}
		}
		else
		{
			//If the user has selected the affiliates link or one of it's sub links
			if(document.getElementById('about_sub2_2') == null)
			{
				var div=document.getElementById(toShow3_3);
				if(document.getElementById('ddnOffice') == null)
				{
					div.style.top='204px';
				}
				else
				{
					div.style.top='184px';
				}
				
			}
		}
	}else if (document.getElementById){
		toHide3_3=toShow3_3;
		offId3_3=thisId3_3;
		timerID3_3=setTimeout( "hide3_3()" , timecount3);
		hider3_3=true;
		if(browser.indexOf("msie") != -1 && browser.indexOf("opera") == -1) {   //IE
			if (document.getElementById && document.createElement && document.childNodes){
				var iframe=document.getElementById("iShow3_3");
			   	document.body.removeChild(iframe);		
			}
		}
	}
}

		// tab rollovers:

function showHideTab1(thisName,toShowTab,thisIdTab){
	if (hiderTab1 && document.getElementById){
		document.getElementById(toShowTab).style.visibility='visible';
		document.getElementById(thisIdTab).style.color="white";		
		document.getElementById(thisIdTab).style.backgroundColor="#4C92CA";
		hiderTab1=false;
		clearTimeout(timerIDTab1);
		timerIDTab1 = null;
	}else if (document.getElementById){
		document.getElementById(thisIdTab).className=="curTabNav" ? curName1=true : curName1=false;
		toHideTab1=toShowTab;
		offIdTab1=thisIdTab;
		timerIDTab1=setTimeout( "hideTab1()" , timecount);
		hiderTab1=true;
	}
}
function showHideTab2(thisName,toShowTab,thisIdTab){
	if (hiderTab2 && document.getElementById){
		document.getElementById(toShowTab).style.visibility='visible';
		document.getElementById(thisIdTab).style.color="white";		
		document.getElementById(thisIdTab).style.backgroundColor="#4C92CA";
		hiderTab2=false;
		clearTimeout(timerIDTab2);
		timerIDTab2 = null;
	}else if (document.getElementById){
		document.getElementById(thisIdTab).className=="curTabNav" ? curName2=true : curName2=false;
		toHideTab2=toShowTab;
		offIdTab2=thisIdTab;
		timerIDTab2=setTimeout( "hideTab2()" , timecount);
		hiderTab2=true;
	}
}


function showHideTab3(thisName,toShowTab,thisIdTab){
	if (hiderTab3 && document.getElementById){
		document.getElementById(toShowTab).style.visibility='visible';
		document.getElementById(thisIdTab).style.color="white";		
		document.getElementById(thisIdTab).style.backgroundColor="#4C92CA";
		hiderTab3=false;
		clearTimeout(timerIDTab3);
		timerIDTab3 = null;
	}else if (document.getElementById){
		document.getElementById(thisIdTab).className=="curTabNav" ? curName3=true : curName3=false;
		toHideTab3=toShowTab;
		offIdTab3=thisIdTab;
		timerIDTab3=setTimeout( "hideTab3()" , timecount);
		hiderTab3=true;
	}
}
function showHideTab4(thisName,toShowTab,thisIdTab){
	if (hiderTab4 && document.getElementById){
		document.getElementById(toShowTab).style.visibility='visible';
		document.getElementById(thisIdTab).style.color="white";		
		document.getElementById(thisIdTab).style.backgroundColor="#4C92CA";
		hiderTab4=false;
		clearTimeout(timerIDTab4);
		timerIDTab4 = null;
	}else if (document.getElementById){
		document.getElementById(thisIdTab).className=="curTabNav" ? curName4=true : curName4=false;
		toHideTab4=toShowTab;
		offIdTab4=thisIdTab;
		timerIDTab4=setTimeout( "hideTab4()" , timecount);
		hiderTab4=true;
	}
}


		//rollover function calls - so many only because settimeout() can't pass values to a common function:

function getLeftPos(theDiv){
	//if (document.all){calc. IE sub-nav height}else{calc. NS & Mozilla sub-nav height}, we already are within .getElementById from above:
	document.all ? tHeight=(document.getElementById(theDiv).offsetTop)+88+'px' : tHeight=(document.getElementById(theDiv).offsetTop)+'px';
}

function hide1(){
	if(toHide1 && offId1){
	document.getElementById(toHide1).style.visibility='hidden';
	document.getElementById(offId1).className="subLink";
	}
}

function hide1_1(){
	if(toHide1_1 && offId1_1){
	document.getElementById(toHide1_1).style.visibility='hidden';
	document.getElementById(offId1_1).className="subLink";
	}
}
function hide1_2(){
	if(toHide1_2 && offId1_2){
	document.getElementById(toHide1_2).style.visibility='hidden';
	document.getElementById(offId1_2).className="subLink";
	}
}

function hide2(){
	if(toHide2 && offId2){
	document.getElementById(toHide2).style.visibility='hidden';
	document.getElementById(offId2).className="subLinkDyn1";
	}
}

function hide3(){
	if(toHide3 && offId3){
		document.getElementById(toHide3).style.visibility='hidden';
		document.getElementById(offId3).className="subLinkDyn1";
	}
}

function hide2_2(){
	if(toHide2_2 && offId2_2){
	document.getElementById(toHide2_2).style.visibility='hidden';
	document.getElementById(offId2_2).style.color="#CE5E37";		
	document.getElementById(offId2_2).style.backgroundImage="url(/images/sub_dyn.gif)";
	}
}

function hide3_3(){
	if(toHide3_3 && offId3_3){
	document.getElementById(toHide3_3).style.visibility='hidden';
	document.getElementById(offId3_3).style.color="#CE5E37";		
	document.getElementById(offId3_3).style.backgroundImage="url(/images/sub_dyn.gif)";
	}
}

function hideTab1(){
	if(toHideTab1 && offIdTab1){
		document.getElementById(toHideTab1).style.visibility='hidden';
		if(curName1){
			document.getElementById(offIdTab1).style.color="white";		
			document.getElementById(offIdTab1).style.backgroundColor="#4C92CA";
		}else{
			document.getElementById(offIdTab1).style.color="#D9E3F2";		
			document.getElementById(offIdTab1).style.backgroundColor="#0064B4";
		}
	}
}
function hideTab2(){
	if(toHideTab2 && offIdTab2){
	document.getElementById(toHideTab2).style.visibility='hidden';
		if(curName2){
			document.getElementById(offIdTab2).style.color="white";		
			document.getElementById(offIdTab2).style.backgroundColor="#4C92CA";
		}else{
			document.getElementById(offIdTab2).style.color="#D9E3F2";		
			document.getElementById(offIdTab2).style.backgroundColor="#0064B4";
		}
	}
}
function hideTab3(){
	if(toHideTab3 && offIdTab3){
	document.getElementById(toHideTab3).style.visibility='hidden';
		if(curName3){
			document.getElementById(offIdTab3).style.color="white";		
			document.getElementById(offIdTab3).style.backgroundColor="#4C92CA";
		}else{
			document.getElementById(offIdTab3).style.color="#D9E3F2";		
			document.getElementById(offIdTab3).style.backgroundColor="#0064B4";
		}
	}
}
function hideTab4(){
	if(toHideTab4 && offIdTab4){
	document.getElementById(toHideTab4).style.visibility='hidden';
		if(curName4){
			document.getElementById(offIdTab4).style.color="white";		
			document.getElementById(offIdTab4).style.backgroundColor="#4C92CA";
		}else{
			document.getElementById(offIdTab4).style.color="#D9E3F2";		
			document.getElementById(offIdTab4).style.backgroundColor="#0064B4";
		}
	}
}

function m_over(btn){
	if(document.getElementById){
		document.getElementById(btn).className='inputbutton_hover';
	}
}

function m_down(btn){
	if(document.getElementById){
		document.getElementById(btn).className='inputbutton_active';
	}
}

function m_up(btn){
	if(document.getElementById){
		document.getElementById(btn).className='inputbutton_hover';
	}
}

function m_out(btn){
	if(document.getElementById){
		document.getElementById(btn).className='inputbutton';
	}
}