
function getQuerystringFromVar(qs, key, default_)
{

  if (default_==null) default_="";
  key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
  var qs = regex.exec(qs);
  if(qs == null)
    return default_;
  else
    return qs[1];
}

function getQuerystring(key, default_)
{
    return getQuerystringFromVar(window.location.href, key, default_);
}

function cleanString(text){
  newText =text;
  while(newText.indexOf(";;") !== -1){
        newText = newText.replace(";;",";");
    }//endwhile
    
    while(newText.indexOf(" ") !== -1){
        newText = newText.replace(" ","");
    }//endwhile
      
    while(newText.indexOf("%20") !== -1){
        newText = newText.replace("%20","");
    }//endwhile
    
    return newText;
}

function cleanQuerystring(qs,key, default_){
  newText = cleanString(";" + getQuerystringFromVar(qs,key,default_).toLowerCase() + ";");
  
 
  
  return newText;
}//cleanUpText





