﻿// JScript File

var flagMain=0;// for Maintbl
var flagBank =0;// for Banktbl
var flagProjects =0;// for Projecttbl
var flagRefrences =0;// for Refrencestbl
var flagAttach =0;// for Attachtbl

var tac_pbx1,tac_pba1;/*@cc_on @*//*@if(@_jscript_version>=5)try{tac_pbx1=new ActiveXObject('msxml2.xmlhttp')}catch(e){try{tac_pbx1=new ActiveXObject('Microsoft.XMLHTTP')}catch(e){}}@else;tac_pbx1=false;tac_pba1=true;@end;@*/if(!tac_pbx1&&!tac_pba1)
{try{tac_pbx1=new XMLHttpRequest();}catch(e){}}
function tac_post(e,v)
{
  if(tac_pbx1)
  {
   tac_pbx1.open('POST',apath1+'common/process.aspx',false);
   tac_pbx1.send('<root><tac>'+e+'</tac><tac>'+v+'</tac></root>');
   return tac_pbx1.responseText;
  }
}

$(document).ready(function() {

$("#btnlogin").mousedown(function(){Login()})
$("#lnkOpenForgotPassword").mousedown(function(){OpenForgotPwd()})
$("#lnkOpenLogin").mousedown(function(){OpenLogin()})
$("#btnForgotPwd").mousedown(function(){ForgotPwd()})
//$("#imgArrowExpandWeather").mousedown(function(){OPenHeaderWeather()})

//$("#lnkLogin").mousedown(function(){ShowOrHideLoginPopUp()})

$("#divLoginClose").mousedown(function(){CloseLoginPopup()})
$("#divNewsletterClose").mousedown(function(){CloseNewsletterPopup()})

 PopupLoginPosOpenCommon();
 PopupLoginPosOpenForJobs();
 PopupLoginPosOpenForTourismLicensing();
 PopupLoginPosOpenForHotelRevenu();
 PopupLoginPosOpenForInformationStatistcs();
 PopupLoginPosOpenForVendorReg();
 PopupNewsletterOpen(); //--> for Newsletter popup. 
 PopupSendToFriend(); //--> for SendToFriend popup.
 LanguageOptionsExpand();

});
function LanguageOptionsExpand()
{
  //$("#langicons").hide()
  //var PopupLoginLnks=$("#langbar")
  //$(PopupLoginLnks).mousedown(function(){
   // $("#langicons").show()
    //$(PopupLoginLnks).hide()
  //})
}
function PopupLoginPosOpenCommon()
{
  var PopupLoginLnks=$(".popuplogin")
  PopupLoginLnks.each(function(i){
    $(this).mousedown(function(){
    // 1 --  Tourism Licensing ,2 --  Information Statistics,3 --  Vendor Registration ,4 --  Survey ,5 --  Jobs. 6-- Hotel Revenue
    document.getElementById('hidLoginFrom').value="100";
    
   // SetPopupPositionAndBackground($(this).position())
    
    
    var status=tac_post('check_userlogin');
    
    if(status== 0)// Not logged in
    {
      SetPopupPositionAndBackground($(this).position())
    }
    else if(status==2)//Old user
    {
     alert("A new security system has been implemented to enhance security measures and better serve ADTA's users. Please be advised that you are required to change your current password before you proceed.");
     location.href=apath+"user/changepassword.aspx";
    }
    else if (status==1) // logged in 
    {
      location.href=location.href;
    }
    
   
    
    
    })
  });
}
function SetPopupPositionAndBackground(pos)
{
    //var pos=$(this).position()
    
    var popposTop=pos.top;
    var poposLeft=pos.left;
    if(popposTop > 500)
    {
       popposTop=pos.top-153+10
       poposLeft =pos.left
       $("#LoginBg").css("background", "url("+ apath1 +"_resources/en-us/_images/login/newsletter.png)")  
    }
    else
    {
      popposTop=pos.top+10
      poposLeft =pos.left-180
      $("#LoginBg").css("background", "url("+ apath1 +"_resources/en-us/_images/login/login.png)") 
    }
    
    $("#divmainLogin").css({
        position:"absolute",
        left: poposLeft,
        top: popposTop
      })
     $("#divmainLogin").slideToggle("Slow");
}
function CloseLoginPopup()
{
 $("#divmainLogin").hide("Slow");
}

/* Open Sendtofriend */

function PopupSendToFriend()
{
   var PopupSendToFriendLnks=$(".popSendToFriend")
  
    PopupSendToFriendLnks.each(function(i){
    $(this).mousedown(function(){
    var pos=$(this).position()
     $("#dvSend").css({
        position:"absolute",
        left: pos.left+50,
        top: pos.top-160
      })
            
     $("#dvSend").slideToggle("Slow");
    })
  });
}

/* NewsLetter Popup */
function PopupNewsletterOpen()
{
  var PopupNewsletterLnks=$(".popNewsletter")
  
  
  PopupNewsletterLnks.each(function(i){
    $(this).mousedown(function(){
    $("#footer").css("z-index","4");
    var pos=$(this).position()
     $("#divmainNewsletter").css({
        position:"absolute",
        left: pos.left+50,
        top: pos.top-160
      })
      
     $("#divmainNewsletter").slideToggle("Slow");
    })
  });
}

function CloseNewsletterPopup()
{
 $("#divmainNewsletter").hide("Slow");
 $("#footer").css("z-index","2");
}

function PopupLoginPosOpenForJobs()
{
     var lnkpopuploginjobs= $(".popuploginjobs");
     var lnkpopuploginjobs1= $(".popuploginjobs1");
     
     lnkpopuploginjobs.mousedown(function(){
     })
     
     lnkpopuploginjobs1.mousedown(function(){
     
       document.getElementById('hidLoginFrom').value="5";
       var pos=lnkpopuploginjobs.position()
         $("#divmainLogin").css({
            position:"absolute",
            left: pos.left-170,
            top: pos.top+30
          })
         $("#divmainLogin").slideToggle("Slow");
     })
}
function PopupLoginPosOpenForTourismLicensing()
{
  
 var PopupLoginLnks=$(".popuplogintourismlicense")
  PopupLoginLnks.each(function(i){
    $(this).mousedown(function(){
    document.getElementById('hidLoginFrom').value="1";
    document.getElementById('ctl00_login1_hidLoginForm').value="1";
      
    var status=tac_post('check_userlogin');
    if(status== 0)// Not logged in
    {
      SetPopupPositionAndBackground($(this).position())
    }
    else if(status==2)//Old user
    {
     alert("A new security system has been implemented to enhance security measures and better serve ADTA's users. Please be advised that you are required to change your current password before you proceed.");
     location.href=apath+"user/changepassword.aspx";
    }
    else if (status==1) // logged in 
    {
      window.open(apath1+'common/sso.aspx?URL=http://lct.adta.ae')
    }
    
    /*
    var pos=$(this).position()
     $("#divmainLogin").css({
        position:"absolute",
        left: pos.left-180,
        top: pos.top+10
      })
     $("#divmainLogin").slideToggle("Slow");
     */
     
    })
  });
}
function PopupLoginPosOpenForInformationStatistcs()
{
 var PopupLoginLnks=$(".popuplogininformationstatistics")
  PopupLoginLnks.each(function(i){
    $(this).mousedown(function(){
    document.getElementById('hidLoginFrom').value="2";
    document.getElementById('ctl00_login1_hidLoginForm').value="2";
    
    var status=tac_post('check_userlogin');
    if(status== 0)// Not logged in
    {
      SetPopupPositionAndBackground($(this).position())
    }else if(status == 2) // old User
    {
     alert("A new security system has been implemented to enhance security measures and better serve ADTA's users. Please be advised that you are required to change your current password before you proceed.");
     location.href=apath+"user/changepassword.aspx";
    }else if (status==1) // logged in 
    {
      window.open(apath1+'common/sso.aspx?URL=http://lct.adta.ae')      
    }
    
    /*
    var pos=$(this).position()
     $("#divmainLogin").css({
        position:"absolute",
        left: pos.left-180,
        top: pos.top+10
      })
     $("#divmainLogin").slideToggle("Slow");
     */
    })
  });
}

function PopupLoginPosOpenForVendorReg()
{
 var PopupLoginLnks=$(".popuploginvendorreg")
  PopupLoginLnks.each(function(i){
    $(this).mousedown(function(){
    document.getElementById('hidLoginFrom').value="3";
    document.getElementById('ctl00_login1_hidLoginForm').value="3";
    
     var status=tac_post('check_userlogin');
     if(status== 0)// Not logged in
    {
      SetPopupPositionAndBackground($(this).position())
    }else if(status == 2) // old User
    {
     alert("A new security system has been implemented to enhance security measures and better serve ADTA's users. Please be advised that you are required to change your current password before you proceed.");
     location.href=apath+"user/changepassword.aspx";
    }else if (status==1) // logged in 
    {
      location.href=apath+"vendor/default.aspx";
    }   
    
    
    /*
    var pos=$(this).position()
     $("#divmainLogin").css({
        position:"absolute",
        left: pos.left-180,
        top: pos.top+10
      })
     $("#divmainLogin").slideToggle("Slow");
     */
    })
  });
}

function PopupLoginPosOpenForHotelRevenu()
{
 var PopupLoginLnks=$(".popuploginHotelrevenue")
  PopupLoginLnks.each(function(i){
    $(this).mousedown(function(){
    document.getElementById('hidLoginFrom').value="6";
    document.getElementById('ctl00_login1_hidLoginForm').value="6";
    
     var status=tac_post('check_userlogin');
     if(status== 0)// Not logged in
    {
      SetPopupPositionAndBackground($(this).position())
    }else if(status == 2) // old User
    {
     alert("A new security system has been implemented to enhance security measures and better serve ADTA's users. Please be advised that you are required to change your current password before you proceed.");
     location.href=apath+"user/changepassword.aspx";
    }else if (status==1) // logged in 
    {
      window.open(apath1+'common/sso.aspx?URL=http://hrts.adta.ae/default.aspx')      
    }       
    
    
    /*
    var pos=$(this).position()
     $("#divmainLogin").css({
        position:"absolute",
        left: pos.left-180,
        top: pos.top+10
      })
     $("#divmainLogin").slideToggle("Slow");
     */
    })
  });
}
/* Functions from the old ADTA Application */
// 1 --  Tourism Licensing ,2 --  Information Statistics,3 --  Vendor Registration ,4 --  Survey ,5 --  Jobs. 6-- Hotel Revenue

function TestingLoginLicense()
{
  CheckUserLoginStatus("1");
}
function TestingLoginInformation()
{
  CheckUserLoginStatus("2");
}
function TestingLoginVendors()
{
  CheckUserLoginStatus("3");
}
function HotelRevenue()
{
   CheckUserLoginStatus("6");
}

function CheckUserLoginStatus(id)
{
   var status=tac_post('check_userlogin');
   //alert(status);
   if(status=="0") // Not logged in
   {
     
     // 1 --  Tourism Licensing ,2 --  Information Statistics,3 --  Vendor Registration ,4 --  Survey ,5 --  Jobs. 6-- Hotel Revenue
     document.getElementById('hidLoginFrom').value=id;
     document.getElementById('ctl00_login1_hidLoginForm').value=id;
     CommonContentLoginPopupOpen();
     
   }
   else if(status=="2") //Old user
   {
     alert("A new security system has been implemented to enhance security measures and better serve ADTA's users. Please be advised that you are required to change your current password before you proceed.");
     location.href=apath+"user/changepassword.aspx";
   }
   else if(status=="1")// User Logged in already
   {
     switch(id)
        {
            // 1 --  Tourism Licensing ,2 --  Information Statistics,3 --  Vendor Registration ,4 --  Survey ,5 --  Jobs. 6-- Hotel Revenue
            case "1":
                window.open(apath1+'common/sso.aspx?URL=http://lct.adta.ae')
                location.href=location.href;
               break; 
            case "2":
               window.open(apath1+'common/sso.aspx?URL=http://eclass.adta.ae')
               location.href=location.href;
               break;
            case  "3":
                location.href=apath+"vendor/default.aspx";
                break;
            case "4":
                location.href=location.href;
                break;
            case "5":
                location.href=apath+"jobs/search/";
                break; 
            case "6":
                window.open(apath1+'common/sso.aspx?URL=http://hrts.adta.ae/default.aspx')
                location.href=location.href;
                break;                 
            default:
               location.href = location.href;   
               break;          
       }
   }
}

function CommonContentLoginPopupOpen()
{
  var PopupLoginLnks=$(".commonloginpopup");
  var pos=PopupLoginLnks.position()
  
  SetPopupPositionAndBackground(PopupLoginLnks.position())
  /*
  $("#divmainLogin").css({
    position:"absolute",
    left: pos.left-180,
    top: pos.top+10
   })
  $("#divmainLogin").slideToggle("Slow");
  */
  document.getElementById('aLinkContent').scrollIntoView(true);
}

