function openSubWin() {
}

var appVer = navigator.appVersion;
var NS = (navigator.appName == 'Netscape');
var MSIE = (appVer.indexOf('MSIE') != -1);

function frameTest(){

	if(top==self) {

		var parent = "index.asp"
		var currURL = unescape(window.location.pathname);
		var newURL;
		ind = currURL.indexOf("?");
		if (ind > -1) currURL = currURL.substring(0, ind);
		s = window.location.search;
		if (s.substring(0,1) == "?") s = s.substring(1, s.length);
		if (s.toLowerCase().indexOf("linktarget=") == -1)
			newURL = parent + "?linkTarget=" + currURL + "&" + s;
		else
			newURL = parent + "?" + s;
		if (document.images)
			location.replace(newURL);
		else
			location.href = newURL;
	
	}
}

function ehide(name,domain,txt,val){
	var a,b,c,d,e,f,g,z
	if (name == '' || domain == '') {
		return "";
	} else {
		a='<a href=\"mai';
		b=name;
		c='\">';
		a+='lto:';
		b+='@';
		e='';
		f=txt;
		e+='<\/a>';
		g='';
		b+=domain;	
		
		if (val == 1) {
			z = a+b+c+b+e;
		} else if (val == 2) {
			z = a+b+c+f+e;	
		} else {
			z = b;
		}
		return z;
	}
}

function remoteWin(page,pgname,parms) {
    top.pgname = window.open(page,pgname,parms);
    top.pgname.focus();
    if (!top.pgname.opener) {
    	top.pgname.opener = self;
    	return false;
    }
}
// vars for formmail popup
var mailWinName = "emailWin"
var mailWinParms = "scrollbars=1,resizable=1,top=10,left=10,width=580,height=520"
// vars for verification popup
var verWinName = "verWin"
var verWinParms = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,top=10,left=10,width=340,height=230"

function clickCheckbox (frm, lyr, which) {
	if (lyr != null && NS) eval("document." + lyr + ".document." + frm + "." + which + ".checked = (!document." + lyr + ".document." + frm + "." + which + ".checked)");
	else document.forms[frm].elements[which].checked = (!document.forms[frm].elements[which].checked);
}

function clickRadio (frm, lyr, which, ind) {
	if (lyr != null && NS) eval("document." + lyr + ".document." + frm + "." + which + "[" + ind + "].click()");//checked = true");
	else document.forms[frm].elements[which][ind].click()//checked = true;
}

function openBuilder() {
	open("upload/builder.asp", "builder", "directories=no,location=no,menus=no,menubar=no,width=855,height=600");
}

//---------- portfolio.js ----------//
var remWin = null;

function openPortfolio(portID) {
	open("/p_redir.asp?portID=" + portID, "portfolio", "directories=no,location=no,menus=no,menubar=no,resizable,width=700,height=530");
}

function openListEntryPortfolio(entryID, theType) {
	open("portRefresh.asp?entryID=" + entryID + "&type=" + theType, "portfolio", "directories=no,location=no,menus=no,menubar=no,resizable,width=700,height=530");
}

function openPortfolioImage(portID, group, groupID, index) {
	open("/p_redir.asp?portID=" + portID + "&group=" + group + "&groupID=" + groupID + "&index=" + index, "portfolio", "directories=no,location=no,menus=no,menubar=no,resizable,width=700,height=530");
}


//---------- inbox.js ----------//
function fileInboxMessages() {
	str = "document.fileFrm.respondID";
	obj = eval(str);
	IDStr = "";
	link = 'fileResponse.asp?'
	if (obj!=null) {
		for(i=0; i<obj.length; i++) {
			if (obj[i].checked) IDStr += obj[i].value + ",";
		}
	}
	IDStr = IDStr.substr(0, IDStr.length-1);
	link = link + 'respondID=' + IDStr
	str = "document.fileFrm.resumeID";
	obj = eval(str);
	IDStr2 = "";
	if (obj!=null) {
		for (i=0; i<obj.length; i++) {
			if (obj[i].checked) IDStr2 += obj[i].value + ",";
		}
	}
	IDStr2 = IDStr2.substr(0, IDStr2.length-1);
	if (IDStr == '' && IDStr2 == '') return;
	link = link + '&resumeID=' + IDStr2
	groupID = document.fileFrm.groupID.options[document.fileFrm.groupID.selectedIndex].value;
	if (groupID!= '') {
		parent.frames['dummy'].location.replace(link + '&groupID=' + groupID);
	//str = 'fileListEntry.asp?listEntryID=' + IDStr + '&groupID=' + groupID;
	//window.open(link + '&groupID=' + groupID, 'dog');
		//self.location.reload();
	}
}

