// validates that the field value string has one or more characters in it
function isNotEmpty() {
	var str = document.getElementById('headerQuery').value;
	if ((str == null || str.length == 0)) {
	alert("Please enter a keyword or phrase in the text box.");
	document.getElementById('headerQuery').focus();
	return false;
	} else {
	return true;
	}
}

function toggleChecked(oElement) 
  { 
	oForm = oElement.form; 
	oElement = oForm.elements[oElement.id]; 
	if(oElement.length) 
	{ 
	  bChecked = oElement[0].checked; 
	  for(i = 1; i < oElement.length; i++) 
		oElement[i].checked = bChecked; 
	} 
  }
  
var checkflag = "false";

strSelectedIDs 	= '';
intCartSize		= 0;


//submit the form
function submitForm(iValue){

	var frm = document.litOrderDisplayForm;						
	var atleastOneCategorySelected = false;
	
	//if sValue equals 2, then Get Selected Documents 'GO' button is pressed, clear IFS Number
	if (iValue == 2){
		frm.ifsnumber.value = ""
	}
	
	for (var i=0; i<frm.category.length; i++) {
		if (frm.category[i].checked) { atleastOneCategorySelected = true; break; }
	}
	if (frm.ifsnumber.value == ""){				
			if (!atleastOneCategorySelected) {
				alert("Please select at least one category.");
				//set default IFS Number Value
				frm.ifsnumber.value = "IFS-A"
				return;
			}
			if (frm.state.value == ""){
			//set default IFS Number Value
			frm.ifsnumber.value = "IFS-A"
			alert("Please select at least one state.");
			return;
			
		}
	}
	
	//check if there are at least 6 numbers in the IFS Number
	if (frm.ifsnumber.value != ""){
		//initialize variables
		var hasnum = 0;
		var tstring = "";
		intIFSNumber=document.getElementById('ifsnumber').value;
		
		//remove any spaces from the IFS Number				
		intIFSNumber = '' + intIFSNumber;
		splitstring = intIFSNumber.split(" ");
		for(i = 0; i < splitstring.length; i++)
		tstring += splitstring[i];
		intIFSNumber = tstring

	
		//Check that there is a total of 6 numbers in the IFS Number
		for( var counter = 0; counter < intIFSNumber.length; counter ++ ) {
	
			if( !isNaN( intIFSNumber.charAt( counter ) ) ) {
	
				hasnum = hasnum + 1;		    
			}		    
		}
				
		if (hasnum !=6){
			alert('The IFS field must contain 6 numbers')
			return;
		}
	}
	
				
	if (frm.intVarID.value == 10){
	
		// Make sure No Specific and All Products etc are not selected together.
		if (!checkSelectionValidity(frm.product, 'Product'))
			return;
	}
	
	// Save current state selection so that it can be 'defaulted to' next time.
	document.cookie = ('pref-state=' + escape(frm.state.options[frm.state.selectedIndex].value) + '; path=/;expires=Thu, 31-Dec-2099 23:59:59 GMT');
	//alert(getCookie('pref-state'));
	
	frm.initSwitch.value = '0';
	
	saveCategoryAsCSV();
	saveProductAsCSV();			
	setStateName();		
	frm.submit();
}

function saveProductAsCSV() {
	
	var frm = document.litOrderDisplayForm;	
	var strProductValues = "";
	var strProductNames = "";
	
	var boxLength = frm.product.length;
	var count = 0;
	
	
	for (i = 0; i < boxLength; i++) {
		if (frm.product.options[i].selected)
		{				
			if (count == 0) {
				strProductValues = frm.product.options[i].value;
				strProductNames = frm.product.options[i].text;
			}
			else {
				strProductValues = strProductValues + "," + frm.product.options[i].value;
				strProductNames  = strProductNames  + "," + frm.product.options[i].text;
			}
			count++;
		}			
	}			
	frm.product_values.value = strProductValues;
	frm.product_names.value = strProductNames;
}

