function doSubmit(myLocation) {
	document.searchForm.action = myLocation;
	document.searchForm.submit();
}

function formatEmail(myField) {
	myField.value = myField.value.toLowerCase();
	var myVal = myField.value;
	if(myVal!='' && !checkEmail(myVal)) {
		alert("Email does not appear to be formatted properly.");
		myField.focus();
		return false;
	}
}

function printpage() {
	window.print();  
}

function popup(arg) {
	if(arg=='Sample Report') {
		window.open("/images/SampleProject2.gif","sample_report","resizable=yes, width=950, height=750");
	} else if(arg=='CC Help') {
		window.open("/images/cvv2.gif","cc_help","resizable=yes, width=235, height=175");
	} else if(arg=='Graph') {
		window.open("/images/graph.gif","graph","resizable=no, width=550, height=450");
	} else if(arg=='Rules') {
		window.open("/content/bulletinBoardRules.jsp","rules","resizable=no, width=650, height=550");
	} else { 
		window.open(arg);
	}
}

function setSelectIndex(sel, val) {
	for (i=0;i<sel.options.length;i++) {
     	if (sel.options[i].value == val) {
      		sel.selectedIndex = i;
       		break;
       	}
    }
}

function setSelectIndexes(sel, val) {
	for (i=0;i<sel.options.length;i++) {
       	if (sel.options[i].value == val) {
       		sel.options[i].selected = true;
       		break;
       	}
    }
}

function getCookie(name) {
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {  begin = dc.indexOf(prefix);  if (begin != 0) return null; } else {  begin += 2;  }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) {  end = dc.length;  }
    return unescape(dc.substring(begin + prefix.length, end));
}

function fixCapitalization(val) {
	return val.toLowerCase().replace(/\b[a-z]/g,function(w){return w.toUpperCase()}); 
}

function openProfile(arg) {
	window.open("/profile/adProfile.jsp?profileID=" + arg,"ad_profile","resizable=no, width=500, height=425");
}

function openProfile2(arg, arg2) {
	window.open("/profile/adProfile.jsp?profileID=" + arg + "&adID=" + arg2,"ad_profile","resizable=no, width=500, height=240");
}

function openMap(arg, arg2, arg3, arg4, arg5) {
	window.open("/mapquest/advantage.jsp?address=" + arg + "&city=" + arg2 + "&stateProvince=" + arg3 + "&postalCode=" + arg4 + "&name=" + arg5,"map_live","resizable=no, width=625, height=675");
}

function openMapDemo() {
	window.open("/mapquest/demo.html","map_demo","resizable=no, width=625, height=675");
}

function openPlanDemo() {
	window.open("/projects/plansDemo.html","plan_demo","resizable=no, width=525, height=365");
}

function openPlans(arg) {
	window.open("/projects/projectPlans.jsp?projectID=" + arg,"project_plans","resizable=yes, width=525, height=450, scrollbars=yes");
}

function openProjImageDemo() {
	window.open("/projects/imageDemo.html","image_demo","resizable=no, width=720, height=600");
}

function openProjImage(arg, arg2) {
	window.open("/projects/projImage.jsp?image=" + arg + "&name=" + arg2,"proj_image","resizable=no, width=720, height=600");
}

function openProjImage2(arg) {
	window.open("/projects/projImage2.jsp?projectID=" + arg,"proj_image2","resizable=no, width=750, height=750");
}

function openProjImage3(arg, arg2, arg3) {
	window.open("/projects/projImage3.jsp?projectID=" + arg + "&ssc=" + arg2 + "&mode=" + arg3,"proj_image3","resizable=no, width=750, height=750");
}

function openReferralDetails() {
	window.open("/projects/referralDetails.jsp","referralDetails","resizable=no, width=500, height=525");
}

function emailToFriend(arg) {
	window.open("/projects/emailToFriend.jsp?projectID=" + arg,"email_to_friend","resizable=yes, width=525, height=550, scrollbars=yes");
}

function citiBankPromo() {
	window.open("/partners/citibank.jsp","citibank_lead","resizable=no, width=650, height=620, scrollbars=no");
}
 
function emailToContact(arg) {
	window.open("/projects/sendContactEmail.jsp?contactID=" + arg,"email_contact","resizable=yes, width=525, height=550, scrollbars=yes");
}
function openMultiAddresses(arg, arg2) {
	window.open("/projects/addressWindow.jsp?entityID=" + arg + "&entityTypeID=" + arg2,"address_page","resizable=yes, width=525, height=550, scrollbars=yes");
}

