
function qPrint(qs) {
	window.open('printWindow.asp?' + qs, 'smcprint', 'height=580, width=600, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, toolbar=no');	
}

function sPage(qs)
{
	window.open('sendthispage.asp?' + qs, 'smcsendthispage', 'height=580, width=600, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, toolbar=no');	
}



function showPrintWindow() 
{
	var printWin;
	
	// make sure the win isn't already opened
	if( !printWin || printWin.closed ) {
		printWin = window.open('index.cfm?event=showPrintWindow', 'smcprint', 
			'height=580, width=600, location=no, menubar=no, resizable=yes, scrollbars=yes, status=yes, toolbar=no');
	}
	else if( printWin.focus ) {
		// win is already open and focusable, so bring it to the front
		printWin.focus();
	}
}

function showEmail2FriendWindow(m2e) 
{
	var emailWin;
	
	// make sure the win isn't already opened
	if( !emailWin || emailWin.closed ) {
		emailWin = window.open(m2e, 'smcemail', 
			'height=580, width=600, location=no, menubar=no, resizable=yes, scrollbars=yes, status=yes, toolbar=no');
	}
	else if( emailWin.focus ) {
		// win is already open and focusable, so bring it to the front
		emailWin.focus();
	}
}

/* utils */
function LTrim(s) {return s.replace(/^\s*/, '');}
function RTrim(s) {return s.replace(/\s*$/, '');}
function Trim(s) {return RTrim(LTrim(s));}

function trimString (str) {
  str = this != window? this : str;
  return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}

function $()
{
    var elements = new Array();

    for (var i = 0; i < arguments.length; i++)
    {
        var element = arguments[i];
        if (typeof element == 'string')
        {
            if (document.getElementById)
            {
                element = document.getElementById(element);
            }
            else if (document.all)
            {
                element = document.all[element];
            }
        }

        if (arguments.length == 1) 
        {
            return element;
        }

        elements.push(element);
    }

    return elements;
}

function addLoadEvent(func) {
   	var oldonload = window.onload;
   	if (typeof window.onload != 'function') {
   	    window.onload = func;
   	} else {
       	window.onload = function() {
       	    oldonload();
       	    func();
       	}
   	}
}