﻿

/* ****** START JQUERY ****** */
$(document).ready(function() {

    $(".alerts:empty").remove();

});
/* ******  END JQUERY  ****** */

// Read a paramater from the query string - example: getParameter('error')
function getParameter(name)
{
	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	var regexS = "[\\?&]"+name+"=([^&#]*)";
	var regex = new RegExp(regexS);
	var results = regex.exec(window.location.href);
	if(results == null) return "";
	else return results[1];
}


function open_window(URL,name,left,top,width,height,menubar){
  // if IE then use modal window (it's a bit quicker)
  var left = (screen.width/2)-(width/2);
  var top = (screen.height/2)-(height/2);
  rp=window.open(URL,"_blank","top="+top+",left="+left+",height="+height+",width="+width+",menubar="+menubar+",scrollbars=0,resizable=0,status=0"); 
  rp.focus();
  return(true);
}


function Rate_Page(URL){
  open_window(URL, "Rate Page",0,0,245,170,0);
}


function refreshParent() {
    if (window.opener.location)
    {
      window.opener.location.reload();
    }
    self.close();
}

// -------------------------------------------------------------
// -      Add sParam=sVal in Query String and goto to the new href
// -------------------------------------------------------------        
function GotoHref(URL, sParam, sVal){
  var arrGet, i, sBeforeQuestion, sAfterQuestion, sNewURL
  i=URL.indexOf("?");
  URL=URL.replace("#","");
  if (i!==-1){
    sBeforeQuestion= URL.substr(0,i);
    sAfterQuestion = URL.substr(i+1);
  }
  else{
    sBeforeQuestion= URL;
    sAfterQuestion = "";
  }
  sNewURL="";
  if (sAfterQuestion!=""){
    arrGet=sAfterQuestion.split("&");
    for (i=0;i<=arrGet.length-1;i++){
      // Cut old sParam if exist
      if (arrGet[i].split("=")[0]!=sParam)
      {
        sNewURL+=(sNewURL.substr(0)!="&" ? "&" : "" )+arrGet[i];
      }
    }
  }
  sNewURL=sParam+"="+sVal+sNewURL;
  document.location.href=sBeforeQuestion+"?"+sNewURL;
  return(true);
}
function PerformSearch()
{
    //alert("Searching ...");
    document.forms[0].submit();
    return false;
}
