function checkOnBlur(e){
	if(e.Validators != null){
		//manually call the onchange event in order to evaluate content against validators
		e.onchange();
	}
}

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 swap(obj, img)
{
	document.images[obj.id].src = img;
}

function trim(str) { 
    str.replace(/^\s*/, '').replace(/\s*$/, ''); 

   return str;
} 
function ShowShowPlannerLogin()
{
    Window = window.open('../Profiles/ShowPlannerLoginPopup.aspx','ShowPlannerPopup','scrollbars=yes,resizable=yes,statusbar=yes,width=425,height=230');
}

function ShowPopup(page,name,options){
	if(options==null || options=='') options = "scrollbars=yes,resizable=yes,width=740,height=450";
	Window = window.open(page,name,options);
}

function ShowPrint(page,name,options){
	if(options==null || options=='') options = "scrollbars=yes,resizable=yes,width=740,height=450";
	Window = window.open(page,name,options);
	//window.open(page);
}

function ShowRegistration(page,name,options){
	//if(options==null || options=='') options = "scrollbars=yes,resizable=yes,width=800,height=600";
	Window = window.open(page,name,options);
}

function ShowFloorPlan(page,name,options){
	if(options==null || options=='') options = "scrollbars=yes,resizable=yes,width=800,height=600";
	Window = window.open(page,name,options);
}

function ShowLink(page){
	var opener = window.opener;
	window.close();
	if(page==''){
		window.opener.location.href=window.opener.location.href;
	}
	else{
		window.opener.location.href=page;
	}
}

function ShowTotalCostEstimator()
{
    ShowPopup("/Exhibitors/TotalCostEstimator.aspx","TotalCostEstimator","scrollbars=no,resizable=no,statusbar=no,addressbar=no,width=510,height=600");
}
function CheckAllGrid(gridID, checkboxID, checkVal)
{
    // set a reg ex that matches the checkboxID so we can check it
    var re;
    re = new RegExp("_" + checkboxID + "$"); // the ID will end with a _ and the checkbox id
    
    // get all of the INPUT elements within the table and then we will filter on the type checkbox and the name
    var table = document.getElementById(gridID);
    
    if (table != null)
    {
        var children = table.getElementsByTagName("INPUT");
        
        for (var i=0;i < children.length; i++)
            if (children[i].type == "checkbox" && re.test(children[i].id)) children[i].checked = checkVal;
    }
}

var bo_ns_id = 0;
function startIeFix() {
  if (isIE()) {
    document.write('<div id="bo_ns_id_' + bo_ns_id + '"><!-- ');
  }
}
function endIeFix() {
  if (isIE()) {
    document.write('</div>');
    var theObject = document.getElementById("bo_ns_id_" + bo_ns_id++);
    var theCode = theObject.innerHTML;
    theCode = theCode.substring(4 ,9+theCode.indexOf("</object>"));
    document.write(theCode);
  }
}
function isIE() {
  // only for Win IE 6+
  // But not in Windows 98, Me, NT 4.0, 2000
  var strBrwsr= navigator.userAgent.toLowerCase();
  if (strBrwsr.indexOf("msie") > -1 && strBrwsr.indexOf("mac") < 0) {
    if (parseInt(strBrwsr.charAt(strBrwsr.indexOf("msie")+5)) < 6) {
      return false;
    }
    if (strBrwsr.indexOf("win98") > -1 ||
       strBrwsr.indexOf("win 9x 4.90") > -1 ||
       strBrwsr.indexOf("winnt4.0") > -1 ||
       strBrwsr.indexOf("windows nt 5.0") > -1)
    {
      return false;
    }
    return true;
  } else {
    return false;
  }
}

function multiline_onpaste(maxlength){
	var e = window.event.srcElement;
	var data = window.clipboardData.getData('Text');
	var s = e.value + data;
	if(s.length > maxlength){
		alert('The text you are attempting to insert exceeds the maximum length of this field.');
		event.returnValue = false;
	}
}

function multiline_onkeypress(maxlength){
	var e = window.event.srcElement;
	if(e.value.length > maxlength){
		event.returnValue = false;
	}
}

function popWindow(inURL){
	var MapWin = window.open('', 'newWin2','resizable=yes,menubar=yes,locationbar=yes,statusbar=yes,personalbar=yes,toolbar=yes,scrollbars=yes,status=0,width=650,height=450');
	MapWin.location = inURL
}