function deleteInboxMessages() {
	str = "document.fileFrm.respondID";
	obj = eval(str);
	IDStr = "";
	link = 'deleteResponse.asp?'
	if (obj!=null) {
		for(i=0; i<obj.length; i++) {
			if (obj[i].checked) IDStr += obj[i].value + ",";
		}
	}
	IDStr = IDStr.substr(0, IDStr.length-1);
	link = link + 'respondID=' + IDStr
	str = "document.fileFrm.resumeID";
	obj = eval(str);
	IDStr2 = "";
	if (obj!=null) {
		for (i=0; i<obj.length; i++) {
			if (obj[i].checked) IDStr2 += obj[i].value + ",";
		}
	}
	IDStr2 = IDStr2.substr(0, IDStr2.length-1);
	if (IDStr == '' && IDStr2 == '') return;
	link = link + '&resumeID=' + IDStr2
	parent.frames['dummy'].location.replace(link);
	//self.location.reload()
	//window.open(link, 'dog');
}


//---------- saveItems.js ----------//
function saveJob(jobID) {
	if (document.frmNotes) {
		if (document.frmNotes.notes.value != '') {
			document.frmNotes.submit();
			return;
		}
	}
	parent.frames['dummy'].location.replace ("saveJob.asp?jobID=" + jobID);
	str = "document.saveGIF" + jobID ;
	obj = eval(str);
	if (obj!=null) obj.src = "images/saved.gif";
}

function saveProfile(indID) {
	if (document.frmNotes) {
		if (document.frmNotes.notes.value != '') {
			document.frmNotes.submit();
			return;
		}
	}
	parent.frames['dummy'].location.replace ("saveProfile.asp?indID=" + indID);
	str = "document.saveGIF" + indID ;
	obj = eval(str);
	if (obj!=null) obj.src = "images/saved.gif";
}

function saveSearch() {
	document.frmSaveSearch.submit();
	str = "document.saveSearchGIF";
	obj = eval(str);
	if (obj!=null) obj.src = "images/saved_search.gif";
}

function saveMessage(respondID) {
	parent.frames['dummy'].location.replace ("saveMessage.asp?respondID=" + respondID);
	str = "document.saveGIF" + respondID ;
	obj = eval(str);
	if (obj!=null) obj.src = "images/saved.gif";
}

function saveResume(resumeID) {
	parent.frames['dummy'].location.replace ("saveResume.asp?resumeID=" + resumeID);
	str = "document.saveGIF" + resumeID ;
	obj = eval(str);
	if (obj!=null) obj.src = "images/saved.gif";
}

function saveCompany (coID) {
	if (document.frmNotes) {
		if (document.frmNotes.notes.value != '') {
			document.frmNotes.submit();
			return;
		}
	}
	parent.frames['dummy'].location.replace ("saveCompany.asp?coID=" + coID);
	str = "document.saveGIF" + coID;
	obj = eval(str);
	if (obj!=null) obj.src = "images/saved.gif";
}
	
function fileEntry(entryID) {
	str = "document.fileFrm" + entryID;
	obj = eval(str);
	if (obj!=null) obj.submit();
	str = "document.fileGIF" + entryID ;
	obj = eval(str);
	if (obj!=null) obj.src = "images/filed.gif";
}

function deleteItem(entryID) {
	parent.frames['dummy'].location.replace('deleteListEntry.asp?listEntryID=' + entryID)
	str = "document.deleteGIF" + entryID ;
	obj = eval(str);
	if (obj!=null) obj.src = "images/deleted.gif";
}

function deleteSearch(searchID) {
	parent.frames['dummy'].location.replace('deleteSearch.asp?searchID=' + searchID)
	str = "document.deleteGIF" + searchID ;
	obj = eval(str);
	if (obj!=null) obj.src = "images/deleted.gif";
}

function deleteResponse(respondID) {
	parent.frames['dummy'].location.replace('deleteResponse.asp?respondID=' + respondID)
	str = "document.deleteGIF" + respondID ;
	obj = eval(str);
	if (obj!=null) obj.src = "images/deleted.gif";
}

function deleteResume(respondID) {
	parent.frames['dummy'].location.replace('deleteResponse.asp?resumeID=' + respondID)
	str = "document.deleteGIF" + respondID ;
	obj = eval(str);
	if (obj!=null) obj.src = "images/deleted.gif";
}