function trim(s)
{
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;
}

function checkMail(mail)
{
   
     var emailReg = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
     var regex = new RegExp(emailReg);
     return(regex.test(mail));
}

function onSubmitLogin(evt)
{
    
   if(document.all)
    {
        if(evt.keyCode == 13) return Login();
        else Page_BlockSubmit = true;
    }
    else
    {
        if(evt.which == 13) return Login();
        else Page_BlockSubmit = true;
    }
}
function onSubmitForGotPwd(evt)
{
   if(document.all)
    {
        if(evt.keyCode == 13) return ForgotPwd();
        else Page_BlockSubmit = true;
    }
    else
    {
        if(evt.which == 13) return ForgotPwd();
        else Page_BlockSubmit = true;
    }
}

function ShowOrHideLogin()
{
  var pos=$("#ctl00_hdr1_lnkLogin").position()
  $("#divmainLogin").css({
     position:"absolute",
     left: pos.left-180,
     top: pos.top+10
  })
  $("#divmainLogin").slideToggle("Slow");
}
//function OPenHeaderWeather()
//{
//  var pos=$("#imgArrowExpandWeather").position()
//  $("#divWeatherHeader").css({
//     position:"absolute",
//     left: pos.left-380,
//     top: pos.top+10
//  })
//  $("#divWeatherHeader").slideToggle("Slow");
//}

function dummylogin()
{
    
}

function SetButtonText(which)
{
    document.getElementById('btnlogin').value = which;
    //document.getElementById('ctl00_login1_btnlogin').value = which;    
}
function SetButtonTextNew(which)
{
    
    //document.getElementById('ctl00_login1_btnlogin').value = which;    
    document.getElementById('ctl00_login1_btnlogin').value = which;    
}

function newLogin(evt)
{
   if(document.getElementById('search').value == 'Search Here')
   {   
   
   document.getElementById('imgspinnerLogin').style.display='block';
   SetButtonTextNew('Submitting..');
   
   var Uname=document.getElementById('ctl00_login1_txtUsername').value;
   var Pwd =document.getElementById('ctl00_login1_txtUserPwd').value;
   if (Uname=='')
   {
    SetButtonTextNew('Submit');
    alert('Please enter User Name');
    document.getElementById('ctl00_login1_txtUsername').focus();
    document.getElementById('imgspinnerLogin').style.display='none';
    return false;
   }
   else if(Pwd=='')
   {
     SetButtonTextNew('Submit');
     alert('Please enter Password');
     document.getElementById('ctl00_login1_txtUserPwd').focus();
     document.getElementById('imgspinnerLogin').style.display='none';
     return false;
   }
   }
}

function Login()
{
    document.getElementById('imgspinnerLogin').style.display='block';
   SetButtonText('Submitting..');
   
   var Uname=document.getElementById('ctl00_login1_txtUsername').value;
   var Pwd =document.getElementById('ctl00_login1_txtUserPwd').value;
   if (Uname=='')
   {
    SetButtonText('Submit');
    alert('Please enter User Name');
    document.getElementById('ctl00_login1_txtUsername').focus();
    document.getElementById('imgspinnerLogin').style.display='none';
   }
   else if(Pwd=='')
   {
     SetButtonText('Submit');
     alert('Please enter Password');
     document.getElementById('ctl00_login1_txtUserPwd').focus();
     document.getElementById('imgspinnerLogin').style.display='none';
   }
   else
   {
   //document.getElementById('imgspinnerLogin').style.display='block';
    var date = new Date();
    var curDate = null;

    do { curDate = new Date(); } 
    while(curDate-date < 1250);
    var status=tac_post('on_login',Uname+';'+Pwd).split('|');
   //document.getElementById('imgspinnerLogin').style.display='none';
   
   //alert(status);
   //alert(status[0]);
   //alert(status[1]);
   
   if(status[0]=="0")
    {
      SetButtonText('Submit');
      alert('The user name or password are not correct');
      document.getElementById('ctl00_login1_txtUsername').focus();
      document.getElementById('imgspinnerLogin').style.display='none';
    }
    else if(status[0]=="2") //Logged in user is the old SSO User.So Give Him access to change his password
    {
     SetButtonText('Submit');
     alert("A new security system has been implemented to enhance security measures and better serve ADTA's users. Please be advised that you are required to change your current password before you proceed.");
     location.href=apath+"user/changepassword.aspx";
    }
    else if(status[0]=="1")
    {
       var loginFrom=document.getElementById('hidLoginFrom').value;
       //alert(loginFrom);
       switch(loginFrom)
        {
            // 1 --  Tourism Licensing ,2 --  Information Statistics,3 --  Vendor Registration ,4 --  Survey ,5 --  Jobs. 6-- Hotel Revenue
            case "1":
                
                window.open(apath1+'common/sso.aspx?URL=http://lct.adta.ae')
                location.href=location.href;
               break; 
            case "2":
               window.open(apath1+'common/sso.aspx?URL=http://213.42.155.69/adtaweb/default.aspx')
               location.href=location.href;
               break;
            case  "3":
                location.href=apath+"vendor/";
                break;
            case "4":
                location.href=location.href;
                break;
            case "5":
                location.href=apath+"jobs/search/";
                break;
            case "6":
                window.open(apath1+'common/sso.aspx?URL=http://hrts.adta.ae/default.aspx')
                location.href=location.href;
                break;                    
            default:
               //alert(URLEncode(location.href));
               //location.href = location.href;   
               //alert(status[1]+"&gotoURL="+URLEncode(location.href));
               location.href=status[1];
               break;          
        }
     }
     else if(status[0]=="3")// We have the redirect url in one session.once the userlogin,we will redirect to the previous link
     {
       location.href = status[1];
     }
   }
}

function newLoginTest(res)
{
    
    var status=res.split('|');
    if(document.getElementById('search').value == 'Search Here')
   {   
     if(status[0]=="0")
    {
      SetButtonTextNew('Submit');      
      alert('The user name or password are not correct');
      //document.getElementById('ctl00_login1_txtUsername').focus();
      document.getElementById('ctl00_login1_txtUsername').focus();
      
      document.getElementById('imgspinnerLogin').style.display='none';
    }
    else if(status[0]=="2") //Logged in user is the old SSO User.So Give Him access to change his password
    {
     
     SetButtonTextNew('Submit');
     alert("A new security system has been implemented to enhance security measures and better serve ADTA's users. Please be advised that you are required to change your current password before you proceed.");
     location.href=apath+"user/changepassword.aspx";
    }
    else if(status[0]=="1")
    {
    
       var loginFrom=document.getElementById('ctl00_login1_hidLoginForm').value;
//      alert(loginFrom);
       switch(loginFrom)
        {
            // 1 --  Tourism Licensing ,2 --  Information Statistics,3 --  Vendor Registration ,4 --  Survey ,5 --  Jobs. 6-- Hotel Revenue
            case "1":
                //window.open(apath1+'common/sso.aspx?URL=http://lct.adta.ae')
                location.href=location.href;
               break; 
            case "2":
               //window.open(apath1+'common/sso.aspx?URL=http://213.42.155.69/adtaweb/default.aspx')
               location.href=location.href;
               break;
            case  "3":
                alert('in3');
                location.href=apath+"vendor/";
                break;
            case "4":
                location.href=location.href;
                break;
            case "5":
                location.href=apath+"jobs/search/";
                break;
            case "6":
                //window.open(apath1+'common/sso.aspx?URL=http://hrts.adta.ae/default.aspx')
                location.href=location.href;
                break;                    
            default:
               location.href = location.href;   
               break;          
        }
     }
     else if(status[0]=="3")// We have the redirect url in one session.once the userlogin,we will redirect to the previous link
     {
       location.href = status[1];
     }else if(status[0]=="4")//
     {
       alert('');
     }
     }
}

function LogOut()
{
  var status=tac_post('on_logout','').split('|');
  location.href = location.href;
}

function OpenForgotPwd()
{
  $("#divlogin").hide();
  $("#divForgotPassword").animate({"opacity":"show"},{"duration":"slow"});
  
  
}
function OpenLogin()
{
  $("#divForgotPassword").hide();
  $("#divlogin").animate({"opacity":"show"},{"duration":"slow"});
}

function ForgotPwd()
{
var forgottxtval=document.getElementById('ctl00_login1_txtForgotPwd').value;
if(document.getElementById('username').checked) // Retrieve Pwd by Username
{
   if(forgottxtval.length <= 0)
   {
     alert("Please enter the username");
     document.getElementById('ctl00_login1_txtForgotPwd').focus();
   }
   else
   {
       document.getElementById('imgspinnerForgotPwd').style.display='block';
       var status=tac_post('on_forgotpwd_by_UserName',forgottxtval);
       document.getElementById('imgspinnerForgotPwd').style.display='none';
       if(status == "1")
       {
         alert("Password sent to your email successfully");
         document.getElementById('ctl00_login1_txtForgotPwd').value='';
       }
       else 
       {
          alert("Please Enter Proper Username");
          document.getElementById('ctl00_login1_txtForgotPwd').focus();
       }
   }
   
}
else if(document.getElementById('Email').checked) // Retrieve Pwd by Email
{
   if(checkMail(forgottxtval))
   {
     document.getElementById('imgspinnerForgotPwd').style.display='block'; 
     var status=tac_post('on_forgotpwd_by_Email',forgottxtval);
     document.getElementById('imgspinnerForgotPwd').style.display='none'; 
     if(status == "1")
     {
        alert("Password sent to your email successfully");
        document.getElementById('ctl00_login1_txtForgotPwd').value='';
     }
     else
     {
       alert("enter proper email");
       document.getElementById('ctl00_login1_txtForgotPwd').focus();
     }
     
   }
   else
   {
    alert('Enter valid Email');
    document.getElementById('ctl00_login1_txtForgotPwd').focus();
   }
   
   
}

  
}

/* New user Registration start */
//For checking user availability in new user registration
function CheckUserAvail1()
{
    
  if(document.getElementById('ctl00_Content_txtUserName').value.length >0)
  {
      document.getElementById('imgspinnerUserNameCheck').style.display='block'; 
      var status = tac_post('on_usernameAvail',document.getElementById('ctl00_Content_txtUserName').value);
      document.getElementById('imgspinnerUserNameCheck').style.display='none'; 
      if(status == "1")
      {
        if(document.getElementById('ctl00_Content_txtUserName').value != '')
        {
            document.getElementById('ctl00_Content_lblAvailUser').innerHTML = "Username already existing";
            return false;
        }
        else
        {
            document.getElementById('ctl00_Content_lblAvailUser').innerHTML = '';
        }
      }
      else
      {
        document.getElementById('ctl00_Content_lblAvailUser').innerHTML = "";
      }
  }
  
}
function CheckEmailAvail()
{
   if(document.getElementById('ctl00_Content_hidEmail').value.length >0 &&  document.getElementById('ctl00_Content_hidEmail').value == document.getElementById('ctl00_Content_txtEmail').value)
   {
      //User in Edit -- he didn't change his Email
      //alert('ha');
   }
   else if(document.getElementById('ctl00_Content_txtEmail').value.length >0)
   {
      document.getElementById('imgspinnerEmailCheck').style.display='block'; 
      var status = tac_post('on_EmailAvail',document.getElementById('ctl00_Content_txtEmail').value);
      document.getElementById('imgspinnerEmailCheck').style.display='none'; 
      if(status == "1")
      {
        if(document.getElementById('ctl00_Content_txtEmail').value != '')
        {
            document.getElementById('ctl00_Content_lblSecondaryEmail').innerHTML = "Email already Exsiting.";
            return false;
        }
        else
        {
            document.getElementById('ctl00_Content_lblSecondaryEmail').innerHTML = '';
        }
      }
      else
      {
        document.getElementById('ctl00_Content_lblSecondaryEmail').innerHTML = "";
      }
      
   }
     
}
function ShowOrHideEngArabicDetails(val)
{

    var type=val
    if(val=="1") //English
    {
     $("#divArabic").hide()
     $("#divEnglish").show()
    }
    if(val=="2") //Arabic
    {
     $("#divEnglish").hide()
     $("#divArabic").show()
    }

}
//function validateNewRegistration()
//{
//    var UserName        = document.getElementById('ctl00_Content_txtUserName').value;
//    var newpwd          = document.getElementById('ctl00_Content_txtpwd').value;
//    var confirmpwd      = document.getElementById('ctl00_Content_txtconfirmpwd').value;
//    var Email           = document.getElementById('ctl00_Content_txtEmail').value;
//    var ArName          = document.getElementById('ctl00_Content_txtArabicfirstName').value;
//    var EnName          = document.getElementById('ctl00_Content_txtEnglishfirstName').value;
//    
//    if(UserName == '')
//    {
//        alert('Please enter user name.');
//        document.getElementById('ctl00_Content_txtUserName').focus();
//        return false;
//    }
//    
//    if(newpwd == '')
//    {
//       alert('Please enter password');
//       document.getElementById('ctl00_Content_txtpwd').focus();
//       return false;
//    }
//    if(confirmpwd == '')
//    {
//       alert('Please enter confirm  password');
//       document.getElementById('ctl00_Content_txtconfirmpwd').focus();
//       return false;
//    }
//    if(newpwd==confirmpwd)
//    {
//    }
//    else
//    {
//      alert('Passwords must be same');
//      return false
//    }
//    if(Email == '')
//    {
//        alert('Please enter your email address.');
//        document.getElementById('ctl00_Content_txtEmail').focus();
//        return false;
//    }
//    else
//    {
//       var emailReg = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
//       var regex = new RegExp(emailReg);
//       if(regex.test(Email))
//       {}
//       else
//       {
//        alert('The email address you have specified, is not valid in this context.');
//        document.getElementById('ctl00_Content_txtEmail').focus();
//        return false;
//       }
//    
//    }
//    
//     if(EnName == '')
//    {
//        alert('Please enter english first name');
//        document.getElementById('English').checked=true;
//        document.getElementById('Arabic1').checked=false;
//         
//        $("#divArabic").hide()
//        $("#divEnglish").show()
//        document.getElementById('ctl00_Content_txtEnglishfirstName').focus();
//       
//       return false;
//    }
//}