function saveCategoryAsCSV() {
						
	var frm = document.litOrderDisplayForm;	
	var strCategoryValues = "";
				
	var boxLength = frm.category.length;
	var count = 0;
	
	
	for (i = 0; i < boxLength; i++) {
		if (frm.category[i].checked)
		{				
			if (count == 0) {
				strCategoryValues = frm.category[i].value;						
			}
			else {
				strCategoryValues = strCategoryValues + "," + frm.category[i].value;					
			}
			count++;
		}			
	}			
	frm.category_values.value = strCategoryValues;		
}



function setStateName() {								
	var frm = document.litOrderDisplayForm;	
	var state_name;					
	var state_value = frm.state.value;
	
	if (state_value == 1)
	{ state_name = 'Alaska';  }
	else if (state_value == 2)
	{	state_name = 'Alabama';  }
	else if (state_value == 3)
	{	state_name = 'Arkansas';  }
	else if (state_value == 4)
	{	state_name = 'Arizona';  }
	else if (state_value == 5)
	{	state_name = 'California';  }
	else if (state_value == 6)
	{	state_name = 'Colorado';  }
	else if (state_value == 7)
	{	state_name = 'Connecticut';  }
	else if (state_value == 8)
	{	state_name = 'District of Columbia';  }
	else if (state_value == 9)
	{	state_name = 'Delaware';  }
	else if (state_value == 10)
	{	state_name = 'Florida';  }
	else if (state_value == 11)
	{	state_name = 'Georgia';  }
	else if (state_value == 12)
	{	state_name = 'Hawaii';  }
	else if (state_value == 13)
	{	state_name = 'Iowa';  }
	else if (state_value == 14)
	{	state_name = 'Idaho';  }
	else if (state_value == 15)
	{	state_name = 'Illinois';  }
	else if (state_value == 16)
	{	state_name = 'Indiana';  }
	else if (state_value == 17)
	{	state_name = 'Kansas';  }
	else if (state_value == 18)
	{	state_name = 'Kentucky';  }
	else if (state_value == 19)
	{	state_name = 'Louisiana';  }
	else if (state_value == 20)
	{	state_name = 'Massachusetts';  }
	else if (state_value == 21)
	{	state_name = 'Maryland';  }
	else if (state_value == 22)
	{	state_name = 'Maine';  }
	else if (state_value == 23)
	{	state_name = 'Michigan';  }
	else if (state_value == 24)
	{	state_name = 'Minnesota';  }
	else if (state_value == 25)
	{	state_name = 'Missouri';  }
	else if (state_value == 26)
	{	state_name = 'Mississippi';  }
	else if (state_value == 27)
	{	state_name = 'Montana';  }
	else if (state_value == 28)
	{	state_name = 'North Carolina';  }
	else if (state_value == 29)
	{	state_name = 'North Dakota';  }
	else if (state_value == 30)
	{	state_name = 'Nebraska';  }
	else if (state_value == 31)
	{	state_name = 'New Hampshire';  }
	else if (state_value == 32)
	{	state_name = 'New Jersey';  }
	else if (state_value == 33)
	{	state_name = 'New Mexico';  }
	else if (state_value == 34)
	{	state_name = 'Nevada';  }
	else if (state_value == 35)
	{	state_name = 'New York';  }
	else if (state_value == 36)
	{	state_name = 'Ohio';  }
	else if (state_value == 37)
	{	state_name = 'Oklahoma';  }
	else if (state_value == 38)
	{	state_name = 'Oregon';  }
	else if (state_value == 39)
	{	state_name = 'Pennsylvania';  }
	else if (state_value == 40)
	{	state_name = 'Rhode Island';  }
	else if (state_value == 41)
	{	state_name = 'South Carolina';  }
	else if (state_value == 42)
	{	state_name = 'South Dakota';  }			
	else if (state_value == 43)
	{	state_name = 'Tennessee';  }
	else if (state_value == 44)
	{	state_name = 'Texas';  }
	else if (state_value == 45)
	{	state_name = 'Utah';  }
	else if (state_value == 46)
	{	state_name = 'Virginia';  }
	else if (state_value == 47)
	{	state_name = 'Vermont';  }
	else if (state_value == 48)
	{	state_name = 'Washington';  }
	else if (state_value == 49)
	{	state_name = 'Wisconsin';  }
	else if (state_value == 50)
	{	state_name = 'West Virginia';  }
	else if (state_value == 51)
	{	state_name = 'Wyoming';  }
	else if (state_value == 52)
	{	state_name = 'Guam';  }
	else if (state_value == 53)
	{	state_name = 'Puerto Rico';  }
	else if (state_value == -1)
	{	state_name = 'All States';  }			
	frm.state_name.value = state_name;		
}
	

