// pop up window
function openWin(theURL,winName,features) {
	newWin = window.open(theURL,winName,features);
	newWin.focus();
}

// validate email address
// if valid return true 
function validEmail(str) {
	// are regex supported?
	var supported = 0;
	if (window.RegExp) {
		var tempStr = "a";
		var tempReg = new RegExp(tempStr);
		if (tempReg.test(tempStr)) supported = 1;
	}
	if (!supported) 
		return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
	var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
	var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
	return (!r1.test(str) && r2.test(str));
}

// for select drop down navigation menus
function jumpMenu(targ,selObj,restore){
	if (selObj.options[selObj.selectedIndex].value != "") {
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); 
	if (restore) selObj.selectedIndex=0; 
	}
}

var rollflag = false;

function imgLoad() {  // called with init()
    if (document.images) {
		// load mag issues
		var issue_date = '20040112';
		cvr_east = new Image(); cvr_east.src = "http://www.claimsjournal.com/img/cover_east_"+issue_date+".jpg";
		cvr_midwest = new Image(); cvr_midwest.src = "http://www.claimsjournal.com/img/cover_midwest_"+issue_date+".jpg";
		cvr_southeast = new Image(); cvr_southeast.src = "http://www.claimsjournal.com/img/cover_southeast_"+issue_date+".jpg";
		cvr_southcentral = new Image(); cvr_southcentral.src = "http://www.claimsjournal.com/img/cover_southcentral_"+issue_date+".jpg";
		cvr_west = new Image(); cvr_west.src = "http://www.claimsjournal.com/img/cover_west_"+issue_date+".jpg";
		
        return (rollflag = true);  // set the flag and let the function know know it can work
    }
}

function imgSwap(imgName,newImage) {
    if (document.images && (rollflag == true)) {
        document[imgName].src = eval(newImage + ".src");
    }
}

function onLoadInit() { // function to call functions that should be called "onload"
	imgLoad();
}