function fileListEntries() {
	str = "document.fileFrm.listEntryID";
	obj = eval(str);
	IDStr = "";
	if (obj!=null) {
		for(i=0; i<obj.length; i++) {
			if (obj[i].checked) IDStr += obj[i].value + ",";
			gifstr = "document.fileGIF" + obj[i].value;
			gifobj = eval(gifstr);
			if (gifobj!=null) gifobj.src = "images/filed.gif";
		}
		IDStr = IDStr.substr(0, IDStr.length-1);
		if (IDStr == '') return;
		groupID = document.fileFrm.groupID.options[document.fileFrm.groupID.selectedIndex].value;
		parent.frames['dummy'].location.replace('fileListEntry.asp?listEntryID=' + IDStr + '&groupID=' + groupID);
		//str = 'fileListEntry.asp?listEntryID=' + IDStr + '&groupID=' + groupID;
		//window.open(str, 'dog');
	}
}

function deleteListEntries() {
	str = "document.fileFrm.listEntryID";
	obj = eval(str);
	IDStr = "";
	if (obj!=null) {
		for(i=0; i<obj.length; i++) {
			if (obj[i].checked) IDStr += obj[i].value + ",";
			gifstr = "document.fileGIF" + obj[i].value;
			gifobj = eval(gifstr);
			if (gifobj!=null) gifobj.src = "images/filed.gif";
		}
		IDStr = IDStr.substr(0, IDStr.length-1);
		if (IDStr == '') return;
		parent.frames['dummy'].location.replace('deleteListEntry.asp?listEntryID=' + IDStr);
	}
}

function fileMessages() {
	str = "document.fileFrm.listEntryID";
	obj = eval(str);
	IDStr = "";
	if (obj!=null) {
		for(i=0; i<obj.length; i++) {
			if (obj[i].checked) IDStr += obj[i].value + ",";
			gifstr = "document.fileGIF" + obj[i].value;
			gifobj = eval(gifstr);
			if (gifobj!=null) gifobj.src = "images/filed.gif";
		}
		IDStr = IDStr.substr(0, IDStr.length-1);
		if (IDStr == '') return;
		groupID = document.fileFrm.groupID.options[document.fileFrm.groupID.selectedIndex].value;
		parent.frames['dummy'].location.replace('fileListEntry.asp?listEntryID=' + IDStr + '&groupID=' + groupID);
		//str = 'fileListEntry.asp?listEntryID=' + IDStr + '&groupID=' + groupID;
		//window.open(str, 'dog');
	}
}

function deleteMessages() {
	str = "document.fileFrm.listEntryID";
	obj = eval(str);
	IDStr = "";
	if (obj!=null) {
		for(i=0; i<obj.length; i++) {
			if (obj[i].checked) IDStr += obj[i].value + ",";
			gifstr = "document.fileGIF" + obj[i].value;
			gifobj = eval(gifstr);
			if (gifobj!=null) gifobj.src = "images/filed.gif";
		}
		IDStr = IDStr.substr(0, IDStr.length-1);
		if (IDStr == '') return;
		parent.frames['dummy'].location.replace('deleteListEntry.asp?listEntryID=' + IDStr);
	}
}


//---------- sort.js ----------//

var sort = 0;
var zip = '';
var sortval = '';

function setSort() {
	if (document.sortFrm) {
		for (i=0; i<document.sortFrm.sortby.length; i++) {
			if (document.sortFrm.sortby[i].defaultChecked) {
				sort = i;
				sortval = document.sortFrm.sortby[i].value.toLowerCase();
				break
			}
			//if (document.sortFrm.sortby[i].value == "Zip") {
			//	zipIndex = i;
			//}
		}
		if (document.sortFrm.sortZip)
			zip = document.sortFrm.sortZip.value
	}
}

function resort(obj) {
	if (document.sortFrm) {
		if (obj==null) {
			//no longer used.
			for (i=0; i<document.sortFrm.sortby.length; i++) {
				r = document.sortFrm.sortby[i]
				if (r.checked) {
					if (i == sort) {
						if (r.value == "Zip") {
							if (document.sortFrm.sortZip.value == zip) return;
						} else { 
							return; 
						}
					} 
					if (r.value=="Zip") {
						if (document.sortFrm.sortZip.value == "") {
							r.checked = false;
							document.sortFrm.sortby[sort].checked = true;
							alert ("Please enter a zip code.");
							return;
						}
					}
				}
			}
		} else {
			val = obj.value.toLowerCase();
			if (val==sortval) {
				if (val!="zip") return;
				else if (document.sortFrm.sortZip.value == zip) return;
			} 
			if (val=="zip") {
				if (document.sortFrm.sortZip.value == "") {
					obj.checked = false; //document.sortFrm.sortby[zipIndex].checked = false;
					document.sortFrm.sortby[sort].checked = true;
					alert ("Please enter a zip code.");
					return;
				}
			}
			document.sortFrm.sortby[sort].checked = false;
			obj.checked = true;
		}
		document.sortFrm.submit();
	}
}