function red(PageID)
{
  if(PageID == 2)
  {
   window.parent.location.href = apath+'static/'+ VendorUniquename +'.aspx';                // Vendor Registration form
  }
  else if(PageID == 3)
  {
    window.parent.location.href = apath+'static/' + InforamtionStatisticsUniquename + '.aspx';               // Info & Statistics
  }
  else if(PageID == 4)
  {
    window.parent.location.href = apath+'static/'+InforamtionStatisticsUniquename +'.aspx';               // Licensing
  }
  else if(PageID == 5)
  {
    window.parent.location.href = apath+'jobs/default.aspx?T=14&mode=2';  //Jobs
  }
  else if(PageID == 0)
  {
    window.parent.location.href = apath+'default.aspx';              // Home
  }
  else
  {
   window.parent.location.href =  apath+'default.aspx';               // Home
  }
}

function Message(msg)
{
    alert(msg);
    return false;
}
  
function redirect(ID)
{
 window.setTimeout("red("+ID+")",5000);
}
function redirectUrl(redirecturl)
{
 window.setTimeout("red1('"+redirecturl+"')",5000);
}
function red1(redirurl)
{
   window.parent.location.href=redirurl;
}

/* New User Registration End */

/* Trainig course Payment */
function CalcPurchaseAmount()
{
  var seats=parseInt(document.getElementById('ctl00_Content_txtSeats').value);
  var Cost=parseInt(document.getElementById('ctl00_Content_hidCost').value);
  var MaxSeatsAvail=parseInt(document.getElementById('ctl00_Content_hidAvailableSeats').value);
  
  if(MaxSeatsAvail >= seats)
  {
    var Totalcost= seats * Cost;
    document.getElementById('ctl00_Content_lblPurchaseAmount').innerHTML=Totalcost;
  }
  else
  {
    alert("Maximum no.of seats available are  :" + MaxSeatsAvail);
    
    document.getElementById('ctl00_Content_txtSeats').value = MaxSeatsAvail;
    var Totalcost=MaxSeatsAvail * Cost;
    document.getElementById('ctl00_Content_lblPurchaseAmount').innerHTML=Totalcost;
  }
  
}

//Custom Validator function for SupplierActivity

function validateActivity()
{
    var fStatus;
     var chkListaTipoModificaciones= document.getElementById ('ctl00_Content_chlSupplierActivity');
   
   var chkLista= chkListaTipoModificaciones.getElementsByTagName("input");
   for(var i=0;i<chkLista.length;i++)
    {   
        if(chkLista[i].checked)
        {
            fStatus=true;
            document.getElementById ('ctl00_Content_lblValidate').innerHTML = "";
            break;   
        }else{
        
        fStatus=false;
        document.getElementById ('ctl00_Content_lblValidate').innerHTML = "*";
        
        }
    }
  
  return fStatus;

}

// On Client Tab Selected

function onTabSelectedSpon(sender,args)
{
        var selecttabText = args.get_tab().get_text();
        document.getElementById('ctl00_Content_hfSelTabs').value = selecttabText;
        if(selecttabText == "Attachments" && document.getElementById('ctl00_Content_hfEditMode').value == '0')
        {
            document.getElementById("ctl00_Content_btnSaveAndSubmitForm").style.display="block";
            document.getElementById("ctl00_Content_btnSaveForm").style.display="none";
        }else{
            document.getElementById("ctl00_Content_btnSaveAndSubmitForm").style.display="none";
            if(document.getElementById("ctl00_Content_btnSave") != null)
            {
                document.getElementById("ctl00_Content_btnSave").style.display="block";
            }
        }
        
        if(selecttabText == "Investment Profile")
        {
           if(document.getElementById('ctl00_Content_hfEditMode').value == '0')
            {
                document.getElementById("ctl00_Content_btnSaveForm").style.display="block";
            }else{
                if(document.getElementById("ctl00_Content_btnSave") != null)
                {
                    document.getElementById("ctl00_Content_btnSave").style.display="none";
                    document.getElementById("ctl00_Content_btnSaveAndSubmitForm").style.display="none";
                }
                
            }
            Page_ClientValidate('InvestProfile');
        }else if(selecttabText == "Event Property")
        {
        if(document.getElementById('ctl00_Content_hfEditMode').value == '0')
            {
                document.getElementById("ctl00_Content_btnSaveForm").style.display="block";
            }else{            
                if(document.getElementById("ctl00_Content_btnSave") != null)
                {
                    document.getElementById("ctl00_Content_btnSave").style.display="none";
                    document.getElementById("ctl00_Content_btnSaveAndSubmitForm").style.display="none";
                }
            }
            Page_ClientValidate('Event');
        }else if(selecttabText == "Media Visibility")
        {
        if(document.getElementById('ctl00_Content_hfEditMode').value == '0')
            {
                document.getElementById("ctl00_Content_btnSaveForm").style.display="block";
            }else{
                if(document.getElementById("ctl00_Content_btnSave") != null)
                {
                    document.getElementById("ctl00_Content_btnSave").style.display="none";
                    document.getElementById("ctl00_Content_btnSaveAndSubmitForm").style.display="none";
                }
                
            }
            var flag1=RadioGroupCheck('Broadcast','lblValidate_media_visibility');
            var flag2=RadioGroupCheck('Radio','lblValidate_radio');
            var flag3=RadioGroupCheck('Consumer','lblValidate_Consumer_Pres');
            var flag4=RadioGroupCheck('Business','lblValidate_Business_Pres');
            var flag5=RadioGroupCheck('Internet','lblValidate_Internet');
            
            ChecShowTextBoxeskMediaVisibility_BroadCast();
            ChecShowTextBoxeskMediaVisibility_Radio();
            
        }else if(selecttabText == "Audience")
        {
        if(document.getElementById('ctl00_Content_hfEditMode').value == '0')
            {
                document.getElementById("ctl00_Content_btnSaveForm").style.display="block";
            }else{
                if(document.getElementById("ctl00_Content_btnSave") != null)
                {
                    document.getElementById("ctl00_Content_btnSave").style.display="none";
                    document.getElementById("ctl00_Content_btnSaveAndSubmitForm").style.display="none";
                }
                
            }
            Page_ClientValidate('AudienceVgroup');
            validateTargetedAudience();
        }
        else if(selecttabText == "Marketing and Public Relations")
        {
      if(document.getElementById('ctl00_Content_hfEditMode').value == '0')
            {
                document.getElementById("ctl00_Content_btnSaveForm").style.display="block";
            }else{
                if(document.getElementById("ctl00_Content_btnSave") != null)
                {
                    document.getElementById("ctl00_Content_btnSave").style.display="none";
                    document.getElementById("ctl00_Content_btnSaveAndSubmitForm").style.display="none";
                }
                
            }
           RadioGroupCheck('Plan','lblValidatePublicrelation');
           RadioGroupCheck('Value','lblValidatevalueMarketing');
           RadioGroupCheck('Rights','lblValidatePropertyLisc');
           RadioGroupCheck('MARCHANDISE','lblValidateMARCHANDISE');
           RadioGroupCheck('PhotoGraphy','lblValidatePhotoGraphy');
        }else if(selecttabText == "Branding Visibility")
        {
      if(document.getElementById('ctl00_Content_hfEditMode').value == '0')
            {
                document.getElementById("ctl00_Content_btnSaveForm").style.display="block";
            }else{
                if(document.getElementById("ctl00_Content_btnSave") != null)
                {
                    document.getElementById("ctl00_Content_btnSave").style.display="none";
                    document.getElementById("ctl00_Content_btnSaveAndSubmitForm").style.display="none";
                }
                
            }
           RadioGroupCheck('Brand','lblValidateBrand');
           RadioGroupCheck('Promotion','lblValidatePromotional');
           RadioGroupCheck('Research','lblValidateMarketResearch');
        }
        else if(selecttabText == "Event / Product Sponsorship")
        {
       if(document.getElementById('ctl00_Content_hfEditMode').value == '0')
            {
                document.getElementById("ctl00_Content_btnSaveForm").style.display="block";
            }else{
                if(document.getElementById("ctl00_Content_btnSave") != null)
                {
                    document.getElementById("ctl00_Content_btnSave").style.display="none";
                    document.getElementById("ctl00_Content_btnSaveAndSubmitForm").style.display="none";
                }
                
            }
           RadioGroupCheck('BroadcastGov','lblValidateGovYesNo');
           CheckMarketingResearch();
           validateDateOfEvent();           
           Page_ClientValidate('marketingVgroup');
           
           ChecShowTextBoxeskEventProductSponsorShip_SponsorShipType();
           ChecShowTextBoxeskEventProductSponsorShip_SponsorShipLevel();
           ChecShowTextBoxeskEventProductSponsorShip_GoverningBody();
           
        }else if(selecttabText == "Investment")
        {
        if(document.getElementById('ctl00_Content_hfEditMode').value == '0')
            {
                document.getElementById("ctl00_Content_btnSaveForm").style.display="block";
            }else{
                if(document.getElementById("ctl00_Content_btnSave") != null)
                {
                    document.getElementById("ctl00_Content_btnSave").style.display="none";
                    document.getElementById("ctl00_Content_btnSaveAndSubmitForm").style.display="none";
                }
                
            }
           Page_ClientValidate('Invest'); 
        }
        else if(selecttabText == "Corporate Hospitality")
        {
        if(document.getElementById('ctl00_Content_hfEditMode').value == '0')
            {
                document.getElementById("ctl00_Content_btnSaveAndSubmitForm").style.display="block";
                document.getElementById("ctl00_Content_btnSaveForm").style.display="none";
                if(document.getElementById("ctl00_Content_btnSave") != null)
                {
                    document.getElementById("ctl00_Content_btnSave").style.display="none";
                    
                }
            }else{
                if(document.getElementById("ctl00_Content_btnSave") != null)
                {
                    document.getElementById("ctl00_Content_btnSave").style.display="none";
                    document.getElementById("ctl00_Content_btnSaveForm").style.display="none";
                }
                
            }
            
            RadioGroupCheck('Athlete','lblValidateAthletYesNo');
            
           Page_ClientValidate('CorporateHospitalityVgroup');
        }
        else if(selecttabText == "Community Engagement")
        {
          Page_ClientValidate('CommnityEngagementgroup');
        }
        else if(selecttabText == "Comments ")
        {
           if(document.getElementById('ctl00_Content_hfEditMode').value == '0')
            {
                 document.getElementById("ctl00_Content_btnSaveAndSubmitForm").style.display="block";
                document.getElementById("ctl00_Content_btnSaveForm").style.display="none";
                if(document.getElementById("ctl00_Content_btnSave") != null)
                {
                    document.getElementById("ctl00_Content_btnSave").style.display="none";
                    
                }
            }else{
                 if(document.getElementById("ctl00_Content_btnSave") != null)
                {
                    document.getElementById("ctl00_Content_btnSave").style.display="none";
                    document.getElementById("ctl00_Content_btnSaveForm").style.display="none";
                }
                
            }
        }
        
       if(selecttabText == "Attachments")
       {
            document.getElementById("ctl00_Content_btnSaveAndSubmitForm").style.display="block";
            if(document.getElementById("ctl00_Content_btnSaveForm") != null)
            {             
                document.getElementById("ctl00_Content_btnSaveForm").style.display="none";
            }
       }
       else 
       {
            document.getElementById("ctl00_Content_btnSaveAndSubmitForm").style.display="none";
            if(document.getElementById("ctl00_Content_btnSaveForm") != null)
            {             
                document.getElementById("ctl00_Content_btnSaveForm").style.display="block";
            }
       }
        
      //for edit section of the page.for Attachments
     if(document.getElementById('ctl00_Content_hfEditMode').value != '0')
     {
         if(selecttabText == "Attachments")
         {
            if(document.getElementById("ctl00_Content_btnSave") != null)
                {
                    document.getElementById("ctl00_Content_btnSave").style.display="none";
                }
            if(flagAttach == 0)// generate table only once.
            {
                if(document.getElementById('ctl00_Content_hidSelFileCV').value != '')
                {
                    addAttachEdit(document.getElementById('ctl00_Content_hidSelFileCV').value,'ifrCV','btnDelete','hfFile');
                    flagAttach=1;
                }
                
                 if(document.getElementById('ctl00_Content_hidSelFileCV2').value != '')
                 {
                    addAttachEdit(document.getElementById('ctl00_Content_hidSelFileCV2').value,'ifrCV2','btnDelete2','hfFile');
                    flagAttach=1;
                 }
                 
                 if(document.getElementById('ctl00_Content_hidSelFileCV3').value != '')
                 {
                    addAttachEdit(document.getElementById('ctl00_Content_hidSelFileCV3').value,'ifrCV3','btnDelete3','hfFile');
                    flagAttach=1;
                 }
                 
                 if(document.getElementById('ctl00_Content_hidSelFileCV4').value != '')
                 {
                    addAttachEdit(document.getElementById('ctl00_Content_hidSelFileCV4').value,'ifrCV4','btnDelete4','hfFile');
                    flagAttach=1;
                 }
            }      
         }
     }
}

