if(typeof WSJS=="undefined"){var WSJS={};}

WSJS.namespace = function() {
    var a=arguments, o=null, i, j, d;
    for (i=0; i<a.length; ++i) {
        d=a[i].split(".");
        o=WSJS;

        // WSJS is implied, so it is ignored if it is included
        for (j=(d[0] == "WSJS") ? 1 : 0; j<d.length; ++j) {
            o[d[j]]=o[d[j]] || {};
            o=o[d[j]];
        }
    }

    return o;
};

WSJS.namespace("anim");
WSJS.namespace("autoScroll");
WSJS.namespace("forms");
WSJS.namespace("util");
WSJS.namespace("display");

WSJS.util.popup = function( url, width, height, resizable, scrollbars, menubar,id ) {

	// Default values
    if(!id) id="WSJSwindow";
    if( !width ) width = 640;
    if( !height ) height = 400;
    if( !resizable ) resizable = "1";
    if (!scrollbars ) scrollbars = "1";
    if (!menubar ) menubar = "0";

	// Application
    var openedWindow = window.open( url, id, "menubar="+menubar+",resizable="+resizable+",scrollbars="+scrollbars+",width="+width+",height="+height );
    
    if (!openedWindow) {
        alert("Your browser appears to be blocking pop-ups. Please allow pop-ups to see more content.");
    }
    return false;
}

WSJS.display.displayEmail = function( username, domain, linked, linked_text, attr ) {
	var email_output = '';
	
	if(linked) {
		email_output = "<a ";
		if (attr != undefined)
			email_output += attr + " ";
		email_output += "href=" + "mail" + "to:" + username + "@" + domain + ">";
	}

	if (linked_text == undefined)
		email_output += username + "@" + domain;
	else
		email_output += linked_text;
	
	if (linked)
		email_output += "</a>";
		
	document.write(email_output);
}

WSJS.util.toggleSections = function(elementId, parentId, selfHide) {
	var children = document.getElementById(parentId).childNodes;

	/* Hide itself if specified */
	if (selfHide != undefined && document.getElementById(elementId).style.display == '') {
		document.getElementById(elementId).style.display = 'none';
		return;
	}

	for(var i=0; i<children.length; i++) {
		if (elementId == children[i].id) {
			document.getElementById(children[i].id).style.display = '';
		}else if (children[i].id != null) {
    		document.getElementById(children[i].id).style.display = 'none';
    	}
	}
}

