
function stripHTML(strHTML){
    var re = new RegExp;
    re = /<(.|\n)+?>/gi;
    return strHTML.replace(re, "");
    return strHTML
						
}

function isEmailValid(str) {

	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
	   return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	    return false
	}

	 if (str.indexOf(at,(lat+1))!=-1){
	    return false
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	    return false
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
	    return false
	 }
	
	 if (str.indexOf(" ")!=-1){
	    return false
	 }

	 return true					
}


//used for top navigation
function swapImage(img) {
    thisSrc = img.src
    if (thisSrc.indexOf("_on.png") == -1) {	//leave alone if on
        if (thisSrc.indexOf("_over") > 0) {	//over, turn off
            thisSrc = thisSrc.replace("_over.png", ".png")
            img.src = thisSrc
        } else {	//turn over
            thisSrc = thisSrc.replace(".png", "_over.png")
            img.src = thisSrc
        }
    }
}

//for use with any ajax calls													
var request = false;
var requestPrivate = false
try {
	request = new XMLHttpRequest();
} catch (trymicrosoft) {
	try {
	request = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (othermicrosoft) {
	try {
		request = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (failed) {
		request = false;
	}  
	}
}


// function: add rollover for SmartWebs buttons (handles GIFs and PNGs)
function addSWBtnRollovers() {
    //alert("images # " + document.images.length);
    for (i = 0; i < document.images.length; i++) {
        //if button is a smartwebs button

        if (document.images[i].src.indexOf('swbtn_') > 0) {
            //if button is a png
            //alert("src: " + document.images[i].src);
            imgSrc = document.images[i].src
            //alert(imgSrc)
            arrParts = imgSrc.split(".")
            ext = arrParts[arrParts.length - 1]
            //alert(ext)
            if (ext == "gif") {
                document.images[i].onmouseover = function() { swapSWButtons(this, 'gif'); };
                document.images[i].onmouseout = function() { swapSWButtons(this, 'gif'); };
            }
            if (ext == "png") {
                document.images[i].onmouseover = function() { swapSWButtons(this, 'png'); };
                document.images[i].onmouseout = function() { swapSWButtons(this, 'png'); };
            }
            if (ext == "jpg") {
                document.images[i].onmouseover = function() { swapSWButtons(this, 'jpg'); };
                document.images[i].onmouseout = function() { swapSWButtons(this, 'jpg'); };
            }
        }

        //while we're in here check uploadImages directories and make sure there are no staging urls floating around

        var theSource = document.images[i].src.toLowerCase()

        if (theSource.indexOf('uploadimages') > 0) {
            arrParts = theSource.split("/")
            theSource = theSource.replace(arrParts[0] + "//" + arrParts[2], "")
            document.images[i].src = theSource
        }
    }
}
// function: swap the rollover buttons
function swapSWButtons(img, ext) {
    thisSrc = img.src
    if (thisSrc.indexOf("Over") > 0) {
        thisSrc = thisSrc.replace("Over." + ext, "." + ext)
        img.src = thisSrc
    } else {
        thisSrc = thisSrc.replace("." + ext, "Over." + ext)
        img.src = thisSrc
    }
}
function init() {

    addSWBtnRollovers(); //add swbutton rollovers


}
window.onload = init;
