﻿
function qs( 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 a_href_with_qs(DeviceUrl)
{
    // Create the indications url from the passed parameter so we can have one file for us and intl
    
    // Find the name, location, and type passed
    var name        =       qs('name');
    var location    =   qs('location');
    var type        = qs('type');
    // DeviceUrl includes ?Section=
    var url = DeviceUrl + '&name='+name+'&location='+location+'&type='+type;
    //alert('Url  '+url);
    //window.open(url);
    window.location.href = url;
}

function a_href_plus_location(DeviceUrl)
{
    // Create the indications url from the passed parameter so we can have one file for us and intl
    
    // Find the location  
    var location    =   qs('location');
  
    // DeviceUrl includes ?param=, we're just adding location
    var url = DeviceUrl + '&location='+location;
    //alert('Url  '+url);
    //window.open(url);
    window.location.href = url;
}

function a_href_plus_location_additional_parms(DeviceUrl,AdditionalParms)
{
    // Create the indications url from the passed parameter so we can have one file for us and intl
    
    // Find the location  
    var location    =   qs('location');
  
    // DeviceUrl includes ?param=, we're just adding location
    var url = DeviceUrl + '&location='+location+AdditionalParms;
    //alert('Url  '+url);
    //window.open(url);
    window.location.href = url;
}

function caution_if_us()
{
     // Find the location  
    var location    =   qs('location');
    
    if (location == 'us')
    {    
        document.write('<p><strong>Caution:</strong> Federal law (USA) restricts this device to sale by or on the order of a physician.</p>');
    }
}

function link_us_or_in(StringUs,StringIn)
{
    var String = StringUs;
    
    // Find the location  
    var location    =   qs('location');
    if (location == 'in')
    {    
        String = StringIn;
    }
    
    window.open(String);
}

function str_us_or_in(StringUs,StringIn)
{
    var String = StringUs;
    
    // Find the location  
    var location    =   qs('location');
    if (location == 'in')
    {    
        String = StringIn;
    }
    
    document.write(String);
}