function FHC_signup() {
  var firstname = $('fn').value;
  var lastname = $('ln').value;
  var myemail = $('Email').value;

  location.href="/captureemail.aspx?email=" + myemail + "&fn=" + firstname + "&ln=" + lastname + "&source=fhcsignup&onok=http://www.worldvitalrecords.com/emailresponse.aspx%3femail=*email%26fn=*fn%26ln=*ln%26item=fhcsignup%26subject=Thanks+for+your+signup+*fn%26onok=http://www.worldvitalrecords.com/FHC_signupsuccess.aspx";
}

function choosemembership() {
  if( document.getElementById('option1').checked ) {
    location.href="/freesoftware.aspx?Productid1=27&variantid1=59&productid=14&variantid=45&nodupes=1&returnurl=/createaccountsubscription.aspx";
  }
  if( document.getElementById('option2').checked ) {
    location.href="/addtocartmultiple.aspx?Productid=14&variantid=31&returnurl=/createaccountsubscription.aspx?checkout=true";
  }
  if( document.getElementById('option3').checked ) {
    location.href="/addtocartmultiple.aspx?Productid=14&variantid=105&returnurl=/createaccountsubscription.aspx?checkout=true";
  }
  
}

function SubmitSearch() {
  var fname = "";
  var lname = "";
  if( document.getElementById('hzfn').value == "First Name" ) {
    fname = "";
  } else {
    fname = document.getElementById('hzfn').value;
  }
  
  if( document.getElementById('hzln').value == "Family Name" ) {
    lname = "";
  } else {
    lname = document.getElementById('hzln').value;
  }
	//location.href="/GlobalSearch.aspx?qt=g&zln="+document.getElementById('hzln').value+"&zfn="+document.getElementById('hzfn').value;
  //alert( fname + " " + lname + " location.href='/GlobalSearch.aspx?qt=g&zln="+lname+"&zfn="+fname );
if (lname!='' || fname!='')
	  location.href="http://www.worldvitalrecords.com/GlobalSearch.aspx?qt=g&zln="+lname+"&zfn="+fname;
}

function SubmitSearch2()
{
  var dd = document.getElementById('ddlSpelling');
	var ddvalue;
	switch( dd.selectedIndex ) {
    case 0:
      ddvalue = "Exact";
      break;
    case 1:
      ddvalue = "s";
      break;
    case 2:
      ddvalue = "d";
      break;
  }
  // Commented by Rajiv 15/03/2007 B293 also remove sub from location.href adding
//  var sub='';
  //if (document.getElementById('cbSearchUS').checked==true)
  //{
    //  sub='&ixsub=u';
  //}
	location.href="http://www.worldvitalrecords.com/GlobalSearch.aspx?qt=g&zln="+document.getElementById('surname_field').value+"&zfn="+document.getElementById('given_field').value+"&zplace="+document.getElementById('state_field').value+"&zdate="+document.getElementById('year_field').value+"&*content="+document.getElementById('keyword_field').value+"&se="+ddvalue;
}

function NewsletterSubmit() {
  location.href="http://www.worldvitalrecords.com/AWeber.aspx?name="+document.getElementById('name').value+"&custom_lastname="+document.getElementById('custom lastname').value+"&from="+document.getElementById('from').value;
}

function clearText(myID) {  
  document.getElementById(myID).value = "";
  document.getElementById(myID).style.color = "#69696A";
}

function SubmitFreeTrial()
{
	location.href="/CreateFreeTrialAccount.aspx?auto=1&fname="+document.getElementById('ftfname').value+"&lname="+document.getElementById('ftlname').value+"&emailadd="+document.getElementById('ftemailadd').value+"&pass1="+document.getElementById('ftpass1').value+"&pass2="+document.getElementById('ftpass2').value+"&pnumber="+document.getElementById('ftpnumber').value+"&newsletter="+document.getElementById('ftnewsletter').value;
}


function CheckKeyForHeaderSearch(event)
{
    if (event.keyCode == 13)
    {
        SubmitSearch();
    }
}

// browser sniff
function Is() {
	agent = navigator.userAgent.toLowerCase();
	this.major = parseInt(navigator.appVersion);
	this.minor = parseFloat(navigator.appVersion);
	this.ns = ((agent.indexOf('mozilla') != -1) && ((agent.indexOf('spoofer') == -1) && (agent.indexOf('compatible') == -1)));
	this.ns4 = (this.ns && (this.major == 4));
	this.ns6 = (this.ns && (this.major >= 5));
	this.ie = (agent.indexOf("msie") != -1);
	this.ie3 = (this.ie && (this.major < 4));
	this.ie4 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.0") == -1));
	this.ie5 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.0") != -1));
	this.ie55 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.5") != -1));
	this.ie6 = (this.ie && (agent.indexOf("msie 6.0")!=-1) );
}

var is = new Is();

// launches pop-up windows //
function NavigateOpen(Location,Width,Height){
	x=Width;
	y=Height;
	xresnow = x;
	yresnow = y;
	if (navigator.appVersion.indexOf("Mac")!=-1 && document.all) {
			xresnow-=0;
			yresnow-=0;
	}
	xl = (screen.availWidth/2)-(xresnow/2);
	tt = (screen.availHeight/2)-(yresnow/2);
  if (document.all) mw=window.open(Location,'mwi','toolbar=no,scrollbars=yes,width='+xresnow+',height='+yresnow+',left='+xl+',top='+tt);
  else {
    if (parseFloat(navigator.appVersion)<4.75)
      mw=window.open(Location,'mwi','left='+xl+',top='+tt+',width='+x+',height='+y+',toolbar=yes,scrollbars=no,status=0,location=0');
    else {
      mw=window.open(Location,'mwi','left='+xl+',top='+tt+',width='+x+',height='+y+',toolbar=yes,scrollbars=no,status=0,location=0');
      setTimeout("mwFix("+xl+","+tt+",x,y)",10);
    }
  }
}

function popToFront () {
	mw.focus ()
}


function marketingPop()
{
	var width = 400;
	var height = 350;
	var top = screen.height/2 - height/2;
	var left = screen.width/2 - width/2;
	
	var winPop = window.open("/marketing/popups/bom/1/", "mPop", "width=" + width + ",height=" + height + ",left=" + left + ",top=" + top);
	this.window.focus();
}


//added by RGO for search box Bug 246 21/02/08
function fnSetValue(strId, strValue)
{
	objText = document.getElementById(strId);
	if (strValue != "")
	{
		objText.value = strValue;
	}
}

function fnGetQueryString(strName)
{
	strUrl = location.href;
	arrQueryValue = {};
	strQuery = strUrl.substring(strUrl.indexOf("?")+1,strUrl.length);
	arrParts = strQuery.split("&");

	for (i=0;i<arrParts.length;i++)
	{
		arrValueParts = arrParts[i].split("=");
		arrQueryValue[arrValueParts[0]] = arrValueParts[1];
	}
	return (arrQueryValue[strName]) ? arrQueryValue[strName] : "";
}

function clearTextv2(myID,strDefault) {  
	if (document.getElementById(myID).value == strDefault)
	{
	  document.getElementById(myID).value = "";
	  document.getElementById(myID).style.color = "#69696A";
	}
}
// bug 246 additions ends