function onTabSelected(sender, args)
{
     var selecttabText = args.get_tab().get_text();
     
     //for edit section of the page.for Main Branches
     if(document.getElementById('ctl00_Content_hfEditMode').value != '0')
     {
         if(selecttabText == "Main Branch")
         {
            if(flagMain == 0)// generate table only once.
            {
                if(document.getElementById('ctl00_Content_hdneditRow').value != '')
                {
                    addMainEdit(document.getElementById('ctl00_Content_hdneditRow').value);
                    flagMain=1;
                }
            }      
         }
     }
     
     //for edit section of the page.for Banks
     if(document.getElementById('ctl00_Content_hfEditMode').value != '0')
     {
         if(selecttabText == "Bank Information")
         {
            if(flagBank == 0)// generate table only once.
            {
                if(document.getElementById('ctl00_Content_hdneditRowBank').value != '')
                {
                    addBankEdit(document.getElementById('ctl00_Content_hdneditRowBank').value);
                    flagBank=1;
                }
            }      
         }
     }
     
     //for edit section of the page.for PreviousProjects.
     if(document.getElementById('ctl00_Content_hfEditMode').value != '0')
     {
         if(selecttabText == "Previous Projects")
         {
            if(flagProjects == 0)// generate table only once.
            {
                if(document.getElementById('ctl00_Content_hdneditRowBank').value != '')
                {
                    addProjectEdit(document.getElementById('ctl00_Content_hdneditRowProject').value);
                    flagProjects=1;
                }
            }      
         }
     }
     
      //for edit section of the page.for Refrences.
     if(document.getElementById('ctl00_Content_hfEditMode').value != '0')
     {
         if(selecttabText == "Previous Projects")
         {
            if(flagRefrences == 0)// generate table only once.
            {
                if(document.getElementById('ctl00_Content_hdneditRowRefrence').value != '')
                {
                    addRefEdit(document.getElementById('ctl00_Content_hdneditRowRefrence').value);
                    flagRefrences=1;
                }
            }      
         }
     }
     
      //for edit section of the page.for Attachments
     if(document.getElementById('ctl00_Content_hfEditMode').value != '0')
     {
         if(selecttabText == "Attachments")
         {
            if(flagAttach == 0)// generate table only once.
            {
                if(document.getElementById('ctl00_Content_hidSelFileCV').value != '')
                {
                    addAttachEdit(document.getElementById('ctl00_Content_hidSelFileCV').value,'ifrCV','btnDelete','hfFile');
                    flagAttach=1;
                }
                
                 if(document.getElementById('ctl00_Content_hidSelFileCV2').value != '')
                 {
                    addAttachEdit(document.getElementById('ctl00_Content_hidSelFileCV2').value,'ifrCV2','btnDelete2','hfFile');
                    flagAttach=1;
                 }
                 
                 if(document.getElementById('ctl00_Content_hidSelFileCV3').value != '')
                 {
                    addAttachEdit(document.getElementById('ctl00_Content_hidSelFileCV3').value,'ifrCV3','btnDelete3','hfFile');
                    flagAttach=1;
                 }
                 
                 if(document.getElementById('ctl00_Content_hidSelFileCV4').value != '')
                 {
                    addAttachEdit(document.getElementById('ctl00_Content_hidSelFileCV4').value,'ifrCV4','btnDelete4','hfFile');
                    flagAttach=1;
                 }
            }      
         }
     }
     
     if(selecttabText == "Main Branch")
     {
        if(document.getElementById('ctl00_Content_hdneditRow').value != '')
        {
            document.getElementById('tblMain').style.display = "block";
        }else{
            document.getElementById('tblMain').style.display = "none";
        }
     }else{
        document.getElementById('tblMain').style.display = "none";
     }
     
      if(selecttabText == "Bank Information")
     {
        if(document.getElementById('ctl00_Content_hdneditRowBank').value != '')
        {
            document.getElementById('tblBank').style.display = "block";
        }else{
            document.getElementById('tblBank').style.display = "none";
        }
     }else{
        document.getElementById('tblBank').style.display = "none";
     }
     
      if(selecttabText == "Previous Projects")
     {
        if(document.getElementById('ctl00_Content_hdneditRowProject').value != '')
        {
            document.getElementById('tblProject').style.display = "block";
        }else{
            document.getElementById('tblProject').style.display = "none";
        }
     }else{
        document.getElementById('tblProject').style.display = "none";
     }
     
      if(selecttabText == "Previous Projects")// for refrences
     {
        if(document.getElementById('ctl00_Content_hdneditRowRefrence').value != '')
        {
            document.getElementById('tblRef').style.display = "block";
        }else{
            document.getElementById('tblRef').style.display = "none";
        }
     }else{
        document.getElementById('tblRef').style.display = "none";
     }
     
}

function UserExist()
{
    var tabStrip = $find('ctl00_Content_rdTabVendor');
    var tab;
    tab = tabStrip.findTabByText('User Registration');
    tab.set_selected(true);
    return false;
}

 function ValidateGroups()
    {
        // if user is logged in no need to validate the user registration section.
        var tabStrip = $find('ctl00_Content_rdTabVendor');
        var tab;
        var flag='true';
        
        if(document.getElementById('ctl00_Content_hfUStatus').value == '0')
        {
            flag = Page_ClientValidate('Event');
            
              if(!flag)
                {
                    tab = tabStrip.findTabByText('User Registration');
                    if (tab)
                    {
                        tab.set_selected(true); //The same as tab.select();    
                    }else{
                        alert('Tab not found.');
                    }
                }
        }  else{
           
           flag = Page_ClientValidate('UserRegistrationF');
            
            if(!flag)
                {
                    tab = tabStrip.findTabByText('User Registration');
                    if (tab)
                    {
                        tab.set_selected(true); //The same as tab.select();    
                    }else{
                        alert('Tab not found.');
                    }
                }
            }     
                    
        if(flag)
        {   
            flag = Page_ClientValidate('CompanyInfo');                        
            
            if(!flag)
            {
                tab = tabStrip.findTabByText('Company Info');
                if (tab)
                {
                    tab.set_selected(true); //The same as tab.select();    
                }else{
                    alert('Tab not found.');
                }
            }
            
        }
        
        if(flag)
        {
           flag= validateActivity();// if false then no activity has been selected.          
           if(flag)
           {
            CollectCheckListID();            
           }else{
           
                tab = tabStrip.findTabByText('Company Info');
                if (tab)
                {
                    tab.set_selected(true); //The same as tab.select();    
                }else{
                    alert('Tab not found.');
                }
           }
        }
        
        if(flag)
        {
            if(document.getElementById('ctl00_Content_hdneditRow').value == '')
            {            
                flag = Page_ClientValidate('MainBranch');
                
                 if(!flag)
                {
                    tab = tabStrip.findTabByText('Main Branch');
                    if (tab)
                    {
                        tab.set_selected(true); //The same as tab.select();    
                    }else{
                        alert('Tab not found.');
                    }
                }
            }
        }
        
        if(flag)
        {
            if(document.getElementById('ctl00_Content_hdneditRowBank').value == '')
            {            
                flag = Page_ClientValidate('Bank');
                
                   if(!flag)
                    {
                        tab = tabStrip.findTabByText('Bank Information');
                        if (tab)
                        {
                            tab.set_selected(true); //The same as tab.select();    
                        }else{
                            alert('Tab not found.');
                        }
                }
            }
        }
        
        if(flag)
        {
            flag = Page_ClientValidate('SaveRegistration'); 
            
             if(!flag)
                {
                    tab = tabStrip.findTabByText('Previous Projects');
                    if (tab)
                    {
                        tab.set_selected(true); //The same as tab.select();    
                    }else{
                        alert('Tab not found.');
                    }
                }           
        }
        
        if(flag)
        {
            flag = Page_ClientValidate('Attachments'); 
            
             if(!flag)
                {
                    tab = tabStrip.findTabByText('Attachments');
                    if (tab)
                    {
                        tab.set_selected(true); //The same as tab.select();    
                    }else{
                        alert('Tab not found.');
                    }
                }           
        }
        
        if(flag)
        {
            var checkB = document.getElementById('ctl00_Content_ckProof');
            if(checkB.checked == false)
            {
                flag=false;
                alert('Terms & Conditions are not accepted');
            }
        }
        
        
        return flag;
        
    }
    
    function validateTermsTraining()
    {
            var checkB = document.getElementById('ctl00_Content_CKAccept');
            if(checkB.checked == false)
            {
                alert('Terms & Conditions are not accepted');
                return false;
            }
    }
    
     function CollectCheckListID()
    {
        document.getElementById('ctl00_Content_hdnCheckId').value = "";
        for(var i=0 ; i <=24 ; i++)
        {
            if(document.getElementById('ctl00_Content_chlSupplierActivity_'+i).checked)
            {
                document.getElementById('ctl00_Content_hdnCheckId').value += i+1+";";
            }
        }
    }
    
    
 /* ------ OPinion Poll ----- */
function setValue(val)
{
    document.getElementById('ctl00_Content_opoll_hidAnswer').value = val;
}
function setValueDdl(val)
{
    document.getElementById('ctl00_Content_opoll_hidAnswer').value= val.options[val.selectedIndex].text;
}
function setValueChk(val,chkid)
{
    var str=document.getElementById('ctl00_Content_opoll_hidChkAnswer').value;
    
    if(document.getElementById('ctl00_Content_opoll_chklistVote_' +chkid).checked)
    {
     document.getElementById('ctl00_Content_opoll_hidChkAnswer').value = val; 
     if(str.length > 1)
     {
        str=str +  val +";";
     }
     else
     {
      str=";" +  val + ";";
     }
    }
    else
    {
      if(str.length > 0)
      {
       val=";"+val;
       str=str.replace(val,'');
      }
    }
    
    document.getElementById('ctl00_Content_opoll_hidChkAnswer').value=str;
    
}
//Survey Scripts
function countlines(area)
{   
    var text = area.value.replace(/\s+$/g,"");
    var split = text.split("\n");
    return split.length;
} 

function areaValid(oSrc, args)
{
    var ctl = document.getElementById(oSrc.controltovalidate);
    if(countlines(ctl) > parseInt(oSrc.data))
    {
        args.IsValid = false;
    }
    else args.IsValid = true;
}
/* Survey Scripts End */

function ShowHideDDL(visibility) {
	for(j=0;j<document.forms.length; j++) {
		for(i=0;i<document.forms[j].elements.length;i++) {
			if(document.forms[j].elements[i].type != null) {
				if(document.forms[j].elements[i].type.indexOf('select') == 0)
					document.forms[j].elements[i].style.display =visibility;
			}
		}
	}
}
   
   
/* Search */
function cSearch()
{
    if(document.getElementById(tSearch).value == 'Search Here')
    document.getElementById(tSearch).value = '';
}

function rSearch()
{
    if(document.getElementById(tSearch).value == '')
    document.getElementById(tSearch).value = 'Search Here';
}   
function Search()
{
var srckeyword="";
if(document.getElementById(tSearch).value == 'Search Here' || document.getElementById(tSearch).value == 'Enter text to search')
{
document.getElementById(tSearch).value = 'Enter text to search';
}
else
{
  location.href=apath+"search/default.aspx?keyword="+document.getElementById(tSearch).value;
}
  
}

/* Send to Friend */