function popupURL(URL,width,height)
{
    Window = window.open(URL,'popupURL','scrollbars=yes,resizable=yes,statusbar=yes,width=' + width +',height=' + height);
}
///////////////////////////////////////////////////////////////
// Functions to swap sibling objects
///////////////////////////////////////////////////////////////
function moveObjUp(o) {
	if (o.previousSibling != null) {
		var p = o.parentNode;
		var s = o.previousSibling;
		var c = p.removeChild(o);
		p.insertBefore(c,s);
	}
}
function moveObjDown(o) {
	if (o.nextSibling != null) {
		var p = o.parentNode;
		var s = p.removeChild(o.nextSibling);
		p.insertBefore(s,o);
	}
}

//shortcut function
function getEl(id) {
    return document.getElementById(id);
}

/////////////////////////////////////
//// Select objects are windowed and therefore don't obey the zIndex in IE (at least at the time of this writing)
//// Therefore, they need to be hidden if they are in the way of an object.
/////////////////////////////////////
function _nonMenu_setSelectVisibility(visibility,obj) {
	// get object position
	var oTop = _totalOffsetTop(obj);
	var oLeft = _totalOffsetLeft(obj);
	var oBottom = oTop + obj.offsetHeight;
	var oRight = oLeft + obj.offsetWidth;

	// loop through select objects
	var selectObjs = document.getElementsByTagName("SELECT");
	for (var i = 0; i < selectObjs.length; i ++) {
		selectObj = selectObjs[i];
		if (visibility == "hidden") {
			// get select object position
			var sTop = _totalOffsetTop(selectObj);
			var sLeft = _totalOffsetLeft(selectObj);
			var sBottom = sTop + selectObj.offsetHeight;
			var sRight = sLeft + selectObj.offsetWidth;

			// If select object overlaps menu, hide it.
			if (((oTop < sTop && sTop < oBottom) || (oTop < sBottom && sBottom < oBottom) || (sTop < oTop && sBottom > oBottom) || (sTop > oTop && sBottom < oBottom))
				&& ((oLeft < sLeft && sLeft < oRight) || (oLeft < sRight && sRight < oRight) || (sLeft < oLeft && sRight > oRight) || (sLeft > oLeft && sRight < oRight))) {
				selectObj.style.visibility = "hidden";
			}
		} else {

			// Make sure all select objects are visible again.
			selectObj.style.visibility = "visible";
		}
	}
}

function menuChanged(event,ui)
{
    // loop through all of the menu items and turn off the item, then only turn on the selected one
    if (ui.oldHeader.length > 0)
    {
        ui.oldHeader[0].firstChild.src = ui.oldHeader[0].firstChild.src.replace("_on.gif","_off.gif");
        ui.oldHeader[0].firstChild.oSrc = ui.oldHeader[0].firstChild.oSrc.replace("_on.gif","_off.gif");
    }
    ui.newHeader[0].firstChild.src = ui.newHeader[0].firstChild.src.replace("_off.gif","_on.gif");
    
    // loop through the roll over code to set the image file in the array so when it restores it, it restores it as ON
    if (document.MM_sr)
    {
        for (var i=0;i<document.MM_sr.length;i++)
        {
            if (document.MM_sr[i].name==ui.newHeader[0].firstChild.name)
                document.MM_sr[i].oSrc = document.MM_sr[i].oSrc.replace("_off.gif","_on.gif");
        }
    }
    
}

function MM_MenuSwapImage() { //v3.0

  var i,j=0,x,a=MM_MenuSwapImage.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];}
}
function MM_MenuSwapImgRestore() { //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 correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters)) 
   {
      for(var i=0; i<document.images.length; i++)
      {
         var img = document.images[i]
         var imgName = img.src.toUpperCase()
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText 
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='crop');\"></span>" 
            img.outerHTML = strNewHTML
            i = i-1
         }
      }
   }    
}

var fontSize = 100;
function increaseFontSize()
{
    var contentArea = document.getElementById("ip-leftcoltxt");
    if (fontSize>=150)
       fontSize = 100;
    else
       fontSize += 20;
    
    contentArea.style.fontSize = fontSize+"%";
}