﻿function getElement(aID)
    { 
        return (document.getElementById) ? document.getElementById(aID) : document.all[aID];
    }
    function ShowHideDiv()
    {
   
	    try
	    {
	    
	        var obj = document.getElementById("DivResults");
    	    
	        var b = document.getElementById("Comments");
    	    
	        if ( obj != null )
	        {
	            var currentdisplay = obj.style.display;
    	        
	            if ( currentdisplay == "none" )
	            {
	                obj.style.display = "block";
	                
	                b.style.display ="none"
	            }
	            else if ( currentdisplay == "block" )
	            {
	                obj.style.display = "none";
	            }
	            else 
	            {
	                obj.style.display = "none";
	            }
		    }
		    
	    }
	    catch(e)
	    {
	    
	    }
    }
    
     function ShowHideDiv2()
    {    
	    try
	    {
	        var obj2 = document.getElementById("Comments");
	        
	        var a = document.getElementById("DivResults");
	        
	        //var obj2 = getElement(Ctrl);
    	    
	        if ( obj2 != null )
	        {
	            var currentdisplay = obj2.style.display;
	  
    	        //document.getElementById("DivResults").innerHTML="";
    	        
	            if ( currentdisplay == "none" )
	            {
	                obj2.style.display = "block";
	                a.style.display ="none"
	            }
	            else if ( currentdisplay == "block" )
	            {
	                obj2.style.display = "none";
	            }
	         else 
	            {
	                obj2.style.display = "none";
	                
	            }
		    }
		    
	    }
	    catch(e)
	    {
	    
	    }
    }
    

 
 ////////////
 
 function validateSpecialChars(Test)
     {
     
      var illegalChars = "@#$%^&*+=-[]\\\';/{}|\<>?";
      var strToSearch = document.getElementById("Test").value;

      for (var i = 0; i < strToSearch.length; i++)
   
            {
            if (illegalChars.indexOf(strToSearch.charAt(i)) != -1)
                {
                alert ("Your Comment has one of the following special characters:\n" + illegalChars + "\nThese are not allowed.\nPlease remove them and try again.");
  
                return false;
                }
            }
      }
      
function name1(name_box)
     {
     
      var illegalChars = "!@#$%^&*()+=-[]\\\';/{}|\:<>?";
      var strToSearch = document.getElementById("name_box").value;

      for (var i = 0; i < strToSearch.length; i++)
   
            {
            if (illegalChars.indexOf(strToSearch.charAt(i)) != -1)
                {
                alert ("Your Comment has one of the following special characters:\n" + illegalChars + "\nThese are not allowed.\nPlease remove them and try again.");
  
                return false;
                }
            }
      }
      
function city(city_box)
     {
     
      var illegalChars = "!@#$%^&*()+=-[]\\\';/{}|\:<>?";
      var strToSearch = document.getElementById("city_box").value;

      for (var i = 0; i < strToSearch.length; i++)
   
            {
            if (illegalChars.indexOf(strToSearch.charAt(i)) != -1)
                {
                alert ("Your Comment has one of the following special characters:\n" + illegalChars + "\nThese are not allowed.\nPlease remove them and try again.");
  
                return false;
                }
            }
      }
      
function email2(email_box)
     {
     
      var illegalChars = "!#$%^&*()+=-[]\\\';/{}|\:<>?";
      var strToSearch = document.getElementById("email_box").value;

      for (var i = 0; i < strToSearch.length; i++)
   
            {
            if (illegalChars.indexOf(strToSearch.charAt(i)) != -1)
                {
                alert ("Your Comment has one of the following special characters:\n" + illegalChars + "\nThese are not allowed.\nPlease remove them and try again.");
  
                return false;
                }
            }
      }
      
       maxL=500;
var bName = navigator.appName;
function taLimit(taObj) {
	if (taObj.value.length==maxL) return false;
	return true;
}

function taCount(taObj,Cnt) { 
	objCnt=createObject(Cnt);
	objVal=taObj.value;
	if (objVal.length>maxL) objVal=objVal.substring(0,maxL);
	if (objCnt) {
		if(bName == "Netscape"){	
			objCnt.textContent=maxL-objVal.length;}
		else{objCnt.innerText=maxL-objVal.length;}
	}
	return true;
}
function createObject(objId) {
	if (document.getElementById) return document.getElementById(objId);
	else if (document.layers) return eval("document." + objId);
	else if (document.all) return eval("document.all." + objId);
	else return eval("document." + objId);
}

    function PassValue() 

    {

    var ID = window.location.search.substring(1);
    window.open("print.aspx?type=ENG&" + ID, "" ,"top=0,left=0,width=820,height=600, scrollbars=yes, menubar=no,toolbar=no,status=no,resizable=no,addressbar=no");

    }
    
    function PassValue2() 

    {

    var ID = window.location.search.substring(1);
    window.open("print.aspx?type=URD&" + ID, "" ,"top=0,left=0,width=820,height=600, scrollbars=yes, menubar=no,toolbar=no,status=no,resizable=no,addressbar=no");

    }
    
    function email() 

    {

    var ID = window.location.search.substring(1);
    window.open("emailtoFriend.aspx?type=ENG&" + ID, "" ,"top=0,left=0,width=450,height=530,scrollbars=no, menubar=no,toolbar=no,status=no,resizable=no,addressbar=no");

    }
    
        function email2() 

    {

    var ID = window.location.search.substring(1);
    window.open("emailtoFriend.aspx?type=URD&" + ID, "" ,"top=0,left=0,width=450,height=530,scrollbars=no, menubar=no,toolbar=no,status=no,resizable=no,addressbar=no");

    }