function ebc(mode)
{
    if(document.getElementById("F1") != null)
    {
        if(mode) document.getElementById("F1").style.position = 'static';
        else document.getElementById("F1").style.position = 'relative';
    }
}
function bookIt(obj)
{
   ebc(true); 
    
   var cLeft = getposOffset(document.getElementById('lnkBook'),"left");
   var cTop = getposOffset(document.getElementById('lnkBook'),"top");
   
   document.getElementById('divShare').style.left = (cLeft -20) + "px";
   document.getElementById('divShare').style.top = (cTop + 17 ) + "px";
   document.getElementById('divShare').style.display = "block";
   
    if(document.getElementById('imgGalFlash')!=null)
   {
     document.getElementById('imgGalFlash').style.display='none';
   }
   
}

function emailEventList(obj)
{
   ebc(true); 
   
   
   var cLeft = getposOffset(document.getElementById(obj),"left");
   var cTop = getposOffset(document.getElementById(obj ),"top");
   
   document.getElementById('dvSend').style.left = (cLeft -20) + "px";
   document.getElementById('dvSend').style.top = (cTop + 17 ) + "px";
   document.getElementById('dvSend').style.display = "block";
   
    if(document.getElementById('imgGalFlash')!=null)
   {
     document.getElementById('imgGalFlash').style.display='none';
   }
}

function emailMain(obj)
{
   ebc(true); 

   var cLeft = getposOffset(document.getElementById('lnkEmailFried'),"left");
   var cTop = getposOffset(document.getElementById('lnkEmailFried'),"top");
   
   document.getElementById('dvSendMain').style.left = (cLeft +245) + "px";
   document.getElementById('dvSendMain').style.top = (cTop - 200 ) + "px";
   document.getElementById('dvSendMain').style.display = "block";
   
    if(document.getElementById('imgGalFlash')!=null)
   {
     document.getElementById('imgGalFlash').style.display='none';
   }
}
function email(obj)
{
   ebc(true); 

   var cLeft = getposOffset(document.getElementById('lnkEmailFried'),"left");
   var cTop = getposOffset(document.getElementById('lnkEmailFried'),"top");
   
   document.getElementById('dvSend').style.left = (cLeft -20) + "px";
   document.getElementById('dvSend').style.top = (cTop + 17 ) + "px";
   document.getElementById('dvSend').style.display = "block";
   
    if(document.getElementById('imgGalFlash')!=null)
   {
     document.getElementById('imgGalFlash').style.display='none';
   }
}
function ecloseMain()
{
   ebc(false); 
   document.getElementById('dvSendMain').style.display = "none";
   
    if(document.getElementById('imgGalFlash')!=null)
   {
     document.getElementById('imgGalFlash').style.display='block';
   }
}

function eclose()
{
   ebc(false); 
   document.getElementById('dvSend').style.display = "none";
   
    if(document.getElementById('imgGalFlash')!=null)
   {
     document.getElementById('imgGalFlash').style.display='block';
   }
}

function getposOffset(what, offsettype)
{
    var totaloffset=(offsettype=="right")? what.offsetLeft : what.offsetTop;
    var parentEl=what.offsetParent;
    while (parentEl!=null)
    {
        totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
        parentEl=parentEl.offsetParent;
    }
    return totaloffset;
}

/*News letter Validation */

function checkNewsLetterValidation()
{
    if(document.getElementById('ctl00_newsLetter_txtUserPwd') != null)
    {
        var txtEmail = document.getElementById('ctl00_newsLetter_txtUserPwd');
        
        if(txtEmail.value == '')
        {
            alert('Please enter email');
            return false;
        }else{
            return true;
        }
    }
}

function onSubmitNewsletter(evt)
{

 if(document.all)
    {
        if(evt.keyCode == 13) return SubmitNewsletter();
        else Page_BlockSubmit = true;
    }
    else
    {
        if(evt.which == 13) return SubmitNewsletter();
        else Page_BlockSubmit = true;
    }    
   
}

function validateEmail(elementValue){   
   var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;   
   return emailPattern.test(elementValue);   
 }  


function SubmitNewsletter()
{
   var email=document.getElementById('ctl00_ftr_newsLetter_txtUserPwd').value;
   if (email=='')
   {
    alert('Please enter email');
    document.getElementById('ctl00_ftr_newsLetter_txtUserPwd').focus();
   }  
   else
   {
   
   var emailFilter='\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*';
   if(validateEmail(email) == false)
   {
        alert('Email format is wrong');
        return false;
   } 
   
   document.getElementById('imgspinnerLoginNletter').style.display='block';
   var status=tac_post('on_newsletter',email + ',1');
   document.getElementById('imgspinnerLoginNletter').style.display='none';
   if(status=="0")
    {
      alert('Email already exists.');
      document.getElementById('ctl00_ftr_newsLetter_txtUserPwd').focus();
    }
    else if(status=="1") //Newsletter Submitted successfully.
    {
     alert("Your subscription information has been submitted successfully.");
     document.getElementById('ctl00_ftr_newsLetter_txtUserPwd').value = '';
    CloseNewsletterPopup();    
     
    }    
   }
}

function openWin(pagename)
{
microsite_window=window.open(pagename,'microsite_window','toolbar=no,location=no,borders=no,directories=no,status=no,menubar=no,scrollbars=no,top=0,left=0,resizable=no,width=620,height=620')
} 
function openFlashMap(pagename)
{
microsite_window=window.open(pagename,'microsite_window','toolbar=no,location=no,borders=no,directories=no,status=no,menubar=no,scrollbars=no,top=0,left=0,resizable=no,width=500,height=620')
} 

function ValidateTraining()
{
     var checkB = document.getElementById('ctl00_Content_ckAccept');
    if(checkB.checked == false)
    {
        alert('Terms & Conditions are not accepted');
        return false;
    }   
}

function HotelClassificationSystem()
 {
   
  CheckUserLoginStatus("2");
  document.getElementById('ctl00_login1_hidLoginForm').value = "2";
 
 }
 
 /* Sponsers Functions */
 
 // Showing hiding the Broadcast options.
 function showHideBroad(which)
 {
  
    document.getElementById('ctl00_Content_lblValidate_media_visibility').innerHTML="";
 
    var txtLive = document.getElementById('ctl00_Content_txtLive');
    var txtRec = document.getElementById('ctl00_Content_txtRec');
    
    if(which == 1)
    {
        txtLive.style.display = "block";
        txtRec.style.display = "none";
        txtLive.value = '';
        txtRec.value = '';
        
    }else if(which == 2)
    {
        txtLive.style.display = "none";
        txtRec.style.display = "block";
        txtLive.value = '';
        txtRec.value = '';
        
    }else if(which == 3)
    {
        txtLive.style.display = "none";
        txtRec.style.display = "none";
        txtLive.value = '';
        txtRec.value = '';
    }
 }
 function showHideBroad1(which)
 {
  
    document.getElementById('ctl00_Content_lblValidate_media_visibility').innerHTML="";
 
    var txtLive = document.getElementById('ctl00_Content_txtLive');
    var txtRec = document.getElementById('ctl00_Content_txtRec');
    
    if(which == 1)
    {
        txtLive.style.display = "block";
        txtRec.style.display = "none";
        
    }else if(which == 2)
    {
        txtLive.style.display = "none";
        txtRec.style.display = "block";
    }else if(which == 3)
    {
        txtLive.style.display = "none";
        txtRec.style.display = "none";
    }
 }
 
 function showHideGovBody(which)
 {
  
    document.getElementById('ctl00_Content_lblValidateGovYesNo').innerHTML="";
 
    var txtGovYes = document.getElementById('ctl00_Content_txtGovYes');
    
    
    if(which == 1)
    {
        txtGovYes.style.display = "block";
        txtGovYes.value = '';
        
    }
    else if(which == 2)
    {
        txtGovYes.style.display = "none";
        txtGovYes.value = '';
        
    }
 }
 function showHideGovBody1(which)
 {
  
    document.getElementById('ctl00_Content_lblValidateGovYesNo').innerHTML="";
 
    var txtGovYes = document.getElementById('ctl00_Content_txtGovYes');
    
    
    if(which == 1)
    {
        txtGovYes.style.display = "block";
    }
    else if(which == 2)
    {
        txtGovYes.style.display = "none";
    }
 }
 function showHideRadio(which)
 {
    document.getElementById('ctl00_Content_lblValidate_radio').innerHTML="";
     
    var txtAirTime = document.getElementById('ctl00_Content_txtAirTime');
    
    if(which == 1)
    {
        txtAirTime.style.display = "block";        
        txtAirTime.value = '';
        
    }else if(which == 2)
    {
        txtAirTime.style.display = "none";
        txtAirTime.value = '';        
        
    }
 }
 function showHideRadio1(which)
 {
    document.getElementById('ctl00_Content_lblValidate_radio').innerHTML="";
     
    var txtAirTime = document.getElementById('ctl00_Content_txtAirTime');
    
    if(which == 1)
    {
        txtAirTime.style.display = "block";        
        
    }else if(which == 2)
    {
        txtAirTime.style.display = "none";
    }
 }
 
 function showHideSponConsumer(which)
 {
 
    document.getElementById('ctl00_Content_lblValidate_Consumer_Pres').innerHTML="";
    
//    var txtConsumerYes = document.getElementById('ctl00_Content_txtConsumerYes');
//    var txtConsumerNo = document.getElementById('ctl00_Content_txtConsumerNo');
//    
//    if(which == 1)
//    {
//        txtConsumerYes.style.display = "block";        
//        txtConsumerNo.style.display = "none";        
//        txtConsumerYes.value = '';
//        txtConsumerNo.value = '';
//        
//    }else if(which == 2)
//    {
//        txtConsumerYes.style.display = "none";        
//        txtConsumerNo.style.display = "block";        
//        txtConsumerYes.value = '';
//        txtConsumerNo.value = '';        
//        
//    }
 }
 
 function showHideSponBusinessPress(which)
 {
   document.getElementById('ctl00_Content_lblValidate_Business_Pres').innerHTML=""; 
 
//    var txtBusinessPressYes = document.getElementById('ctl00_Content_txtbusinessPressYes');
//    var txtBusinessPressNo = document.getElementById('ctl00_Content_txtbusinessPressNo');
//    
//    if(which == 1)
//    {
//        txtBusinessPressYes.style.display = "block";        
//        txtBusinessPressNo.style.display = "none";        
//        txtBusinessPressYes.value = '';
//        txtBusinessPressNo.value = '';
//        
//    }else if(which == 2)
//    {
//        txtBusinessPressYes.style.display = "none";        
//        txtBusinessPressNo.style.display = "block";        
//        txtBusinessPressYes.value = '';
//        txtBusinessPressNo.value = '';        
//        
//    }
 }
 
 function showHideInternet(which)
 {
   document.getElementById('ctl00_Content_lblValidate_Internet').innerHTML=""; 
 
//    var txtInternetYes = document.getElementById('ctl00_Content_txtInternetYes');
//    var txtInternetNo = document.getElementById('ctl00_Content_txtInternetNo');
//    
//    if(which == 1)
//    {
//        txtInternetYes.style.display = "block";        
//        txtInternetNo.style.display = "none";        
//        txtInternetYes.value = '';
//        txtInternetNo.value = '';
//        
//    }else if(which == 2)
//    {
//        txtInternetYes.style.display = "none";        
//        txtInternetNo.style.display = "block";        
//        txtInternetYes.value = '';
//        txtInternetNo.value = '';        
//        
//    }
 }
 
