// JavaScript Document
window.onload = function() {
	runCommonJS();
}

function showHideWindow(which) {
  var dynWin = document.getElementById(which);
  if (dynWin.style.display != "block") {
      dynWin.style.display = "block";
  } else {
      dynWin.style.display = "none";
  }
}

function numeralsOnly(evt) {
    evt = (evt) ? evt : event;
	var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode :
	    ((evt.which) ? evt.which : 0));
	if (charCode > 31 && (charCode < 48 || charCode > 57)) {
	    alert("You may only enter numerals in this field.");
		return false;
	}
	return true;
}

function runCommonJS() {
	// check for Two Column Promo Image Bottom
	// if exists then initiate runPromoAdjust()
	if (document.getElementById("PromoImageLeft") == null) {
		null;
	} else if (document.getElementById("PromoImageLeft") != null) {
	    runPromoAdjust();	
	}
	// check for RightColHeightAddition
	// if exists then initiate GetOffset()
	if (document.getElementById("RightSpacerSub") == null) {
		null;	
	} else if (document.getElementById("RightSpacerSub") != null) {
		GetOffset();
	}
	// enable display modes of hidden divs
	function showHideWindow(which) {
	  var dynWin = document.getElementById(which);
	  if (dynWin.style.display != "block") {
		  dynWin.style.display = "block";
	  } else {
		  dynWin.style.display = "none";
	  }
	}
}

//-- BEGIN TWO COLUMN PROMO IMAGE BOTTOM --//
function runPromoAdjust() {
// Perform Check to determine whether or not
// -- a Promotional Image exists within the 
// -- Bottom Promo Area and add the height of Image PLUS additional height included in CSS
// -- TO OPPOSITE columns Y location in order to align SubHeadlines

    // check for PromoImageLeft ID 
    var checkForPromoImageL = document.getElementById("PromoImageLeft").innerHTML.length;

    // check for PromoImageRight ID 
    var checkForPromoImageR = document.getElementById("PromoImageRight").innerHTML.length;

  // If neither PromoImageLeft or PromoImageRight ID's exist
    // -- base values off of innerHTML
    // -- Due to IE6 alignment when nothing exists between open/closing <div>'s
    // -- &nbsp; added in between open/close <div>'s so run test off of value of 6 (# of characters in "&nbsp;"
    if ((checkForPromoImageL <= 6) && (checkForPromoImageR <= 6)) {
      // DO NOT run promoImageLeftSide or promoImageRightSide functions
        null;

  // Assuming a value of 7 or higher means an <img> exists...
    // If promoImageLeftSide contains image
    } else if ((checkForPromoImageL >= 7) && (checkForPromoImageR <= 6)) {
      // RUN promoImageLeftSide function
        promoImageLeftSide();

    // If promoImageRightSide contains image
    } else if ((checkForPromoImageL <= 6) && (checkForPromoImageR >= 7)) {
      // RUN promoImageRightSide function
        promoImageRightSide();	

    // If both PromoImageLeft and PromoImageRight ID's exist
    } else if ((checkForPromoImageL >= 7) && (checkForPromoImageR >= 7)) {
      // DO NOT run promoImageLeftSide or promoImageRightSide functions
        null;

    } 
}

// If PromoImageLeft exists
function promoImageLeftSide() {			
    var imageHeightL;	
    // Get offset height of PromoImageLeft ID
      // -- This value includes any margin top/bottom or padding top/bottom
      // -- pulled in via PromoImageLeft CSS styling
    var hasImageL = document.getElementById("PromoImageLeft").offsetHeight - 18;
    // Determine location of ID to add extra height to
    var PromoLeftImage = document.getElementById("RightPromoImagePadding");

    imageHeightL = hasImageL;

    // If ID PromoImageLeft is greater than 100px + addtional space added from CSS style + 1
      // -- in this instance an additional margin-bottom: 12px exists
    if (imageHeightL >= 113) {
        // set imageHeightL to 100px
        imageHeightL = 100;	

    // If ID PromoImageLeft is less than 100px + additional space added from CSS style
      // -- in this instance an additional margin-bottom: 12px exists
    } else if (imageHeightL <= 112) {
        // set imageHeightL to the offsetHeight of ID PromoImageLeft
        imageHeightL = imageHeightL;
    }

    // Add height value to PromoLeftImage if it is greater than 0
    // -- otherwise keep height equal to 0
    if (hasImageL >= 1) {
        PromoLeftImage.style.height = imageHeightL + "px";
    } else {
        PromoLeftImage.style.height = 0 + "px";	
    }
}

// If PromoImageRight exists
function promoImageRightSide() {			
    var imageHeightR;	
    // Get offset height of PromoImageRight ID
      // -- This value includes any margin top/bottom or padding top/bottom
      // -- pulled in via PromoImageRight CSS styling
    var hasImageR = document.getElementById("PromoImageRight").offsetHeight - 18;
    // Determine location of ID to add extra height to
    var PromoRightImage = document.getElementById("LeftPromoImagePadding");

    imageHeightR = hasImageR;

    // If ID PromoImageRight is greater than 100px + addtional space added from CSS style + 1
      // -- in this instance an additional margin-bottom: 12px exists
    if (imageHeightR >= 113) {
        // set imageHeightL to 100px
        imageHeightR = 100;	

    // If ID PromoImageRight is less than 100px + additional space added from CSS style
      // -- in this instance an additional margin-bottom: 12px exists
    } else if (imageHeightR <= 112) {
        // set imageHeightR to the offsetHeight of ID PromoImageRight
        imageHeightR = imageHeightR;	
    }
	
    // Add height value to PromoRightImage if it is greater than 0
    // -- otherwise keep height equal to 0
    if (hasImageR >= 1) {
        PromoRightImage.style.height = imageHeightR + "px";
    } else {
        PromoRightImage.style.height = 0 + "px";	
    }
}
//-- END TWO COLUMN PROMO IMAGE BOTTOM --//

//-- BEGIN RIGHT COLUMN HEIGHT ADDITION --//
/*-- THIS WILL ADD NEEDED HEIGHT TO RIGHT COLUMN RED BAR
     WHEN CONTENT WITHIN IT DOES NOT EXCEED CONTENT IN THE LEFT COLUMN --*/
function GetOffset() {
	var LeftColOffset = document.getElementById("TwoCol_LeftColumn");
	var LeftColOffsetHeight = LeftColOffset.offsetHeight;
	var RightSpacerSub = document.getElementById("RightSpacerSub");
	var RightSpacerSubHeight = RightSpacerSub.offsetHeight;
	var RightColSpacer = document.getElementById("TwoCol_RightColumn");

	RightColSpacer.style.height = LeftColOffsetHeight - RightSpacerSubHeight + "px";
}
//-- END RIGHT COLUMN HEIGHT ADDITION --//







<!--
// Quase Full Screen
function FullScreen(url,janela,scroll){
W = eval(screen.width)-10;
H = eval(screen.height)-54;

window.open(url,janela,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars="+scroll+",resizable=no,width="+W+",height="+H+",top=0,left=0");
}
//-->

<!--
// Popup Window for Personalizadas e Casas Dentais

var win = null;
function PopUp(mypage,myname,w,h,scroll,resize,status){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable='+resize+',status='+status+'toolbar=no,location=no,directories=no,menubar=no' 
win = window.open(mypage,myname,settings)
}
//-->