function opennewwindow(theURL,winName,features)
{
window.open(theURL,winName,features);
return false;
}

function ClearStuff(which)
{
	if (which.clicked == undefined)
	{
	  which.value = "";
	  which.clicked = true;
	 }
}
function formatPhone(field){
    field.value = trim(field.value);
    var ov = field.value;
    var v = "";
    var x = -1;
    // is this phone number 'escaped' by a leading plus?
    if (0 < ov.length && '+' != ov.charAt(0)) { // format it
        // count number of digits
        var n = 0;
        if ('1' == ov.charAt(0)) {  // skip it
            ov = ov.substring(1, ov.length);
        }

        for (i = 0; i < ov.length; i++) {
            var ch = ov.charAt(i);

            // build up formatted number
            if (ch >= '0' && ch <= '9') {
                if (n == 0) v += "(";
                else if (n == 3) v += ") ";
                else if (n == 6) v += "-";
                v += ch;
                n++;
            }
            // check for extension type section;
            // are spaces, dots, dashes and parentheses the only valid non-digits in a phone number?
            if (! (ch >= '0' && ch <= '9') && ch != ' ' && ch != '-' && ch != '.' && ch != '(' && ch != ')') {
                x = i;
                break;
            }
        }
        // add the extension
        if (x >= 0) v += " " + ov.substring(x, ov.length);

        // if we recognize the number, then format it
        if (n == 10 && v.length <= 40) field.value = v;
    }
    return true;
}

function validateEmail(FEmail)
{
if ((FEmail.value.indexOf(".") == -1) || (FEmail.value.indexOf("@") == -1) || (FEmail.value.indexOf(" ") != -1))
	return false;
else
	return true;
}

function trim(FString)
{
return FString.replace(/^\s*|\s*$/g,"");
}

function ajaxCall(FURL)
{
if (window.XMLHttpRequest)
	ajaxReq = new XMLHttpRequest();
else if (window.ActiveXObject)
	ajaxReq = new ActiveXObject("Microsoft.XMLHTTP");
if (FURL.indexOf("?") == -1)
	submitURL = FURL + "?count=" + Math.random();
else
	submitURL = FURL + "&count=" + Math.random();
ajaxReq.open("GET",submitURL,false);
ajaxReq.send(null);
}
document.write('<!--[if IE ]>');
document.write('<link rel=\"stylesheet\" href=\"https://www.nexternal.com/styles_ie.css\" type=\"text/css\">');
document.write('<![endif]-->')
document.write('<!--[if lte IE 6]>')
document.write('<link rel=\"stylesheet\" href=\"https://www.nexternal.com/styles_ie6.css\" type=\"text/css\">')
document.write('<![endif]--> ')
document.write('<!--[if gte IE 5.5]>')
document.write('<![if lt IE 7]>')
document.write('<link rel=\"stylesheet\" href=\"https://www.nexternal.com/styles_png.css\" type=\"text/css\">')
document.write('<![endif]>')
document.write('<![endif]-->')