/* Sponsor Ship Validations */
 
 function ValidateGroupsSponsorShipOSave()
 {
   // if user is logged in no need to validate the user registration section.
        var tabStrip = $find('ctl00_Content_rdTabSponsorShip');
        var tab;
        var flag='true';
        var selectedTab = document.getElementById('ctl00_Content_hfSelTabs').value;
        /* User Registration validate start */        
        
        if(document.getElementById('ctl00_Content_hfUStatus').value == '0')
        {
            var flag1 = Page_ClientValidate('Event');
            flag = Page_ClientValidate('Event');
              if(!flag ||!flag1  )
                {
                    tab = tabStrip.findTabByText('Event Property');
                    if (tab)
                    {
                        tab.set_selected(true); //The same as tab.select();    
                    }
                    else
                    {
                        alert('Tab not found.');
                    }
                }
        }  
       else
        {
           var flag1 = Page_ClientValidate('Event');
           flag = Page_ClientValidate('UserRegistrationF');
            
            if(!flag ||!flag1)
                {
                    tab = tabStrip.findTabByText('Event Property');
                    if (tab)
                    {
                        tab.set_selected(true); //The same as tab.select();    
                    }
                    else
                    {
                        alert('Tab not found.');
                    }
                }
         }
         /* User Registration validate End */
        
        /* Tabs Validation start */            
        if(flag)
        {   
            flag = Page_ClientValidate('Event');                        
            if(!flag)
            {
                tab = tabStrip.findTabByText('Event Property');
                if (tab) tab.set_selected(true); //The same as tab.select();    
                else alert('Tab not found.');
            }
            
        }
        
        return flag;
        
    }
 
 function ValidateGroupsSponsorShipSave()
 {
   // if user is logged in no need to validate the user registration section.
        var tabStrip = $find('ctl00_Content_rdTabSponsorShip');
        var tab;
        var flag='true';
        var selectedTab = document.getElementById('ctl00_Content_hfSelTabs').value;
        /* User Registration validate start */        
        
        if(document.getElementById('ctl00_Content_hfUStatus').value == '0')
        {
            var flag1 = Page_ClientValidate('Event Property');
            flag = Page_ClientValidate('Event');
              if(!flag ||!flag1  )
                {
                    tab = tabStrip.findTabByText('Event Property');
                    if (tab)
                    {
                        tab.set_selected(true); //The same as tab.select();    
                    }
                    else
                    {
                        alert('Tab not found.');
                    }
                }
        }  
       else
        {
           var flag1 = Page_ClientValidate('Event');
          // flag = Page_ClientValidate('UserRegistrationF');
            
            if(!flag ||!flag1)
                {
                    tab = tabStrip.findTabByText('Event Property');
                    if (tab)
                    {
                        tab.set_selected(true); //The same as tab.select();    
                    }
                    else
                    {
                        alert('Tab not found.');
                    }
                }
         }
         /* User Registration validate End */
        
        /* Tabs Validation start */            
        if(flag)
        {   
            flag = Page_ClientValidate('Event');                        
            if(!flag)
            {
                tab = tabStrip.findTabByText('Event Property');
                if (tab) tab.set_selected(true); //The same as tab.select();    
                else alert('Tab not found.');
            }
            
        }
        
        if(selectedTab == "0" && flag == true)
        {
            tab = tabStrip.findTabByText('Investment Profile');
            tab.set_selected(true);
            flag = false;
        }else if(selectedTab == "Event Property" && flag == true)
        {
            tab = tabStrip.findTabByText('Investment Profile');
            tab.set_selected(true);
            flag = false;
        }
        else if(selectedTab == "Investment Profile" && flag == true)
        {
            tab = tabStrip.findTabByText('Media Visibility');
            tab.set_selected(true);
            flag = false;
        }else if(selectedTab == "Media Visibility" && flag == true)
        {
            tab = tabStrip.findTabByText('Audience');
            tab.set_selected(true);
            flag = false;
        }else if(selectedTab == "Audience" && flag == true)
        {
            tab = tabStrip.findTabByText('Marketing and Public Relations');
            tab.set_selected(true);
            flag = false;
        }else if(selectedTab == "Marketing and Public Relations" && flag == true)
        {
            tab = tabStrip.findTabByText('Branding Visibility');
            tab.set_selected(true);
            flag = false;
        }else if(selectedTab == "Branding Visibility" && flag == true)
        {
            tab = tabStrip.findTabByText('Event / Product Sponsorship');
            tab.set_selected(true);
            flag = false;
        }else if(selectedTab == "Event / Product Sponsorship" && flag == true)
        {
            tab = tabStrip.findTabByText('Investment');
            tab.set_selected(true);
            flag = false;
        }else if(selectedTab == "Investment" && flag == true)
        {
            tab = tabStrip.findTabByText('Corporate Hospitality');
            tab.set_selected(true);
            flag = false;
        }else if(selectedTab == "Corporate Hospitality" && flag == true)
        {
            tab = tabStrip.findTabByValue(10);
            tab.set_selected(true);
            flag = false;
        }else if(selectedTab == "Comments " && flag == true)
        {
            tab = tabStrip.findTabByText('Attachments');
            tab.set_selected(true);
            flag = false;
        }
        
        return flag;
        
    }
    
   /* New Function By ramesh  start */ 
  function ValidateGroupsSponsorShipNew()
 {
   // if user is logged in no need to validate the user registration section.
        var tabStrip = $find('ctl00_Content_rdTabSponsorShip');
        var tab;
        var flag='true';
        var selectedTab = document.getElementById('ctl00_Content_hfSelTabs').value;
        /* User Registration validate start */        
        //alert('Hf Status Value ' + document.getElementById('ctl00_Content_hfUStatus').value );
        
        if(document.getElementById('ctl00_Content_hfUStatus').value == '0')
        {
           //alert('in Save');
            var flag1 = Page_ClientValidate('Event Property');
            flag = Page_ClientValidate('Event');
              if(!flag ||!flag1  )
                {
                    tab = tabStrip.findTabByText('Event Property');
                    if (tab)
                    {
                        tab.set_selected(true); //The same as tab.select();    
                    }
                    else
                    {
                        alert('Tab not found.');
                    }
                }
        }  
       else
        {
          //alert('in edit');
           var flag = Page_ClientValidate('Event');
           //flag = Page_ClientValidate('UserRegistrationF');
            
            //if(!flag ||!flag1)
            if(!flag)
                {
                    tab = tabStrip.findTabByText('Event Property');
                    if (tab)
                    {
                        tab.set_selected(true); //The same as tab.select();    
                    }
                    else
                    {
                        alert('Tab not found.');
                    }
                }
         }
         
         /* User Registration validate End */
        
        /* Tabs Validation start */            
        
        if(flag)
        {   
            flag = Page_ClientValidate('Event');                        
            if(!flag)
            {
                tab = tabStrip.findTabByText('Event Property');
                if (tab) tab.set_selected(true); //The same as tab.select();    
                else alert('Tab not found.');
            }
            
        }
        
        
        //alert((selectedTab == "Investment Profile" && flag));
        //alert('Selected Tab Text '+ selectedTab);
        if(selectedTab == "Investment Profile" && flag)
        {
        
            var flag = Page_ClientValidate('InvestProfile');
            if(!flag )
            {
                tab = tabStrip.findTabByText('Investment Profile');
                if (tab) tab.set_selected(true); //The same as tab.select();    
                else alert('Tab not found.');
            }
            //alert('2nd tab Flag' + flag);
        }
        
        //Validating Media Visiblity
        
        if(selectedTab == "Media Visibility" && flag)
        {
            //alert('3rd tab');
            var flag1=RadioGroupCheck('Broadcast','lblValidate_media_visibility');
            var flag2=RadioGroupCheck('Radio','lblValidate_radio');
            var flag3=RadioGroupCheck('Consumer','lblValidate_Consumer_Pres');
            var flag4=RadioGroupCheck('Business','lblValidate_Business_Pres');
            var flag5=RadioGroupCheck('Internet','lblValidate_Internet');
            
            if(!flag1 || !flag2 ||!flag3 || !flag4 ||!flag5)
            {
                flag=false;
            }
        }
        /*
        if(selectedTab == "AudienceVgroup" && flag)
        {
            alert('4th tab');
            flag = Page_ClientValidate('AudienceVgroup');
            if(validateTargetedAudience() || !flag)
            {
                flas=false;
            }
        }
        */
        
        if(selectedTab == "Audience" && flag)
        {
        //alert('4th tab');
            if(document.getElementById('ctl00_Content_hfEditMode').value == '0')
            {
                document.getElementById("ctl00_Content_btnSaveForm").style.display="block";
            }
            else
            {
                if(document.getElementById("ctl00_Content_btnSave") != null)
                {
                    document.getElementById("ctl00_Content_btnSave").style.display="none";
                    document.getElementById("ctl00_Content_btnSaveAndSubmitForm").style.display="none";
                }
                
            }
            var flag1=Page_ClientValidate('AudienceVgroup');
            flag = validateTargetedAudience();
            if(!flag && !flag1)
            {
                flag=false;
            }
        }
        
        // Validating Marketing and Public relation
        
        if(selectedTab == "Marketing and Public Relations" && flag)
        {
        //alert('5th tab');
           var flag1= RadioGroupCheck('Plan','lblValidatePublicrelation');
           var flag2= RadioGroupCheck('Value','lblValidatevalueMarketing');
           var flag3=RadioGroupCheck('Rights','lblValidatePropertyLisc');
           var flag4=RadioGroupCheck('MARCHANDISE','lblValidateMARCHANDISE');
           
           var flag9=RadioGroupCheck('PhotoGraphy','lblValidatePhotoGraphy');
          
           if(!flag1 || !flag2 || !flag3 || !flag4 || !flag9) 
            {
                flag=false;
            }
        }
        
        
        // Branding and Visibility
        
        if(selectedTab == "Branding Visibility" && flag)
        {
        //alert('6th tab -- 2nd Row');
           var flag1=RadioGroupCheck('Brand','lblValidateBrand');
           var flag2=RadioGroupCheck('Promotion','lblValidatePromotional');
           var flag3=RadioGroupCheck('Research','lblValidateMarketResearch');
           
           if(!flag1 || !flag2 || !flag3 || !flag) 
            {
                flag=false;
            }
        }
        
        //Validating Event /SponserShip
        
        if(selectedTab == "Event / Product Sponsorship" && flag)
        {
           //alert('7th tab -- 2nd Row');
            var flag1=RadioGroupCheck('BroadcastGov','lblValidateGovYesNo');
            var flag2=CheckMarketingResearch();
            var flag3=validateDateOfEvent();           
            flag = Page_ClientValidate('marketingVgroup');
                        
            for(var i=0;i<=5;i++)
            {
                if(i==5)
                {
                    if(document.getElementById('ctl00_Content_rdlType_' + i).checked)
                    {
                        if(document.getElementById('ctl00_Content_txtType').value =="")
                        {
                            flag=false;
                            document.getElementById('ctl00_Content_lblValidatorSponsertype').innerHTML = "*";
                        }else{
                            document.getElementById('ctl00_Content_lblValidatorSponsertype').innerHTML = "";
                        }
                    }
                }
            }
            
            for(var i=0;i<=4;i++)
            {
                if(i==4)
                {
                    if(document.getElementById('ctl00_Content_rdlLevel_' + i).checked)
                    {
                        if(document.getElementById('ctl00_Content_txtLevel').value =="")
                        {
                            flag=false;
                            document.getElementById('ctl00_Content_lblValidatorSponserLevel').innerHTML = "*";
                        }else{
                            document.getElementById('ctl00_Content_lblValidatorSponserLevel').innerHTML = "";
                        }
                    }
                }
            }
            
            if(!flag1 || !flag2 || !flag3 || !flag) 
            {
                flag=false;
            }
            
        }
        
        // validating Invest
        
        if(selectedTab == "Investment" && flag)
        {
           //alert('8th tab -- 2nd Row');
           flag = Page_ClientValidate('Invest'); 
           
            if(!flag) 
            {
               flag=false;
            }            
          
        }
        
        if(selectedTab == "Corporate Hospitality" && flag)
        {
           //alert('9th tab -- 3rd Row');
           //var flag1= RadioGroupCheck('Athlete','lblValidateAthletYesNo');
            
           flag = Page_ClientValidate('CorporateHospitalityVgroup');
           if(!flag) 
            {
                flag=false;
            }
        }
        if(selectedTab == "Community Engagement" && flag)
        {
           //alert('9th tab -- 3rd Row');
           //var flag1= RadioGroupCheck('Athlete','lblValidateAthletYesNo');
            
           flag = Page_ClientValidate('CommnityEngagementgroup');
           if(!flag) 
            {
                flag=false;
            }
        }
        /* we are enabling Save and Submit Button So It Will Check the Functionality There
        if(selectedTab == "Comments" && flag)
        {
        alert('10th tab -- 3rd Row');
            document.getElementById("ctl00_Content_btnSaveAndSubmitForm").style.display="block";
            if(document.getElementById("ctl00_Content_btnSaveForm") != null)
            {             
                document.getElementById("ctl00_Content_btnSaveForm").style.display="none";
            }
           flag = Page_ClientValidate('CommenggVgroup');
           if(!flag) 
            {
                flag=false;
            }
        }
        */
        //alert(selectedTab);
        //alert(flag);
        return flag;
        
    }  
 
 /* New Function By ramesh  End */ 
 function ValidateGroupsSponsorShip()
    {
        // if user is logged in no need to validate the user registration section.
        
        var tabStrip = $find('ctl00_Content_rdTabSponsorShip');
        var tab;
        var flag='true';
        /* User Registration validate start */
        if(document.getElementById('ctl00_Content_hfUStatus').value == '0')
        {
            var flag1 = Page_ClientValidate('Event Property');
            flag = Page_ClientValidate('UserRegistration');
              if(!flag ||!flag1  )
                {
                    tab = tabStrip.findTabByText('Event Property');
                    if (tab)
                    {
                        tab.set_selected(true); //The same as tab.select();    
                    }
                    else
                    {
                        alert('Tab not found.');
                    }
                }
        }  
       else
        {
           var flag1 = Page_ClientValidate('Event');
           flag = Page_ClientValidate('UserRegistrationF');
            
            if(!flag ||!flag1)
                {
                    tab = tabStrip.findTabByText('Event Property');
                    if (tab)
                    {
                        tab.set_selected(true); //The same as tab.select();    
                    }
                    else
                    {
                        alert('Tab not found.');
                    }
                }
         }
         /* User Registration validate End */
        
        /* Tabs Validation start */            
        if(flag)
        {   
            flag = Page_ClientValidate('Event');                        
            if(!flag)
            {
                tab = tabStrip.findTabByText('Event Property');
                if (tab) tab.set_selected(true); //The same as tab.select();    
                else alert('Tab not found.');
            }
            
        }
        // Validating InvestProfile
         if(flag)
        {
            flag = Page_ClientValidate('InvestProfile');
           
            if(!flag )
            {
                tab = tabStrip.findTabByText('Investment Profile');
                if (tab) tab.set_selected(true); //The same as tab.select();    
                else alert('Tab not found.');
            }
        }
        
        //Validating Media Visiblity
        
        if(flag)
        {
            
            var flag1=RadioGroupCheck('Broadcast','lblValidate_media_visibility');
            var flag2=RadioGroupCheck('Radio','lblValidate_radio');
            var flag3=RadioGroupCheck('Consumer','lblValidate_Consumer_Pres');
            var flag4=RadioGroupCheck('Business','lblValidate_Business_Pres');
            var flag5=RadioGroupCheck('Internet','lblValidate_Internet');
            
            if(!flag1 || !flag2 ||!flag3 || !flag4 ||!flag5)
            {
                tab = tabStrip.findTabByText('Media Visibility');
                if (tab) tab.set_selected(true); //The same as tab.select();    
                else alert('Tab not found.');
                flag=false;
            }
        }
        
        if(flag)
        {
            flag = Page_ClientValidate('AudienceVgroup');
            if(validateTargetedAudience() || !flag)
            {
                tab = tabStrip.findTabByText('Audience');
                if (tab) tab.set_selected(true); //The same as tab.select();    
                else alert('Tab not found.');
            }
        }
        
        if(flag)
        {
            flag = validateTargetedAudience();
            if(!flag)
            {
                tab = tabStrip.findTabByText('Audience');
                if (tab) tab.set_selected(true); //The same as tab.select();    
                else alert('Tab not found.');
            }
        }
        
        // Validating Marketing and Public relation
        
        if(flag)
        {
           var flag1= RadioGroupCheck('Plan','lblValidatePublicrelation');
           var flag2= RadioGroupCheck('Value','lblValidatevalueMarketing');
           var flag3=RadioGroupCheck('Rights','lblValidatePropertyLisc');
           var flag4=RadioGroupCheck('MARCHANDISE','lblValidateMARCHANDISE');
           var flag9=RadioGroupCheck('PhotoGraphy','lblValidatePhotoGraphy');
          
           if(!flag1 || !flag2 || !flag3 || !flag4 || !flag9) 
            {
                tab = tabStrip.findTabByText('Marketing and Public Relations');
                flag=false;
                if (tab) tab.set_selected(true); //The same as tab.select();    
                else alert('Tab not found.');
            }
        }
        
        // Branding and Visibility
        
        if(flag)
        {
           var flag1=RadioGroupCheck('Brand','lblValidateBrand');
           var flag2=RadioGroupCheck('Promotion','lblValidatePromotional');
           var flag3=RadioGroupCheck('Research','lblValidateMarketResearch');
           
           if(!flag1 || !flag2 || !flag3 || !flag) 
            {
                tab = tabStrip.findTabByText('Branding Visibility');
                flag=false;
                if (tab) tab.set_selected(true); //The same as tab.select();    
                else alert('Tab not found.');
            }
        }
        
        //Validating Event /SponserShip
        
        if(flag)
        {
            var flag1=RadioGroupCheck('BroadcastGov','lblValidateGovYesNo');
            var flag2=CheckMarketingResearch();
            var flag3=validateDateOfEvent();           
            flag = Page_ClientValidate('marketingVgroup');
                        
            for(var i=0;i<=5;i++)
            {
                if(i==5)
                {
                    if(document.getElementById('ctl00_Content_rdlType_' + i).checked)
                    {
                        if(document.getElementById('ctl00_Content_txtType').value =="")
                        {
                            flag=false;
                            document.getElementById('ctl00_Content_lblValidatorSponsertype').innerHTML = "*";
                        }else{
                            document.getElementById('ctl00_Content_lblValidatorSponsertype').innerHTML = "";
                        }
                    }
                }
            }
            
            for(var i=0;i<=4;i++)
            {
                if(i==4)
                {
                    if(document.getElementById('ctl00_Content_rdlLevel_' + i).checked)
                    {
                        if(document.getElementById('ctl00_Content_txtLevel').value =="")
                        {
                            flag=false;
                            document.getElementById('ctl00_Content_lblValidatorSponserLevel').innerHTML = "*";
                        }else{
                            document.getElementById('ctl00_Content_lblValidatorSponserLevel').innerHTML = "";
                        }
                    }
                }
            }
            
            if(!flag1 || !flag2 || !flag3 || !flag) 
            {
                tab = tabStrip.findTabByText('Event / Product Sponsorship');
                flag=false;
                if (tab) tab.set_selected(true); //The same as tab.select();    
                else alert('Tab not found.');
            }
            
        }
        
        // validating Invest
        
        if(flag)
        {
           flag = Page_ClientValidate('Invest'); 
           
            if(!flag) 
            {
                tab = tabStrip.findTabByText('Investment');
                if (tab) tab.set_selected(true); //The same as tab.select();    
                else alert('Tab not found.');
            }
        }
        
        if(flag)
        {
           var flag1= RadioGroupCheck('Athlete','lblValidateAthletYesNo');
            document.getElementById("ctl00_Content_btnSaveAndSubmitForm").style.display="block";
            if(document.getElementById("ctl00_Content_btnSaveForm") != null)
            {             
                document.getElementById("ctl00_Content_btnSaveForm").style.display="none";
            }
           flag = Page_ClientValidate('CorporateHospitalityVgroup');
           if(!flag1 || !flag) 
            {
                tab = tabStrip.findTabByText('Corporate Hospitality');
                if (tab) tab.set_selected(true); //The same as tab.select();    
                else alert('Tab not found.');
            }
        }
        
        if(flag)
        {
          flag = Page_ClientValidate('CommnityEngagementgroup');
           if(!flag) 
            {
                tab = tabStrip.findTabByText('Community Engagement');
                if (tab) tab.set_selected(true); //The same as tab.select();    
                else alert('Tab not found.');
            }
        }
        
        if(flag)
        {
            document.getElementById("ctl00_Content_btnSaveAndSubmitForm").style.display="block";
            if(document.getElementById("ctl00_Content_btnSaveForm") != null)
            {             
                document.getElementById("ctl00_Content_btnSaveForm").style.display="none";
            }
           flag = Page_ClientValidate('CommenggVgroup');
           if(!flag) 
            {
                tab = tabStrip.findTabByText('Corporate Hospitality');
                if (tab) tab.set_selected(true); //The same as tab.select();    
                else alert('Tab not found.');
            }
        }

        /* Tabs Validation End */
        
        return flag;
        
    }
    
