function returnLinkify( url )
{
	window.opener.location.href=url; 
	window.close();
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.id; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function sendForm()
{
	MM_validateForm('First Name','','R','Primary Email','','RisEmail');
	if(document.MM_returnValue == true)
	{
		document.form1.submit();
	}
	else
	{
		return false;
	}

}

// Close all <div class="close">
function classChange()
{
	for (i=0;i<document.getElementsByTagName("div").length; i++) 
	{
		if (document.getElementsByTagName("div").item(i).className == "close")
		{
			document.getElementsByTagName("div").item(i).style.display = "none";
		}
	}
}

function tmt_regExpValidator(f,re,eMsg,ru,r){
	var myErr="";var fv=MM_findObj(f).value;var rex=new RegExp(unescape(re));
	var t=eval(ru+rex.test(fv));if(r){if(fv.length<=0||!t){alert(unescape(eMsg));myErr+="eMsg";}}
	else if(fv.length>0&&!t){alert(unescape(eMsg));myErr+="eMsg";}document.MM_returnValue=(myErr=="");
}


/* Collapsable/Expandable Div Display Box */
function showDiv(ID, closeAll)
{
	/*
	Author:
		Another Tool by SBC 2005-12-05
	Usage:
		showDiv(ID)
	Purpose:
		Allows a "hidden" div to be placed in a HTML document and displayed when appropritate with
		the use of JavaScript event handlers: onClick, onMouseover and etc.
	Directions:
		Use the <div> statement below to establish your display box.
		
			<div id="Unique_ID_Name_Goes_Here" style="display:none:">
			
		If you want the display box visible when the page loads, change display:none to display:block.
		You can call this function using any JavaScript event handler method.  Below are some examples.
		
		Hyperlink:
			<a href="#" onclick="showDiv('Unique_ID_Name_Goes_Her'); return false">Display or Close Display Box</a>
			
		Input button:
			<input type="button" onclick="showDisplay('Unique_ID_Name_Goes_Her'); return false" value="Display or Close Display Box">
	*/
	// Should all open divs be closed?
	// If there is no div, don't throw a JavaScript error
	if(!document.getElementById(ID)){ return false; }
	
	// Evaluate the current visibility status of the display box.
	if(document.getElementById(ID).style.display == 'none')
	{
		if(closeAll == true)
		{
			classChange();
		}		
		// The display box is not visible, so we want to display the box
		document.getElementById(ID).style.display='block';
	}
	else
	{
		if(closeAll == true)
		{
			classChange();
		}				
		// The display box is visible, so we want to hide the display box
		document.getElementById(ID).style.display='none';
	}
}

function explode(string)
{
	data = string.split("|");
	return data;
}

function changeCopy(divId, newCopy)
{
	if(!document.getElementById(divId)){ return false; }
	else
	{
		document.getElementById(divId).innerHTML = newCopy;
	}
}
function changeCopy2(divId, newCopy)
{
	if(!document.getElementById(divId)){ return false; }
	else
	{
		document.getElementById(divId).innerHTML = newCopy;
	}
}

function setfieldValue(formName, fieldName, newValue)
{
	setValue = document.forms[formName].elements[fieldName].vlaue = newValue;
	return setValue;
}

function setCurrentSlections(rawValue, formName, fieldName, divIdOne, divIdTwo)
{	
	var data = explode(rawValue);
	setfieldValue(formName, fieldName, data[0]);
	changeCopy(divIdOne, data[0]);
	changeCopy(divIdTwo, '$' + data[1] + '.00');
}


var productOptions = new Array();

//productOptions['WC000'] = "2284005";
//              W = State (Wyoming/Nevada)
//               C = Corporation
//                R = Resident Advisor
//                 B = Buisness Presence
//                  N = Nominee/Director
//              WCRBN
productOptions['WC000'] = "";
productOptions['WC100'] = "1827979,549";
productOptions['WC010'] = "1828217,695";
productOptions['WC001'] = "1828218,695";
productOptions['WC110'] = "1828404,795";
productOptions['WC011'] = "1828406,941";
productOptions['WC101'] = "1828405,795";
productOptions['WC111'] = "1829734,1041";

//productOptions['WN000'] = "2285050";
productOptions['WN000'] = "";
productOptions['WN100'] = "1828437,499";
productOptions['WN010'] = "1828439,645";
productOptions['WN001'] = "1828458,645";
productOptions['WN110'] = "1828440,745";
productOptions['WN011'] = "1828457,891";
productOptions['WN101'] = "1828456,745";
productOptions['WN111'] = "1829733,991";

//productOptions['WL000'] = "2284117";
productOptions['WL000'] = "";
productOptions['WL100'] = "1828410,549";
productOptions['WL010'] = "1828411,695";
productOptions['WL001'] = "1828412,695";
productOptions['WL110'] = "1828413,795";
productOptions['WL011'] = "1828414,941";
productOptions['WL101'] = "1830269,795";
productOptions['WL111'] = "1829732,1041";

//productOptions['NC000'] = "2346413";
productOptions['NC000'] = "";
productOptions['NC100'] = "1829787,705";
productOptions['NC010'] = "1829788,1800";
productOptions['NC001'] = "1829789,1355";
productOptions['NC110'] = "1829790,1900";
productOptions['NC011'] = "1829792,2550";
productOptions['NC101'] = "1829791,1455";
productOptions['NC111'] = "1829793,2650";

//productOptions['NN000'] = "2285024";
productOptions['NN000'] = "";
productOptions['NN100'] = "1828424,525";
productOptions['NN010'] = "1828425,1120";
productOptions['NN001'] = "1828426,1020";
productOptions['NN110'] = "1828427,1220";
productOptions['NN011'] = "1830276,1715";
productOptions['NN101'] = "1828428,1120";
productOptions['NN111'] = "1829738,1815";

//productOptions['NL000'] = "2284091";
productOptions['NL000'] = "";
productOptions['NL100'] = "1828430,705";
productOptions['NL010'] = "1828431,1800";
productOptions['NL001'] = "1828432,1355";
productOptions['NL110'] = "1828433,1900";
productOptions['NL011'] = "1828435,2550";
productOptions['NL101'] = "1828434,1455";
productOptions['NL111'] = "1829740,2650";

function getOptionID(st,ot,ra,bp,nd) {
	var key = new String();
	key = key.concat(st,ot,ra,bp,nd);
	var v = productOptions[key].split(",");
	return v[0];
}

function getOptionValue(st,ot,ra,bp,nd) {
	var key = new String();
	key = key.concat(st,ot,ra,bp,nd);
	var v = productOptions[key].split(",");
	return v[1];
}

function setOptionID(o,st,ot,ra,bp,nd) {
	var optionID = getOptionID(st,ot,ra,bp,nd);
	if (optionID != "") {
		o.value += "&optionID=" + optionID;
		changeCopy('priceDiv', '$' + getOptionValue(st,ot,ra,bp,nd) + '.00');
	}
}

// Preload Over and Down state images
Image1= new Image(10,12);
Image1.src = "http://www.onlinebuttonsecrets.com/images/alexButtonBgDown.gif";
Image2= new Image(10,12);
Image2.src = "http://www.onlinebuttonsecrets.com/images/alexButtonBgOn.gif";

function press(ID)
{
	document.getElementById(ID).style.backgroundImage='url(http://www.onlinebuttonsecrets.com/images/alexButtonBgDown.gif)';
	document.getElementById(ID).style.backgroundPosition='top';
}

function release(ID)
{
	document.getElementById(ID).style.backgroundPosition='bottom';
	document.getElementById(ID).style.backgroundImage='url(http://www.onlinebuttonsecrets.com/images/alexButtonBg.gif)';
}

function over(ID)
{
	document.getElementById(ID).style.backgroundPosition='bottom';
	document.getElementById(ID).style.backgroundImage='url(http://www.onlinebuttonsecrets.com/images/alexButtonBgOn.gif)';
}

function linkify(URL,target, config)
{
	if(target != '')
	{
		// Open in a new window
		window.open(URL, target, config);
	}
	else
	{
		location.href=URL;
	}
}

function myCookie(name, value, expiry, path, domain)
{
	document.cookie= name + "=" + value + "; expires=" + expiry + "; " + " path=" + path + "; domain=" + domain + ";";
}

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 dc.substring(begin + prefix.length, end);
}

function activateForm(formName, checkBox, button)
{
	// formName is the name of the form
	// checkBox is the name of the checkbox to activate button
	// button is the name of the disabled button to be activated
	if(document.forms[formName].elements[checkBox].checked == true)
	{
		document.forms[formName].elements[button].disabled = false;
	}
	else
	{
		document.forms[formName].elements[button].disabled = true;
	}
}

function doSubmit()
{
	// Validate form
	MM_validateForm('name1','','R','email1','','RisEmail');
	
	if(document.MM_returnValue)
	{
		// Data is valid so submit the form
		document.joinform.submit();
	}
	else
	{
		return document.MM_returnValue;
	}
}

/* THIS SCRIPT FROM BRAVENET
   http://www.bravenet.com */
 function openPopUp(url,target,attributes) 
 {
  popup = window.open(url,target,attributes);
  popup.moveTo(10, 10);//tl
       popup.focus();blur();
    }
