﻿// JScript File
var startedRadioRoho = false
var startedRadioOther = false
function openModal()
{
$("#basic-modal-content").modal({appendTo:'form', persist:true})
return false;
}
function ToggleRadio(x)
{
if (document.getElementById('hiddenRadio').value == "off")
{
document.getElementById(x).src = "graphics/design/testimonialsubmit/radio_on.gif"
document.getElementById('hiddenRadio').value = "on"
}
else
{
document.getElementById(x).src = "graphics/design/testimonialsubmit/radio_off.gif"
document.getElementById('hiddenRadio').value = "off"
}
}

function ToggleRadioSponRoho(x)
{
startedRadioRoho = true
if (document.getElementById('SponRohoHidden').value == "0")
{
document.getElementById("SponRohoYes").src = "graphics/design/testimonialsubmit/radio_on.gif"
document.getElementById("SponRohoNo").src = "graphics/design/testimonialsubmit/radio_off.gif"
document.getElementById('SponRohoHidden').value = "1"
}
else
{

if (x == "SponRohoYes")
{
document.getElementById("SponRohoYes").src = "graphics/design/testimonialsubmit/radio_on.gif"
document.getElementById("SponRohoNo").src = "graphics/design/testimonialsubmit/radio_off.gif"
document.getElementById('SponRohoHidden').value = "1"
}
else
{
document.getElementById("SponRohoYes").src = "graphics/design/testimonialsubmit/radio_off.gif"
document.getElementById("SponRohoNo").src = "graphics/design/testimonialsubmit/radio_on.gif"
document.getElementById('SponRohoHidden').value = "0"
}
}

}




function ToggleRadioSponOther(x)
{
startedRadioOther = true
if (document.getElementById('SponOtherHidden').value == "0")
{
document.getElementById("SponOtherYes").src = "graphics/design/testimonialsubmit/radio_on.gif"
document.getElementById("SponOtherNo").src = "graphics/design/testimonialsubmit/radio_off.gif"
document.getElementById('SponOtherHidden').value = "1"
document.getElementById('CompaniesOverlay').style.display = "none"
}
else
{

if (x == "SponOtherYes")
{
document.getElementById("SponOtherYes").src = "graphics/design/testimonialsubmit/radio_on.gif"
document.getElementById("SponOtherNo").src = "graphics/design/testimonialsubmit/radio_off.gif"
document.getElementById('SponOtherHidden').value = "1"
document.getElementById('CompaniesOverlay').style.display = "none"
}
else
{
document.getElementById("SponOtherYes").src = "graphics/design/testimonialsubmit/radio_off.gif"
document.getElementById("SponOtherNo").src = "graphics/design/testimonialsubmit/radio_on.gif"
document.getElementById('SponOtherHidden').value = "0"
document.getElementById('CompaniesOverlay').style.display = "block"
document.getElementById('whotxt').value = "";
}


}
}

function CheckAgree()
{
if (document.getElementById('hiddenRadio').value == "off")
{
document.getElementById('termsLbl').style.display = "block"
return false;
}
}
function getNameFromPath(strFilepath) { 
var objRE = new RegExp(/([^\/\\]+)$/); 
  var strName = objRE.exec(strFilepath); 
 if (strName == null) { 
    return null; 
} 
 
else {     
return strName[0]; 
}
} 
        function updatefile()
        {
        path = document.getElementById('FileUpload1').value        
        path = getNameFromPath(path)
  
        if((!/(\.gif|\.jpg|\.jpeg|\.jpe)$/i.test(path)))
            {
            document.getElementById('filestr').innerHTML = "You can only upload .jpg or .gif files."
            document.getElementById('uploaddiv').innerHTML = document.getElementById('uploaddiv').innerHTML;
            } 
            else
            {
        document.getElementById('filestr').innerHTML = path + "&nbsp;<a href='#' onclick='ClearUpload(); return false'>(x)</a>"    
            }      
        }
        function ClearUpload()
        {
        document.getElementById('uploaddiv').innerHTML = document.getElementById('uploaddiv').innerHTML;
        document.getElementById('filestr').innerHTML = ""
        }
        function changeit(x)
        {
        document.getElementById('productstxt').value = x
      
        document.getElementById('items').style.display = "none"
        }
        function OpenProducts()
        {
        if (document.getElementById('items').style.display == "block")
        {
        document.getElementById('items').style.display = "none"
        }
        else
        {
        document.getElementById('items').style.display = "block"
        }
        
        }
