function MWOshowImage(img,w,h) {
    var wobj = window.open(img,'photo','width='+w+',height='+h+',menubar=no,location=no,resizable=no,scrollbars=no,status=no');
    wobj.document.write('<html><head><title>Click to Close - '+img+'</title></head><body style="margin:0; padding:0" onclick="self.close()"><img src="'+img+'" width="'+w+'" height="'+h+'" alt="photo" title="click on photo to close this window" /></body></html>');
	wobj.focus();
}

function MWOshowVideo(vid,w,h) {
    var wobj = window.open(vid,'video','width='+w+',height='+h+',menubar=no,location=no,resizable=no,scrollbars=no,status=no');
    wobj.document.write('<html><head><title>'+vid+'</title></head><body style="margin:0; padding:0"><embed src="'+vid+'" width="'+w+'" height="'+h+'" /></body></html>');
	wobj.focus();
}

function hideSubmit(btn) {
	btn.style.visibility = "hidden";
	document.getElementById('processing').style.visibility = "visible";
}

function signOut() {
	window.location.href = '/account/signout.php?t=1';
}

function checkNumberFieldKeyPress(e) {
	var key1 = (e.keyCode) ? e.keyCode : e.charCode;
	var thekey = (key1) ? key1 : e.which;
	if ((thekey >= 48) && (thekey <= 57))   // 0-9
		return true;
 	switch (thekey) {
		case 0:
		case 8:  // backspace
		case 9:  // tab
		case 37: // left arrow
		case 39: // right arrow
		//case 46: // delete
		    return true;
			break;
	}
	return false;
}

function checkAlnumFieldKeypress(e) {
	if (checkNumberFieldKeyPress(e))
		return true;
	var key1 = (e.keyCode) ? e.keyCode : e.charCode;
	var thekey = (key1) ? key1 : e.which;
	if ((thekey >= 65) && (thekey <= 90))   // A-Z
	    return true;
	if ((thekey >= 97) && (thekey <= 122))  // a-z
	    return true;
	return false;
}

function selectButton(formName,fldName,val) {
	var btn = document.forms[formName].elements[fldName];
	if (btn && (btn.length > 0)) {
	  	for (var i=0; i<btn.length; i++) {
			if (btn[i].value == val)
	            btn[i].checked = true;
			else
			    btn[i].checked = false;
		}
	}
}

function convioEmailChange(fld) {
    document.MWOjoinMLForm.NEXTURL.value = "SPageServer?pagename=quickreg_followup&email=" + fld.value;
}


///////////////// UNITS

// v = value; s = c(elsius) | f(arenheit)
function convertTemp (v,s) {
	var r; 
	if ((s == "C") || (s=="c")) { r = v * 1.8 + 32; }
	else { r = (v-32)/1.8; }
	r = r.toFixed(1);
	if (r == 0) { return(0); }
	else { return(r); }
}

// v = value; s = kph | mph
function convertSpeed (v,s) {
	var r;
	if ((s == "KPH") || (s=="kph")) { r = v * 0.6214; }
	else { r = v * 1.6093; }
	return(r.toFixed(1));
}

// v = value; s = m(eter) | f(ee)t
function convertLength (v,s) {
	var r;
	if ((s == "m") || (s == "M")) { r = v * 3.281; }
	else { r = v * 0.3048; }
	return(Math.round(r));
}


/* 
  ------------------------------------
  PVII Menu CSS Express Drop-Down Menu
  by Project Seven Development
  www.projectseven.com
  ------------------------------------
*/
function MWO_ExpMenu(){ //v1.1.0.2 by PVII-www.projectseven.com
 if(navigator.appVersion.indexOf("MSIE")==-1){return;}
 var i,k,g,lg,r=/\s*mwohvr/,nn='',c,cs='mwohvr',bv='nav';
 for(i=0;i<10;i++){g=document.getElementById(bv+nn);if(g){
 lg=g.getElementsByTagName("LI");if(lg){for(k=0;k<lg.length;k++){
 lg[k].onmouseover=function(){c=this.className;cl=(c)?c+' '+cs:cs;
 this.className=cl;};lg[k].onmouseout=function(){c=this.className;
 this.className=(c)?c.replace(r,''):'';};}}}nn=i+1;}
}
