// SpamProof jscript methods
//To be used to prevent spammers from grabbing email addresses from a website
//
//Example:
//For more information contact our <Script language="JavaScript">PrintMail('sales','hubbardone.com','Sales')</SCRIPT> department.
//results: For more information contact our sales department.
//	where sales will be a link to mailto.



function xSendMail(n,d){
	document.location.href='mailto:' + n + '@' + d;
}

function SendMail(name, domain){
	if (location.href.indexOf('positioning.wilmerhale.com')!=-1)
	{
		document.location.href='mailto:' + name + '@' + domain;
	}
	else if (location.href.indexOf('wilmerhaleinsite.com')!=-1)
	{
		document.location.href='mailto:' + name + '@' + domain;
	}
	else
	{
        //the german disclaimer is longer    
	    var BaseOptions = '';
	    if(emSiteRoot.indexOf("MOBILE:") > -1)
	    {
	       if(confirm(emSiteRoot.substring(7)))
	            document.location.href = "mailto:" + name + "@" + domain;
	    }
	    else
	    {
	    if(emSiteRoot.indexOf("/de/") > -1)
	    {
            BaseOptions = 'width=400,height=400,status=no,scrollbars=yes,resizeable=yes';
	    }
	    else
	    {
	        BaseOptions = 'width=400,height=330,status=no,scrollbars=yes,resizeable=yes';
	    }
	    		
		var win = window.open(emSiteRoot + 'emaildisclaimer/emaildisclaimer.aspx?n=' + name + '&d=' + domain.replace('?subject=','%3Fsubject%3D'),'_new', BaseOptions);
		}
    }
}

function SendAlumniMail(name, domain){
    var BaseOptions = '';
    if(emSiteRoot.indexOf("/de/") > -1)
    {
        BaseOptions = 'width=400,height=400,status=no,scrollbars=yes,resizeable=yes';
    }
    else
    {
        BaseOptions = 'width=400,height=330,status=no,scrollbars=yes,resizeable=yes';
    }
    		
	var win = window.open(emSiteRoot + 'emailpopup/EmailPopUp.aspx?n=' + name + '&d=' + domain.replace('?subject=','%3Fsubject%3D'),'_new', BaseOptions);
}

function MobileSendMail(name, domain){
	if(emSiteRoot && confirm(emSiteRoot.substring(7)))
	    document.location.href = "mailto:" + name + "@" + domain;
	    	        
}

function MobileConfirmMail(){
	if(emSiteRoot)
	    return confirm(emSiteRoot.substring(7));
	else
	    return true;
}

function MobilePrintMail(n,d,m,l){
	var ns = n.replace("'","\\\'");
	ns = ns.replace("&#39;", "\\\'");
	if(m == ""){
		m = n + '@' + d;
	} else {
	    m = m.replace("|at|", "@");
	}
	var ms = m.replace("'","\\\'");
	ms = ms.replace("&#39;", "\\\'");
	
	document.write("<a href=\"JavaScript:MobileSendMail('" + ns + "','" + d + "'); \" onMouseOver=\"self.status='" + ms.replace("<br>", "") + "'; return true;\" onMouseOut=\"self.status=''; return true;\"" + l +">" + m + "</a>");
	return true;
}	

function PrintMail(n,d,m){
	PrintMail(n,d,m,'');
}	

function PrintMail(n,d,m,l){
	var ns = n.replace("'","\\\'");
	ns = ns.replace("&#39;", "\\\'");
	if(m == ""){
		m = n + '@' + d;
	} else {
	    m = m.replace("<at>", "@");
	}
	var ms = m.replace("'","\\\'");
	ms = ms.replace("&#39;", "\\\'");
	
	document.write("<a href=\"JavaScript:SendMail('" + ns + "','" + d + "'); \" onMouseOver=\"self.status='" + ms.replace("<br>", "") + "'; return true;\" onMouseOut=\"self.status=''; return true;\"" + l +">" + m + "</a>");
	return true;
}	

function PrintEmail(name, domain) { 
	document.write(name + "@" + domain);
}

function SendEmail(name, domain){
	document.location.href = "mailto:" + name + "@" + domain;
}

function sMail(s){
    var sx = s.replace("<at>", "@");
    
    var n = sx.substring(0, sx.indexOf("@"));
    var d = sx.substring(sx.indexOf("@")+1);
	m = sx;

    var ns = n.replace("'","\\\'");
	var ms = m.replace("'","\\\'");
	var l = '';

	document.write("<a href=\"JavaScript:SendMail('" + ns + "','" + d + "'); \" onMouseOver=\"self.status='" + ms + "'; return true;\" onMouseOut=\"self.status=''; return true;\"" + l +">" + m + "</a>");
}
