﻿<!--                               Hide from non-JS browsers
function getDiv(id){
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( id );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[id];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[id];
	
	return elem;
}
function iFrameHeight(iframe) {
     var h = 0;
     if(document.all ) {
         h = document.frames(iframe).document.body.scrollHeight;
         eval("document.all."+iframe+".style.height = h + 20 + 'px';");
     } else if ( document.getElementById) {
         h = document.getElementById(iframe).contentDocument.height;
         document.getElementById(iframe).style.height = h + 60 + 'px';
     }
 }
function getWindowWidth() {
			var viewportwidth;
			 if (typeof window.innerWidth != 'undefined'){
				  viewportwidth = window.innerWidth;
			 }
			// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
			 else if (typeof document.documentElement != 'undefined'
				 && typeof document.documentElement.clientWidth !=
				 'undefined' && document.documentElement.clientWidth != 0){
				   viewportwidth = document.documentElement.clientWidth;
			 }
			 // older versions of IE
			 else{
				   viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
			 }
			return viewportwidth;
		}
		
		function getWindowHeight() {
			 var viewportheight;
			 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
			 if (typeof window.innerHeight != 'undefined'){
				  viewportheight = window.innerHeight;
			 }
			// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
			 else if (typeof document.documentElement != 'undefined'
				 && typeof document.documentElement.clientHeight !=
				 'undefined' && document.documentElement.clientHeight != 0){
				   viewportheight = document.documentElement.clientHeight;
			 }
			 // older versions of IE
			 else{
				   viewportheight = document.getElementsByTagName('body')[0].clientHeight;
			 }
			return viewportheight;
		}
		
		function centerDivH(id) {
			if (document.getElementById) {
				var windowHeight = getWindowHeight();
				if (windowHeight > 0) {
					var contentElement = getDiv(id);
					var contentHeight = contentElement.offsetHeight;
					if (windowHeight - contentHeight > 0) {
						contentElement.style.position = 'absolute';
						contentElement.style.top = ((windowHeight / 2) - (contentHeight / 2)) + 'px';
					}
					else {
						contentElement.style.position = 'static';
					}
				}
			}
		}
		function centerDivW(id) {
			if (document.getElementById) {
				var windowWidth = getWindowWidth();
				if (windowWidth > 0) {
					var contentElement = document.getElementById(id);
					var contentWidth = contentElement.offsetWidth;
					if (windowWidth - contentWidth > 0) {
						contentElement.style.position = 'absolute';
						contentElement.style.left = ((windowWidth / 2) - (contentWidth / 2)) + 'px';
					}
					else {
						contentElement.style.position = 'static';
					}
				}
			}
		}

		function centerDiv(id,width,height) {
			if (document.getElementById) {
				var windowHeight = getWindowHeight();
				var windowWidth = getWindowWidth();
				if (windowHeight > 0) {
					var contentElement = getDiv(id);
					var contentHeight;
					var contentWidth;
					if(empty(height)){
						contentHeight = contentElement.offsetHeight;
					}
					else{
						contentHeight = height;
					}
					if(empty(width)){
						contentWidth = contentElement.offsetWidth;
					}
					else{
						contentWidth = width;
					}
					//alert(contentHeight +'-'+ windowHeight);
					if (windowHeight - contentHeight > 0) {
						contentElement.style.position = 'absolute';
						contentElement.style.top = ((windowHeight / 2) - (contentHeight / 2)) + 'px';
						if (windowWidth - contentWidth > 0) {
							contentElement.style.position = 'absolute';
							contentElement.style.left = ((windowWidth / 2) - (contentWidth / 2)) + 'px';
						}
						else {
							contentElement.style.position = 'static';
						}
					}
					else {
						contentElement.style.position = 'static';
					}
				}
			}
		}

function getScrollWidth()
{
   var w = window.pageXOffset ||
           document.body.scrollLeft ||
           document.documentElement.scrollLeft;
           
   return w ? w : 0;
}

function getScrollHeight()
{
   var h = window.pageYOffset ||
           document.body.scrollTop ||
           document.documentElement.scrollTop;
           
   return h ? h : 0;
}
function getPageSizeWithScroll(){
	if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
  	}
	arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
	//alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );
	return arrayPageSizeWithScroll;
}

function newWindow(url, name, w, h, opt){
	if(!opt || opt=='' || typeof opt =='undefined')
		opt='location=0, menubar=0, status=0, toolbar=0, scrollbars=0, resizable=0';
      sw = screen.availWidth;
      sh = screen.availHeight;
   var leftPos = (sw-w)/2, topPos = (sh-h)/2;
	remotewin = window.open(url, name, 'width= '+ w +', height='+ h +', left='+leftPos+', top='+topPos+', '+opt);
	if (remotewin != null){
		if (remotewin.opener == null) {
			remotewin.opener = self;
		}
	}
}

function getScrollPos() {
    var x = 0, y = 0;
    if( typeof( window.pageYOffset ) == 'number' ) {
        // Netscape
        x = window.pageXOffset;
        y = window.pageYOffset;
    } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
        // DOM
        x = document.body.scrollLeft;
        y = document.body.scrollTop;
    } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
        // IE6 standards compliant mode
        x = document.documentElement.scrollLeft;
        y = document.documentElement.scrollTop;
    }
    return [x, y];
}		