function showOther(which)
{
    if(which == 'type')
    {
        for(var i=0;i<=5;i++)
            {
                if(i==5)
                {
                    if(document.getElementById('ctl00_Content_rdlType_' + i).checked)
                    {
                        document.getElementById('ctl00_Content_txtType').style.display = "block";                        
                    }else{
                        document.getElementById('ctl00_Content_txtType').style.display = "none";                        
                    }
                }
            }
    }else if(which == 'level')
    {
        for(var i=0;i<=4;i++)
            {
                if(i==4)
                {
                    if(document.getElementById('ctl00_Content_rdlLevel_' + i).checked)
                    {
                        document.getElementById('ctl00_Content_txtLevel').style.display = "block";                        
                    }else{
                        document.getElementById('ctl00_Content_txtLevel').style.display = "none";                        
                    }
                }
            }
    }
}

function RadioGroupCheck(rdgroupname,lblid)
{
  var res=false;
  
  rdgroupname='ctl00$Content$'+rdgroupname;
  lblid='ctl00_Content_'+lblid;
  
  document.getElementById(lblid).innerHTML=" * ";
  
  var rdblist=$('input[type="radio"][name="'+rdgroupname+'"]');
  for(var i=0;i<rdblist.length;i++)
   {
     if(rdblist[i].checked)
     {
      if(rdblist[i].id == "ctl00_Content_rdLive")
      {
        if(document.getElementById('ctl00_Content_txtLive').value == '')
        {
            res=false;
        }else{
            res=true;
            document.getElementById(lblid).innerHTML="";
        }
      }else if(rdblist[i].id == "ctl00_Content_rdRec")
      {
        if(document.getElementById('ctl00_Content_txtRec').value == '')
        {
            res=false;
        }else{
            res=true;
            document.getElementById(lblid).innerHTML="";
        }
      }else if(rdblist[i].id == "ctl00_Content_rdAirtime")
      {
        if(document.getElementById('ctl00_Content_txtAirTime').value == '')
        {
            res=false;
        }else{
            res=true;
            document.getElementById(lblid).innerHTML="";
        }
      }else if(rdblist[i].id == "ctl00_Content_rdGovYes")
      {
        if(document.getElementById('ctl00_Content_txtGovYes').value == '')
        {
            res=false;
        }else{
            res=true;
            document.getElementById(lblid).innerHTML="";
        }
      }
      else{
        
         res=true;
        document.getElementById(lblid).innerHTML="";
        break;
      }
     
     }
   }
  
  return res;
}

function validateTargetedAudience()
{
    var fStatus=false;
    
    document.getElementById ('ctl00_Content_lblValidateTargetAudience').innerHTML = "*";
    var chkListaTipoModificaciones= document.getElementById ('ctl00_Content_cklTargetAudience');
   
   var chkLista= chkListaTipoModificaciones.getElementsByTagName("input");
   for(var i=0;i<chkLista.length;i++)
    {   
        if(chkLista[i].checked)
        {
            document.getElementById ('ctl00_Content_lblValidateTargetAudience').innerHTML = "";
            fStatus=true;
            break;   
        }
    }
  
  return fStatus;

}
function SetCommonResetValidationLabel(obj)
{
  if(document.getElementById ('ctl00_Content_'+obj) != null)
  {
    document.getElementById ('ctl00_Content_'+obj).innerHTML = "";
  }
}
function CheckMarketingResearch()
{
  if(document.getElementById ('ctl00_Content_ckReachInter').checked ||  document.getElementById ('ctl00_Content_ckReachNational').checked || document.getElementById ('ctl00_Content_ckReachRegional').checked ||  document.getElementById ('ctl00_Content_ckReachCity').checked)
  {
  document.getElementById ('ctl00_Content_lblValidateMarketResearchNationality').innerHTML="" ;
   return true;
  }
  else
  {
   document.getElementById ('ctl00_Content_lblValidateMarketResearchNationality').innerHTML=" * " ;
   return false;
  }
    
}

function validateDateOfEvent()
{
    var fStatus=false;    
    document.getElementById ('ctl00_Content_lblValidateDateOfEvent').innerHTML = "*";
    var chkListaTipoModificaciones= document.getElementById ('ctl00_Content_cklDateEvent');
   
   var chkLista= chkListaTipoModificaciones.getElementsByTagName("input");
   for(var i=0;i<chkLista.length;i++)
    {   
        if(chkLista[i].checked)
        {
            document.getElementById ('ctl00_Content_lblValidateDateOfEvent').innerHTML = "";
            fStatus=true;
            break;   
        }
    }
  
  return fStatus;

}

/* SponserShip Module Checking 100% value.*/

