var baseUrl  ; 

function SetCorrectUrl(string)
{
   baseUrl = string ;}

function ReplaceUrl(str) {
  
    document.location = baseUrl + str;
}

var fixedBaseUrl ;

function OpenUrl(newLocation) {

   if (fixedBaseUrl=='' || fixedBaseUrl==null || fixedBaseUrl==undefined)
   {
        window.parent.location.href =  newLocation;
   }
   else 
   {
       //check if fixedBaseUrl  contains '/' at the end
       if (fixedBaseUrl.charAt(fixedBaseUrl.length - 1) == '/') {
           window.parent.location.href = fixedBaseUrl + newLocation;
       }
       else {
           window.parent.location.href = fixedBaseUrl + "/" + newLocation;              
       }
   }
}