//=====================================================
//this function return  searched parametr 
//index       - searched parametr 
//documentRef-  laval  document

	function getQueryStringRef(index, documentRef){
       
        //This function gets the query string index and return its value

 

        //Init QueryString

        var queryString = new Array();  //Saves all the query strings

        queryString = documentRef.location.search.substring(1).split("&");

        

        var wasFound = false;

        var i=0;

        var returnValue = "";

        

        while ((!wasFound) && i < queryString.length){

            

            if (queryString[i].toLowerCase().indexOf(index.toLowerCase() + "=") != -1){

                

                //Set as found

                wasFound = true;

                

                //Set the return value

                returnValue = queryString[i].substring(index.length + 1);

            

            }

            

            i++;

        }

 

        return DecodeURL(returnValue);

    

    }

    

    function DecodeURL (encodStr)

    {

        //This function gets a URL encoded string (encodStr)

        //And returns a decoded string

        

        //Set the inputString as outputString

        outputStr = encodStr;

        

        //create vars for later use

        var bnValue, currStr;

        

        //Create a formatted strcture to search in the input string

        var urlRegEx = /(%[^%]{2})/;

        

        //While we can find in the string

        while ((match = urlRegEx.exec(outputStr)) != null && match.length > 1 && match[1] != '') 

        {

            //Decode

            bnValue = parseInt(match[1].substr(1),16);

            currStr = String.fromCharCode(bnValue);

            outputStr = outputStr.replace(match[1], currStr);

        }

        

        //Reurn the output str

        return outputStr;

    

    }
    