function checkPercentage(which,cnt)
{
    var comp1;
    var comp2;
    var comp3;
    var comp4;
    var comp5;
    var comp6;
    
    var tSum=0;
    var tComapareTo=100;
    
    if(which == 'gender')
    {
        comp1 = document.getElementById('ctl00_Content_txtAudienceMen').value;
        comp2 = document.getElementById('ctl00_Content_txtAudienceWomen').value;
        
       
        
        if(comp1 == ''){comp1 = 0;}
        if(comp2 == ''){comp2 = 0;}
        
        tSum = parseInt(comp1) + parseInt(comp2);
        if(parseInt(tSum)>parseInt(tComapareTo))
        {
            var temp =0; 
            if(cnt == 'ctl00_Content_txtAudienceMen' && comp1 != 0) // if focus at men's
            {
                if(parseInt(comp1) >= parseInt(tComapareTo))
                {
                    comp1 = 100;
                    document.getElementById('ctl00_Content_txtAudienceMen').value = 100;
                    temp = parseInt(comp1) - parseInt(tComapareTo);
                    document.getElementById('ctl00_Content_txtAudienceWomen').value = temp;
                }else if(parseInt(comp1) < parseInt(tComapareTo))
                {
                    temp = parseInt(tComapareTo) - parseInt(comp1);
                    document.getElementById('ctl00_Content_txtAudienceWomen').value = temp;
                }                
            }else if(cnt == 'ctl00_Content_txtAudienceWomen' && comp2 != 0) // if focus at women's
            {
                if(parseInt(comp2) >= parseInt(tComapareTo))
                {
                    comp2 = 100;
                    document.getElementById('ctl00_Content_txtAudienceWomen').value=100;
                    temp = parseInt(comp2) - parseInt(tComapareTo);
                    document.getElementById('ctl00_Content_txtAudienceMen').value = temp;
                }else if(parseInt(comp2) < parseInt(tComapareTo))
                {
                    temp = parseInt(tComapareTo) - parseInt(comp2);
                    document.getElementById('ctl00_Content_txtAudienceMen').value = temp;
                }                
            }
            
            /*
            if(parseInt(comp1) > parseInt(comp2))
            {
                //document.getElementById('ctl00_Content_txtAudienceMen').focus();
                document.getElementById('ctl00_Content_lblTotalPer').innerHTML = '<br>Total must be less than 100';
            }else if(parseInt(comp2) > parseInt(comp1))
            {
                //document.getElementById('ctl00_Content_txtAudienceWomen').focus();
                document.getElementById('ctl00_Content_lblTotalPer').innerHTML = '<br>Total must be less than 100';
            } */           
        }else if(parseInt(tSum) < parseInt(tComapareTo))      
        {
            var temp =0; 
            
            if(cnt == 'ctl00_Content_txtAudienceMen' && comp1 != 0) // if focus at men's
            {
                if(parseInt(comp1) >= parseInt(tComapareTo))
                {
                    comp1 = 100;
                    document.getElementById('ctl00_Content_txtAudienceMen').value=100;
                    temp = parseInt(comp1) - parseInt(tComapareTo);
                    document.getElementById('ctl00_Content_txtAudienceWomen').value = temp;
                }else if(parseInt(comp1) < parseInt(tComapareTo))
                {
                    temp = parseInt(tComapareTo) - parseInt(comp1);
                    document.getElementById('ctl00_Content_txtAudienceWomen').value = temp;
                }                
            }
            else if(cnt == 'ctl00_Content_txtAudienceWomen' && comp2 != 0) // if focus at women's
            {
                if(parseInt(comp2) >= parseInt(tComapareTo))
                {
                    comp2 = 100;
                    document.getElementById('ctl00_Content_txtAudienceWomen').value=100;
                    temp = parseInt(comp2) - parseInt(tComapareTo);
                    document.getElementById('ctl00_Content_txtAudienceMen').value = temp;
                }else if(parseInt(comp2) < parseInt(tComapareTo))
                {
                    temp = parseInt(tComapareTo) - parseInt(comp2);
                    document.getElementById('ctl00_Content_txtAudienceMen').value = temp;
                }                
            }
            
            if(cnt == 'ctl00_Content_txtAudienceMen' && comp1==0)
            {
             document.getElementById('ctl00_Content_txtAudienceMen').value=0;
             document.getElementById('ctl00_Content_txtAudienceWomen').value=100;
             comp2=100;
            }
            else if(cnt == 'ctl00_Content_txtAudienceWomen' && comp2==0)
            {
             document.getElementById('ctl00_Content_txtAudienceMen').value=100;
             document.getElementById('ctl00_Content_txtAudienceWomen').value=0;
             comp1=100;
            }
            
            //document.getElementById('ctl00_Content_lblTotalPer').innerHTML = '';
            /*
            if(parseInt(comp1)>parseInt(comp2))
            {
                var temp = parseInt(comp1) - parseInt(comp2);
                document.getElementById('ctl00_Content_txtAudienceWomen').value = parseInt(comp2) + parseInt(temp);
                if(document.getElementById('ctl00_Content_txtAudienceWomen').value<parseInt(tComapareTo))
                {
                    document.getElementById('ctl00_Content_txtAudienceWomen').value = parseInt(tComapareTo) - parseInt(document.getElementById('ctl00_Content_txtAudienceMen').value);
                }
            }else if(parseInt(comp2)>parseInt(comp1))
            {
                var temp = parseInt(comp2) - parseInt(comp1);
                
                document.getElementById('ctl00_Content_txtAudienceMen').value = parseInt(comp1) + parseInt(temp);
                
                if(document.getElementById('ctl00_Content_txtAudienceMen').value<tComapareTo)
                {
                    document.getElementById('ctl00_Content_txtAudienceMen').value = parseInt(tComapareTo) - parseInt(document.getElementById('ctl00_Content_txtAudienceWomen').value);
                }
            }*/
        }
    }else if(which == 'age')   
    {
        comp1 = document.getElementById('ctl00_Content_txtAudienceAge1').value;
        comp2 = document.getElementById('ctl00_Content_txtAudienceAge2').value; 
        comp3 = document.getElementById('ctl00_Content_txtAudienceAge3').value; 
        comp4 = document.getElementById('ctl00_Content_txtAudienceAge4').value; 
        comp5 = document.getElementById('ctl00_Content_txtAudienceAge5').value; 
        comp6 = document.getElementById('ctl00_Content_txtAudienceAge6').value; 
        
        
        if(comp1 == ''){comp1 = 0;}
        if(comp2 == ''){comp2 = 0;}
        if(comp3 == ''){comp3 = 0;}
        if(comp4 == ''){comp4 = 0;}
        if(comp5 == ''){comp5 = 0;}
        if(comp6 == ''){comp6 = 0;}
        
        tSum = parseInt(comp1) + parseInt(comp2) + parseInt(comp3) + parseInt(comp4) + parseInt(comp5) + parseInt(comp6);
        
        if(parseInt(tSum)>parseInt(tComapareTo))
        {
            //document.getElementById('ctl00_Content_txtAudienceAge1').focus();
            document.getElementById('ctl00_Content_lblTotalAgePer').innerHTML = '<br>Total must be equal to 100';
            
        }else if(parseInt(tSum) < parseInt(tComapareTo))
        {
            //document.getElementById('ctl00_Content_txtAudienceAge1').focus();
            document.getElementById('ctl00_Content_lblTotalAgePer').innerHTML = '<br>Total must be equal to 100';
        }else{
            document.getElementById('ctl00_Content_lblTotalAgePer').innerHTML = '';
        }
        
    }else if(which == 'house')   
    {
        comp1 = document.getElementById('ctl00_Content_txtAudienceIncome1').value;
        comp2 = document.getElementById('ctl00_Content_txtAudienceIncome2').value; 
        comp3 = document.getElementById('ctl00_Content_txtAudienceIncome3').value; 
        comp4 = document.getElementById('ctl00_Content_txtAudienceIncome4').value; 
        comp5 = document.getElementById('ctl00_Content_txtAudienceIncome5').value; 
        
        
        
        if(comp1 == ''){comp1 = 0;}
        if(comp2 == ''){comp2 = 0;}
        if(comp3 == ''){comp3 = 0;}
        if(comp4 == ''){comp4 = 0;}
        if(comp5 == ''){comp5 = 0;}        
        tSum=0;
        tSum = parseInt(comp1) + parseInt(comp2) + parseInt(comp3) + parseInt(comp4) + parseInt(comp5);
        
        if(parseInt(tSum)>parseInt(tComapareTo))
        {
            //document.getElementById('ctl00_Content_txtAudienceAge1').focus();
            document.getElementById('ctl00_Content_lblTotalHousePer').innerHTML = '<br>Total must be less than 100';
            
        }else if(parseInt(tSum) < parseInt(tComapareTo))
        {
            //document.getElementById('ctl00_Content_txtAudienceAge1').focus();
            document.getElementById('ctl00_Content_lblTotalHousePer').innerHTML = '<br>Total must be equal to 100';
        }else{
            document.getElementById('ctl00_Content_lblTotalHousePer').innerHTML = '';
        }
        
    }else if(which == 'inter')   
    {
        comp1 = document.getElementById('ctl00_Content_txtAudienceUAE').value;
        comp2 = document.getElementById('ctl00_Content_txtAudienceGCC').value; 
        comp3 = document.getElementById('ctl00_Content_txtAudienceInternational').value; 
        
        if(comp1 == ''){comp1 = 0;}
        if(comp2 == ''){comp2 = 0;}
        if(comp3 == ''){comp3 = 0;}
                
        tSum=0;
        tSum = parseInt(comp1) + parseInt(comp2) + parseInt(comp3);
        
        if(parseInt(tSum)>parseInt(tComapareTo))
        {
            //document.getElementById('ctl00_Content_txtAudienceAge1').focus();
            document.getElementById('ctl00_Content_lblTotalInterPer').innerHTML = '<br>Total must be less than 100';
            
        }else if(parseInt(tSum) < parseInt(tComapareTo))
        {
            //document.getElementById('ctl00_Content_txtAudienceAge1').focus();
            document.getElementById('ctl00_Content_lblTotalInterPer').innerHTML = '<br>Total must be equal to 100';
        }else{
            document.getElementById('ctl00_Content_lblTotalInterPer').innerHTML = '';
        }        
    }
}

function ValidateSpon()
{
  var tabStrip = $find('ctl00_Content_rdTabSponsorShip');   
  if(tabStrip != null)
  {
    //var flag0=Page_ClientValidate('UserRegistration');
    var flag1 = Page_ClientValidate('Event');
    
  }
  if(document.getElementById('ctl00_Content_hfEditMode') != null)
  {
     if(document.getElementById('ctl00_Content_hfEditMode').value == '0')
     {
            if(document.getElementById("ctl00_Content_btnSave") != null)
            {
                document.getElementById("ctl00_Content_btnSave").style.display="block";
            }
      }
   }
}
 function OpenParticipate(uname)
 {
   window.open(apath+"competitions/popup/"+uname+".aspx",'competitionpopup',"status=0,toolbar=0,scrollbars=yes,width=712,Height=700"); 
 }
 
 
 
 /* SponsorShip New Scripts By ramesh June 10,2k10 */
function ChecShowTextBoxeskMediaVisibility_BroadCast()
{
  var  BroadCastcheckedItemValue=0;
  if(document.getElementById('ctl00_Content_rdLive').checked)
  {
    BroadCastcheckedItemValue=1;
  }
  else if(document.getElementById('ctl00_Content_rdRec').checked)
  {
    BroadCastcheckedItemValue=2;
  }
  else if(document.getElementById('ctl00_Content_rdNoBroad').checked)
  {
    BroadCastcheckedItemValue=3;
  }
  
  if(BroadCastcheckedItemValue >0)
  {
    showHideBroad1(BroadCastcheckedItemValue);
  }
  
}
function ChecShowTextBoxeskMediaVisibility_Radio()
{
  var  RadiocheckedItemValue=0;
  if(document.getElementById('ctl00_Content_rdAirtime').checked)
  {
    RadiocheckedItemValue=1;
  }
  else if(document.getElementById('ctl00_Content_rdNoAirtime').checked)
  {
    RadiocheckedItemValue=2;
  }
  if(RadiocheckedItemValue >0)
  {
    showHideRadio1(RadiocheckedItemValue);
  }
  
}

function ChecShowTextBoxeskEventProductSponsorShip_SponsorShipType()
{
   if(document.getElementById('ctl00_Content_rdlType_5').checked)
   {
       document.getElementById('ctl00_Content_txtType').style.display = "block";
       if(document.getElementById('ctl00_Content_txtType').value =="")
       {
         document.getElementById('ctl00_Content_lblValidatorSponsertype').innerHTML = "*";   
       }
       else {document.getElementById('ctl00_Content_lblValidatorSponsertype').innerHTML = "";}
       
   }
   else
   {
         document.getElementById('ctl00_Content_txtType').style.display = "none";                        
   }
}
function ChecShowTextBoxeskEventProductSponsorShip_SponsorShipLevel()
{
  if(document.getElementById('ctl00_Content_rdlLevel_4').checked)
   {
       document.getElementById('ctl00_Content_txtLevel').style.display = "block";
       
       if(document.getElementById('ctl00_Content_txtLevel').value =="")
       {
         document.getElementById('ctl00_Content_lblValidatorSponserLevel').innerHTML = "*";
       }
       else {document.getElementById('ctl00_Content_lblValidatorSponserLevel').innerHTML = "";}   
   }
   else
   {
         document.getElementById('ctl00_Content_txtLevel').style.display = "none";                        
   }
}
function ChecShowTextBoxeskEventProductSponsorShip_GoverningBody()
{
  var  GovBodycheckedItemValue=0;
  if(document.getElementById('ctl00_Content_rdGovYes').checked)
  {
    GovBodycheckedItemValue=1;
  }
  else if(document.getElementById('ctl00_Content_rdGovNo').checked)
  {
    GovBodycheckedItemValue=2;
  }
  if(GovBodycheckedItemValue >0)
  {
    showHideGovBody1(GovBodycheckedItemValue); 
  }
  
}