﻿//function hashCheck()
//{
//    var hashVal = window.location.hash;
//    if(hashVal.length > 1){
//        validate(hashVal.substring(1));
//    }
//}

function initialiseStateFromURL() {
        var hashVal = window.location.hash;
        if(hashVal.length > 1){
        
 //alert("nomatch2")
            //validate(hashVal.substring(1));
        }
   }

 recentHash = "";
 var runningHash = false;
   function pollHash() {
   if (runningHash == false)
    {
        setInterval(pollHash, 1000);
        runningHash = true;
        //alert("check")
    }
//  alert(window.location.hash)
 // alert(recentHash);
    
     
     
//     if (window.location.hash=="#" && recentHash=="" || (window.location.hash=="" && recentHash=="") )
//       {
//       window.location.hash = recentHash;
//       return;
//       }
     if (window.location.hash==recentHash && (window.location.hash!="")) {
       return; // Nothing's changed since last polled.
     }
     if ((window.location.hash=="" && recentHash=="#") || (window.location.hash=="#" && recentHash=="") || (window.location.hash=="" && recentHash=="") )//|| (window.location.hash=="#" && recentHash=="#index.aspx") || (window.location.hash=="" && recentHash=="#index.aspx") || (window.location.hash=="#index.aspx" && recentHash=="") ) 
    {
       recentHash = "#index.aspx"
       window.location.hash = recentHash;
        
     }
     if ((window.location.hash=="" ) || (window.location.hash=="#") )
    {
       window.location.hash = recentHash;
       return;
     }
//     if (window.location.hash=="#" && recentHash=="" || (window.location.hash=="" && recentHash=="") )
//       {
//       window.location.hash = recentHash;
//       return;
//       }
//       
//       
//     if (window.location.hash==recentHash) {
//     return; // Nothing's changed since last polled.
//     }
// alert(recentHash)
// alert(window.location.hash)
     recentHash = window.location.hash;
     // URL has changed, update the UI accordingly.
     
     
     validate(recentHash.substring(1));
     
     
  
   }
//   function pollHash2() {
//        setInterval(pollHash2, 1000);
//  
//   }

