
function OpenReceiptPrintViewPage (pageUrl, pageTitle)
{
    window.open(pageUrl,pageTitle, 'menubar=0,toolbar=0,location=1,resizable=1,scrollbars=1,width=800,height=600');     
}

function OpenHelpPage (pageUrl, pageTitle)
{
    mywindow = window.open(pageUrl,pageTitle, 'menubar=1,toolbar=1,location=1,resizable=1,scrollbars=1,width=630,height=700');     
}

function OpenStandardPopupPage (pageUrl, pageTitle)
{
    window.open(pageUrl,pageTitle, 'menubar=1,toolbar=1,location=1,resizable=1,scrollbars=1,width=1000,height=800');     
}

function textboxMultilineMaxNumber(txt,maxLen)
{   
    try{   
        if(txt.value.length > (maxLen-1))
            return false;   
        }catch(e){   
    }   
}   

function QReqSetVal() {
    var cmb1val = document.getElementById("Select1");
    var cmb2val = document.getElementById("Select2");
    cmb2val.options.length = 0;

    if (cmb1val.value == 1) {
        var optn = document.createElement("OPTION");
        optn.text = "Real Estate Agent";
        optn.value = "5";
        cmb2val.options.add(optn);            
    }
    else if (cmb1val.value == 2) {
        var optn3 = document.createElement("OPTION");
        optn3.text = "- Select -";
        optn3.value = "0";
        cmb2val.options.add(optn3);            
        var optn = document.createElement("OPTION");
        optn.text = "Real Estate Agent";
        optn.value = "5";
        cmb2val.options.add(optn);
        var optn2 = document.createElement("OPTION");
        optn2.text = "Investor";
        optn2.value = "7";
        cmb2val.options.add(optn2);
    }
    else if (cmb1val.value == 3) {
        var optn = document.createElement("OPTION");
        optn.text = "Loan Officer";
        optn.value = "6";
        cmb2val.options.add(optn);            
    }
    else if (cmb1val.value == 4) {
        var optn = document.createElement("OPTION");
        optn.text = "Real Estate Agent";
        optn.value = "5";
        cmb2val.options.add(optn);    
    }
}
    
function QReqGo(){
    var cmb1val = document.getElementById("Select1");
    var cmb2val = document.getElementById("Select2");
    
    if (cmb1val.value == 1) {
        location.href='http://www.myrealestatehomesolutions.com/myrehs/b_BuyHomeQuick.aspx';            
    }    
    else if (cmb1val.value == 2) {
        if (cmb2val.value == 5)
        {
            location.href='http://www.myrealestatehomesolutions.com/myrehs/s_SellHomeQuick.aspx';            
        }
        else if (cmb2val.value == 7)
        {
            location.href='http://www.myrealestatehomesolutions.com/myrehs/s_SellHomeQuick.aspx?inv=y';            
        }
        else
        {
            alert('Please select a value');
        }
    }    
    else if (cmb1val.value == 3) {
        location.href='http://www.myrealestatehomesolutions.com/myrehs/f_RFinancingQuick.aspx';            
    }    
    else if (cmb1val.value == 4) {
        location.href='http://www.myrealestatehomesolutions.com/myrehs/r_RentToOwnQuick.aspx';            
    }    
    else
    {
        alert('Please select a value');
    }
}

function IntroMenuGo(b1,b2,b3,b4,b5,b6,t1)
{   
    if (isNaN(parseInt(t1)) || (t1.length != 5)) 
    {
        alert('Please input a valid zipcode.');
    }
    else
    {
        if (b1 == true) {
            OpenStandardPopupPage('http://www.myrealestatehomesolutions.com/myrehs/home-owners-insurance.aspx' + "?zipcode=" + t1,'null');
        }        
        else if (b2 == true) {
            OpenStandardPopupPage('http://www.myrealestatehomesolutions.com/myrehs/renters-insurance.aspx' + "?zipcode=" + t1,'null');            
        }        
        else if (b3 == true)  {
            OpenStandardPopupPage('http://www.myrealestatehomesolutions.com/myrehs/auto-insurance.aspx' + "?zipcode=" + t1,'null');            
        }        
        else if (b4 == true) {
            OpenStandardPopupPage('http://www.myrealestatehomesolutions.com/myrehs/motorcycle-insurance.aspx' + "?zipcode=" + t1,'null');            
        }        
        else if (b5 == true) {
            OpenStandardPopupPage('http://www.myrealestatehomesolutions.com/myrehs/health-insurance.aspx' + "?zipcode=" + t1,'null');            
        }        
        else if (b6 == true) {
            OpenStandardPopupPage('http://www.myrealestatehomesolutions.com/myrehs/life-insurance.aspx' + "?zipcode=" + t1,'null');            
        }        
        else {
            alert('Please select a type of insurance.');
        }
    }
}

