/*[ Select 3 Config ]
        ===========================================================*/

    var info = document.getElementById("info1");
    var info = document.getElementById("info");
    var btn = document.getElementById("btn");
    var choose = document.getElementById("choose");
    var language = document.getElementById("language");
    var studio = document.getElementById("studio");
    var studio1 = document.getElementById("studio1");
    var namee = document.getElementById("namee");
    var lname = document.getElementById("lname");
    var phone = document.getElementById("phone");
    var time = document.getElementById("time");
    var loc = document.getElementById("loc");
    var card = document.getElementById("card");
    var locationss = document.getElementById("locationss");
    var locationss = document.getElementById("locationss");
    var spetime = document.getElementById("spetime");
    var btnMale = document.getElementById("btnMale");
    var btnFemale = document.getElementById("btnFemale");
    var label1 = document.getElementById("label1");
    var label = document.getElementsByClassName("label");
    var niceselect = document.getElementsByClassName("nice-select");
    var south = document.getElementById("south");
    var north = document.getElementById("north");
    var time1 = document.getElementById("time1");
    var time2 = document.getElementById("time2");
    var time3 = document.getElementById("time3");
    var time4 = document.getElementById("time4");
    var namess = document.getElementById("namess");
    var locationss3 = document.getElementById("locationss3");
    var locationss4 = document.getElementById("locationss4");
    var subhead = document.getElementById("subhead");
    var lab1 = document.getElementById("lab1");
    var vicont = document.getElementById("vicont");
    var btn22 = document.getElementById("btn22");

    var player;
    var link = "iU5OLiWe13U";
    var link5 = "6h0Eo4cxrL8";
    var team = document.getElementById("team");
    var slogan = document.getElementById("slogan");
    var register = document.getElementById("register");
    var fn = document.getElementById("fn");
    var ln = document.getElementById("ln");
    var ph = document.getElementById("ph");
    var loc = document.getElementById("loc");
    var lab = document.getElementById("lab");
    var inputgroup1 = document.getElementById("inputgroup1");
    var inputgroup2 = document.getElementById("inputgroup2");
    var inputgroup3 = document.getElementById("inputgroup3");
    var inputgroup4 = document.getElementById("inputgroup4");
    var inputgroup5 = document.getElementById("inputgroup5");
    var inputgroup6 = document.getElementById("inputgroup6");
    var email = document.getElementById("email");
    var email1 = document.getElementById("email1");
    var input4 = studio.options[studio.selectedIndex].text;
    var input5 = studio1.options[studio1.selectedIndex].text;
    var ytplayer=document.getElementById("ytplayer");
    var ytplayer2=document.getElementById("ytplayer2");
    var inn=document.getElementById("inn");
    var innfarsi=document.getElementById("innfarsi");
    var thankss=document.getElementById("thankss");
    var thankss2=document.getElementById("thankss2");
    var btncont = document.getElementById("btncont");

    var locate, timeee;
    var furniture_area = document.getElementById("furniture_area");
    var dropDown_sel = language.options[language.selectedIndex].text;

var tag = document.createElement('script');
          tag.src = "https://www.youtube.com/player_api";
          var firstScriptTag = document.getElementsByTagName('script')[0];
          firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
          var player;
        //inputgroup4.style.justifyContent ="flex-end";
        selectedfarsi();

function show(){
    dropDown_sel = language.options[language.selectedIndex].text;
    if (dropDown_sel == "Choose option")
   {
    alert("Please select a Language");
   }
    else if(dropDown_sel == "English")
   {
    down();   
   }
    else
   {
    downfarsi();
   }
}
//The mailer Functions used to post the form data to mymailer.php

function mymailer(){
    var lang = $('#language').val();
    if(lang == 1){
        var location1= $('#studio').val();
    }else{
        location1= $('#studio1').val();
    };
    var data={
    lang: lang,
    fname: $('#namee').val(),
    lname: $('#lname').val(),
    email: $('#email1').val(),
    phone: $('#phone').val(),
    location:location1,
    };
   //alert(JSON.stringify(data));
    $.ajax({
    type: "POST",
    url: 'mymailer.php',
    data: data,
    success: function(data) {
            //alert(data);
    }
});
}
function down(){
    
    input4 = studio.options[studio.selectedIndex].text;
    if((namee.value != "") && (lname.value != "") && (phone.value != "") && (inn.checked != false) && (input4 !="Location")){
        furniture_area.style.display="block"
        location.href = "#";
        location.href = "#cont";
        card.style.display="none";
        language.style.display="none";
        player = new YT.Player('ytplayer', {videoId: '6h0Eo4cxrL8'});
        
    }
    else if((namee.value == "") || (lname.value == "") || (phone.value == "")  || (input4 == "Location") || (inn.checked == false)) {
         alert("Please Fill the Form Completely")
         
    }
}



var pattern = /^([\w\-\.]+)@((\[([0-9]{1,3}\.){3}[0-9]{1,3}\])|(([\w\-]+\.)+)([a-zA-Z]{2,4}))$/;


