﻿
    function EmailCheck() {
        var txtvalue;
        var msg = "Please enter a valid email address";
        var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
        txtvalue = document.getElementById("txtEmailAddress").value.trim();
  
       
        if ((!filter.test(txtvalue))||(txtvalue==""))
         {

            document.getElementById("lblSignUpError").innerHTML = msg;
            document.getElementById("txtEmailAddress").value = "";
            document.getElementById("txtEmailAddress").focus();
            return false;
        }
       
        return true;
    }

           function ShowModal(ModalPopup) {

            if ($find(ModalPopup) != null) {
                $find(ModalPopup).show();
                if (navigator.appName == "Microsoft Internet Explorer")
                               pngCorrection(document.getElementById("imgClose").id);
  

            }
        } 
    function pngCorrection(img) 
    {     
    if (navigator.appName == "Microsoft Internet Explorer")
    {
       var arVersion = navigator.appVersion.split("MSIE");
	    var version = parseFloat(arVersion[1]);
	    if ((version >= 5.5))
	     {
	        var img = document.getElementById(img);
	        if(img.src!=null)
	        {
	             var imgName = img.src.toUpperCase();
	            if (imgName.substring(imgName.length - 3, imgName.length) == "PNG")
	             {
	                var imgID = (img.id) ? "id='" + img.id + "' " : "";
	                //alert(imgID);
	                var imgClass = (img.className) ? "class='" + img.className + "' " : "";
	                //alert(imgClass);
	                var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
	                //alert(imgTitle);
	                var imgStyle = "display:inline-block;" + img.style.cssText;
	                //alert(imgStyle);
	                if (img.align == "left") imgStyle = "float:left;" + imgStyle;
	                if (img.align == "right") imgStyle = "float:right;" + imgStyle;
	                if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
	                var strNewHTML = "<span " + imgID + imgClass + imgTitle
						        + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
						        + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
						        + "(src=\'" + img.src + "\', sizingMethod='');\"></span>";
	                img.outerHTML = strNewHTML;
	                //alert(img.outerHTML);
	               
	            }
	        }
	    }
    }
    }
    function setTimeIntervalToHide()
    {
     window.setTimeout(function(){
      document.getElementById("divSignupMessage").style.display='none';
      document.getElementById("dvBetaReleaseLogin").style.display='';
      document.getElementById("txtEmailAddress").value = "";
      document.getElementById("txtEmailAddress").focus();
      document.getElementById("btnSignUp").focus();
     
       },20000);
       }
       
    function forceClick(e, elemId)
      {  
       
        var elem = document.getElementById(elemId);
        var intKey = (e.which) ? e.which : e.keyCode;
        if(intKey == 13) 
        {
        if(EmailCheck())
        {
        __doPostBack(elemId,'');
         }
         e.returnValue = false;
            e.cancel=true;
                    try
                    {
                        e.returnValue = false;
                        e.cancelBubble = true;

                        if(document.all)
                        { //IE
                            e.keyCode = 0;
                        }else
                        { //NS
                            e.preventDefault();
                            e.stopPropagation();
                        }
                    }catch(ex)
                    {
                       
                    }
                    return false;
        }
        }
        
        function clearText()
        {
        if(document.getElementById("lblSignUpError").innerHTML!="")
        { document.getElementById("lblSignUpError").innerHTML="";
        }
         document.getElementById("txtEmailAddress").value = "";
        }
        
    function catchEsc(e)
    {
        var kC  = (window.event) ?    // MSIE or Firefox?
                 event.keyCode : e.keyCode;
      var Esc = (window.event) ?   
                27 : e.DOM_VK_ESCAPE // MSIE : Firefox

      if(kC==Esc)
        {

        if($find('ModalPopupPrivacy')!=null)
         {
            $find('ModalPopupPrivacy').hide();
         }
         }
         }
function EnablefeedbackButton()
   {
  // '<% =lblcommentcount.ClientID %>'
   if( document.getElementById('txtfeedbackcomments').value.length<=0)
   {
    document.getElementById('btnsendfeedback').disabled=true;
   }
   else
   {
       document.getElementById('btnsendfeedback').disabled=false;
   }
   CharCounters("txtfeedbackcomments");
   }
   
   
   function CharCounters(textId)
    {
    var totalchar = 1000;
    var txtbox = document.getElementById(textId);
    var lbl = document.getElementById('lblcommentcount');
    if(txtbox.value.length > totalchar)
    {
    txtbox.value = txtbox.value.substring(0,totalchar);
    }
    lbl.innerHTML = (totalchar - txtbox.value.length) + " chars remaining" ;
    }