/*--------------------------------------------------------------------------
 *
 *  From old site
 *
/*--------------------------------------------------------------------------*/

function MM_openBrWindow(theURL,winName,features) {
	if (features == null) {
		var win = window.open(theURL,winName);
	} else {
		var win = window.open(theURL,winName,features);
	}
	return win;
}

function gotoWindow(strPage, intWidth, intHeight) {
	if (strPage > '') {
		var strWindowName = strPage.replace(/\./gi, '_');
		var strURL = 'https://wic012v.server-secure.com/vs76083_secure/index.asp?Page=' + strPage;
		if (isNull(intWidth) && isNull(intHeight)) {
			intWidth = 768
			intHeight = 576
		}
		intLeft = ((screen.width - intWidth) / 2) + 1
		intTop = ((screen.height - intHeight) / 2) + 1
		var win = MM_openBrWindow(strURL, strWindowName, 'left=' + intLeft + ',screenX=' + intLeft + ',top=' + intTop + ',screenY=' + intTop + ',resizable=yes,scrollbars=yes,status=yes,toolbar=no,width=' + intWidth + ',height=' + intHeight);
	}
}

function isNull(aItem) {
	var item = aItem + ''
	return ((item == 'null') || (item == 'undefined'))
}


//To include a page, invoke ajaxinclude("afile.htm") in the BODY of page
//Included file MUST be from the same domain as the page displaying it.

var rootdomain="http://"+window.location.hostname
function ajaxinclude(url) {
	var page_request = false
	if (window.XMLHttpRequest) { // if Mozilla, Safari etc
		page_request = new XMLHttpRequest();
	} else if (window.ActiveXObject){ // if IE
		try {
			page_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e){
			try {
				page_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
			}
		}
	} else {
		return false;
	}
	page_request.open('GET', url, false); //get page synchronously 
	page_request.send(null);
	writecontent(page_request);
}

function writecontent(page_request){
	if (window.location.href.indexOf("http")==-1 || page_request.status==200) document.write(page_request.responseText);
}

function init_tips(){
		unauthTips = new Tips($$('.tips'), {
			offsets: {
			'x': 0,
			'y': 15
		},
			maxTitleChars: 70,
			className: 'custom-tip',
			fixed: false,
			title: 'title',
			text: 'rel'
		});

}

window.addEvent('domready', function(){
	// external links
	var anchors = $$('a');
	var lb_init_tips = false;
	$$('span.ua').each(function(element, i){
		if ( (element.hasClass('ua')) ) {
				element.title = 'Please log in to view this file.';
				lb_init_tips = true;
				element.onclick = function () { window.location='/login/'; }
		}
	});
	anchors.each(function(element, i){
		if(element.get('rel') && element.get('href')){
			if(element.get('rel').contains('external')) {
					element.target = "_blank";
					if(!element.get('title')){
						element.title = 'Opens in a new window.';
					}
			}
		}
		
		if ((element.hasClass('toggle'))||(element.hasClass('moreinfonot'))) {
			var lsSectionId = element.get('href').split("#")[1];
			$(lsSectionId).addClass('hidden');
			element.onclick = function () { jly_toggle(this); return false; }
		}
	});
	
	if(lb_init_tips){
			init_tips();
	}
	$$('#nav li').each(function(element){
		element.addEvent('mouseover', function(){
			this.addClass('ieHover');
		});
		element.addEvent('mouseout', function(){
			this.removeClass('ieHover');
		});
	});
});