function checkSelectionValidity (selectBox, name) {
	var ignoreItemsSelected = false;
	var allItemsSelected = false;
	var singleItemSelected = false;
	
	for (var i=0; i<selectBox.options.length; i++) {
		if (selectBox.options [i].value == '' && selectBox.options [i].selected) 
			ignoreItemsSelected = true;
		else if (selectBox.options [i].value == '-1' && selectBox.options [i].selected) 
			allItemsSelected = true;
		else if (selectBox.options [i].selected)
			singleItemSelected = true;
	}
	
	if (ignoreItemsSelected && allItemsSelected || ignoreItemsSelected && singleItemSelected || allItemsSelected && singleItemSelected) {
		alert ('\'No Specific ' + name + '\' or \'All ' + name + 's\' may not be combined with any other options.\n' + 
				'Please select again from the ' + name + ' list.');
		selectBox.focus ();
		return (false);
	}

	return (true);
}



var descHidden = false;
var thumbHidden = false;
var spanCount=document.getElementsByTagName("span");

function fnShowHideDescription() {
if (descHidden == true) {
	for(var i=0;i<spanCount.length;i++){
		if (spanCount[i].className == "docDescription") spanCount[i].style.display="block";
	}
	document.getElementById('showHideText').innerHTML = "Hide Descriptions";
	descHidden = false;	
} else {
	for(var i=0;i<spanCount.length;i++){
		if (spanCount[i].className == "docDescription") spanCount[i].style.display="none";
	}
	document.getElementById('showHideText').innerHTML = "Show Descriptions";
	descHidden = true;	
}
}

function fnShowHideThumbs() {
if (thumbHidden == true) {
	for(var i=0;i<spanCount.length;i++){
		if (spanCount[i].className == "docThumb") spanCount[i].style.display="block";
	}
	document.getElementById('showHideTextThumb').innerHTML = "Hide";
	thumbHidden = false;	
} else {
	for(var i=0;i<spanCount.length;i++){
		if (spanCount[i].className == "docThumb") spanCount[i].style.display="none";
	}
	document.getElementById('showHideTextThumb').innerHTML = "Show";
	thumbHidden = true;	
}
}

function getCookie(NameOfCookie)
{
if (document.cookie.length > 0) 
{ 
begin = document.cookie.indexOf(NameOfCookie+"="); 
if (begin != -1) 
{ 
	begin += NameOfCookie.length+1; 
	end = document.cookie.indexOf(";", begin);
	if (end == -1) end = document.cookie.length;
	return unescape(document.cookie.substring(begin, end)); } 
}
return null; 
}

<!-- J:\View\ALLSTATE\js\amsjavascriptInclude.jsp 03/13/07 -->