function validateTestForm()
{
var msg = ""
var name = document.getElementById('nametxt').value
var address = document.getElementById('address1txt').value
var city = document.getElementById('citytxt').value
var state = document.getElementById('statetxt').value
var zip = document.getElementById('ziptxt').value
var country = document.getElementById('countrytxt').value
var image = document.getElementById('FileUpload1').value
var email = document.getElementById('emailaddrtxt').value
var product = document.getElementById('productstxt').value
var story = document.getElementById('storytxt').value

 if(name =="")
    {
    msg += "You must enter your name.\n"
    }
     if(address =="")
    {
    msg += "You must enter your address.\n"
    }
     if(city =="")
    {
    msg += "You must enter your city.\n"
    }
     if(state =="")
    {
    msg += "You must enter your state.\n"
    }
     if(zip =="")
    {
    msg += "You must enter your zip code.\n"
    }
     if(country =="")
    {
    msg += "You must enter your country.\n"
    }
     if(email =="")
    {
    msg += "You must enter your email address.\n"
    }
     if(product =="")
    {
    msg += "You must enter a product.\n"
    }
    if(image =="")
    {
    msg += "You must provide an image.\n"
    }
     if(story =="")
    {
    msg += "You must enter your story.\n"
    }


 if (msg =="")
    {   
     return openModal()
    }
    else
    {
    msg = "The following fields are required:\n\n" + msg
    alert(msg)
    return false;
    }
    }
    
    function validateEliteForm()
{
var msg = ""
var name = document.getElementById('nametxt').value
var address = document.getElementById('address1txt').value
var city = document.getElementById('citytxt').value
var state = document.getElementById('statetxt').value
var zip = document.getElementById('ziptxt').value
var phone = document.getElementById('phonetxt').value
var email = document.getElementById('emailaddrtxt').value
var dob = document.getElementById('dobtxt').value
var otherradio = document.getElementById('SponOtherHidden').value
var otherdetail = document.getElementById('whotxt').value
var rohotime = document.getElementById('howlongtxt').value
var rohoprod = document.getElementById('whatproductstxt').value
//alert(otherradio)
var image = document.getElementById('FileUpload1').value
var story = document.getElementById('storytxt').value

 if(name =="")
    {
    msg += "You must enter your name.\n"
    }
     if(address =="")
    {
    msg += "You must enter your address.\n"
    }
     if(city =="")
    {
    msg += "You must enter your city.\n"
    }
     if(state =="")
    {
    msg += "You must enter your state.\n"
    }
     if(zip =="")
    {
    msg += "You must enter your zip code.\n"
    }
     if(phone =="")
    {
    msg += "You must enter your phone number.\n"
    }
     if(email =="")
    {
    msg += "You must enter your email address.\n"
    }
     if(dob =="")
    {
    msg += "You must enter your birth date.\n"
    };
    if (startedRadioRoho==false)
    {
    msg += "Have you ever been sponsored by ROHO?.\n"
    }
    if (startedRadioOther==false)
    {
    msg += "Have you ever been sponsored by any other companies?.\n"
    }
    if ((otherradio == "1") && (otherdetail == ""))
    {
    msg += "Enter the companies that have sponsored you.\n"
    }
     if(rohotime =="")
    {
    msg += "How long have you been using a ROHO product.\n"
    }
     if(rohoprod =="")
    {
    msg += "What ROHO product(s) do you currently use.\n"
    }
    if(image =="")
    {
    msg += "You must provide an image.\n"
    }
     if(story =="")
    {
    msg += "You must enter your comments.\n"
    }


 if (msg =="")
    {   
     return openModal()
    }
    else
    {
    msg = "The following fields are required:\n\n" + msg
    alert(msg)
    return false;
    }
    }

      function validateEnewsForm()
      {
      var msg = ""
var name = document.getElementById('nametxt').value
var email = document.getElementById('emailaddrtxt').value
var whoareyou = document.getElementById('productstxt').value

 if(name =="")
    {
    msg += "You must enter your name.\n"
    }
     if(email =="")
    {
    msg += "You must enter your email.\n"
    }
     if(whoareyou =="")
    {
    msg += "You must enter who you are.\n"
    }
     if (msg =="")
    {   
     return true;
    }
    else
    {
    msg = "The following fields are required:\n\n" + msg
    alert(msg)
    return false;
    }

      }
