﻿/* ************************************************************************
* File  : Nicam.js                                       Part of Sitecore *
* Version: 1.00                                          www.sitecore.net *
* Author : Alexandr Tsvirchkov                                            *
*                                                                         *
* Copyright (C) 1999-2008 by SiteCore A/S. All rights reserved.           *
* *********************************************************************** */
// -------------------------------------------------------------
// -      Open Window. For IE open Modal Window
// -------------------------------------------------------------
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);
}