<!--
//--Preload Images
function MM_preloadImages() {
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i < a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

//--For Swapping Images
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i < (a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

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_swapImgRestore() {
  var i,x,a=document.MM_sr; for(i=0;a&&i < a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

//--For Market Watch Summary and Graph
function openSummary(passtitle,topurl,passedurl) {
var framewin = window.open("what","summary", "top=10,left=10,scrollbars=yes,menubar=no,width=540,height=500");
with (framewin.document) {
write("<html><head><title>" + passtitle + "</title></head><frameset ROWS='75,*' FRAMEBORDER=NO BORDER='0'>");
write(" <frame src='" + topurl + "' SCROLLING=NO>");
write(" <frame src='" + passedurl + "'>");
write("</frameset></html>");
   }
return false;
}

//--For Legal Disclaimer
function MM_openBrWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}

//--Select (NOT USED RIGHT NOW)
function MM_jumpMenu(targ,selObj,restore){
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

//-- SYC Drop-down v4.0
function OpenNewWindow(winName, features) {  
  
  var URL2 = 
document.form2.select2.options[document.form2.select2.selectedIndex].value; 
  if (URL2 == "none")
  { } 
   if (URL2 == "/qpjump.htm")
{ location = document.form2.select2.options[document.form2.select2.selectedIndex].value;}
  else {
  if (URL2 == "/serviceonline_client_redirect.html") { 
           window.open(URL2,winName,'width=717,height=500,top=75,left=150,menubar,scrollbars,resizable');} 
          else { 
           window.open(URL2,winName); } 
} 
}

//-- External Link Alert
function openURL() {
  var goToLoc = parseQueryString (window.location.search);
  window.open(goToLoc, "newWindow");
  window.close();
}

function parseQueryString (str) {
  str = str ? str : location.search;
  var query = str.charAt(0) == '?' ? str.substring(5) : str;
  return query;
}

function alertWindow(url) {
  widgets = 'width=298,height=198,left=555,top=130,toolbar=no,location=no,directories=no,menubar=no,scrollbars=no';
  popupWin = window.open(url,'alert',widgets);
  popupWin.focus();
}

function popupRegInfo(url, scroll){
	var scrollable;
	scroll? scrollable=",scrollbars": scrollable="";
	newwin = window.open(url, "winpopup1","WIDTH=400,HEIGHT=150" + scrollable);
	newwin.focus();
	
}

function popupRegSearch(url, scroll){ 
	var scrollable;
	scroll? scrollable=",scrollbars": scrollable="";
	newwin = window.open(url, "winpopup2","WIDTH=480,HEIGHT=420" + scrollable);
	newwin.focus();
	
}

function popupMoneyMgr(url, scroll){
	var scrollable;
	scroll? scrollable=",scrollbars": scrollable="";
	newwin = window.open(url, "winpopup3","WIDTH=400,HEIGHT=380" + scrollable);
	newwin.focus();
	
}

function popupEnroll(url, scroll){
	var scrollable;
	scroll? scrollable=",scrollbars": scrollable="";
	newwin = window.open(url, "winpopup4","WIDTH=480,HEIGHT=380" + scrollable);
	newwin.focus();
	
}

//-- Gray Alert Box External Link Disclaimer
function disclaimer()
{
   if (confirm("You are leaving American Skandia's web site and entering a site sponsored by another entity.\n\nThe content in these other sites is not reviewed by American Skandia, and we make no representation and/or warranty as to such site, the accuracy of the content in such site, and/or the parties providing information in such site.\n\nAmerican Skandia does not endorse or recommend any of the services and/or products provided, nor are we responsible for the content accessible through these links.\n\nAmerican Skandia's privacy policy does not apply to these linked sites. Please remember to read the privacy statements of the other Internet sites you visit.\n\nFor SEC standardized performance information for our products, please visit us at www.americanskandia.prudential.com.\n\nIFS-A090045   Ed. 07/2004"))
  {   
       return true;
   }
   else
   {
       return false;
   }
}


//-- Contact Us drop-down function

function go1(){
if (document.selecter1.select1.options[document.selecter1.select1.selectedIndex].value != "none") {
location = document.selecter1.select1.options[document.selecter1.select1.selectedIndex].value
	}
}

//-- Close child window and reload parent
function goParent(url){
	window.opener.location.href = url;
	window.close();
}	

function JumpMenu(selObj,restore){

	var theFullString = selObj.options[selObj.selectedIndex].value;
	if (restore) selObj.selectedIndex=0;
	var theLength = theFullString.length;
	
	//take no action if 1st or 2nd item is selected.
	if (theLength == 1) {
		selObj.selectedIndex = 0;
		return;
	}
	
	var endPos = theFullString.lastIndexOf("$");
	var theUrl, theTarget, theParent;
	if (endPos > 0) {theUrl = theFullString.substring(0,endPos);}
	else {theUrl = theFullString;}
	endPos++
	if (endPos < theLength) {theTarget = theFullString.substring(endPos,theLength)}
	else {theTarget = "window:Main";}
	
	//if (theTarget == "window:New") {newin = window.open(theUrl,'winone', 'width=717,height=500,top=75,left=150,menubar,scrollbars,resizable');
	if (theTarget == "window:New") {
		newin = window.open(theUrl,'winone');
		newin.focus();
	}
	else if (theTarget == "window:FeatureMenu") {
		//newin = window.open(theUrl,'wintwo','menubar,status,scrollbars,resizable');
		newin = window.open(theUrl,'wintwo','width=717,height=500,top=75,left=150,menubar,status,scrollbars,resizable');
		newin.focus();
	}
	else if (theTarget == "window:Main") {
		eval("parent.location='"+theUrl+"'");
	}
	else {eval("parent.frames[\'"+theTarget+"\'].location='"+theUrl+"'");}
}

function JumpMenu1(theFullString){

	var theLength = theFullString.length;
			
	var endPos = theFullString.lastIndexOf("$");
	var theUrl, theTarget, theParent;
	if (endPos > 0) {theUrl = theFullString.substring(0,endPos);}
	else {theUrl = theFullString;}
	endPos++
	if (endPos < theLength) {theTarget = theFullString.substring(endPos,theLength)}
	else {theTarget = "window:Main";}
	
	if (theTarget == "window:New") {
		newin = window.open(theUrl,'winone');
		newin.focus();
	}
	else if (theTarget == "window:FeatureMenu") {	
		newin = window.open(theUrl,'wintwo','width=717,height=500,top=75,left=150,menubar,status,scrollbars,resizable');
		newin.focus();
	}
	else if (theTarget == "window:Main") {
		eval("parent.location='"+theUrl+"'");
	}
	else {eval("parent.frames[\'"+theTarget+"\'].location='"+theUrl+"'");}
}


/*function JumpMenu1(selObj,restore){

	var theFullString = selObj.options[selObj.selectedIndex].value;
	var endPos = theFullString.lastIndexOf("$");

	if (!(endPos > 0)) {
		window.location = theFullString;
	}
	
}*/

//--College Cost Calculator 
	function checkRadio1(){
		window.document.calc.annual[0].checked=true; 
		window.document.calc.annual[1].checked=false;
		window.document.calc.elements[4].value="";
		return false;
	}
	function checkRadio2(){
		window.document.calc.annual[1].checked=true; 
		window.document.calc.annual[0].checked=false;
		window.document.calc.elements[2].value="";
		return false;
	}
	function focusText1(){
		window.document.calc.elements[2].focus();
		window.document.calc.elements[4].value="";
		return false;
	}
	function focusText2(){
		window.document.calc.elements[4].focus();
		window.document.calc.elements[2].value="";
		return false;
	}
	
//--Asset Allocation Questionnaire

//Figure out first subtotal

function Calculate1() {
if ((document.Investor.question1.value == "") || (document.Investor.question2.value == "")){
	alert("Please select a radio button option for each question and click Subtotal under Time Horizon.");
} else{
	var Unknown;

	var answer1;
	var answer2;
	answer1 = parseInt(document.Investor.question1.value);
	answer2 = parseInt(document.Investor.question2.value);
	document.Investor.Sub1.value = (answer1 + answer2);
 
	if (document.Investor.Sub1.value <= 2) {
		document.Investor.comment.value= "Preservation";
	}
	if (document.Investor.Sub1.value >= 3 && document.Investor.Sub1.value <= 4) {
		document.Investor.comment.value= "Conservative";
	}
	if (document.Investor.Sub1.value >= 5 && document.Investor.Sub1.value <= 7) {
		document.Investor.comment.value= "Balanced";
	}
	if (document.Investor.Sub1.value >= 8 && document.Investor.Sub1.value <= 9) {
		document.Investor.comment.value= "Capital Growth";
	}
	if (document.Investor.Sub1.value >= 10) {
		document.Investor.comment.value= "Aggressive";
	}
}
}


//Figure out second subtotal

function Calculate2() {
if ((document.Investor.question3.value == "") || (document.Investor.question4.value == "") || (document.Investor.question5.value == "")){
	alert("Please select a radio button option for each question and click Subtotal under Long Term Goals and Expectations.");
} else{
	var Unknown;

	var answer3;
	var answer4;
	var answer5;

	answer3 = parseInt(document.Investor.question3.value);
	answer4 = parseInt(document.Investor.question4.value);
	answer5 = parseInt(document.Investor.question5.value);

	document.Investor.Sub2.value = (answer3 + answer4 + answer5);

	if (document.Investor.Sub2.value <= 3) {
		document.Investor.comment2.value= "Preservation";
	}
	if (document.Investor.Sub2.value > 3 && document.Investor.Sub1.value <= 5) {
		document.Investor.comment2.value= "Conservative";
	}
	if (document.Investor.Sub2.value >= 7 && document.Investor.Sub1.value <= 9) {
		document.Investor.comment2.value= "Balanced";
	}
	if (document.Investor.Sub2.value >= 11 && document.Investor.Sub1.value <= 13) {
		document.Investor.comment2.value= "Capital Growth";
	}
	if (document.Investor.Sub2.value >= 15) {
		document.Investor.comment2.value= "Aggressive";
	}
}

}

//Figure out third subtotal

function Calculate3() {
if ((document.Investor.question6.value == "") || (document.Investor.question7.value == "")){
	alert("Please select a radio button option for each question and click Subtotal under Short-Term Risk Attitudes.");
} else{
	var Unknown;
	var answer6;
	var answer7;
	answer6 = parseInt(document.Investor.question6.value);
	answer7 = parseInt(document.Investor.question7.value);
	document.Investor.Sub3.value = (answer6 + answer7);

	if (document.Investor.Sub3.value == 2) {
		document.Investor.comment3.value= "Preservation";
	}
	if (document.Investor.Sub3.value  == 4 ) {
		document.Investor.comment3.value= "Conservative";
	}
	if (document.Investor.Sub3.value == 6) {
		document.Investor.comment3.value= "Balanced";
	}
	if (document.Investor.Sub3.value == 8) {
		document.Investor.comment3.value= "Capital Growth";
	}
	if (document.Investor.Sub3.value == 10) {
		document.Investor.comment3.value= "Aggressive";
	}
}
}

//Figure out Grand Total

function Calculate4() {
if ((document.Investor.Sub1.value == "") && (document.Investor.Sub2.value == "") && (document.Investor.Sub3.value == "")){
	alert("All fields must be completed before the Grand Total is calculated.");
} else if (document.Investor.Sub1.value == ""){
	alert("Please select a radio button option for each question and click Subtotal under Time Horizon.");
} else if (document.Investor.Sub2.value == ""){
		alert("Please select a radio button option for each question and click Subtotal under Long Term Goals and Expectations.");
} else if (document.Investor.Sub3.value == ""){
		alert("Please select a radio button option for each question and click Subtotal under Short-Term Risk Attitudes.");
} else{
	var Unknown;
	var Sub1;
	var Sub2;
	var Sub3;
	Sub1 = parseInt(document.Investor.Sub1.value);
	Sub2 = parseInt(document.Investor.Sub2.value);
	Sub3 = parseInt(document.Investor.Sub3.value);
	document.Investor.Sub4.value = (Sub1 + Sub2 + Sub3);

	if (document.Investor.Sub4.value >= 7 && document.Investor.Sub4.value <= 10) {
		document.Investor.comment4.value= "Preservation";
	}
	if (document.Investor.Sub4.value >= 11 && document.Investor.Sub4.value <= 17 ) {
		document.Investor.comment4.value= "Conservative";
	}
	if (document.Investor.Sub4.value >= 18 && document.Investor.Sub4.value <= 24) {
		document.Investor.comment4.value= "Balanced";
	}
	if (document.Investor.Sub4.value >= 25 && document.Investor.Sub4.value <= 31) {
		document.Investor.comment4.value= "Capital Growth";
	}
	if (document.Investor.Sub4.value >= 32 && document.Investor.Sub4.value <= 35) {
		document.Investor.comment4.value= "Aggressive";
	}
}

}


//check IP Locator form
function checkIPLocator()
{
	MM_validateForm('First_Name','','R');
	if (!document.MM_returnValue) {
		alert('*First Name, Last Name, Address, City, State, Zip, \nPhone and Email are required');
		return document.MM_returnValue;
	}
	MM_validateForm('Last_Name','','R');
	if (!document.MM_returnValue) {
		alert('First Name, *Last Name, Address, City, State, Zip, \nPhone and Email are required');
		return document.MM_returnValue;
	}
	MM_validateForm('Phone','','R');
	if (!document.MM_returnValue) {
		alert('First Name, Last Name, Address, City, State, Zip, \n*Phone and Email are required');
		return document.MM_returnValue;
	}
	MM_validateForm('Address_Line1','','R');
	if (!document.MM_returnValue) {
		alert('First Name, Last Name, *Address, City, State, Zip, \nPhone and Email are required');
		return document.MM_returnValue;
	}
	MM_validateForm('City','','R');
	if (!document.MM_returnValue) {
		alert('First Name, Last Name, Address, *City, State, Zip, \nPhone and Email are required');
		return document.MM_returnValue;
	}
	MM_validateForm('State','','R');
	if (!document.MM_returnValue) {
		alert('First Name, Last Name, Address, City, *State, Zip, \nPhone and Email are required');
		return document.MM_returnValue;
	}
	MM_validateForm('Zip','','R');
	if (!document.MM_returnValue) {
		alert('First Name, Last Name, Address, City, State, *Zip, \nPhone and Email are required');
		return document.MM_returnValue;
	}

	MM_validateForm('Email','','R');
	if (!document.MM_returnValue) {
		alert('First Name, Last Name, Address, City, State, Zip, \nPhone and *Email are required');
		return document.MM_returnValue;
	}
	
	document.contact.submit();
	
	return document.MM_returnValue;
}

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.name; 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') {
        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 (val < min || max < val) 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 == '');
}	

String.prototype.trim = function()
		{
    // Use a regular expression to replace leading and trailing 
    // spaces with the empty string
    return this.replace(/(^\s*)|(\s*$)/g, "");
	}

function Query() 
{
	var q = "";
	if(document.frmSearch.QueryText){
		q = document.frmSearch.QueryText.value;
		q = q.trim();
		document.frmSearch.QueryText.value = q;
		}	
	if (q == "") {
			alert ("Please enter one or more search terms.");
			return false;
		}
	else
		{
			if (document.frmSearch.qtype[0].checked)
				document.frmSearch.QueryType.value = 0;
			else if (document.frmSearch.qtype[1].checked)
				document.frmSearch.QueryType.value = 1;
			else if (document.frmSearch.qtype[2].checked)
				document.frmSearch.QueryType.value = 2;
			//document.frmSearch.st.value = document.frmResultParams.strST.value;
		}
	return true;
}
function QueryTop()
{
	var st = "";
	st = document.seek1.searchtext.value;
	st = st.trim();
	document.seek1.searchtext.value = st;
	if (st == ""){
			alert ("Please enter one or more search terms.");
			return false;
		}
		
	return true;
}


function JumpMenu(selObj,restore){
	var theFullString = selObj.options[selObj.selectedIndex].value;
	if (restore) selObj.selectedIndex=0;
	var theLength = theFullString.length;
	
	//take no action if 1st or 2nd item is selected.
	if (theLength == 1) {
		selObj.selectedIndex = 0;
		return;
	}
	
	var endPos = theFullString.lastIndexOf("$");
	var theUrl, theTarget, theParent;
	if (endPos > 0) {theUrl = theFullString.substring(0,endPos);}
	else {theUrl = theFullString;}
	endPos++
	if (endPos < theLength) {theTarget = theFullString.substring(endPos,theLength)}
	else {theTarget = "window:Main";}
	
	//if (theTarget == "window:New") {newin = window.open(theUrl,'winone', 'width=717,height=500,top=75,left=150,menubar,scrollbars,resizable');
	if (theTarget == "window:New") {
		newin = window.open(theUrl,'winone');
		newin.focus();
	}
	else if (theTarget == "window:FeatureMenu") {
		//newin = window.open(theUrl,'wintwo','menubar,status,scrollbars,resizable');
		newin = window.open(theUrl,'wintwo','width=800,height=600,top=50,left=120,menubar,status,scrollbars,resizable');
		newin.focus();
	}
	else if (theTarget == "window:Main") {
		eval("parent.location='"+theUrl+"'");
	}
	else {eval("parent.frames[\'"+theTarget+"\'].location='"+theUrl+"'");}
}



function JumpMenu1(theFullString){

	var theLength = theFullString.length;
			
	var endPos = theFullString.lastIndexOf("$");
	var theUrl, theTarget, theParent;
	if (endPos > 0) {theUrl = theFullString.substring(0,endPos);}
	else {theUrl = theFullString;}
	endPos++
	if (endPos < theLength) {theTarget = theFullString.substring(endPos,theLength)}
	else {theTarget = "window:Main";}
	
	if (theTarget == "window:New") {
		newin = window.open(theUrl,'winone');
		newin.focus();
	}
	else if (theTarget == "window:FeatureMenu") {	
		newin = window.open(theUrl,'wintwo','width=717,height=500,top=75,left=150,menubar,status,scrollbars,resizable');
		newin.focus();
	}
	else if (theTarget == "window:Main") {
		eval("parent.location='"+theUrl+"'");
	}
	else {eval("parent.frames[\'"+theTarget+"\'].location='"+theUrl+"'");}
}

//ALLSTATE onLoad popup

	function popup() {
		var flag = 0;		
		if (flag){	
			var url = "";
   			window.open(url, "", "Height=,Width=,scrollbar=no,addressbar=no,titlebar=no,toolbar=no,menubar=no");
  		}
	}
	
//Book mark 
function CreateBookmarkLink() 
	{ 
		var title = "American Skandia - Allstate Website";  
		var url = window.location;
				
		if (window.sidebar) 
		{ 
			// Mozilla Firefox Bookmark		
			window.sidebar.addPanel(title, url,"");	
		} 
		else if( window.external ) 
		{ 
			// IE Favorite		
			window.external.AddFavorite( url, title); 
		}	 
	}  
	
//SEARCH
function go_search(form){

	function filterSC(str) {
		re = /\$|,|@|#|~|`|\%|\*|\^|\&|\(|\)|\+|\=|\[|\-|\_|\]|\[|\}|\{|\;|\:|\'|\"|\<|\>|\?|\||\\|\!|\$|\./g;
		// remove special characters
		return str.replace(re, "");
	}
	
	var query = filterSC(document.getElementById('headerQuery').value);
	
	var qt = document.getElementById('headerQt').value;
	
	var qtQ = qt + query;

	if ((query == "") || (query == "Search" )) {
	
		alert("Please enter one or more search terms.");
		document.getElementById('headerQuery').focus();
		return false;
		
	} else {
		
		document.getElementById('headerQt').value = qtQ;
		document.headerSearchForm.submit();
		return false;
	}
}
-->
	

