﻿// JScript File

/*function Send()
{
       var strOption = document.getElementById('select').selectedIndex;
       var options = document.getElementById('select').options[strOption].text;
       if(options == "select one")
       {
        alert("Please select from below option");
       }
       if(options == "Penson")
       {
        location.href ="https://online.penson.com/%283xuaatrzpreu5pfrtp5h0mei%29/Default.aspx?LoginInProgress=YES";
       }
       if(options == "Stern Agee")
       {
        window.open("https://sal.automatedfinancial.com/secure_login.html");
		//location.href = "http://www.sterneagee.com/account/Pages/brokerage-account-access.aspx";
       }
       
}*/

function Send(){
 
 var stroption = document.getElementById('select').selectedIndex;
 var optval = document.getElementById('select').options[stroption].text;
 
 if(trim(optval)=="Penson or Sterne Agee")
 {
  alert("Please select from below option"); 
 }
    else if(trim(optval)== "Penson"){
   window.open("https://online.penson.com/%283xuaatrzpreu5pfrtp5h0mei%29/Default.aspx?LoginInProgress=YES");
 }else if(optval=="Stern Agee"){
    window.open("https://sal.automatedfinancial.com/secure_login.html");
   //location.href = "http://www.sterneagee.com/account/Pages/brokerage-account-access.aspx";
 }
}

function trim(s)
{
 return rtrim(ltrim(s));
}

function ltrim(s)
{
 var l=0;
 while(l < s.length && s[l] == ' ')
 { l++; }
 return s.substring(l, s.length);
}

function rtrim(s)
{
 var r=s.length -1;
 while(r > 0 && s[r] == ' ')
 { r-=1; }
 return s.substring(0, r+1);
}
