﻿
//--------------UI Manipulation Code----------------
function hideClass(sClass) {
	var el = getElementsByClass(document,sClass,'*');
	for (i = 0; i != el.length; i++) {
		el[i].style.display = 'none';
	}
}
function getElementsByClass(node,searchClass,tag) {
	var classElements = new Array();
	var els = node.getElementsByTagName(tag); // use "*" for all elements
	var elsLen = els.length;
	var pattern = new RegExp("\\b"+searchClass+"\\b");
	for (i = 0, j = 0; i < elsLen; i++) {
		  if ( pattern.test(els[i].className) ) {
				 classElements[j] = els[i];
				 j++;
		  }
	}
	return classElements;
}
function popup(url) {
	var newWin = window.open(url,'mywin','width=800,height=600,scrollbars=yes,resizable=yes');
}
function popupPreview(url) {
	var newWin = window.open(url,'mywin','width=900,height=600,scrollbars=yes,resizable=yes,adddressbar=yes');
}
function popupGeotag(url) {
	var newWin = window.open(url,'mywin','width=800,height=600,scrollbars=yes,resizable=yes,adddressbar=yes');
}
function popupSlideshow(url) {
	var newWin = window.open(url,'mywin','width=900,height=700,scrollbars=yes,resizable=yes,adddressbar=yes');
}
function popupMini(url) {
	var newWin = window.open(url,'mywin','width=340,height=240,scrollbars=no,resizable=no');
}
function popupMedium(url) {
	var newWin = window.open(url,'mywin','width=500,height=300,scrollbars=no,resizable=no');
}
function popupFullscreen(p,s,r){
    var w = screen.availWidth-10;
    var h = screen.availHeight-70;
    win=window.window.open(p,'f', 'width=' + w + ',height=' + h + ',top=0,left=0,scrollbars='+s+',resizable='+r+',fullscreen=0');
    win.focus();
}

function capitalizeMe(val) {
    return val.substring(0,1).toUpperCase() + val.substring(1,val.length);
}


function updateOpener() {
    opener.location.href = opener.location.href;
}

function backToTop() {
    var x1 = x2 = x3 = 0;
    var y1 = y2 = y3 = 0;

    if (document.documentElement) {
        x1 = document.documentElement.scrollLeft || 0;
        y1 = document.documentElement.scrollTop || 0;
    }

    if (document.body) {
        x2 = document.body.scrollLeft || 0;
        y2 = document.body.scrollTop || 0;
    }

    x3 = window.scrollX || 0;
    y3 = window.scrollY || 0;

    var x = Math.max(x1, Math.max(x2, x3));
    var y = Math.max(y1, Math.max(y2, y3));

    window.scrollTo(Math.floor(x / 2), Math.floor(y / 2));

    if (x > 0 || y > 0) {
        window.setTimeout("backToTop()", 25);
    }
}
function DoRollOver(name,over)
{
	if(window.document.images) 
	{
	    var sExt;
	    if (window.document.images[name].src.indexOf('.jpg')>0){
	        sExt=".jpg";
	    }else{
	        if (window.document.images[name].src.indexOf('.gif')>0){
	        sExt=".gif";
	        }else{
	            sExt=".png";
	        }
	    }
	    
		if (over)
			window.document.images[name].src = "/images/buttons/" + name + "-hover" + sExt;
		else
			window.document.images[name].src =  "/images/buttons/" + name + sExt;
	}
}
function hoverOver(oElement,bHover) {
	if (bHover==1) {
		//oElement.className='area-hover';
	}else {
		//oElement.className='area';
	}
}
function toggleContentExpand(sField,iID){
	var divShort = document.getElementById(sField+'Short'+iID);
	var divLong = document.getElementById(sField+'Long'+iID);
	if (divShort.className=='visible'){
		//Effect.SlideUp(divShort.id);
		divShort.className='invisible';
		divLong.className='visible';
		Effect.BlindDown(divLong.id,{duration: 0.5,from:0.5,to:1.0});
		//ffect.Appear('divFacilitiesLong',{duration: 0.8,from:0.2,to:1.0});
	}else{
		//Effect.SlideUp(divLong.id);
		divShort.className='visible';
		Effect.BlindUp(divLong.id,{duration: 0.4,from:0.0,to:1.0});
		Effect.BlindDown(divShort.id,{duration: 1.0});
		//divLong.className='invisible';
		//Effect.SlideDown(divLong.id,{from:0.5;to:1.0});
	}
}
function rowHover(oElement,bAlt,bHover) {
    if (bAlt==1) {
        if (bHover==1) {
	        oElement.className='trOverAlt';
        }else {
	        oElement.className='trOutAlt';
        }
    }else {
        if (bHover==1) {
	        oElement.className='trOver';
        }else {
	        oElement.className='trOut';
        }
    }
}