//image stuff

function centerImageTable(){
	var height=getWindowHeight();
	var width=getWindowWidth();
	var oh=height/2;
	var ow=width/2;
	var table=getDiv('loadedTable');
	var h=table.offsetHeight;
	var w=table.offsetWidth;
	table.style.top=oh-(h/2)+'px';
	table.style.left=ow-(w/2)+'px';
	table.style.visibility='visible';
}
function showImage(imgName,txt){
	//parent.showImage(imgName,txt);
	//return false;
	showLayer('loading');
	var l=getDiv('loading');
	var dim=getPageSizeWithScroll();
	var height=dim[1];
	var width=dim[0];
	var oh=height/2;
	var ow=width/2;
	if(txt)
	txt=str_replace(array('`1`','`2`'),array("'",'"'),txt);
	var temp='<div style="opacity: 0.6;-moz-opacity: 0.6;filter: alpha(opacity=60);position:absolute; margin:0; padding:0; top:0; left:0; width:'+width+'px; height:'+height+'px; background-color:#ffffff; z-index:501;">&nbsp;</div>	<div id="loadedTable" style="margin:0; padding:0;opacity: 1.0;-moz-opacity: 1.0;filter: alpha(opacity=100);z-index:9999; position:absolute; top:'+oh+'px;left:'+ow+'px;" align="center"><table style="z-index:9999;width: 356px; border-width: 0px;background-color:#ffffff;" cellspacing="0"><tr><td style="text-align: center; border-left: 1px solid #808080; border-right: 1px solid #808080; border-top: 1px solid #808080; border-bottom-color: #808080; background-color:#ffffff; font-family:arial;font-size:11px;" valign="top"><img id="blogImg" src="'+imgName+'" />';
         if(txt){
            temp+='<br />'+txt;
         }
         temp+='</td></tr><tr><td style="text-align: center; font-family: Arial, Helvetica, sans-serif; font-size: 9px; border: 1px solid #808080; background-color: #E9E9E9" valign="top"><a href="javascript:void(0);" onclick="hideLayer(\'loading\');" style="text-decoration: none;color: #000080">CLICK TO CLOSE</a></td></tr></table></div>';
         l.innerHTML=temp;
	var table=getDiv('loadedTable');
	table.style.visibility='hidden';
	setTimeout('centerImageTable();', 500); // in half a second
}

// calendar stuff
function display_cal(content,form){
		var obj=getDiv('cal');
		var formobj=getDiv(form);
		var left;
		var top;
			var loading=getDiv('calLoading');
			var name=getDiv('calName');
			if(name)
				name.style.display='inline';
			if(loading)
				loading.style.display='none';
		top=get_y(formobj);
		left=get_x(formobj);
		top=top+20;
		left=left+20;
		//window.scroll(0,top-30);
		obj.style.visibility='visible';
		obj.style.position='absolute';
		obj.style.left=left+'px';
		obj.style.top=top+'px';
		obj.innerHTML=content;
	}
	function click_cal(form,date){
		var obj=getDiv('cal');
		var formobj=getDiv(form);
		formobj.value=date;
		obj.style.visibility='hidden';
	}
	function hide_cal(){
		var obj=getDiv('cal');
		obj.style.visibility='hidden';
	}
	
function get_x(obj){
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

  function get_y(obj){
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }
//registration jumping
function checkphone1()
{
var letters = document.FormName.homephone1.value.length +1;
if (letters <= 3)
{document.FormName.homephone1.focus()}
else
{document.FormName.homephone2.focus()}
}
function checkphone2()
{
var letters = document.FormName.homephone2.value.length +1;
if (letters <= 3)
{document.FormName.homephone2.focus()}
else
{document.FormName.homephone3.focus()}
}
function checkworkphone1()
{
var letters = document.FormName.workphone1.value.length +1;
if (letters <= 3)
{document.FormName.workphone1.focus()}
else
{document.FormName.workphone2.focus()}
}
function checkworkphone2()
{
var letters = document.FormName.workphone2.value.length +1;
if (letters <= 3)
{document.FormName.workphone2.focus()}
else
{document.FormName.workphone3.focus()}
}
function checkcellphone1()
{
var letters = document.FormName.cellphone1.value.length +1;
if (letters <= 3)
{document.FormName.cellphone1.focus()}
else
{document.FormName.cellphone2.focus()}
}
function checkcellphone2()
{
var letters = document.FormName.cellphone2.value.length +1;
if (letters <= 3)
{document.FormName.cellphone2.focus()}
else
{document.FormName.cellphone3.focus()}
}
function checkfaxphone1()
{
var letters = document.FormName.faxphone1.value.length +1;
if (letters <= 3)
{document.FormName.faxphone1.focus()}
else
{document.FormName.faxphone2.focus()}
}
function checkfaxphone2()
{
var letters = document.FormName.faxphone2.value.length +1;
if (letters <= 3)
{document.FormName.faxphone2.focus()}
else
{document.FormName.faxphone3.focus()}
}
// -->