function valiemail(strr){
    if(strr.match(pattern)){
            return true;
        }
        else{
            return false;
        }
}


function validateform(){
    
    inputgroup5.style.display="content";
    input5 = studio1.options[studio1.selectedIndex].text;
    if((namee.value != "") && (lname.value != "") && (phone.value != "") && (input5 !="موقعیت") && (innfarsi.checked != false)){
            return true;
    }
    else if((namee.value == "") || (lname.value == "") || (phone.value == "")  || (input5 == "موقیعت") || (inn.checked == false) ) {
        return false;
    }
}






function downfarsi(){
        furniture_area.style.display="block"
        location.href = "#";
        location.href = "#cont";
        card.style.display="none";  
        language.style.display="none";
        ytplayer2.style.display="none";
}
        inputgroup4.style.display ="none";
        //
        
        
        


function changeFunction(val) {
        
       //Show option value
       if(val.value == "2"){
           selectedfarsi();
           info.style.fontFamily = "BHoma";
           btn.style.fontFamily = "BHoma";
            thanksf.style.fontFamily = "BHoma";
            btn22.style.fontFamily = "BHoma";
       }
        else{
            
            selectedeng();
            info.style.fontFamily = "Roboto";
            btn.style.fontFamily = "Roboto";
            thanksf.style.fontFamily = "Roboto";
            btn22.style.fontFamily = "Roboto";
        }
        
    }

function selectedfarsi(){
        info.style.fontFamily = "BHoma";
        btn.style.fontFamily = "BHoma";
        thanksf.style.fontFamily = "BHoma";
        btn22.style.fontFamily = "BHoma";
        //slogan.innerHTML="";
        inputgroup4.style.display ="none";
        
        //inputgroup4.style.justifyContent ="flex-end";
        register.innerHTML="<mark class='f45name'>F45</mark> تشکر از علاقه مندی تان به برنامه";
        
        subhead.style.display="none";
        thankss.style.marginTop="-100px;"
        thankss.innerHTML="ثبت نام  کردید <mark class='f45name'>F45</mark> تشکر از اینکه به برنامه";
        thankss2.innerHTML=".کارت دعوت به ایمیل آدرس شما ارسال گردید";
        btn.innerHTML="اشتراک";
        btncont.style.textAlign="center";
        fn.innerHTML="اسم";
        ln.style.textAlign="left";
        ln.innerHTML="تخلص";
        ph.innerHTML="شماره تلیفون";
        email.innerHTML="ایمیل آدرس";
        lab1.style.marginTop="-20px";
    
        
           
        inputgroup5.style.display="contents";
        lab1.style.display="block";
        lab.style.display="none";
    
        innfarsi.style.display="block";
        inn.style.display="none";
    
        studio1.style.marginTop="9px";
        studio1.style.marginBottom="45px";
           
        namee.style.direction ="RTL";
        lname.style.direction ="RTL";
        email.style.direction ="RTL";
        phone.style.direction ="RTL";
        email1.style.direction ="RTL";
    
        namess.style.direction ="RTL";
    
        register.style.textAlign="center";
        subhead.style.textAlign="center";
        fn.style.textAlign="right";
        thankss.style.textAlign="center";
        thankss2.style.textAlign="center";
        inputgroup3.style.justifyContent ="flex-end";
        inputgroup6.style.justifyContent ="flex-end";
        inputgroup3.style.justifyContent ="flex-end";
        link= 'iU5OLiWe13U';
}

function selectedeng(){
    
     inputgroup5.style.display ="none";
        register.innerHTML="Thank you for your Interest in F45";
        subhead.innerHTML="Please fill the form to watch F45 video presentation";
        thankss.innerHTML="Thank you for your time";
        thankss2.innerHTML="Please watch the video for complete information about F45";
    
        innfarsi.style.display="none";
        inn.style.display="block";
        
        btn.innerHTML="Watch Video";
        btncont.style.textAlign="center";
        fn.innerHTML="First Name";
        ln.style.textAlign="right";
        ln.innerHTML="Last Name";
        ph.innerHTML="Phone Number";
        email.innerHTML="Email Address";   
        lab.style.display="block";
        lab1.style.display="none";
        namee.style.direction ="LTR";
        lname.style.direction ="LTR";
        email.style.direction ="LTR";
        phone.style.direction ="LTR";
        email1.style.direction ="LTR";
    
        namess.style.direction ="LTR";
    
        inputgroup4.style.display ="block";
        inputgroup1.style.justifyContent ="flex-start";
        inputgroup2.style.justifyContent ="flex-start";
        inputgroup3.style.justifyContent ="flex-start";
        inputgroup6.style.justifyContent ="flex-start";
        register.style.textAlign="center";
        subhead.style.textAlign="center";
        thankss.style.textAlign="center";
        thankss2.style.textAlign="center";
        link='6h0Eo4cxrL8';   
}


// 2. get player.playerInfo.currentTime