/* Desc: opens a new window to show content */
function openWin( url, iWidth, iHeight, scroll ) 
{	
	if( iWidth == -1 )	// width of the screen
		iWidth = screen.availWidth;
	
	if( iHeight == -1 ) // height of the screen
		iHeight = screen.availHeight;
	
	var winprop = "width=" + iWidth + ",height=" + iHeight + ",scrollbars=" + scroll; 
	
	openwin = window.open(url,'',winprop); 
} 

/*
    Desc: This will write out our email address to avoid spam bots
    Example: name@domain.com?subject=fun
    Param:  emailName - name of email, ex: name
            emailDomain - name of the domain, ex: domain.com
            emailLink - the representation text of the email
            emailSubject - the subject of the email, ex: fun
*/
function protectMail( emailName, emailDomain, emailLink, emailSubject )
{
    var strDefaultDomain = "ccsasoftball.net";
    var strFinalEmail = ""; // final email string
    var strFinalHTML = "";  // final html string to write
    
    // final manipulation of the variables
    var strFinalEmailName = trim( emailName );
    var strFinalEmailDomain = trim( emailDomain );
    var strFinalEmailLink = trim( emailLink );
    var strFinalEmailSubject = trim( emailSubject );
    
    if( strFinalEmailDomain.length == 0 )   // use the default
        strFinalEmailDomain = strDefaultDomain;
    
    if( strFinalEmailName.length > 0 || strFinalEmailDomain.length > 0 )  // these param must be at least 1 in length
    {
        strFinalEmail = strFinalEmailName + "@" + strFinalEmailDomain;
        
        strFinalHTML = "<a href=\"mailto:" + strFinalEmail;
        
        if( strFinalEmailSubject.length > 0 )   // give the email a subject line
            strFinalHTML += "?subject=" + strFinalEmailSubject;
        
        strFinalHTML += "\">";
        
        if( strFinalEmailLink.length > 0 )   // use this link name
            strFinalHTML += strFinalEmailLink;
        else
            strFinalHTML += strFinalEmail;
        
        strFinalHTML += "</a>";
    } // if
    
    document.write( strFinalHTML );
} // protectMail

/*
    Desc: This will trim the string passed in
    Param: strToTrim - string subject to be trimmed.
*/
function trim( strToTrim ) 
{
	return strToTrim.replace(/^\s+|\s+$/g,"");
} //trim