function ChangePic(i,j)
{
var e;

 if(i == 1)
 {
     e = document.getElementById("imgBuy");
     if(j == 1)
      e.src="myrehs/images/menuBuy.jpg";
     else if(j == 2)
       e.src="myrehs/images/menuBuyh.jpg";
 }
 else if (i == 2)
 {
    e = document.getElementById("imgSell");
     if(j == 1)
       e.src="myrehs/images/menuSell.jpg";
     else if(j == 2)
       e.src="myrehs/images/menuSellh.jpg";
 }
 else if (i == 3)
 {
    e = document.getElementById("imgFinancing");
     if(j == 1)
       e.src="myrehs/images/menuFinancing.jpg";
     else if(j == 2)
       e.src="myrehs/images/menuFinancingh.jpg";
 }
 else if (i == 4)
 {
     e = document.getElementById("imgRentToOwn");
     if(j == 1)
       e.src="myrehs/images/menuRentToOwn.jpg";
     else if(j == 2)
       e.src="myrehs/images/menuRentToOwnh.jpg";
 }
 else if (i == 5)
 {
     e = document.getElementById("imgSpecialNeeds");
     if(j == 1)
       e.src="myrehs/images/menuSNeeds.jpg";
     else if(j == 2)
       e.src="myrehs/images/menuSNeedsh.jpg";
 }
 
 else if (i == 6)
 {
     e = document.getElementById("imgAdvertise");
     if(j == 1)
       e.src="myrehs/images/menuAdvertise.jpg";
     else if(j == 2)
       e.src="myrehs/images/menuAdvertiseh.jpg";
 }   
else if (i == 7)
 {
     e = document.getElementById("imgRent");
     if(j == 1)
       e.src="myrehs/images/menuRent.jpg";
     else if(j == 2)
       e.src="myrehs/images/menuRenth.jpg";

}
}

function InsGo(t1)
{   
    if (isNaN(parseInt(t1)) || (t1.length != 5)) 
    {
        alert('Please input a valid zipcode.');
    }
    else
    {
        location.href='http://www.myrealestatehomesolutions.com/myrehs/home-owners-insurance.aspx?zipcode=' + t1;
    }
}

function URLEncode (clearString) {       
  var output = '';   
  var x = 0;   
  clearString = clearString.toString();   
  var regex = /(^[a-zA-Z0-9_.]*)/;   
  while (x < clearString.length) {   
    var match = regex.exec(clearString.substr(x));   
    if (match != null && match.length > 1 && match[1] != '') {   
        output += match[1];   
      x += match[1].length;   
    } else {   
      if (clearString[x] == ' ')   
        output += '+';   
      else {   
        var charCode = clearString.charCodeAt(x);   
        var hexVal = charCode.toString(16);   
        output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();   
      }   
      x++;   
    }   
  }   
  return output;   
}   

function SearchSite(a1,b1,sval)   
{   
if (a1==true)
{
    document.location.href='http://www.myrealestatehomesolutions.com/searchresults.aspx?cx=015391131012695642435%3Aliw1t4jtofy&cof=FORID%3A9&ie=UTF-8&q=' + URLEncode(sval)  + '&sa=Search';   
}
else if (b1==true)
{
    document.location.href='http://www.myrealestatehomesolutions.com/searchresults.aspx?cx=015391131012695642435%3Aeuloq0kuwpc&cof=FORID%3A9&ie=UTF-8&q=' + URLEncode(sval)  + '&sa=Search';   
}
}  

